@paraspell/sdk 5.9.0 → 6.0.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 +29 -47
- package/dist/index.cjs +2342 -1121
- package/dist/index.d.ts +229 -232
- package/dist/index.mjs +2334 -1118
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -57,13 +57,13 @@ const paraspell = require('@paraspell/sdk')
|
|
|
57
57
|
|
|
58
58
|
```
|
|
59
59
|
NOTES:
|
|
60
|
-
- If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add the character 'n' to the end of currencyID. Eg: .currency(42259045809535163221576417993425387648n) will mean you transfer xcDOT.
|
|
60
|
+
- If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add the character 'n' to the end of currencyID. Eg: .currency({id: 42259045809535163221576417993425387648n}) will mean you transfer xcDOT.
|
|
61
61
|
- You can now use custom ParachainIDs if you wish to test in TestNet. Just add parachainID as an additional parameter eg: .to('Basilisk', 2948).
|
|
62
62
|
- You can now add an optional parameter useKeepAlive which will ensure, that you send more than the existential deposit.
|
|
63
63
|
- Since v5 you can fully customize all multilocations (address, currency and destination). Instead of a string parameter simply pass an object with multilocation instead for more information refer to the following PR https://github.com/paraspell/xcm-tools/pull/199.
|
|
64
64
|
- Fee asset is now a required builder parameter when you enter a multilocation array.
|
|
65
65
|
- When using a multilocation array the amount parameter is overridden.
|
|
66
|
-
- Multilocation arrays are now available. Customize your asset multilocations by .currency([{multilocation1},{multilocation2}..{multilocationN}]) For more information refer to the official documentation or following PR https://github.com/paraspell/xcm-tools/pull/224.
|
|
66
|
+
- Multilocation arrays are now available. Customize your asset multilocations by .currency({multiasset: [{multilocation1},{multilocation2}..{multilocationN}]}) For more information refer to the official documentation or following PR https://github.com/paraspell/xcm-tools/pull/224.
|
|
67
67
|
- POLKADOT <> KUSAMA Bridge is now available! Try sending DOT or KSM between AssetHubs - More information here: https://paraspell.github.io/docs/sdk/xcmPallet.html#ecosystem-bridges.
|
|
68
68
|
- You can now customize XCM Version! Try using .xcmVersion parameter after address in builder.
|
|
69
69
|
- 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.
|
|
@@ -76,7 +76,7 @@ NOTES:
|
|
|
76
76
|
await Builder(/*node api - optional*/)
|
|
77
77
|
.from(NODE)
|
|
78
78
|
.to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
|
|
79
|
-
.currency(
|
|
79
|
+
.currency({id: currencyID} | {symbol: currencySymbol}, | {multilocation: multilocationJson} | {multiasset: multilocationJsonArray})
|
|
80
80
|
/*.feeAsset(feeAsset) - Parameter required when using MultilocationArray*/
|
|
81
81
|
.amount(amount) // Overriden when using MultilocationArray
|
|
82
82
|
.address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
|
|
@@ -87,7 +87,7 @@ EXAMPLE:
|
|
|
87
87
|
await Builder()
|
|
88
88
|
.from('Basilisk')
|
|
89
89
|
.to('Robonomics')
|
|
90
|
-
.currency('XRT')
|
|
90
|
+
.currency({symbol:'XRT'})
|
|
91
91
|
.amount(1000000000000)
|
|
92
92
|
.address('4FCUYBMe2sbq5KosN22emsPUydS8XUwZhJ6VUZesmouGu6qd')
|
|
93
93
|
.build()
|
|
@@ -140,25 +140,28 @@ await Builder(/*node api - optional*/)
|
|
|
140
140
|
/*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call*/
|
|
141
141
|
.build()
|
|
142
142
|
```
|
|
143
|
-
##### Close HRMP channels
|
|
144
|
-
```ts
|
|
145
|
-
Builder(api)
|
|
146
|
-
.from(NODE)
|
|
147
|
-
.closeChannel()
|
|
148
|
-
.inbound(inbound)
|
|
149
|
-
.outbound(outbound)
|
|
150
|
-
.build()
|
|
151
|
-
```
|
|
152
143
|
|
|
153
|
-
#####
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
.
|
|
158
|
-
.
|
|
159
|
-
.
|
|
160
|
-
.
|
|
161
|
-
.
|
|
144
|
+
##### Batch calls
|
|
145
|
+
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.
|
|
146
|
+
```js
|
|
147
|
+
await Builder(/*node api - optional*/)
|
|
148
|
+
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
|
|
149
|
+
.to(NODE_2) //Any compatible Parachain
|
|
150
|
+
.currency(currency) //Currency to transfer (If Para->Para), otherwise you do not need to specify .currency()
|
|
151
|
+
.amount(amount)
|
|
152
|
+
.address(address | Multilocation object)
|
|
153
|
+
.addToBatch()
|
|
154
|
+
|
|
155
|
+
.from(NODE) //Ensure, that origin node is the same in all batched XCM Calls.
|
|
156
|
+
.to(NODE_3) //Any compatible Parachain
|
|
157
|
+
.currency(currency) //Currency to transfer (If Para->Para), otherwise you do not need to specify .currency()
|
|
158
|
+
.amount(amount)
|
|
159
|
+
.address(address | Multilocation object)
|
|
160
|
+
.addToBatch()
|
|
161
|
+
.buildBatch({
|
|
162
|
+
// This settings object is optional and batch all is the default option
|
|
163
|
+
mode: BatchMode.BATCH_ALL //or BatchMode.BATCH
|
|
164
|
+
})
|
|
162
165
|
```
|
|
163
166
|
|
|
164
167
|
### Function pattern:
|
|
@@ -174,7 +177,7 @@ await paraspell.xcmPallet.send(
|
|
|
174
177
|
{
|
|
175
178
|
api?: ApiPromise,
|
|
176
179
|
origin: origin Parachain name string,
|
|
177
|
-
currency:
|
|
180
|
+
currency: {id: currencyID} | {symbol: currencySymbol}, | {multilocation: multilocationJson} | {multiasset: multilocationJsonArray},
|
|
178
181
|
feeAsset? - Fee asset select id
|
|
179
182
|
amount: any,
|
|
180
183
|
to: destination address string | Multilocation object,
|
|
@@ -207,27 +210,6 @@ await paraspell.xcmPallet.transferRelayToPara(
|
|
|
207
210
|
destApiForKeepAlive?: ApiPromise
|
|
208
211
|
}
|
|
209
212
|
)
|
|
210
|
-
|
|
211
|
-
// Close HRMP channels
|
|
212
|
-
paraspell.closeChannels.closeChannel(
|
|
213
|
-
{
|
|
214
|
-
api: ApiPromise,
|
|
215
|
-
origin: origin Parachain ID,
|
|
216
|
-
inbound: number,
|
|
217
|
-
outbound: number
|
|
218
|
-
}
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
// Open HRMP channels
|
|
222
|
-
paraspell.openChannels.openChannel(
|
|
223
|
-
{
|
|
224
|
-
api: ApiPromise,
|
|
225
|
-
origin: origin Parachain ID,
|
|
226
|
-
destination: destination Parachain ID,
|
|
227
|
-
maxSize: number,
|
|
228
|
-
maxMessageSize: number
|
|
229
|
-
}
|
|
230
|
-
)
|
|
231
213
|
```
|
|
232
214
|
|
|
233
215
|
### Asset claim:
|
|
@@ -304,16 +286,16 @@ const ed = getExistentialDeposit('Acala')
|
|
|
304
286
|
import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk";
|
|
305
287
|
|
|
306
288
|
//Get balance of foreign currency
|
|
307
|
-
await getBalanceForeign(address, Parachain name, currency)
|
|
289
|
+
await getBalanceForeign(address, Parachain name, currency /*- {id: currencyID} | {symbol: currencySymbol}*/)
|
|
308
290
|
|
|
309
291
|
//Get balance of native currency
|
|
310
292
|
await getBalanceNative(address, Parachain name)
|
|
311
293
|
|
|
312
294
|
//Get fee information regarding XCM call
|
|
313
|
-
await getOriginFeeDetails(from, to, currency
|
|
295
|
+
await getOriginFeeDetails(from, to, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, originAddress)
|
|
314
296
|
|
|
315
297
|
//Get all the information about XCM transfer
|
|
316
|
-
await getTransferInfo(from, to, address, destinationAddress, currency
|
|
298
|
+
await getTransferInfo(from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount)
|
|
317
299
|
```
|
|
318
300
|
|
|
319
301
|
## 💻 Tests
|