Add "value" to Transaction object

This commit is contained in:
Mark Spanbroek 2023-07-03 15:50:24 +02:00 committed by markspanbroek
parent e086b71b42
commit 5127991117
2 changed files with 3 additions and 0 deletions

View File

@ -5,6 +5,7 @@ type Transaction* = object
sender*: ?Address
to*: Address
data*: seq[byte]
value*: UInt256
nonce*: ?UInt256
chainId*: ?UInt256
gasPrice*: ?UInt256
@ -17,6 +18,7 @@ func `$`*(transaction: Transaction): string =
if sender =? transaction.sender:
result &= "from: " & $sender & ", "
result &= "to: " & $transaction.to & ", "
result &= "value: " & $transaction.value & ", "
result &= "data: 0x" & $transaction.data.toHex
if nonce =? transaction.nonce:
result &= ", nonce: 0x" & $nonce.toHex

View File

@ -97,6 +97,7 @@ proc signTransaction*(wallet: Wallet, tx: tx.Transaction): Future[seq[byte]] {.a
s.chainId = ChainId(chainId.truncate(uint64))
s.gasLimit = GasInt(gasLimit.truncate(uint64))
s.value = tx.value
s.nonce = nonce.truncate(uint64)
s.to = some EthAddress(tx.to)
s.payload = tx.data