Skip to content

Commit

Permalink
chore(xcm-tools): Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dudo50 committed Dec 18, 2024
1 parent b544a7f commit 4de56b2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
19 changes: 19 additions & 0 deletions apps/xcm-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
14 changes: 14 additions & 0 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4de56b2

Please sign in to comment.