0

How to get the result by parsing the log after executing the contract? How can I get the execution result ? enter image description here

enter image description here

1 Answer 1

1

The short answer is you don't.

You get what's in the log from the log.

Other contracts can get the result, but you can't sign a transaction that changes the state and also get the result.

Have a look here: https://blog.b9lab.com/calls-vs-transactions-in-ethereum-smart-contracts-62d6b17d0bc2

Hope it helps.

2
  • This is the receipt. { blockHash: '0x30127276daa98740a2ed0bcbf47f9a345e44e766751ec2889e93482e784064c5', blockNumber: 6692373, contractAddress: null, cumulativeGasUsed: 58199, from: '0x8e0f4a1f3c0dbea0c73684b49ae4ad02789b3ec4', gasUsed: 27584, logs: [], logsBloom: '0x.....', status: true, to: '0xc2500c2a90dc6eece516582caca5b006d425e1ff', transactionHash: '0x....', transactionIndex: 1 }
    – Smith Jone
    Commented Nov 2, 2019 at 2:32
  • I want to parse the receipt.logs, but it fail when I use this code. const abi = _.find(item => (item.name == "LoginEvent") && item.type == "event"); const eventJsonInterface = _.find( contract._jsonInterface, o => (o.name === 'LoginEvent' || o.name === 'CreateUser') && o.type === 'event', ) const log = _.find( receipt.logs, l => l.topics.includes(eventJsonInterface.signature) ) let de = ABI.decodeLog(eventJsonInterface.inputs, log.data, log.topics.slice(1))
    – Smith Jone
    Commented Nov 2, 2019 at 2:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.