简体   繁体   中英

What is the problem in use of “send” of web3.js?

I'm trying to use web3.js (v1.0.0) in order to send a transaction to smart contract, so i use send() method of the contract. My code:

let contract = new icoWeb3.eth.Contract(getABI(), contractAddress);

contract.methods.myMethod().send({
    from: from,
    value: value
});

The problem is that contract.methods.myMethod equals "undefined". So i can't utilize send() method to do what i need. Docs example code:

myContract.methods.myMethod([param1[, param2[, ...]]]).send(options[, callback])

What do i need to do in order to make method send() work? Thanks and i hope for your help...

If you are using send, you are calling a setter method of your contract.

So, you should provide some arguments:

 MyMethod(args1 [, args2, ...])

Can you provide the method of your solidity contract?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM