Change Transaction type to support EIP1559

This commit is contained in:
Jackie 2022-07-12 20:22:31 +02:00 committed by markspanbroek
parent e01ef1daf8
commit abda8493b0
2 changed files with 3 additions and 1 deletions

View File

@ -58,7 +58,7 @@ method populateTransaction*(signer: Signer,
populated.nonce = some(await signer.getTransactionCount(BlockTag.pending))
if transaction.chainId.isNone:
populated.chainId = some(await signer.getChainId())
if transaction.gasPrice.isNone:
if transaction.gasPrice.isNone and (transaction.maxFee.isNone or transaction.maxPriorityFee.isNone):
populated.gasPrice = some(await signer.getGasPrice())
if transaction.gasLimit.isNone:
populated.gasLimit = some(await signer.estimateGas(populated))

View File

@ -8,6 +8,8 @@ type Transaction* = object
nonce*: ?UInt256
chainId*: ?UInt256
gasPrice*: ?UInt256
maxFee*: ?UInt256
maxPriorityFee*: ?UInt256
gasLimit*: ?UInt256
func `$`*(transaction: Transaction): string =