16 关于gasPrice的设置问题

我要实现的是:使用 sendSignedTransaction() 方法转出usdt时,把账户里的ETH余额(balance)全部用来充当手续费,gasPrice的值该怎么设置?我的而代码总是报错: E:\test\getblock_vision\node_modules\web3-utils\lib\utils.js:59 throw new Error(e + ' Given value: "' + number + '"'); ^

Error: Error: [number-to-bn] while converting number 33982013713.65282 to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported

代码段如图所示: 2323232.png

请先 登录 后评论

最佳答案 2021-12-19 10:23

错误提示已经非常直白了,web3.utils.toHex 传入参数只能是整数,balance/50000的计算结果是 33982013713.65282

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,495 浏览
  • 提出于 2021-12-18 18:25