umbracle / ethgo

Ethereum Golang API
https://www.ethgoproject.io
Mozilla Public License 2.0
484 stars 135 forks source link

The result of GetTransactionByHash can not get correct gas ? transanction type 2 #175

Closed dingding001 closed 2 years ago

dingding001 commented 2 years ago

gg

curl -H "Content-Type: application/json" -d '{"id": 1, "method": "eth_getTransactionByHash", "params": ["0xd94650def68f99443c3557cb0c9e602de8dd54b8c3b1df6a115c2e4c75b78e03"]}' localhost:58545

{"jsonrpc":"2.0","id":1,"result":{"blockHash":"0xd5b8cb3d127f2c4657bb258deeb7bfe941f139ab0444ab151eea5f166e920734","blockNumber":"0xd380ac","from":"0xd33937c55fe4d030b4e2c55d2c0be0c6072285ca","gas":"0x493e0","gasPrice":"0x2540be400","maxFeePerGas":"0x2540be400","maxPriorityFeePerGas":"0x2540be400","hash":"0xd94650def68f99443c3557cb0c9e602de8dd54b8c3b1df6a115c2e4c75b78e03","input":"0x38ed17390000000000000000000000000000000000000000000000008256c4aa3376c0480000000000000000000000000000000000000000000000000017b235177be89c00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000d33937c55fe4d030b4e2c55d2c0be0c6072285ca000000000000000000000000000000000000000000000000000000006241c8820000000000000000000000000000000000000000000000000000000000000002000000000000000000000000a71edc38d189767582c38a3145b5873052c3e47a00000000000000000000000003dfd917677de9321249da24d47950964fd3034c","nonce":"0x145","to":"0xed7d5f38c79115ca12fe6c0041abb22f0a06c300","transactionIndex":"0x1d","value":"0x0","type":"0x2","accessList":[],"chainId":"0x80","v":"0x0","r":"0xbf77da9ad8bd08a9cd696189cb4d17ccc632529d0d4967eaa90f6c76c1884199","s":"0x2d6bac30aff7842d324b965d6ae7c6a62142c433acdfa64ef574bc2b168fa688"}}

strHash := "0xd94650def68f99443c3557cb0c9e602de8dd54b8c3b1df6a115c2e4c75b78e03" txHash := ethgo.HexToHash(strHash) tx,err1 := Client.Eth().GetTransactionByHash(txHash) Logging.Infof("hash:%s %+v",strHash, tx)

hash:0xd94650def68f99443c3557cb0c9e602de8dd54b8c3b1df6a115c2e4c75b78e03 &{Type:2 Hash:0xd94650def68f99443c3557cb0c9e602de8dd54b8c3b1df6a115c2e4c75b78e03 From:0xd33937c55fe4d030B4E2c55D2c0be0C6072285CA To:0xED7d5F38C79115ca12fe6C0041abb22F0A06C300 Input:[56 237 23 57 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 130 86 196 170 51 118 192 72 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23 178 53 23 123 232 156 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 160 0 0 0 0 0 0 0 0 0 0 0 0 211 57 55 197 95 228 208 48 180 226 197 93 44 11 224 198 7 34 133 202 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 98 65 200 130 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 167 30 220 56 209 137 118 117 130 195 138 49 69 181 135 48 82 195 228 122 0 0 0 0 0 0 0 0 0 0 0 0 3 223 217 23 103 125 233 50 18 73 218 36 212 121 80 150 79 211 3 76] GasPrice:10000000000 Gas:0 Value:+0 Nonce:325 V:[0] R:[191 119 218 154 216 189 8 169 205 105 97 137 203 77 23 204 198 50 82 157 13 73 103 234 169 15 108 118 193 136 65 153] S:[45 107 172 48 175 247 132 45 50 75 150 93 106 231 198 166 33 66 196 51 172 223 166 78 245 116 188 43 22 143 166 136] BlockHash:0x0000000000000000000000000000000000000000000000000000000000000000 BlockNumber:0 TxnIndex:0 ChainID:+128 AccessList:[] MaxPriorityFeePerGas:+10000000000 MaxFeePerGas:+10000000000}

ferranbt commented 2 years ago

Hi, I am not sure what is missing? EIP-1559 transaction types were implemented recently and there are not many tests on that. Is there a new field on the transaction receipt?

ferranbt commented 2 years ago

Solved in #198