From 4de56b24d62a3158e07a701334b81ed2d1722a98 Mon Sep 17 00:00:00 2001 From: Dusan Morhac <55763425+dudo50@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:37:43 +0100 Subject: [PATCH] chore(xcm-tools): Add readme --- apps/xcm-api/README.md | 19 +++++++++++++++++++ packages/sdk/README.md | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/apps/xcm-api/README.md b/apps/xcm-api/README.md index 3d8cba2c..7742ba93 100644 --- a/apps/xcm-api/README.md +++ b/apps/xcm-api/README.md @@ -125,6 +125,25 @@ const response = await fetch('http://localhost:3001/x-transfer', { }); ``` +### Dry run your XCM Calls + +A complete guide on asset claim can be found in [official docs](https://paraspell.github.io/docs/api/xcmP.html#dry-run). + +```js +const response = await fetch('http://localhost:3001/dry-run', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + from: 'Parachain', // Replace "Parachain" with sender Parachain or Relay chain, e.g., "Acala" + to: 'Parachain', // Replace "Parachain" with destination Parachain or Relay chain, e.g., "Moonbeam" or custom Multilocation + currency: { currencySpec }, //{id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}} + address: 'Address', // Replace "Address" with destination wallet address (In AccountID32 or AccountKey20 Format) or custom Multilocation + //xcmVersion: "Vx" //Optional parameter - replace "Vx" with V and version number eg. "V4" + }), +``` + ### Batch call A complete guide on asset claim can be found in [official docs](https://paraspell.github.io/docs/api/xcmP.html#batch-call). diff --git a/packages/sdk/README.md b/packages/sdk/README.md index a0432fbf..28ad3c90 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -196,6 +196,20 @@ await Builder(/*node api/ws_url_string/ws_url_array - optional*/) }) ``` +### Dryrun your XCM Calls: +```ts +//Builder pattern +const result = await Builder(API /*optional*/) + .from(NODE) + .to(NODE_2) + .currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {multilocation: AssetMultilocationString, amount: amount | AssetMultilocationJson, amount: amount} | {multilocation: Override('Custom Multilocation'), amount: amount} | {multiasset: {currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or multilocation: multilocation*/, amount: amount}}) + .address(ADDRESS) + .dryRun() + +//Function pattern +getDryRun({Api, /*optional*/ node, address, tx /* Extrinsic object*/}) +``` + ### Asset claim: ```ts //Claim XCM trapped assets from the selected chain