@paraspell/sdk 6.2.3 → 7.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
@@ -26,31 +26,57 @@
26
26
  <br /><br />
27
27
  ## Installation
28
28
 
29
- #### Install dependencies
29
+ ### Install dependencies
30
+
31
+ Install peer dependencies according to the choice of API package.
32
+
33
+ ParaSpell XCM SDK is the 🥇 in the ecosystem to support both **PolkadotJS** and **PolkadotAPI**.
34
+
35
+ ```
36
+ NOTE: Make sure to set PeerDependencyInstall flag to false on your package manager (Because it will install both API packages instead of just one)
37
+ For example on PNPM: `pnpm config set auto-install-peers false`
38
+ ```
30
39
 
31
40
  ```bash
41
+ #NOTE: apps-config will soon be removed entirely from the peer dependency list
42
+
43
+ #Choose a package and install its dependencies below (SDK is built in a way, that only one library has to be installed)
44
+
45
+ #Polkadot API peer dependencies
46
+ pnpm | npm install || yarn add polkadot-api @polkadot/apps-config
47
+
48
+ #PolkadotJS peer dependencies
32
49
  pnpm | npm install || yarn add @polkadot/api @polkadot/types @polkadot/api-base @polkadot/apps-config @polkadot/util
33
50
  ```
34
51
 
35
- #### Install SDK
52
+ ### Install SDK
36
53
 
37
54
  ```bash
38
55
  pnpm | npm install || yarn add @paraspell/sdk
39
56
  ```
40
57
 
41
- #### Importing package to your project:
58
+ ### Importing package to your project
42
59
 
43
60
  Builder pattern:
44
61
  ```js
62
+ // Polkadot API version
63
+ import { Builder } from '@paraspell/sdk/papi'
64
+
65
+ // Polkadot JS version
45
66
  import { Builder } from '@paraspell/sdk'
46
67
  ```
47
68
 
48
69
  Other patterns:
49
70
  ```js
50
- // ESM
71
+ // ESM PAPI
72
+ import * as paraspell from '@paraspell/sdk/papi'
73
+ // ESM PJS
51
74
  import * as paraspell from '@paraspell/sdk'
52
75
 
53
- // CommonJS
76
+ // CommonJS PAPI
77
+ const paraspell = require('@paraspell/sdk/papi')
78
+
79
+ // CommonJS PJS
54
80
  const paraspell = require('@paraspell/sdk')
55
81
  ```
56
82
 
@@ -263,7 +289,10 @@ paraspell.NODE_NAMES
263
289
 
264
290
  ### Parachain XCM Pallet queries
265
291
  ```ts
292
+ //PJS
266
293
  import { getDefaultPallet, getSupportedPallets, SUPPORTED_PALLETS } from '@paraspell/sdk'
294
+ //PAPI
295
+ import { getDefaultPallet, getSupportedPallets, SUPPORTED_PALLETS } from '@paraspell/sdk/papi'
267
296
 
268
297
  //Retrieve default pallet for specific Parachain
269
298
  getDefaultPallet(node: TNode)
@@ -277,14 +306,20 @@ console.log(SUPPORTED_PALLETS)
277
306
 
278
307
  ### Existential deposit queries
279
308
  ```ts
309
+ //PJS
280
310
  import { getExistentialDeposit } from "@paraspell/sdk";
311
+ //PAPI
312
+ import { getExistentialDeposit } from "@paraspell/sdk/papi";
281
313
 
282
314
  const ed = getExistentialDeposit('Acala')
283
315
  ```
284
316
 
285
317
  ### XCM Transfer info
286
318
  ```ts
287
- import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk";
319
+ //PJS
320
+ import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk";
321
+ //PAPI
322
+ import { getTransferInfo, getBalanceForeign, getBalanceNative, getOriginFeeDetails } from "@paraspell/sdk/papi";
288
323
 
289
324
  //Get balance of foreign currency
290
325
  await getBalanceForeign(address, Parachain name, currency /*- {id: currencyID} | {symbol: currencySymbol}*/)