diff --git a/ethers/provider.nim b/ethers/provider.nim index 3b49fb9..f365bb7 100644 --- a/ethers/provider.nim +++ b/ethers/provider.nim @@ -170,6 +170,7 @@ proc replay*(provider: Provider, tx: Transaction, blockNumber: UInt256) {.async. # the same block BEFORE this transaction will not have their state transitions # included in the replay. # More information: https://snakecharmers.ethereum.org/web3py-revert-reason-parsing/ + trace "replaying transaction", hasGas = (%tx).hasKey("gas"), tx = %tx discard await provider.call(tx, BlockTag.init(blockNumber)) method getRevertReason*( diff --git a/testmodule/providers/jsonrpc/testConversions.nim b/testmodule/providers/jsonrpc/testConversions.nim index 489c8aa..37ffb2b 100644 --- a/testmodule/providers/jsonrpc/testConversions.nim +++ b/testmodule/providers/jsonrpc/testConversions.nim @@ -206,3 +206,34 @@ suite "JSON Conversions": "chainId":"0xc0de4" }""".flatten check $(%tx) == expected + + test "correctly converts PastTransaction to Transaction": + let json = %*{ + "blockHash":"0x595bffbe897e025ea2df3213c4cc52c3f3d69bc04b49011d558f1b0e70038922", + "blockNumber":"0x22e", + "from":"0xe00b677c29ff8d8fe6068530e2bc36158c54dd34", + "gas":"0x52277", + "gasPrice":"0x3b9aca07", + "hash":"0xa31608907c338d6497b0c6ec81049d845c7d409490ebf78171f35143897ca790", + "input":"0x6368a471d26ff5c7f835c1a8203235e88846ce1a196d6e79df0eaedd1b8ed3deec2ae5c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000012a00000000000000000000000000000000000000000000000000000000000000", + "nonce":"0x3", + "to":"0x92f09aa59dccb892a9f5406ddd9c0b98f02ea57e", + "transactionIndex":"0x3", + "value":"0x0", + "type":"0x0", + "chainId":"0xc0de4", + "v":"0x181bec", + "r":"0x57ba18460934526333b80b0fea08737c363f3cd5fbec4a25a8a25e3e8acb362a", + "s":"0x33aa50bc8bd719b6b17ad0bf52006bf8943999198f2bf731eb33c118091000f2" + } + + let past = PastTransaction.fromJson(json) + check %past.toTransaction == %*{ + "to": !Address.init("0x92f09aa59dccb892a9f5406ddd9c0b98f02ea57e"), + "data": hexToSeqByte("0x6368a471d26ff5c7f835c1a8203235e88846ce1a196d6e79df0eaedd1b8ed3deec2ae5c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000012a00000000000000000000000000000000000000000000000000000000000000"), + "from": !Address.init("0xe00b677c29ff8d8fe6068530e2bc36158c54dd34"), + "nonce": 0x3.u256, + "chainId": 0xc0de4.u256, + "gasPrice": 0x3b9aca07.u256, + "gas": 0x52277.u256 + }