From 4bba9f6ddb4a1c76f74b9bc5f5855e1469795c3a Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Sat, 28 Dec 2024 00:18:46 +0200 Subject: [PATCH] Solana enhancements (#1907) * fix: Confirm widget is still mounted * feat: Modify balance display to include full balance * fix: Modifying balance * chore: Feature cleanup * fix: Add frozen balance into consideration when taking available balance and add field to make full balance display only on bitcoin and litecoin wallets * fix: Adjust balance card to display correct available and unavailable balance, unavailable balance should only be displayed when there is one WIP * fix: Cleanup balance page and balance page view_model * chore: Revert formatting * fix: Remove full balance * fix: Remove full balance * fix: Remove full balance * chore: Rever formating [skip ci] * feat: Finalize display only available and unavailable balance * fix: Modify the way balance is displayed, activate frozen balance with label, remove unavailable/additional balance for bitcoin wallet type * fix: Issues coming from syncing with main * fix: Modify additional balance label * fix: Monero and Wownero balances display bug * fix: Resolve merge conflicts * feat: Activate CPFP for BTC, LTC and BCH, also fix issues with frozen balance display * - minor fix - remove unused functions * Fix conflicts * Temporarily remove misused function Ignore creating associated account for receiver (testing) * revert associated recipient account removal * Migrate eth and polygon nodes to new urls and https --------- Co-authored-by: Blazebrain Co-authored-by: tuxsudo --- assets/ethereum_server_list.yml | 4 ++- assets/polygon_node_list.yml | 4 ++- cw_solana/lib/solana_client.dart | 22 +++++++------ lib/entities/default_settings_migration.dart | 34 ++++++++++++++++++-- 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/assets/ethereum_server_list.yml b/assets/ethereum_server_list.yml index 965638471..ed425c3c7 100644 --- a/assets/ethereum_server_list.yml +++ b/assets/ethereum_server_list.yml @@ -1,5 +1,7 @@ - - uri: ethereum.publicnode.com + uri: ethereum-rpc.publicnode.com + useSSL: true + isDefault: true - uri: eth.llamarpc.com - diff --git a/assets/polygon_node_list.yml b/assets/polygon_node_list.yml index 63878bc0c..3b2cdcdc3 100644 --- a/assets/polygon_node_list.yml +++ b/assets/polygon_node_list.yml @@ -1,7 +1,9 @@ - uri: polygon-rpc.com - - uri: polygon-bor.publicnode.com + uri: polygon-bor-rpc.publicnode.com + useSSL: true + isDefault: true - uri: polygon.llamarpc.com - diff --git a/cw_solana/lib/solana_client.dart b/cw_solana/lib/solana_client.dart index 9447aad38..2207822bb 100644 --- a/cw_solana/lib/solana_client.dart +++ b/cw_solana/lib/solana_client.dart @@ -379,16 +379,18 @@ class SolanaWalletClient { required double solBalance, required double fee, }) async { - final rent = - await _client!.getMinimumBalanceForMintRentExemption(commitment: Commitment.confirmed); - - final rentInSol = (rent / lamportsPerSol).toDouble(); - - final remnant = solBalance - (inputAmount + fee); - - if (remnant > rentInSol) return true; - - return false; + return true; + // TODO: this is not doing what the name inclines + // final rent = + // await _client!.getMinimumBalanceForMintRentExemption(commitment: Commitment.confirmed); + // + // final rentInSol = (rent / lamportsPerSol).toDouble(); + // + // final remnant = solBalance - (inputAmount + fee); + // + // if (remnant > rentInSol) return true; + // + // return false; } Future _signNativeTokenTransaction({ diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 96638621a..63e70ce4d 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -35,8 +35,8 @@ const publicBitcoinTestnetElectrumUri = '$publicBitcoinTestnetElectrumAddress:$publicBitcoinTestnetElectrumPort'; const cakeWalletLitecoinElectrumUri = 'ltc-electrum.cakewallet.com:50002'; const havenDefaultNodeUri = 'nodes.havenprotocol.org:443'; -const ethereumDefaultNodeUri = 'ethereum.publicnode.com'; -const polygonDefaultNodeUri = 'polygon-bor.publicnode.com'; +const ethereumDefaultNodeUri = 'ethereum-rpc.publicnode.com'; +const polygonDefaultNodeUri = 'polygon-bor-rpc.publicnode.com'; const cakeWalletBitcoinCashDefaultNodeUri = 'bitcoincash.stackwallet.com:50002'; const nanoDefaultNodeUri = 'nano.nownodes.io'; const nanoDefaultPowNodeUri = 'rpc.nano.to'; @@ -360,6 +360,18 @@ Future defaultSettingsMigration( 'solana-rpc.publicnode.com:443', ], ); + _updateNode( + nodes: nodes, + currentUri: "ethereum.publicnode.com", + newUri: "ethereum-rpc.publicnode.com", + useSSL: true, + ); + _updateNode( + nodes: nodes, + currentUri: "polygon-bor.publicnode.com", + newUri: "polygon-bor-rpc.publicnode.com", + useSSL: true, + ); break; default: break; @@ -375,6 +387,24 @@ Future defaultSettingsMigration( await sharedPreferences.setInt(PreferencesKey.currentDefaultSettingsMigrationVersion, version); } +void _updateNode({ + required Box nodes, + required String currentUri, + String? newUri, + bool? useSSL, +}) { + for (Node node in nodes.values) { + if (node.uriRaw == currentUri) { + if (newUri != null) { + node.uriRaw = newUri; + } + if (useSSL != null) { + node.useSSL = useSSL; + } + } + } +} + Future _backupHavenSeeds(Box havenSeedStore) async { final future = haven?.backupHavenSeeds(havenSeedStore); if (future != null) {