Create a local claimAssets XCM transaction to retrieve trapped assets. This can be either locally on a systems parachain, on the relay chain or any chain that supports the pallet-xcm claimAssets
runtime call.
import { TxResult } from '@substrate/asset-transfer-api'
let callInfo: TxResult<'call'>;
try {
callInfo = await assetsApi.claimAssets(
[`{"parents":"0","interior":{"X2":[{"PalletInstance":"50"},{"GeneralIndex":"1984"}]}}`],
['1000000000000'],
'0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b',
{
format: 'call',
xcmVersion: 2,
}
)
} catch (e) {
console.error(e);
throw Error(e);
}
Array of assetId's to be claimed from the AssetTrap
Array of the amounts of each trapped asset to be claimed
Address of the account to receive the trapped assets
Options
Create an asset transfer transaction. This can be either locally on a systems parachain or relay chain, or between chains using xcm.
import { TxResult } from '@substrate/asset-transfer-api'
let callInfo: TxResult<'call'>;
try {
callInfo = await assetsApi.createTransferTransaction(
'1000',
'5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
['WND'],
['1000000000000'],
{
format: 'call',
xcmVersion: 2,
}
)
} catch (e) {
console.error(e);
throw Error(e);
}
ID of the destination (para) chain (‘0’ for Relaychain)
Address of destination account
Array of assetId's to be transferred
Array of the amounts of each token to transfer
Options
Decodes the hex of an extrinsic into a string readable format.
const decodedExt = assetsApi.decodeExtrinsic(tx, 'call');
console.log(JSON.parse(decodedExt));
the hex of an extrinsic tx
The format the tx is in
Dry Run a call to determine its execution result
const executionResult = await assetApi.dryRunCall(sendersAddr, tx, 'call');
console.log(executionResult.toJSON());
address of the account sending the transaction
a payload, call or submittable
The format the tx is in
Fetch estimated fee information for an extrinsic
const feeInfo = assetApi.fetchFeeInfo(tx, 'call');
console.log(feeInfo.toJSON());
a payload, call or submittable
The format the tx is in
Holds open an api connection to a specified chain within the ApiPromise in order to help construct transactions for assets and estimating fees.