@paraspell/sdk 7.0.1 → 7.1.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 +16 -13
- package/dist/index.cjs +437 -181
- package/dist/index.d.ts +71 -57
- package/dist/index.mjs +437 -181
- package/dist/papi/index.cjs +435 -181
- package/dist/papi/index.d.ts +60 -46
- package/dist/papi/index.mjs +435 -181
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ NOTES:
|
|
|
100
100
|
|
|
101
101
|
##### Transfer assets from Parachain to Parachain
|
|
102
102
|
```ts
|
|
103
|
-
await Builder(/*node api - optional*/)
|
|
103
|
+
await Builder(/*node api/ws_url_string - optional*/)
|
|
104
104
|
.from(NODE)
|
|
105
105
|
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
|
|
106
106
|
.currency({id: currencyID} | {symbol: currencySymbol}, | {multilocation: multilocationJson} | {multiasset: multilocationJsonArray})
|
|
@@ -122,7 +122,7 @@ await Builder()
|
|
|
122
122
|
```
|
|
123
123
|
##### Transfer assets from the Relay chain to Parachain
|
|
124
124
|
```ts
|
|
125
|
-
await Builder(/*node api - optional*/)
|
|
125
|
+
await Builder(/*node api/ws_url_string - optional*/)
|
|
126
126
|
.to(NODE/*,customParaId - optional*/ | Multilocation object)
|
|
127
127
|
.amount(amount)
|
|
128
128
|
.address(address | Multilocation object)
|
|
@@ -139,7 +139,7 @@ await Builder()
|
|
|
139
139
|
```
|
|
140
140
|
##### Transfer assets from Parachain to Relay chain
|
|
141
141
|
```ts
|
|
142
|
-
await Builder(/*node api - optional*/)
|
|
142
|
+
await Builder(/*node api/ws_url_string - optional*/)
|
|
143
143
|
.from(NODE)
|
|
144
144
|
.amount(amount)
|
|
145
145
|
.address(address | Multilocation object)
|
|
@@ -159,7 +159,7 @@ await Builder()
|
|
|
159
159
|
NOTE: Custom multilocations are not available when keepALive check is used
|
|
160
160
|
```
|
|
161
161
|
```ts
|
|
162
|
-
await Builder(/*node api - optional*/)
|
|
162
|
+
await Builder(/*node api/ws_url_string - optional*/)
|
|
163
163
|
.from(NODE)
|
|
164
164
|
.amount(amount)
|
|
165
165
|
.address(address)
|
|
@@ -171,7 +171,7 @@ await Builder(/*node api - optional*/)
|
|
|
171
171
|
##### Batch calls
|
|
172
172
|
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.
|
|
173
173
|
```js
|
|
174
|
-
await Builder(/*node api - optional*/)
|
|
174
|
+
await Builder(/*node api/ws_url_string - optional*/)
|
|
175
175
|
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
|
|
176
176
|
.to(NODE_2) //Any compatible Parachain
|
|
177
177
|
.currency(currency) //Currency to transfer (If Para->Para), otherwise you do not need to specify .currency()
|
|
@@ -202,7 +202,7 @@ NOTES:
|
|
|
202
202
|
// Transfer assets from Parachain to Parachain
|
|
203
203
|
await paraspell.xcmPallet.send(
|
|
204
204
|
{
|
|
205
|
-
api?: ApiPromise,
|
|
205
|
+
api?: ApiPromise/Ws_url_string,
|
|
206
206
|
origin: origin Parachain name string,
|
|
207
207
|
currency: {id: currencyID} | {symbol: currencySymbol}, | {multilocation: multilocationJson} | {multiasset: multilocationJsonArray},
|
|
208
208
|
feeAsset? - Fee asset select id
|
|
@@ -217,7 +217,7 @@ await paraspell.xcmPallet.send(
|
|
|
217
217
|
// Transfer assets from Parachain to Relay chain
|
|
218
218
|
await paraspell.xcmPallet.send(
|
|
219
219
|
{
|
|
220
|
-
api?: ApiPromise,
|
|
220
|
+
api?: ApiPromise/Ws_url_string,
|
|
221
221
|
origin: origin Parachain name string,
|
|
222
222
|
amount: any,
|
|
223
223
|
to: destination address string | Multilocation object,
|
|
@@ -229,7 +229,7 @@ await paraspell.xcmPallet.send(
|
|
|
229
229
|
// Transfer assets from Relay chain to Parachain
|
|
230
230
|
await paraspell.xcmPallet.transferRelayToPara(
|
|
231
231
|
{
|
|
232
|
-
api?: ApiPromise,
|
|
232
|
+
api?: ApiPromise/Ws_url_string,
|
|
233
233
|
destination: destination Parachain ID | Multilocation object,
|
|
234
234
|
amount: any,
|
|
235
235
|
to: destination address string | Multilocation object,
|
|
@@ -242,7 +242,7 @@ await paraspell.xcmPallet.transferRelayToPara(
|
|
|
242
242
|
### Asset claim:
|
|
243
243
|
```ts
|
|
244
244
|
//Claim XCM trapped assets from the selected chain
|
|
245
|
-
await Builder(api)
|
|
245
|
+
await Builder(api/ws_url_string)
|
|
246
246
|
.claimFrom(NODE)
|
|
247
247
|
.fungible(MultilocationArray (Only one multilocation allowed) [{Multilocation}])
|
|
248
248
|
.account(address | Multilocation object)
|
|
@@ -322,16 +322,19 @@ import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetai
|
|
|
322
322
|
import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk/papi";
|
|
323
323
|
|
|
324
324
|
//Get balance of foreign currency
|
|
325
|
-
await getBalanceForeign(address,
|
|
325
|
+
await getBalanceForeign({address, node, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, api /* api/ws_url_string optional */})
|
|
326
326
|
|
|
327
327
|
//Get balance of native currency
|
|
328
|
-
await getBalanceNative(address,
|
|
328
|
+
await getBalanceNative({address, node, api /* api/ws_url_string optional */})
|
|
329
329
|
|
|
330
330
|
//Get fee information regarding XCM call
|
|
331
|
-
await getOriginFeeDetails(from, to, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, originAddress, api /* optional */, feeMargin /* 10% by default */)
|
|
331
|
+
await getOriginFeeDetails({from, to, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, originAddress, api /* api/ws_url_string optional */, feeMargin /* 10% by default */})
|
|
332
|
+
|
|
333
|
+
//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 */});
|
|
332
335
|
|
|
333
336
|
//Get all the information about XCM transfer
|
|
334
|
-
await getTransferInfo(from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount)
|
|
337
|
+
await getTransferInfo({from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, api /* api/ws_url_string optional */})
|
|
335
338
|
```
|
|
336
339
|
|
|
337
340
|
## 💻 Tests
|