substrate - 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();
解决方案
这可能是由于您的链中有大量小数造成的。确保将 balance 值指定为BigInt
或BN
而不是 just number
。
推荐阅读
- php - 你能帮我解决我的代码中的错误吗
- python - Tableau 和关系数据库
- python - 子类化多个类时来自 __dict__ 中的实例属性
- javascript - 如何创建不区分大小写的文本搜索
- python - Python - 将数据点插入到 numpy 图像中
- go - 在 Go 中深度复制图结构
- c# - ASP.NET Core:IsInRoleAsync 和 Authorize Attribute 不一致
- c++ - 列表中的插入和删除
- php - WordPress:get_the_content() 和 the_content() 之间的区别
- c++ - 无法让 Qt Creator 正确编译 OpenCV