@paraspell/sdk-dedot 12.9.6 → 12.10.0-rc.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 +95 -46
- package/dist/index.d.ts +3 -13
- package/dist/index.mjs +61 -23
- 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,5 +1,5 @@
|
|
|
1
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,
|
|
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, 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';
|
|
@@ -19,20 +19,11 @@ declare const getBalance: (options: _paraspell_sdk_core.TGetBalanceCommonOptions
|
|
|
19
19
|
} & {
|
|
20
20
|
api?: TDedotApiOrUrl;
|
|
21
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
22
|
|
|
31
23
|
declare const assets_Foreign: typeof Foreign;
|
|
32
24
|
declare const assets_ForeignAbstract: typeof ForeignAbstract;
|
|
33
25
|
declare const assets_Native: typeof Native;
|
|
34
26
|
declare const assets_Override: typeof Override;
|
|
35
|
-
declare const assets_claimAssets: typeof claimAssets;
|
|
36
27
|
declare const assets_findAssetInfo: typeof findAssetInfo;
|
|
37
28
|
declare const assets_getAllAssetsSymbols: typeof getAllAssetsSymbols;
|
|
38
29
|
declare const assets_getAssetDecimals: typeof getAssetDecimals;
|
|
@@ -55,7 +46,6 @@ declare namespace assets {
|
|
|
55
46
|
assets_ForeignAbstract as ForeignAbstract,
|
|
56
47
|
assets_Native as Native,
|
|
57
48
|
assets_Override as Override,
|
|
58
|
-
assets_claimAssets as claimAssets,
|
|
59
49
|
assets_findAssetInfo as findAssetInfo,
|
|
60
50
|
assets_getAllAssetsSymbols as getAllAssetsSymbols,
|
|
61
51
|
assets_getAssetDecimals as getAssetDecimals,
|
|
@@ -84,7 +74,7 @@ declare const convertSs58: (address: string, chain: TSubstrateChain) => string;
|
|
|
84
74
|
* @returns A new Builder instance.
|
|
85
75
|
*/
|
|
86
76
|
declare const Builder: (api?: TBuilderOptions<TDedotApiOrUrl>) => GeneralBuilder$1<DedotClient<GenericSubstrateApi>, ChainSubmittableExtrinsic, IKeyringPair, object>;
|
|
87
|
-
type GeneralBuilder<T extends Partial<
|
|
77
|
+
type GeneralBuilder<T extends Partial<TTransferBaseOptions<TDedotApi, TDedotExtrinsic, TDedotSigner>> = object> = GeneralBuilder$1<TDedotApi, TDedotExtrinsic, TDedotSigner, T>;
|
|
88
78
|
|
|
89
79
|
declare const dryRun: (options: _paraspell_sdk_core.TDryRunBaseOptions<ChainSubmittableExtrinsic> & {
|
|
90
80
|
api?: TDedotApiOrUrl;
|
|
@@ -113,5 +103,5 @@ declare namespace transfer {
|
|
|
113
103
|
|
|
114
104
|
declare const createChainClient: (chain: TSubstrateChain, builderOptions?: TBuilderOptions<TDedotApiOrUrl>) => Promise<DedotClient<GenericSubstrateApi>>;
|
|
115
105
|
|
|
116
|
-
export { Builder, assets,
|
|
106
|
+
export { Builder, assets, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, transfer as xcmPallet };
|
|
117
107
|
export type { GeneralBuilder, TDedotApi, TDedotApiOrUrl, TDedotExtrinsic, TDedotSigner };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, isSenderSigner, DEFAULT_TTL_MS, resolveChainApi, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, isAssetXcEqual, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOf, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1,
|
|
1
|
+
import { getEvmPrivateKeyHex, getNativeAssetSymbol, getOtherAssets, NumberFormatError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrow, getChainProviders, isSenderSigner, DEFAULT_TTL_MS, resolveChainApi, isExternalChain, UnsupportedOperationError, findAssetInfoOrThrow, hasXcmPaymentApiSupport, resolveModuleError, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, localizeLocation, isAssetXcEqual, addXcmVersionHeader, RELAY_LOCATION, getRelayChainOf, replaceBigInt, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, Builder as Builder$1, getBridgeStatus as getBridgeStatus$1, getParaEthTransferFees as getParaEthTransferFees$1, DRY_RUN_CLIENT_TIMEOUT_MS, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { stringPascalCase, isEvmAddress, decodeAddress, isHex, u8aToHex, hexToU8a, stringToU8a, blake2AsHex } from 'dedot/utils';
|
|
4
4
|
import { Keyring } from '@polkadot/keyring';
|
|
@@ -607,7 +607,7 @@ var _transform = function transform(obj) {
|
|
|
607
607
|
return {
|
|
608
608
|
type: key,
|
|
609
609
|
value: {
|
|
610
|
-
|
|
610
|
+
jitWithdraw: (_value$jit_withdraw = value.jit_withdraw) !== null && _value$jit_withdraw !== void 0 ? _value$jit_withdraw : false
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
613
|
} else if (key === "PayFees") {
|
|
@@ -883,7 +883,7 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
883
883
|
case 0:
|
|
884
884
|
params = serialized.params;
|
|
885
885
|
_this$convertToDedotC2 = this.convertToDedotCall(serialized), module = _this$convertToDedotC2.module, method = _this$convertToDedotC2.method;
|
|
886
|
-
return _context4.a(2, this.api.query[module][method](params.length > 1 ? params : params[0]));
|
|
886
|
+
return _context4.a(2, this.api.query[module][method](params.length > 1 ? params.map(_transform) : params[0]));
|
|
887
887
|
}
|
|
888
888
|
}, _callee4, this);
|
|
889
889
|
}));
|
|
@@ -1056,13 +1056,13 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1056
1056
|
return _regenerator().w(function (_context8) {
|
|
1057
1057
|
while (1) switch (_context8.n) {
|
|
1058
1058
|
case 0:
|
|
1059
|
-
api = new DedotApi();
|
|
1059
|
+
api = new DedotApi(isConfig(this._config) ? this._config : undefined);
|
|
1060
1060
|
_context8.n = 1;
|
|
1061
1061
|
return api.init(chain);
|
|
1062
1062
|
case 1:
|
|
1063
1063
|
return _context8.a(2, api);
|
|
1064
1064
|
}
|
|
1065
|
-
}, _callee8);
|
|
1065
|
+
}, _callee8, this);
|
|
1066
1066
|
}));
|
|
1067
1067
|
function createApiForChain(_x11) {
|
|
1068
1068
|
return _createApiForChain.apply(this, arguments);
|
|
@@ -1111,7 +1111,7 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1111
1111
|
isCustomAsset: true,
|
|
1112
1112
|
asset: findAssetInfoOrThrow(chain, {
|
|
1113
1113
|
id: assetId
|
|
1114
|
-
}
|
|
1114
|
+
})
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
1117
|
}, _callee9, this);
|
|
@@ -1129,7 +1129,7 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1129
1129
|
_result,
|
|
1130
1130
|
_resValue$executionRe,
|
|
1131
1131
|
_execRes$actualWeight;
|
|
1132
|
-
var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, _getAssetsObject, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, resValue, execRes, forwardedXcms, actualWeight, weight, destParaId, localXcm, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
|
|
1132
|
+
var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, _getAssetsObject, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, resValue, execRes, forwardedXcms, actualWeight, weight, destParaId, localXcm, USE_XCM_PAYMENT_API_CHAINS, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
|
|
1133
1133
|
return _regenerator().w(function (_context1) {
|
|
1134
1134
|
while (1) switch (_context1.p = _context1.n) {
|
|
1135
1135
|
case 0:
|
|
@@ -1186,14 +1186,22 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1186
1186
|
return _ref1.apply(this, arguments);
|
|
1187
1187
|
};
|
|
1188
1188
|
}();
|
|
1189
|
+
findFailingEventInResult = function findFailingEventInResult(res) {
|
|
1190
|
+
var _res$value;
|
|
1191
|
+
return res === null || res === void 0 || (_res$value = res.value) === null || _res$value === void 0 || (_res$value = _res$value.emittedEvents) === null || _res$value === void 0 ? void 0 : _res$value.find(function (event) {
|
|
1192
|
+
var _event$palletEvent, _event$palletEvent2;
|
|
1193
|
+
return event.pallet === "Utility" && ((_event$palletEvent = event.palletEvent) === null || _event$palletEvent === void 0 ? void 0 : _event$palletEvent.name) === "DispatchedAs" && ((_event$palletEvent2 = event.palletEvent) === null || _event$palletEvent2 === void 0 || (_event$palletEvent2 = _event$palletEvent2.data) === null || _event$palletEvent2 === void 0 || (_event$palletEvent2 = _event$palletEvent2.result) === null || _event$palletEvent2 === void 0 ? void 0 : _event$palletEvent2.isErr) === true;
|
|
1194
|
+
});
|
|
1195
|
+
};
|
|
1189
1196
|
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
1190
1197
|
var _result$value$executi;
|
|
1198
|
+
var errorInEvents = findFailingEventInResult(result);
|
|
1191
1199
|
if (result !== null && result !== void 0 && result.isOk) {
|
|
1192
1200
|
var _result$value3;
|
|
1193
1201
|
var execResult = result === null || result === void 0 || (_result$value3 = result.value) === null || _result$value3 === void 0 ? void 0 : _result$value3.executionResult;
|
|
1194
|
-
if (execResult !== null && execResult !== void 0 && execResult.isOk) return
|
|
1202
|
+
if (execResult !== null && execResult !== void 0 && execResult.isOk) return !errorInEvents;
|
|
1195
1203
|
}
|
|
1196
|
-
return Boolean((result === null || result === void 0 ? void 0 : result.isOk) && ((_result$value$executi = result.value.executionResult) === null || _result$value$executi === void 0 ? void 0 : _result$value$executi.isOk));
|
|
1204
|
+
return Boolean((result === null || result === void 0 ? void 0 : result.isOk) && ((_result$value$executi = result.value.executionResult) === null || _result$value$executi === void 0 ? void 0 : _result$value$executi.isOk)) && !errorInEvents;
|
|
1197
1205
|
};
|
|
1198
1206
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1199
1207
|
var _result$value4, _execResult$value;
|
|
@@ -1220,6 +1228,21 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1220
1228
|
failureReason: JSON.stringify(execErr.error)
|
|
1221
1229
|
};
|
|
1222
1230
|
}
|
|
1231
|
+
var erroredEvent = findFailingEventInResult(result);
|
|
1232
|
+
if (erroredEvent) {
|
|
1233
|
+
var _eventResult$err;
|
|
1234
|
+
var eventResult = erroredEvent.palletEvent.data.result;
|
|
1235
|
+
var err = (_eventResult$err = eventResult === null || eventResult === void 0 ? void 0 : eventResult.err) !== null && _eventResult$err !== void 0 ? _eventResult$err : eventResult === null || eventResult === void 0 ? void 0 : eventResult.value;
|
|
1236
|
+
if (err !== null && err !== void 0 && err.type) {
|
|
1237
|
+
var subErr = err.value;
|
|
1238
|
+
if (subErr) {
|
|
1239
|
+
return resolveModuleError(chain, subErr);
|
|
1240
|
+
}
|
|
1241
|
+
return {
|
|
1242
|
+
failureReason: err.type
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1223
1246
|
return {
|
|
1224
1247
|
failureReason: JSON.stringify(result !== null && result !== void 0 ? result : "Unknown error")
|
|
1225
1248
|
};
|
|
@@ -1580,19 +1603,19 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1580
1603
|
key: "getXcmWeight",
|
|
1581
1604
|
value: function () {
|
|
1582
1605
|
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(xcm) {
|
|
1583
|
-
var
|
|
1606
|
+
var _okValue$refTime, _okValue$proofSize;
|
|
1584
1607
|
var result, okValue;
|
|
1585
1608
|
return _regenerator().w(function (_context14) {
|
|
1586
1609
|
while (1) switch (_context14.n) {
|
|
1587
1610
|
case 0:
|
|
1588
1611
|
_context14.n = 1;
|
|
1589
|
-
return this.api.call.xcmPaymentApi.queryXcmWeight(xcm);
|
|
1612
|
+
return this.api.call.xcmPaymentApi.queryXcmWeight(!xcm.type ? _transform(xcm) : xcm);
|
|
1590
1613
|
case 1:
|
|
1591
1614
|
result = _context14.v;
|
|
1592
1615
|
okValue = result === null || result === void 0 ? void 0 : result.value;
|
|
1593
1616
|
return _context14.a(2, {
|
|
1594
|
-
refTime: BigInt((
|
|
1595
|
-
proofSize: BigInt((
|
|
1617
|
+
refTime: BigInt((_okValue$refTime = okValue === null || okValue === void 0 ? void 0 : okValue.refTime) !== null && _okValue$refTime !== void 0 ? _okValue$refTime : 0),
|
|
1618
|
+
proofSize: BigInt((_okValue$proofSize = okValue === null || okValue === void 0 ? void 0 : okValue.proofSize) !== null && _okValue$proofSize !== void 0 ? _okValue$proofSize : 0)
|
|
1596
1619
|
});
|
|
1597
1620
|
}
|
|
1598
1621
|
}, _callee14, this);
|
|
@@ -1605,13 +1628,13 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1605
1628
|
}, {
|
|
1606
1629
|
key: "getDryRunXcm",
|
|
1607
1630
|
value: function () {
|
|
1608
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(
|
|
1631
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(_ref11) {
|
|
1609
1632
|
var _result$value5;
|
|
1610
1633
|
var originLocation, xcm, asset, chain, version, _getAssetsObject2, supportsDryRunApi, transformedOriginLocation, result, executionResult, isSuccess, actualWeight, weight, forwardedXcms, destParaId, fee;
|
|
1611
1634
|
return _regenerator().w(function (_context15) {
|
|
1612
1635
|
while (1) switch (_context15.n) {
|
|
1613
1636
|
case 0:
|
|
1614
|
-
originLocation =
|
|
1637
|
+
originLocation = _ref11.originLocation, xcm = _ref11.xcm, asset = _ref11.asset, chain = _ref11.chain, version = _ref11.version;
|
|
1615
1638
|
_getAssetsObject2 = getAssetsObject(chain), supportsDryRunApi = _getAssetsObject2.supportsDryRunApi;
|
|
1616
1639
|
if (supportsDryRunApi) {
|
|
1617
1640
|
_context15.n = 1;
|
|
@@ -1773,6 +1796,28 @@ var DedotApi = /*#__PURE__*/function () {
|
|
|
1773
1796
|
}
|
|
1774
1797
|
return signAndSubmit;
|
|
1775
1798
|
}()
|
|
1799
|
+
}, {
|
|
1800
|
+
key: "signAndSubmitFinalized",
|
|
1801
|
+
value: function () {
|
|
1802
|
+
var _signAndSubmitFinalized = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(tx, sender) {
|
|
1803
|
+
var account, result;
|
|
1804
|
+
return _regenerator().w(function (_context18) {
|
|
1805
|
+
while (1) switch (_context18.n) {
|
|
1806
|
+
case 0:
|
|
1807
|
+
account = isSenderSigner(sender) ? sender : createKeyringPair(sender);
|
|
1808
|
+
_context18.n = 1;
|
|
1809
|
+
return tx.signAndSend(account).untilFinalized();
|
|
1810
|
+
case 1:
|
|
1811
|
+
result = _context18.v;
|
|
1812
|
+
return _context18.a(2, result.txHash);
|
|
1813
|
+
}
|
|
1814
|
+
}, _callee18);
|
|
1815
|
+
}));
|
|
1816
|
+
function signAndSubmitFinalized(_x33, _x34) {
|
|
1817
|
+
return _signAndSubmitFinalized.apply(this, arguments);
|
|
1818
|
+
}
|
|
1819
|
+
return signAndSubmitFinalized;
|
|
1820
|
+
}()
|
|
1776
1821
|
}]);
|
|
1777
1822
|
}();
|
|
1778
1823
|
|
|
@@ -1807,12 +1852,6 @@ var createDedotApiCall = function createDedotApiCall(apiCall) {
|
|
|
1807
1852
|
* @returns The asset balance as a bigint.
|
|
1808
1853
|
*/
|
|
1809
1854
|
var getBalance = createDedotApiCall(getBalance$1);
|
|
1810
|
-
/**
|
|
1811
|
-
* Claims assets from a parachain.
|
|
1812
|
-
*
|
|
1813
|
-
* @returns An extrinsic representing the claim transaction.
|
|
1814
|
-
*/
|
|
1815
|
-
var claimAssets = createDedotApiCall(claimAssets$1);
|
|
1816
1855
|
|
|
1817
1856
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1818
1857
|
__proto__: null,
|
|
@@ -1820,7 +1859,6 @@ var assets = /*#__PURE__*/Object.freeze({
|
|
|
1820
1859
|
ForeignAbstract: ForeignAbstract,
|
|
1821
1860
|
Native: Native,
|
|
1822
1861
|
Override: Override,
|
|
1823
|
-
claimAssets: claimAssets,
|
|
1824
1862
|
findAssetInfo: findAssetInfo,
|
|
1825
1863
|
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
1826
1864
|
getAssetDecimals: getAssetDecimals,
|
|
@@ -1902,4 +1940,4 @@ var transfer = /*#__PURE__*/Object.freeze({
|
|
|
1902
1940
|
getParaEthTransferFees: getParaEthTransferFees
|
|
1903
1941
|
});
|
|
1904
1942
|
|
|
1905
|
-
export { Builder, assets,
|
|
1943
|
+
export { Builder, assets, convertSs58, createChainClient, dryRun, dryRunOrigin, getBalance, getBridgeStatus, getParaEthTransferFees, transfer as xcmPallet };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-dedot",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.10.0-rc.0",
|
|
4
4
|
"description": "Dedot-based SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@paraspell/sdk-core": "12.
|
|
26
|
+
"@paraspell/sdk-core": "12.10.0-rc.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"dedot": ">= 1.2.0",
|