@paraspell/sdk 5.10.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 CHANGED
@@ -57,17 +57,16 @@ 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.
70
- - If you have duplicit asset error when building your call you can now specify which asset by new object selection eg. {symbol: number | bigint | string } or {id: number | bigint | string}
71
70
  ```
72
71
 
73
72
  ### Builder pattern:
@@ -77,7 +76,7 @@ NOTES:
77
76
  await Builder(/*node api - optional*/)
78
77
  .from(NODE)
79
78
  .to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
80
- .currency(CurrencyString | CurrencyID | Multilocation object | MultilocationArray | { symbol: string | number | bigint} | { id: string | number | bigint}) // Object selection is used when there are duplicate assets found and selector is unable to pick based on details provided (You will get an error from SDK when this happens).
79
+ .currency({id: currencyID} | {symbol: currencySymbol}, | {multilocation: multilocationJson} | {multiasset: multilocationJsonArray})
81
80
  /*.feeAsset(feeAsset) - Parameter required when using MultilocationArray*/
82
81
  .amount(amount) // Overriden when using MultilocationArray
83
82
  .address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
@@ -88,7 +87,7 @@ EXAMPLE:
88
87
  await Builder()
89
88
  .from('Basilisk')
90
89
  .to('Robonomics')
91
- .currency('XRT')
90
+ .currency({symbol:'XRT'})
92
91
  .amount(1000000000000)
93
92
  .address('4FCUYBMe2sbq5KosN22emsPUydS8XUwZhJ6VUZesmouGu6qd')
94
93
  .build()
@@ -165,27 +164,6 @@ await Builder(/*node api - optional*/)
165
164
  })
166
165
  ```
167
166
 
168
- ##### Close HRMP channels
169
- ```ts
170
- Builder(api)
171
- .from(NODE)
172
- .closeChannel()
173
- .inbound(inbound)
174
- .outbound(outbound)
175
- .build()
176
- ```
177
-
178
- ##### Open HRMP channels
179
- ```ts
180
- Builder()
181
- .from(NODE)
182
- .to(NODE)
183
- .openChannel()
184
- .maxSize(maxSize)
185
- .maxMessageSize(maxMsgSize)
186
- .build()'
187
- ```
188
-
189
167
  ### Function pattern:
190
168
  ```
191
169
  NOTES:
@@ -199,7 +177,7 @@ await paraspell.xcmPallet.send(
199
177
  {
200
178
  api?: ApiPromise,
201
179
  origin: origin Parachain name string,
202
- currency: CurrencyString | CurrencyID | Multilocation object /*Only works for PolkadotXCM pallet*/,
180
+ currency: {id: currencyID} | {symbol: currencySymbol}, | {multilocation: multilocationJson} | {multiasset: multilocationJsonArray},
203
181
  feeAsset? - Fee asset select id
204
182
  amount: any,
205
183
  to: destination address string | Multilocation object,
@@ -232,27 +210,6 @@ await paraspell.xcmPallet.transferRelayToPara(
232
210
  destApiForKeepAlive?: ApiPromise
233
211
  }
234
212
  )
235
-
236
- // Close HRMP channels
237
- paraspell.closeChannels.closeChannel(
238
- {
239
- api: ApiPromise,
240
- origin: origin Parachain ID,
241
- inbound: number,
242
- outbound: number
243
- }
244
- )
245
-
246
- // Open HRMP channels
247
- paraspell.openChannels.openChannel(
248
- {
249
- api: ApiPromise,
250
- origin: origin Parachain ID,
251
- destination: destination Parachain ID,
252
- maxSize: number,
253
- maxMessageSize: number
254
- }
255
- )
256
213
  ```
257
214
 
258
215
  ### Asset claim:
@@ -329,16 +286,16 @@ const ed = getExistentialDeposit('Acala')
329
286
  import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk";
330
287
 
331
288
  //Get balance of foreign currency
332
- await getBalanceForeign(address, Parachain name, currency)
289
+ await getBalanceForeign(address, Parachain name, currency /*- {id: currencyID} | {symbol: currencySymbol}*/)
333
290
 
334
291
  //Get balance of native currency
335
292
  await getBalanceNative(address, Parachain name)
336
293
 
337
294
  //Get fee information regarding XCM call
338
- await getOriginFeeDetails(from, to, currency, amount, originAddress)
295
+ await getOriginFeeDetails(from, to, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount, originAddress)
339
296
 
340
297
  //Get all the information about XCM transfer
341
- await getTransferInfo(from, to, address, destinationAddress, currency, amount)
298
+ await getTransferInfo(from, to, address, destinationAddress, currency /*- {id: currencyID} | {symbol: currencySymbol}*/, amount)
342
299
  ```
343
300
 
344
301
  ## 💻 Tests