CW-802: Ethereum enhancements (#1826)

* fix: Ethereum enhancements around fees and computations relating to signing and sending transactions

* feat: Add nownodes key for evm to workflow

* feat: Reactivate send all on both eth and polygon wallet types

* fix: Add generic function for updating the node for a wallet type, move ethereum transaction error fees handler to a new file

* fix: Revert podfile.lock

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
David Adegoke 2024-12-11 15:45:15 +01:00 committed by GitHub
parent ed600f9b8b
commit 9590aa25b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 346 additions and 35 deletions

View file

@ -289,7 +289,21 @@ Future<void> defaultSettingsMigration(
],
);
break;
case 45:
await updateWalletTypeNodesWithNewNode(
newNodeUri: 'matic.nownodes.io',
sharedPreferences: sharedPreferences,
nodes: nodes,
type: WalletType.polygon,
useSSL: true,
);
await updateWalletTypeNodesWithNewNode(
newNodeUri: 'eth.nownodes.io',
sharedPreferences: sharedPreferences,
nodes: nodes,
type: WalletType.ethereum,
useSSL: true,
);
default:
break;
}
@ -339,6 +353,26 @@ Future<void> _changeDefaultNode({
}
}
/// Generic function for adding a new Node for a Wallet Type.
Future<void> updateWalletTypeNodesWithNewNode({
required SharedPreferences sharedPreferences,
required Box<Node> nodes,
required WalletType type,
required String newNodeUri,
required bool useSSL,
}) async {
// If it already exists in the box of nodes, no need to add it annymore.
if (nodes.values.any((node) => node.uriRaw == newNodeUri)) return;
await nodes.add(
Node(
uri: newNodeUri,
type: type,
useSSL: useSSL,
),
);
}
Future<void> _updateCakeXmrNode(Box<Node> nodes) async {
final node = nodes.values.firstWhereOrNull((element) => element.uriRaw == newCakeWalletMoneroUri);