Skip to content

Commit

Permalink
chore(sdk): Add changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dudo50 authored and michaeldev5 committed Dec 14, 2024
1 parent 7582646 commit ce8cb0a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ Latest news:
- You can now query foreign asset minimal deposits also.
- Since v8, amount moved closer to currency selection and specifying from and to parameters is no longer optional to save code.
- More information on v8 major breaking change: https://github.com/paraspell/xcm-tools/pull/554
- XCM SDK Now supports API Failsafe - If one endpoint doesn't work it automatically switches to the next one.
```

### Builder pattern:

##### Transfer assets from Parachain to Parachain
```ts
await Builder(/*node api/ws_url_string - optional*/)
await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
.from(NODE)
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
.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}})
Expand All @@ -131,7 +132,7 @@ const tx = await Builder()
```
##### Transfer assets from the Relay chain to Parachain
```ts
await Builder(/*node api/ws_url_string - optional*/)
await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
.from(RELAY_NODE) //Kusama or Polkadot
.to(NODE/*,customParaId - optional*/ | Multilocation object)
.currency({symbol: 'DOT', amount: amount})
Expand All @@ -153,7 +154,7 @@ const tx = await Builder()
```
##### Transfer assets from Parachain to Relay chain
```ts
await Builder(/*node api/ws_url_string - optional*/)
await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
.from(NODE)
.to(RELAY_NODE) //Kusama or Polkadot
.currency({symbol: 'DOT', amount: amount})
Expand All @@ -177,7 +178,7 @@ const tx = await Builder()
##### Batch calls
You can batch XCM calls and execute multiple XCM calls within one call. All three scenarios (Para->Para, Para->Relay, Relay->Para) can be used and combined.
```js
await Builder(/*node api/ws_url_string - optional*/)
await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
.to(NODE_2) //Any compatible Parachain
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
Expand All @@ -198,7 +199,7 @@ await Builder(/*node api/ws_url_string - optional*/)
### Asset claim:
```ts
//Claim XCM trapped assets from the selected chain
await Builder(api/ws_url_string)
await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
.claimFrom(NODE)
.fungible(MultilocationArray (Only one multilocation allowed) [{Multilocation}])
.account(address | Multilocation object)
Expand Down

0 comments on commit ce8cb0a

Please sign in to comment.