mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
move confirmSend to a nicer place
This commit is contained in:
parent
20c3da72a3
commit
b3c4e690c7
1 changed files with 23 additions and 23 deletions
|
@ -220,29 +220,6 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
await updateCachedBalance(_balance!);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> confirmSend({required Map<String, dynamic> txData}) async {
|
||||
web3.Web3Client client = getEthClient();
|
||||
final chainId = await client.getChainId();
|
||||
final amount = txData['recipientAmt'] as int;
|
||||
final decimalAmount = Format.satoshisToAmount(amount, coin: coin);
|
||||
final bigIntAmount = amountToBigInt(
|
||||
decimalAmount.toDouble(),
|
||||
Constants.decimalPlacesForCoin(coin),
|
||||
);
|
||||
|
||||
final tx = web3.Transaction(
|
||||
to: web3.EthereumAddress.fromHex(txData['address'] as String),
|
||||
gasPrice: web3.EtherAmount.fromUnitAndValue(
|
||||
web3.EtherUnit.wei, txData['feeInWei']),
|
||||
maxGas: _gasLimit,
|
||||
value: web3.EtherAmount.inWei(bigIntAmount));
|
||||
final transaction = await client.sendTransaction(_credentials, tx,
|
||||
chainId: chainId.toInt());
|
||||
|
||||
return transaction;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<int> estimateFeeFor(int satoshiAmount, int feeRate) async {
|
||||
final fee = estimateFee(feeRate, _gasLimit, coin.decimals);
|
||||
|
@ -484,6 +461,29 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
return txData;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> confirmSend({required Map<String, dynamic> txData}) async {
|
||||
web3.Web3Client client = getEthClient();
|
||||
final chainId = await client.getChainId();
|
||||
final amount = txData['recipientAmt'] as int;
|
||||
final decimalAmount = Format.satoshisToAmount(amount, coin: coin);
|
||||
final bigIntAmount = amountToBigInt(
|
||||
decimalAmount.toDouble(),
|
||||
Constants.decimalPlacesForCoin(coin),
|
||||
);
|
||||
|
||||
final tx = web3.Transaction(
|
||||
to: web3.EthereumAddress.fromHex(txData['address'] as String),
|
||||
gasPrice: web3.EtherAmount.fromUnitAndValue(
|
||||
web3.EtherUnit.wei, txData['feeInWei']),
|
||||
maxGas: _gasLimit,
|
||||
value: web3.EtherAmount.inWei(bigIntAmount));
|
||||
final txid = await client.sendTransaction(_credentials, tx,
|
||||
chainId: chainId.toInt());
|
||||
|
||||
return txid;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> recoverFromMnemonic({
|
||||
required String mnemonic,
|
||||
|
|
Loading…
Reference in a new issue