mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-05 23:23:08 +00:00
fix(nonce): indentation mistake after last merge (#92)
* fix an indentation mistake after last merge * add assertion to ensure nonce is not populated * assert populated nonce is populated, not transaction
This commit is contained in:
parent
80b2ead97c
commit
0ce6abf0fe
@ -119,18 +119,18 @@ method populateTransaction*(
|
|||||||
if transaction.gasPrice.isNone and (transaction.maxFee.isNone or transaction.maxPriorityFee.isNone):
|
if transaction.gasPrice.isNone and (transaction.maxFee.isNone or transaction.maxPriorityFee.isNone):
|
||||||
populated.gasPrice = some(await signer.getGasPrice())
|
populated.gasPrice = some(await signer.getGasPrice())
|
||||||
|
|
||||||
if transaction.nonce.isNone and transaction.gasLimit.isNone:
|
if transaction.nonce.isNone and transaction.gasLimit.isNone:
|
||||||
# when both nonce and gasLimit are not populated, we must ensure getNonce is
|
# when both nonce and gasLimit are not populated, we must ensure getNonce is
|
||||||
# followed by an estimateGas so we can determine if there was an error. If
|
# followed by an estimateGas so we can determine if there was an error. If
|
||||||
# there is an error, the nonce must be decreased to prevent nonce gaps and
|
# there is an error, the nonce must be decreased to prevent nonce gaps and
|
||||||
# stuck transactions
|
# stuck transactions
|
||||||
populated.nonce = some(await signer.getNonce())
|
populated.nonce = some(await signer.getNonce())
|
||||||
try:
|
try:
|
||||||
populated.gasLimit = some(await signer.estimateGas(populated, BlockTag.pending))
|
populated.gasLimit = some(await signer.estimateGas(populated, BlockTag.pending))
|
||||||
except EstimateGasError as e:
|
except EstimateGasError as e:
|
||||||
raise e
|
raise e
|
||||||
except ProviderError as e:
|
except ProviderError as e:
|
||||||
raiseSignerError(e.msg)
|
raiseSignerError(e.msg)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if transaction.nonce.isNone:
|
if transaction.nonce.isNone:
|
||||||
@ -139,6 +139,8 @@ method populateTransaction*(
|
|||||||
if transaction.gasLimit.isNone:
|
if transaction.gasLimit.isNone:
|
||||||
populated.gasLimit = some(await signer.estimateGas(populated, BlockTag.pending))
|
populated.gasLimit = some(await signer.estimateGas(populated, BlockTag.pending))
|
||||||
|
|
||||||
|
doAssert populated.nonce.isSome, "nonce not populated!"
|
||||||
|
|
||||||
return populated
|
return populated
|
||||||
|
|
||||||
method cancelTransaction*(
|
method cancelTransaction*(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user