From f54f9bfb90311f19e9a517e4388ee24daefaa3dc Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 9 Jul 2025 09:57:11 -0600 Subject: [PATCH 1/6] fix custom fee on desktop --- .../sub_widgets/desktop_send_fee_form.dart | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart index 6b08923ab..69757ac7c 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send_fee_form.dart @@ -55,7 +55,15 @@ class _DesktopSendFeeFormState extends ConsumerState { bool get isEth => cryptoCurrency is Ethereum; - bool isCustomFee = false; + bool _isCustomFeeValue = false; + bool get _isCustomFee => _isCustomFeeValue; + set _isCustomFee(bool newValue) { + if (_isCustomFeeValue != newValue) { + _isCustomFeeValue = newValue; + widget.onCustomFeeOptionChanged.call(_isCustomFeeValue); + } + } + (FeeRateType, String?, String?)? feeSelectionResult; @override @@ -97,12 +105,12 @@ class _DesktopSendFeeFormState extends ConsumerState { ); if (feeSelectionResult != null) { - if (isCustomFee && + if (_isCustomFee && feeSelectionResult!.$1 != FeeRateType.custom) { - isCustomFee = false; - } else if (!isCustomFee && + _isCustomFee = false; + } else if (!_isCustomFee && feeSelectionResult!.$1 == FeeRateType.custom) { - isCustomFee = true; + _isCustomFee = true; } } @@ -113,7 +121,7 @@ class _DesktopSendFeeFormState extends ConsumerState { ), child: Text( "Transaction fee" - "${isCustomFee ? "" : " (${isEth ? "max" : "estimated"})"}", + "${_isCustomFee ? "" : " (${isEth ? "max" : "estimated"})"}", style: STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of( @@ -124,7 +132,7 @@ class _DesktopSendFeeFormState extends ConsumerState { ), ), const SizedBox(height: 10), - if (!isCustomFee) + if (!_isCustomFee) Padding( padding: const EdgeInsets.all(10), child: @@ -275,7 +283,7 @@ class _DesktopSendFeeFormState extends ConsumerState { ], ), ), - if (isCustomFee && isEth) + if (_isCustomFee && isEth) EthFeeForm( minGasLimit: widget.isToken @@ -284,7 +292,7 @@ class _DesktopSendFeeFormState extends ConsumerState { stateChanged: (value) => widget.onCustomEip1559FeeOptionChanged?.call(value), ), - if (isCustomFee && !isEth) + if (_isCustomFee && !isEth) Padding( padding: const EdgeInsets.only(bottom: 12, top: 16), child: FeeSlider( From 6d0a95e01a65f84a4ac68e35af6bf1fdefbc765b Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 15 Jul 2025 07:53:43 -0600 Subject: [PATCH 2/6] fix mweb output spent status (balance fix) --- .../mweb_interface.dart | 76 +++++++++---------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart index a870aaa1e..4480ef81b 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart @@ -216,17 +216,28 @@ mixin MwebInterface (e) => e.outputId.equals(utxo.outputId), )).getSingleOrNull(); - final newUtxo = MwebUtxosCompanion( - outputId: Value(prev?.outputId ?? utxo.outputId), - address: Value(prev?.address ?? utxo.address), - value: Value(utxo.value.toInt()), - height: Value(utxo.height), - blockTime: Value(utxo.blockTime), - blocked: Value(prev?.blocked ?? false), - used: Value(prev?.used ?? false), - ); + if (prev == null) { + final newUtxo = MwebUtxosCompanion( + outputId: Value(utxo.outputId), + address: Value(utxo.address), + value: Value(utxo.value.toInt()), + height: Value(utxo.height), + blockTime: Value(utxo.blockTime), + blocked: const Value(false), + used: const Value(false), + ); - await db.into(db.mwebUtxos).insertOnConflictUpdate(newUtxo); + await db.into(db.mwebUtxos).insert(newUtxo); + } else { + await db + .update(db.mwebUtxos) + .replace( + prev.copyWith( + blockTime: utxo.blockTime, + height: utxo.height, + ), + ); + } }); Address? addr = await mainDB.getAddress(walletId, utxo.address); @@ -469,7 +480,19 @@ mixin MwebInterface ); // Update used mweb utxos as used in database - await _checkSpentMwebUtxos(); + final usedMwebUtxos = + txData.usedUTXOs!.whereType().map((e) => e.utxo).toList(); + + Logging.instance.i("Used mweb inputs: $usedMwebUtxos"); + + if (usedMwebUtxos.isNotEmpty) { + final db = Drift.get(walletId); + await db.transaction(() async { + for (final used in usedMwebUtxos) { + await db.update(db.mwebUtxos).replace(used); + } + }); + } return await updateSentCachedTxData(txData: txData); } catch (e, s) { @@ -583,35 +606,6 @@ mixin MwebInterface } } - Future _checkSpentMwebUtxos() async { - try { - final db = Drift.get(walletId); - final mwebUtxos = await db.select(db.mwebUtxos).get(); - - final client = await _client; - - final spent = await client.spent( - SpentRequest(outputId: mwebUtxos.map((e) => e.outputId)), - ); - - await db.transaction(() async { - for (final utxo in mwebUtxos) { - await db - .into(db.mwebUtxos) - .insertOnConflictUpdate( - utxo - .toCompanion(false) - .copyWith( - used: Value(spent.outputId.contains(utxo.outputId)), - ), - ); - } - }); - } catch (e, s) { - Logging.instance.e("_checkSpentMwebUtxos()", error: e, stackTrace: s); - } - } - Future _checkAddresses() async { // check change first as it is index 0 Address? changeAddress = await getMwebChangeAddress(); @@ -667,8 +661,6 @@ mixin MwebInterface if (info.isMwebEnabled) { final start = DateTime.now(); try { - await _checkSpentMwebUtxos(); - final currentHeight = await chainHeight; final db = Drift.get(walletId); final mwebUtxos = From c73fef657a4ed51e32289838331c2323cc8c35f5 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 15 Jul 2025 08:03:29 -0600 Subject: [PATCH 3/6] fix missing coin control option --- lib/pages/send_view/send_view.dart | 2 +- .../my_stack_view/wallet_view/sub_widgets/desktop_send.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 9ac52806f..76aebaf33 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -1222,7 +1222,7 @@ class _SendViewState extends ConsumerState { ), ) && ref.watch(pWallets).getWallet(walletId) is CoinControlInterface && - balType == BalanceType.public; + (showPrivateBalance ? balType == BalanceType.public : true); final isExchangeAddress = ref.watch(pIsExchangeAddress); diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index 567f3a94a..dd3a70f9d 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -1052,7 +1052,7 @@ class _DesktopSendState extends ConsumerState { ), ) && ref.watch(pWallets).getWallet(walletId) is CoinControlInterface && - balType == BalanceType.public; + (showPrivateBalance ? balType == BalanceType.public : true); return Column( crossAxisAlignment: CrossAxisAlignment.start, From d642b8f89a1a1363c85d81f671fd76c5d9c3aa9b Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 15 Jul 2025 09:12:23 -0600 Subject: [PATCH 4/6] update salvium dep --- pubspec.lock | 12 ++++++------ scripts/app_config/templates/pubspec.template | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 66cfe0e85..6113ff410 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -532,18 +532,18 @@ packages: dependency: "direct main" description: name: cs_salvium - sha256: "5711a9b547e9e5ba1d91e1c6b37ba94803b0b7c6ef56baf245b270e2a637b839" + sha256: "838a2f21b0ad567f68a5294360c4c96727b722037ae7bfdc26651c99d6c26bd3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" cs_salvium_flutter_libs: dependency: "direct main" description: name: cs_salvium_flutter_libs - sha256: cb2759e3d0829251cb13daa9e012f7821d9717ec1f1dedc9329c4012f99f386c + sha256: d7b6d257a2279526fb67f8f45f835e6432a221e231949829a26272d2bfd35b2b url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.0.3" cs_salvium_flutter_libs_android: dependency: transitive description: @@ -580,10 +580,10 @@ packages: dependency: transitive description: name: cs_salvium_flutter_libs_ios - sha256: "4c11cc7499ca7d3a8c0f2b29fcb4eaf4cd1475c5752f34856a3d4c0b721a6319" + sha256: "62739c13186aa4a89dd8dcb04ec7f7a01976a77a7cfa46172434b7c56b93938f" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" cs_salvium_flutter_libs_linux: dependency: transitive description: diff --git a/scripts/app_config/templates/pubspec.template b/scripts/app_config/templates/pubspec.template index 4e60e7857..d5fb421dc 100644 --- a/scripts/app_config/templates/pubspec.template +++ b/scripts/app_config/templates/pubspec.template @@ -222,8 +222,8 @@ dependencies: drift: ^2.22.1 drift_flutter: ^0.2.3 path: ^1.9.1 - cs_salvium: ^1.2.0 - cs_salvium_flutter_libs: ^1.0.2 + cs_salvium: ^1.2.1 + cs_salvium_flutter_libs: ^1.0.3 flutter_mwebd: ^0.0.1-pre.6 mweb_client: ^0.2.0 fixnum: ^1.1.1 From 1896c7f5bcf8694e593f5c5dc9ed9b260efe8362 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 15 Jul 2025 10:23:23 -0600 Subject: [PATCH 5/6] taproot address null error fix --- lib/wallets/crypto_currency/coins/bitcoin_frost.dart | 1 + .../crypto_currency/interfaces/electrumx_currency_interface.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/wallets/crypto_currency/coins/bitcoin_frost.dart b/lib/wallets/crypto_currency/coins/bitcoin_frost.dart index 3edaea351..b24316b52 100644 --- a/lib/wallets/crypto_currency/coins/bitcoin_frost.dart +++ b/lib/wallets/crypto_currency/coins/bitcoin_frost.dart @@ -255,6 +255,7 @@ class BitcoinFrost extends FrostCurrency { final clAddress = cl.Address.fromString(address, networkParams); return switch (clAddress) { + cl.P2TRAddress() => AddressType.p2tr, cl.P2PKHAddress() => AddressType.p2pkh, cl.P2WSHAddress() => AddressType.p2sh, cl.P2WPKHAddress() => AddressType.p2wpkh, diff --git a/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart b/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart index c9d0da2b9..9cc01cf64 100644 --- a/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart +++ b/lib/wallets/crypto_currency/interfaces/electrumx_currency_interface.dart @@ -18,6 +18,7 @@ mixin ElectrumXCurrencyInterface on Bip39HDCurrency { cl.P2PKHAddress() => AddressType.p2pkh, cl.P2WSHAddress() => AddressType.p2sh, cl.P2WPKHAddress() => AddressType.p2wpkh, + cl.P2TRAddress() => AddressType.p2tr, cl.MwebAddress() => AddressType.mweb, _ => null, }; From a8dd5ebdb1c4883495477cf5241c60949c8c38ae Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 15 Jul 2025 13:02:04 -0600 Subject: [PATCH 6/6] salvium ios lib fix should be there now --- pubspec.lock | 8 ++++---- scripts/app_config/templates/pubspec.template | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 6113ff410..39d500ae1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -540,10 +540,10 @@ packages: dependency: "direct main" description: name: cs_salvium_flutter_libs - sha256: d7b6d257a2279526fb67f8f45f835e6432a221e231949829a26272d2bfd35b2b + sha256: d1e49ed67632f77d863ad3eafc78db8867f155cf9decf156345ec75c92e0d026 url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" cs_salvium_flutter_libs_android: dependency: transitive description: @@ -580,10 +580,10 @@ packages: dependency: transitive description: name: cs_salvium_flutter_libs_ios - sha256: "62739c13186aa4a89dd8dcb04ec7f7a01976a77a7cfa46172434b7c56b93938f" + sha256: "54d18fbac60c8a602e4d0f967ea7d02fab71bff3e032f9576e159229ce372534" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" cs_salvium_flutter_libs_linux: dependency: transitive description: diff --git a/scripts/app_config/templates/pubspec.template b/scripts/app_config/templates/pubspec.template index d5fb421dc..ae6032744 100644 --- a/scripts/app_config/templates/pubspec.template +++ b/scripts/app_config/templates/pubspec.template @@ -223,7 +223,7 @@ dependencies: drift_flutter: ^0.2.3 path: ^1.9.1 cs_salvium: ^1.2.1 - cs_salvium_flutter_libs: ^1.0.3 + cs_salvium_flutter_libs: ^1.0.4 flutter_mwebd: ^0.0.1-pre.6 mweb_client: ^0.2.0 fixnum: ^1.1.1