关于通过web3转移以太坊令牌的问题

时间:2018-01-03 10:09:06

标签: javascript ethereum web3

我正在尝试实现令牌传输,我是在第一次测试时制作的。

可以在https://etherscan.io/tx/0x91ed7e481e0cced5600bb91498017a9ec02064710395363f57f2aa8c0a480b44

中查看

但是我收到错误,例如'交易未在50个街区内开采,请确保您的交易正确发送。请注意,它可能仍在开采!

让我知道这是什么问题。

const abi = [...];
const from = '0x...';
const gas = 50000;
const gasPrice = 30;
const decimal = Number(token.decimals); //token.decimals = 18
const contract = new this.web3.eth.Contract(abi, token.address, {
    from: from,
    gas: gas,
    gasPrice: gasPrice * 1000000000
});
return contract.methods.transfer(to, value *
    Math.pow(10, decimal)).send().then(res => {
    return res;
}).catch(err => {
    return err;
});   

这是简单的代码,但它在第一时间醒来。我能够了解。帮帮我PLZ

0 个答案:

没有答案