Last active
January 14, 2021 17:40
-
-
Save critesjosh/f1a7f2d39e180f9e1d3669ed9c624b8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// API call: | |
// https://explorer.celo.org/api?module=transaction&action=gettxinfo&txhash=0xc495463ca93ec63fa654cc12690db488a9b127221a21af4c6359ceb357f3d757 | |
{ | |
"status": "1", | |
"result": { | |
"value": "0", | |
"to": "0x6d67b41236129cb4f6ffaf6e37223485b20d1d06", | |
"timeStamp": "1610353070", | |
"success": true, | |
"next_page_params": null, | |
"logs": [ | |
{ | |
"topics": [ | |
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", | |
"0x0000000000000000000000006d67b41236129cb4f6ffaf6e37223485b20d1d06", | |
"0x000000000000000000000000c31965ffe24866d122b5469c08f3c69e0dcc578c", | |
null | |
], | |
"index": "0", | |
"data": "0x000000000000000000000000000000000000000000000000c2b818f06ea05800", | |
"address": "0x471ece3750da237f93b8e339c536989b8978a438" | |
} | |
], | |
"input": "0x0dcd7a6c000000000000000000000000c31965ffe24866d122b5469c08f3c69e0dcc578c000000000000000000000000000000000000000000000000c2b818f06ea05800000000000000000000000000471ece3750da237f93b8e339c536989b8978a4380000000000000000000000000000000000000000000000000000000060054421000000000000000000000000000000000000000000000000000000000000017400000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041fcc2af54088c59d8d606a9fd0f6f4bbcc598f5369020001a2a11f6005fe1d0a27739d56777f505292131294e2b7da09b5aa036935b0c91afcf59ec3726fd73cc1c00000000000000000000000000000000000000000000000000000000000000", | |
"hash": "0xc495463ca93ec63fa654cc12690db488a9b127221a21af4c6359ceb357f3d757", | |
"gatewayFeeRecipient": "", | |
"gatewayFee": "0", | |
"gasUsed": "75044", | |
"gasPrice": "650000000", | |
"gasLimit": "500000", | |
"from": "0xbc373d55874e3d8a3d0f949a8f69da44de90ede3", | |
"feeCurrency": "", | |
"confirmations": "5186", | |
"blockNumber": "4555500" | |
}, | |
"message": "OK" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require("web3"); | |
const web3 = new Web3("https://forno.celo.org") | |
// relevant web3.js docs: https://web3js.readthedocs.io/en/v1.3.1/web3-eth-abi.html?#decodelog | |
console.log(web3.eth.abi.decodeLog( | |
// view the types & names of logs for this type of tx here: https://explorer.celo.org/tx/0xc495463ca93ec63fa654cc12690db488a9b127221a21af4c6359ceb357f3d757/logs | |
[{ | |
type: 'address', | |
name: 'from', | |
indexed: true | |
},{ | |
type: 'address', | |
name: 'to', | |
indexed: true | |
},{ | |
type: 'uint256', | |
name: 'value' | |
}], | |
"0x000000000000000000000000000000000000000000000000c2b818f06ea05800", | |
// the first topic in the array is the hash of the of the signature of the event | |
// event sig: "Transfer(address indexed from, address indexed to, uint256 value)" | |
// hash: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" | |
// this was removed as we are not interested in it, "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" | |
["0x0000000000000000000000006d67b41236129cb4f6ffaf6e37223485b20d1d06","0x000000000000000000000000c31965ffe24866d122b5469c08f3c69e0dcc578c",null] | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment