此代码在执行sendTransaction
函数之前返回错误。
我使用了回调但它也不起作用。
这是我写的代码
var mytoken= MyContract.at(contractAddress);
router.get('/test',function (req, res, next)
{
res.render('test.ejs');
});
//send token
router.post('/test', function(req, res, next) {
var recieverAdd = req.body.to;
var from=req.body.from;
var amount = req.body.amount;
var bool= web3.personal.unlockAccount(web3.eth.accounts[0],"yosra");
mytoken.transfer.sendTransaction(from,recieverAdd,amount, {from:eth.accounts[0],gas:500000},function (error, result)
{
callback(result);
});
});