【发布时间】:2019-03-25 12:24:54
【问题描述】:
我试图让这个简单的 Dapp 工作,我将变量 nombre 和 edad 发送到 setInstructor() 函数,然后由 getInstructor() 函数返回。问题是我不断收到BigNumber Error: "new BigNumber() not a base 16 number:。有什么想法吗?
团结
pragma solidity ^0.4.25;
contract Contrato {
string fName;
uint age;
function setInstructor (string _fName, uint _age){
fName = _fName;
age = _age;
}
function getInstructor () public constant returns (string, uint){
return (fName, age);
}
}
Web3
var Contrato = web3.eth.contract(ABI);
var Contratito = Contrato.at(Address);
$("#button").click(function(){
Contratito.setInstructor($("#nombre").val(), $("#edad").val(), function(error,result){if (!error) { console.log("bien") } else { console.error(error)}});
Contratito.getInstructor(function(error,result){ if (!error) { $("#instructor").html(result[0] + " " + result[1])} else {console.error(error)}});
})
【问题讨论】:
标签: javascript solidity web3