mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-25 13:09:32 +00:00
Refactor signing/sending transactions
This commit is contained in:
parent
73743932ae
commit
4705394fce
1 changed files with 4 additions and 1 deletions
|
@ -104,7 +104,6 @@ class EthereumClient {
|
||||||
required CryptoCurrency currency,
|
required CryptoCurrency currency,
|
||||||
}) async {
|
}) async {
|
||||||
bool _isEthereum = currency == CryptoCurrency.eth;
|
bool _isEthereum = currency == CryptoCurrency.eth;
|
||||||
final estimatedGas = BigInt.from(_isEthereum ? 21000 : 50000);
|
|
||||||
|
|
||||||
final price = await _client!.getGasPrice();
|
final price = await _client!.getGasPrice();
|
||||||
|
|
||||||
|
@ -118,11 +117,15 @@ class EthereumClient {
|
||||||
|
|
||||||
final signedTransaction = await _client!.signTransaction(privateKey, transaction);
|
final signedTransaction = await _client!.signTransaction(privateKey, transaction);
|
||||||
|
|
||||||
|
final estimatedGas;
|
||||||
final Function _sendTransaction;
|
final Function _sendTransaction;
|
||||||
|
|
||||||
if (_isEthereum) {
|
if (_isEthereum) {
|
||||||
|
estimatedGas = BigInt.from(21000);
|
||||||
_sendTransaction = () async => await sendTransaction(signedTransaction);
|
_sendTransaction = () async => await sendTransaction(signedTransaction);
|
||||||
} else {
|
} else {
|
||||||
|
estimatedGas = BigInt.from(50000);
|
||||||
|
|
||||||
final erc20 = Erc20(
|
final erc20 = Erc20(
|
||||||
client: _client!,
|
client: _client!,
|
||||||
address: EthereumAddress.fromHex(_erc20Currencies[currency]!),
|
address: EthereumAddress.fromHex(_erc20Currencies[currency]!),
|
||||||
|
|
Loading…
Reference in a new issue