首页 > 解决方案 > polkadot-js balances.transfer 抛出错误

问题描述

在我的 webappbalances.transfer中抛出错误但staking.bondExtra按预期工作。它连接到westend网络。

错误:

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

代码片段:

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();

标签: substratepolkadotpolkadot-js

解决方案


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


推荐阅读