出现 BigNumber 错误 .. 几乎尝试了一切
这是 web3js 函数调用
creditPoints: function() {
var self = this;
alert("Credit Coins");
this.setStatus("Initiating transaction... (please wait)");
var meta;
MetaCoin.deployed().then(function(instance) {
meta = instance;
//alert("credit Points");
alert(account);
return meta.creditCoin( account, {from: account,gas: 300000});
}).then(function() {
console.log("Transaction complete");
self.setStatus("Transaction complete!");
// self.refreshBalance();
}).catch(function(e) {
console.log(e);
self.setStatus("Error sending coin; see log.");
});
},
这是solidity中的合约函数
function creditCoin(address receiver) returns(bool sufficient) {
uint amount;
amount=100;
if (balances[0xE208914454c16c7a2CD561071519bea9207Dda59] < amount) return false;
balances[0xE208914454c16c7a2CD561071519bea9207Dda59] -= amount;
balances[receiver] += amount;
Transfer(0xE208914454c16c7a2CD561071519bea9207Dda59, receiver, amount);
return true;
}
调用上述函数时出现 BigNumber 错误
Error: new BigNumber() not a number: [object Object]
at raise (app.js:17546)
at app.js:17534
at new BigNumber (app.js:16561)
at new BigNumber (app.js:16571)
at toBigNumber (app.js:2719)
at Object.toTwosComplement (app.js:2730)
at SolidityTypeUInt.formatInputInt [as _inputFormatter] (app.js:3888)
at SolidityTypeUInt.SolidityType.encode (app.js:5111)
at app.js:21124
at Array.map (<anonymous>)