2023-08-30 15:11:56 +00:00
|
|
|
import 'dart:io' show Directory, File, Platform;
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
2024-05-08 20:23:27 +00:00
|
|
|
import 'package:cake_wallet/core/secure_storage.dart';
|
2023-03-01 21:44:15 +00:00
|
|
|
import 'package:cake_wallet/entities/exchange_api_mode.dart';
|
2024-04-02 18:02:28 +00:00
|
|
|
import 'package:cake_wallet/entities/fiat_api_mode.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/pathForWallet.dart';
|
2021-01-15 17:41:30 +00:00
|
|
|
import 'package:cake_wallet/entities/secret_store_key.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:hive/hive.dart';
|
2023-08-30 15:11:56 +00:00
|
|
|
import 'package:path_provider/path_provider.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/preferences_key.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
import 'package:cw_core/node.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
|
|
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
|
|
|
import 'package:cake_wallet/entities/node_list.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cake_wallet/monero/monero.dart';
|
2020-09-23 18:26:10 +00:00
|
|
|
import 'package:cake_wallet/entities/contact.dart';
|
|
|
|
import 'package:cake_wallet/entities/fs_migration.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_info.dart';
|
2020-09-23 18:26:10 +00:00
|
|
|
import 'package:cake_wallet/exchange/trade.dart';
|
2021-01-15 17:41:30 +00:00
|
|
|
import 'package:encrypt/encrypt.dart' as encrypt;
|
2022-10-12 17:09:57 +00:00
|
|
|
import 'package:collection/collection.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2021-02-01 18:12:37 +00:00
|
|
|
const newCakeWalletMoneroUri = 'xmr-node.cakewallet.com:18081';
|
2021-05-07 07:36:38 +00:00
|
|
|
const cakeWalletBitcoinElectrumUri = 'electrum.cakewallet.com:50002';
|
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
|
|
|
const cakeWalletSilentPaymentsElectrsUri = 'electrs.cakewallet.com:50001';
|
|
|
|
const publicBitcoinTestnetElectrumAddress = 'electrs.cakewallet.com';
|
|
|
|
const publicBitcoinTestnetElectrumPort = '50002';
|
Btc address types (#1263)
* inital migration changes
* feat: rest of changes
* minor fix [skip ci]
* fix: P2wshAddress & wallet address index
* fix: address review comments
* fix: address type restore
* feat: add testnet
* Fix review comments
Remove bitcoin_base from cw_core
* Fix address not matching selected type on start
* remove un-necessary parameter [skip ci]
* Remove bitcoin specific code from main lib
Fix possible runtime exception from list wrong access
* Minor fix
* fix: fixes for Testnet
* fix: bitcoin receive option dependency breaks monerocom
* Fix issues when building Monero.com
* feat: Transaction Builder changes
* fix: discover addresses, testnet restoring, duplicate unspent coins, and taproot address vs schnorr sig tweak
* fix: remove print
* feat: improve error when failed broadcast response
* feat: create fish shell env script
* fix: unmodifiable maps
* fix: build
* fix: build
* fix: computed observable side effect bug
* feat: add nix script for android build_all
* fix: wrong keypairs used for signing
* fix: wrong addresses when using fromScriptPubKey scripts
* fix(actual commit): testnet tx expanded + wrong addresses when using fromScriptPubKey scripts (update bitcoin_base deps)
* fix: self-send [skip ci]
* fix: p2wsh
* fix: testnet fees
* New versions
* Update macos build number
Minor UI fix
* fix: use new bitcoin_base ref, fix tx list wrong hex value & refactor hidden vs hd use
- if always use sideHd for isHidden, it is easier to simplify the functions instead of passing both which can be error prone
- (ps: now this could probably be changed, for example from isHidden to isChange since with address list we now see "hidden" addresses)
* Fix if condition to handle litecoin case
* fix: self-send, change address was always making direction incoming
* refactor: improve estimation function, add more inputs if balance missing
* fix: new bitcoin_base update, fixes script issues
* Update evm chain wallet service arguments
* Fix translation [skip ci]
* Fix translation [skip ci]
* Update strings_fr.arb [skip ci]
* fix: async isChange function not being awaited, refactor to reduce looping into a single place
* fix: _address vs address, missing p2sh
* fix: minor mistake in storing p2sh page type [skip ci]
* refactor: use already matched addresses property
* feat: improved perfomance for fetching transaction histories
* feat: continue perfomance change, improve address discovery only to last address by type with history
* fix: make sure transaction list is sorted by date
* refactor: isTestnet only for bitcoin
* fix: walletInfo type null case
* fix: deprecated p2pk
* refactor: make condition more readable
* refactor: remove unnecessary Str variant
* refactor: make condition more readable
* fix: infinite loop possible
* Revert removing isTestnet from other wallets [skip ci]
* refactor: rename addresses when matched by receive type
* Make the beta build [skip ci]
Remove app_env.fish
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-02-23 16:13:30 +00:00
|
|
|
const publicBitcoinTestnetElectrumUri =
|
|
|
|
'$publicBitcoinTestnetElectrumAddress:$publicBitcoinTestnetElectrumPort';
|
2021-05-11 16:57:12 +00:00
|
|
|
const cakeWalletLitecoinElectrumUri = 'ltc-electrum.cakewallet.com:50002';
|
2022-05-18 16:13:58 +00:00
|
|
|
const havenDefaultNodeUri = 'nodes.havenprotocol.org:443';
|
2023-08-04 17:01:49 +00:00
|
|
|
const ethereumDefaultNodeUri = 'ethereum.publicnode.com';
|
2023-12-02 02:26:43 +00:00
|
|
|
const polygonDefaultNodeUri = 'polygon-bor.publicnode.com';
|
2023-10-12 22:50:16 +00:00
|
|
|
const cakeWalletBitcoinCashDefaultNodeUri = 'bitcoincash.stackwallet.com:50002';
|
2023-10-05 01:09:07 +00:00
|
|
|
const nanoDefaultNodeUri = 'rpc.nano.to';
|
|
|
|
const nanoDefaultPowNodeUri = 'rpc.nano.to';
|
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
|
|
|
const solanaDefaultNodeUri = 'rpc.ankr.com';
|
2024-06-10 15:24:52 +00:00
|
|
|
const tronDefaultNodeUri = 'api.trongrid.io';
|
2024-03-18 15:45:11 +00:00
|
|
|
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
|
2021-02-01 18:12:37 +00:00
|
|
|
|
2023-08-30 15:11:56 +00:00
|
|
|
Future<void> defaultSettingsMigration(
|
2022-10-12 17:09:57 +00:00
|
|
|
{required int version,
|
|
|
|
required SharedPreferences sharedPreferences,
|
2024-05-08 20:23:27 +00:00
|
|
|
required SecureStorage secureStorage,
|
2022-10-12 17:09:57 +00:00
|
|
|
required Box<Node> nodes,
|
2023-10-05 01:09:07 +00:00
|
|
|
required Box<Node> powNodes,
|
2022-10-12 17:09:57 +00:00
|
|
|
required Box<WalletInfo> walletInfoSource,
|
|
|
|
required Box<Trade> tradeSource,
|
|
|
|
required Box<Contact> contactSource}) async {
|
2020-09-23 18:26:10 +00:00
|
|
|
if (Platform.isIOS) {
|
|
|
|
await ios_migrate_v1(walletInfoSource, tradeSource, contactSource);
|
|
|
|
}
|
|
|
|
|
2023-03-17 19:15:28 +00:00
|
|
|
// check current nodes for nullability regardless of the version
|
2023-10-05 01:09:07 +00:00
|
|
|
await checkCurrentNodes(nodes, powNodes, sharedPreferences);
|
2023-03-17 19:15:28 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
final isNewInstall =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion) == null;
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
await _validateWalletInfoBoxData(walletInfoSource);
|
2023-04-21 15:21:31 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setBool(PreferencesKey.isNewInstall, isNewInstall);
|
2023-04-21 15:21:31 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
final currentVersion =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion) ?? 0;
|
2023-04-21 15:21:31 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
if (currentVersion >= version) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-01-08 16:38:38 +00:00
|
|
|
final migrationVersionsLength = version - currentVersion;
|
2023-10-05 01:09:07 +00:00
|
|
|
final migrationVersions =
|
|
|
|
List<int>.generate(migrationVersionsLength, (i) => currentVersion + (i + 1));
|
2020-01-08 16:38:38 +00:00
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
/// When you add a new case, increase the initialMigrationVersion parameter in the main.dart file.
|
|
|
|
/// This ensures that this switch case runs the newly added case.
|
2020-01-08 16:38:38 +00:00
|
|
|
await Future.forEach(migrationVersions, (int version) async {
|
|
|
|
try {
|
|
|
|
switch (version) {
|
|
|
|
case 1:
|
|
|
|
await sharedPreferences.setString(
|
2023-10-05 01:09:07 +00:00
|
|
|
PreferencesKey.currentFiatCurrencyKey, FiatCurrency.usd.toString());
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentTransactionPriorityKeyLegacy,
|
2022-10-12 17:09:57 +00:00
|
|
|
monero!.getDefaultTransactionPriority().raw);
|
2020-01-08 16:38:38 +00:00
|
|
|
await sharedPreferences.setInt(
|
2023-10-05 01:09:07 +00:00
|
|
|
PreferencesKey.currentBalanceDisplayModeKey, BalanceDisplayMode.availableBalance.raw);
|
2020-01-20 19:04:26 +00:00
|
|
|
await sharedPreferences.setBool('save_recipient_address', true);
|
2020-01-08 16:38:38 +00:00
|
|
|
await resetToDefault(nodes);
|
2020-08-27 16:54:34 +00:00
|
|
|
await changeMoneroCurrentNodeToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
await changeBitcoinCurrentElectrumServerToDefault(
|
2020-01-08 16:38:38 +00:00
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
2021-05-07 07:36:38 +00:00
|
|
|
await changeLitecoinCurrentElectrumServerToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
2023-11-30 21:39:09 +00:00
|
|
|
await changeHavenCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
2023-10-12 22:50:16 +00:00
|
|
|
await changeBitcoinCashCurrentNodeToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
2020-01-08 16:38:38 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
await replaceNodesMigration(nodes: nodes);
|
2023-10-05 01:09:07 +00:00
|
|
|
await replaceDefaultNode(sharedPreferences: sharedPreferences, nodes: nodes);
|
2020-01-08 16:38:38 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
await updateNodeTypes(nodes: nodes);
|
|
|
|
await addBitcoinElectrumServerList(nodes: nodes);
|
2020-08-27 16:54:34 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
await changeBitcoinCurrentElectrumServerToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
2020-01-08 16:38:38 +00:00
|
|
|
break;
|
2020-09-23 18:26:10 +00:00
|
|
|
|
2021-01-08 18:10:37 +00:00
|
|
|
case 5:
|
|
|
|
await addAddressesForMoneroWallets(walletInfoSource);
|
|
|
|
break;
|
2021-01-11 17:15:27 +00:00
|
|
|
|
|
|
|
case 6:
|
|
|
|
await updateDisplayModes(sharedPreferences);
|
|
|
|
break;
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
case 9:
|
|
|
|
await generateBackupPassword(secureStorage);
|
|
|
|
break;
|
2021-05-07 07:36:38 +00:00
|
|
|
|
2021-01-27 13:51:51 +00:00
|
|
|
case 10:
|
|
|
|
await changeTransactionPriorityAndFeeRateKeys(sharedPreferences);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 11:
|
|
|
|
await changeDefaultMoneroNode(nodes, sharedPreferences);
|
|
|
|
break;
|
2021-01-15 17:41:30 +00:00
|
|
|
|
2021-02-01 18:12:37 +00:00
|
|
|
case 12:
|
2023-10-05 01:09:07 +00:00
|
|
|
await checkCurrentNodes(nodes, powNodes, sharedPreferences);
|
2021-02-01 18:12:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
2021-05-07 07:36:38 +00:00
|
|
|
await resetBitcoinElectrumServer(nodes, sharedPreferences);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 15:
|
|
|
|
await addLitecoinElectrumServerList(nodes: nodes);
|
|
|
|
await changeLitecoinCurrentElectrumServerToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
2023-10-05 01:09:07 +00:00
|
|
|
await checkCurrentNodes(nodes, powNodes, sharedPreferences);
|
2021-02-01 18:12:37 +00:00
|
|
|
break;
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
case 16:
|
|
|
|
await addHavenNodeList(nodes: nodes);
|
2023-10-05 01:09:07 +00:00
|
|
|
await changeHavenCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
await checkCurrentNodes(nodes, powNodes, sharedPreferences);
|
2022-03-30 15:57:04 +00:00
|
|
|
break;
|
|
|
|
|
2022-05-18 16:13:58 +00:00
|
|
|
case 17:
|
|
|
|
await changeDefaultHavenNode(nodes);
|
|
|
|
break;
|
|
|
|
|
2022-11-29 23:37:56 +00:00
|
|
|
case 18:
|
|
|
|
await addOnionNode(nodes);
|
|
|
|
break;
|
|
|
|
|
2022-12-15 00:00:59 +00:00
|
|
|
case 19:
|
|
|
|
await validateBitcoinSavedTransactionPriority(sharedPreferences);
|
|
|
|
break;
|
2023-03-01 21:44:15 +00:00
|
|
|
case 20:
|
|
|
|
await migrateExchangeStatus(sharedPreferences);
|
|
|
|
break;
|
2023-08-04 17:01:49 +00:00
|
|
|
case 21:
|
|
|
|
await addEthereumNodeList(nodes: nodes);
|
|
|
|
await changeEthereumCurrentNodeToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
break;
|
2023-10-05 01:09:07 +00:00
|
|
|
case 22:
|
|
|
|
await addNanoNodeList(nodes: nodes);
|
2023-10-05 13:42:35 +00:00
|
|
|
await addNanoPowNodeList(nodes: powNodes);
|
2023-10-05 01:09:07 +00:00
|
|
|
await changeNanoCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
await changeNanoCurrentPowNodeToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: powNodes);
|
|
|
|
break;
|
2023-10-12 22:50:16 +00:00
|
|
|
case 23:
|
|
|
|
await addBitcoinCashElectrumServerList(nodes: nodes);
|
|
|
|
await changeBitcoinCurrentElectrumServerToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
break;
|
2023-12-02 02:26:43 +00:00
|
|
|
case 24:
|
|
|
|
await addPolygonNodeList(nodes: nodes);
|
|
|
|
await changePolygonCurrentNodeToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
break;
|
2023-11-30 21:39:09 +00:00
|
|
|
case 25:
|
|
|
|
await rewriteSecureStoragePin(secureStorage: secureStorage);
|
|
|
|
break;
|
2024-01-23 00:30:16 +00:00
|
|
|
case 26:
|
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
|
|
|
|
|
|
|
/// commented out as it was a probable cause for some users to have white screen issues
|
|
|
|
/// maybe due to multiple access on Secure Storage at once
|
|
|
|
/// or long await time on start of the app
|
|
|
|
// await insecureStorageMigration(secureStorage: secureStorage, sharedPreferences: sharedPreferences);
|
|
|
|
case 27:
|
|
|
|
await addSolanaNodeList(nodes: nodes);
|
|
|
|
await changeSolanaCurrentNodeToDefault(
|
|
|
|
sharedPreferences: sharedPreferences, nodes: nodes);
|
2024-01-23 00:30:16 +00:00
|
|
|
break;
|
2024-03-18 15:45:11 +00:00
|
|
|
|
2024-03-14 18:26:00 +00:00
|
|
|
case 28:
|
|
|
|
await _updateMoneroPriority(sharedPreferences);
|
|
|
|
break;
|
2024-03-18 15:45:11 +00:00
|
|
|
case 29:
|
|
|
|
await changeDefaultBitcoinNode(nodes, sharedPreferences);
|
|
|
|
break;
|
2024-04-02 18:02:28 +00:00
|
|
|
case 30:
|
|
|
|
await disableServiceStatusFiatDisabled(sharedPreferences);
|
|
|
|
break;
|
2024-04-12 12:36:42 +00:00
|
|
|
case 31:
|
|
|
|
await updateNanoNodeList(nodes: nodes);
|
|
|
|
break;
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
case 32:
|
|
|
|
await updateBtcNanoWalletInfos(walletInfoSource);
|
|
|
|
break;
|
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 33:
|
|
|
|
await addTronNodeList(nodes: nodes);
|
|
|
|
await changeTronCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
break;
|
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
|
|
|
case 34:
|
|
|
|
await _addElectRsNode(nodes, sharedPreferences);
|
2024-06-10 07:22:57 +00:00
|
|
|
case 35:
|
|
|
|
await _switchElectRsNode(nodes, sharedPreferences);
|
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
|
|
|
break;
|
2024-06-10 15:24:52 +00:00
|
|
|
case 36:
|
|
|
|
await changeTronCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
|
|
|
break;
|
2024-06-18 05:08:03 +00:00
|
|
|
case 37:
|
|
|
|
await fixBtcDerivationPaths(walletInfoSource);
|
2020-01-08 16:38:38 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
await sharedPreferences.setInt(
|
2022-11-29 23:37:56 +00:00
|
|
|
PreferencesKey.currentDefaultSettingsMigrationVersion, version);
|
2020-01-08 16:38:38 +00:00
|
|
|
} catch (e) {
|
|
|
|
print('Migration error: ${e.toString()}');
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
2020-01-08 16:38:38 +00:00
|
|
|
});
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentDefaultSettingsMigrationVersion, version);
|
2022-11-29 23:37:56 +00:00
|
|
|
}
|
|
|
|
|
2024-04-12 12:36:42 +00:00
|
|
|
Future<void> updateNanoNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultNanoNodes();
|
|
|
|
var listOfNewEndpoints = <String>[
|
|
|
|
"app.natrium.io",
|
|
|
|
"rainstorm.city",
|
|
|
|
"node.somenano.com",
|
|
|
|
"nanoslo.0x.no",
|
|
|
|
"www.bitrequest.app",
|
|
|
|
];
|
|
|
|
// add new nodes:
|
|
|
|
for (final node in nodeList) {
|
|
|
|
if (listOfNewEndpoints.contains(node.uriRaw)) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// update the nautilus node:
|
|
|
|
final nautilusNode =
|
|
|
|
nodes.values.firstWhereOrNull((element) => element.uriRaw == "node.perish.co");
|
|
|
|
if (nautilusNode != null) {
|
|
|
|
nautilusNode.uriRaw = "node.nautilus.io";
|
|
|
|
nautilusNode.path = "/api";
|
|
|
|
nautilusNode.useSSL = true;
|
|
|
|
await nautilusNode.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-02 18:02:28 +00:00
|
|
|
Future<void> disableServiceStatusFiatDisabled(SharedPreferences sharedPreferences) async {
|
2024-04-12 12:36:42 +00:00
|
|
|
final currentFiat = await sharedPreferences.getInt(PreferencesKey.currentFiatApiModeKey) ?? -1;
|
2024-04-02 18:02:28 +00:00
|
|
|
if (currentFiat == -1 || currentFiat == FiatApiMode.enabled.raw) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2024-04-05 16:11:47 +00:00
|
|
|
if (currentFiat == FiatApiMode.disabled.raw || currentFiat == FiatApiMode.torOnly.raw) {
|
2024-04-02 18:02:28 +00:00
|
|
|
await sharedPreferences.setBool(PreferencesKey.disableBulletinKey, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-14 18:26:00 +00:00
|
|
|
Future<void> _updateMoneroPriority(SharedPreferences sharedPreferences) async {
|
|
|
|
final currentPriority =
|
|
|
|
await sharedPreferences.getInt(PreferencesKey.moneroTransactionPriority) ??
|
|
|
|
monero!.getDefaultTransactionPriority().serialize();
|
|
|
|
|
|
|
|
// was set to automatic but automatic should be 0
|
|
|
|
if (currentPriority == 1) {
|
|
|
|
sharedPreferences.setInt(PreferencesKey.moneroTransactionPriority,
|
|
|
|
monero!.getDefaultTransactionPriority().serialize()); // 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-30 15:11:56 +00:00
|
|
|
Future<void> _validateWalletInfoBoxData(Box<WalletInfo> walletInfoSource) async {
|
2023-11-03 19:24:45 +00:00
|
|
|
try {
|
|
|
|
final root = await getApplicationDocumentsDirectory();
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
for (var type in WalletType.values) {
|
|
|
|
if (type == WalletType.none) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
String prefix = walletTypeToString(type).toLowerCase();
|
|
|
|
Directory walletsDir = Directory('${root.path}/wallets/$prefix/');
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
if (!walletsDir.existsSync()) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
List<String> walletNames = walletsDir.listSync().map((e) => e.path.split("/").last).toList();
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
for (var name in walletNames) {
|
|
|
|
final Directory dir;
|
|
|
|
try {
|
|
|
|
dir = Directory(await pathForWalletDir(name: name, type: type));
|
|
|
|
} catch (_) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
final walletFiles = dir.listSync();
|
|
|
|
final hasCacheFile = walletFiles.any((element) => element.path.contains("$name/$name"));
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
if (!hasCacheFile) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
if (type == WalletType.monero || type == WalletType.haven) {
|
|
|
|
final hasKeysFile = walletFiles.any((element) => element.path.contains(".keys"));
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
if (!hasKeysFile) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
}
|
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
final id = prefix + '_' + name;
|
|
|
|
final exist = walletInfoSource.values.any((el) => el.id == id);
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
if (exist) {
|
|
|
|
continue;
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
|
2023-11-03 19:24:45 +00:00
|
|
|
final walletInfo = WalletInfo.external(
|
|
|
|
id: id,
|
|
|
|
type: type,
|
|
|
|
name: name,
|
|
|
|
isRecovery: true,
|
|
|
|
restoreHeight: 0,
|
|
|
|
date: DateTime.now(),
|
|
|
|
dirPath: dir.path,
|
|
|
|
path: '${dir.path}/$name',
|
|
|
|
address: '',
|
|
|
|
showIntroCakePayCard: false,
|
|
|
|
);
|
|
|
|
|
|
|
|
walletInfoSource.add(walletInfo);
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
}
|
2023-11-03 19:24:45 +00:00
|
|
|
} catch (_) {}
|
2023-08-30 15:11:56 +00:00
|
|
|
}
|
|
|
|
|
2022-12-15 00:00:59 +00:00
|
|
|
Future<void> validateBitcoinSavedTransactionPriority(SharedPreferences sharedPreferences) async {
|
2022-12-15 00:29:30 +00:00
|
|
|
if (bitcoin == null) {
|
|
|
|
return;
|
|
|
|
}
|
2022-12-15 00:05:00 +00:00
|
|
|
final int? savedBitcoinPriority =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.bitcoinTransactionPriority);
|
2022-12-15 00:29:30 +00:00
|
|
|
if (!bitcoin!.getTransactionPriorities().any((element) => element.raw == savedBitcoinPriority)) {
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.bitcoinTransactionPriority,
|
|
|
|
bitcoin!.getMediumTransactionPriority().serialize());
|
2022-12-15 00:00:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-29 23:37:56 +00:00
|
|
|
Future<void> addOnionNode(Box<Node> nodes) async {
|
|
|
|
final onionNodeUri = "cakexmrl7bonq7ovjka5kuwuyd3f7qnkz6z6s6dmsy3uckwra7bvggyd.onion:18081";
|
|
|
|
|
2022-12-01 12:29:03 +00:00
|
|
|
// check if the user has this node before (added it manually)
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == onionNodeUri) == null) {
|
|
|
|
await nodes.add(Node(uri: onionNodeUri, type: WalletType.monero));
|
|
|
|
}
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
2020-01-08 16:38:38 +00:00
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> replaceNodesMigration({required Box<Node> nodes}) async {
|
2020-01-08 16:38:38 +00:00
|
|
|
final replaceNodes = <String, Node>{
|
|
|
|
'eu-node.cakewallet.io:18081':
|
2020-08-27 16:54:34 +00:00
|
|
|
Node(uri: 'xmr-node-eu.cakewallet.com:18081', type: WalletType.monero),
|
2023-10-05 01:09:07 +00:00
|
|
|
'node.cakewallet.io:18081':
|
|
|
|
Node(uri: 'xmr-node-usa-east.cakewallet.com:18081', type: WalletType.monero),
|
|
|
|
'node.xmr.ru:13666': Node(uri: 'node.monero.net:18081', type: WalletType.monero)
|
2020-01-08 16:38:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes.values.forEach((Node node) async {
|
|
|
|
final nodeToReplace = replaceNodes[node.uri];
|
|
|
|
|
|
|
|
if (nodeToReplace != null) {
|
2021-05-10 16:00:20 +00:00
|
|
|
node.uriRaw = nodeToReplace.uriRaw;
|
2020-01-08 16:38:38 +00:00
|
|
|
node.login = nodeToReplace.login;
|
|
|
|
node.password = nodeToReplace.password;
|
|
|
|
await node.save();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-08-27 16:54:34 +00:00
|
|
|
Future<void> changeMoneroCurrentNodeToDefault(
|
2023-10-05 01:09:07 +00:00
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
2020-08-27 16:54:34 +00:00
|
|
|
final node = getMoneroDefaultNode(nodes: nodes);
|
2023-08-30 15:11:56 +00:00
|
|
|
final nodeId = node.key as int? ?? 0; // 0 - England
|
2020-08-27 16:54:34 +00:00
|
|
|
|
2022-11-29 23:37:56 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNodeIdKey, nodeId);
|
2020-08-27 16:54:34 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Node? getBitcoinDefaultElectrumServer({required Box<Node> nodes}) {
|
2023-10-05 01:09:07 +00:00
|
|
|
return nodes.values
|
|
|
|
.firstWhereOrNull((Node node) => node.uriRaw == cakeWalletBitcoinElectrumUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.bitcoin);
|
2020-08-27 16:54:34 +00:00
|
|
|
}
|
|
|
|
|
Btc address types (#1263)
* inital migration changes
* feat: rest of changes
* minor fix [skip ci]
* fix: P2wshAddress & wallet address index
* fix: address review comments
* fix: address type restore
* feat: add testnet
* Fix review comments
Remove bitcoin_base from cw_core
* Fix address not matching selected type on start
* remove un-necessary parameter [skip ci]
* Remove bitcoin specific code from main lib
Fix possible runtime exception from list wrong access
* Minor fix
* fix: fixes for Testnet
* fix: bitcoin receive option dependency breaks monerocom
* Fix issues when building Monero.com
* feat: Transaction Builder changes
* fix: discover addresses, testnet restoring, duplicate unspent coins, and taproot address vs schnorr sig tweak
* fix: remove print
* feat: improve error when failed broadcast response
* feat: create fish shell env script
* fix: unmodifiable maps
* fix: build
* fix: build
* fix: computed observable side effect bug
* feat: add nix script for android build_all
* fix: wrong keypairs used for signing
* fix: wrong addresses when using fromScriptPubKey scripts
* fix(actual commit): testnet tx expanded + wrong addresses when using fromScriptPubKey scripts (update bitcoin_base deps)
* fix: self-send [skip ci]
* fix: p2wsh
* fix: testnet fees
* New versions
* Update macos build number
Minor UI fix
* fix: use new bitcoin_base ref, fix tx list wrong hex value & refactor hidden vs hd use
- if always use sideHd for isHidden, it is easier to simplify the functions instead of passing both which can be error prone
- (ps: now this could probably be changed, for example from isHidden to isChange since with address list we now see "hidden" addresses)
* Fix if condition to handle litecoin case
* fix: self-send, change address was always making direction incoming
* refactor: improve estimation function, add more inputs if balance missing
* fix: new bitcoin_base update, fixes script issues
* Update evm chain wallet service arguments
* Fix translation [skip ci]
* Fix translation [skip ci]
* Update strings_fr.arb [skip ci]
* fix: async isChange function not being awaited, refactor to reduce looping into a single place
* fix: _address vs address, missing p2sh
* fix: minor mistake in storing p2sh page type [skip ci]
* refactor: use already matched addresses property
* feat: improved perfomance for fetching transaction histories
* feat: continue perfomance change, improve address discovery only to last address by type with history
* fix: make sure transaction list is sorted by date
* refactor: isTestnet only for bitcoin
* fix: walletInfo type null case
* fix: deprecated p2pk
* refactor: make condition more readable
* refactor: remove unnecessary Str variant
* refactor: make condition more readable
* fix: infinite loop possible
* Revert removing isTestnet from other wallets [skip ci]
* refactor: rename addresses when matched by receive type
* Make the beta build [skip ci]
Remove app_env.fish
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-02-23 16:13:30 +00:00
|
|
|
Node? getBitcoinTestnetDefaultElectrumServer({required Box<Node> nodes}) {
|
|
|
|
return nodes.values
|
|
|
|
.firstWhereOrNull((Node node) => node.uriRaw == publicBitcoinTestnetElectrumUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.bitcoin);
|
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Node? getLitecoinDefaultElectrumServer({required Box<Node> nodes}) {
|
2023-10-05 01:09:07 +00:00
|
|
|
return nodes.values
|
|
|
|
.firstWhereOrNull((Node node) => node.uriRaw == cakeWalletLitecoinElectrumUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.litecoin);
|
2021-05-07 07:36:38 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Node? getHavenDefaultNode({required Box<Node> nodes}) {
|
2023-10-05 01:09:07 +00:00
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == havenDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.haven);
|
2022-03-30 15:57:04 +00:00
|
|
|
}
|
|
|
|
|
2023-08-04 17:01:49 +00:00
|
|
|
Node? getEthereumDefaultNode({required Box<Node> nodes}) {
|
2023-10-05 01:09:07 +00:00
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == ethereumDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.ethereum);
|
|
|
|
}
|
|
|
|
|
2023-12-02 02:26:43 +00:00
|
|
|
Node? getPolygonDefaultNode({required Box<Node> nodes}) {
|
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == polygonDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.polygon);
|
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
Node? getNanoDefaultNode({required Box<Node> nodes}) {
|
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == nanoDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.nano);
|
|
|
|
}
|
|
|
|
|
|
|
|
Node? getNanoDefaultPowNode({required Box<Node> nodes}) {
|
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == nanoDefaultPowNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => (node.type == WalletType.nano));
|
2023-08-04 17:01:49 +00:00
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
Node? getBitcoinCashDefaultElectrumServer({required Box<Node> nodes}) {
|
2023-11-30 21:39:09 +00:00
|
|
|
return nodes.values
|
|
|
|
.firstWhereOrNull((Node node) => node.uriRaw == cakeWalletBitcoinCashDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.bitcoinCash);
|
2023-10-12 22:50:16 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Node getMoneroDefaultNode({required Box<Node> nodes}) {
|
2020-01-08 16:38:38 +00:00
|
|
|
final timeZone = DateTime.now().timeZoneOffset.inHours;
|
2020-08-27 16:54:34 +00:00
|
|
|
var nodeUri = '';
|
2020-01-08 16:38:38 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
if (timeZone >= 1) {
|
|
|
|
// Eurasia
|
2020-01-08 16:38:38 +00:00
|
|
|
nodeUri = 'xmr-node-eu.cakewallet.com:18081';
|
2020-07-06 20:09:03 +00:00
|
|
|
} else if (timeZone <= -4) {
|
|
|
|
// America
|
2020-01-08 16:38:38 +00:00
|
|
|
nodeUri = 'xmr-node-usa-east.cakewallet.com:18081';
|
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
try {
|
2023-10-05 01:09:07 +00:00
|
|
|
return nodes.values.firstWhere((Node node) => node.uriRaw == nodeUri);
|
|
|
|
} catch (_) {
|
2022-10-12 17:09:57 +00:00
|
|
|
return nodes.values.first;
|
|
|
|
}
|
2020-08-27 16:54:34 +00:00
|
|
|
}
|
2020-01-08 16:38:38 +00:00
|
|
|
|
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
|
|
|
Node? getSolanaDefaultNode({required Box<Node> nodes}) {
|
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == solanaDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.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
|
|
|
Node? getTronDefaultNode({required Box<Node> nodes}) {
|
|
|
|
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == tronDefaultNodeUri) ??
|
|
|
|
nodes.values.firstWhereOrNull((node) => node.type == WalletType.tron);
|
|
|
|
}
|
|
|
|
|
2024-01-23 00:30:16 +00:00
|
|
|
Future<void> insecureStorageMigration({
|
|
|
|
required SharedPreferences sharedPreferences,
|
2024-05-08 20:23:27 +00:00
|
|
|
required SecureStorage secureStorage,
|
2024-01-23 00:30:16 +00:00
|
|
|
}) async {
|
|
|
|
bool? allowBiometricalAuthentication =
|
|
|
|
sharedPreferences.getBool(SecureKey.allowBiometricalAuthenticationKey);
|
|
|
|
bool? useTOTP2FA = sharedPreferences.getBool(SecureKey.useTOTP2FA);
|
|
|
|
bool? shouldRequireTOTP2FAForAccessingWallet =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForAccessingWallet);
|
|
|
|
bool? shouldRequireTOTP2FAForSendsToContact =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForSendsToContact);
|
|
|
|
bool? shouldRequireTOTP2FAForSendsToNonContact =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForSendsToNonContact);
|
|
|
|
bool? shouldRequireTOTP2FAForSendsToInternalWallets =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForSendsToInternalWallets);
|
|
|
|
bool? shouldRequireTOTP2FAForExchangesToInternalWallets =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForExchangesToInternalWallets);
|
|
|
|
bool? shouldRequireTOTP2FAForExchangesToExternalWallets =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForExchangesToExternalWallets);
|
|
|
|
bool? shouldRequireTOTP2FAForAddingContacts =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForAddingContacts);
|
|
|
|
bool? shouldRequireTOTP2FAForCreatingNewWallets =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForCreatingNewWallets);
|
|
|
|
bool? shouldRequireTOTP2FAForAllSecurityAndBackupSettings =
|
|
|
|
sharedPreferences.getBool(SecureKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings);
|
|
|
|
int? selectedCake2FAPreset = sharedPreferences.getInt(SecureKey.selectedCake2FAPreset);
|
|
|
|
String? totpSecretKey = sharedPreferences.getString(SecureKey.totpSecretKey);
|
|
|
|
int? pinTimeOutDuration = sharedPreferences.getInt(SecureKey.pinTimeOutDuration);
|
|
|
|
int? lastAuthTimeMilliseconds = sharedPreferences.getInt(SecureKey.lastAuthTimeMilliseconds);
|
|
|
|
|
|
|
|
try {
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.allowBiometricalAuthenticationKey,
|
|
|
|
value: allowBiometricalAuthentication.toString());
|
|
|
|
await secureStorage.write(key: SecureKey.useTOTP2FA, value: useTOTP2FA.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForAccessingWallet,
|
|
|
|
value: shouldRequireTOTP2FAForAccessingWallet.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForSendsToContact,
|
|
|
|
value: shouldRequireTOTP2FAForSendsToContact.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForSendsToNonContact,
|
|
|
|
value: shouldRequireTOTP2FAForSendsToNonContact.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForSendsToInternalWallets,
|
|
|
|
value: shouldRequireTOTP2FAForSendsToInternalWallets.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForExchangesToInternalWallets,
|
|
|
|
value: shouldRequireTOTP2FAForExchangesToInternalWallets.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForExchangesToExternalWallets,
|
|
|
|
value: shouldRequireTOTP2FAForExchangesToExternalWallets.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForAddingContacts,
|
|
|
|
value: shouldRequireTOTP2FAForAddingContacts.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForCreatingNewWallets,
|
|
|
|
value: shouldRequireTOTP2FAForCreatingNewWallets.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
|
|
|
value: shouldRequireTOTP2FAForAllSecurityAndBackupSettings.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.selectedCake2FAPreset, value: selectedCake2FAPreset.toString());
|
|
|
|
await secureStorage.write(key: SecureKey.totpSecretKey, value: totpSecretKey.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.pinTimeOutDuration, value: pinTimeOutDuration.toString());
|
|
|
|
await secureStorage.write(
|
|
|
|
key: SecureKey.lastAuthTimeMilliseconds, value: lastAuthTimeMilliseconds.toString());
|
|
|
|
} catch (e) {
|
|
|
|
print("Error migrating shared preferences to secure storage!: $e");
|
|
|
|
// this actually shouldn't be that big of a problem since we don't delete the old keys in this update
|
|
|
|
// and we read and write to the new locations when loading storage, the migration is just for extra safety
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
Future<void> rewriteSecureStoragePin({required SecureStorage secureStorage}) async {
|
2023-11-30 21:39:09 +00:00
|
|
|
// the bug only affects ios/mac:
|
|
|
|
if (!Platform.isIOS && !Platform.isMacOS) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// first, get the encoded pin:
|
|
|
|
final keyForPinCode = generateStoreKeyFor(key: SecretStoreKey.pinCodePassword);
|
|
|
|
String? encodedPin;
|
|
|
|
try {
|
|
|
|
encodedPin = await secureStorage.read(key: keyForPinCode);
|
|
|
|
} catch (e) {
|
|
|
|
// either we don't have a pin, or we can't read it (maybe even because of the bug!)
|
|
|
|
// the only option here is to abort the migration or we risk losing the pin and locking the user out
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (encodedPin == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ensure we overwrite by deleting the old key first:
|
|
|
|
await secureStorage.delete(key: keyForPinCode);
|
|
|
|
await secureStorage.write(
|
|
|
|
key: keyForPinCode,
|
|
|
|
value: encodedPin,
|
2024-05-08 20:23:27 +00:00
|
|
|
// TODO: find a way to add those with the generated secure storage
|
|
|
|
// iOptions: IOSOptions(accessibility: KeychainAccessibility.first_unlock),
|
|
|
|
// mOptions: MacOsOptions(accessibility: KeychainAccessibility.first_unlock),
|
2023-11-30 21:39:09 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-08-27 16:54:34 +00:00
|
|
|
Future<void> changeBitcoinCurrentElectrumServerToDefault(
|
Btc address types (#1263)
* inital migration changes
* feat: rest of changes
* minor fix [skip ci]
* fix: P2wshAddress & wallet address index
* fix: address review comments
* fix: address type restore
* feat: add testnet
* Fix review comments
Remove bitcoin_base from cw_core
* Fix address not matching selected type on start
* remove un-necessary parameter [skip ci]
* Remove bitcoin specific code from main lib
Fix possible runtime exception from list wrong access
* Minor fix
* fix: fixes for Testnet
* fix: bitcoin receive option dependency breaks monerocom
* Fix issues when building Monero.com
* feat: Transaction Builder changes
* fix: discover addresses, testnet restoring, duplicate unspent coins, and taproot address vs schnorr sig tweak
* fix: remove print
* feat: improve error when failed broadcast response
* feat: create fish shell env script
* fix: unmodifiable maps
* fix: build
* fix: build
* fix: computed observable side effect bug
* feat: add nix script for android build_all
* fix: wrong keypairs used for signing
* fix: wrong addresses when using fromScriptPubKey scripts
* fix(actual commit): testnet tx expanded + wrong addresses when using fromScriptPubKey scripts (update bitcoin_base deps)
* fix: self-send [skip ci]
* fix: p2wsh
* fix: testnet fees
* New versions
* Update macos build number
Minor UI fix
* fix: use new bitcoin_base ref, fix tx list wrong hex value & refactor hidden vs hd use
- if always use sideHd for isHidden, it is easier to simplify the functions instead of passing both which can be error prone
- (ps: now this could probably be changed, for example from isHidden to isChange since with address list we now see "hidden" addresses)
* Fix if condition to handle litecoin case
* fix: self-send, change address was always making direction incoming
* refactor: improve estimation function, add more inputs if balance missing
* fix: new bitcoin_base update, fixes script issues
* Update evm chain wallet service arguments
* Fix translation [skip ci]
* Fix translation [skip ci]
* Update strings_fr.arb [skip ci]
* fix: async isChange function not being awaited, refactor to reduce looping into a single place
* fix: _address vs address, missing p2sh
* fix: minor mistake in storing p2sh page type [skip ci]
* refactor: use already matched addresses property
* feat: improved perfomance for fetching transaction histories
* feat: continue perfomance change, improve address discovery only to last address by type with history
* fix: make sure transaction list is sorted by date
* refactor: isTestnet only for bitcoin
* fix: walletInfo type null case
* fix: deprecated p2pk
* refactor: make condition more readable
* refactor: remove unnecessary Str variant
* refactor: make condition more readable
* fix: infinite loop possible
* Revert removing isTestnet from other wallets [skip ci]
* refactor: rename addresses when matched by receive type
* Make the beta build [skip ci]
Remove app_env.fish
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
2024-02-23 16:13:30 +00:00
|
|
|
{required SharedPreferences sharedPreferences,
|
|
|
|
required Box<Node> nodes,
|
|
|
|
bool? isTestnet}) async {
|
|
|
|
Node? server;
|
|
|
|
if (isTestnet == true) {
|
|
|
|
server = getBitcoinTestnetDefaultElectrumServer(nodes: nodes);
|
|
|
|
} else {
|
|
|
|
server = getBitcoinDefaultElectrumServer(nodes: nodes);
|
|
|
|
}
|
2023-08-30 15:11:56 +00:00
|
|
|
final serverId = server?.key as int? ?? 0;
|
2020-08-27 16:54:34 +00:00
|
|
|
|
2022-11-29 23:37:56 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentBitcoinElectrumSererIdKey, serverId);
|
2020-01-08 16:38:38 +00:00
|
|
|
}
|
|
|
|
|
2021-05-07 07:36:38 +00:00
|
|
|
Future<void> changeLitecoinCurrentElectrumServerToDefault(
|
2023-10-05 01:09:07 +00:00
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
2021-05-07 07:36:38 +00:00
|
|
|
final server = getLitecoinDefaultElectrumServer(nodes: nodes);
|
2023-08-30 15:11:56 +00:00
|
|
|
final serverId = server?.key as int? ?? 0;
|
2021-05-07 07:36:38 +00:00
|
|
|
|
2022-11-29 23:37:56 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentLitecoinElectrumSererIdKey, serverId);
|
2021-05-07 07:36:38 +00:00
|
|
|
}
|
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
Future<void> changeBitcoinCashCurrentNodeToDefault(
|
2023-11-30 21:39:09 +00:00
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
2023-10-12 22:50:16 +00:00
|
|
|
final server = getBitcoinCashDefaultElectrumServer(nodes: nodes);
|
2024-01-30 17:57:47 +00:00
|
|
|
final serverId = server?.key as int? ?? 0;
|
2023-10-12 22:50:16 +00:00
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentBitcoinCashNodeIdKey, serverId);
|
|
|
|
}
|
|
|
|
|
2022-03-30 15:57:04 +00:00
|
|
|
Future<void> changeHavenCurrentNodeToDefault(
|
2023-10-05 01:09:07 +00:00
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
2022-03-30 15:57:04 +00:00
|
|
|
final node = getHavenDefaultNode(nodes: nodes);
|
2023-08-30 15:11:56 +00:00
|
|
|
final nodeId = node?.key as int? ?? 0;
|
2022-03-30 15:57:04 +00:00
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentHavenNodeIdKey, nodeId);
|
|
|
|
}
|
|
|
|
|
2020-01-08 16:38:38 +00:00
|
|
|
Future<void> replaceDefaultNode(
|
2023-10-05 01:09:07 +00:00
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
2020-01-08 16:38:38 +00:00
|
|
|
const nodesForReplace = <String>[
|
|
|
|
'xmr-node-uk.cakewallet.com:18081',
|
|
|
|
'eu-node.cakewallet.io:18081',
|
|
|
|
'node.cakewallet.io:18081'
|
|
|
|
];
|
2022-11-29 23:37:56 +00:00
|
|
|
final currentNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
|
2023-10-05 01:09:07 +00:00
|
|
|
final currentNode = nodes.values.firstWhereOrNull((Node node) => node.key == currentNodeId);
|
|
|
|
final needToReplace = currentNode == null ? true : nodesForReplace.contains(currentNode.uriRaw);
|
2020-01-08 16:38:38 +00:00
|
|
|
|
|
|
|
if (!needToReplace) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
await changeMoneroCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes);
|
2020-01-08 16:38:38 +00:00
|
|
|
}
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> updateNodeTypes({required Box<Node> nodes}) async {
|
2020-07-06 20:09:03 +00:00
|
|
|
nodes.values.forEach((node) async {
|
|
|
|
if (node.type == null) {
|
|
|
|
node.type = WalletType.monero;
|
|
|
|
await node.save();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> addBitcoinElectrumServerList({required Box<Node> nodes}) async {
|
2021-05-07 07:36:38 +00:00
|
|
|
final serverList = await loadBitcoinElectrumServerList();
|
2022-11-26 14:13:54 +00:00
|
|
|
for (var node in serverList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
2021-05-07 07:36:38 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> addLitecoinElectrumServerList({required Box<Node> nodes}) async {
|
2021-05-07 07:36:38 +00:00
|
|
|
final serverList = await loadLitecoinElectrumServerList();
|
2022-11-26 14:13:54 +00:00
|
|
|
for (var node in serverList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
2020-07-06 20:09:03 +00:00
|
|
|
}
|
2021-01-08 18:10:37 +00:00
|
|
|
|
2023-10-12 22:50:16 +00:00
|
|
|
Future<void> addBitcoinCashElectrumServerList({required Box<Node> nodes}) async {
|
|
|
|
final serverList = await loadBitcoinCashElectrumServerList();
|
|
|
|
for (var node in serverList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
Future<void> addHavenNodeList({required Box<Node> nodes}) async {
|
2022-03-30 15:57:04 +00:00
|
|
|
final nodeList = await loadDefaultHavenNodes();
|
2022-11-26 14:13:54 +00:00
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
2022-03-30 15:57:04 +00:00
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
Future<void> addAddressesForMoneroWallets(Box<WalletInfo> walletInfoSource) async {
|
|
|
|
final moneroWalletsInfo = walletInfoSource.values.where((info) => info.type == WalletType.monero);
|
2021-01-08 18:10:37 +00:00
|
|
|
moneroWalletsInfo.forEach((info) async {
|
|
|
|
try {
|
2023-10-05 01:09:07 +00:00
|
|
|
final walletPath = await pathForWallet(name: info.name, type: WalletType.monero);
|
2021-01-08 18:10:37 +00:00
|
|
|
final addressFilePath = '$walletPath.address.txt';
|
|
|
|
final addressFile = File(addressFilePath);
|
|
|
|
|
|
|
|
if (!addressFile.existsSync()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
final addressText = await addressFile.readAsString();
|
|
|
|
info.address = addressText;
|
|
|
|
await info.save();
|
|
|
|
} catch (e) {
|
|
|
|
print(e.toString());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-01-11 17:15:27 +00:00
|
|
|
|
|
|
|
Future<void> updateDisplayModes(SharedPreferences sharedPreferences) async {
|
|
|
|
final currentBalanceDisplayMode =
|
2022-10-12 17:09:57 +00:00
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBalanceDisplayModeKey) ?? -1;
|
2021-01-11 17:15:27 +00:00
|
|
|
final balanceDisplayMode = currentBalanceDisplayMode < 2 ? 3 : 2;
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentBalanceDisplayModeKey, balanceDisplayMode);
|
2021-01-15 17:41:30 +00:00
|
|
|
}
|
|
|
|
|
2024-05-08 20:23:27 +00:00
|
|
|
Future<void> generateBackupPassword(SecureStorage secureStorage) async {
|
2021-01-15 17:41:30 +00:00
|
|
|
final key = generateStoreKeyFor(key: SecretStoreKey.backupPassword);
|
|
|
|
|
|
|
|
if ((await secureStorage.read(key: key))?.isNotEmpty ?? false) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
final password = encrypt.Key.fromSecureRandom(32).base16;
|
2023-11-27 13:28:34 +00:00
|
|
|
await secureStorage.delete(key: key);
|
2021-01-15 17:41:30 +00:00
|
|
|
await secureStorage.write(key: key, value: password);
|
2021-01-11 17:15:27 +00:00
|
|
|
}
|
2021-01-27 13:51:51 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
Future<void> changeTransactionPriorityAndFeeRateKeys(SharedPreferences sharedPreferences) async {
|
|
|
|
final legacyTransactionPriority =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentTransactionPriorityKeyLegacy)!;
|
2021-01-27 13:51:51 +00:00
|
|
|
await sharedPreferences.setInt(
|
|
|
|
PreferencesKey.moneroTransactionPriority, legacyTransactionPriority);
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.bitcoinTransactionPriority,
|
2022-10-12 17:09:57 +00:00
|
|
|
bitcoin!.getMediumTransactionPriority().serialize());
|
2021-01-27 13:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changeDefaultMoneroNode(
|
|
|
|
Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
|
|
|
const cakeWalletMoneroNodeUriPattern = '.cakewallet.com';
|
2023-10-05 01:09:07 +00:00
|
|
|
final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
|
|
|
|
final currentMoneroNode = nodeSource.values.firstWhere((node) => node.key == currentMoneroNodeId);
|
2021-05-07 07:36:38 +00:00
|
|
|
final needToReplaceCurrentMoneroNode =
|
2021-05-10 16:00:20 +00:00
|
|
|
currentMoneroNode.uri.toString().contains(cakeWalletMoneroNodeUriPattern);
|
2021-01-27 13:51:51 +00:00
|
|
|
|
|
|
|
nodeSource.values.forEach((node) async {
|
2021-05-07 07:36:38 +00:00
|
|
|
if (node.type == WalletType.monero &&
|
2021-05-10 16:00:20 +00:00
|
|
|
node.uri.toString().contains(cakeWalletMoneroNodeUriPattern)) {
|
2021-01-27 13:51:51 +00:00
|
|
|
await node.delete();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
final newCakeWalletNode = Node(uri: newCakeWalletMoneroUri, type: WalletType.monero);
|
2021-01-27 13:51:51 +00:00
|
|
|
|
|
|
|
await nodeSource.add(newCakeWalletNode);
|
|
|
|
|
|
|
|
if (needToReplaceCurrentMoneroNode) {
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNodeIdKey, newCakeWalletNode.key as int);
|
2021-01-27 13:51:51 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-01 18:12:37 +00:00
|
|
|
|
2024-06-18 05:08:03 +00:00
|
|
|
Future<void> fixBtcDerivationPaths(Box<WalletInfo> walletsInfoSource) async {
|
|
|
|
for (WalletInfo walletInfo in walletsInfoSource.values) {
|
|
|
|
if (walletInfo.type == WalletType.bitcoin ||
|
|
|
|
walletInfo.type == WalletType.bitcoinCash ||
|
|
|
|
walletInfo.type == WalletType.litecoin) {
|
|
|
|
if (walletInfo.derivationInfo?.derivationPath == "m/0'/0") {
|
|
|
|
walletInfo.derivationInfo!.derivationPath = "m/0'";
|
|
|
|
await walletInfo.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Bitcoin derivations (#1089)
* - Update and Fix Conflicts with main
* Add Balances for ERC20 tokens
* Fix conflicts with main
* Add erc20 abi json
* Add send erc20 tokens initial function
* add missing getHeightByDate in Haven [skip ci]
* Allow contacts and wallets from the same tag
* Add Shiba Inu icon
* Add send ERC-20 tokens initial flow
* Add missing import in generated file
* Add initial approach for transaction sending for ERC-20 tokens
* Refactor signing/sending transactions
* Add initial flow for transactions subscription
* Refactor signing/sending transactions
* Add home settings icon
* Fix conflicts with main
* Initial flow for home settings
* Add logic flow for adding erc20 tokens
* Fix initial UI
* Finalize UI for Tokens
* Integrate UI with Ethereum flow
* Add "Enable/Disable" feature for ERC20 tokens
* Add initial Erc20 tokens
* Add Sorting and Pin Native Token features
* Fix price sorting
* Sort tokens list as well when Sort criteria changes
* - Improve sorting balances flow
- Add initial add token from search bar flow
* Fix Accounts Popup UI
* Fix Pin native token
* Fix Enabling/Disabling tokens
Fix sorting by fiat once app is opened
Improve token availability mechanism
* Fix deleting token
Fix renaming tokens
* Fix issue with search
* Add more tokens
* - Fix scroll issue
- Add ERC20 tokens placeholder image in picker
* - Separate and organize default erc20 tokens
- Fix scrolling
- Add token placeholder images in picker
- Sort disabled tokens alphabetically
* Change BNB token initial availability [skip ci]
* Fix Conflicts with main
* Fix Conflicts with main
* Add Verse ERC20 token to the initial tokens list
* Add rename wallet to Ethereum
* Integrate EtherScan API for fetching address transactions
Generate Ethereum specific secrets in Ethereum package
* Adjust transactions fiat price for ERC20 tokens
* Free Up GitHub Actions Ubuntu Runner Disk Space
* Free Up GitHub Actions Ubuntu Runner Disk space (trial 2)
* Fix Transaction Fee display
* Save transaction history
* Enhance loading time for erc20 tokens transactions
* Minor Fixes and Enhancements
* Fix sending erc20
fix block explorer issue
* Fix int overflow
* Fix transaction amount conversions
* Minor: `slow` -> `Slow` [skip-ci]
* initial changes
* more base config stuff
* config changes
* successfully builds!
* save
* successfully add nano wallet
* save
* seed generation
* receive screen + node screen working
* tx history working and fiat fixes
* balance working
* derivation updates
* nano-unfinished
* sends working
* remove fees from send screen, send and receive transactions working
* fixes + auto receive incoming txs
* fix for scanning QR codes
* save
* update translations
* fixes
* more fixes
* more strings
* small fix
* fix github actions workflow
* potential fix
* potential fix
* ci/cd fix
* change rep working
* seed generation fixes
* fixes
* save
* change rep screen functional
* save
* banano changes
* fixes, start adding ui for PoW
* pow node changes
* update translations
* fix
* account changing barely working
* save
* disable account generation
* small fix
* save
* UI work
* save
* fixes after merge main
* fixes
* remove monero stuff, work on derivation ui
* lots of fixes + finish up seed derivation
* last minute fixes
* node related fixes
* more fixes
* small fix
* more fixes
* fixes
* pretty big refactor for pow, still some bugs
* finally works!
* get transactions after send
* fix
* merge conflict fixes
* save
* fix pow node showing up twice
* done
* initial changes
* small fix
* more merge fixes
* fixes
* more fixes
* fix
* save
* fix manage pow nodes setting appearing on other wallets
* fix contact bug
* fixes
* fiat fixes
* save
* save
* save
* save
* updates
* cleanup
* restore fix
* fixes
* remove deprecated alert
* fix
* small fix
* remove outdated warning
* electrum restore fixes
* fixes
* fixes
* fix
* derivation fixes
* nano fixes pt.1
* nano fixes pt.2
* bip39 fixes
* pownode refactor
* nodes pages fixes
* observer fix
* ssl fix
* remove old references
* remove unused imports
* code cleanup
* small fix
* small potential fix
* save
* derivation fixes
* deterministic fix
* fix pt.2
* derivation class fixes
* review fixes from nano that also apply here
* formatting
* stuff that should've stayed deleted
* post merge fixes
* remove problematic imports and duplicate changes
* Delete lib/nano/nano.dart
* move wallet restore page proxy code to the view model
* fix dashboard page indicators being the same color
* debatably better refactoring of derivationInfo, migration needed
* additional refactor improvements
* blanket comment some stuff out to narrow down this issue
* refactor fixes
* fix nano exchange
* fix , bug, i.e. replace , with . when making a nano transaction
* fix nano sending, update restore page wording, and other minor fixes
* write migration for existing bitcoin and nano wallets
* merge fixes
* minor fixes
* use default derivation type when restoring from qr code
* fixes for restoring
* fixes
* fixes
* merge fix
* Fix issues with Creating Electrum and Restoring Bip39
* updates & fixes
* Add missing case for no transactions BIP39 wallet restore
* Make the default BIP39 the 84 derivation path
* Add Samourai Deposit
* litecoin mnemonic error fix
* Bip39 passphrase support (#1412)
* save
* passphrase working
* fix for when loading wallets + translation update
* minor fix
* Fix Nano
* minor fix [skip ci]
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
* change error state seed conditions into throwables [skip ci]
* litecoin fixes
* Bip39 minor enhancements (#1416)
* minor enhancements
* rename bitcoin_derivations -> electrum_derivations
* Remove duplicate derivations
handle default case
* minor fix
* Enable passphrase for Litecoin
* obscure text of passphrase
---------
Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Justin Ehrenhofer <justin.ehrenhofer@gmail.com>
Co-authored-by: fossephate <fosse@book.local>
2024-04-30 00:49:56 +00:00
|
|
|
Future<void> updateBtcNanoWalletInfos(Box<WalletInfo> walletsInfoSource) async {
|
|
|
|
for (WalletInfo walletInfo in walletsInfoSource.values) {
|
|
|
|
if (walletInfo.type == WalletType.nano || walletInfo.type == WalletType.bitcoin) {
|
|
|
|
walletInfo.derivationInfo = DerivationInfo(
|
|
|
|
derivationPath: walletInfo.derivationPath,
|
|
|
|
derivationType: walletInfo.derivationType,
|
|
|
|
address: walletInfo.address,
|
|
|
|
transactionsCount: walletInfo.restoreHeight,
|
|
|
|
);
|
|
|
|
await walletInfo.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-18 15:45:11 +00:00
|
|
|
Future<void> changeDefaultBitcoinNode(
|
|
|
|
Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
|
|
|
const cakeWalletBitcoinNodeUriPattern = '.cakewallet.com';
|
|
|
|
final currentBitcoinNodeId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
|
|
|
|
final currentBitcoinNode =
|
|
|
|
nodeSource.values.firstWhere((node) => node.key == currentBitcoinNodeId);
|
|
|
|
final needToReplaceCurrentBitcoinNode =
|
|
|
|
currentBitcoinNode.uri.toString().contains(cakeWalletBitcoinNodeUriPattern);
|
|
|
|
|
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
|
|
|
final newCakeWalletBitcoinNode =
|
|
|
|
Node(uri: newCakeWalletBitcoinUri, type: WalletType.bitcoin, useSSL: false);
|
2024-03-18 15:45:11 +00:00
|
|
|
|
|
|
|
await nodeSource.add(newCakeWalletBitcoinNode);
|
|
|
|
|
|
|
|
if (needToReplaceCurrentBitcoinNode) {
|
|
|
|
await sharedPreferences.setInt(
|
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey, newCakeWalletBitcoinNode.key as int);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
Future<void> _addElectRsNode(Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
|
|
|
const cakeWalletBitcoinNodeUriPattern = '.cakewallet.com';
|
|
|
|
final currentBitcoinNodeId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
|
|
|
|
final currentBitcoinNode =
|
|
|
|
nodeSource.values.firstWhere((node) => node.key == currentBitcoinNodeId);
|
|
|
|
final needToReplaceCurrentBitcoinNode =
|
|
|
|
currentBitcoinNode.uri.toString().contains(cakeWalletBitcoinNodeUriPattern);
|
|
|
|
|
|
|
|
final newElectRsBitcoinNode =
|
|
|
|
Node(uri: cakeWalletSilentPaymentsElectrsUri, type: WalletType.bitcoin, useSSL: false);
|
|
|
|
|
|
|
|
await nodeSource.add(newElectRsBitcoinNode);
|
|
|
|
|
|
|
|
if (needToReplaceCurrentBitcoinNode) {
|
|
|
|
await sharedPreferences.setInt(
|
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey, newElectRsBitcoinNode.key as int);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-10 07:22:57 +00:00
|
|
|
Future<void> _switchElectRsNode(Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
|
|
|
final currentBitcoinNodeId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
|
|
|
|
final currentBitcoinNode =
|
|
|
|
nodeSource.values.firstWhere((node) => node.key == currentBitcoinNodeId);
|
|
|
|
final needToReplaceCurrentBitcoinNode =
|
|
|
|
currentBitcoinNode.uri.toString().contains('electrs.cakewallet.com');
|
|
|
|
|
|
|
|
if (!needToReplaceCurrentBitcoinNode) return;
|
|
|
|
|
|
|
|
final btcElectrumNode = nodeSource.values.firstWhereOrNull(
|
|
|
|
(node) => node.uri.toString().contains('btc-electrum.cakewallet.com'),
|
|
|
|
);
|
|
|
|
|
|
|
|
if (btcElectrumNode == null) {
|
|
|
|
final newBtcElectrumBitcoinNode = Node(
|
|
|
|
uri: newCakeWalletBitcoinUri,
|
|
|
|
type: WalletType.bitcoin,
|
|
|
|
useSSL: false,
|
|
|
|
);
|
|
|
|
await nodeSource.add(newBtcElectrumBitcoinNode);
|
|
|
|
await sharedPreferences.setInt(
|
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey,
|
|
|
|
newBtcElectrumBitcoinNode.key as int,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
await sharedPreferences.setInt(
|
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey,
|
|
|
|
btcElectrumNode.key as int,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-07 07:36:38 +00:00
|
|
|
Future<void> checkCurrentNodes(
|
2023-10-05 01:09:07 +00:00
|
|
|
Box<Node> nodeSource, Box<Node> powNodeSource, SharedPreferences sharedPreferences) async {
|
|
|
|
final currentMoneroNodeId = sharedPreferences.getInt(PreferencesKey.currentNodeIdKey);
|
2021-05-07 07:36:38 +00:00
|
|
|
final currentBitcoinElectrumSeverId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
|
2023-11-30 21:39:09 +00:00
|
|
|
final currentLitecoinElectrumSeverId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentLitecoinElectrumSererIdKey);
|
|
|
|
final currentHavenNodeId = sharedPreferences.getInt(PreferencesKey.currentHavenNodeIdKey);
|
|
|
|
final currentEthereumNodeId = sharedPreferences.getInt(PreferencesKey.currentEthereumNodeIdKey);
|
2023-12-02 02:26:43 +00:00
|
|
|
final currentPolygonNodeId = sharedPreferences.getInt(PreferencesKey.currentPolygonNodeIdKey);
|
2023-11-30 21:39:09 +00:00
|
|
|
final currentNanoNodeId = sharedPreferences.getInt(PreferencesKey.currentNanoNodeIdKey);
|
|
|
|
final currentNanoPowNodeId = sharedPreferences.getInt(PreferencesKey.currentNanoPowNodeIdKey);
|
|
|
|
final currentBitcoinCashNodeId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBitcoinCashNodeIdKey);
|
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
|
|
|
final currentSolanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey);
|
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
|
|
|
final currentTronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey);
|
2023-11-30 21:39:09 +00:00
|
|
|
final currentMoneroNode =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentMoneroNodeId);
|
|
|
|
final currentBitcoinElectrumServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentBitcoinElectrumSeverId);
|
|
|
|
final currentLitecoinElectrumServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentLitecoinElectrumSeverId);
|
|
|
|
final currentHavenNodeServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentHavenNodeId);
|
|
|
|
final currentEthereumNodeServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentEthereumNodeId);
|
2023-12-02 02:26:43 +00:00
|
|
|
final currentPolygonNodeServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentPolygonNodeId);
|
2023-10-05 01:09:07 +00:00
|
|
|
final currentNanoNodeServer =
|
2023-11-30 21:39:09 +00:00
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentNanoNodeId);
|
2023-10-05 01:09:07 +00:00
|
|
|
final currentNanoPowNodeServer =
|
2023-11-30 21:39:09 +00:00
|
|
|
powNodeSource.values.firstWhereOrNull((node) => node.key == currentNanoPowNodeId);
|
|
|
|
final currentBitcoinCashNodeServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentBitcoinCashNodeId);
|
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
|
|
|
final currentSolanaNodeServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentSolanaNodeId);
|
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
|
|
|
final currentTronNodeServer =
|
|
|
|
nodeSource.values.firstWhereOrNull((node) => node.key == currentTronNodeId);
|
2021-02-01 18:12:37 +00:00
|
|
|
if (currentMoneroNode == null) {
|
2023-10-05 01:09:07 +00:00
|
|
|
final newCakeWalletNode = Node(uri: newCakeWalletMoneroUri, type: WalletType.monero);
|
2021-02-01 18:12:37 +00:00
|
|
|
await nodeSource.add(newCakeWalletNode);
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNodeIdKey, newCakeWalletNode.key as int);
|
2021-02-01 18:12:37 +00:00
|
|
|
}
|
|
|
|
|
2021-05-07 07:36:38 +00:00
|
|
|
if (currentBitcoinElectrumServer == null) {
|
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
|
|
|
final cakeWalletElectrum =
|
|
|
|
Node(uri: cakeWalletBitcoinElectrumUri, type: WalletType.bitcoin, useSSL: false);
|
2021-02-01 18:12:37 +00:00
|
|
|
await nodeSource.add(cakeWalletElectrum);
|
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
|
|
|
final cakeWalletElectrumTestnet =
|
|
|
|
Node(uri: publicBitcoinTestnetElectrumUri, type: WalletType.bitcoin, useSSL: false);
|
|
|
|
await nodeSource.add(cakeWalletElectrumTestnet);
|
2021-05-07 07:36:38 +00:00
|
|
|
await sharedPreferences.setInt(
|
2023-10-05 01:09:07 +00:00
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey, cakeWalletElectrum.key as int);
|
2021-02-01 18:12:37 +00:00
|
|
|
}
|
|
|
|
|
2021-05-07 07:36:38 +00:00
|
|
|
if (currentLitecoinElectrumServer == null) {
|
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
|
|
|
final cakeWalletElectrum =
|
|
|
|
Node(uri: cakeWalletLitecoinElectrumUri, type: WalletType.litecoin, useSSL: false);
|
2021-05-07 07:36:38 +00:00
|
|
|
await nodeSource.add(cakeWalletElectrum);
|
|
|
|
await sharedPreferences.setInt(
|
2023-10-05 01:09:07 +00:00
|
|
|
PreferencesKey.currentLitecoinElectrumSererIdKey, cakeWalletElectrum.key as int);
|
2021-05-07 07:36:38 +00:00
|
|
|
}
|
2022-03-30 15:57:04 +00:00
|
|
|
|
|
|
|
if (currentHavenNodeServer == null) {
|
2022-10-19 22:21:16 +00:00
|
|
|
final node = Node(uri: havenDefaultNodeUri, type: WalletType.haven);
|
2022-03-30 15:57:04 +00:00
|
|
|
await nodeSource.add(node);
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentHavenNodeIdKey, node.key as int);
|
2022-03-30 15:57:04 +00:00
|
|
|
}
|
2023-08-04 17:01:49 +00:00
|
|
|
|
|
|
|
if (currentEthereumNodeServer == null) {
|
|
|
|
final node = Node(uri: ethereumDefaultNodeUri, type: WalletType.ethereum);
|
|
|
|
await nodeSource.add(node);
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentEthereumNodeIdKey, node.key as int);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentNanoNodeServer == null) {
|
|
|
|
final node = Node(uri: nanoDefaultNodeUri, useSSL: true, type: WalletType.nano);
|
|
|
|
await nodeSource.add(node);
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNanoNodeIdKey, node.key as int);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentNanoPowNodeServer == null) {
|
|
|
|
Node? node = powNodeSource.values
|
|
|
|
.firstWhereOrNull((node) => node.uri.toString() == nanoDefaultPowNodeUri);
|
|
|
|
if (node == null) {
|
|
|
|
node = Node(uri: nanoDefaultPowNodeUri, useSSL: true, type: WalletType.nano);
|
|
|
|
await powNodeSource.add(node);
|
|
|
|
}
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNanoPowNodeIdKey, node.key as int);
|
2023-08-04 17:01:49 +00:00
|
|
|
}
|
2023-10-12 22:50:16 +00:00
|
|
|
|
|
|
|
if (currentBitcoinCashNodeServer == null) {
|
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
|
|
|
final node =
|
|
|
|
Node(uri: cakeWalletBitcoinCashDefaultNodeUri, type: WalletType.bitcoinCash, useSSL: false);
|
2023-10-12 22:50:16 +00:00
|
|
|
await nodeSource.add(node);
|
2023-11-30 21:39:09 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentBitcoinCashNodeIdKey, node.key as int);
|
2023-10-12 22:50:16 +00:00
|
|
|
}
|
2023-12-02 02:26:43 +00:00
|
|
|
|
|
|
|
if (currentPolygonNodeServer == null) {
|
|
|
|
final node = Node(uri: polygonDefaultNodeUri, type: WalletType.polygon);
|
|
|
|
await nodeSource.add(node);
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentPolygonNodeIdKey, node.key as int);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
if (currentSolanaNodeServer == null) {
|
|
|
|
final node = Node(uri: solanaDefaultNodeUri, type: WalletType.solana);
|
|
|
|
await nodeSource.add(node);
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentSolanaNodeIdKey, node.key as int);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
if (currentTronNodeServer == null) {
|
|
|
|
final node = Node(uri: tronDefaultNodeUri, type: WalletType.tron);
|
|
|
|
await nodeSource.add(node);
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentTronNodeIdKey, node.key as int);
|
|
|
|
}
|
2021-05-07 07:36:38 +00:00
|
|
|
}
|
2021-02-01 18:12:37 +00:00
|
|
|
|
2021-05-07 07:36:38 +00:00
|
|
|
Future<void> resetBitcoinElectrumServer(
|
|
|
|
Box<Node> nodeSource, SharedPreferences sharedPreferences) async {
|
|
|
|
final currentElectrumSeverId =
|
|
|
|
sharedPreferences.getInt(PreferencesKey.currentBitcoinElectrumSererIdKey);
|
2023-10-05 01:09:07 +00:00
|
|
|
final oldElectrumServer = nodeSource.values
|
|
|
|
.firstWhereOrNull((node) => node.uri.toString().contains('electrumx.cakewallet.com'));
|
|
|
|
var cakeWalletNode = nodeSource.values
|
|
|
|
.firstWhereOrNull((node) => node.uriRaw.toString() == cakeWalletBitcoinElectrumUri);
|
2021-02-01 18:12:37 +00:00
|
|
|
|
|
|
|
if (cakeWalletNode == null) {
|
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
|
|
|
cakeWalletNode =
|
|
|
|
Node(uri: cakeWalletBitcoinElectrumUri, type: WalletType.bitcoin, useSSL: false);
|
|
|
|
// final cakeWalletElectrumTestnet =
|
|
|
|
// Node(uri: publicBitcoinTestnetElectrumUri, type: WalletType.bitcoin, useSSL: false);
|
|
|
|
// await nodeSource.add(cakeWalletElectrumTestnet);
|
2021-02-01 18:12:37 +00:00
|
|
|
await nodeSource.add(cakeWalletNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (currentElectrumSeverId == oldElectrumServer?.key) {
|
2021-05-07 07:36:38 +00:00
|
|
|
await sharedPreferences.setInt(
|
2023-10-05 01:09:07 +00:00
|
|
|
PreferencesKey.currentBitcoinElectrumSererIdKey, cakeWalletNode.key as int);
|
2021-02-01 18:12:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
await oldElectrumServer?.delete();
|
|
|
|
}
|
2022-05-18 16:13:58 +00:00
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
Future<void> changeDefaultHavenNode(Box<Node> nodeSource) async {
|
2022-05-18 16:13:58 +00:00
|
|
|
const previousHavenDefaultNodeUri = 'vault.havenprotocol.org:443';
|
2023-10-05 01:09:07 +00:00
|
|
|
final havenNodes = nodeSource.values.where((node) => node.uriRaw == previousHavenDefaultNodeUri);
|
2022-05-18 16:13:58 +00:00
|
|
|
havenNodes.forEach((node) async {
|
|
|
|
node.uriRaw = havenDefaultNodeUri;
|
|
|
|
await node.save();
|
|
|
|
});
|
|
|
|
}
|
2023-03-01 21:44:15 +00:00
|
|
|
|
|
|
|
Future<void> migrateExchangeStatus(SharedPreferences sharedPreferences) async {
|
|
|
|
final isExchangeDisabled = sharedPreferences.getBool(PreferencesKey.disableExchangeKey);
|
|
|
|
if (isExchangeDisabled == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-05 01:09:07 +00:00
|
|
|
await sharedPreferences.setInt(PreferencesKey.exchangeStatusKey,
|
|
|
|
isExchangeDisabled ? ExchangeApiMode.disabled.raw : ExchangeApiMode.enabled.raw);
|
2023-08-04 17:01:49 +00:00
|
|
|
|
2023-03-01 21:46:05 +00:00
|
|
|
await sharedPreferences.remove(PreferencesKey.disableExchangeKey);
|
2023-03-01 21:44:15 +00:00
|
|
|
}
|
2023-08-04 17:01:49 +00:00
|
|
|
|
|
|
|
Future<void> addEthereumNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultEthereumNodes();
|
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changeEthereumCurrentNodeToDefault(
|
2023-10-05 01:09:07 +00:00
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
2023-08-04 17:01:49 +00:00
|
|
|
final node = getEthereumDefaultNode(nodes: nodes);
|
|
|
|
final nodeId = node?.key as int? ?? 0;
|
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentEthereumNodeIdKey, nodeId);
|
|
|
|
}
|
2023-10-05 01:09:07 +00:00
|
|
|
|
|
|
|
Future<void> addNanoNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultNanoNodes();
|
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> addNanoPowNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultNanoPowNodes();
|
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changeNanoCurrentNodeToDefault(
|
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
|
|
|
final node = getNanoDefaultNode(nodes: nodes);
|
|
|
|
final nodeId = node?.key as int? ?? 0;
|
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNanoNodeIdKey, nodeId);
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changeNanoCurrentPowNodeToDefault(
|
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
|
|
|
final node = getNanoDefaultPowNode(nodes: nodes);
|
|
|
|
final nodeId = node?.key as int? ?? 0;
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentNanoPowNodeIdKey, nodeId);
|
|
|
|
}
|
2023-12-02 02:26:43 +00:00
|
|
|
|
|
|
|
Future<void> addPolygonNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultPolygonNodes();
|
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changePolygonCurrentNodeToDefault(
|
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
|
|
|
final node = getPolygonDefaultNode(nodes: nodes);
|
|
|
|
final nodeId = node?.key as int? ?? 0;
|
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentPolygonNodeIdKey, nodeId);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
Future<void> addSolanaNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultSolanaNodes();
|
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changeSolanaCurrentNodeToDefault(
|
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
|
|
|
final node = getSolanaDefaultNode(nodes: nodes);
|
|
|
|
final nodeId = node?.key as int? ?? 0;
|
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentSolanaNodeIdKey, nodeId);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
Future<void> addTronNodeList({required Box<Node> nodes}) async {
|
|
|
|
final nodeList = await loadDefaultTronNodes();
|
|
|
|
for (var node in nodeList) {
|
|
|
|
if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) {
|
|
|
|
await nodes.add(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> changeTronCurrentNodeToDefault(
|
|
|
|
{required SharedPreferences sharedPreferences, required Box<Node> nodes}) async {
|
|
|
|
final node = getTronDefaultNode(nodes: nodes);
|
|
|
|
final nodeId = node?.key as int? ?? 0;
|
|
|
|
|
|
|
|
await sharedPreferences.setInt(PreferencesKey.currentTronNodeIdKey, nodeId);
|
|
|
|
}
|