@paraspell/sdk-dedot 12.9.7 → 12.10.0-rc.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 +95 -46
- package/dist/index.d.ts +11 -22
- package/dist/index.mjs +279 -287
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -44,7 +44,33 @@ npm install | pnpm add | yarn add dedot @polkadot/keyring
|
|
|
44
44
|
npm install | pnpm add | yarn add @paraspell/sdk-dedot
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
###
|
|
47
|
+
### Install Swap extension
|
|
48
|
+
|
|
49
|
+
If you plan to [do Swap XCMs](https://paraspell.github.io/docs/sdk/xcmPallet.html#swap) you can install Swap package which allows you to do cross-chain swaps on popular Polkadot, Kusama, Paseo, Westend exchanges. Now available in all JS client versions of SDK.
|
|
50
|
+
|
|
51
|
+
> [!IMPORTANT]
|
|
52
|
+
> - ⚠️ **WebAssembly (Wasm) must be enabled in your project** because of the Hydration SDK (One of the exchanges implemented in XCM Router). Wasm can be enabled either through the web application configuration or through the appropriate plugin.
|
|
53
|
+
>
|
|
54
|
+
> - ⚠️ Additionally, Hydration requires the use of the **augment package** (see: https://github.com/galacticcouncil/sdk/issues/114).
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install | pnpm add | yarn add @paraspell/swap @galacticcouncil/api-augment
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Setup Swap extension
|
|
61
|
+
|
|
62
|
+
Add the `@paraspell/swap` import to your application's root component (Usually `App.tsx`). This ensures the extension is registered before using Builder.
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
// Import swap extension here
|
|
66
|
+
import '@paraspell/swap';
|
|
67
|
+
|
|
68
|
+
export default function App() {
|
|
69
|
+
return {/* Your app here */};
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Importing SDK Functionality
|
|
48
74
|
|
|
49
75
|
Named import:
|
|
50
76
|
```ts
|
|
@@ -59,6 +85,11 @@ import * as paraspell from '@paraspell/sdk-dedot'
|
|
|
59
85
|
|
|
60
86
|
|
|
61
87
|
## Implementation
|
|
88
|
+
|
|
89
|
+
> **Latest news:**
|
|
90
|
+
> - V12 > V13 Migration guide: https://paraspell.github.io/docs/migration/v12-to-v13.html
|
|
91
|
+
> - Swap package is now available on every XCM SDK version: https://paraspell.github.io/docs/sdk/getting-started.html#install-swap-extension
|
|
92
|
+
> - abstractDecimals is now turned on by default!
|
|
62
93
|
|
|
63
94
|
### Sending XCM
|
|
64
95
|
For full documentation on XCM Transfers head over to [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html).
|
|
@@ -70,15 +101,15 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
70
101
|
.from(TSubstrateChain)
|
|
71
102
|
.to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
|
|
72
103
|
.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
|
-
.
|
|
74
|
-
.
|
|
104
|
+
.recipient(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
|
|
105
|
+
.sender(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
106
|
/*.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
107
|
.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
108
|
.xcmVersion(Version.V3/V4/V5) //Optional parameter for manual override of XCM Version used in call
|
|
78
109
|
.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
110
|
|
|
80
111
|
const tx = await builder.build()
|
|
81
|
-
// Or if you use signers in
|
|
112
|
+
// Or if you use signers in sender:
|
|
82
113
|
// await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
|
|
83
114
|
|
|
84
115
|
//Make sure to disconnect the API after it is no longer used (eg, after a transaction)
|
|
@@ -91,9 +122,9 @@ const builder = Builder()
|
|
|
91
122
|
.to('Polkadot')
|
|
92
123
|
.currency({
|
|
93
124
|
symbol: 'DOT',
|
|
94
|
-
amount: '
|
|
125
|
+
amount: '1'
|
|
95
126
|
})
|
|
96
|
-
.
|
|
127
|
+
.recipient(address)
|
|
97
128
|
|
|
98
129
|
const tx = await builder.build()
|
|
99
130
|
|
|
@@ -109,7 +140,7 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
109
140
|
.from(TSubstrateChain)
|
|
110
141
|
.to(TChain) //Has to be the same as the origin (from)
|
|
111
142
|
.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
|
-
.
|
|
143
|
+
.recipient(address)
|
|
113
144
|
/* .keepAlive(bool) - Optional: Allows draining the account below the existential deposit. */
|
|
114
145
|
|
|
115
146
|
|
|
@@ -125,9 +156,9 @@ const builder = Builder()
|
|
|
125
156
|
.to('Hydration')
|
|
126
157
|
.currency({
|
|
127
158
|
symbol: 'DOT',
|
|
128
|
-
amount: '
|
|
159
|
+
amount: '1'
|
|
129
160
|
})
|
|
130
|
-
.
|
|
161
|
+
.recipient(address)
|
|
131
162
|
|
|
132
163
|
const tx = await builder.build()
|
|
133
164
|
|
|
@@ -143,18 +174,45 @@ const builder = Builder(/*client | builder_config | ws_url | [ws_url, ws_url,..]
|
|
|
143
174
|
.from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
|
|
144
175
|
.to(TChain) // Has to be same as origin (from)
|
|
145
176
|
.currency(CURRENCY_SPEC) // Refer to currency spec options below
|
|
146
|
-
.
|
|
147
|
-
.
|
|
177
|
+
.sender(sender | PAPI SIGNER)
|
|
178
|
+
.recipient(address)
|
|
148
179
|
.transact(hex, /* originType, TWeight - Optional */)
|
|
149
180
|
|
|
150
181
|
const tx = await builder.build()
|
|
151
|
-
// Or if you use signers in
|
|
182
|
+
// Or if you use signers in sender:
|
|
152
183
|
// await builder.signAndSubmit() - Signs and submits the transaction; returns TX hash for tracking
|
|
153
184
|
|
|
154
185
|
//Disconnect API after TX
|
|
155
186
|
await builder.disconnect()
|
|
156
187
|
```
|
|
157
188
|
|
|
189
|
+
#### Swap
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
const builder = Builder(/*client | builder_config |ws_url | [ws_url, ws_url,..] - Optional*/)
|
|
193
|
+
.from(TSubstrateChain) // 'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
|
|
194
|
+
.to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/) //'AssetHubPolkadot' | 'Hydration' | 'Moonbeam' | 'Polkadot' | ... https://paraspell.github.io/docs/sdk/AssetPallet.html#import-chains-as-types
|
|
195
|
+
.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*/})
|
|
196
|
+
.recipient(address | Location object /*If you are sending through xTokens, you need to pass the destination and address location in one object (x2)*/)
|
|
197
|
+
.sender(address | PAPI_SIGNER /*Only in PAPI SDK*/ | {address, PJS_SIGNER} /*Only in PJS SDK*/) // - OPTIONAL but strongly recommended as it is automatically ignored when not needed - Used when origin is AssetHub/Hydration with feeAsset or when sending to AssetHub to prevent asset traps by auto-swapping to DOT to have DOT ED.
|
|
198
|
+
.swap({
|
|
199
|
+
currencyTo: {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*/}
|
|
200
|
+
// exchange: ['AssetHubPolkadotDex'], - Optional parameter - 'HydrationDex' | 'AcalaDex' | 'AssetHubPolkadotDex' | ...
|
|
201
|
+
// slippage: 1, - Optional - 1 by default
|
|
202
|
+
// evmsender: '0x000', - Optional parameter when origin CHAIN is EVM based (Required with evmSigner)
|
|
203
|
+
// evmSigner: Signer, - Optional parameter when origin CHAIN is EVM based (Required with evmInjectorAddress)
|
|
204
|
+
// onStatusChange: (event) => void - Optional parameter for callback events when sender address is supplied as signer
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
const tx = await builder.buildAll()
|
|
208
|
+
// Or if you use signers in sender:
|
|
209
|
+
// await builder.signAndSubmit() - Signs and submits the transaction (only working in 1click scenarios); returns TX hash for tracking
|
|
210
|
+
// await builder.signAndSubmitAll() - Signs and submits transactions (required in 2click scenarios); returns array of TX hashes for tracking
|
|
211
|
+
|
|
212
|
+
// Make sure to disconnect API after it is no longer used (eg. after transaction)
|
|
213
|
+
await builder.disconnect()
|
|
214
|
+
```
|
|
215
|
+
|
|
158
216
|
#### Dry run your XCM Calls:
|
|
159
217
|
```ts
|
|
160
218
|
//Builder pattern
|
|
@@ -163,8 +221,8 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
|
|
|
163
221
|
.to(TChain)
|
|
164
222
|
.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
223
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
166
|
-
.
|
|
167
|
-
.
|
|
224
|
+
.recipient(ADDRESS)
|
|
225
|
+
.sender(address | {address, DEDOT_Signer})
|
|
168
226
|
.dryRun()
|
|
169
227
|
|
|
170
228
|
//Check Parachain for DryRun support - returns true/false
|
|
@@ -181,8 +239,8 @@ const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_arr
|
|
|
181
239
|
.to(TChain)
|
|
182
240
|
.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
241
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
184
|
-
.
|
|
185
|
-
.
|
|
242
|
+
.recipient(ADDRESS)
|
|
243
|
+
.sender(address | {address, DEDOT_Signer})
|
|
186
244
|
.dryRunPreview(/*{ mintFeeAssets: true } - false by default - Mints fee assets also, if user does not have enough to cover fees on origin.*/)
|
|
187
245
|
```
|
|
188
246
|
|
|
@@ -193,13 +251,13 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
193
251
|
.from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
194
252
|
.to(TChain2) //Any compatible Parachain
|
|
195
253
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
196
|
-
.
|
|
254
|
+
.recipient(address | Location object)
|
|
197
255
|
.addToBatch()
|
|
198
256
|
|
|
199
257
|
.from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
200
258
|
.to(TChain3) //Any compatible Parachain
|
|
201
259
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
202
|
-
.
|
|
260
|
+
.recipient(address | Location object)
|
|
203
261
|
.addToBatch()
|
|
204
262
|
|
|
205
263
|
const tx = await builder.buildBatch({
|
|
@@ -219,7 +277,7 @@ const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
219
277
|
.claimfrom(TSubstrateChain)
|
|
220
278
|
.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
279
|
)
|
|
222
|
-
.
|
|
280
|
+
.recipient(address | Location object)
|
|
223
281
|
/*.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
282
|
|
|
225
283
|
const tx = await builder.build()
|
|
@@ -243,11 +301,11 @@ const builder = await Builder({
|
|
|
243
301
|
.from(TSubstrateChain)
|
|
244
302
|
.to(TChain)
|
|
245
303
|
.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
|
-
.
|
|
247
|
-
.
|
|
304
|
+
.recipient(address) //You can also use prederived accounts - //Alice, //Bob... //Alith, //Balthathar...
|
|
305
|
+
.sender(address | {address, DEDOT_Signer}) //You can also use prederived accounts //Alice, //Bob... //Alith, //Balthathar...
|
|
248
306
|
|
|
249
307
|
const tx = await builder.build()
|
|
250
|
-
//Or if you use prederived account as
|
|
308
|
+
//Or if you use prederived account as sender:
|
|
251
309
|
//await builder.signAndSubmit()
|
|
252
310
|
|
|
253
311
|
//Disconnect API after TX
|
|
@@ -266,8 +324,8 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
266
324
|
.to(TChain)
|
|
267
325
|
.currency(CURRENCY_SPEC)
|
|
268
326
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
269
|
-
.
|
|
270
|
-
.
|
|
327
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
328
|
+
.sender(address | {address, DEDOT_Signer})
|
|
271
329
|
.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
330
|
```
|
|
273
331
|
|
|
@@ -279,8 +337,8 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
279
337
|
.to(TChain)
|
|
280
338
|
.currency(CURRENCY_SPEC)
|
|
281
339
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
282
|
-
.
|
|
283
|
-
.
|
|
340
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
341
|
+
.sender(address | {address, DEDOT_Signer})
|
|
284
342
|
.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
343
|
```
|
|
286
344
|
|
|
@@ -291,8 +349,8 @@ const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
291
349
|
.to(TChain)
|
|
292
350
|
.currency(CURRENCY_SPEC)
|
|
293
351
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
294
|
-
.
|
|
295
|
-
.
|
|
352
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
353
|
+
.sender(address | {address, DEDOT_Signer})
|
|
296
354
|
.getTransferInfo()
|
|
297
355
|
```
|
|
298
356
|
|
|
@@ -303,8 +361,8 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
|
|
|
303
361
|
.to(TChain)
|
|
304
362
|
.currency(CURRENCY_SPEC)
|
|
305
363
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
306
|
-
.
|
|
307
|
-
.
|
|
364
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
365
|
+
.sender(address | {address, DEDOT_Signer})
|
|
308
366
|
.getTransferableAmount()
|
|
309
367
|
```
|
|
310
368
|
|
|
@@ -315,8 +373,8 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
|
|
|
315
373
|
.to(TChain)
|
|
316
374
|
.currency(CURRENCY_SPEC)
|
|
317
375
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
318
|
-
.
|
|
319
|
-
.
|
|
376
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
377
|
+
.sender(address | {address, DEDOT_Signer})
|
|
320
378
|
.getMinTransferableAmount()
|
|
321
379
|
```
|
|
322
380
|
|
|
@@ -327,8 +385,8 @@ const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url
|
|
|
327
385
|
.to(TChain)
|
|
328
386
|
.currency(CURRENCY_SPEC)
|
|
329
387
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
330
|
-
.
|
|
331
|
-
.
|
|
388
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
389
|
+
.sender(address | {address, DEDOT_Signer})
|
|
332
390
|
.getReceivableAmount()
|
|
333
391
|
```
|
|
334
392
|
|
|
@@ -339,8 +397,8 @@ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
339
397
|
.to(TChain)
|
|
340
398
|
.currency(CURRENCY_SPEC)
|
|
341
399
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
342
|
-
.
|
|
343
|
-
.
|
|
400
|
+
.recipient(RECIPIENT_ADDRESS)
|
|
401
|
+
.sender(address | {address, DEDOT_Signer})
|
|
344
402
|
.verifyEdOnDestination()
|
|
345
403
|
```
|
|
346
404
|
|
|
@@ -380,7 +438,7 @@ let result = convertSs58(ADDRESS, TChain) // returns converted address in string
|
|
|
380
438
|
For full documentation with output examples of asset queries, head over to [official documentation](https://paraspell.github.io/docs/sdk/AssetPallet.html).
|
|
381
439
|
|
|
382
440
|
```ts
|
|
383
|
-
import { getSupportedDestinations, getFeeAssets, getAssetsObject,
|
|
441
|
+
import { getSupportedDestinations, getFeeAssets, getAssetsObject, getRelayChainSymbol, getNativeAssets, getNativeAssets, getOtherAssets, getAllAssetsSymbols, getParaId, getTChain, getAssetLocation, CHAINS, findAssetInfo, findAssetInfoOrThrow } from '@paraspell/sdk-dedot'
|
|
384
442
|
|
|
385
443
|
//Get chains that support the specific asset related to origin
|
|
386
444
|
getSupportedDestinations(TChain, CURRENCY)
|
|
@@ -403,9 +461,6 @@ getAssetLocation(TChain, { symbol: symbol } | { id: assetId })
|
|
|
403
461
|
// Retrieve assets object from assets.json for a particular chain, including information about native and foreign assets
|
|
404
462
|
getAssetsObject(TChain)
|
|
405
463
|
|
|
406
|
-
// Retrieve foreign assetId for a particular chain and asset symbol
|
|
407
|
-
getAssetId(TChain, ASSET_SYMBOL)
|
|
408
|
-
|
|
409
464
|
// Retrieve the symbol of the relay chain for a particular chain. Either "DOT" or "KSM"
|
|
410
465
|
getRelayChainSymbol(TChain)
|
|
411
466
|
|
|
@@ -418,12 +473,6 @@ getOtherAssets(TChain)
|
|
|
418
473
|
// Retrieve string array of all asset symbols. (native and foreign assets are merged into a single array)
|
|
419
474
|
getAllAssetsSymbols(TChain)
|
|
420
475
|
|
|
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
476
|
// Get specific chain id
|
|
428
477
|
getParaId(TChain)
|
|
429
478
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as _paraspell_sdk_core from '@paraspell/sdk-core';
|
|
2
|
-
import {
|
|
2
|
+
import { Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, TSubstrateChain, TBuilderOptions, TApiOrUrl, GeneralBuilder as GeneralBuilder$1, TTransferBaseOptions } from '@paraspell/sdk-core';
|
|
3
3
|
export * from '@paraspell/sdk-core';
|
|
4
4
|
import { DedotClient as DedotClient$1 } from 'dedot';
|
|
5
5
|
import { GenericSubstrateApi as GenericSubstrateApi$1, ChainSubmittableExtrinsic as ChainSubmittableExtrinsic$1, IKeyringPair as IKeyringPair$1 } from 'dedot/types';
|
|
6
6
|
|
|
7
7
|
type TDedotApi = DedotClient$1<GenericSubstrateApi$1>;
|
|
8
|
-
type TDedotApiOrUrl = TApiOrUrl<TDedotApi>;
|
|
9
8
|
type TDedotExtrinsic = ChainSubmittableExtrinsic$1;
|
|
10
9
|
type TDedotSigner = IKeyringPair$1;
|
|
11
10
|
|
|
@@ -17,22 +16,13 @@ type TDedotSigner = IKeyringPair$1;
|
|
|
17
16
|
declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions & {
|
|
18
17
|
currency?: _paraspell_sdk_core.TCurrencyCore;
|
|
19
18
|
} & {
|
|
20
|
-
api?:
|
|
19
|
+
api?: _paraspell_sdk_core.TApiOrUrl<TDedotApi>;
|
|
21
20
|
}) => 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
21
|
|
|
31
22
|
declare const assets_Foreign: typeof Foreign;
|
|
32
23
|
declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
33
24
|
declare const assets_Native: typeof Native;
|
|
34
25
|
declare const assets_Override: typeof Override;
|
|
35
|
-
declare const assets_claimAssets: typeof claimAssets;
|
|
36
26
|
declare const assets_findAssetInfo: typeof findAssetInfo;
|
|
37
27
|
declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
38
28
|
declare const assets_getAssetDecimals: typeof getAssetDecimals;
|
|
@@ -55,7 +45,6 @@ declare namespace assets {
|
|
|
55
45
|
assets_ForeignAbstract as ForeignAbstract,
|
|
56
46
|
assets_Native as Native,
|
|
57
47
|
assets_Override as Override,
|
|
58
|
-
assets_claimAssets as claimAssets,
|
|
59
48
|
assets_findAssetInfo as findAssetInfo,
|
|
60
49
|
assets_getAllAssetsSymbols as getAllAssetsSymbols,
|
|
61
50
|
assets_getAssetDecimals as getAssetDecimals,
|
|
@@ -83,20 +72,20 @@ declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
|
|
|
83
72
|
* @param api - The API instance or options to use for building transactions.
|
|
84
73
|
* @returns A new Builder instance.
|
|
85
74
|
*/
|
|
86
|
-
declare const Builder: (api?: TBuilderOptions<
|
|
87
|
-
type GeneralBuilder<T extends Partial<
|
|
75
|
+
declare const Builder: (api?: TBuilderOptions<TApiOrUrl<TDedotApi>>) => GeneralBuilder$1<DedotClient<GenericSubstrateApi>, ChainSubmittableExtrinsic, IKeyringPair, object>;
|
|
76
|
+
type GeneralBuilder<T extends Partial<TTransferBaseOptions<TDedotApi, TDedotExtrinsic, TDedotSigner>> = object> = GeneralBuilder$1<TDedotApi, TDedotExtrinsic, TDedotSigner, T>;
|
|
88
77
|
|
|
89
78
|
declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<ChainSubmittableExtrinsic> & {
|
|
90
|
-
api?:
|
|
79
|
+
api?: TApiOrUrl<TDedotApi>;
|
|
91
80
|
}) => Promise<_paraspell_sdk_core.TDryRunResult>;
|
|
92
81
|
declare const dryRunOrigin: (options: _paraspell_sdk_core.TDryRunCallBaseOptions<ChainSubmittableExtrinsic> & {
|
|
93
|
-
api?:
|
|
82
|
+
api?: TApiOrUrl<TDedotApi>;
|
|
94
83
|
}) => Promise<_paraspell_sdk_core.TDryRunChainResult>;
|
|
95
|
-
declare const getParaEthTransferFees: (api?:
|
|
84
|
+
declare const getParaEthTransferFees: (api?: TApiOrUrl<TDedotApi>) => Promise<[bigint, bigint]>;
|
|
96
85
|
/**
|
|
97
86
|
* Gets the Ethereum bridge status.
|
|
98
87
|
*/
|
|
99
|
-
declare const getBridgeStatus: (api?:
|
|
88
|
+
declare const getBridgeStatus: (api?: TApiOrUrl<TDedotApi>) => Promise<_paraspell_sdk_core.TBridgeStatus>;
|
|
100
89
|
|
|
101
90
|
declare const transfer_dryRun: typeof dryRun;
|
|
102
91
|
declare const transfer_dryRunOrigin: typeof dryRunOrigin;
|
|
@@ -111,7 +100,7 @@ declare namespace transfer {
|
|
|
111
100
|
};
|
|
112
101
|
}
|
|
113
102
|
|
|
114
|
-
declare const createChainClient: (chain: TSubstrateChain, builderOptions?: TBuilderOptions<
|
|
103
|
+
declare const createChainClient: (chain: TSubstrateChain, builderOptions?: TBuilderOptions<TApiOrUrl<TDedotApi>>) => Promise<DedotClient<GenericSubstrateApi>>;
|
|
115
104
|
|
|
116
|
-
export { Builder, assets,
|
|
117
|
-
export type { GeneralBuilder, TDedotApi,
|
|
105
|
+
export { Builder, assets, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, transfer as xcmPallet };
|
|
106
|
+
export type { GeneralBuilder, TDedotApi, TDedotExtrinsic, TDedotSigner };
|