Skip to content

Commit

Permalink
Update readme based on suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Sep 18, 2023
1 parent 79fba01 commit aac9e28
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,31 @@ The `AssetsTransferApi.createTransferTransaction` is able to infer what kind of

### Transferring assets via xTokens pallet

If the transfer is being sent from a parachain that utilizes the `xTokens` pallet, the API will detect that and construct the transaction that is necessary. It will construct one of three calls: `transferMultiAsset`, `transferMultiAssets`, or `transferMultiAssetWithFee`. This is only application when the intended transfer direction starts from a parachain.
If the transfer is being sent from a parachain that utilizes the `xTokens` pallet, the API will detect that and construct the transaction that is necessary. It will construct one of three calls: `transferMultiAsset`, `transferMultiAssets`, or `transferMultiAssetWithFee`. This is only application when the intended transfer direction starts from a parachain. The xTokens pallet can be found [here](https://github.com/open-web3-stack/open-runtime-module-library/tree/master/xtokens).

An example would look like:
```typescript
api.createTransferTransaction(
'1000',
'0xc4db7bcb733e117c0b34ac96354b10d47e84a006b9e7e66a229d174e8ff2a063',
['xcUSDT'],
['1000000'],
{
format: 'call',
isLimited: false,
xcmVersion: 2,
}
);
```

### Foreign Asset Transfers

Sending a foreign asset requires the input `assetIds` in `createTransferTransaction` to include the `multiLocation` of the asset you would like to send. If a multilocation is not passed it will not know if the asset you are sending is a foreign asset. If the `multiLocation` passed in has a `Parachain` id which matches the `destChainId` input for the transfer then it will be a `teleportAssets`, otherwise it will be a `reserveTransferAssets`.
Sending a foreign asset requires the input `assetIds` in `createTransferTransaction` to include the `multiLocation` of the asset you would like to send. If a multilocation is not passed it will not know if the asset you are sending is a foreign asset. If the `multiLocation` passed in has a `Parachain` id which matches the `destChainId` input for the transfer then the output will be a teleport, otherwise it will be a reserve backed transfer.

An example would look like:
```typescript
api.createTransferTransaction(
'2125', // Note: the Parchain ID matches the MultiLocations 'Parachain' ID, making this a teleportAssets
'2125', // Note: the Parchain ID matches the MultiLocations 'Parachain' ID, making this a teleport of assets
'5EWNeodpcQ6iYibJ3jmWVe85nsok1EDG8Kk3aFg8ZzpfY1qX',
['{"parents":"1","interior":{"X2":[{"Parachain":"2125"},{"GeneralIndex":"0"}]}}'],
['1000000000000'],
Expand All @@ -217,7 +232,7 @@ If you would like to run an example to understand the output run: `yarn build:ex

### Liquid Pool Asset Transfers

Sending a Liquid Pool Asset is as simple as setting the option `transferLiquidToken` to true. That being said, it does have some nuances. A liquid transfer must be in the direction of a SystemToPara, and the inputted asset must be a valid integer as a string. The api will error if either of these conditions are not met.
Sending a liquidity token (from the poolAssets pallet) in Asset Hub is as simple as setting the option `transferLiquidToken` to true. That being said, it does have some nuances. A liquidity token transfer must be in the direction of a SystemToPara, and the inputted asset must be a valid integer as a string. The api will error if either of these conditions are not met.

An example would look like:
```typescript
Expand Down

0 comments on commit aac9e28

Please sign in to comment.