@paraspell/sdk 8.10.0 → 8.11.1

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
@@ -70,26 +70,19 @@ import { Native, Foreign, ForeignAbstract } from '@paraspell/sdk'; //Only needed
70
70
 
71
71
  ```
72
72
  NOTES:
73
- - 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.
74
- - You can now use custom ParachainIDs if you wish to test in TestNet. Just add parachainID as an additional parameter eg: .to('Basilisk', 2948).
75
- - 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.
76
- - You can now customize XCM Version! Try using .xcmVersion parameter after address in builder.
77
- - 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.
78
- - 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"}.
79
- - 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')}.
80
- - The balance queries also support multilocation asset selection
81
73
  - PAPI version of SDK is now fully PJS-less (We removed apps/config as dependency entirely).
82
74
  - You can now query foreign asset minimal deposits also.
83
- ```
84
-
85
- ```
86
- Latest news:
87
75
  - Since v8, amount moved closer to currency selection and specifying from and to parameters is no longer optional to save code.
88
76
  - More information on v8 major breaking change: https://github.com/paraspell/xcm-tools/pull/554
89
77
  - XCM SDK Now supports API Failsafe - If one endpoint doesn't work it automatically switches to the next one.
90
78
  - Builder now allows you to directly disconnect API.
91
79
  ```
92
80
 
81
+ ```
82
+ Latest news:
83
+ - Local transfers are now available for every currency and every chain. To try them, simply use same origin and destination parameters.
84
+ ```
85
+
93
86
  ### Builder pattern:
94
87
 
95
88
  ##### Transfer assets from Parachain to Parachain
@@ -99,7 +92,8 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
99
92
  .to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
100
93
  .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}})
101
94
  .address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/, /*senderAddress - OPTIONAL - used when origin is AssetHub and feeAsset parameter is provided*/)
102
- /*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
95
+ /*.feeAsset({symbol: 'symbol'} || {id: 'id'} || {multilocation: 'multilocation'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
96
+ .xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
103
97
  .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
104
98
 
105
99
  const tx = await builder.build()
@@ -131,8 +125,7 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
131
125
  .to(NODE/*,customParaId - optional*/ | Multilocation object)
132
126
  .currency({symbol: 'DOT', amount: amount})
133
127
  .address(address | Multilocation object)
134
- /*.feeAsset({symbol: 'symbol'} || {id: 'id'} || {multilocation: 'multilocation'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
135
- .xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
128
+ /*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
136
129
  .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
137
130
 
138
131
  const tx = await builder.build()
@@ -249,6 +242,37 @@ const tx = await builder.build()
249
242
  await builder.disconnect()
250
243
  ```
251
244
 
245
+ ### Local transfers
246
+ ```ts
247
+ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
248
+ .from(NODE)
249
+ .to(NODE) //Has to be same as origin (from)
250
+ .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}})
251
+ .address(address)
252
+
253
+ const tx = await builder.build()
254
+
255
+ //Make sure to disconnect API after it is no longer used (eg. after transaction)
256
+ await builder.disconnect()
257
+
258
+ /*
259
+ EXAMPLE:
260
+ const builder = Builder()
261
+ .from('Hydration')
262
+ .to('Hydration')
263
+ .currency({
264
+ symbol: 'DOT',
265
+ amount: '1000000000'
266
+ })
267
+ .address(address)
268
+
269
+ const tx = await builder.build()
270
+
271
+ //Disconnect API after TX
272
+ await builder.disconnect()
273
+ */
274
+ ```
275
+
252
276
  ### Asset queries:
253
277
 
254
278
  ```ts
package/dist/index.cjs CHANGED
@@ -532,6 +532,11 @@ var _transform = function transform(obj) {
532
532
  id: polkadotApi.FixedSizeBinary.fromHex(value.id)
533
533
  }
534
534
  };
535
+ } else if (key === 'Id') {
536
+ return {
537
+ type: key,
538
+ value: value
539
+ };
535
540
  } else if (key === 'OtherReserve') {
536
541
  return {
537
542
  type: key,
@@ -627,6 +632,10 @@ var _transform = function transform(obj) {
627
632
  newObj[k] = undefined;
628
633
  continue;
629
634
  }
635
+ if ((k === 'dest' || k === 'target') && typeof v === 'string') {
636
+ newObj[k] = v;
637
+ continue;
638
+ }
630
639
  if (typeof v === 'string' && v.startsWith('0x')) {
631
640
  newObj[k] = polkadotApi.FixedSizeBinary.fromHex(v);
632
641
  } else if (typeof v === 'string') {
package/dist/index.mjs CHANGED
@@ -531,6 +531,11 @@ var _transform = function transform(obj) {
531
531
  id: FixedSizeBinary.fromHex(value.id)
532
532
  }
533
533
  };
534
+ } else if (key === 'Id') {
535
+ return {
536
+ type: key,
537
+ value: value
538
+ };
534
539
  } else if (key === 'OtherReserve') {
535
540
  return {
536
541
  type: key,
@@ -626,6 +631,10 @@ var _transform = function transform(obj) {
626
631
  newObj[k] = undefined;
627
632
  continue;
628
633
  }
634
+ if ((k === 'dest' || k === 'target') && typeof v === 'string') {
635
+ newObj[k] = v;
636
+ continue;
637
+ }
629
638
  if (typeof v === 'string' && v.startsWith('0x')) {
630
639
  newObj[k] = FixedSizeBinary.fromHex(v);
631
640
  } else if (typeof v === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "8.10.0",
3
+ "version": "8.11.1",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "ethers": "^6.13.5",
27
27
  "viem": "^2.23.15",
28
28
  "@noble/hashes": "^1.7.1",
29
- "@paraspell/sdk-core": "8.10.0"
29
+ "@paraspell/sdk-core": "8.11.1"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "polkadot-api": ">= 1.9.7 < 2"