1

I'm trying to transfer aUSD test token from one wallet to another on my dapp using Polkadot.js wallet. Sender's wallet is connected to Mandala TC7 test.

I read this at Acala's site and I'm trying to use it as below.

const transfer = polkadot.tx.currencies.transfer('5F1pZeuR...GmZRSZuK', 'aUSD',100000000000);

But I'm getting the error below. My sender's wallet has 30 aUSD.

bundle-polkadot-types.js:8021 Uncaught (in promise) Error: createType(Call):: Call: failed decoding currencies.transfer:: Struct: failed on args: {"dest":"MultiAddress","currency_id":"{\"_enum\":{\"Token\":\"AcalaPrimitivesCurrencyTokenSymbol\",\"DexShare\":\"(AcalaPrimitivesCurrencyDexShare,AcalaPrimitivesCurrencyDexShare)\",\"Erc20\":\"H160\",\"StableAssetPoolToken\":\"u32\",\"LiquidCrowdloan\":\"u32\",\"ForeignAsset\":\"u16\"}}","amount":"Lookup48"}:: Struct: failed on currency_id: {"_enum":{"Token":"AcalaPrimitivesCurrencyTokenSymbol","DexShare":"(AcalaPrimitivesCurrencyDexShare,AcalaPrimitivesCurrencyDexShare)","Erc20":"H160","StableAssetPoolToken":"u32","LiquidCrowdloan":"u32","ForeignAsset":"u16"}}:: Cannot map Enum JSON, unable to find 'aUSD' in token, dexshare, erc20, stableassetpooltoken, liquidcrowdloan, foreignasset at createTypeUnsafe (bundle-polkadot-types.js:8021:20)

1 Answer 1

6

Looking at the extrinsics page, the currencyId is an Enum indicating the type of transfer.

So you need to pass the Token explicitly. This should do the trick -

const transfer = polkadot.tx.currencies.transfer(
  // dest
  '5F1pZeuR...GmZRSZuK', 
  // currencyId, enum
  { Token: 'AUSD' },
  // amount
  100000000000
);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.