【问题标题】:polkadot-js balances.transfer throws errorpolkadot-js balances.transfer 抛出错误
【发布时间】:2021-07-22 12:17:23
【问题描述】:

在我的 web 应用程序中,balances.transfer 抛出错误,但 staking.bondExtra 正在按预期工作。它连接到 westend 网络。

错误:

错误:createType(Call):: Call: 解码失败 balances.transfer:: Struct: 参数失败:{"dest":"LookupSource","value":"Compact"}:: Struct:值失败:Compact:: 断言失败

代码sn-p:

transactions = []
transactions.push(
    api.tx.staking.bondExtra(rawAmount),
    api.tx.balances.transfer(Address, commission);
);

const bondExtraFee = await api.tx.utility.batch(transactions).paymentInfo(substrateStashId);
return bondExtraFee.partialFee.toNumber();

【问题讨论】:

  • 你使用的是最新的api版本吗?究竟是什么?
  • 遇到同样的问题。你找到解决办法了吗?

标签: substrate polkadot polkadot-js


【解决方案1】:

这可能是由于您的链中有大量小数造成的。 确保将余额值指定为BigIntBN 而不仅仅是number

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-24
    • 1970-01-01
    • 1970-01-01
    • 2018-01-14
    • 2018-06-18
    • 1970-01-01
    • 1970-01-01
    • 2016-05-02
    相关资源
    最近更新 更多