From 84cc0576d56abed644866cbbfe95fd1b6fb7ddad Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Tue, 31 Dec 2024 17:03:17 +0200 Subject: [PATCH 01/14] fix creating associated token account (#1918) --- cw_solana/lib/solana_client.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/cw_solana/lib/solana_client.dart b/cw_solana/lib/solana_client.dart index 9412b4e9c..16f8988b1 100644 --- a/cw_solana/lib/solana_client.dart +++ b/cw_solana/lib/solana_client.dart @@ -618,8 +618,6 @@ class SolanaWalletClient { signedTransaction.encode(), preflightCommitment: commitment, ); - print("#########"); - print(signature); _client!.waitForSignatureStatus(signature, status: commitment); From a2cb994c09352eb85ff5d8909aa07ad37933bbb7 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Tue, 31 Dec 2024 17:03:36 +0200 Subject: [PATCH 02/14] Fix fee check for erc20 transactions (#1915) --- cw_evm/lib/evm_chain_wallet.dart | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cw_evm/lib/evm_chain_wallet.dart b/cw_evm/lib/evm_chain_wallet.dart index dca16539c..9ccb05e7f 100644 --- a/cw_evm/lib/evm_chain_wallet.dart +++ b/cw_evm/lib/evm_chain_wallet.dart @@ -29,7 +29,6 @@ import 'package:cw_evm/evm_chain_transaction_model.dart'; import 'package:cw_evm/evm_chain_transaction_priority.dart'; import 'package:cw_evm/evm_chain_wallet_addresses.dart'; import 'package:cw_evm/evm_ledger_credentials.dart'; -import 'package:flutter/foundation.dart'; import 'package:hex/hex.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; @@ -348,7 +347,7 @@ abstract class EVMChainWalletBase final CryptoCurrency transactionCurrency = balance.keys.firstWhere((element) => element.title == _credentials.currency.title); - final erc20Balance = balance[transactionCurrency]!; + final currencyBalance = balance[transactionCurrency]!; BigInt totalAmount = BigInt.zero; BigInt estimatedFeesForTransaction = BigInt.zero; int exponent = transactionCurrency is Erc20Token ? transactionCurrency.decimal : 18; @@ -385,7 +384,7 @@ abstract class EVMChainWalletBase estimatedGasUnitsForTransaction = gasFeesModel.estimatedGasUnits; maxFeePerGasForTransaction = gasFeesModel.maxFeePerGas; - if (erc20Balance.balance < totalAmount) { + if (currencyBalance.balance < totalAmount) { throw EVMChainTransactionCreationException(transactionCurrency); } } else { @@ -398,7 +397,7 @@ abstract class EVMChainWalletBase } if (output.sendAll && transactionCurrency is Erc20Token) { - totalAmount = erc20Balance.balance; + totalAmount = currencyBalance.balance; } final gasFeesModel = await calculateActualEstimatedFeeForCreateTransaction( @@ -413,14 +412,15 @@ abstract class EVMChainWalletBase maxFeePerGasForTransaction = gasFeesModel.maxFeePerGas; if (output.sendAll && transactionCurrency is! Erc20Token) { - totalAmount = (erc20Balance.balance - estimatedFeesForTransaction); - - if (estimatedFeesForTransaction > erc20Balance.balance) { - throw EVMChainTransactionFeesException(); - } + totalAmount = (currencyBalance.balance - estimatedFeesForTransaction); } - if (erc20Balance.balance < totalAmount) { + // check the fees on the base currency (Eth/Polygon) + if (estimatedFeesForTransaction > balance[currency]!.balance) { + throw EVMChainTransactionFeesException(); + } + + if (currencyBalance.balance < totalAmount) { throw EVMChainTransactionCreationException(transactionCurrency); } } From 9b27121261a3dd91886cde641ab9f01f44b82075 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Tue, 31 Dec 2024 17:04:18 +0200 Subject: [PATCH 03/14] Rename linux app (#1911) --- linux/my_application.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/my_application.cc b/linux/my_application.cc index 7375d05ca..49ed75499 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "cake_wallet"); + gtk_header_bar_set_title(header_bar, "Cake Wallet"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "cake_wallet"); + gtk_window_set_title(window, "Cake Wallet"); } gtk_window_set_default_size(window, 1280, 720); From d33a901f669b9a2a3868b4c184be5fe58a2974a6 Mon Sep 17 00:00:00 2001 From: cyan Date: Tue, 31 Dec 2024 17:47:17 +0100 Subject: [PATCH 04/14] Fix unavailable balance not refreshing after the app got opened (#1920) --- cw_monero/lib/monero_wallet.dart | 4 ++++ cw_monero/lib/monero_wallet_service.dart | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 4d2f95e47..9f46d32cd 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -503,6 +503,7 @@ abstract class MoneroWalletBase extends WalletBase updateUnspent() async { + await transaction_history.txHistoryMutex.acquire(); try { refreshCoins(walletAddresses.account!.id); @@ -531,6 +532,7 @@ abstract class MoneroWalletBase extends WalletBase _addCoinInfo(coin)); + transaction_history.txHistoryMutex.release(); return; } @@ -555,7 +557,9 @@ abstract class MoneroWalletBase extends WalletBase Date: Thu, 2 Jan 2025 00:14:00 +0200 Subject: [PATCH 05/14] Fix Mobx issue (#1922) --- cw_bitcoin/lib/electrum_wallet_addresses.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cw_bitcoin/lib/electrum_wallet_addresses.dart b/cw_bitcoin/lib/electrum_wallet_addresses.dart index 6774a5036..13a32c68c 100644 --- a/cw_bitcoin/lib/electrum_wallet_addresses.dart +++ b/cw_bitcoin/lib/electrum_wallet_addresses.dart @@ -349,8 +349,10 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store { type: addressPageType, network: network, ); - _addresses.add(address); - Future.delayed(Duration.zero, () => updateAddressesByMatch()); + Future.delayed(Duration.zero, () { + _addresses.add(address); + updateAddressesByMatch(); + }); return address; } From 0ebfd671f98e84da3455238ae7a9e841080cc5b9 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Thu, 2 Jan 2025 18:02:44 +0200 Subject: [PATCH 06/14] Revert "Fix unavailable balance not refreshing after the app got opened (#1920)" (#1925) This reverts commit d33a901f669b9a2a3868b4c184be5fe58a2974a6. --- cw_monero/lib/monero_wallet.dart | 4 ---- cw_monero/lib/monero_wallet_service.dart | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 9f46d32cd..4d2f95e47 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -503,7 +503,6 @@ abstract class MoneroWalletBase extends WalletBase updateUnspent() async { - await transaction_history.txHistoryMutex.acquire(); try { refreshCoins(walletAddresses.account!.id); @@ -532,7 +531,6 @@ abstract class MoneroWalletBase extends WalletBase _addCoinInfo(coin)); - transaction_history.txHistoryMutex.release(); return; } @@ -557,9 +555,7 @@ abstract class MoneroWalletBase extends WalletBase Date: Fri, 3 Jan 2025 08:53:15 +0200 Subject: [PATCH 07/14] Disable mweb coins for exchanges (#1919) * Disable mweb coins for exchanges * Take into consideration to not use non-mweb coins in ALL calculations --- lib/bitcoin/cw_bitcoin.dart | 4 +- .../exchange/exchange_view_model.dart | 42 +++++++++++-------- lib/view_model/send/send_view_model.dart | 13 ++++-- tool/configure.dart | 4 +- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/lib/bitcoin/cw_bitcoin.dart b/lib/bitcoin/cw_bitcoin.dart index d098ea0e4..bf9ec0c4d 100644 --- a/lib/bitcoin/cw_bitcoin.dart +++ b/lib/bitcoin/cw_bitcoin.dart @@ -149,7 +149,8 @@ class CWBitcoin extends Bitcoin { } @override - Future estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority) async { + Future estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority, + {UnspentCoinType coinTypeToSpendFrom = UnspentCoinType.any}) async { try { final sk = ECPrivate.random(); final electrumWallet = wallet as ElectrumWallet; @@ -173,6 +174,7 @@ class CWBitcoin extends Bitcoin { ? priority as LitecoinTransactionPriority : priority as BitcoinTransactionPriority, ), + coinTypeToSpendFrom: coinTypeToSpendFrom, ); return estimatedTx.amount; diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index ee8a88b6b..63e1db6bc 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -9,6 +9,7 @@ import 'package:cake_wallet/exchange/provider/stealth_ex_exchange_provider.dart' import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/sync_status.dart'; import 'package:cw_core/transaction_priority.dart'; +import 'package:cw_core/unspent_coin_type.dart'; import 'package:cw_core/utils/print_verbose.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:hive/hive.dart'; @@ -122,7 +123,8 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with depositAmount = ''; receiveAmount = ''; receiveAddress = ''; - depositAddress = depositCurrency == wallet.currency ? wallet.walletAddresses.addressForExchange : ''; + depositAddress = + depositCurrency == wallet.currency ? wallet.walletAddresses.addressForExchange : ''; provider = providersForCurrentPair().first; final initialProvider = provider; provider!.checkIsAvailable().then((bool isAvailable) { @@ -157,8 +159,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with wallet.type == WalletType.bitcoinCash; bool get hideAddressAfterExchange => - wallet.type == WalletType.monero || - wallet.type == WalletType.wownero; + wallet.type == WalletType.monero || wallet.type == WalletType.wownero; bool _useTorOnly; final Box trades; @@ -167,17 +168,17 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with final SharedPreferences sharedPreferences; List get _allProviders => [ - ChangeNowExchangeProvider(settingsStore: _settingsStore), - SideShiftExchangeProvider(), - SimpleSwapExchangeProvider(), - ThorChainExchangeProvider(tradesStore: trades), - if (FeatureFlag.isExolixEnabled) ExolixExchangeProvider(), - QuantexExchangeProvider(), - LetsExchangeExchangeProvider(), - StealthExExchangeProvider(), - TrocadorExchangeProvider( - useTorOnly: _useTorOnly, providerStates: _settingsStore.trocadorProviderStates), - ]; + ChangeNowExchangeProvider(settingsStore: _settingsStore), + SideShiftExchangeProvider(), + SimpleSwapExchangeProvider(), + ThorChainExchangeProvider(tradesStore: trades), + if (FeatureFlag.isExolixEnabled) ExolixExchangeProvider(), + QuantexExchangeProvider(), + LetsExchangeExchangeProvider(), + StealthExExchangeProvider(), + TrocadorExchangeProvider( + useTorOnly: _useTorOnly, providerStates: _settingsStore.trocadorProviderStates), + ]; @observable ExchangeProvider? provider; @@ -613,8 +614,10 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with isReceiveAmountEntered = false; depositAmount = ''; receiveAmount = ''; - depositAddress = depositCurrency == wallet.currency ? wallet.walletAddresses.addressForExchange : ''; - receiveAddress = receiveCurrency == wallet.currency ? wallet.walletAddresses.addressForExchange : ''; + depositAddress = + depositCurrency == wallet.currency ? wallet.walletAddresses.addressForExchange : ''; + receiveAddress = + receiveCurrency == wallet.currency ? wallet.walletAddresses.addressForExchange : ''; isDepositAddressEnabled = !(depositCurrency == wallet.currency); isFixedRateMode = false; _onPairChange(); @@ -640,7 +643,12 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with wallet.type == WalletType.bitcoinCash) { final priority = _settingsStore.priority[wallet.type]!; - final amount = await bitcoin!.estimateFakeSendAllTxAmount(wallet, priority); + final amount = await bitcoin!.estimateFakeSendAllTxAmount( + wallet, + priority, + coinTypeToSpendFrom: + wallet.type == WalletType.litecoin ? UnspentCoinType.nonMweb : UnspentCoinType.any, + ); changeDepositAmount(amount: bitcoin!.formatterBitcoinAmountToString(amount: amount)); } diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index 78bc867db..cafe89cb1 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -394,7 +394,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState(); - pendingTransaction = await wallet.createTransaction(_credentials()); + pendingTransaction = await wallet.createTransaction(_credentials(provider)); if (provider is ThorChainExchangeProvider) { final outputCount = pendingTransaction?.outputCount ?? 0; @@ -522,7 +522,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor void setTransactionPriority(TransactionPriority priority) => _settingsStore.priority[wallet.type] = priority; - Object _credentials() { + Object _credentials([ExchangeProvider? provider]) { final priority = _settingsStore.priority[wallet.type]; if (priority == null && @@ -535,7 +535,6 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor switch (wallet.type) { case WalletType.bitcoin: - case WalletType.litecoin: case WalletType.bitcoinCash: return bitcoin!.createBitcoinTransactionCredentials( outputs, @@ -543,6 +542,14 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor feeRate: customBitcoinFeeRate, coinTypeToSpendFrom: coinTypeToSpendFrom, ); + case WalletType.litecoin: + return bitcoin!.createBitcoinTransactionCredentials( + outputs, + priority: priority!, + feeRate: customBitcoinFeeRate, + // if it's an exchange flow then disable sending from mweb coins + coinTypeToSpendFrom: provider != null ? UnspentCoinType.nonMweb : coinTypeToSpendFrom, + ); case WalletType.monero: return monero! diff --git a/tool/configure.dart b/tool/configure.dart index 6abd73d9e..c08ef3a34 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -109,7 +109,6 @@ import 'package:cw_bitcoin/electrum.dart'; import 'package:cw_bitcoin/electrum_transaction_info.dart'; import 'package:cw_bitcoin/pending_bitcoin_transaction.dart'; import 'package:cw_bitcoin/bitcoin_receive_page_option.dart'; -import 'package:cw_bitcoin/bitcoin_wallet.dart'; import 'package:cw_bitcoin/electrum_wallet.dart'; import 'package:cw_bitcoin/bitcoin_unspent.dart'; import 'package:cw_bitcoin/bitcoin_mnemonic.dart'; @@ -173,7 +172,8 @@ abstract class Bitcoin { List getSilentPaymentAddresses(Object wallet); List getSilentPaymentReceivedAddresses(Object wallet); - Future estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority); + Future estimateFakeSendAllTxAmount(Object wallet, TransactionPriority priority, + {UnspentCoinType coinTypeToSpendFrom = UnspentCoinType.any}); List getSubAddresses(Object wallet); String formatterBitcoinAmountToString({required int amount}); From 52e20e1a44c0728ebf1b7814863fea7b16b75b98 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Fri, 3 Jan 2025 08:55:01 +0200 Subject: [PATCH 08/14] Fix Sending SPL token issue (#1924) * Fix creating ATA * give more buffer for the transaction to be broadcast [skip ci] --- cw_solana/lib/solana_client.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cw_solana/lib/solana_client.dart b/cw_solana/lib/solana_client.dart index 16f8988b1..431f5f7fb 100644 --- a/cw_solana/lib/solana_client.dart +++ b/cw_solana/lib/solana_client.dart @@ -515,7 +515,7 @@ class SolanaWalletClient { final instruction = AssociatedTokenAccountInstruction.createAccount( mint: mint, address: derivedAddress, - owner: ownerKeypair.publicKey, + owner: destinationOwner, funder: ownerKeypair.publicKey, ); @@ -541,6 +541,8 @@ class SolanaWalletClient { data: null, ), ); + + await Future.delayed(Duration(seconds: 5)); } } catch (e) { throw SolanaCreateAssociatedTokenAccountException(e.toString()); @@ -583,10 +585,14 @@ class SolanaWalletClient { latestBlockhash: latestBlockhash, ); - sendTx() async => await sendTransaction( + sendTx() async { + await Future.delayed(Duration(seconds: 3)); + + return await sendTransaction( signedTransaction: signedTx, commitment: commitment, ); + } final pendingTransaction = PendingSolanaTransaction( amount: inputAmount, From 471a2af527e97d258f5c7c3faca9ac5522a984ad Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Fri, 3 Jan 2025 13:49:15 +0200 Subject: [PATCH 09/14] minor fixes [skip ci] --- lib/buy/robinhood/robinhood_buy_provider.dart | 9 +++++---- lib/utils/exception_handler.dart | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/buy/robinhood/robinhood_buy_provider.dart b/lib/buy/robinhood/robinhood_buy_provider.dart index 271b9c090..937af0315 100644 --- a/lib/buy/robinhood/robinhood_buy_provider.dart +++ b/lib/buy/robinhood/robinhood_buy_provider.dart @@ -51,6 +51,8 @@ class RobinhoodBuyProvider extends BuyProvider { switch (wallet.type) { case WalletType.ethereum: case WalletType.polygon: + case WalletType.solana: + case WalletType.tron: return await wallet.signMessage(message); case WalletType.litecoin: case WalletType.bitcoin: @@ -78,8 +80,7 @@ class RobinhoodBuyProvider extends BuyProvider { if (response.statusCode == 200) { return (jsonDecode(response.body) as Map)['connectId'] as String; } else { - throw Exception( - 'Provider currently unavailable. Status: ${response.statusCode} ${response.body}'); + throw Exception('Provider currently unavailable. Status: ${response.statusCode}'); } } @@ -120,13 +121,13 @@ class RobinhoodBuyProvider extends BuyProvider { try { final uri = await requestProviderUrl(); await launchUrl(uri, mode: LaunchMode.externalApplication); - } catch (_) { + } catch (e) { await showPopUp( context: context, builder: (BuildContext context) { return AlertWithOneAction( alertTitle: "Robinhood Connect", - alertContent: S.of(context).buy_provider_unavailable, + alertContent: e.toString(), buttonText: S.of(context).ok, buttonAction: () => Navigator.of(context).pop()); }); diff --git a/lib/utils/exception_handler.dart b/lib/utils/exception_handler.dart index 66cbc61a0..b949c9968 100644 --- a/lib/utils/exception_handler.dart +++ b/lib/utils/exception_handler.dart @@ -215,6 +215,7 @@ class ExceptionHandler { "input stream error", "invalid signature", "invalid password", + "NetworkImage._loadAsync", // Temporary ignored, More context: Flutter secure storage reads the values as null some times // probably when the device was locked and then opened on Cake // this is solved by a restart of the app From bc80fa68df00064aed5e52bfcb04185828de1bd2 Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 3 Jan 2025 22:29:53 +0200 Subject: [PATCH 10/14] fix buy sell fiat calculation (#1930) * fix buy sell fiat calculation * skip IsReadyToTrade reaction * Update lib/src/screens/buy/buy_sell_page.dart [skip ci] --------- Co-authored-by: Omar Hatem --- lib/src/screens/buy/buy_sell_page.dart | 4 ++++ lib/view_model/buy/buy_sell_view_model.dart | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/src/screens/buy/buy_sell_page.dart b/lib/src/screens/buy/buy_sell_page.dart index 945559bb6..9d0f17ee3 100644 --- a/lib/src/screens/buy/buy_sell_page.dart +++ b/lib/src/screens/buy/buy_sell_page.dart @@ -312,6 +312,10 @@ class BuySellPage extends BasePage { reaction((_) => buySellViewModel.isReadyToTrade, (bool isReady) { if (isReady) { + if (buySellViewModel.skipIsReadyToTradeReaction) { + buySellViewModel.skipIsReadyToTradeReaction = false; + return; + } if (cryptoAmountController.text.isNotEmpty && cryptoAmountController.text != S.current.fetching) { buySellViewModel.changeCryptoAmount(amount: cryptoAmountController.text); diff --git a/lib/view_model/buy/buy_sell_view_model.dart b/lib/view_model/buy/buy_sell_view_model.dart index d16307134..508d68a82 100644 --- a/lib/view_model/buy/buy_sell_view_model.dart +++ b/lib/view_model/buy/buy_sell_view_model.dart @@ -149,6 +149,9 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S @observable BuySellQuotLoadingState buySellQuotState; + @observable + bool skipIsReadyToTradeReaction = false; + @computed bool get isReadyToTrade { final hasSelectedQuote = selectedQuote != null; @@ -266,6 +269,7 @@ abstract class BuySellViewModelBase extends WalletChangeListenerViewModel with S } void onTapChoseProvider(BuildContext context) async { + skipIsReadyToTradeReaction = true; final initialQuotes = List.from(sortedRecommendedQuotes + sortedQuotes); await calculateBestRate(); final newQuotes = (sortedRecommendedQuotes + sortedQuotes); From e64b87a1b03b794b387326abeb304f7822295a11 Mon Sep 17 00:00:00 2001 From: tuxsudo Date: Fri, 3 Jan 2025 16:47:02 -0500 Subject: [PATCH 11/14] Hidden balance (#1921) * Change balance hiding behaviour * Update hiding behaviour and add strings * Add touch feedback to balance card * Remove color from TextButton * Add toast to balance card * Add missing string * minor code improvement [skip ci] --------- Co-authored-by: Omar Hatem --- .../pages/balance/balance_row_widget.dart | 260 ++++++++++-------- .../dashboard/balance_view_model.dart | 125 ++------- res/values/strings_ar.arb | 2 + res/values/strings_bg.arb | 2 + res/values/strings_cs.arb | 2 + res/values/strings_de.arb | 6 +- res/values/strings_en.arb | 2 + res/values/strings_es.arb | 2 + res/values/strings_fr.arb | 2 + res/values/strings_ha.arb | 2 + res/values/strings_hi.arb | 2 + res/values/strings_hr.arb | 2 + res/values/strings_hy.arb | 2 + res/values/strings_id.arb | 2 + res/values/strings_it.arb | 2 + res/values/strings_ja.arb | 2 + res/values/strings_ko.arb | 4 +- res/values/strings_my.arb | 2 + res/values/strings_nl.arb | 2 + res/values/strings_pl.arb | 2 + res/values/strings_pt.arb | 2 + res/values/strings_ru.arb | 2 + res/values/strings_th.arb | 2 + res/values/strings_tl.arb | 2 + res/values/strings_tr.arb | 2 + res/values/strings_uk.arb | 2 + res/values/strings_ur.arb | 2 + res/values/strings_vi.arb | 2 + res/values/strings_yo.arb | 2 + res/values/strings_zh.arb | 2 + 30 files changed, 229 insertions(+), 218 deletions(-) diff --git a/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart b/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart index e3cff4760..155348ebf 100644 --- a/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart +++ b/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart @@ -14,6 +14,7 @@ import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/unspent_coin_type.dart'; import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:url_launcher/url_launcher.dart'; class BalanceRowWidget extends StatelessWidget { @@ -76,14 +77,23 @@ class BalanceRowWidget extends StatelessWidget { ), color: Theme.of(context).extension()!.syncedBackgroundColor, ), - child: Container( - margin: const EdgeInsets.only(top: 16, left: 24, right: 8, bottom: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), - child: Row( + child: TextButton( + onPressed: () => + Fluttertoast.showToast( + msg: S.current.show_balance_toast, + backgroundColor: Color.fromRGBO(0, 0, 0, 0.85), + ), + onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), + style: TextButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30)), + ), + child: Container( + margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -93,8 +103,11 @@ class BalanceRowWidget extends StatelessWidget { GestureDetector( behavior: HitTestBehavior.opaque, onTap: hasAdditionalBalance - ? () => _showBalanceDescription( - context, S.of(context).available_balance_description) + ? () => + _showBalanceDescription( + context, S + .of(context) + .available_balance_description) : null, child: Row( children: [ @@ -137,14 +150,16 @@ class BalanceRowWidget extends StatelessWidget { textAlign: TextAlign.start), SizedBox(height: 6), if (isTestnet) - Text(S.of(context).testnet_coins_no_value, + Text(S + .of(context) + .testnet_coins_no_value, textAlign: TextAlign.center, style: TextStyle( fontSize: 14, fontFamily: 'Lato', fontWeight: FontWeight.w400, color: - Theme.of(context).extension()!.textColor, + Theme.of(context).extension()!.textColor, height: 1)), if (!isTestnet) Text('${availableFiatBalance}', @@ -154,12 +169,12 @@ class BalanceRowWidget extends StatelessWidget { fontFamily: 'Lato', fontWeight: FontWeight.w500, color: - Theme.of(context).extension()!.textColor, + Theme.of(context).extension()!.textColor, height: 1)), ], ), SizedBox( - width: min(MediaQuery.of(context).size.width * 0.2, 100), + //width: min(MediaQuery.of(context).size.width * 0.2, 100), child: Center( child: Column( children: [ @@ -201,120 +216,128 @@ class BalanceRowWidget extends StatelessWidget { ), ], ), - ), - if (frozenBalance.isNotEmpty) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: hasAdditionalBalance - ? () => _showBalanceDescription( - context, S.of(context).unavailable_balance_description) - : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 26), - Row( - children: [ + //), + if (frozenBalance.isNotEmpty) + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: hasAdditionalBalance + ? () => + _showBalanceDescription( + context, S + .of(context) + .unavailable_balance_description) + : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 26), + Row( + children: [ + Text( + S + .of(context) + .unavailable_balance, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: + Theme.of(context).extension()!.labelTextColor, + height: 1, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: Icon(Icons.help_outline, + size: 16, + color: Theme.of(context) + .extension()! + .labelTextColor), + ), + ], + ), + SizedBox(height: 8), + AutoSizeText( + frozenBalance, + style: TextStyle( + fontSize: 20, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: + Theme.of(context).extension()!.balanceAmountColor, + height: 1, + ), + maxLines: 1, + textAlign: TextAlign.center, + ), + SizedBox(height: 4), + if (!isTestnet) Text( - S.of(context).unavailable_balance, + frozenFiatBalance, textAlign: TextAlign.center, style: TextStyle( fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: - Theme.of(context).extension()!.labelTextColor, + color: Theme.of(context).extension()!.textColor, height: 1, ), ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: Icon(Icons.help_outline, - size: 16, - color: Theme.of(context) - .extension()! - .labelTextColor), - ), - ], - ), - SizedBox(height: 8), - AutoSizeText( - frozenBalance, - style: TextStyle( - fontSize: 20, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, - color: - Theme.of(context).extension()!.balanceAmountColor, - height: 1, - ), - maxLines: 1, - textAlign: TextAlign.center, - ), - SizedBox(height: 4), - if (!isTestnet) + ], + ), + ), + if (hasAdditionalBalance) + GestureDetector( + onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24), Text( - frozenFiatBalance, + '${additionalBalanceLabel}', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.textColor, + color: Theme.of(context).extension()! + .labelTextColor, height: 1, ), ), - ], - ), - ), - if (hasAdditionalBalance) - GestureDetector( - onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 24), - Text( - '${additionalBalanceLabel}', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.labelTextColor, - height: 1, - ), - ), - SizedBox(height: 8), - AutoSizeText( - additionalBalance, - style: TextStyle( - fontSize: 20, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.assetTitleColor, - height: 1, - ), - maxLines: 1, - textAlign: TextAlign.center, - ), - SizedBox(height: 4), - if (!isTestnet) - Text( - '${additionalFiatBalance}', - textAlign: TextAlign.center, + SizedBox(height: 8), + AutoSizeText( + additionalBalance, style: TextStyle( - fontSize: 12, + fontSize: 20, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.textColor, + color: Theme.of(context).extension()! + .assetTitleColor, height: 1, ), + maxLines: 1, + textAlign: TextAlign.center, ), - ], + SizedBox(height: 4), + if (!isTestnet) + Text( + '${additionalFiatBalance}', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: Theme.of(context).extension()!.textColor, + height: 1, + ), + ), + ], + ), ), - ), - ], + ], + ), ), ), ), @@ -383,11 +406,12 @@ class BalanceRowWidget extends StatelessWidget { children: [ GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () => launchUrl( - Uri.parse( - "https://docs.cakewallet.com/cryptos/litecoin.html#mweb"), - mode: LaunchMode.externalApplication, - ), + onTap: () => + launchUrl( + Uri.parse( + "https://docs.cakewallet.com/cryptos/litecoin.html#mweb"), + mode: LaunchMode.externalApplication, + ), child: Row( children: [ Text( @@ -521,11 +545,13 @@ class BalanceRowWidget extends StatelessWidget { children: [ Expanded( child: Semantics( - label: S.of(context).litecoin_mweb_pegin, + label: S + .of(context) + .litecoin_mweb_pegin, child: OutlinedButton( onPressed: () { final mwebAddress = - bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet); + bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet); PaymentRequest? paymentRequest = null; if ((mwebAddress?.isNotEmpty ?? false)) { paymentRequest = PaymentRequest.fromUri( @@ -563,7 +589,9 @@ class BalanceRowWidget extends StatelessWidget { ), const SizedBox(width: 8), Text( - S.of(context).litecoin_mweb_pegin, + S + .of(context) + .litecoin_mweb_pegin, style: TextStyle( color: Theme.of(context) .extension()! @@ -579,11 +607,13 @@ class BalanceRowWidget extends StatelessWidget { SizedBox(width: 24), Expanded( child: Semantics( - label: S.of(context).litecoin_mweb_pegout, + label: S + .of(context) + .litecoin_mweb_pegout, child: OutlinedButton( onPressed: () { final litecoinAddress = - bitcoin!.getUnusedSegwitAddress(dashboardViewModel.wallet); + bitcoin!.getUnusedSegwitAddress(dashboardViewModel.wallet); PaymentRequest? paymentRequest = null; if ((litecoinAddress?.isNotEmpty ?? false)) { paymentRequest = PaymentRequest.fromUri( @@ -621,7 +651,9 @@ class BalanceRowWidget extends StatelessWidget { ), const SizedBox(width: 8), Text( - S.of(context).litecoin_mweb_pegout, + S + .of(context) + .litecoin_mweb_pegout, style: TextStyle( color: Theme.of(context) .extension()! diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index 0c4407e60..dbc0cce1d 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -20,7 +20,8 @@ part 'balance_view_model.g.dart'; class BalanceRecord { const BalanceRecord( - {required this.availableBalance, + { + required this.availableBalance, required this.additionalBalance, required this.secondAvailableBalance, required this.secondAdditionalBalance, @@ -148,26 +149,18 @@ abstract class BalanceViewModelBase with Store { @computed String get availableBalanceLabel { - switch (wallet.type) { - case WalletType.monero: - case WalletType.wownero: - case WalletType.haven: - case WalletType.ethereum: - case WalletType.polygon: - case WalletType.nano: - case WalletType.banano: - case WalletType.solana: - case WalletType.tron: - case WalletType.bitcoin: - case WalletType.litecoin: - case WalletType.bitcoinCash: - case WalletType.none: - return S.current.xmr_available_balance; + + if (displayMode == BalanceDisplayMode.hiddenBalance) { + return S.current.show_balance; + } + else { + return S.current.xmr_available_balance; } } @computed String get additionalBalanceLabel { + switch (wallet.type) { case WalletType.haven: case WalletType.ethereum: @@ -203,98 +196,35 @@ abstract class BalanceViewModelBase with Store { } } - @computed - bool get hasMultiBalance => appStore.wallet!.type == WalletType.haven; - - @computed - String get availableBalance { - final walletBalance = _walletBalance; - - if (displayMode == BalanceDisplayMode.hiddenBalance) { - return '---'; - } - - return walletBalance.formattedAvailableBalance; - } - - @computed - String get frozenBalance { - final walletBalance = _walletBalance; - - if (displayMode == BalanceDisplayMode.hiddenBalance) { - return '---'; - } - - return getFormattedFrozenBalance(walletBalance); - } - - @computed - String get frozenFiatBalance { - final walletBalance = _walletBalance; - final fiatCurrency = settingsStore.fiatCurrency; - - if (displayMode == BalanceDisplayMode.hiddenBalance) { - return '---'; - } - - return _getFiatBalance(price: price, cryptoAmount: getFormattedFrozenBalance(walletBalance)) + - ' ${fiatCurrency.toString()}'; - } - @computed String get additionalBalance { final walletBalance = _walletBalance; if (displayMode == BalanceDisplayMode.hiddenBalance) { - return '---'; + return '0.0'; } return walletBalance.formattedAdditionalBalance; } - @computed - String get availableFiatBalance { - final walletBalance = _walletBalance; - final fiatCurrency = settingsStore.fiatCurrency; - - if (displayMode == BalanceDisplayMode.hiddenBalance) { - return '---'; - } - - return _getFiatBalance(price: price, cryptoAmount: walletBalance.formattedAvailableBalance) + - ' ${fiatCurrency.toString()}'; - } - - @computed - String get additionalFiatBalance { - final walletBalance = _walletBalance; - final fiatCurrency = settingsStore.fiatCurrency; - - if (displayMode == BalanceDisplayMode.hiddenBalance) { - return '---'; - } - - return _getFiatBalance(price: price, cryptoAmount: walletBalance.formattedAdditionalBalance) + - ' ${fiatCurrency.toString()}'; - } - @computed Map get balances { return wallet.balance.map((key, value) { if (displayMode == BalanceDisplayMode.hiddenBalance) { + final fiatCurrency = settingsStore.fiatCurrency; return MapEntry( key, BalanceRecord( - availableBalance: '---', - additionalBalance: '---', + availableBalance: '●●●●●●', + additionalBalance: additionalBalance, frozenBalance: '', - secondAvailableBalance: '---', - secondAdditionalBalance: '---', - fiatAdditionalBalance: isFiatDisabled ? '' : '---', - fiatAvailableBalance: isFiatDisabled ? '' : '---', - fiatFrozenBalance: isFiatDisabled ? '' : '---', - fiatSecondAvailableBalance: isFiatDisabled ? '' : '---', - fiatSecondAdditionalBalance: isFiatDisabled ? '' : '---', + secondAvailableBalance: '', + secondAdditionalBalance: '', + fiatAdditionalBalance: isFiatDisabled ? '' : '', + fiatAvailableBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●', + fiatFrozenBalance: isFiatDisabled ? '' : '', + fiatSecondAvailableBalance: isFiatDisabled ? '' : '', + fiatSecondAdditionalBalance: isFiatDisabled ? '' : '', asset: key, formattedAssetTitle: _formatterAsset(key))); } @@ -374,16 +304,11 @@ abstract class BalanceViewModelBase with Store { bool _hasAdditionalBalanceForWalletType(WalletType type) { switch (type) { - case WalletType.ethereum: - case WalletType.polygon: - case WalletType.solana: - case WalletType.tron: - case WalletType.bitcoin: - case WalletType.bitcoinCash: - case WalletType.litecoin: - return false; - default: + case WalletType.monero: + case WalletType.wownero: return true; + default: + return false; } } @@ -468,8 +393,6 @@ abstract class BalanceViewModelBase with Store { return balance; } - @computed - CryptoCurrency get currency => appStore.wallet!.currency; @observable bool isShowCard; diff --git a/res/values/strings_ar.arb b/res/values/strings_ar.arb index 28b35c35e..b0955b6d7 100644 --- a/res/values/strings_ar.arb +++ b/res/values/strings_ar.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "مجموعات محفظة البذور المشتركة", "show": "يعرض", "show_address_book_popup": "عرض \"إضافة إلى كتاب العناوين\" المنبثقة بعد الإرسال", + "show_balance": "اضغط لفترة طويلة لإظهار التوازن", + "show_balance_toast": "اضغط لفترة طويلة لإخفاء أو إظهار التوازن", "show_details": "اظهر التفاصيل", "show_keys": "اظهار السييد / المفاتيح", "show_market_place": "إظهار السوق", diff --git a/res/values/strings_bg.arb b/res/values/strings_bg.arb index 64cd7c61f..e1fc3bd87 100644 --- a/res/values/strings_bg.arb +++ b/res/values/strings_bg.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Споделени групи за портфейли за семена", "show": "Показване", "show_address_book_popup": "Показване на изскачането на „Добавяне към адресната книга“ след изпращане", + "show_balance": "Дълго натиснете, за да покажете баланса", + "show_balance_toast": "Дълго натискане, за да се скрие или покаже баланс", "show_details": "Показване на подробностите", "show_keys": "Покажи seed/keys", "show_market_place": "Покажи пазар", diff --git a/res/values/strings_cs.arb b/res/values/strings_cs.arb index 7d458e5af..29c04496d 100644 --- a/res/values/strings_cs.arb +++ b/res/values/strings_cs.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Skupiny sdílených semen", "show": "Show", "show_address_book_popup": "Po odeslání zobrazíte vyskakovací okno „Přidat do adresáře“", + "show_balance": "Dlouhý stisknutí zobrazí rovnováhu", + "show_balance_toast": "Dlouhý stiskněte pro skrytí nebo zobrazení rovnováhy", "show_details": "Zobrazit detaily", "show_keys": "Zobrazit seed/klíče", "show_market_place": "Zobrazit trh", diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index 0b2d22f62..54c3a70e7 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -511,8 +511,8 @@ "placeholder_transactions": "Ihre Transaktionen werden hier angezeigt", "please_fill_totp": "Bitte geben Sie den 8-stelligen Code ein, der auf Ihrem anderen Gerät vorhanden ist", "please_make_selection": "Bitte treffen Sie unten eine Auswahl zum Erstellen oder Wiederherstellen Ihrer Wallet.", - "please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.", "Please_reference_document": "Weitere Informationen finden Sie in den Dokumenten unten.", + "please_reference_document": "Bitte verweisen Sie auf die folgenden Dokumente, um weitere Informationen zu erhalten.", "please_select": "Bitte auswählen:", "please_select_backup_file": "Bitte wählen Sie die Sicherungsdatei und geben Sie das Sicherungskennwort ein.", "please_try_to_connect_to_another_node": "Bitte versuchen Sie, sich mit einem anderen Knoten zu verbinden", @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "Gemeinsame Walletsseed Gruppen", "show": "Zeigen", "show_address_book_popup": "Popup \"zum Adressbuch hinzufügen\" nach dem Senden anzeigen", + "show_balance": "Lange Presse, um das Gleichgewicht zu zeigen", + "show_balance_toast": "Lange Presse, um sich zu verbergen oder Gleichgewicht zu zeigen", "show_details": "Details anzeigen", "show_keys": "Seed/Schlüssel anzeigen", "show_market_place": "Marktplatz anzeigen", @@ -989,4 +991,4 @@ "you_will_get": "Konvertieren zu", "you_will_send": "Konvertieren von", "yy": "YY" -} +} \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 7da5e0fa1..995fb5595 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Shared Seed Wallet Groups", "show": "Show", "show_address_book_popup": "Show 'Add to Address Book' popup after sending", + "show_balance": "Long Press to Show Balance", + "show_balance_toast": "Long press to hide or show balance", "show_details": "Show Details", "show_keys": "Show seed/keys", "show_market_place": "Show Marketplace", diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index 724f691c9..011206fbf 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "Grupos de billetera de semillas compartidas", "show": "Espectáculo", "show_address_book_popup": "Mostrar ventana emergente 'Agregar a la libreta de direcciones' después de enviar", + "show_balance": "Prensa larga para mostrar equilibrio", + "show_balance_toast": "Prensa larga para esconder o mostrar equilibrio", "show_details": "Mostrar detalles", "show_keys": "Mostrar semilla/claves", "show_market_place": "Mostrar mercado", diff --git a/res/values/strings_fr.arb b/res/values/strings_fr.arb index 85c6e2646..7e2907c8f 100644 --- a/res/values/strings_fr.arb +++ b/res/values/strings_fr.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Groupes de portefeuilles partagés", "show": "Montrer", "show_address_book_popup": "Afficher la popup `` Ajouter au carnet d'adresses '' après avoir envoyé", + "show_balance": "Longue presse pour montrer l'équilibre", + "show_balance_toast": "Longue appuyez sur pour masquer ou afficher l'équilibre", "show_details": "Afficher les détails", "show_keys": "Visualiser la phrase secrète (seed) et les clefs", "show_market_place": "Afficher la place de marché", diff --git a/res/values/strings_ha.arb b/res/values/strings_ha.arb index cb457f07a..d06210e3d 100644 --- a/res/values/strings_ha.arb +++ b/res/values/strings_ha.arb @@ -732,6 +732,8 @@ "shared_seed_wallet_groups": "Raba ƙungiya walat", "show": "Nuna", "show_address_book_popup": "Nuna 'ƙara don magance littafin' Popup bayan aikawa", + "show_balance": "Dogon latsawa don nuna ma'auni", + "show_balance_toast": "Latsa latsawa don ɓoye ko nuna ma'auni", "show_details": "Nuna Cikakkun bayanai", "show_keys": "Nuna iri/maɓallai", "show_market_place": "Nuna dan kasuwa", diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index 2eaa53e87..74de1126e 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -732,6 +732,8 @@ "shared_seed_wallet_groups": "साझा बीज बटुए समूह", "show": "दिखाओ", "show_address_book_popup": "भेजने के बाद 'एड एड्रेस बुक' पॉपअप दिखाएं", + "show_balance": "बैलेंस दिखाने के लिए लॉन्ग प्रेस", + "show_balance_toast": "बैलेंस को छिपाने या दिखाने के लिए लॉन्ग प्रेस", "show_details": "विवरण दिखाएं", "show_keys": "बीज / कुंजियाँ दिखाएँ", "show_market_place": "बाज़ार दिखाएँ", diff --git a/res/values/strings_hr.arb b/res/values/strings_hr.arb index 303009403..41768bd4f 100644 --- a/res/values/strings_hr.arb +++ b/res/values/strings_hr.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Zajedničke grupe za sjeme novčanika", "show": "Pokazati", "show_address_book_popup": "Pokažite \"dodaj u adresar\" skočni prozor nakon slanja", + "show_balance": "Dugački pritisak za pokazivanje ravnoteže", + "show_balance_toast": "Dugo pritisnite da biste sakrili ili pokazali ravnotežu", "show_details": "Prikaži pojedinosti", "show_keys": "Prikaži pristupni izraz/ključ", "show_market_place": "Prikaži tržište", diff --git a/res/values/strings_hy.arb b/res/values/strings_hy.arb index 4b03eb2dd..2a3aeed6d 100644 --- a/res/values/strings_hy.arb +++ b/res/values/strings_hy.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Համօգտագործված սերմերի դրամապանակների խմբեր", "show": "Ցուցահանդես", "show_address_book_popup": "Show ույց տալ «Ուղարկելուց հետո« Հասցեների գրքի »թռուցիկ", + "show_balance": "Երկար մամուլ, հավասարակշռությունը ցույց տալու համար", + "show_balance_toast": "Երկար սեղմեք `հավասարակշռությունը թաքցնելու կամ ցույց տալու համար", "show_details": "Ցուցադրել մանրամասներ", "show_keys": "Ցուցադրել բանալիներ", "show_market_place": "Ցուցադրել շուկան", diff --git a/res/values/strings_id.arb b/res/values/strings_id.arb index d142ab41b..90bf4d806 100644 --- a/res/values/strings_id.arb +++ b/res/values/strings_id.arb @@ -733,6 +733,8 @@ "shared_seed_wallet_groups": "Kelompok dompet benih bersama", "show": "Menunjukkan", "show_address_book_popup": "Tampilkan popup 'Tambahkan ke Alamat' setelah mengirim", + "show_balance": "PRESS PANJANG UNTUK MENUNJUKKAN Balance", + "show_balance_toast": "Tekan panjang untuk menyembunyikan atau menunjukkan keseimbangan", "show_details": "Tampilkan Rincian", "show_keys": "Tampilkan seed/kunci", "show_market_place": "Tampilkan Pasar", diff --git a/res/values/strings_it.arb b/res/values/strings_it.arb index ae26f2d13..c3796be5a 100644 --- a/res/values/strings_it.arb +++ b/res/values/strings_it.arb @@ -732,6 +732,8 @@ "shared_seed_wallet_groups": "Gruppi di portafoglio di semi condivisi", "show": "Spettacolo", "show_address_book_popup": "Mostra il popup \"Aggiungi alla rubrica\" ​​dopo l'invio", + "show_balance": "Lunga stampa per mostrare l'equilibrio", + "show_balance_toast": "A lungo pressa per nascondere o mostrare l'equilibrio", "show_details": "Mostra dettagli", "show_keys": "Mostra seme/chiavi", "show_market_place": "Mostra mercato", diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 041265697..4ccd2d830 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "共有シードウォレットグループ", "show": "見せる", "show_address_book_popup": "送信後に「アドレスブックに追加」ポップアップを表示します", + "show_balance": "バランスを示すためにロングプレス", + "show_balance_toast": "バランスを隠したり表示したりするためにロングプレス", "show_details": "詳細を表示", "show_keys": "シード/キーを表示する", "show_market_place": "マーケットプレイスを表示", diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index 7fb3bab95..67a69e26b 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -511,8 +511,8 @@ "placeholder_transactions": "거래가 여기에 표시됩니다", "please_fill_totp": "다른 기기에 있는 8자리 코드를 입력하세요.", "please_make_selection": "아래에서 선택하십시오 지갑 만들기 또는 복구.", - "Please_reference_document": "자세한 내용은 아래 문서를 참조하십시오.", "please_reference_document": "자세한 내용은 아래 문서를 참조하십시오.", + "Please_reference_document": "자세한 내용은 아래 문서를 참조하십시오.", "please_select": "선택 해주세요:", "please_select_backup_file": "백업 파일을 선택하고 백업 암호를 입력하십시오.", "please_try_to_connect_to_another_node": "다른 노드에 연결을 시도하십시오", @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "공유 종자 지갑 그룹", "show": "보여주다", "show_address_book_popup": "전송 후 '주소 책에 추가'팝업을 표시하십시오", + "show_balance": "균형을 보여주기 위해 긴 언론", + "show_balance_toast": "균형을 숨기거나 보여주기 위해 긴 누르십시오", "show_details": "세부정보 표시", "show_keys": "시드 / 키 표시", "show_market_place": "마켓플레이스 표시", diff --git a/res/values/strings_my.arb b/res/values/strings_my.arb index 1498403e0..dd2909d3f 100644 --- a/res/values/strings_my.arb +++ b/res/values/strings_my.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "shared မျိုးစေ့ပိုက်ဆံအိတ်အုပ်စုများ", "show": "ပြသ", "show_address_book_popup": "ပေးပို့ပြီးနောက် 'address book' popup ကိုပြပါ", + "show_balance": "ချိန်ခွင်လျှာကိုပြသရန်ရှည်လျားသောစာနယ်ဇင်း", + "show_balance_toast": "ချိန်ခွင်လျှာကိုဖျောက်ရန်သို့မဟုတ်ပြသရန်ရှည်လျားသောစာနယ်ဇင်း", "show_details": "အသေးစိတ်ပြ", "show_keys": "မျိုးစေ့ /သော့များကို ပြပါ။", "show_market_place": "စျေးကွက်ကိုပြသပါ။", diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index d63b85a3e..8b32d669f 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Gedeelde zaadportelgroepen", "show": "Show", "show_address_book_popup": "Toon 'Toevoegen aan adresboek' pop -up na verzenden", + "show_balance": "Lange pers om evenwicht te tonen", + "show_balance_toast": "Lange pers om evenwicht te verbergen of te tonen", "show_details": "Toon details", "show_keys": "Toon zaad/sleutels", "show_market_place": "Toon Marktplaats", diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index 0e9c53310..2f2c19546 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Wspólne grupy portfeli nasion", "show": "Pokazywać", "show_address_book_popup": "Pokaż wysypkę „Dodaj do książki” po wysłaniu", + "show_balance": "Długa prasa, aby pokazać równowagę", + "show_balance_toast": "Długa naciśnij, aby ukryć lub pokazać równowagę", "show_details": "Pokaż szczegóły", "show_keys": "Pokaż seed/klucze", "show_market_place": "Pokaż rynek", diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index 2653adde4..cf3adcf82 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -732,6 +732,8 @@ "shared_seed_wallet_groups": "Grupos de carteira de sementes compartilhados", "show": "Mostrar", "show_address_book_popup": "Mostre pop -up 'Adicionar ao livro de endereços' depois de enviar", + "show_balance": "Pressione há muito tempo para mostrar o equilíbrio", + "show_balance_toast": "Pressione há muito tempo para se esconder ou mostrar equilíbrio", "show_details": "Mostrar detalhes", "show_keys": "Mostrar semente/chaves", "show_market_place": "Mostrar mercado", diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index af7759316..0ba732a1c 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "Общие группы кошелька семян", "show": "Показывать", "show_address_book_popup": "Покажите всплывающее окно «Добавить в адрес адреса» после отправки", + "show_balance": "Длинная пресса, чтобы показать баланс", + "show_balance_toast": "Длинная нажавка, чтобы скрыть или показать баланс", "show_details": "Показать детали", "show_keys": "Показать мнемоническую фразу/ключи", "show_market_place": "Показать торговую площадку", diff --git a/res/values/strings_th.arb b/res/values/strings_th.arb index 43ef057ad..29764b302 100644 --- a/res/values/strings_th.arb +++ b/res/values/strings_th.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "กลุ่มกระเป๋าเงินที่ใช้ร่วมกัน", "show": "แสดง", "show_address_book_popup": "แสดง 'เพิ่มในสมุดรายชื่อ' ป๊อปอัพหลังจากส่ง", + "show_balance": "กดยาวเพื่อแสดงความสมดุล", + "show_balance_toast": "กดนานเพื่อซ่อนหรือแสดงความสมดุล", "show_details": "แสดงรายละเอียด", "show_keys": "แสดงซีด/คีย์", "show_market_place": "แสดงตลาดกลาง", diff --git a/res/values/strings_tl.arb b/res/values/strings_tl.arb index 1e845550d..772ed2cc0 100644 --- a/res/values/strings_tl.arb +++ b/res/values/strings_tl.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Ibinahaging mga pangkat ng pitaka ng binhi", "show": "Ipakita", "show_address_book_popup": "Ipakita ang popup na 'Idagdag sa Address Book' pagkatapos magpadala", + "show_balance": "Mahabang pindutin upang ipakita ang balanse", + "show_balance_toast": "Mahabang pindutin upang itago o ipakita ang balanse", "show_details": "Ipakita ang mga detalye", "show_keys": "Ipakita ang mga seed/key", "show_market_place": "Ipakita ang Marketplace", diff --git a/res/values/strings_tr.arb b/res/values/strings_tr.arb index 48567f883..34fc7da8c 100644 --- a/res/values/strings_tr.arb +++ b/res/values/strings_tr.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "Paylaşılan tohum cüzdan grupları", "show": "Göstermek", "show_address_book_popup": "Gönderdikten sonra 'adres defterine ekle' açılır", + "show_balance": "Dengeyi Göstermek İçin Uzun Basın", + "show_balance_toast": "Dengeyi gizlemek veya göstermek için uzun basın", "show_details": "Detayları Göster", "show_keys": "Tohumları/anahtarları göster", "show_market_place": "Pazar Yerini Göster", diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index 5d26be28d..35d12cbbb 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "Спільні групи насіннєвих гаманців", "show": "Показувати", "show_address_book_popup": "Показати спливаюче вікно \"Додати до адресної книги\" після надсилання", + "show_balance": "Довга преса, щоб показати рівновагу", + "show_balance_toast": "Довга преса, щоб приховати або показати рівновагу", "show_details": "Показати деталі", "show_keys": "Показати мнемонічну фразу/ключі", "show_market_place": "Відображати маркетплейс", diff --git a/res/values/strings_ur.arb b/res/values/strings_ur.arb index f9ca35bff..874b9913e 100644 --- a/res/values/strings_ur.arb +++ b/res/values/strings_ur.arb @@ -732,6 +732,8 @@ "shared_seed_wallet_groups": "مشترکہ بیج پرس گروپ", "show": "دکھائیں", "show_address_book_popup": "بھیجنے کے بعد 'ایڈریس میں شامل کریں کتاب' پاپ اپ دکھائیں", + "show_balance": "توازن ظاہر کرنے کے لئے طویل پریس", + "show_balance_toast": "توازن چھپانے یا ظاہر کرنے کے لئے طویل پریس", "show_details": "تفصیلات دکھائیں", "show_keys": "بیج / چابیاں دکھائیں۔", "show_market_place": "بازار دکھائیں۔", diff --git a/res/values/strings_vi.arb b/res/values/strings_vi.arb index 17c7cfc8d..5b3b08a6b 100644 --- a/res/values/strings_vi.arb +++ b/res/values/strings_vi.arb @@ -729,6 +729,8 @@ "shared_seed_wallet_groups": "Nhóm ví hạt được chia sẻ", "show": "Trình diễn", "show_address_book_popup": "Hiển thị cửa sổ bật lên 'Thêm vào sổ địa chỉ' sau khi gửi", + "show_balance": "Báo chí dài để hiển thị sự cân bằng", + "show_balance_toast": "Nhấn dài để ẩn hoặc hiển thị sự cân bằng", "show_details": "Hiển thị chi tiết", "show_keys": "Hiển thị hạt giống/khóa", "show_market_place": "Hiển thị Thị trường", diff --git a/res/values/strings_yo.arb b/res/values/strings_yo.arb index 8bd6b6a34..360676a7e 100644 --- a/res/values/strings_yo.arb +++ b/res/values/strings_yo.arb @@ -731,6 +731,8 @@ "shared_seed_wallet_groups": "Awọn ẹgbẹ ti a pin irugbin", "show": "Fihan", "show_address_book_popup": "Fihan 'ṣafikun si Agbejade Iwe' Lẹhin fifiranṣẹ", + "show_balance": "Tẹ Tẹ lati ṣafihan iwọntunwọnsi", + "show_balance_toast": "Tẹ Tẹ lati tọju tabi ṣafihan iwọntunwọnsi", "show_details": "Fi ìsọfúnni kékeré hàn", "show_keys": "Wo hóró / àwọn kọ́kọ́rọ́", "show_market_place": "Wa Sopọ Pataki", diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 483b10050..e032c40c4 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -730,6 +730,8 @@ "shared_seed_wallet_groups": "共享种子钱包组", "show": "展示", "show_address_book_popup": "发送后显示“添加到通讯簿”弹出窗口", + "show_balance": "长印刷以显示平衡", + "show_balance_toast": "长按以隐藏或显示平衡", "show_details": "显示详细信息", "show_keys": "显示种子/密钥", "show_market_place": "显示市场", From da9c30980581c470e6f06ac4616a51ed9e7ae82b Mon Sep 17 00:00:00 2001 From: cyan Date: Sat, 4 Jan 2025 05:28:04 +0100 Subject: [PATCH 12/14] CW-873 automatically export outputs (#1885) * automatically export outputs * remove print statements * update configure script * Update logic behind import/export keyimages/outputs * discussed changes * replace store with just waiting for the wallet to update it's state --- cw_monero/lib/api/wallet.dart | 6 ++++-- cw_monero/lib/monero_wallet.dart | 8 ++++++++ lib/monero/cw_monero.dart | 6 ++++++ lib/src/screens/send/send_page.dart | 15 +++++++++++++++ tool/configure.dart | 2 ++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/cw_monero/lib/api/wallet.dart b/cw_monero/lib/api/wallet.dart index 78153a654..537c9802e 100644 --- a/cw_monero/lib/api/wallet.dart +++ b/cw_monero/lib/api/wallet.dart @@ -126,8 +126,10 @@ Future setupNodeSync( if (status != 0) { final error = monero.Wallet_errorString(wptr!); - printV("error: $error"); - throw SetupWalletException(message: error); + if (error != "no tx keys found for this txid") { + printV("error: $error"); + throw SetupWalletException(message: error); + } } if (kDebugMode) { diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 4d2f95e47..54c36a828 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -265,6 +265,14 @@ abstract class MoneroWalletBase extends WalletBase createTransaction(Object credentials) async { final _credentials = credentials as MoneroTransactionCreationCredentials; diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 89b1579fc..037ab8f9c 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -391,6 +391,12 @@ class CWMonero extends Monero { return moneroWallet.exportOutputsUR(all); } + @override + bool needExportOutputs(Object wallet, int amount) { + final moneroWallet = wallet as MoneroWallet; + return moneroWallet.needExportOutputs(amount); + } + @override void monerocCheck() { checkIfMoneroCIsFine(); diff --git a/lib/src/screens/send/send_page.dart b/lib/src/screens/send/send_page.dart index ca471c4f2..a52bd11e9 100644 --- a/lib/src/screens/send/send_page.dart +++ b/lib/src/screens/send/send_page.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/entities/contact_record.dart'; import 'package:cake_wallet/core/execution_state.dart'; import 'package:cake_wallet/entities/fiat_currency.dart'; import 'package:cake_wallet/entities/template.dart'; +import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/reactions/wallet_connect.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/routes.dart'; @@ -412,6 +413,20 @@ class SendPage extends BasePage { } } + if (sendViewModel.wallet.type == WalletType.monero) { + int amount = 0; + for (var item in sendViewModel.outputs) { + amount += item.formattedCryptoAmount; + } + if (monero!.needExportOutputs(sendViewModel.wallet, amount)) { + await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, arguments: 'export-outputs'); + await Future.delayed(Duration(seconds: 1)); // wait for monero to refresh the state + } + if (monero!.needExportOutputs(sendViewModel.wallet, amount)) { + return; + } + } + final check = sendViewModel.shouldDisplayTotp(); authService.authenticateAction( context, diff --git a/tool/configure.dart b/tool/configure.dart index c08ef3a34..44d42fa55 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -387,6 +387,8 @@ abstract class Monero { String exportOutputsUR(Object wallet, bool all); + bool needExportOutputs(Object wallet, int amount); + bool importKeyImagesUR(Object wallet, String ur); WalletCredentials createMoneroRestoreWalletFromKeysCredentials({ From cee3abcb7230669c35b7e8f0a4a5c3f7205caf2f Mon Sep 17 00:00:00 2001 From: tuxsudo Date: Sat, 4 Jan 2025 01:50:06 -0500 Subject: [PATCH 13/14] Balance card fixes (#1933) --- .../pages/balance/balance_row_widget.dart | 347 ++++++++---------- .../dashboard/balance_view_model.dart | 10 +- 2 files changed, 160 insertions(+), 197 deletions(-) diff --git a/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart b/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart index 155348ebf..f86c72b80 100644 --- a/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart +++ b/lib/src/screens/dashboard/pages/balance/balance_row_widget.dart @@ -78,15 +78,13 @@ class BalanceRowWidget extends StatelessWidget { color: Theme.of(context).extension()!.syncedBackgroundColor, ), child: TextButton( - onPressed: () => - Fluttertoast.showToast( - msg: S.current.show_balance_toast, - backgroundColor: Color.fromRGBO(0, 0, 0, 0.85), - ), + onPressed: () => Fluttertoast.showToast( + msg: S.current.show_balance_toast, + backgroundColor: Color.fromRGBO(0, 0, 0, 0.85), + ), onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), style: TextButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)), ), child: Container( margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10), @@ -103,11 +101,8 @@ class BalanceRowWidget extends StatelessWidget { GestureDetector( behavior: HitTestBehavior.opaque, onTap: hasAdditionalBalance - ? () => - _showBalanceDescription( - context, S - .of(context) - .available_balance_description) + ? () => _showBalanceDescription( + context, S.of(context).available_balance_description) : null, child: Row( children: [ @@ -150,16 +145,14 @@ class BalanceRowWidget extends StatelessWidget { textAlign: TextAlign.start), SizedBox(height: 6), if (isTestnet) - Text(S - .of(context) - .testnet_coins_no_value, + Text(S.of(context).testnet_coins_no_value, textAlign: TextAlign.center, style: TextStyle( fontSize: 14, fontFamily: 'Lato', fontWeight: FontWeight.w400, color: - Theme.of(context).extension()!.textColor, + Theme.of(context).extension()!.textColor, height: 1)), if (!isTestnet) Text('${availableFiatBalance}', @@ -169,7 +162,7 @@ class BalanceRowWidget extends StatelessWidget { fontFamily: 'Lato', fontWeight: FontWeight.w500, color: - Theme.of(context).extension()!.textColor, + Theme.of(context).extension()!.textColor, height: 1)), ], ), @@ -218,123 +211,98 @@ class BalanceRowWidget extends StatelessWidget { ), //), if (frozenBalance.isNotEmpty) - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: hasAdditionalBalance - ? () => - _showBalanceDescription( - context, S - .of(context) - .unavailable_balance_description) - : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 26), - Row( - children: [ - Text( - S - .of(context) - .unavailable_balance, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, - color: - Theme.of(context).extension()!.labelTextColor, - height: 1, - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: Icon(Icons.help_outline, - size: 16, - color: Theme.of(context) - .extension()! - .labelTextColor), - ), - ], - ), - SizedBox(height: 8), - AutoSizeText( - frozenBalance, - style: TextStyle( - fontSize: 20, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, - color: - Theme.of(context).extension()!.balanceAmountColor, - height: 1, - ), - maxLines: 1, - textAlign: TextAlign.center, - ), - SizedBox(height: 4), - if (!isTestnet) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 26), + Row( + children: [ Text( - frozenFiatBalance, + S.of(context).frozen_balance, textAlign: TextAlign.center, style: TextStyle( fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.textColor, + color: + Theme.of(context).extension()!.labelTextColor, height: 1, ), ), - ], - ), - ), - if (hasAdditionalBalance) - GestureDetector( - onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 24), + ], + ), + SizedBox(height: 8), + AutoSizeText( + frozenBalance, + style: TextStyle( + fontSize: 20, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: + Theme.of(context).extension()!.balanceAmountColor, + height: 1, + ), + maxLines: 1, + textAlign: TextAlign.center, + ), + SizedBox(height: 4), + if (!isTestnet) Text( - '${additionalBalanceLabel}', + frozenFiatBalance, textAlign: TextAlign.center, style: TextStyle( fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()! - .labelTextColor, + color: Theme.of(context).extension()!.textColor, height: 1, ), ), - SizedBox(height: 8), - AutoSizeText( - additionalBalance, + ], + ), + if (hasAdditionalBalance) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24), + Text( + '${additionalBalanceLabel}', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: Theme.of(context).extension()!.labelTextColor, + height: 1, + ), + ), + SizedBox(height: 8), + AutoSizeText( + additionalBalance, + style: TextStyle( + fontSize: 20, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: Theme.of(context).extension()!.assetTitleColor, + height: 1, + ), + maxLines: 1, + textAlign: TextAlign.center, + ), + SizedBox(height: 4), + if (!isTestnet) + Text( + '${additionalFiatBalance}', + textAlign: TextAlign.center, style: TextStyle( - fontSize: 20, + fontSize: 12, fontFamily: 'Lato', fontWeight: FontWeight.w400, - color: Theme.of(context).extension()! - .assetTitleColor, + color: Theme.of(context).extension()!.textColor, height: 1, ), - maxLines: 1, - textAlign: TextAlign.center, ), - SizedBox(height: 4), - if (!isTestnet) - Text( - '${additionalFiatBalance}', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, - color: Theme.of(context).extension()!.textColor, - height: 1, - ), - ), - ], - ), + ], ), ], ), @@ -353,12 +321,20 @@ class BalanceRowWidget extends StatelessWidget { ), color: Theme.of(context).extension()!.syncedBackgroundColor, ), - child: Container( + child: TextButton( + onPressed: () => Fluttertoast.showToast( + msg: S.current.show_balance_toast, + backgroundColor: Color.fromRGBO(0, 0, 0, 0.85), + ), + onLongPress: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), + style: TextButton.styleFrom( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: const EdgeInsets.only(top: 16, left: 24, right: 8, bottom: 16), + margin: const EdgeInsets.only(top: 10, left: 12, right: 12, bottom: 10), child: Stack( children: [ if (currency == CryptoCurrency.ltc) @@ -366,7 +342,6 @@ class BalanceRowWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, children: [ Container( - padding: EdgeInsets.only(right: 16, top: 0), child: Column( children: [ Container( @@ -397,81 +372,77 @@ class BalanceRowWidget extends StatelessWidget { ], ), if (hasSecondAvailableBalance) - GestureDetector( - onTap: () => dashboardViewModel.balanceViewModel.switchBalanceValue(), - child: Row( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () => - launchUrl( - Uri.parse( - "https://docs.cakewallet.com/cryptos/litecoin.html#mweb"), - mode: LaunchMode.externalApplication, + Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => launchUrl( + Uri.parse( + "https://docs.cakewallet.com/cryptos/litecoin#mweb"), + mode: LaunchMode.externalApplication, + ), + child: Row( + children: [ + Text( + '${secondAvailableBalanceLabel}', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontFamily: 'Lato', + fontWeight: FontWeight.w400, + color: Theme.of(context) + .extension()! + .labelTextColor, + height: 1, ), - child: Row( - children: [ - Text( - '${secondAvailableBalanceLabel}', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 12, - fontFamily: 'Lato', - fontWeight: FontWeight.w400, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: Icon(Icons.help_outline, + size: 16, color: Theme.of(context) .extension()! - .labelTextColor, - height: 1, - ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: Icon(Icons.help_outline, - size: 16, - color: Theme.of(context) - .extension()! - .labelTextColor), - ) - ], - ), + .labelTextColor), + ) + ], ), - SizedBox(height: 8), - AutoSizeText( - secondAvailableBalance, + ), + SizedBox(height: 8), + AutoSizeText( + secondAvailableBalance, + style: TextStyle( + fontSize: 24, + fontFamily: 'Lato', + fontWeight: FontWeight.w900, + color: Theme.of(context) + .extension()! + .assetTitleColor, + height: 1, + ), + maxLines: 1, + textAlign: TextAlign.center, + ), + SizedBox(height: 6), + if (!isTestnet) + Text( + '${secondAvailableFiatBalance}', + textAlign: TextAlign.center, style: TextStyle( - fontSize: 24, + fontSize: 16, fontFamily: 'Lato', - fontWeight: FontWeight.w900, + fontWeight: FontWeight.w500, color: Theme.of(context) .extension()! - .assetTitleColor, + .textColor, height: 1, ), - maxLines: 1, - textAlign: TextAlign.center, ), - SizedBox(height: 6), - if (!isTestnet) - Text( - '${secondAvailableFiatBalance}', - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - fontFamily: 'Lato', - fontWeight: FontWeight.w500, - color: Theme.of(context) - .extension()! - .textColor, - height: 1, - ), - ), - ], - ), - ], - ), + ], + ), + ], ), ], ), @@ -539,19 +510,17 @@ class BalanceRowWidget extends StatelessWidget { ), IntrinsicHeight( child: Container( - padding: EdgeInsets.symmetric(horizontal: 24), + padding: EdgeInsets.symmetric(horizontal: 12), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( child: Semantics( - label: S - .of(context) - .litecoin_mweb_pegin, + label: S.of(context).litecoin_mweb_pegin, child: OutlinedButton( onPressed: () { final mwebAddress = - bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet); + bitcoin!.getUnusedMwebAddress(dashboardViewModel.wallet); PaymentRequest? paymentRequest = null; if ((mwebAddress?.isNotEmpty ?? false)) { paymentRequest = PaymentRequest.fromUri( @@ -589,9 +558,7 @@ class BalanceRowWidget extends StatelessWidget { ), const SizedBox(width: 8), Text( - S - .of(context) - .litecoin_mweb_pegin, + S.of(context).litecoin_mweb_pegin, style: TextStyle( color: Theme.of(context) .extension()! @@ -607,13 +574,11 @@ class BalanceRowWidget extends StatelessWidget { SizedBox(width: 24), Expanded( child: Semantics( - label: S - .of(context) - .litecoin_mweb_pegout, + label: S.of(context).litecoin_mweb_pegout, child: OutlinedButton( onPressed: () { final litecoinAddress = - bitcoin!.getUnusedSegwitAddress(dashboardViewModel.wallet); + bitcoin!.getUnusedSegwitAddress(dashboardViewModel.wallet); PaymentRequest? paymentRequest = null; if ((litecoinAddress?.isNotEmpty ?? false)) { paymentRequest = PaymentRequest.fromUri( @@ -651,9 +616,7 @@ class BalanceRowWidget extends StatelessWidget { ), const SizedBox(width: 8), Text( - S - .of(context) - .litecoin_mweb_pegout, + S.of(context).litecoin_mweb_pegout, style: TextStyle( color: Theme.of(context) .extension()! diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index dbc0cce1d..5ca11e2bb 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -218,13 +218,13 @@ abstract class BalanceViewModelBase with Store { availableBalance: '●●●●●●', additionalBalance: additionalBalance, frozenBalance: '', - secondAvailableBalance: '', - secondAdditionalBalance: '', - fiatAdditionalBalance: isFiatDisabled ? '' : '', + secondAvailableBalance: '●●●●●●', + secondAdditionalBalance: '●●●●●●', + fiatAdditionalBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●', fiatAvailableBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●', fiatFrozenBalance: isFiatDisabled ? '' : '', - fiatSecondAvailableBalance: isFiatDisabled ? '' : '', - fiatSecondAdditionalBalance: isFiatDisabled ? '' : '', + fiatSecondAvailableBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●', + fiatSecondAdditionalBalance: isFiatDisabled ? '' : '${fiatCurrency.toString()} ●●●●●', asset: key, formattedAssetTitle: _formatterAsset(key))); } From d1c45a5326317b0b78675d34f4d827a88a5bba5a Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Sun, 5 Jan 2025 03:11:44 +0200 Subject: [PATCH 14/14] 4.22.1 RC (#1932) * 4.22.1 RC * minor cleanup [skip ci] * Fix frozen balance not displaying at startup issue * Monero balance tx display issue (#1934) * minor cleanup [skip ci] * Fix frozen balance not displaying at startup issue * fix transactions not updating (stupid mobx reactions :3) * [skip ci] --- assets/text/Monerocom_Release_Notes.txt | 5 ++- assets/text/Release_Notes.txt | 9 +++-- cw_monero/lib/monero_wallet.dart | 34 ++++--------------- ios/Podfile.lock | 2 +- .../dashboard/dashboard_view_model.dart | 6 ++-- scripts/android/app_env.sh | 8 ++--- scripts/ios/app_env.sh | 8 ++--- scripts/linux/app_env.sh | 4 +-- scripts/macos/app_env.sh | 8 ++--- scripts/windows/build_exe_installer.iss | 2 +- 10 files changed, 32 insertions(+), 54 deletions(-) diff --git a/assets/text/Monerocom_Release_Notes.txt b/assets/text/Monerocom_Release_Notes.txt index 3a6706a26..09092a8df 100644 --- a/assets/text/Monerocom_Release_Notes.txt +++ b/assets/text/Monerocom_Release_Notes.txt @@ -1,3 +1,2 @@ -Support Monero Ledger -Bug fixes -New designs and better user experience \ No newline at end of file +UI enhancements +Bug fixes \ No newline at end of file diff --git a/assets/text/Release_Notes.txt b/assets/text/Release_Notes.txt index f7d5e4d2c..8abed72a2 100644 --- a/assets/text/Release_Notes.txt +++ b/assets/text/Release_Notes.txt @@ -1,5 +1,4 @@ -Support Monero Ledger -Prepare for Haven removal -Improve Ethereum and Polygon sending process -Bug fixes -New designs and better user experience \ No newline at end of file +Bitcoin and Litecoin enhancements +Solana and Nano fixes/improvements +UI enhancements +Bug fixes \ No newline at end of file diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 54c36a828..b46e8dd10 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -7,7 +7,6 @@ import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/account.dart'; import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_core/monero_balance.dart'; import 'package:cw_core/monero_transaction_priority.dart'; import 'package:cw_core/monero_wallet_keys.dart'; @@ -28,7 +27,6 @@ import 'package:cw_monero/api/transaction_history.dart' as transaction_history; import 'package:cw_monero/api/wallet.dart' as monero_wallet; import 'package:cw_monero/api/wallet_manager.dart'; import 'package:cw_monero/exceptions/monero_transaction_creation_exception.dart'; -import 'package:cw_monero/exceptions/monero_transaction_no_inputs_exception.dart'; import 'package:cw_monero/ledger.dart'; import 'package:cw_monero/monero_transaction_creation_credentials.dart'; import 'package:cw_monero/monero_transaction_history.dart'; @@ -58,8 +56,9 @@ abstract class MoneroWalletBase extends WalletBase.of({ CryptoCurrency.xmr: MoneroBalance( - fullBalance: monero_wallet.getFullBalance(accountIndex: 0), - unlockedBalance: monero_wallet.getFullBalance(accountIndex: 0)) + fullBalance: monero_wallet.getFullBalance(accountIndex: 0), + unlockedBalance: monero_wallet.getUnlockedBalance(accountIndex: 0), + ) }), _isTransactionUpdating = false, _hasSyncAfterStartup = false, @@ -281,7 +280,6 @@ abstract class MoneroWalletBase extends WalletBase 1; final unlockedBalance = monero_wallet.getUnlockedBalance( accountIndex: walletAddresses.account!.id); - var allInputsAmount = 0; PendingTransactionDescription pendingTransactionDescription; @@ -295,11 +293,9 @@ abstract class MoneroWalletBase extends WalletBase acc + (value.formattedCryptoAmount ?? 0)); - final estimatedFee = - calculateEstimatedFee(_credentials.priority, totalAmount); if (unlockedBalance < totalAmount) { throw MoneroTransactionCreationException( 'You do not have enough XMR to send this amount.'); @@ -342,8 +336,6 @@ abstract class MoneroWalletBase extends WalletBase _askForUpdateTransactionHistory() async => await updateTransactions(); - int _getFullBalance() => - monero_wallet.getFullBalance(accountIndex: walletAddresses.account!.id); - int _getUnlockedBalance() => monero_wallet.getUnlockedBalance( accountIndex: walletAddresses.account!.id); int _getFrozenBalance() { var frozenBalance = 0; - unspentCoinsInfo.values.forEach((info) { - unspentCoins.forEach((element) { - if (element.hash == info.hash && - element.vout == info.vout && - info.isFrozen && - element.value == info.value && info.walletId == id && - info.accountIndex == walletAddresses.account!.id) { - if (element.isFrozen && !element.isSending) frozenBalance+= element.value; - } - }); - }); + for (var coin in unspentCoinsInfo.values.where((element) => + element.walletId == id && element.accountIndex == walletAddresses.account!.id)) { + if (coin.isFrozen && !coin.isSending) frozenBalance += coin.value; + } return frozenBalance; } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8046ba307..9e2a8507a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -272,7 +272,7 @@ SPEC CHECKSUMS: uni_links: d97da20c7701486ba192624d99bffaaffcfc298a universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe - wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 + wakelock_plus: 373cfe59b235a6dd5837d0fb88791d2f13a90d56 workmanager: 0afdcf5628bbde6924c21af7836fed07b42e30e6 PODFILE CHECKSUM: e448f662d4c41f0c0b1ccbb78afd57dbf895a597 diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 387c66511..4ab171a15 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -641,7 +641,7 @@ abstract class DashboardViewModelBase with Store { transactions.clear(); - transactions = ObservableList.of( + transactions.addAll( wallet.transactionHistory.transactions.values.map( (transaction) => TransactionListItem( transaction: transaction, @@ -703,7 +703,7 @@ abstract class DashboardViewModelBase with Store { monero!.getTransactionInfoAccountId(tx) == monero!.getCurrentAccount(wallet).id) .toList(); - transactions = ObservableList.of( + transactions.addAll( _accountTransactions.map( (transaction) => TransactionListItem( transaction: transaction, @@ -723,7 +723,7 @@ abstract class DashboardViewModelBase with Store { wow.wownero!.getCurrentAccount(wallet).id) .toList(); - transactions = ObservableList.of( + transactions.addAll( _accountTransactions.map( (transaction) => TransactionListItem( transaction: transaction, diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 385414f24..6b1907451 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.19.0" -MONERO_COM_BUILD_NUMBER=109 +MONERO_COM_VERSION="1.19.1" +MONERO_COM_BUILD_NUMBER=110 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_SCHEME="monero.com" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.22.0" -CAKEWALLET_BUILD_NUMBER=240 +CAKEWALLET_VERSION="4.22.1" +CAKEWALLET_BUILD_NUMBER=241 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_SCHEME="cakewallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index 580adad8e..c1747c502 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN) APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.19.0" -MONERO_COM_BUILD_NUMBER=106 +MONERO_COM_VERSION="1.19.1" +MONERO_COM_BUILD_NUMBER=107 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="4.22.0" -CAKEWALLET_BUILD_NUMBER=287 +CAKEWALLET_VERSION="4.22.1" +CAKEWALLET_BUILD_NUMBER=288 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" HAVEN_NAME="Haven" diff --git a/scripts/linux/app_env.sh b/scripts/linux/app_env.sh index 6d8557d6c..f0ec8e9e6 100755 --- a/scripts/linux/app_env.sh +++ b/scripts/linux/app_env.sh @@ -14,8 +14,8 @@ if [ -n "$1" ]; then fi CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="1.12.0" -CAKEWALLET_BUILD_NUMBER=41 +CAKEWALLET_VERSION="1.12.1" +CAKEWALLET_BUILD_NUMBER=42 if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then echo "Wrong app type." diff --git a/scripts/macos/app_env.sh b/scripts/macos/app_env.sh index 37e7890c4..fe3d806d8 100755 --- a/scripts/macos/app_env.sh +++ b/scripts/macos/app_env.sh @@ -16,13 +16,13 @@ if [ -n "$1" ]; then fi MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="1.9.0" -MONERO_COM_BUILD_NUMBER=39 +MONERO_COM_VERSION="1.9.1" +MONERO_COM_BUILD_NUMBER=40 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="1.15.0" -CAKEWALLET_BUILD_NUMBER=99 +CAKEWALLET_VERSION="1.15.1" +CAKEWALLET_BUILD_NUMBER=100 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then diff --git a/scripts/windows/build_exe_installer.iss b/scripts/windows/build_exe_installer.iss index 155e65005..950800896 100644 --- a/scripts/windows/build_exe_installer.iss +++ b/scripts/windows/build_exe_installer.iss @@ -1,5 +1,5 @@ #define MyAppName "Cake Wallet" -#define MyAppVersion "0.3.0" +#define MyAppVersion "0.3.1" #define MyAppPublisher "Cake Labs LLC" #define MyAppURL "https://cakewallet.com/" #define MyAppExeName "CakeWallet.exe"