Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decoding receipt.logs undefined #46

Open
luolixuan opened this issue Dec 11, 2019 · 1 comment
Open

decoding receipt.logs undefined #46

luolixuan opened this issue Dec 11, 2019 · 1 comment

Comments

@luolixuan
Copy link

luolixuan commented Dec 11, 2019

Hi, I try to use abidDecoder.decodeLogs(), but not working
the code is :

web3.eth.getTransactionReceipt('0x3ceff5f69a3e7440bccc226cc6f860b0bde81d05440c676c8bbf0c0f19585bd4', function(e,receipt){
	console.log('receipt', receipt);
  console.log('receipt log', receipt.logs);
	const decodedLogs = abiDecoder.decodeLogs(receipt.logs);
	console.log('decodedLogs',decodedLogs);
})

And I got the output receipt { blockHash: '0xc581cd0cd611d70119e10b5e472c4935a31c1bf035e251552df8357b44721206', blockNumber: 96803, contractAddress: null, cumulativeGasUsed: 75490, from: '0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98', gasUsed: 32878, logs: [ { address: '0xCAc7000C7dBaa2E33Af15325AF5D435E011C7BdD', topics: [Array], data: '0x00000000000000000000000000000000000000000000000022359c267290d800', blockNumber: 96803, transactionHash: '0x3ceff5f69a3e7440bccc226cc6f860b0bde81d05440c676c8bbf0c0f19585bd4', transactionIndex: 2, blockHash: '0xc581cd0cd611d70119e10b5e472c4935a31c1bf035e251552df8357b44721206', logIndex: 0, removed: false, id: 'log_943b1cf8' } ], logsBloom: '0x00000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000200000000000000000000080000000000000000000000000040000000000000000000000030000000001000000001000000000000', root: '0xa3f6d0955c6918bdb800c7b8e2bbc224e7e0c7d0938d82dc819fa1cb7c469bcf', to: '0xcac7000c7dbaa2e33af15325af5d435e011c7bdd', transactionHash: '0x3ceff5f69a3e7440bccc226cc6f860b0bde81d05440c676c8bbf0c0f19585bd4', transactionIndex: 2 } receipt log [ { address: '0xCAc7000C7dBaa2E33Af15325AF5D435E011C7BdD', topics: [ '0x4c13017ee95afc4bbd8a701dd9fbc9733f1f09f5a1b5438b5b9abd48e4c92d78', '0x4249545452455830300000000000000000000000000000000000000000000000', '0x000000000000000000000000725f637bf6266b62d8a4b8f9ec4e6e346d34998d' ], data: '0x00000000000000000000000000000000000000000000000022359c267290d800', blockNumber: 96803, transactionHash: '0x3ceff5f69a3e7440bccc226cc6f860b0bde81d05440c676c8bbf0c0f19585bd4', transactionIndex: 2, blockHash: '0xc581cd0cd611d70119e10b5e472c4935a31c1bf035e251552df8357b44721206', logIndex: 0, removed: false, id: 'log_943b1cf8' } ] decodedLogs [ undefined ]

I got the right transaction receipt but the abiDecoder.decodeMethod() returns undefined. What's the problem? Thanks!

@Antilochus
Copy link

Make sure that using abiDecoder.addABI() before using abidDecoder.decodeLogs().
And make sure the ABI you added is the right one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants