Suryansh Singh
Suryansh Singh

Reputation: 67

polkadot-js balances.transfer throws error

In my webapp balances.transfer is throwing an error but staking.bondExtra is working as expected. Its connected to westend network.

Error:

Error: createType(Call):: Call: failed decoding balances.transfer:: Struct: failed on args: {"dest":"LookupSource","value":"Compact<Balance>"}:: Struct: failed on value: Compact<Balance>:: Assertion failed

Code snippet:

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

Upvotes: 0

Views: 796

Answers (1)

nazar-pc
nazar-pc

Reputation: 326

This is likely caused by the large number of decimals in your chain. Make sure to specify balance value as BigInt or BN instead of just number.

Upvotes: 1

Related Questions