replace 'net_*' calls with 'eth_*' alternatives

This commit is contained in:
julian 2023-02-27 16:49:20 -06:00
parent 24e66f3d5f
commit 305b252573

View file

@ -173,9 +173,9 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override @override
Future<String> confirmSend({required Map<String, dynamic> txData}) async { Future<String> confirmSend({required Map<String, dynamic> txData}) async {
web3.Web3Client client = getEthClient(); web3.Web3Client client = getEthClient();
final int chainId = await client.getNetworkId(); final chainId = await client.getChainId();
final amount = txData['recipientAmt']; final amount = txData['recipientAmt'] as int;
final decimalAmount = Format.satoshisToAmount(amount as int, coin: coin); final decimalAmount = Format.satoshisToAmount(amount, coin: coin);
final bigIntAmount = amountToBigInt( final bigIntAmount = amountToBigInt(
decimalAmount.toDouble(), decimalAmount.toDouble(),
Constants.decimalPlacesForCoin(coin), Constants.decimalPlacesForCoin(coin),
@ -187,8 +187,8 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
web3.EtherUnit.wei, txData['feeInWei']), web3.EtherUnit.wei, txData['feeInWei']),
maxGas: _gasLimit, maxGas: _gasLimit,
value: web3.EtherAmount.inWei(bigIntAmount)); value: web3.EtherAmount.inWei(bigIntAmount));
final transaction = final transaction = await client.sendTransaction(_credentials, tx,
await client.sendTransaction(_credentials, tx, chainId: chainId); chainId: chainId.toInt());
return transaction; return transaction;
} }
@ -773,8 +773,8 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
Future<bool> testNetworkConnection() async { Future<bool> testNetworkConnection() async {
web3.Web3Client client = getEthClient(); web3.Web3Client client = getEthClient();
try { try {
final result = await client.isListeningForNetwork(); await client.getBlockNumber();
return result; return true;
} catch (_) { } catch (_) {
return false; return false;
} }