Add "value" to Transaction object
This commit is contained in:
parent
e086b71b42
commit
5127991117
|
@ -5,6 +5,7 @@ type Transaction* = object
|
||||||
sender*: ?Address
|
sender*: ?Address
|
||||||
to*: Address
|
to*: Address
|
||||||
data*: seq[byte]
|
data*: seq[byte]
|
||||||
|
value*: UInt256
|
||||||
nonce*: ?UInt256
|
nonce*: ?UInt256
|
||||||
chainId*: ?UInt256
|
chainId*: ?UInt256
|
||||||
gasPrice*: ?UInt256
|
gasPrice*: ?UInt256
|
||||||
|
@ -17,6 +18,7 @@ func `$`*(transaction: Transaction): string =
|
||||||
if sender =? transaction.sender:
|
if sender =? transaction.sender:
|
||||||
result &= "from: " & $sender & ", "
|
result &= "from: " & $sender & ", "
|
||||||
result &= "to: " & $transaction.to & ", "
|
result &= "to: " & $transaction.to & ", "
|
||||||
|
result &= "value: " & $transaction.value & ", "
|
||||||
result &= "data: 0x" & $transaction.data.toHex
|
result &= "data: 0x" & $transaction.data.toHex
|
||||||
if nonce =? transaction.nonce:
|
if nonce =? transaction.nonce:
|
||||||
result &= ", nonce: 0x" & $nonce.toHex
|
result &= ", nonce: 0x" & $nonce.toHex
|
||||||
|
|
|
@ -97,6 +97,7 @@ proc signTransaction*(wallet: Wallet, tx: tx.Transaction): Future[seq[byte]] {.a
|
||||||
|
|
||||||
s.chainId = ChainId(chainId.truncate(uint64))
|
s.chainId = ChainId(chainId.truncate(uint64))
|
||||||
s.gasLimit = GasInt(gasLimit.truncate(uint64))
|
s.gasLimit = GasInt(gasLimit.truncate(uint64))
|
||||||
|
s.value = tx.value
|
||||||
s.nonce = nonce.truncate(uint64)
|
s.nonce = nonce.truncate(uint64)
|
||||||
s.to = some EthAddress(tx.to)
|
s.to = some EthAddress(tx.to)
|
||||||
s.payload = tx.data
|
s.payload = tx.data
|
||||||
|
|
Loading…
Reference in New Issue