2024-11-09 18:59:47 +00:00
|
|
|
import 'package:cake_wallet/di.dart';
|
2024-03-19 22:44:00 +00:00
|
|
|
import 'package:cake_wallet/entities/contact.dart';
|
2022-11-23 17:06:41 +00:00
|
|
|
import 'package:cake_wallet/entities/priority_for_wallet_type.dart';
|
2020-11-06 18:54:00 +00:00
|
|
|
import 'package:cake_wallet/entities/transaction_description.dart';
|
2023-10-05 01:09:07 +00:00
|
|
|
import 'package:cake_wallet/ethereum/ethereum.dart';
|
2024-03-28 12:41:11 +00:00
|
|
|
import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
|
|
|
import 'package:cake_wallet/exchange/provider/thorchain_exchange.provider.dart';
|
2023-10-05 01:09:07 +00:00
|
|
|
import 'package:cake_wallet/nano/nano.dart';
|
|
|
|
import 'package:cake_wallet/core/wallet_change_listener_view_model.dart';
|
|
|
|
import 'package:cake_wallet/entities/contact_record.dart';
|
2023-08-04 13:49:26 +00:00
|
|
|
import 'package:cake_wallet/entities/wallet_contact.dart';
|
2023-12-02 02:26:43 +00:00
|
|
|
import 'package:cake_wallet/polygon/polygon.dart';
|
|
|
|
import 'package:cake_wallet/reactions/wallet_connect.dart';
|
2024-11-09 18:59:47 +00:00
|
|
|
import 'package:cake_wallet/routes.dart';
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
import 'package:cake_wallet/solana/solana.dart';
|
2024-11-09 18:59:47 +00:00
|
|
|
import 'package:cake_wallet/src/screens/ur/animated_ur_page.dart';
|
2023-10-05 01:09:07 +00:00
|
|
|
import 'package:cake_wallet/store/app_store.dart';
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
import 'package:cake_wallet/tron/tron.dart';
|
2023-08-04 13:49:26 +00:00
|
|
|
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
|
2022-04-22 15:00:28 +00:00
|
|
|
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
import 'package:cake_wallet/wownero/wownero.dart';
|
2024-03-29 18:51:34 +00:00
|
|
|
import 'package:cw_core/exceptions.dart';
|
2024-08-23 13:19:42 +00:00
|
|
|
import 'package:cw_core/transaction_info.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/transaction_priority.dart';
|
2024-10-14 21:28:38 +00:00
|
|
|
import 'package:cw_core/unspent_coin_type.dart';
|
2021-08-10 14:52:35 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/output.dart';
|
2021-07-16 09:32:36 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
|
2024-11-09 18:59:47 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2020-11-06 18:54:00 +00:00
|
|
|
import 'package:hive/hive.dart';
|
2020-10-30 16:32:21 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
2020-10-07 05:58:22 +00:00
|
|
|
import 'package:cake_wallet/entities/template.dart';
|
2020-08-25 16:32:40 +00:00
|
|
|
import 'package:cake_wallet/core/address_validator.dart';
|
|
|
|
import 'package:cake_wallet/core/amount_validator.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/pending_transaction.dart';
|
2020-08-25 16:32:40 +00:00
|
|
|
import 'package:cake_wallet/core/validator.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/core/execution_state.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cake_wallet/monero/monero.dart';
|
|
|
|
import 'package:cw_core/sync_status.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
|
|
|
import 'package:cake_wallet/entities/calculate_fiat_amount.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
2020-08-25 16:32:40 +00:00
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
|
|
|
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
2021-11-02 09:17:24 +00:00
|
|
|
import 'package:cake_wallet/entities/parsed_address.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
2022-03-30 15:57:04 +00:00
|
|
|
import 'package:cake_wallet/haven/haven.dart';
|
2023-09-25 12:20:11 +00:00
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2024-04-08 14:54:58 +00:00
|
|
|
import 'package:collection/collection.dart';
|
2020-08-25 16:32:40 +00:00
|
|
|
|
|
|
|
part 'send_view_model.g.dart';
|
|
|
|
|
|
|
|
class SendViewModel = SendViewModelBase with _$SendViewModel;
|
|
|
|
|
2023-09-01 15:06:18 +00:00
|
|
|
abstract class SendViewModelBase extends WalletChangeListenerViewModel with Store {
|
|
|
|
@override
|
|
|
|
void onWalletChange(wallet) {
|
|
|
|
currencies = wallet.balance.keys.toList();
|
|
|
|
selectedCryptoCurrency = wallet.currency;
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
hasMultipleTokens = isEVMCompatibleChain(wallet.type) ||
|
|
|
|
wallet.type == WalletType.solana ||
|
|
|
|
wallet.type == WalletType.tron;
|
2023-09-01 15:06:18 +00:00
|
|
|
}
|
|
|
|
|
2022-01-25 14:43:19 +00:00
|
|
|
SendViewModelBase(
|
2023-09-01 15:06:18 +00:00
|
|
|
AppStore appStore,
|
|
|
|
this.sendTemplateViewModel,
|
|
|
|
this._fiatConversationStore,
|
|
|
|
this.balanceViewModel,
|
|
|
|
this.contactListViewModel,
|
|
|
|
this.transactionDescriptionBox,
|
2024-10-14 21:28:38 +00:00
|
|
|
this.ledgerViewModel, {
|
|
|
|
this.coinTypeToSpendFrom = UnspentCoinType.any,
|
|
|
|
}) : state = InitialExecutionState(),
|
2023-09-01 15:06:18 +00:00
|
|
|
currencies = appStore.wallet!.balance.keys.toList(),
|
|
|
|
selectedCryptoCurrency = appStore.wallet!.currency,
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
hasMultipleTokens = isEVMCompatibleChain(appStore.wallet!.type) ||
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
appStore.wallet!.type == WalletType.solana ||
|
|
|
|
appStore.wallet!.type == WalletType.tron,
|
2022-11-25 20:51:07 +00:00
|
|
|
outputs = ObservableList<Output>(),
|
2023-09-01 15:06:18 +00:00
|
|
|
_settingsStore = appStore.settingsStore,
|
|
|
|
fiatFromSettings = appStore.settingsStore.fiatCurrency,
|
|
|
|
super(appStore: appStore) {
|
2024-04-08 14:54:58 +00:00
|
|
|
if (wallet.type == WalletType.bitcoin &&
|
|
|
|
_settingsStore.priority[wallet.type] == bitcoinTransactionPriorityCustom) {
|
|
|
|
setTransactionPriority(bitcoinTransactionPriorityMedium);
|
|
|
|
}
|
2023-09-01 15:06:18 +00:00
|
|
|
final priority = _settingsStore.priority[wallet.type];
|
|
|
|
final priorities = priorityForWalletType(wallet.type);
|
2023-10-05 01:09:07 +00:00
|
|
|
if (!priorityForWalletType(wallet.type).contains(priority) && priorities.isNotEmpty) {
|
2023-09-01 15:06:18 +00:00
|
|
|
_settingsStore.priority[wallet.type] = priorities.first;
|
2021-01-06 08:42:21 +00:00
|
|
|
}
|
2023-08-04 13:49:26 +00:00
|
|
|
|
|
|
|
outputs
|
2023-09-01 15:06:18 +00:00
|
|
|
.add(Output(wallet, _settingsStore, _fiatConversationStore, () => selectedCryptoCurrency));
|
2020-09-21 11:50:26 +00:00
|
|
|
}
|
2020-08-25 16:32:40 +00:00
|
|
|
|
|
|
|
@observable
|
2020-09-21 11:50:26 +00:00
|
|
|
ExecutionState state;
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2021-08-10 14:52:35 +00:00
|
|
|
ObservableList<Output> outputs;
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2024-10-14 21:28:38 +00:00
|
|
|
final UnspentCoinType coinTypeToSpendFrom;
|
|
|
|
|
2021-07-16 09:32:36 +00:00
|
|
|
@action
|
2021-08-10 14:52:35 +00:00
|
|
|
void addOutput() {
|
2023-08-04 13:49:26 +00:00
|
|
|
outputs
|
2023-09-01 15:06:18 +00:00
|
|
|
.add(Output(wallet, _settingsStore, _fiatConversationStore, () => selectedCryptoCurrency));
|
2021-07-16 09:32:36 +00:00
|
|
|
}
|
2021-01-27 13:51:51 +00:00
|
|
|
|
2021-07-16 09:32:36 +00:00
|
|
|
@action
|
2021-08-10 14:52:35 +00:00
|
|
|
void removeOutput(Output output) {
|
2021-08-12 14:56:34 +00:00
|
|
|
if (isBatchSending) {
|
|
|
|
outputs.remove(output);
|
|
|
|
}
|
2021-07-16 09:32:36 +00:00
|
|
|
}
|
2021-01-27 13:51:51 +00:00
|
|
|
|
2021-07-16 09:32:36 +00:00
|
|
|
@action
|
2021-08-10 14:52:35 +00:00
|
|
|
void clearOutputs() {
|
|
|
|
outputs.clear();
|
|
|
|
addOutput();
|
2021-01-27 13:51:51 +00:00
|
|
|
}
|
2020-09-30 18:23:15 +00:00
|
|
|
|
2020-12-29 18:48:57 +00:00
|
|
|
@computed
|
2021-08-10 14:52:35 +00:00
|
|
|
bool get isBatchSending => outputs.length > 1;
|
2020-12-29 18:48:57 +00:00
|
|
|
|
2024-10-17 01:17:29 +00:00
|
|
|
bool get shouldDisplaySendALL {
|
|
|
|
if (walletType == WalletType.solana) return false;
|
|
|
|
|
|
|
|
if (walletType == WalletType.ethereum && selectedCryptoCurrency == CryptoCurrency.eth)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (walletType == WalletType.polygon && selectedCryptoCurrency == CryptoCurrency.matic)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
|
2020-12-29 18:48:57 +00:00
|
|
|
@computed
|
|
|
|
String get pendingTransactionFiatAmount {
|
2023-10-05 01:09:07 +00:00
|
|
|
if (pendingTransaction == null) {
|
|
|
|
return '0.00';
|
|
|
|
}
|
|
|
|
|
2020-12-29 18:48:57 +00:00
|
|
|
try {
|
2023-10-05 01:09:07 +00:00
|
|
|
final fiat = calculateFiatAmount(
|
|
|
|
price: _fiatConversationStore.prices[selectedCryptoCurrency]!,
|
|
|
|
cryptoAmount: pendingTransaction!.amountFormatted);
|
|
|
|
return fiat;
|
2020-12-29 18:48:57 +00:00
|
|
|
} catch (_) {
|
|
|
|
return '0.00';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-30 14:54:55 +00:00
|
|
|
@computed
|
|
|
|
String get pendingTransactionFeeFiatAmount {
|
|
|
|
try {
|
|
|
|
if (pendingTransaction != null) {
|
2024-05-28 13:32:36 +00:00
|
|
|
final currency = pendingTransactionFeeCurrency(walletType);
|
2020-12-30 14:54:55 +00:00
|
|
|
final fiat = calculateFiatAmount(
|
2023-08-04 17:01:49 +00:00
|
|
|
price: _fiatConversationStore.prices[currency]!,
|
2022-10-12 17:09:57 +00:00
|
|
|
cryptoAmount: pendingTransaction!.feeFormatted);
|
2020-12-30 14:54:55 +00:00
|
|
|
return fiat;
|
|
|
|
} else {
|
|
|
|
return '0.00';
|
|
|
|
}
|
|
|
|
} catch (_) {
|
|
|
|
return '0.00';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-28 13:32:36 +00:00
|
|
|
CryptoCurrency pendingTransactionFeeCurrency(WalletType type) {
|
|
|
|
switch (type) {
|
|
|
|
case WalletType.ethereum:
|
|
|
|
case WalletType.polygon:
|
|
|
|
case WalletType.tron:
|
|
|
|
case WalletType.solana:
|
|
|
|
return wallet.currency;
|
|
|
|
default:
|
|
|
|
return selectedCryptoCurrency;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
FiatCurrency get fiat => _settingsStore.fiatCurrency;
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
TransactionPriority get transactionPriority {
|
2023-09-01 15:06:18 +00:00
|
|
|
final priority = _settingsStore.priority[wallet.type];
|
2022-10-12 17:09:57 +00:00
|
|
|
|
|
|
|
if (priority == null) {
|
2023-09-01 15:06:18 +00:00
|
|
|
throw Exception('Unexpected type ${wallet.type}');
|
2022-10-12 17:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return priority;
|
|
|
|
}
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2024-04-08 14:54:58 +00:00
|
|
|
int? getCustomPriorityIndex(List<TransactionPriority> priorities) {
|
|
|
|
if (wallet.type == WalletType.bitcoin) {
|
2024-04-12 14:01:21 +00:00
|
|
|
final customItem = priorities
|
|
|
|
.firstWhereOrNull((element) => element == bitcoin!.getBitcoinTransactionPriorityCustom());
|
2024-04-08 14:54:58 +00:00
|
|
|
|
|
|
|
return customItem != null ? priorities.indexOf(customItem) : null;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-04-25 16:28:18 +00:00
|
|
|
int? get maxCustomFeeRate {
|
|
|
|
if (wallet.type == WalletType.bitcoin) {
|
|
|
|
return bitcoin!.getMaxCustomFeeRate(wallet);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-04-08 14:54:58 +00:00
|
|
|
@computed
|
|
|
|
int get customBitcoinFeeRate => _settingsStore.customBitcoinFeeRate;
|
|
|
|
|
|
|
|
void set customBitcoinFeeRate(int value) => _settingsStore.customBitcoinFeeRate = value;
|
|
|
|
|
2023-09-01 15:06:18 +00:00
|
|
|
CryptoCurrency get currency => wallet.currency;
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
Validator<String> get amountValidator =>
|
2023-09-01 15:06:18 +00:00
|
|
|
AmountValidator(currency: walletTypeToCryptoCurrency(wallet.type));
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
Validator<String> get allAmountValidator => AllAmountValidator();
|
2020-10-09 07:41:29 +00:00
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
Validator<String> get addressValidator => AddressValidator(type: selectedCryptoCurrency);
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
Validator<String> get textValidator => TextValidator();
|
2021-09-22 13:47:10 +00:00
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
final FiatCurrency fiatFromSettings;
|
|
|
|
|
2021-01-29 20:18:07 +00:00
|
|
|
@observable
|
2022-10-12 17:09:57 +00:00
|
|
|
PendingTransaction? pendingTransaction;
|
2020-08-25 16:32:40 +00:00
|
|
|
|
|
|
|
@computed
|
2024-10-14 21:28:38 +00:00
|
|
|
String get balance {
|
|
|
|
if (coinTypeToSpendFrom == UnspentCoinType.mweb) {
|
|
|
|
return balanceViewModel.balances.values.first.secondAvailableBalance;
|
|
|
|
} else if (coinTypeToSpendFrom == UnspentCoinType.nonMweb) {
|
|
|
|
return balanceViewModel.balances.values.first.availableBalance;
|
|
|
|
}
|
|
|
|
return wallet.balance[selectedCryptoCurrency]!.formattedFullAvailableBalance;
|
|
|
|
}
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2022-12-07 20:07:32 +00:00
|
|
|
@computed
|
|
|
|
bool get isFiatDisabled => balanceViewModel.isFiatDisabled;
|
|
|
|
|
2022-11-22 17:33:24 +00:00
|
|
|
@computed
|
|
|
|
String get pendingTransactionFiatAmountFormatted =>
|
2023-08-04 13:49:26 +00:00
|
|
|
isFiatDisabled ? '' : pendingTransactionFiatAmount + ' ' + fiat.title;
|
2022-11-22 17:33:24 +00:00
|
|
|
|
|
|
|
@computed
|
|
|
|
String get pendingTransactionFeeFiatAmountFormatted =>
|
2023-08-04 13:49:26 +00:00
|
|
|
isFiatDisabled ? '' : pendingTransactionFeeFiatAmount + ' ' + fiat.title;
|
2022-11-22 17:33:24 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
@computed
|
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 14:43:48 +00:00
|
|
|
bool get isReadyForSend =>
|
|
|
|
wallet.syncStatus is SyncedSyncStatus ||
|
|
|
|
// If silent payments scanning, can still send payments
|
|
|
|
(wallet.type == WalletType.bitcoin && wallet.syncStatus is SyncingSyncStatus);
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2020-10-07 05:58:22 +00:00
|
|
|
@computed
|
2022-01-26 16:11:32 +00:00
|
|
|
List<Template> get templates => sendTemplateViewModel.templates
|
2022-01-31 12:54:24 +00:00
|
|
|
.where((template) => _isEqualCurrency(template.cryptoCurrency))
|
2022-01-26 16:11:32 +00:00
|
|
|
.toList();
|
2020-10-07 05:58:22 +00:00
|
|
|
|
2023-08-24 13:54:05 +00:00
|
|
|
@computed
|
|
|
|
bool get hasCoinControl =>
|
2023-09-01 15:06:18 +00:00
|
|
|
wallet.type == WalletType.bitcoin ||
|
2023-10-17 15:59:41 +00:00
|
|
|
wallet.type == WalletType.litecoin ||
|
|
|
|
wallet.type == WalletType.monero ||
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
wallet.type == WalletType.wownero ||
|
2023-10-17 15:59:41 +00:00
|
|
|
wallet.type == WalletType.bitcoinCash;
|
2023-08-24 13:54:05 +00:00
|
|
|
|
2021-07-20 15:03:49 +00:00
|
|
|
@computed
|
2022-01-25 14:43:19 +00:00
|
|
|
bool get isElectrumWallet =>
|
2023-10-12 22:50:16 +00:00
|
|
|
wallet.type == WalletType.bitcoin ||
|
2023-10-17 15:59:41 +00:00
|
|
|
wallet.type == WalletType.litecoin ||
|
|
|
|
wallet.type == WalletType.bitcoinCash;
|
2021-07-20 15:03:49 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
@computed
|
|
|
|
bool get hasFees => wallet.type != WalletType.nano && wallet.type != WalletType.banano;
|
|
|
|
|
2024-03-29 18:55:29 +00:00
|
|
|
@computed
|
|
|
|
bool get hasFeesPriority =>
|
|
|
|
wallet.type != WalletType.nano &&
|
|
|
|
wallet.type != WalletType.banano &&
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
wallet.type != WalletType.solana &&
|
|
|
|
wallet.type != WalletType.tron;
|
2024-05-06 19:11:18 +00:00
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
@observable
|
|
|
|
CryptoCurrency selectedCryptoCurrency;
|
|
|
|
|
|
|
|
List<CryptoCurrency> currencies;
|
|
|
|
|
2023-09-01 15:06:18 +00:00
|
|
|
bool get hasYat => outputs
|
|
|
|
.any((out) => out.isParsedAddress && out.parsedAddress.parseFrom == ParseFrom.yatRecord);
|
2021-11-02 09:17:24 +00:00
|
|
|
|
2023-09-01 15:06:18 +00:00
|
|
|
WalletType get walletType => wallet.type;
|
2022-03-30 15:57:04 +00:00
|
|
|
|
2023-09-01 15:06:18 +00:00
|
|
|
String? get walletCurrencyName => wallet.currency.fullName?.toLowerCase() ?? wallet.currency.name;
|
2022-08-09 15:06:21 +00:00
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
bool get hasCurrecyChanger => walletType == WalletType.haven;
|
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@computed
|
|
|
|
FiatCurrency get fiatCurrency => _settingsStore.fiatCurrency;
|
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
final SettingsStore _settingsStore;
|
2021-07-16 09:32:36 +00:00
|
|
|
final SendTemplateViewModel sendTemplateViewModel;
|
2022-04-22 15:00:28 +00:00
|
|
|
final BalanceViewModel balanceViewModel;
|
2023-08-04 13:49:26 +00:00
|
|
|
final ContactListViewModel contactListViewModel;
|
2024-05-22 01:18:04 +00:00
|
|
|
final LedgerViewModel? ledgerViewModel;
|
2020-09-21 11:50:26 +00:00
|
|
|
final FiatConversionStore _fiatConversationStore;
|
2020-11-06 18:54:00 +00:00
|
|
|
final Box<TransactionDescription> transactionDescriptionBox;
|
2023-09-01 15:06:18 +00:00
|
|
|
|
|
|
|
@observable
|
|
|
|
bool hasMultipleTokens;
|
2020-08-25 16:32:40 +00:00
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
@computed
|
|
|
|
List<ContactRecord> get contactsToShow => contactListViewModel.contacts
|
2023-08-24 13:54:05 +00:00
|
|
|
.where((element) => element.type == selectedCryptoCurrency)
|
2023-08-04 13:49:26 +00:00
|
|
|
.toList();
|
|
|
|
|
|
|
|
@computed
|
|
|
|
List<WalletContact> get walletContactsToShow => contactListViewModel.walletContacts
|
2023-08-24 13:54:05 +00:00
|
|
|
.where((element) => element.type == selectedCryptoCurrency)
|
2023-08-04 13:49:26 +00:00
|
|
|
.toList();
|
|
|
|
|
|
|
|
@action
|
|
|
|
bool checkIfAddressIsAContact(String address) {
|
|
|
|
final contactList = contactsToShow.where((element) => element.address == address).toList();
|
|
|
|
|
|
|
|
return contactList.isNotEmpty;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
bool checkIfWalletIsAnInternalWallet(String address) {
|
|
|
|
final walletContactList =
|
|
|
|
walletContactsToShow.where((element) => element.address == address).toList();
|
|
|
|
|
|
|
|
return walletContactList.isNotEmpty;
|
|
|
|
}
|
|
|
|
|
|
|
|
@computed
|
|
|
|
bool get shouldDisplayTOTP2FAForContact => _settingsStore.shouldRequireTOTP2FAForSendsToContact;
|
|
|
|
|
|
|
|
@computed
|
|
|
|
bool get shouldDisplayTOTP2FAForNonContact =>
|
|
|
|
_settingsStore.shouldRequireTOTP2FAForSendsToNonContact;
|
|
|
|
|
|
|
|
@computed
|
|
|
|
bool get shouldDisplayTOTP2FAForSendsToInternalWallet =>
|
|
|
|
_settingsStore.shouldRequireTOTP2FAForSendsToInternalWallets;
|
|
|
|
|
|
|
|
//* Still open to further optimize these checks
|
|
|
|
//* It works but can be made better
|
|
|
|
@action
|
|
|
|
bool checkThroughChecksToDisplayTOTP(String address) {
|
|
|
|
final isContact = checkIfAddressIsAContact(address);
|
|
|
|
final isInternalWallet = checkIfWalletIsAnInternalWallet(address);
|
|
|
|
|
|
|
|
if (isContact) {
|
|
|
|
return shouldDisplayTOTP2FAForContact;
|
|
|
|
} else if (isInternalWallet) {
|
|
|
|
return shouldDisplayTOTP2FAForSendsToInternalWallet;
|
|
|
|
} else {
|
|
|
|
return shouldDisplayTOTP2FAForNonContact;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool shouldDisplayTotp() {
|
|
|
|
List<bool> conditionsList = [];
|
|
|
|
|
|
|
|
for (var output in outputs) {
|
2023-10-09 15:18:59 +00:00
|
|
|
final show = checkThroughChecksToDisplayTOTP(output.extractedAddress);
|
2023-08-04 13:49:26 +00:00
|
|
|
conditionsList.add(show);
|
|
|
|
}
|
|
|
|
|
|
|
|
return conditionsList.contains(true);
|
|
|
|
}
|
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
@action
|
2024-03-28 12:41:11 +00:00
|
|
|
Future<PendingTransaction?> createTransaction({ExchangeProvider? provider}) async {
|
2020-08-25 16:32:40 +00:00
|
|
|
try {
|
2020-09-21 11:50:26 +00:00
|
|
|
state = IsExecutingState();
|
2024-04-25 01:14:11 +00:00
|
|
|
|
2024-05-05 01:44:50 +00:00
|
|
|
if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState();
|
|
|
|
|
2023-09-01 15:06:18 +00:00
|
|
|
pendingTransaction = await wallet.createTransaction(_credentials());
|
2024-05-05 01:44:50 +00:00
|
|
|
|
2024-03-28 12:41:11 +00:00
|
|
|
if (provider is ThorChainExchangeProvider) {
|
|
|
|
final outputCount = pendingTransaction?.outputCount ?? 0;
|
2024-04-01 13:31:14 +00:00
|
|
|
if (outputCount > 10) {
|
2024-04-25 01:14:11 +00:00
|
|
|
throw Exception("THORChain does not support more than 10 outputs");
|
2024-04-01 13:31:14 +00:00
|
|
|
}
|
2024-04-25 01:14:11 +00:00
|
|
|
|
2024-04-01 13:31:14 +00:00
|
|
|
if (_hasTaprootInput(pendingTransaction)) {
|
2024-04-25 01:14:11 +00:00
|
|
|
throw Exception("THORChain does not support Taproot addresses");
|
2024-04-01 13:31:14 +00:00
|
|
|
}
|
2024-03-28 12:41:11 +00:00
|
|
|
}
|
2024-09-20 14:24:25 +00:00
|
|
|
|
|
|
|
if (wallet.type == WalletType.bitcoin) {
|
|
|
|
final updatedOutputs = bitcoin!.updateOutputs(pendingTransaction!, outputs);
|
|
|
|
|
|
|
|
if (outputs.length == updatedOutputs.length) {
|
2024-11-11 17:39:45 +00:00
|
|
|
outputs.replaceRange(0, outputs.length, updatedOutputs);
|
2024-09-20 14:24:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-21 11:50:26 +00:00
|
|
|
state = ExecutedSuccessfullyState();
|
2024-03-28 12:41:11 +00:00
|
|
|
return pendingTransaction;
|
2020-08-25 16:32:40 +00:00
|
|
|
} catch (e) {
|
2024-10-23 15:38:31 +00:00
|
|
|
// if (e is LedgerException) {
|
|
|
|
// final errorCode = e.errorCode.toRadixString(16);
|
|
|
|
// final fallbackMsg =
|
|
|
|
// e.message.isNotEmpty ? e.message : "Unexpected Ledger Error Code: $errorCode";
|
|
|
|
// final errorMsg = ledgerViewModel!.interpretErrorCode(errorCode) ?? fallbackMsg;
|
|
|
|
//
|
|
|
|
// state = FailureState(errorMsg);
|
|
|
|
// } else {
|
2024-05-05 01:44:50 +00:00
|
|
|
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
2024-10-23 15:38:31 +00:00
|
|
|
// }
|
2020-08-25 16:32:40 +00:00
|
|
|
}
|
2024-04-01 13:31:14 +00:00
|
|
|
return null;
|
2020-08-25 16:32:40 +00:00
|
|
|
}
|
|
|
|
|
2024-04-08 14:54:58 +00:00
|
|
|
@action
|
2024-08-23 13:19:42 +00:00
|
|
|
Future<void> replaceByFee(TransactionInfo tx, String newFee) async {
|
2024-04-08 14:54:58 +00:00
|
|
|
state = IsExecutingState();
|
|
|
|
|
2024-08-23 13:19:42 +00:00
|
|
|
try {
|
|
|
|
final isSufficient = await bitcoin!.isChangeSufficientForFee(wallet, tx.id, newFee);
|
|
|
|
|
|
|
|
if (!isSufficient) {
|
|
|
|
state = AwaitingConfirmationState(
|
|
|
|
title: S.current.confirm_fee_deduction,
|
|
|
|
message: S.current.confirm_fee_deduction_content,
|
|
|
|
onConfirm: () async => await _executeReplaceByFee(tx, newFee),
|
|
|
|
onCancel: () => state = FailureState('Insufficient change for fee'));
|
|
|
|
} else {
|
|
|
|
await _executeReplaceByFee(tx, newFee);
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
state = FailureState(e.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> _executeReplaceByFee(TransactionInfo tx, String newFee) async {
|
|
|
|
clearOutputs();
|
|
|
|
final output = outputs.first;
|
|
|
|
output.address = tx.outputAddresses?.first ?? '';
|
|
|
|
|
|
|
|
try {
|
|
|
|
pendingTransaction = await bitcoin!.replaceByFee(wallet, tx.id, newFee);
|
2024-04-08 14:54:58 +00:00
|
|
|
state = ExecutedSuccessfullyState();
|
2024-08-23 13:19:42 +00:00
|
|
|
} catch (e) {
|
|
|
|
state = FailureState(e.toString());
|
2024-04-08 14:54:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
@action
|
2024-11-09 18:59:47 +00:00
|
|
|
Future<void> commitTransaction(BuildContext context) async {
|
2022-10-12 17:09:57 +00:00
|
|
|
if (pendingTransaction == null) {
|
|
|
|
throw Exception("Pending transaction doesn't exist. It should not be happened.");
|
|
|
|
}
|
|
|
|
|
2021-08-10 14:52:35 +00:00
|
|
|
String address = outputs.fold('', (acc, value) {
|
2021-10-04 14:25:27 +00:00
|
|
|
return value.isParsedAddress
|
2024-05-05 01:44:50 +00:00
|
|
|
? '$acc${value.address}\n${value.extractedAddress}\n\n'
|
|
|
|
: '$acc${value.address}\n\n';
|
2021-07-20 15:03:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
address = address.trim();
|
|
|
|
|
2024-05-05 01:44:50 +00:00
|
|
|
String note = outputs.fold('', (acc, value) => '$acc${value.note}\n');
|
2021-07-20 15:03:49 +00:00
|
|
|
|
|
|
|
note = note.trim();
|
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
try {
|
|
|
|
state = TransactionCommitting();
|
2024-11-09 18:59:47 +00:00
|
|
|
|
|
|
|
if (pendingTransaction!.shouldCommitUR()) {
|
|
|
|
final urstr = await pendingTransaction!.commitUR();
|
|
|
|
final result = await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, arguments: urstr);
|
|
|
|
if (result == null) {
|
|
|
|
state = FailureState("Canceled by user");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
await pendingTransaction!.commit();
|
|
|
|
}
|
2020-11-06 18:54:00 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
if (walletType == WalletType.nano) {
|
|
|
|
nano!.updateTransactions(wallet);
|
|
|
|
}
|
|
|
|
|
2024-10-18 02:58:57 +00:00
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
if (pendingTransaction!.id.isNotEmpty) {
|
2024-10-18 02:58:57 +00:00
|
|
|
|
|
|
|
final descriptionKey = '${pendingTransaction!.id}_${wallet.walletAddresses.primaryAddress}';
|
2020-12-24 10:04:23 +00:00
|
|
|
_settingsStore.shouldSaveRecipientAddress
|
2021-01-11 17:15:27 +00:00
|
|
|
? await transactionDescriptionBox.add(TransactionDescription(
|
2024-10-18 02:58:57 +00:00
|
|
|
id: descriptionKey,
|
|
|
|
recipientAddress: address,
|
|
|
|
transactionNote: note))
|
|
|
|
: await transactionDescriptionBox.add(TransactionDescription(
|
|
|
|
id: descriptionKey,
|
|
|
|
transactionNote: note));
|
2020-11-06 18:54:00 +00:00
|
|
|
}
|
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
state = TransactionCommitted();
|
|
|
|
} catch (e) {
|
2024-03-29 18:51:34 +00:00
|
|
|
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
2020-08-25 16:32:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-30 18:23:15 +00:00
|
|
|
@action
|
|
|
|
void setTransactionPriority(TransactionPriority priority) =>
|
2023-09-01 15:06:18 +00:00
|
|
|
_settingsStore.priority[wallet.type] = priority;
|
2020-09-30 18:23:15 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
Object _credentials() {
|
2023-10-12 22:50:16 +00:00
|
|
|
final priority = _settingsStore.priority[wallet.type];
|
2020-09-21 11:50:26 +00:00
|
|
|
|
2024-05-06 19:11:18 +00:00
|
|
|
if (priority == null &&
|
|
|
|
wallet.type != WalletType.nano &&
|
|
|
|
wallet.type != WalletType.banano &&
|
|
|
|
wallet.type != WalletType.solana &&
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
wallet.type != WalletType.tron) {
|
2023-10-17 15:59:41 +00:00
|
|
|
throw Exception('Priority is null for wallet type: ${wallet.type}');
|
|
|
|
}
|
2022-10-12 17:09:57 +00:00
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
switch (wallet.type) {
|
|
|
|
case WalletType.bitcoin:
|
2021-05-07 07:36:38 +00:00
|
|
|
case WalletType.litecoin:
|
2023-10-12 22:50:16 +00:00
|
|
|
case WalletType.bitcoinCash:
|
2024-10-14 21:28:38 +00:00
|
|
|
return bitcoin!.createBitcoinTransactionCredentials(
|
|
|
|
outputs,
|
|
|
|
priority: priority!,
|
|
|
|
feeRate: customBitcoinFeeRate,
|
|
|
|
coinTypeToSpendFrom: coinTypeToSpendFrom,
|
|
|
|
);
|
2022-10-12 17:09:57 +00:00
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
case WalletType.monero:
|
2023-08-04 13:49:26 +00:00
|
|
|
return monero!
|
2023-10-17 15:59:41 +00:00
|
|
|
.createMoneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
|
2023-08-04 13:49:26 +00:00
|
|
|
|
Wownero (#1485)
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* various fixes for build issues
* initial monero.dart implementation
* ...
* multiple wallets
new lib
minor fixes
* other fixes from monero.dart and monero_c
* fix: nodes & build
* update build scripts
fix polyseed
* remove unnecessary code
* Add windows app, build scripts and build guide for it.
* Minor fix in generated monero configs
* fix: send all with multiple outs
* add missing monero_c command
* add android build script
* Merge and fix main
* undo android ndk removal
* Fix modified exception_handler.dart
* Temporarily remove haven
* fix build issues
* fix pr script
* Fixes for build monero.dart (monero_c) for windows.
* monero build script
* wip: ios build script
* refactor: unchanged file
* Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script.
* Update monero.dart and monero_c versions.
* Add missed windows build scripts
* Update the application configuration for windows build script.
* Update cw_monero pubspec lock file for monero.dart
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* Fix conflicts with main
* fix for multiple wallets
* Add tron to windows application configuration.
* Add macOS option for description message in configure_cake_wallet.sh
* Include missed monero dll for windows.
* fix conflicts with main
* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero.
* fix: scan fixes, add date, allow sending while scanning
* add missing nano secrets file [skip ci]
* ios library
* don't pull prebuilds android
* Add auto generation of manifest file for android project even for iOS, macOS, Windows.
* feat: sync fixes, sp settings
* feat: fix resyncing
* store crash fix
* make init async so it won't lag
disable print starts
* fix monero_c build issues
* libstdc++
* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)
* update pubspec.lock
* fix build script
* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* bump monero_c hash
* bump monero_c commit
* bump moneroc version
* bump monero_c commit
* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* get App Dir correctly in default_settings_migration.dart
* handle previous issue with fetching linux documents directory [skip ci]
* backup fix
* fix NTFS issues
* Close the wallet when the wallet gets changed
* fix: double balance
* feat: node domain
* fix: menu name
* bump monero_c commit
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* Only stop wallet on rename and delete
* fix: status toggle
* minor enhancement
* Monero.com fixes
* bump monero_c commit
* update sp_scanner to include windows and linux
* Update macOS build guide. Change brew dependencies for build unbound locally.
* fix conflicts and update macos build guide
* remove build cache when on gh actions
* update secure storage
* free up even more storage
* free up more storage
* Add initial wownero
* fix conflicts
* fix workflow issue
* build wownero
* ios and windows changes
* macos
* complete wownero flow (app side)
* add keychain group entitlement and update script for RunnerBase on macos
* update secure_storage version to 8.1.0 in configure.dart
* add wownero framework
* update ios builds
* proper path for wownero and monero
* finalizing wownero
* finalizing wownero
* free up even more storage
* revert commenting of build gradle configs
* revert commenting of secrets [skip ci]
* free more storage
* minor fixes
* link android wownero libraries
* bump monero_c commit
* wownero fixes
* rename target
* build_single.sh using clean env
* bump monero_c commit
* minor fix
* Add wownero polyseed
* fix conflicts with main
* fix: wallet seed display
fix: wownero not refreshing
* fix: wallet seed display
fix: wownero not refreshing
* bump monero_c commit
* minor fixes
* fix: incorrectly displaying XMR instead of WOW
* fix: incorrect restore height in wownero
* bump monero_c commit
* Add Inno Setup Script for windows exe installer
* drop libc++_shared.so
* fixes from comments
* Fix CMake for windows
* Merge latest monero dart changes [skip ci]
* bump monero_c commit
* add wownero to build scripts for macos [skip ci]
* add 14 word seed support to wownero
* UI fixes for wownero seed restore
* minor fixes
* reformat code to pass lints
* wownero: fixes
haven: removal popup
* minor iOS fix [skip ci]
* fix: wownero confirmation count (it is spendable after 3 confirms)
fix: transaction history not displaying in WOW and XMR
when tx has 0 confirms,
This is more of a workaround, because I have no idea
why would the cpp code not return pending transaction.
* Update preferences_key.dart [skip ci]
* minor fixes
---------
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: M <m@cakewallet.com>
Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
Co-authored-by: Matthew Fosse <matt@fosse.co>
2024-07-04 19:43:17 +00:00
|
|
|
case WalletType.wownero:
|
|
|
|
return wownero!
|
|
|
|
.createWowneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
case WalletType.haven:
|
2022-10-12 17:09:57 +00:00
|
|
|
return haven!.createHavenTransactionCreationCredentials(
|
2023-10-17 15:59:41 +00:00
|
|
|
outputs: outputs, priority: priority!, assetType: selectedCryptoCurrency.title);
|
2023-10-12 22:50:16 +00:00
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
case WalletType.ethereum:
|
2023-09-01 15:06:18 +00:00
|
|
|
return ethereum!.createEthereumTransactionCredentials(outputs,
|
2023-10-17 15:59:41 +00:00
|
|
|
priority: priority!, currency: selectedCryptoCurrency);
|
2023-10-05 01:09:07 +00:00
|
|
|
case WalletType.nano:
|
2023-10-12 22:50:16 +00:00
|
|
|
return nano!.createNanoTransactionCredentials(outputs);
|
2023-12-02 02:26:43 +00:00
|
|
|
case WalletType.polygon:
|
|
|
|
return polygon!.createPolygonTransactionCredentials(outputs,
|
|
|
|
priority: priority!, currency: selectedCryptoCurrency);
|
CW-555-Add-Solana-Wallet (#1272)
* chore: Create cw_solana package and clean up files
* feat: Add Solana Wallet - Create, Restore form seed, restore from Key, Restore from QR, Send, Receive, transaction history, spl tokens
* fix: Make transactions file specific to solana only for solana transactions
* chore: Revert inject app details script
* fix: Fix issue with node and switch current node to main beta instead of testnet
* fix: Fix merge conflicts and adjust migration version
* fix: Fetch spl token error
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
* fix: Diplay and activate spl tokens bug
* fix: Review and fixes
* fix: reverted formatting for cryptocurrency class
* fix: Review comments, split sending flow into signing and sending separately, fix issues
* fix: Revert throwing unimplenented error
* chore: Fix comment
* chore: Fix comment
* fix: Errors in flow
* Update provider_types.dart [skip ci]
* fix: Issues with solana wallet
* Update solana_wallet.dart [skip ci]
* fix: Review comments
* fix: Date time config
* fix: Revert bash script for app details
* fix: Error with balance, displaying fees, fixing sent or received identifier bug, displaying token symbol with token transaction item in transactions list
* fix: Issues with address validation when sending spl tokens and walletconnect initial setup
* fix: Issues with sending, fetching transactions history, almost wrapping up walletconnect
* fix: Adjust imports that would affect monerocom building successfully
* fix: Refine transaction direction and continue work on walletconnect
* feat: Display SPL token transfers in the transaction history and finally settle the transaction direction
* fix: Delay in transactions history dispaly, show native token transactions first, then process spl token transactions
* feat: Switch node and revert solana chain id to previous id
* fix: Remove print statement
* fix: Remove await for transactions, fetch all transaction histories instantly and adjust solana send success message
* chore: Code refactoring and streamlined wallet type check for solana send success message
* fix: Make timeout error for node silent and add spl token images
---------
Signed-off-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-02-23 13:39:19 +00:00
|
|
|
case WalletType.solana:
|
|
|
|
return solana!
|
|
|
|
.createSolanaTransactionCredentials(outputs, currency: selectedCryptoCurrency);
|
CW-525-Add-Tron-Wallet (#1327)
* chore: Initial setup for Tron Wallet
* feat: Create Tron Wallet base flow implemented, keys, address, receive, restore and proxy classes all setup
* feat: Display seed and key within the app
* feat: Activate restore from key and seed for Tron wallet
* feat: Add icon for tron wallet in wallet listing page
* feat: Activate display of receive address for tron
* feat: Fetch and display tron balance, sending transaction flow setup, fee limit calculation setup
* feat: Implement sending of native tron, setup sending of trc20 tokens
* chore: Rename function
* Delete lib/tron/tron.dart
* feat: Activate exchange for tron and its tokens, implement balance display for trc20 tokens and setup secrets configuration for tron
* feat: Implement tron token management, add, remove, delete, and get tokens in home settings view, also minor cleanup
* feat: Activate buy and sell for tron
* feat: Implement restore from QR, transactions history listing for both native transactions and trc20 transactions
* feat: Activate send all and do some minor cleanups
* chore: Fix some lint infos and warnings
* chore: Adjust configurations
* ci: Modify CI to create and add secrets for node
* fix: Fixes made while self reviewing the PR for this feature
* feat: Add guide for adding new wallet types, and add fixes to requested changes
* fix: Handle exceptions gracefully
* fix: Alternative for trc20 estimated fee
* fix: Fixes to display of amount and fee, removing clashes
* fix: Fee calculation WIP
* fix: Fix issue with handling of send all flow and display of amount and fee values before broadcasting transaction
* fix: PR review fixes and fix merge conflicts
* fix: Modify fetching assetOfTransaction [skip ci]
* fix: Move tron settings migration to 33
2024-05-03 18:00:05 +00:00
|
|
|
case WalletType.tron:
|
|
|
|
return tron!.createTronTransactionCredentials(outputs, currency: selectedCryptoCurrency);
|
2020-08-25 16:32:40 +00:00
|
|
|
default:
|
2023-09-01 15:06:18 +00:00
|
|
|
throw Exception('Unexpected wallet type: ${wallet.type}');
|
2021-07-20 15:03:49 +00:00
|
|
|
}
|
2020-09-21 11:50:26 +00:00
|
|
|
}
|
2020-10-07 05:58:22 +00:00
|
|
|
|
2024-04-08 14:54:58 +00:00
|
|
|
String displayFeeRate(dynamic priority, int? customValue) {
|
2021-02-12 22:38:34 +00:00
|
|
|
final _priority = priority as TransactionPriority;
|
|
|
|
|
2024-04-08 14:54:58 +00:00
|
|
|
if (walletType == WalletType.bitcoin) {
|
|
|
|
final rate = bitcoin!.getFeeRate(wallet, _priority);
|
|
|
|
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate, customRate: customValue);
|
|
|
|
}
|
|
|
|
|
2021-12-24 12:37:24 +00:00
|
|
|
if (isElectrumWallet) {
|
2022-10-12 17:09:57 +00:00
|
|
|
final rate = bitcoin!.getFeeRate(wallet, _priority);
|
2022-10-28 22:09:27 +00:00
|
|
|
return bitcoin!.bitcoinTransactionPriorityWithLabel(_priority, rate);
|
2021-02-12 22:38:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return priority.toString();
|
|
|
|
}
|
2022-01-31 12:54:24 +00:00
|
|
|
|
2023-08-04 13:49:26 +00:00
|
|
|
bool _isEqualCurrency(String currency) =>
|
2023-09-01 15:06:18 +00:00
|
|
|
wallet.balance.keys.any((e) => currency.toLowerCase() == e.title.toLowerCase());
|
2022-11-25 20:51:07 +00:00
|
|
|
|
2024-04-08 14:54:58 +00:00
|
|
|
TransactionPriority get bitcoinTransactionPriorityCustom =>
|
|
|
|
bitcoin!.getBitcoinTransactionPriorityCustom();
|
|
|
|
|
|
|
|
TransactionPriority get bitcoinTransactionPriorityMedium =>
|
|
|
|
bitcoin!.getBitcoinTransactionPriorityMedium();
|
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@action
|
2023-08-04 13:49:26 +00:00
|
|
|
void onClose() => _settingsStore.fiatCurrency = fiatFromSettings;
|
2022-12-12 13:41:16 +00:00
|
|
|
|
2022-11-25 20:51:07 +00:00
|
|
|
@action
|
2023-09-01 15:06:18 +00:00
|
|
|
void setFiatCurrency(FiatCurrency fiat) => _settingsStore.fiatCurrency = fiat;
|
2023-08-04 17:01:49 +00:00
|
|
|
|
|
|
|
@action
|
|
|
|
void setSelectedCryptoCurrency(String cryptoCurrency) {
|
|
|
|
try {
|
2023-09-01 15:06:18 +00:00
|
|
|
selectedCryptoCurrency = wallet.balance.keys
|
2023-08-04 17:01:49 +00:00
|
|
|
.firstWhere((e) => cryptoCurrency.toLowerCase() == e.title.toLowerCase());
|
|
|
|
} catch (e) {
|
2023-09-01 15:06:18 +00:00
|
|
|
selectedCryptoCurrency = wallet.currency;
|
2023-08-04 17:01:49 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-25 12:20:11 +00:00
|
|
|
|
2024-03-29 18:51:34 +00:00
|
|
|
ContactRecord? newContactAddress() {
|
2024-03-19 22:44:00 +00:00
|
|
|
final Set<String> contactAddresses =
|
2024-03-29 18:51:34 +00:00
|
|
|
Set.from(contactListViewModel.contacts.map((contact) => contact.address))
|
|
|
|
..addAll(contactListViewModel.walletContacts.map((contact) => contact.address));
|
2024-03-19 22:44:00 +00:00
|
|
|
|
|
|
|
for (var output in outputs) {
|
|
|
|
String address;
|
|
|
|
if (output.isParsedAddress) {
|
|
|
|
address = output.parsedAddress.addresses.first;
|
|
|
|
} else {
|
|
|
|
address = output.address;
|
|
|
|
}
|
|
|
|
|
2024-04-12 14:01:21 +00:00
|
|
|
if (address.isNotEmpty &&
|
|
|
|
!contactAddresses.contains(address) &&
|
|
|
|
selectedCryptoCurrency.raw != -1) {
|
2024-03-19 22:44:00 +00:00
|
|
|
return ContactRecord(
|
|
|
|
contactListViewModel.contactSource,
|
|
|
|
Contact(
|
|
|
|
name: '',
|
|
|
|
address: address,
|
|
|
|
type: selectedCryptoCurrency,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-10-09 15:18:59 +00:00
|
|
|
String translateErrorMessage(
|
2024-03-29 18:51:34 +00:00
|
|
|
Object error,
|
2023-10-09 15:18:59 +00:00
|
|
|
WalletType walletType,
|
|
|
|
CryptoCurrency currency,
|
|
|
|
) {
|
2024-03-29 18:51:34 +00:00
|
|
|
String errorMessage = error.toString();
|
|
|
|
|
2024-08-09 23:02:47 +00:00
|
|
|
if (walletType == WalletType.solana) {
|
2024-08-16 22:21:03 +00:00
|
|
|
if (errorMessage.contains('insufficient lamports')) {
|
|
|
|
double solValueNeeded = 0.0;
|
|
|
|
|
|
|
|
// Regular expression to match the number after "need". This shows the exact lamports the user needs to perform the transaction.
|
|
|
|
RegExp regExp = RegExp(r'need (\d+)');
|
|
|
|
|
|
|
|
// Find the match
|
|
|
|
Match? match = regExp.firstMatch(errorMessage);
|
|
|
|
|
|
|
|
if (match != null) {
|
|
|
|
String neededAmount = match.group(1)!;
|
|
|
|
final lamportsNeeded = int.tryParse(neededAmount);
|
|
|
|
|
|
|
|
// 5000 lamport used here is the constant for sending a transaction on solana
|
|
|
|
int lamportsPerSol = 1000000000;
|
|
|
|
|
|
|
|
solValueNeeded =
|
|
|
|
lamportsNeeded != null ? ((lamportsNeeded + 5000) / lamportsPerSol) : 0.0;
|
|
|
|
return S.current.insufficient_lamports(solValueNeeded.toString());
|
|
|
|
} else {
|
|
|
|
print("No match found.");
|
|
|
|
return S.current.insufficient_lamport_for_tx;
|
|
|
|
}
|
|
|
|
}
|
2024-08-09 23:02:47 +00:00
|
|
|
if (errorMessage.contains('insufficient funds for rent')) {
|
|
|
|
return S.current.insufficientFundsForRentError;
|
|
|
|
}
|
|
|
|
|
|
|
|
return errorMessage;
|
|
|
|
}
|
2023-12-02 02:26:43 +00:00
|
|
|
if (walletType == WalletType.ethereum ||
|
|
|
|
walletType == WalletType.polygon ||
|
|
|
|
walletType == WalletType.haven) {
|
2024-03-29 18:51:34 +00:00
|
|
|
if (errorMessage.contains('gas required exceeds allowance') ||
|
|
|
|
errorMessage.contains('insufficient funds')) {
|
2023-09-25 12:20:11 +00:00
|
|
|
return S.current.do_not_have_enough_gas_asset(currency.toString());
|
|
|
|
}
|
2023-12-02 02:26:43 +00:00
|
|
|
|
2024-03-29 18:51:34 +00:00
|
|
|
return errorMessage;
|
|
|
|
}
|
|
|
|
|
2024-05-06 19:11:18 +00:00
|
|
|
if (walletType == WalletType.tron) {
|
|
|
|
if (errorMessage.contains('balance is not sufficient')) {
|
|
|
|
return S.current.do_not_have_enough_gas_asset(currency.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (errorMessage.contains('Transaction expired')) {
|
2024-05-10 18:34:28 +00:00
|
|
|
return 'An error occurred while processing the transaction. Please retry the transaction';
|
2024-05-06 19:11:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-29 18:51:34 +00:00
|
|
|
if (walletType == WalletType.bitcoin ||
|
|
|
|
walletType == WalletType.litecoin ||
|
|
|
|
walletType == WalletType.bitcoinCash) {
|
|
|
|
if (error is TransactionWrongBalanceException) {
|
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 14:43:48 +00:00
|
|
|
if (error.amount != null)
|
|
|
|
return S.current
|
|
|
|
.tx_wrong_balance_with_amount_exception(currency.toString(), error.amount.toString());
|
|
|
|
|
2024-03-29 18:51:34 +00:00
|
|
|
return S.current.tx_wrong_balance_exception(currency.toString());
|
|
|
|
}
|
|
|
|
if (error is TransactionNoInputsException) {
|
|
|
|
return S.current.tx_not_enough_inputs_exception;
|
|
|
|
}
|
|
|
|
if (error is TransactionNoFeeException) {
|
|
|
|
return S.current.tx_zero_fee_exception;
|
|
|
|
}
|
|
|
|
if (error is TransactionNoDustException) {
|
|
|
|
return S.current.tx_no_dust_exception;
|
|
|
|
}
|
|
|
|
if (error is TransactionCommitFailed) {
|
litecoin mweb support (#1455)
* Fix stub creation
* Generate MWEB addresses
* Fix mweb address derivation
* Use camel-case
* Show utxos in tx list
* A few fixes
* Add spent processing
* Update balance
* Balance fixes
* Update address records
* Get rid of debounce hack
* Get sending up to the confirmation box
* Fee estimation
* Stop the daemon if plugin is unloaded
* Normal fee for non-mweb txns
* Fix fee estimation for send all
* Don't hash mweb addresses
* More fee fixes
* Broadcast mweb
* Remove test files
* One more
* Confirm sent txns
* Couple of fixes
* Resign inputs after mweb create
* Some more fixes
* Update balance after sending
* Correctly update address records
* Update confs
* [skip ci] updates
* [skip ci] add dep overrides
* working
* small fix
* merge fixes [skip ci]
* merge fixes [skip ci]
* [skip ci] minor fixes
* silent payment fixes [skip ci]
* updates [skip ci]
* save [skip ci]
* use mwebutxos box
* [skip ci] lots of fixes, still testing
* add rescan from height feature and test workflow build
* install go
* use sudo
* correct package name
* move building mweb higher for faster testing
* install fixes
* install later version of go
* go fixes
* testing
* testing
* testing
* testing
* testing
* should workgit add .github/workflows/pr_test_build.yml
* ???
* ??? pt.2
* should work, for real this time
* fix tx history not persisting + update build_mwebd script
* updates
* fix some rescan and address gen issues
* save [skip ci]
* fix unconfirmed balance not updating when receiving
* unspent coins / coin control fixes
* coin control fixes
* address balance and txCount fixes, try/catch electrum call
* fix txCount for addresses
* save [skip ci]
* potential fixes
* minor fix
* minor fix - 2
* sync status fixes, potential fix for background state issue
* workflow and script updates
* updates
* expirimental optimization
* [skip ci] minor enhancements
* workflow and script fixes
* workflow minor cleanup [skip ci]
* minor code cleanup & friendlier error message on failed tx's
* balance when sending fix
* experimental
* more experiments
* save
* updates
* coin control edge cases
* remove neutrino.db if no litecoin wallets left after deleting
* update translations
* updates
* minor fix
* [skip ci] update translations + minor fixes
* state fixes
* configure fix
* ui updates
* translation fixes
* [skip ci] addressbook updates
* fix popup
* fix popup2
* fix litecoin address book
* fix ios mwebd build script
* fix for building monero.com
* minor fix
* uncomment fix for state issues
* potential mweb sync fix (ios)
* remove print [skip ci]
* electrum stream potential fix
* fix ios build issues [skip ci]
* connection reliability updates, update kotlin code to match swift code, minor electrum error handling
* dep fixes
* minor fix
* more merge fixes
* bitcoin_flutter removal fixes
* [skip ci] fix always scan setting, swift updates
* updates
* fixes
* small fix
* small fix
* fix
* dart:convert != package:convert
* change address fixes
* update bitcoin_base to fix mweb address program checking
* fix ios xcode project [skip ci]
* updates
* more fixes
* more fixes
* ensure we don't initialize mweb until we really have to
* fix regression
* improve mweb reliability
* [skip ci] wip adress generation
* wip
* wip
* [skip ci] wip
* updates [skip ci]
* ios fixes
* fix workflows + ios fix
* test old mweb version
* update go version and mwebd hash
* review updates pt.1
* Update cw_bitcoin/lib/litecoin_wallet.dart
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
* remove non-litecoin address types regex [skip ci]
* more minor fixes
* remove duplicate [skip ci]
* Update lib/store/settings_store.dart
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
* script updates, swap params on createLitecoinWalletService
* topup fix
* [skip ci] wip
* [skip ci] testing
* [skip ci] file didn't get saved
* more address generation reliability fixes
* [skip ci] minor
* minor code cleanup
* hopefully prevents send issue
* [skip ci] wip address changes
* [skip ci] save
* save mweb addresses, auto-restart sync process if it gets stuck [skip ci]
* address generation issues mostly resolved
* more performance fixes
* [skip ci]
* this should maybe be refactored, pt.1
* separate mweb balances, pt.2
* [skip ci] save
* add translations [skip ci]
* fix sending with mweb amounts
* works for simple mweb-mweb case, further testing needed
* found an edge case
* [skip ci] make failed broadcast error message less serious
* minor
* capture all grpc errors and much better error handling overall
* [skip ci] minor
* prevent transactions with < 6 confirmations from being used + hide mweb balances if mweb is off
* fix
* merge fixes pt.1 [skip ci]
* fix mweb tags
* fix
* [skip ci] fix tag spacing
* fix transaction history not showing up
* fix mweb crash on non-fully deleted mweb cache, sync status ETA, other connection fixes
* [skip ci] minor code cleanup
* [skip ci] minor code cleanup
* additional cleanup
* silent payments eta fixes and updates
* revert sync eta changes into separate pr
* [skip ci] minor
* [skip ci] minor
* revert sync status title
* review fixes, additional cleanup
* [skip ci] minor
* [skip ci] minor
* [skip ci] minor
* trigger build
* review fixes, pt.2
* check if still processing utxos before updating sync status [skip ci]
* [skip ci] minor
* balance fix
* minor
* minor
* [skip ci] minor
* [skip ci] fix test net btc
* don't use mwebd for non-mweb tx's
* [skip ci] minor cleanup
* don't show all 1000+ mweb addresses on receive page
* minor cleanup + additional logging
---------
Co-authored-by: Hector Chu <hectorchu@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
2024-09-28 02:22:25 +00:00
|
|
|
if (error.errorMessage != null && error.errorMessage!.contains("no peers replied")) {
|
|
|
|
return S.current.tx_commit_failed_no_peers;
|
|
|
|
}
|
2024-04-26 19:29:31 +00:00
|
|
|
return "${S.current.tx_commit_failed}${error.errorMessage != null ? "\n\n${error.errorMessage}" : ""}";
|
2024-03-29 18:51:34 +00:00
|
|
|
}
|
|
|
|
if (error is TransactionCommitFailedDustChange) {
|
|
|
|
return S.current.tx_rejected_dust_change;
|
|
|
|
}
|
|
|
|
if (error is TransactionCommitFailedDustOutput) {
|
|
|
|
return S.current.tx_rejected_dust_output;
|
|
|
|
}
|
|
|
|
if (error is TransactionCommitFailedDustOutputSendAll) {
|
|
|
|
return S.current.tx_rejected_dust_output_send_all;
|
|
|
|
}
|
|
|
|
if (error is TransactionCommitFailedVoutNegative) {
|
|
|
|
return S.current.tx_rejected_vout_negative;
|
|
|
|
}
|
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 14:43:48 +00:00
|
|
|
if (error is TransactionCommitFailedBIP68Final) {
|
|
|
|
return S.current.tx_rejected_bip68_final;
|
|
|
|
}
|
2024-09-23 14:10:40 +00:00
|
|
|
if (error is TransactionCommitFailedLessThanMin) {
|
|
|
|
return S.current.fee_less_than_min;
|
|
|
|
}
|
2024-03-29 18:51:34 +00:00
|
|
|
if (error is TransactionNoDustOnChangeException) {
|
|
|
|
return S.current.tx_commit_exception_no_dust_on_change(error.min, error.max);
|
|
|
|
}
|
Cw 453 (#1306)
* feat: rebase btc-addr-types, migrate to bitcoin_base
* feat: allow scanning elect-rs using get_tweaks
* feat: scanning and adding addresses working with getTweaks, add btc SP address type
* chore: pubspec.lock
* chore: pubspec.lock
* fix: scan when switching, fix multiple unspents in same tx
* fix: initial scan
* fix: initial scan
* fix: scanning issues
* fix: sync, storing silent unspents
* chore: deps
* fix: label issues, clear spent utxo
* chore: deps
* fix: build
* fix: missing types
* feat: new electrs API & changes, fixes for last block scanning
* feat: Scan Silent Payments homepage toggle
* chore: build configure
* feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes
* fix: invalid Object in sendData
* feat: improve addresses page & address book displays
* feat: silent payments labeled addresses disclaimer
* fix: missing i18n
* chore: print
* feat: single block scan, rescan by date working for btc mainnet
* feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert
* feat: delete silent addresses
* fix: red dot in non ssl nodes
* fix: inconsistent connection states, fix tx history
* fix: tx & balance displays, cpfp sending
* feat: new rust lib
* chore: node path
* fix: check node based on network
* fix: missing txcount from addresses
* style: padding in feature page cards
* fix: restore not getting all wallet addresses by type
* fix: auto switch node broken
* fix: silent payment txs not being restored
* feat: change scanning to subscription model, sync improvements
* fix: scan re-subscription
* fix: default nodes
* fix: improve scanning by date, fix single block scan
* refactor: common function for input tx selection
* fix: nodes & build
* fix: send all with multiple outs
* refactor: unchanged file
* Update pr_test_build.yml
* chore: upgrade
* chore: merge changes
* refactor: unchanged files [skip ci]
* fix: scan fixes, add date, allow sending while scanning
* feat: sync fixes, sp settings
* feat: fix resyncing
* fix: date from height logic, status disconnected & chain tip get
* fix: params
* feat: electrum migration if using cake electrum
* fix nodes
update versions
* re-enable tron
* update sp_scanner to work on iOS [skip ci]
* fix: wrong socket for old electrum nodes
* Fix unchecked wallet type call
* fix: double balance
* feat: node domain
* fix: menu name
* fix: update tip on set scanning
* fix: connection switching back and forth
* feat: check if node is electrs, and supports sp
* chore: fix build
* minor enhancements
* fixes and enhancements
* solve conflicts with main
* fix: status toggle
* minor enhancement
* Monero.com fixes
* update sp_scanner to include windows and linux
---------
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2024-05-29 14:43:48 +00:00
|
|
|
if (error is TransactionInputNotSupported) {
|
|
|
|
return S.current.tx_invalid_input;
|
|
|
|
}
|
2023-09-25 12:20:11 +00:00
|
|
|
}
|
|
|
|
|
2024-03-29 18:51:34 +00:00
|
|
|
return errorMessage;
|
2023-09-25 12:20:11 +00:00
|
|
|
}
|
2024-04-01 13:31:14 +00:00
|
|
|
|
|
|
|
bool _hasTaprootInput(PendingTransaction? pendingTransaction) {
|
|
|
|
if (walletType == WalletType.bitcoin && pendingTransaction != null) {
|
|
|
|
return bitcoin!.hasTaprootInput(pendingTransaction);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2020-08-25 16:32:40 +00:00
|
|
|
}
|