@paraspell/sdk 12.0.3 → 12.0.5
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 +16 -16
- package/dist/index.mjs +175 -116
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ For full documentation on XCM Transfers head over to [official documentation](ht
|
|
|
85
85
|
|
|
86
86
|
```ts
|
|
87
87
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
88
|
-
.from(
|
|
88
|
+
.from(TSubstrateChain)
|
|
89
89
|
.to(TChain /*,customParaId - optional*/ | Location object /*Only works for PolkadotXCM pallet*/)
|
|
90
90
|
.currency({id: currencyID, amount: amount} | {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}, ..])
|
|
91
91
|
.address(address | Location object /*If you are sending through xTokens, you need to pass the destination and address Location in one object (x2)*/)
|
|
@@ -156,7 +156,7 @@ await builder.disconnect()
|
|
|
156
156
|
|
|
157
157
|
```ts
|
|
158
158
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
159
|
-
.from(
|
|
159
|
+
.from(TSubstrateChain)
|
|
160
160
|
.to(TRelaychain) // Kusama | Polkadot | Westend | Paseo
|
|
161
161
|
.currency({symbol: 'DOT', amount: amount /*Use "ALL" to transfer everything*/})
|
|
162
162
|
.address(address | Location object)
|
|
@@ -190,7 +190,7 @@ await builder.disconnect()
|
|
|
190
190
|
|
|
191
191
|
```ts
|
|
192
192
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
193
|
-
.from(
|
|
193
|
+
.from(TSubstrateChain)
|
|
194
194
|
.to(TChain) //Has to be the same as the origin (from)
|
|
195
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*/} | [{currencySelection /*for example symbol: symbol or id: id, or location: location*/, amount: amount /*Use "ALL" to transfer everything*/}, {currencySelection}, ..])
|
|
196
196
|
.address(address)
|
|
@@ -222,13 +222,13 @@ await builder.disconnect()
|
|
|
222
222
|
|
|
223
223
|
```ts
|
|
224
224
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
225
|
-
.from(
|
|
225
|
+
.from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
226
226
|
.to(TChain2) //Any compatible Parachain
|
|
227
227
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
228
228
|
.address(address | Location object)
|
|
229
229
|
.addToBatch()
|
|
230
230
|
|
|
231
|
-
.from(
|
|
231
|
+
.from(TSubstrateChain) //Ensure, that origin chain is the same in all batched XCM Calls.
|
|
232
232
|
.to(TChain3) //Any compatible Parachain
|
|
233
233
|
.currency({currencySelection, amount}) //Currency to transfer - options as in scenarios above
|
|
234
234
|
.address(address | Location object)
|
|
@@ -248,7 +248,7 @@ await builder.disconnect()
|
|
|
248
248
|
```ts
|
|
249
249
|
//Claim XCM trapped assets from the selected chain
|
|
250
250
|
const builder = Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
251
|
-
.
|
|
251
|
+
.claimfrom(TSubstrateChain)
|
|
252
252
|
.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}, ..]
|
|
253
253
|
)
|
|
254
254
|
.address(address | Location object)
|
|
@@ -265,7 +265,7 @@ await builder.disconnect()
|
|
|
265
265
|
```ts
|
|
266
266
|
//Builder pattern
|
|
267
267
|
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
268
|
-
.from(
|
|
268
|
+
.from(TSubstrateChain)
|
|
269
269
|
.to(TChain)
|
|
270
270
|
.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*/}]})
|
|
271
271
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
@@ -284,7 +284,7 @@ const result = hasDryRunSupport(TChain)
|
|
|
284
284
|
```ts
|
|
285
285
|
//Builder pattern
|
|
286
286
|
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
287
|
-
.from(
|
|
287
|
+
.from(TSubstrateChain)
|
|
288
288
|
.to(TChain)
|
|
289
289
|
.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*/}]})
|
|
290
290
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
@@ -306,7 +306,7 @@ const builder = await Builder({
|
|
|
306
306
|
//ChainName: ...
|
|
307
307
|
}
|
|
308
308
|
})
|
|
309
|
-
.from(
|
|
309
|
+
.from(TSubstrateChain)
|
|
310
310
|
.to(TChain)
|
|
311
311
|
.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*/}])
|
|
312
312
|
.address(address)
|
|
@@ -323,7 +323,7 @@ For full documentation with output examples of XCM Fee queries, head to [officia
|
|
|
323
323
|
#### XCM Transfer info
|
|
324
324
|
```ts
|
|
325
325
|
const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
326
|
-
.from(
|
|
326
|
+
.from(TSubstrateChain)
|
|
327
327
|
.to(TChain)
|
|
328
328
|
.currency(CURRENCY_SPEC)
|
|
329
329
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
@@ -335,7 +335,7 @@ const info = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
335
335
|
#### Transferable amount
|
|
336
336
|
```ts
|
|
337
337
|
const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
338
|
-
.from(
|
|
338
|
+
.from(TSubstrateChain)
|
|
339
339
|
.to(TChain)
|
|
340
340
|
.currency(CURRENCY_SPEC)
|
|
341
341
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
@@ -347,7 +347,7 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
|
|
|
347
347
|
#### Minimal transferable amount
|
|
348
348
|
```ts
|
|
349
349
|
const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
350
|
-
.from(
|
|
350
|
+
.from(TSubstrateChain)
|
|
351
351
|
.to(TChain)
|
|
352
352
|
.currency(CURRENCY_SPEC)
|
|
353
353
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
@@ -359,7 +359,7 @@ const transferable = await Builder(/*chain api/builder_config/ws_url_string/ws_u
|
|
|
359
359
|
#### Receivable amount
|
|
360
360
|
```ts
|
|
361
361
|
const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
362
|
-
.from(
|
|
362
|
+
.from(TSubstrateChain)
|
|
363
363
|
.to(TChain)
|
|
364
364
|
.currency(CURRENCY_SPEC)
|
|
365
365
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
@@ -371,7 +371,7 @@ const receivable = await Builder(/*chain api/builder_config/ws_url_string/ws_url
|
|
|
371
371
|
#### Verify ED on destination
|
|
372
372
|
```ts
|
|
373
373
|
const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
374
|
-
.from(
|
|
374
|
+
.from(TSubstrateChain)
|
|
375
375
|
.to(TChain)
|
|
376
376
|
.currency(CURRENCY_SPEC)
|
|
377
377
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
@@ -384,7 +384,7 @@ const ed = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array -
|
|
|
384
384
|
|
|
385
385
|
```ts
|
|
386
386
|
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
387
|
-
.from(
|
|
387
|
+
.from(TSubstrateChain)
|
|
388
388
|
.to(TChain)
|
|
389
389
|
.currency(CURRENCY_SPEC)
|
|
390
390
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
|
@@ -397,7 +397,7 @@ const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array
|
|
|
397
397
|
|
|
398
398
|
```ts
|
|
399
399
|
const fee = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
400
|
-
.from(
|
|
400
|
+
.from(TSubstrateChain)
|
|
401
401
|
.to(TChain)
|
|
402
402
|
.currency(CURRENCY_SPEC)
|
|
403
403
|
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in the same fee asset as selected currency.*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NumberFormatError, isConfig, InvalidAddressError, BatchMode, getChainProviders, MissingChainApiError, Parents, Version,
|
|
1
|
+
import { NumberFormatError, isConfig, InvalidAddressError, BatchMode, findNativeAssetInfoOrThrow, getChainProviders, MissingChainApiError, Parents, Version, findAssetInfoOrThrow, computeFeeFromDryRun, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, RuntimeApiUnavailableError, wrapTxBypass, assertHasLocation, localizeLocation, isAssetXcEqual, padValueBy, isRelayChain, isAssetEqual, createChainClient as createChainClient$1, getBalance as getBalance$1, claimAssets as claimAssets$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$1, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1, getParaEthTransferFees as getParaEthTransferFees$1, getBridgeStatus as getBridgeStatus$1, getXcmFee as getXcmFee$1, send as send$1, dryRun as dryRun$1, dryRunOrigin as dryRunOrigin$1, getOriginXcmFee as getOriginXcmFee$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { blake2b } from '@noble/hashes/blake2.js';
|
|
4
4
|
import { bytesToHex } from '@noble/hashes/utils.js';
|
|
@@ -1147,19 +1147,71 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1147
1147
|
}
|
|
1148
1148
|
return createApiForChain;
|
|
1149
1149
|
}()
|
|
1150
|
+
}, {
|
|
1151
|
+
key: "resolveDefaultFeeAsset",
|
|
1152
|
+
value: function resolveDefaultFeeAsset(_ref8) {
|
|
1153
|
+
var chain = _ref8.chain,
|
|
1154
|
+
feeAsset = _ref8.feeAsset;
|
|
1155
|
+
return feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrow(chain);
|
|
1156
|
+
}
|
|
1157
|
+
}, {
|
|
1158
|
+
key: "resolveFeeAsset",
|
|
1159
|
+
value: function () {
|
|
1160
|
+
var _resolveFeeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(options) {
|
|
1161
|
+
var chain, address, assetId;
|
|
1162
|
+
return _regenerator().w(function (_context9) {
|
|
1163
|
+
while (1) switch (_context9.n) {
|
|
1164
|
+
case 0:
|
|
1165
|
+
chain = options.chain, address = options.address;
|
|
1166
|
+
if (chain.startsWith('Hydration')) {
|
|
1167
|
+
_context9.n = 1;
|
|
1168
|
+
break;
|
|
1169
|
+
}
|
|
1170
|
+
return _context9.a(2, {
|
|
1171
|
+
isCustomAsset: false,
|
|
1172
|
+
asset: this.resolveDefaultFeeAsset(options)
|
|
1173
|
+
});
|
|
1174
|
+
case 1:
|
|
1175
|
+
_context9.n = 2;
|
|
1176
|
+
return this.api.getUnsafeApi().query.MultiTransactionPayment.AccountCurrencyMap.getValue(address);
|
|
1177
|
+
case 2:
|
|
1178
|
+
assetId = _context9.v;
|
|
1179
|
+
if (!(assetId === undefined)) {
|
|
1180
|
+
_context9.n = 3;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
return _context9.a(2, {
|
|
1184
|
+
isCustomAsset: false,
|
|
1185
|
+
asset: this.resolveDefaultFeeAsset(options)
|
|
1186
|
+
});
|
|
1187
|
+
case 3:
|
|
1188
|
+
return _context9.a(2, {
|
|
1189
|
+
isCustomAsset: true,
|
|
1190
|
+
asset: findAssetInfoOrThrow(chain, {
|
|
1191
|
+
id: assetId
|
|
1192
|
+
}, null)
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
}, _callee9, this);
|
|
1196
|
+
}));
|
|
1197
|
+
function resolveFeeAsset(_x14) {
|
|
1198
|
+
return _resolveFeeAsset.apply(this, arguments);
|
|
1199
|
+
}
|
|
1200
|
+
return resolveFeeAsset;
|
|
1201
|
+
}()
|
|
1150
1202
|
}, {
|
|
1151
1203
|
key: "getDryRunCall",
|
|
1152
1204
|
value: function () {
|
|
1153
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1205
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(options) {
|
|
1154
1206
|
var _this = this;
|
|
1155
|
-
var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason,
|
|
1156
|
-
return _regenerator().w(function (
|
|
1157
|
-
while (1) switch (
|
|
1207
|
+
var tx, chain, destination, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, findFailureObjectFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, resolvedFeeAsset, actualWeight, weight, forwardedXcms, destParaId, hasLocation, xcmFee, executionFee, fee, _t2;
|
|
1208
|
+
return _regenerator().w(function (_context1) {
|
|
1209
|
+
while (1) switch (_context1.n) {
|
|
1158
1210
|
case 0:
|
|
1159
1211
|
tx = options.tx, chain = options.chain, destination = options.destination, address = options.address, feeAsset = options.feeAsset, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
|
|
1160
1212
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1161
1213
|
if (supportsDryRunApi) {
|
|
1162
|
-
|
|
1214
|
+
_context1.n = 1;
|
|
1163
1215
|
break;
|
|
1164
1216
|
}
|
|
1165
1217
|
throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
|
|
@@ -1175,38 +1227,38 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1175
1227
|
}
|
|
1176
1228
|
};
|
|
1177
1229
|
if (!useRootOrigin) {
|
|
1178
|
-
|
|
1230
|
+
_context1.n = 3;
|
|
1179
1231
|
break;
|
|
1180
1232
|
}
|
|
1181
|
-
|
|
1233
|
+
_context1.n = 2;
|
|
1182
1234
|
return wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
1183
1235
|
api: this
|
|
1184
1236
|
}), bypassOptions);
|
|
1185
1237
|
case 2:
|
|
1186
|
-
_t2 =
|
|
1187
|
-
|
|
1238
|
+
_t2 = _context1.v;
|
|
1239
|
+
_context1.n = 4;
|
|
1188
1240
|
break;
|
|
1189
1241
|
case 3:
|
|
1190
1242
|
_t2 = tx;
|
|
1191
1243
|
case 4:
|
|
1192
1244
|
resolvedTx = _t2;
|
|
1193
1245
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1194
|
-
var
|
|
1246
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(includeVersion) {
|
|
1195
1247
|
var _this$api$getUnsafeAp3;
|
|
1196
1248
|
var callArgs;
|
|
1197
|
-
return _regenerator().w(function (
|
|
1198
|
-
while (1) switch (
|
|
1249
|
+
return _regenerator().w(function (_context0) {
|
|
1250
|
+
while (1) switch (_context0.n) {
|
|
1199
1251
|
case 0:
|
|
1200
1252
|
callArgs = [basePayload, resolvedTx.decodedCall];
|
|
1201
1253
|
if (includeVersion) {
|
|
1202
1254
|
callArgs.push(DEFAULT_XCM_VERSION);
|
|
1203
1255
|
}
|
|
1204
|
-
return
|
|
1256
|
+
return _context0.a(2, (_this$api$getUnsafeAp3 = _this.api.getUnsafeApi().apis.DryRunApi).dry_run_call.apply(_this$api$getUnsafeAp3, callArgs));
|
|
1205
1257
|
}
|
|
1206
|
-
},
|
|
1258
|
+
}, _callee0);
|
|
1207
1259
|
}));
|
|
1208
|
-
return function performDryRunCall(
|
|
1209
|
-
return
|
|
1260
|
+
return function performDryRunCall(_x16) {
|
|
1261
|
+
return _ref9.apply(this, arguments);
|
|
1210
1262
|
};
|
|
1211
1263
|
}();
|
|
1212
1264
|
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
@@ -1235,7 +1287,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1235
1287
|
return result;
|
|
1236
1288
|
};
|
|
1237
1289
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1238
|
-
var _obj$value,
|
|
1290
|
+
var _obj$value, _ref0, _result$value6;
|
|
1239
1291
|
var obj = findFailureObjectFromResult(result);
|
|
1240
1292
|
if (obj !== null && obj !== void 0 && obj.type && obj !== null && obj !== void 0 && (_obj$value = obj.value) !== null && _obj$value !== void 0 && (_obj$value = _obj$value.error) !== null && _obj$value !== void 0 && _obj$value.type) {
|
|
1241
1293
|
return {
|
|
@@ -1249,31 +1301,31 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1249
1301
|
};
|
|
1250
1302
|
}
|
|
1251
1303
|
return {
|
|
1252
|
-
failureReason: JSON.stringify((
|
|
1304
|
+
failureReason: JSON.stringify((_ref0 = (_result$value6 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value6 !== void 0 ? _result$value6 : result) !== null && _ref0 !== void 0 ? _ref0 : 'Unknown error structure', replaceBigInt)
|
|
1253
1305
|
};
|
|
1254
1306
|
};
|
|
1255
1307
|
failureOutputReason = {
|
|
1256
1308
|
failureReason: ''
|
|
1257
1309
|
};
|
|
1258
|
-
|
|
1310
|
+
_context1.n = 5;
|
|
1259
1311
|
return performDryRunCall(false);
|
|
1260
1312
|
case 5:
|
|
1261
|
-
result =
|
|
1313
|
+
result = _context1.v;
|
|
1262
1314
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1263
1315
|
if (isSuccess) {
|
|
1264
|
-
|
|
1316
|
+
_context1.n = 7;
|
|
1265
1317
|
break;
|
|
1266
1318
|
}
|
|
1267
1319
|
initialFailureReason = extractFailureReasonFromResult(result);
|
|
1268
1320
|
failureOutputReason = initialFailureReason;
|
|
1269
1321
|
if (!(initialFailureReason.failureReason === 'VersionedConversionFailed')) {
|
|
1270
|
-
|
|
1322
|
+
_context1.n = 7;
|
|
1271
1323
|
break;
|
|
1272
1324
|
}
|
|
1273
|
-
|
|
1325
|
+
_context1.n = 6;
|
|
1274
1326
|
return performDryRunCall(true);
|
|
1275
1327
|
case 6:
|
|
1276
|
-
result =
|
|
1328
|
+
result = _context1.v;
|
|
1277
1329
|
isSuccess = getExecutionSuccessFromResult(result);
|
|
1278
1330
|
if (!isSuccess) {
|
|
1279
1331
|
failureOutputReason = extractFailureReasonFromResult(result);
|
|
@@ -1284,18 +1336,21 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1284
1336
|
};
|
|
1285
1337
|
}
|
|
1286
1338
|
case 7:
|
|
1287
|
-
|
|
1339
|
+
_context1.n = 8;
|
|
1340
|
+
return this.resolveFeeAsset(options);
|
|
1341
|
+
case 8:
|
|
1342
|
+
resolvedFeeAsset = _context1.v;
|
|
1288
1343
|
if (isSuccess) {
|
|
1289
|
-
|
|
1344
|
+
_context1.n = 9;
|
|
1290
1345
|
break;
|
|
1291
1346
|
}
|
|
1292
|
-
return
|
|
1347
|
+
return _context1.a(2, Promise.resolve({
|
|
1293
1348
|
success: false,
|
|
1294
1349
|
failureReason: failureOutputReason.failureReason,
|
|
1295
1350
|
failureSubReason: failureOutputReason.failureSubReason,
|
|
1296
|
-
asset:
|
|
1351
|
+
asset: resolvedFeeAsset.asset
|
|
1297
1352
|
}));
|
|
1298
|
-
case
|
|
1353
|
+
case 9:
|
|
1299
1354
|
actualWeight = result.value.execution_result.value.actual_weight;
|
|
1300
1355
|
weight = actualWeight ? {
|
|
1301
1356
|
refTime: actualWeight.ref_time,
|
|
@@ -1303,46 +1358,50 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1303
1358
|
} : undefined;
|
|
1304
1359
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1305
1360
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
_context0.n = 10;
|
|
1361
|
+
hasLocation = resolvedFeeAsset.asset.location;
|
|
1362
|
+
if (!(hasXcmPaymentApiSupport(chain) && result.value.local_xcm && hasLocation && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
|
|
1363
|
+
_context1.n = 12;
|
|
1310
1364
|
break;
|
|
1311
1365
|
}
|
|
1312
|
-
|
|
1313
|
-
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms,
|
|
1314
|
-
case
|
|
1315
|
-
xcmFee =
|
|
1366
|
+
_context1.n = 10;
|
|
1367
|
+
return this.getXcmPaymentApiFee(chain, result.value.local_xcm, forwardedXcms, resolvedFeeAsset.asset);
|
|
1368
|
+
case 10:
|
|
1369
|
+
xcmFee = _context1.v;
|
|
1316
1370
|
if (!(typeof xcmFee === 'bigint')) {
|
|
1317
|
-
|
|
1371
|
+
_context1.n = 11;
|
|
1318
1372
|
break;
|
|
1319
1373
|
}
|
|
1320
|
-
return
|
|
1374
|
+
return _context1.a(2, Promise.resolve({
|
|
1321
1375
|
success: true,
|
|
1322
1376
|
fee: xcmFee,
|
|
1323
|
-
asset:
|
|
1377
|
+
asset: resolvedFeeAsset.asset,
|
|
1324
1378
|
weight: weight,
|
|
1325
1379
|
forwardedXcms: forwardedXcms,
|
|
1326
1380
|
destParaId: destParaId
|
|
1327
1381
|
}));
|
|
1328
|
-
case 10:
|
|
1329
|
-
_context0.n = 11;
|
|
1330
|
-
return this.calculateTransactionFee(tx, address);
|
|
1331
1382
|
case 11:
|
|
1332
|
-
|
|
1383
|
+
resolvedFeeAsset = {
|
|
1384
|
+
isCustomAsset: false,
|
|
1385
|
+
asset: this.resolveDefaultFeeAsset(options)
|
|
1386
|
+
};
|
|
1387
|
+
case 12:
|
|
1388
|
+
_context1.n = 13;
|
|
1389
|
+
return this.calculateTransactionFee(tx, address);
|
|
1390
|
+
case 13:
|
|
1391
|
+
executionFee = _context1.v;
|
|
1333
1392
|
fee = computeFeeFromDryRun(result, chain, executionFee, !!feeAsset);
|
|
1334
|
-
return
|
|
1393
|
+
return _context1.a(2, Promise.resolve({
|
|
1335
1394
|
success: true,
|
|
1336
1395
|
fee: fee,
|
|
1337
|
-
asset:
|
|
1396
|
+
asset: resolvedFeeAsset.asset,
|
|
1338
1397
|
weight: weight,
|
|
1339
1398
|
forwardedXcms: forwardedXcms,
|
|
1340
1399
|
destParaId: destParaId
|
|
1341
1400
|
}));
|
|
1342
1401
|
}
|
|
1343
|
-
},
|
|
1402
|
+
}, _callee1, this);
|
|
1344
1403
|
}));
|
|
1345
|
-
function getDryRunCall(
|
|
1404
|
+
function getDryRunCall(_x15) {
|
|
1346
1405
|
return _getDryRunCall.apply(this, arguments);
|
|
1347
1406
|
}
|
|
1348
1407
|
return getDryRunCall;
|
|
@@ -1350,24 +1409,24 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1350
1409
|
}, {
|
|
1351
1410
|
key: "getXcmWeight",
|
|
1352
1411
|
value: function () {
|
|
1353
|
-
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1412
|
+
var _getXcmWeight = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(xcm) {
|
|
1354
1413
|
var weightResult, _weightResult$value, ref_time, proof_size;
|
|
1355
|
-
return _regenerator().w(function (
|
|
1356
|
-
while (1) switch (
|
|
1414
|
+
return _regenerator().w(function (_context10) {
|
|
1415
|
+
while (1) switch (_context10.n) {
|
|
1357
1416
|
case 0:
|
|
1358
|
-
|
|
1417
|
+
_context10.n = 1;
|
|
1359
1418
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(!xcm.type ? _transform(xcm) : xcm);
|
|
1360
1419
|
case 1:
|
|
1361
|
-
weightResult =
|
|
1420
|
+
weightResult = _context10.v;
|
|
1362
1421
|
_weightResult$value = weightResult.value, ref_time = _weightResult$value.ref_time, proof_size = _weightResult$value.proof_size;
|
|
1363
|
-
return
|
|
1422
|
+
return _context10.a(2, {
|
|
1364
1423
|
refTime: ref_time,
|
|
1365
1424
|
proofSize: proof_size
|
|
1366
1425
|
});
|
|
1367
1426
|
}
|
|
1368
|
-
},
|
|
1427
|
+
}, _callee10, this);
|
|
1369
1428
|
}));
|
|
1370
|
-
function getXcmWeight(
|
|
1429
|
+
function getXcmWeight(_x17) {
|
|
1371
1430
|
return _getXcmWeight.apply(this, arguments);
|
|
1372
1431
|
}
|
|
1373
1432
|
return getXcmWeight;
|
|
@@ -1375,7 +1434,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1375
1434
|
}, {
|
|
1376
1435
|
key: "getXcmPaymentApiFee",
|
|
1377
1436
|
value: function () {
|
|
1378
|
-
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1437
|
+
var _getXcmPaymentApiFee = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(chain, localXcm, forwardedXcm, asset) {
|
|
1379
1438
|
var _deliveryFeeRes$value, _deliveryFeeRes$value2;
|
|
1380
1439
|
var transformXcm,
|
|
1381
1440
|
transformedXcm,
|
|
@@ -1388,37 +1447,37 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1388
1447
|
nativeAsset,
|
|
1389
1448
|
deliveryFee,
|
|
1390
1449
|
res,
|
|
1391
|
-
|
|
1450
|
+
_args11 = arguments,
|
|
1392
1451
|
_t3,
|
|
1393
1452
|
_t4;
|
|
1394
|
-
return _regenerator().w(function (
|
|
1395
|
-
while (1) switch (
|
|
1453
|
+
return _regenerator().w(function (_context11) {
|
|
1454
|
+
while (1) switch (_context11.p = _context11.n) {
|
|
1396
1455
|
case 0:
|
|
1397
|
-
transformXcm =
|
|
1456
|
+
transformXcm = _args11.length > 4 && _args11[4] !== undefined ? _args11[4] : false;
|
|
1398
1457
|
transformedXcm = transformXcm ? _transform(localXcm) : localXcm;
|
|
1399
|
-
|
|
1458
|
+
_context11.n = 1;
|
|
1400
1459
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_xcm_weight(transformedXcm);
|
|
1401
1460
|
case 1:
|
|
1402
|
-
weight =
|
|
1461
|
+
weight = _context11.v;
|
|
1403
1462
|
assertHasLocation(asset);
|
|
1404
1463
|
assetLocalizedLoc = localizeLocation(chain, asset.location);
|
|
1405
1464
|
transformedAssetLoc = _transform(assetLocalizedLoc);
|
|
1406
|
-
|
|
1465
|
+
_context11.n = 2;
|
|
1407
1466
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_weight_to_asset_fee(weight.value, {
|
|
1408
1467
|
type: Version.V4,
|
|
1409
1468
|
value: transformedAssetLoc
|
|
1410
1469
|
});
|
|
1411
1470
|
case 2:
|
|
1412
|
-
execFeeRes =
|
|
1471
|
+
execFeeRes = _context11.v;
|
|
1413
1472
|
if (!(forwardedXcm.length > 0)) {
|
|
1414
|
-
|
|
1473
|
+
_context11.n = 4;
|
|
1415
1474
|
break;
|
|
1416
1475
|
}
|
|
1417
|
-
|
|
1476
|
+
_context11.n = 3;
|
|
1418
1477
|
return this.api.getUnsafeApi().apis.XcmPaymentApi.query_delivery_fees(forwardedXcm[0], forwardedXcm[1][0]);
|
|
1419
1478
|
case 3:
|
|
1420
|
-
_t3 =
|
|
1421
|
-
|
|
1479
|
+
_t3 = _context11.v;
|
|
1480
|
+
_context11.n = 5;
|
|
1422
1481
|
break;
|
|
1423
1482
|
case 4:
|
|
1424
1483
|
_t3 = undefined;
|
|
@@ -1427,36 +1486,36 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1427
1486
|
deliveryFeeResolved = (deliveryFeeRes === null || deliveryFeeRes === void 0 || (_deliveryFeeRes$value = deliveryFeeRes.value) === null || _deliveryFeeRes$value === void 0 ? void 0 : _deliveryFeeRes$value.value.length) > 0 ? deliveryFeeRes === null || deliveryFeeRes === void 0 || (_deliveryFeeRes$value2 = deliveryFeeRes.value) === null || _deliveryFeeRes$value2 === void 0 ? void 0 : _deliveryFeeRes$value2.value[0].fun.value : 0n;
|
|
1428
1487
|
nativeAsset = findNativeAssetInfoOrThrow(chain);
|
|
1429
1488
|
if (!isAssetXcEqual(asset, nativeAsset)) {
|
|
1430
|
-
|
|
1489
|
+
_context11.n = 6;
|
|
1431
1490
|
break;
|
|
1432
1491
|
}
|
|
1433
1492
|
deliveryFee = deliveryFeeResolved;
|
|
1434
|
-
|
|
1493
|
+
_context11.n = 9;
|
|
1435
1494
|
break;
|
|
1436
1495
|
case 6:
|
|
1437
|
-
|
|
1496
|
+
_context11.p = 6;
|
|
1438
1497
|
assertHasLocation(nativeAsset);
|
|
1439
|
-
|
|
1498
|
+
_context11.n = 7;
|
|
1440
1499
|
return this.quoteAhPrice(localizeLocation(chain, nativeAsset.location), assetLocalizedLoc, deliveryFeeResolved, false);
|
|
1441
1500
|
case 7:
|
|
1442
|
-
res =
|
|
1501
|
+
res = _context11.v;
|
|
1443
1502
|
deliveryFee = res !== null && res !== void 0 ? res : 0n;
|
|
1444
|
-
|
|
1503
|
+
_context11.n = 9;
|
|
1445
1504
|
break;
|
|
1446
1505
|
case 8:
|
|
1447
|
-
|
|
1448
|
-
_t4 =
|
|
1506
|
+
_context11.p = 8;
|
|
1507
|
+
_t4 = _context11.v;
|
|
1449
1508
|
if (_t4 instanceof Error && /Runtime entry RuntimeCall\(.+\) not found/.test(_t4.message)) {
|
|
1450
1509
|
deliveryFee = 0n;
|
|
1451
1510
|
} else {
|
|
1452
1511
|
deliveryFee = 0n;
|
|
1453
1512
|
}
|
|
1454
1513
|
case 9:
|
|
1455
|
-
return
|
|
1514
|
+
return _context11.a(2, execFeeRes.value + deliveryFee);
|
|
1456
1515
|
}
|
|
1457
|
-
},
|
|
1516
|
+
}, _callee11, this, [[6, 8]]);
|
|
1458
1517
|
}));
|
|
1459
|
-
function getXcmPaymentApiFee(
|
|
1518
|
+
function getXcmPaymentApiFee(_x18, _x19, _x20, _x21) {
|
|
1460
1519
|
return _getXcmPaymentApiFee.apply(this, arguments);
|
|
1461
1520
|
}
|
|
1462
1521
|
return getXcmPaymentApiFee;
|
|
@@ -1464,32 +1523,32 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1464
1523
|
}, {
|
|
1465
1524
|
key: "getDryRunXcm",
|
|
1466
1525
|
value: function () {
|
|
1467
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1468
|
-
var
|
|
1526
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(_ref1) {
|
|
1527
|
+
var _ref10, _processAssetsDeposit, _ref11, _ref12, _ref13, _ref14, _ref15;
|
|
1469
1528
|
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
|
|
1470
|
-
return _regenerator().w(function (
|
|
1471
|
-
while (1) switch (
|
|
1529
|
+
return _regenerator().w(function (_context12) {
|
|
1530
|
+
while (1) switch (_context12.n) {
|
|
1472
1531
|
case 0:
|
|
1473
|
-
originLocation =
|
|
1532
|
+
originLocation = _ref1.originLocation, xcm = _ref1.xcm, chain = _ref1.chain, origin = _ref1.origin, asset = _ref1.asset, feeAsset = _ref1.feeAsset, originFee = _ref1.originFee, amount = _ref1.amount;
|
|
1474
1533
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1475
1534
|
if (supportsDryRunApi) {
|
|
1476
|
-
|
|
1535
|
+
_context12.n = 1;
|
|
1477
1536
|
break;
|
|
1478
1537
|
}
|
|
1479
1538
|
throw new RuntimeApiUnavailableError(chain, 'DryRunApi');
|
|
1480
1539
|
case 1:
|
|
1481
1540
|
transformedOriginLocation = _transform(originLocation);
|
|
1482
|
-
|
|
1541
|
+
_context12.n = 2;
|
|
1483
1542
|
return this.api.getUnsafeApi().apis.DryRunApi.dry_run_xcm(transformedOriginLocation, xcm);
|
|
1484
1543
|
case 2:
|
|
1485
|
-
result =
|
|
1544
|
+
result = _context12.v;
|
|
1486
1545
|
isSuccess = result.success && result.value.execution_result.type === 'Complete';
|
|
1487
1546
|
if (isSuccess) {
|
|
1488
|
-
|
|
1547
|
+
_context12.n = 3;
|
|
1489
1548
|
break;
|
|
1490
1549
|
}
|
|
1491
1550
|
failureReason = extractDryRunXcmFailureReason(result);
|
|
1492
|
-
return
|
|
1551
|
+
return _context12.a(2, {
|
|
1493
1552
|
success: false,
|
|
1494
1553
|
failureReason: failureReason,
|
|
1495
1554
|
asset: asset
|
|
@@ -1503,18 +1562,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1503
1562
|
forwardedXcms = result.value.forwarded_xcms.length > 0 ? result.value.forwarded_xcms[0] : [];
|
|
1504
1563
|
destParaId = forwardedXcms.length === 0 ? undefined : forwardedXcms[0].value.interior.type === 'Here' ? 0 : forwardedXcms[0].value.interior.value.value;
|
|
1505
1564
|
if (!(hasXcmPaymentApiSupport(chain) && asset)) {
|
|
1506
|
-
|
|
1565
|
+
_context12.n = 5;
|
|
1507
1566
|
break;
|
|
1508
1567
|
}
|
|
1509
|
-
|
|
1568
|
+
_context12.n = 4;
|
|
1510
1569
|
return this.getXcmPaymentApiFee(chain, xcm, forwardedXcms, asset);
|
|
1511
1570
|
case 4:
|
|
1512
|
-
_fee =
|
|
1571
|
+
_fee = _context12.v;
|
|
1513
1572
|
if (!(typeof _fee === 'bigint')) {
|
|
1514
|
-
|
|
1573
|
+
_context12.n = 5;
|
|
1515
1574
|
break;
|
|
1516
1575
|
}
|
|
1517
|
-
return
|
|
1576
|
+
return _context12.a(2, {
|
|
1518
1577
|
success: true,
|
|
1519
1578
|
fee: _fee,
|
|
1520
1579
|
asset: asset,
|
|
@@ -1527,13 +1586,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1527
1586
|
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1528
1587
|
palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
|
|
1529
1588
|
isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && asset && isAssetEqual(feeAsset, asset);
|
|
1530
|
-
feeAssetFeeEvent = (
|
|
1589
|
+
feeAssetFeeEvent = (_ref10 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1531
1590
|
return (event.type === 'ForeignAssets' || event.type === 'Assets') && event.value.type === 'Issued';
|
|
1532
|
-
}) : undefined) !== null &&
|
|
1591
|
+
}) : undefined) !== null && _ref10 !== void 0 ? _ref10 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1533
1592
|
return event.type === 'Tokens' && event.value.type === 'Deposited';
|
|
1534
1593
|
}) : undefined;
|
|
1535
1594
|
processedAssetsAmount = chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? processAssetsDepositedEvents(emitted, amount, 'Assets', 'Deposited', true) : (_processAssetsDeposit = processAssetsDepositedEvents(emitted, amount, 'Balances', 'Minted', false)) !== null && _processAssetsDeposit !== void 0 ? _processAssetsDeposit : processAssetsDepositedEvents(emitted, amount, 'Balances', 'Issued', false);
|
|
1536
|
-
feeEvent = (
|
|
1595
|
+
feeEvent = (_ref11 = (_ref12 = (_ref13 = (_ref14 = (_ref15 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
|
|
1537
1596
|
//
|
|
1538
1597
|
processedAssetsAmount !== undefined ? {
|
|
1539
1598
|
type: 'Assets',
|
|
@@ -1543,30 +1602,30 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1543
1602
|
amount: processedAssetsAmount
|
|
1544
1603
|
}
|
|
1545
1604
|
}
|
|
1546
|
-
} : undefined) !== null &&
|
|
1605
|
+
} : undefined) !== null && _ref15 !== void 0 ? _ref15 :
|
|
1547
1606
|
//
|
|
1548
1607
|
chain === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1549
1608
|
return event.type === 'Balances' && event.value.type === 'Issued';
|
|
1550
|
-
}) : undefined) !== null &&
|
|
1609
|
+
}) : undefined) !== null && _ref14 !== void 0 ? _ref14 :
|
|
1551
1610
|
//
|
|
1552
1611
|
origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
|
|
1553
1612
|
return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
|
|
1554
|
-
}) : undefined) !== null &&
|
|
1613
|
+
}) : undefined) !== null && _ref13 !== void 0 ? _ref13 :
|
|
1555
1614
|
// Prefer to Minted event
|
|
1556
1615
|
reversedEvents.find(function (event) {
|
|
1557
1616
|
return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
|
|
1558
|
-
})) !== null &&
|
|
1617
|
+
})) !== null && _ref12 !== void 0 ? _ref12 :
|
|
1559
1618
|
// Fallback an Issued event
|
|
1560
1619
|
reversedEvents.find(function (event) {
|
|
1561
1620
|
return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
|
|
1562
|
-
})) !== null &&
|
|
1621
|
+
})) !== null && _ref11 !== void 0 ? _ref11 : reversedEvents.find(function (event) {
|
|
1563
1622
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1564
1623
|
});
|
|
1565
1624
|
if (feeEvent) {
|
|
1566
|
-
|
|
1625
|
+
_context12.n = 6;
|
|
1567
1626
|
break;
|
|
1568
1627
|
}
|
|
1569
|
-
return
|
|
1628
|
+
return _context12.a(2, Promise.resolve({
|
|
1570
1629
|
success: false,
|
|
1571
1630
|
failureReason: 'Cannot determine destination fee. No fee event found',
|
|
1572
1631
|
asset: asset
|
|
@@ -1577,7 +1636,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1577
1636
|
fee = amount - originFee - feeEvent.value.value.amount;
|
|
1578
1637
|
}
|
|
1579
1638
|
processedFee = (isRelayChain(chain) || chain.includes('AssetHub')) && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT' ? padValueBy(fee, 30) : fee;
|
|
1580
|
-
return
|
|
1639
|
+
return _context12.a(2, Promise.resolve({
|
|
1581
1640
|
success: true,
|
|
1582
1641
|
fee: processedFee,
|
|
1583
1642
|
asset: asset,
|
|
@@ -1586,9 +1645,9 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1586
1645
|
destParaId: destParaId
|
|
1587
1646
|
}));
|
|
1588
1647
|
}
|
|
1589
|
-
},
|
|
1648
|
+
}, _callee12, this);
|
|
1590
1649
|
}));
|
|
1591
|
-
function getDryRunXcm(
|
|
1650
|
+
function getDryRunXcm(_x22) {
|
|
1592
1651
|
return _getDryRunXcm.apply(this, arguments);
|
|
1593
1652
|
}
|
|
1594
1653
|
return getDryRunXcm;
|
|
@@ -1596,18 +1655,18 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1596
1655
|
}, {
|
|
1597
1656
|
key: "getBridgeStatus",
|
|
1598
1657
|
value: function () {
|
|
1599
|
-
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1658
|
+
var _getBridgeStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
1600
1659
|
var outboundOperatingMode;
|
|
1601
|
-
return _regenerator().w(function (
|
|
1602
|
-
while (1) switch (
|
|
1660
|
+
return _regenerator().w(function (_context13) {
|
|
1661
|
+
while (1) switch (_context13.n) {
|
|
1603
1662
|
case 0:
|
|
1604
|
-
|
|
1663
|
+
_context13.n = 1;
|
|
1605
1664
|
return this.api.getUnsafeApi().query.EthereumOutboundQueue.OperatingMode.getValue();
|
|
1606
1665
|
case 1:
|
|
1607
|
-
outboundOperatingMode =
|
|
1608
|
-
return
|
|
1666
|
+
outboundOperatingMode = _context13.v;
|
|
1667
|
+
return _context13.a(2, outboundOperatingMode.type);
|
|
1609
1668
|
}
|
|
1610
|
-
},
|
|
1669
|
+
}, _callee13, this);
|
|
1611
1670
|
}));
|
|
1612
1671
|
function getBridgeStatus() {
|
|
1613
1672
|
return _getBridgeStatus.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.5",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@noble/hashes": "^2.0.1",
|
|
27
27
|
"@polkadot-api/legacy-provider": "^0.3.6",
|
|
28
28
|
"viem": "^2.40.3",
|
|
29
|
-
"@paraspell/sdk-core": "12.0.
|
|
29
|
+
"@paraspell/sdk-core": "12.0.5"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"polkadot-api": ">= 1.22.0 < 2"
|