Closed BigMurry closed 5 years ago
Tested it with:
var Web3 = require('../../web3.js/packages/web3/dist/web3.umd.js');
var abi = require('../tokenContractAbi');
var web3 = new Web3(window.web3.currentProvider);
console.log('Version: ', web3.version);
var contract = new web3.eth.Contract(abi, '0x0ff095b6b4d215d91b4c1d7fce025a9d72afff22');
contract.methods.transfer('0x24BBE93E1D5b43233D921C9c73E15e8576bD7Be1', 1000)
.send({from: '0x9CC9a2c777605Af16872E0997b3Aeb91d96D5D8c'})
.then(function (receipt) {
console.log(receipt);
}).catch(function (error) {
console.log(error);
});
and got the following response:
Could you reference a gist file or repository here with the contract and your code example?
@nivida
when I create the contractInstance, some events' abi is missing from the contractAbi
, cause the events came from the other contract.
const contractAbi = [...];
const addr = '0x....';
const contractInstance = new web3.eth.Contract(contractAbi, addr);
Then when transaction is confirmed, it will trigger these methods:
TransactionConfirmationWorkflow
-> handleSuccessState
-> method.afterExecution
-> allEventsLogDecoder.decode
But some events' abi can not found, so that the abiItemModel
will be undefined
.
I think I found the guilty lines: https://github.com/ethereum/web3.js/blob/35ebbcacbecc75a6cac033fc648d0091e0235a83/packages/web3-eth-contract/src/decoders/AllEventsLogDecoder.js#L45-L47
if the abiModel.getEventBySignature
returns undefined
, then in the EventLogDecoder.decode
method, abiItemModel
will be undefined
, then line 46
will throw exception.
So in your test, you should make a transaction that can emit an event from other contract.
Yeah. I'm got this problem as well. Probably something to do with Escrow contract.
I have a similar problem. Is there a way to solve this problem?
Yeah. I'm got this problem as well. Probably something to do with Escrow contract.
Do you know what to do with escrow contract? Did you solve this problem?
@gudcjfdldu This is a web3 bug, if your transaction will trigger another contract event, web3 will trigger this bug.
I've downgraded to 1.0.0-beta.36.
@BigMurry i think Version 1.0.0-beta.37 seems to be the most stable. Currently, web3 works fine in this version.
Thanks all for the additional information. I will fix and release this asap!
can release a new version for this bug fix? @nivida
Expected behavior
send transaction should work fine.
Actual behavior
Steps to reproduce the behavior
when transaction is confirmed on the blockchain, exception occurred.
Error Logs
code snapshot:
Versions
Web3.js -
1.0.0-beta.46
Nodejs -v10.14.0
NPM -v6.4.1