web3.js交易方法调用方式汇总
发布时间
阅读量:
阅读量
web3.js中涉及交易功能的方法调用方式如下:
(1)第一种调用形式
contractAddr.register(amount, {from: account});
务必确保传递from参数,即明确指定调用操作所关联的账户信息,否则将导致调用过程失败。【from参数为必填项
contractAddr.register(amount, {from: account}).then(function(returnValue) {
console.log("交易hash:" + returnValue);
});
可获取本次操作所对应的交易哈希值;【from参数必须予以保留
contractAddr.register.sendTransaction(amount, {from: account});
这与直接发起一笔交易的操作具有同等效果。【from参数在该过程中同样不可遗漏
contractAddr.register.sendTransaction(amount, {from: account}).then(function(returnValue) {
全部评论 (0)
还没有任何评论哟~
