web3.js向合约发送交易列子

求一个dapp用web3.js 拉起metamask 向合约发起交易的列子? 我写的拉不起来metamask。

var message = {from: defaultaccount, value: web3js.utils.toWei(amount, 'ether')};

console.log("111111111111",defaultaccount,web3js.utils.toWei(amount, 'ether'),message)
mytoken.methods.contre().send(message, function(error, transactionHash){
console.log(error)
});

image.png

请先 登录 后评论

2 个回答

i am duck - 划水
请先 登录 后评论
Tiny熊 - 布道者
  擅长:智能合约,以太坊
请先 登录 后评论