mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-11 01:53:07 +00:00
cancel transaction after estimateGas failure
This commit is contained in:
parent
7eac8410af
commit
9ffc1763e4
@ -123,7 +123,7 @@ proc send(contract: Contract,
|
||||
Future[?TransactionResponse] {.async.} =
|
||||
if signer =? contract.signer:
|
||||
let transaction = createTransaction(contract, function, parameters, overrides)
|
||||
let populated = await signer.populateTransaction(transaction)
|
||||
let populated = await signer.populateTransaction(transaction, cancelOnEstimateGasError = true)
|
||||
let txResp = await signer.sendTransaction(populated)
|
||||
return txResp.some
|
||||
else:
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
import ./basics
|
||||
import ./provider
|
||||
import pkg/chronicles
|
||||
|
||||
export basics
|
||||
export chronicles
|
||||
|
||||
logScope:
|
||||
topics = "ethers signer"
|
||||
|
||||
type
|
||||
Signer* = ref object of RootObj
|
||||
@ -87,7 +92,8 @@ method decreaseNonce*(signer: Signer) {.base, gcsafe.} =
|
||||
signer.lastSeenNonce = some lastSeen - 1
|
||||
|
||||
method populateTransaction*(signer: Signer,
|
||||
transaction: Transaction):
|
||||
transaction: Transaction,
|
||||
cancelOnEstimateGasError = false):
|
||||
Future[Transaction] {.base, async.} =
|
||||
|
||||
if sender =? transaction.sender and sender != await signer.getAddress():
|
||||
|
||||
@ -9,6 +9,7 @@ import ./hardhat
|
||||
import ./helpers
|
||||
import ./miner
|
||||
import ./mocks
|
||||
import ./examples
|
||||
|
||||
type
|
||||
TestToken = ref object of Erc20Token
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user