@paraspell/sdk-dedot 12.9.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ParaSpell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,499 @@
1
+ <br /><br />
2
+
3
+ <div align="center">
4
+ <h1 align="center">@paraspell/sdk-dedot</h1>
5
+ <h4 align="center"> SDK for handling XCM asset transfers across Polkadot, Kusama, Paseo and Westend ecosystems. </h4>
6
+ <p align="center">
7
+ <a href="https://npmjs.com/package/@paraspell/sdk-dedot">
8
+ <img alt="version" src="https://img.shields.io/npm/v/@paraspell/sdk-dedot?style=flat-square" />
9
+ </a>
10
+ <a href="https://npmjs.com/package/@paraspell/sdk-dedot">
11
+ <img alt="downloads" src="https://img.shields.io/npm/dm/@paraspell/sdk-dedot?style=flat-square" />
12
+ </a>
13
+ <a href="https://github.com/paraspell/xcm-sdk/actions">
14
+ <img alt="build" src="https://github.com/paraspell/xcm-tools/actions/workflows/ci.yml/badge.svg" />
15
+ </a>
16
+ <a href="https://snyk.io/test/github/paraspell/sdk">
17
+ <img alt="snyk" src="https://snyk.io/test/github/paraspell/sdk/badge.svg" />
18
+ </a>
19
+ </p>
20
+ <p>Supporting every XCM Active Parachain <a href = "https://paraspell.github.io/docs/supported.html"\>[list]</p>
21
+ <p>SDK documentation <a href = "https://paraspell.github.io/docs/" \>[here]</p>
22
+ </div>
23
+
24
+ <br /><br />
25
+ <br /><br />
26
+
27
+ ## Installation
28
+
29
+ ### Install dependencies
30
+
31
+ ParaSpell XCM SDK is the 🥇 in the ecosystem to support **PolkadotJS**, **Dedot** and **PolkadotAPI**.
32
+
33
+ **This version of SDK uses Dedot** if you wish to use **PolkadotAPI** version please reffer to [following package](https://github.com/paraspell/xcm-tools/tree/main/packages/sdk) or **PolkadotJS** please reffer to [following package](https://github.com/paraspell/xcm-tools/tree/main/packages/sdk-pjs).
34
+
35
+
36
+ ```bash
37
+ #Dedot peer dependencies
38
+ npm install | pnpm add | yarn add dedot @polkadot/keyring
39
+ ```
40
+
41
+ ### Install SDK
42
+
43
+ ```bash
44
+ npm install | pnpm add | yarn add @paraspell/sdk-dedot
45
+ ```
46
+
47
+ ### Importing package to your project
48
+
49
+ Named import:
50
+ ```ts
51
+ import { Builder } from '@paraspell/sdk-dedot'
52
+ ```
53
+
54
+ Default import:
55
+ ```ts
56
+ // ESM
57
+ import * as paraspell from '@paraspell/sdk-dedot'
58
+ ```
59
+
60
+
61
+ ## Implementation
62
+
63
+ ### Sending XCM
64
+ For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
65
+
66
+ #### Transfer assets from Substrate to Substrate
67
+
68
+ ```ts
69
+ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
70
+ .from(TSubstrateChain)
71
+ .to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
72
+ .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount /*Use "ALL" to transfer everything*/}, {currencySelection}, ..])
73
+ .address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
74
+ .senderAddress(address | {address, DEDOT_Signer}) // - OPTIONAL but strongly recommended as it is automatically ignored when not needed - Used when origin is AssetHub with feeAsset or when sending to AssetHub to prevent asset traps by auto-swapping to DOT to have DOT ED.
75
+ /*.ahAddress(ahAddress) - OPTIONAL - used when origin is EVM chain and XCM goes through AssetHub (Multihop transfer where we are unable to convert Key20 to ID32 address eg. origin: Moonbeam & destination: Ethereum (Multihop goes from Moonbeam > AssetHub > BridgeHub > Ethereum)
76
+ .feeAsset({symbol: 'symbol'} || {id: 'id'} || {location: 'location'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
77
+ .xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
78
+ .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some chain but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
79
+
80
+ const tx = await builder.build()
81
+ // Or if you use signers in senderAddress:
82
+ // await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
83
+
84
+ //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
85
+ await builder.disconnect()
86
+
87
+ /*
88
+ EXAMPLE:
89
+ const builder = Builder()
90
+ .from('AssetHubPolkadot')
91
+ .to('Polkadot')
92
+ .currency({
93
+ symbol: 'DOT',
94
+ amount: '1000000000'
95
+ })
96
+ .address(address)
97
+
98
+ const tx = await builder.build()
99
+
100
+ //Disconnect API after TX
101
+ await builder.disconnect()
102
+ */
103
+ ```
104
+
105
+ #### Local transfers
106
+
107
+ ```ts
108
+ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
109
+ .from(TSubstrateChain)
110
+ .to(TChain) //Has to be the same as the origin (from)
111
+ .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount /*Use "ALL" to transfer everything*/}, {currencySelection}, ..])
112
+ .address(address)
113
+ /* .keepAlive(bool) - Optional: Allows draining the account below the existential deposit. */
114
+
115
+
116
+ const tx = await builder.build()
117
+
118
+ //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
119
+ await builder.disconnect()
120
+
121
+ /*
122
+ EXAMPLE:
123
+ const builder = Builder()
124
+ .from('Hydration')
125
+ .to('Hydration')
126
+ .currency({
127
+ symbol: 'DOT',
128
+ amount: '1000000000'
129
+ })
130
+ .address(address)
131
+
132
+ const tx = await builder.build()
133
+
134
+ //Disconnect API after TX
135
+ await builder.disconnect()
136
+ */
137
+ ```
138
+
139
+ #### Transact
140
+
141
+ ```ts
142
+ const builder = Builder(/*client | builder_config | ws_url | [ws_url, ws_url,..] - Optional*/)
143
+ .from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
144
+ .to(TChain) // Has to be same as origin (from)
145
+ .currency(CURRENCY_SPEC) // Refer to currency spec options below
146
+ .senderAddress(senderAddress | PAPI SIGNER)
147
+ .address(address)
148
+ .transact(hex, /* originType, TWeight - Optional */)
149
+
150
+ const tx = await builder.build()
151
+ // Or if you use signers in senderAddress:
152
+ // await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
153
+
154
+ //Disconnect API after TX
155
+ await builder.disconnect()
156
+ ```
157
+
158
+ #### Dry run your XCM Calls:
159
+ ```ts
160
+ //Builder pattern
161
+ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
162
+ .from(TSubstrateChain)
163
+ .to(TChain)
164
+ .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | {[{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount /*Use "ALL" to transfer everything*/}]})
165
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
166
+ .address(ADDRESS)
167
+ .senderAddress(address | {address, DEDOT_Signer})
168
+ .dryRun()
169
+
170
+ //Check Parachain for DryRun support - returns true/false
171
+ import { hasDryRunSupport } from "@paraspell/sdk";
172
+
173
+ const result = hasDryRunSupport(chain)
174
+ ```
175
+
176
+ #### Dry run preview:
177
+ ```ts
178
+ //Builder pattern
179
+ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
180
+ .from(TSubstrateChain)
181
+ .to(TChain)
182
+ .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | {[{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount /*Use "ALL" to transfer everything*/}]})
183
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
184
+ .address(ADDRESS)
185
+ .senderAddress(address | {address, DEDOT_Signer})
186
+ .dryRunPreview(/*{ mintFeeAssets: true } - false by default - Mints fee assets also, if user does not have enough to cover fees on origin.*/)
187
+ ```
188
+
189
+ #### Batch calls
190
+
191
+ ```ts
192
+ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
193
+ .from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
194
+ .to(TChain2) //Any compatible Parachain
195
+ .currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
196
+ .address(address | Location object)
197
+ .addToBatch()
198
+
199
+ .from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
200
+ .to(TChain3) //Any compatible Parachain
201
+ .currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
202
+ .address(address | Location object)
203
+ .addToBatch()
204
+
205
+ const tx = await builder.buildBatch({
206
+ // This settings object is optional and batch all is the default option
207
+ mode: BatchMode.BATCH_ALL //or BatchMode.BATCH
208
+ })
209
+
210
+ //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
211
+ await builder.disconnect()
212
+ ```
213
+
214
+ #### Asset claim:
215
+
216
+ ```ts
217
+ //Claim XCM trapped assets from the selected chain
218
+ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
219
+ .claimfrom(TSubstrateChain)
220
+ .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount /*Use "ALL" to transfer everything*/}, {currencySelection}, ..]
221
+ )
222
+ .address(address | Location object)
223
+ /*.xcmVersion(Version.V3) Optional parameter, by default chain specific version. XCM Version ENUM if a different XCM version is needed (Supported V3 & V4 & V5). Requires importing Version enum.*/
224
+
225
+ const tx = await builder.build()
226
+
227
+ //Make sure to disconnect the API after it is no longer used (eg, after a transaction)
228
+ await builder.disconnect()
229
+ ```
230
+
231
+ ### Localhost test setup
232
+
233
+ ```ts
234
+ const builder = await Builder({
235
+ development: true, // Optional: Enforces overrides for all chains used
236
+ decimalAbstraction: true // Abstracts decimals, so 1 as input amount equals 10_000_000_000 if selected asset is DOT.
237
+ apiOverrides: {
238
+ Hydration: // "wsEndpointString" | papiClient
239
+ BridgeHubPolkadot: // "wsEndpointString" | papiClient
240
+ //ChainName: ...
241
+ }
242
+ })
243
+ .from(TSubstrateChain)
244
+ .to(TChain)
245
+ .currency({id: currencyID, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: currencySymbol, amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Native('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: Foreign('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {symbol: ForeignAbstract('currencySymbol'), amount: amount /*Use "ALL" to transfer everything*/} | {location: AssetLocationString, amount: amount /*Use "ALL" to transfer everything*/ | AssetLocationJson, amount: amount /*Use "ALL" to transfer everything*/} | {location: Override('Custom Location'), amount: amount /*Use "ALL" to transfer everything*/} | [{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount /*Use "ALL" to transfer everything*/}])
246
+ .address(address) //You can also use prederived accounts - //Alice, //Bob... //Alith, //Balthathar...
247
+ .senderAddress(address | {address, DEDOT_Signer}) //You can also use prederived accounts //Alice, //Bob... //Alith, //Balthathar...
248
+
249
+ const tx = await builder.build()
250
+ //Or if you use prederived account as senderAddress:
251
+ //await builder.signAndSubmit()
252
+
253
+ //Disconnect API after TX
254
+ await builder.disconnect()
255
+ ```
256
+
257
+ ### XCM Fee queries
258
+
259
+ For full documentation with output examples of XCM Fee queries, head to [official documentation](https://paraspell.github.io/docs/sdk/xcmUtils.html).
260
+
261
+ #### XCM Fee (Origin and Dest.)
262
+
263
+ ```ts
264
+ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
265
+ .from(TSubstrateChain)
266
+ .to(TChain)
267
+ .currency(CURRENCY_SPEC)
268
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
269
+ .address(RECIPIENT_ADDRESS)
270
+ .senderAddress(address | {address, DEDOT_Signer})
271
+ .getXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of a DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin or Destination chain do not support DryRun out of the box.
272
+ ```
273
+
274
+ #### XCM Fee (Origin only)
275
+
276
+ ```ts
277
+ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
278
+ .from(TSubstrateChain)
279
+ .to(TChain)
280
+ .currency(CURRENCY_SPEC)
281
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
282
+ .address(RECIPIENT_ADDRESS)
283
+ .senderAddress(address | {address, DEDOT_Signer})
284
+ .getOriginXcmFee(/*{disableFallback: true / false}*/) //Fallback is optional. When fallback is disabled, you only get notified of a DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin do not support DryRun out of the box.
285
+ ```
286
+
287
+ #### XCM Transfer info
288
+ ```ts
289
+ const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
290
+ .from(TSubstrateChain)
291
+ .to(TChain)
292
+ .currency(CURRENCY_SPEC)
293
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
294
+ .address(RECIPIENT_ADDRESS)
295
+ .senderAddress(address | {address, DEDOT_Signer})
296
+ .getTransferInfo()
297
+ ```
298
+
299
+ #### Transferable amount
300
+ ```ts
301
+ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
302
+ .from(TSubstrateChain)
303
+ .to(TChain)
304
+ .currency(CURRENCY_SPEC)
305
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
306
+ .address(RECIPIENT_ADDRESS)
307
+ .senderAddress(address | {address, DEDOT_Signer})
308
+ .getTransferableAmount()
309
+ ```
310
+
311
+ #### Minimal transferable amount
312
+ ```ts
313
+ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
314
+ .from(TSubstrateChain)
315
+ .to(TChain)
316
+ .currency(CURRENCY_SPEC)
317
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
318
+ .address(RECIPIENT_ADDRESS)
319
+ .senderAddress(address | {address, DEDOT_Signer})
320
+ .getMinTransferableAmount()
321
+ ```
322
+
323
+ #### Receivable amount
324
+ ```ts
325
+ const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
326
+ .from(TSubstrateChain)
327
+ .to(TChain)
328
+ .currency(CURRENCY_SPEC)
329
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
330
+ .address(RECIPIENT_ADDRESS)
331
+ .senderAddress(address | {address, DEDOT_Signer})
332
+ .getReceivableAmount()
333
+ ```
334
+
335
+ #### Verify ED on destination
336
+ ```ts
337
+ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
338
+ .from(TSubstrateChain)
339
+ .to(TChain)
340
+ .currency(CURRENCY_SPEC)
341
+ /*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
342
+ .address(RECIPIENT_ADDRESS)
343
+ .senderAddress(address | {address, DEDOT_Signer})
344
+ .verifyEdOnDestination()
345
+ ```
346
+
347
+ #### Asset balance
348
+ ```ts
349
+ import { getBalance } from "@paraspell/sdk-dedot";
350
+
351
+ //Retrieves the asset balance for a given account on a specified chain (You do not need to specify if it is native or foreign).
352
+ const balance = await getBalance({ADDRESS, TChain, CURRENCY_SPEC /*- {id: currencyID} | {symbol: currencySymbol} | {symbol: Native('currencySymbol')} | {symbol: Foreign('currencySymbol')} | {symbol: ForeignAbstract('currencySymbol')} | {location: AssetLocationString | AssetLocationJson}*/, api /* api/ws_url_string optional */});
353
+ ```
354
+
355
+ #### Ethereum bridge fees
356
+ ```ts
357
+ import { getParaEthTransferFees } from "@paraspell/sdk-dedot";
358
+
359
+ const fees = await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
360
+ ```
361
+
362
+ #### Existential deposit queries
363
+ ```ts
364
+ import { getExistentialDeposit } from "@paraspell/sdk-dedot";
365
+
366
+ //Currency is an optional parameter. If you wish to query native asset, currency parameter is not necessary.
367
+ //Currency can be either {symbol: assetSymbol}, {id: assetId}, {location: assetLocation}.
368
+ const ed = getExistentialDeposit(Tchain, CURRENCY_SPEC?)
369
+ ```
370
+
371
+ #### Convert SS58 address
372
+ ```ts
373
+ import { convertSs58 } from "@paraspell/sdk-dedot";
374
+
375
+ let result = convertSs58(ADDRESS, TChain) // returns converted address in string
376
+ ```
377
+
378
+ ### Asset queries:
379
+
380
+ For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
381
+
382
+ ```ts
383
+ import { getSupportedDestinations, getFeeAssets, getAssetsObject, getAssetId, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, hasSupportForAsset, getAssetDecimals, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk-dedot'
384
+
385
+ //Get chains that support the specific asset related to origin
386
+ getSupportedDestinations(TChain, CURRENCY)
387
+
388
+ //Get reserve chain for specific asset on specific chain
389
+ getAssetReserveChain(chain: TSubstrateChain, location: TLocation)
390
+
391
+ //Find out whether asset is registered on chain and return its entire parameters. If not found, returns null.
392
+ findAssetInfo(TChain, CURRENCY, DESTINATION?)
393
+
394
+ //Find out whether asset is registered on chain and return its entire parameters. If not found, returns error.
395
+ findAssetInfoOrThrow(TChain, CURRENCY, DESTINATION?)
396
+
397
+ // Retrieve Fee asset queries (Assets accepted as XCM Fee on specific chain)
398
+ getFeeAssets(TChain)
399
+
400
+ // Get Location for asset ID or symbol on a specific chain
401
+ getAssetLocation(TChain, { symbol: symbol } | { id: assetId })
402
+
403
+ // Retrieve assets object from assets.json for a particular chain, including information about native and foreign assets
404
+ getAssetsObject(TChain)
405
+
406
+ // Retrieve foreign assetId for a particular chain and asset symbol
407
+ getAssetId(TChain, ASSET_SYMBOL)
408
+
409
+ // Retrieve the symbol of the relay chain for a particular chain. Either "DOT" or "KSM"
410
+ getRelayChainSymbol(TChain)
411
+
412
+ // Retrieve string array of native assets symbols for a particular chain
413
+ getNativeAssets(TChain)
414
+
415
+ // Retrieve object array of foreign assets for a particular chain. Each object has a symbol and an assetId property
416
+ getOtherAssets(TChain)
417
+
418
+ // Retrieve string array of all asset symbols. (native and foreign assets are merged into a single array)
419
+ getAllAssetsSymbols(TChain)
420
+
421
+ // Check if a chain supports a particular asset. (Both native and foreign assets are searched). Returns boolean
422
+ hasSupportForAsset(TChain, ASSET_SYMBOL)
423
+
424
+ // Get decimals for specific asset
425
+ getAssetDecimals(TChain, ASSET_SYMBOL)
426
+
427
+ // Get specific chain id
428
+ getParaId(TChain)
429
+
430
+ // Get specific TChain from chainID
431
+ getTChain(paraID: number, ecosystem: 'Polkadot' | 'Kusama' | 'Ethereum' | 'Paseo' | 'Westend') //When the Ethereum ecosystem is selected, please fill chainID as 1 to select Ethereum.
432
+
433
+ // Import all compatible chains as constant
434
+ CHAINS
435
+ ```
436
+
437
+ ### Parachain XCM Pallet queries
438
+
439
+ For full documentation with output examples of pallet queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/NodePallets.html).
440
+
441
+ ```ts
442
+ import { getDefaultPallet, getSupportedPallets, getPalletIndex, getNativeAssetsPallet, getOtherAssetsPallets, SUPPORTED_PALLETS } from '@paraspell/sdk-dedot';
443
+
444
+ //Retrieve default pallet for specific Parachain
445
+ getDefaultPallet(chain: TChain)
446
+
447
+ // Returns an array of supported pallets for a specific Parachain
448
+ getSupportedPallets(chain: TChain)
449
+
450
+ //Returns index of XCM Pallet used by Parachain
451
+ getPalletIndex(chain: TChain)
452
+
453
+ //Returns all pallets for local transfers of native assets for specific chain.
454
+ getNativeAssetsPallet(chain: TChain)
455
+
456
+ //Returns all pallets for local transfers of foreign assets for specific chain.
457
+ getOtherAssetsPallets(chain: TChain)
458
+
459
+ // Print all pallets that are currently supported
460
+ console.log(SUPPORTED_PALLETS)
461
+ ```
462
+
463
+ ## 💻 Tests
464
+ - Run compilation using `pnpm compile`
465
+
466
+ - Run linter using `pnpm lint`
467
+
468
+ - Run unit tests using `pnpm test`
469
+
470
+ - Run all core tests and checks using `pnpm runAll`
471
+
472
+ > [!NOTE]
473
+ > XCM SDK can be tested in [Playground](https://playground.paraspell.xyz/xcm-sdk/xcm-transfer).
474
+
475
+ ## Contribute to XCM Tools and earn rewards 💰
476
+
477
+ We run an open Bug Bounty Program that rewards contributors for reporting and fixing bugs in the project. More information on bug bounty can be found in the [official documentation](https://paraspell.github.io/docs/contribution.html).
478
+
479
+ ## Get Support 🚑
480
+
481
+ - Contact form on our [landing page](https://paraspell.xyz/#contact-us).
482
+ - Message us on our [X](https://x.com/paraspell).
483
+ - Support channel on [telegram](https://t.me/paraspell).
484
+
485
+ ## License
486
+
487
+ Made with 💛 by [ParaSpell✨](https://paraspell.xyz/)
488
+
489
+ Published under [MIT License](https://github.com/paraspell/xcm-tools/blob/main/packages/sdk/LICENSE).
490
+
491
+ ## Supported by
492
+
493
+ <p align="center">
494
+ <picture>
495
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_transparent.png">
496
+ <source media="(prefers-color-scheme: light)" srcset="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_w3f_standard.png">
497
+ <img width="750" alt="Shows a black logo in light color mode and a white one in dark color mode." src="https://github.com/paraspell/presskit/blob/main/logos_supporters/polkadot_kusama_w3f_standard.png">
498
+ </picture>
499
+ </p>
@@ -0,0 +1,117 @@
1
+ import * as _paraspell_sdk_core from '@paraspell/sdk-core';
2
+ import { TApiOrUrl, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TBuilderOptions, GeneralBuilder as GeneralBuilder$1, TSendBaseOptions } from '@paraspell/sdk-core';
3
+ export * from '@paraspell/sdk-core';
4
+ import { DedotClient as DedotClient$1 } from 'dedot';
5
+ import { GenericSubstrateApi as GenericSubstrateApi$1, ChainSubmittableExtrinsic as ChainSubmittableExtrinsic$1, IKeyringPair as IKeyringPair$1 } from 'dedot/types';
6
+
7
+ type TDedotApi = DedotClient$1<GenericSubstrateApi$1>;
8
+ type TDedotApiOrUrl = TApiOrUrl<TDedotApi>;
9
+ type TDedotExtrinsic = ChainSubmittableExtrinsic$1;
10
+ type TDedotSigner = IKeyringPair$1;
11
+
12
+ /**
13
+ * Retrieves the asset balance for a given account on a specified chain.
14
+ *
15
+ * @returns The asset balance as a bigint.
16
+ */
17
+ declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions & {
18
+ currency?: _paraspell_sdk_core.TCurrencyCore;
19
+ } & {
20
+ api?: TDedotApiOrUrl;
21
+ }) => Promise<bigint>;
22
+ /**
23
+ * Claims assets from a parachain.
24
+ *
25
+ * @returns An extrinsic representing the claim transaction.
26
+ */
27
+ declare const claimAssets: (options: _paraspell_sdk_core.TAssetClaimOptionsBase & {
28
+ api?: TDedotApiOrUrl;
29
+ }) => Promise<ChainSubmittableExtrinsic>;
30
+
31
+ declare const assets_Foreign: typeof Foreign;
32
+ declare const assets_ForeignAbstract: typeof ForeignAbstract;
33
+ declare const assets_Native: typeof Native;
34
+ declare const assets_Override: typeof Override;
35
+ declare const assets_claimAssets: typeof claimAssets;
36
+ declare const assets_findAssetInfo: typeof findAssetInfo;
37
+ declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
38
+ declare const assets_getAssetDecimals: typeof getAssetDecimals;
39
+ declare const assets_getAssetId: typeof getAssetId;
40
+ declare const assets_getAssets: typeof getAssets;
41
+ declare const assets_getAssetsObject: typeof getAssetsObject;
42
+ declare const assets_getBalance: typeof getBalance;
43
+ declare const assets_getExistentialDeposit: typeof getExistentialDeposit;
44
+ declare const assets_getNativeAssetSymbol: typeof getNativeAssetSymbol;
45
+ declare const assets_getNativeAssets: typeof getNativeAssets;
46
+ declare const assets_getOtherAssets: typeof getOtherAssets;
47
+ declare const assets_getRelayChainSymbol: typeof getRelayChainSymbol;
48
+ declare const assets_getSupportedAssets: typeof getSupportedAssets;
49
+ declare const assets_getTChain: typeof getTChain;
50
+ declare const assets_hasSupportForAsset: typeof hasSupportForAsset;
51
+ declare const assets_isChainEvm: typeof isChainEvm;
52
+ declare namespace assets {
53
+ export {
54
+ assets_Foreign as Foreign,
55
+ assets_ForeignAbstract as ForeignAbstract,
56
+ assets_Native as Native,
57
+ assets_Override as Override,
58
+ assets_claimAssets as claimAssets,
59
+ assets_findAssetInfo as findAssetInfo,
60
+ assets_getAllAssetsSymbols as getAllAssetsSymbols,
61
+ assets_getAssetDecimals as getAssetDecimals,
62
+ assets_getAssetId as getAssetId,
63
+ assets_getAssets as getAssets,
64
+ assets_getAssetsObject as getAssetsObject,
65
+ assets_getBalance as getBalance,
66
+ assets_getExistentialDeposit as getExistentialDeposit,
67
+ assets_getNativeAssetSymbol as getNativeAssetSymbol,
68
+ assets_getNativeAssets as getNativeAssets,
69
+ assets_getOtherAssets as getOtherAssets,
70
+ assets_getRelayChainSymbol as getRelayChainSymbol,
71
+ assets_getSupportedAssets as getSupportedAssets,
72
+ assets_getTChain as getTChain,
73
+ assets_hasSupportForAsset as hasSupportForAsset,
74
+ assets_isChainEvm as isChainEvm,
75
+ };
76
+ }
77
+
78
+ declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
79
+
80
+ /**
81
+ * Creates a new Builder instance using the Dedot client.
82
+ *
83
+ * @param api - The API instance or options to use for building transactions.
84
+ * @returns A new Builder instance.
85
+ */
86
+ declare const Builder: (api?: TBuilderOptions<TDedotApiOrUrl>) => GeneralBuilder$1<DedotClient<GenericSubstrateApi>, ChainSubmittableExtrinsic, IKeyringPair, object>;
87
+ type GeneralBuilder<T extends Partial<TSendBaseOptions<TDedotApi, TDedotExtrinsic, TDedotSigner>> = object> = GeneralBuilder$1<TDedotApi, TDedotExtrinsic, TDedotSigner, T>;
88
+
89
+ declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<ChainSubmittableExtrinsic> & {
90
+ api?: TDedotApiOrUrl;
91
+ }) => Promise<_paraspell_sdk_core.TDryRunResult>;
92
+ declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<ChainSubmittableExtrinsic> & {
93
+ api?: TDedotApiOrUrl;
94
+ }) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
95
+ declare const getParaEthTransferFees: (api?: TDedotApiOrUrl) => Promise<[bigint, bigint]>;
96
+ /**
97
+ * Gets the Ethereum bridge status.
98
+ */
99
+ declare const getBridgeStatus: (api?: TDedotApiOrUrl) => Promise<_paraspell_sdk_core.TBridgeStatus>;
100
+
101
+ declare const transfer_dryRun: typeof dryRun;
102
+ declare const transfer_dryRunOrigin: typeof dryRunOrigin;
103
+ declare const transfer_getBridgeStatus: typeof getBridgeStatus;
104
+ declare const transfer_getParaEthTransferFees: typeof getParaEthTransferFees;
105
+ declare namespace transfer {
106
+ export {
107
+ transfer_dryRun as dryRun,
108
+ transfer_dryRunOrigin as dryRunOrigin,
109
+ transfer_getBridgeStatus as getBridgeStatus,
110
+ transfer_getParaEthTransferFees as getParaEthTransferFees,
111
+ };
112
+ }
113
+
114
+ declare const createChainClient: (chain: TSubstrateChain, builderOptions?: TBuilderOptions<TDedotApiOrUrl>) => Promise<DedotClient<GenericSubstrateApi>>;
115
+
116
+ export { Builder, assets, claimAssets, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, transfer as xcmPallet };
117
+ export type { GeneralBuilder, TDedotApi, TDedotApiOrUrl, TDedotExtrinsic, TDedotSigner };