mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-05-23 10:29:27 +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.} =
|
Future[?TransactionResponse] {.async.} =
|
||||||
if signer =? contract.signer:
|
if signer =? contract.signer:
|
||||||
let transaction = createTransaction(contract, function, parameters, overrides)
|
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)
|
let txResp = await signer.sendTransaction(populated)
|
||||||
return txResp.some
|
return txResp.some
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
import ./basics
|
import ./basics
|
||||||
import ./provider
|
import ./provider
|
||||||
|
import pkg/chronicles
|
||||||
|
|
||||||
export basics
|
export basics
|
||||||
|
export chronicles
|
||||||
|
|
||||||
|
logScope:
|
||||||
|
topics = "ethers signer"
|
||||||
|
|
||||||
type
|
type
|
||||||
Signer* = ref object of RootObj
|
Signer* = ref object of RootObj
|
||||||
@ -87,7 +92,8 @@ method decreaseNonce*(signer: Signer) {.base, gcsafe.} =
|
|||||||
signer.lastSeenNonce = some lastSeen - 1
|
signer.lastSeenNonce = some lastSeen - 1
|
||||||
|
|
||||||
method populateTransaction*(signer: Signer,
|
method populateTransaction*(signer: Signer,
|
||||||
transaction: Transaction):
|
transaction: Transaction,
|
||||||
|
cancelOnEstimateGasError = false):
|
||||||
Future[Transaction] {.base, async.} =
|
Future[Transaction] {.base, async.} =
|
||||||
|
|
||||||
if sender =? transaction.sender and sender != await signer.getAddress():
|
if sender =? transaction.sender and sender != await signer.getAddress():
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import ./hardhat
|
|||||||
import ./helpers
|
import ./helpers
|
||||||
import ./miner
|
import ./miner
|
||||||
import ./mocks
|
import ./mocks
|
||||||
|
import ./examples
|
||||||
|
|
||||||
type
|
type
|
||||||
TestToken = ref object of Erc20Token
|
TestToken = ref object of Erc20Token
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user