@paraspell/sdk 7.1.2 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -13
- package/dist/index.cjs +10694 -7020
- package/dist/index.d.ts +151 -138
- package/dist/index.mjs +10688 -7019
- package/dist/papi/index.cjs +10694 -7030
- package/dist/papi/index.d.ts +151 -138
- package/dist/papi/index.mjs +10688 -7029
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -38,15 +38,13 @@ For example on PNPM: `pnpm config set auto-install-peers false`
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
#NOTE: apps-config will soon be removed entirely from the peer dependency list
|
|
42
|
-
|
|
43
41
|
#Choose a package and install its dependencies below (SDK is built in a way, that only one library has to be installed)
|
|
44
42
|
|
|
45
43
|
#Polkadot API peer dependencies
|
|
46
|
-
pnpm | npm install || yarn add polkadot-api
|
|
44
|
+
pnpm | npm install || yarn add polkadot-api
|
|
47
45
|
|
|
48
46
|
#PolkadotJS peer dependencies
|
|
49
|
-
pnpm | npm install || yarn add @polkadot/api @polkadot/types @polkadot/api-base @polkadot/
|
|
47
|
+
pnpm | npm install || yarn add @polkadot/api @polkadot/types @polkadot/api-base @polkadot/util
|
|
50
48
|
```
|
|
51
49
|
|
|
52
50
|
### Install SDK
|
|
@@ -80,6 +78,11 @@ const paraspell = require('@paraspell/sdk/papi')
|
|
|
80
78
|
const paraspell = require('@paraspell/sdk')
|
|
81
79
|
```
|
|
82
80
|
|
|
81
|
+
Interaction with further asset symbol abstraction:
|
|
82
|
+
```js
|
|
83
|
+
import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk'; //Only needed when advanced asset symbol selection is used. PJS version.
|
|
84
|
+
import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk/papi'; //Only needed when advanced asset symbol selection is used. PAPI version.
|
|
85
|
+
```
|
|
83
86
|
## Implementation
|
|
84
87
|
|
|
85
88
|
```
|
|
@@ -96,6 +99,14 @@ NOTES:
|
|
|
96
99
|
- POLKADOT <> ETHEREUM Bridge is now available! Try sending WETH between the ecosystems - More information here: https://paraspell.github.io/docs/sdk/xcmPallet.html#ecosystem-bridges.
|
|
97
100
|
```
|
|
98
101
|
|
|
102
|
+
```
|
|
103
|
+
Latest news:
|
|
104
|
+
- ParaSpell now offers advanced asset symbol selection {symbol: "symbol"} for non duplicate assets, {symbol: Native("symbol")} or {symbol: Foreign("symbol")} if the duplicates are between native and foreign assets and {symbol: ForeignAbstract("symbol")} if the duplicates are in foreign assets only. You will get an error that will guide you further if you simply start with {symbol: "symbol"}.
|
|
105
|
+
- You can now select assets by multilocation by simply using { multilocation: string | JSON }. The custom multilocation selection remains supported, but in order to use it you now have to use override - {multilocation: Override('Custom Multilocation')}.
|
|
106
|
+
- The balance queries also support multilocation asset selection
|
|
107
|
+
- PAPI version of SDK is now fully PJS-less (We removed apps/config as dependency entirely).
|
|
108
|
+
```
|
|
109
|
+
|
|
99
110
|
### Builder pattern:
|
|
100
111
|
|
|
101
112
|
##### Transfer assets from Parachain to Parachain
|
|
@@ -103,7 +114,7 @@ NOTES:
|
|
|
103
114
|
await Builder(/*node api/ws_url_string - optional*/)
|
|
104
115
|
.from(NODE)
|
|
105
116
|
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
|
|
106
|
-
.currency({id: currencyID} | {symbol: currencySymbol}
|
|
117
|
+
.currency({id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson} | {multilocation: Override('Custom Multilocation')} | {multiasset: multilocationJsonArray})
|
|
107
118
|
/*.feeAsset(feeAsset) - Parameter required when using MultilocationArray*/
|
|
108
119
|
.amount(amount) // Overriden when using MultilocationArray
|
|
109
120
|
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
|
|
@@ -112,9 +123,9 @@ await Builder(/*node api/ws_url_string - optional*/)
|
|
|
112
123
|
/*
|
|
113
124
|
EXAMPLE:
|
|
114
125
|
await Builder()
|
|
115
|
-
.from('
|
|
116
|
-
.to('
|
|
117
|
-
.currency({symbol:'
|
|
126
|
+
.from('Hydration')
|
|
127
|
+
.to('BifrostPolkadot')
|
|
128
|
+
.currency({symbol:'BNC'})
|
|
118
129
|
.amount(1000000000000)
|
|
119
130
|
.address('4FCUYBMe2sbq5KosN22emsPUydS8XUwZhJ6VUZesmouGu6qd')
|
|
120
131
|
.build()
|
|
@@ -204,7 +215,7 @@ await paraspell.xcmPallet.send(
|
|
|
204
215
|
{
|
|
205
216
|
api?: ApiPromise/Ws_url_string,
|
|
206
217
|
origin: origin Parachain name string,
|
|
207
|
-
currency: {id: currencyID} | {symbol: currencySymbol}
|
|
218
|
+
currency: {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson} | {multilocation: Override('Custom Multilocation')} | {multiasset: multilocationJsonArray} ,
|
|
208
219
|
feeAsset? - Fee asset select id
|
|
209
220
|
amount: any,
|
|
210
221
|
to: destination address string | Multilocation object,
|
|
@@ -322,19 +333,19 @@ import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetai
|
|
|
322
333
|
import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk/papi";
|
|
323
334
|
|
|
324
335
|
//Get balance of foreign currency
|
|
325
|
-
await getBalanceForeign({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, api /* api/ws_url_string optional */})
|
|
336
|
+
await getBalanceForeign({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */})
|
|
326
337
|
|
|
327
338
|
//Get balance of native currency
|
|
328
339
|
await getBalanceNative({address, node, api /* api/ws_url_string optional */})
|
|
329
340
|
|
|
330
341
|
//Get fee information regarding XCM call
|
|
331
|
-
await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, originAddress, api /* api/ws_url_string optional */, feeMargin /* 10% by default */})
|
|
342
|
+
await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, originAddress, destinationAddress, api /* api/ws_url_string optional */, feeMargin /* 10% by default */})
|
|
332
343
|
|
|
333
344
|
//Retrieves the asset balance for a given account on a specified node.
|
|
334
|
-
await getAssetBalance({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, api /* api/ws_url_string optional */});
|
|
345
|
+
await getAssetBalance({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, api /* api/ws_url_string optional */});
|
|
335
346
|
|
|
336
347
|
//Get all the information about XCM transfer
|
|
337
|
-
await getTransferInfo({from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, api /* api/ws_url_string optional */})
|
|
348
|
+
await getTransferInfo({from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {multilocation: AssetMultilocationString | AssetMultilocationJson}*/, amount, api /* api/ws_url_string optional */})
|
|
338
349
|
```
|
|
339
350
|
|
|
340
351
|
## 💻 Tests
|