@paraspell/sdk 11.3.2 → 11.4.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 +15 -0
- package/dist/index.cjs +26 -23
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +27 -24
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -277,6 +277,21 @@ import { hasDryRunSupport } from "@paraspell/sdk";
|
|
|
277
277
|
const result = hasDryRunSupport(chain)
|
|
278
278
|
```
|
|
279
279
|
|
|
280
|
+
#### Dry run preview:
|
|
281
|
+
More on this feature in [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#preview-your-call-results)
|
|
282
|
+
|
|
283
|
+
```ts
|
|
284
|
+
//Builder pattern
|
|
285
|
+
const result = await Builder(/*chain api/builder_config/ws_url_string/ws_url_array - optional*/)
|
|
286
|
+
.from(CHAIN)
|
|
287
|
+
.to(CHAIN_2)
|
|
288
|
+
.currency({id: currencyID, amount: amount} | {symbol: currencySymbol, amount: amount} | {symbol: Native('currencySymbol'), amount: amount} | {symbol: Foreign('currencySymbol'), amount: amount} | {symbol: ForeignAbstract('currencySymbol'), amount: amount} | {location: AssetLocationString, amount: amount | AssetLocationJson, amount: amount} | {location: Override('Custom Location'), amount: amount} | {[{currencySelection, isFeeAsset?: true /* for example symbol: symbol or id: id, or Location: Location*/, amount: amount}]})
|
|
289
|
+
/*.feeAsset(CURRENCY) - Optional parameter when origin === AssetHubPolkadot and TX is supposed to be paid in same fee asset as selected currency.*/
|
|
290
|
+
.address(ADDRESS)
|
|
291
|
+
.senderAddress(SENDER_ADDRESS)
|
|
292
|
+
.dryRunPreview(/*{ mintFeeAssets: true } - false by default - Mints fee assets also, if user does not have enough to cover fees on origin.*/)
|
|
293
|
+
```
|
|
294
|
+
|
|
280
295
|
### Localhost test setup
|
|
281
296
|
|
|
282
297
|
SDK offers enhanced localhost support. You can pass an object containing overrides for all WS endpoints (Including hops) used in the test transfer. This allows for advanced localhost testing such as localhost dry-run or xcm-fee queries. More information about available options can be found in the [official documentation](https://paraspell.github.io/docs/sdk/xcmPallet.html#localhost-testing-setup).
|
package/dist/index.cjs
CHANGED
|
@@ -1373,14 +1373,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1373
1373
|
}, {
|
|
1374
1374
|
key: "getDryRunCall",
|
|
1375
1375
|
value: function () {
|
|
1376
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(
|
|
1377
|
-
var _this = this
|
|
1378
|
-
|
|
1379
|
-
var tx, address, chain, asset, feeAsset, _ref6$useRootOrigin, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedSymbol, usedAsset, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t4;
|
|
1376
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(options) {
|
|
1377
|
+
var _this = this;
|
|
1378
|
+
var tx, chain, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedAsset, usedSymbol, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t4;
|
|
1380
1379
|
return _regenerator().w(function (_context20) {
|
|
1381
1380
|
while (1) switch (_context20.n) {
|
|
1382
1381
|
case 0:
|
|
1383
|
-
tx =
|
|
1382
|
+
tx = options.tx, chain = options.chain, address = options.address, feeAsset = options.feeAsset, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
|
|
1384
1383
|
supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
|
|
1385
1384
|
if (supportsDryRunApi) {
|
|
1386
1385
|
_context20.n = 1;
|
|
@@ -1403,7 +1402,9 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1403
1402
|
break;
|
|
1404
1403
|
}
|
|
1405
1404
|
_context20.n = 2;
|
|
1406
|
-
return sdkCore.wrapTxBypass(
|
|
1405
|
+
return sdkCore.wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
1406
|
+
api: this
|
|
1407
|
+
}), bypassOptions);
|
|
1407
1408
|
case 2:
|
|
1408
1409
|
_t4 = _context20.v;
|
|
1409
1410
|
_context20.n = 4;
|
|
@@ -1413,7 +1414,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1413
1414
|
case 4:
|
|
1414
1415
|
resolvedTx = _t4;
|
|
1415
1416
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1416
|
-
var
|
|
1417
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(includeVersion) {
|
|
1417
1418
|
var _this$api$getUnsafeAp;
|
|
1418
1419
|
var callArgs;
|
|
1419
1420
|
return _regenerator().w(function (_context19) {
|
|
@@ -1428,7 +1429,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1428
1429
|
}, _callee19);
|
|
1429
1430
|
}));
|
|
1430
1431
|
return function performDryRunCall(_x36) {
|
|
1431
|
-
return
|
|
1432
|
+
return _ref6.apply(this, arguments);
|
|
1432
1433
|
};
|
|
1433
1434
|
}();
|
|
1434
1435
|
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
@@ -1437,7 +1438,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1437
1438
|
return (result === null || result === void 0 ? void 0 : result.success) && ((_result$value = result.value) === null || _result$value === void 0 || (_result$value = _result$value.execution_result) === null || _result$value === void 0 ? void 0 : _result$value.success) && !errorInEvents;
|
|
1438
1439
|
};
|
|
1439
1440
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1440
|
-
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3,
|
|
1441
|
+
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3, _ref7, _result$value4;
|
|
1441
1442
|
var executionResultValue = result === null || result === void 0 || (_result$value2 = result.value) === null || _result$value2 === void 0 || (_result$value2 = _result$value2.execution_result) === null || _result$value2 === void 0 ? void 0 : _result$value2.value;
|
|
1442
1443
|
if (executionResultValue !== null && executionResultValue !== void 0 && (_executionResultValue = executionResultValue.error) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && _executionResultValue.type) {
|
|
1443
1444
|
return String(executionResultValue.error.value.value.type);
|
|
@@ -1452,7 +1453,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1452
1453
|
if (erroredEvent) {
|
|
1453
1454
|
return erroredEvent.value.value.result.value.value.value.type;
|
|
1454
1455
|
}
|
|
1455
|
-
return JSON.stringify((
|
|
1456
|
+
return JSON.stringify((_ref7 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref7 !== void 0 ? _ref7 : 'Unknown error structure', sdkCore.replaceBigInt);
|
|
1456
1457
|
};
|
|
1457
1458
|
failureOutputReason = '';
|
|
1458
1459
|
_context20.n = 5;
|
|
@@ -1481,8 +1482,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1481
1482
|
failureOutputReason = '';
|
|
1482
1483
|
}
|
|
1483
1484
|
case 7:
|
|
1484
|
-
|
|
1485
|
-
|
|
1485
|
+
usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : sdkCore.findAssetInfoOrThrow(chain, {
|
|
1486
|
+
symbol: sdkCore.Native(sdkCore.getNativeAssetSymbol(chain))
|
|
1487
|
+
}, null);
|
|
1488
|
+
usedSymbol = usedAsset.symbol;
|
|
1486
1489
|
if (isSuccess) {
|
|
1487
1490
|
_context20.n = 8;
|
|
1488
1491
|
break;
|
|
@@ -1614,13 +1617,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1614
1617
|
}, {
|
|
1615
1618
|
key: "getDryRunXcm",
|
|
1616
1619
|
value: function () {
|
|
1617
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(
|
|
1618
|
-
var
|
|
1620
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(_ref8) {
|
|
1621
|
+
var _ref9, _processAssetsDeposit, _ref0, _ref1, _ref10, _ref11, _ref12;
|
|
1619
1622
|
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, symbol, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
|
|
1620
1623
|
return _regenerator().w(function (_context23) {
|
|
1621
1624
|
while (1) switch (_context23.n) {
|
|
1622
1625
|
case 0:
|
|
1623
|
-
originLocation =
|
|
1626
|
+
originLocation = _ref8.originLocation, xcm = _ref8.xcm, chain = _ref8.chain, origin = _ref8.origin, asset = _ref8.asset, feeAsset = _ref8.feeAsset, originFee = _ref8.originFee, amount = _ref8.amount;
|
|
1624
1627
|
supportsDryRunApi = sdkCore.getAssetsObject(chain).supportsDryRunApi;
|
|
1625
1628
|
if (supportsDryRunApi) {
|
|
1626
1629
|
_context23.n = 1;
|
|
@@ -1680,13 +1683,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1680
1683
|
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1681
1684
|
palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
|
|
1682
1685
|
isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && asset && sdkCore.isAssetEqual(feeAsset, asset);
|
|
1683
|
-
feeAssetFeeEvent = (
|
|
1686
|
+
feeAssetFeeEvent = (_ref9 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1684
1687
|
return (event.type === 'ForeignAssets' || event.type === 'Assets') && event.value.type === 'Issued';
|
|
1685
|
-
}) : undefined) !== null &&
|
|
1688
|
+
}) : undefined) !== null && _ref9 !== void 0 ? _ref9 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1686
1689
|
return event.type === 'Tokens' && event.value.type === 'Deposited';
|
|
1687
1690
|
}) : undefined;
|
|
1688
1691
|
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);
|
|
1689
|
-
feeEvent = (_ref1 = (_ref10 = (_ref11 = (_ref12 =
|
|
1692
|
+
feeEvent = (_ref0 = (_ref1 = (_ref10 = (_ref11 = (_ref12 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
|
|
1690
1693
|
//
|
|
1691
1694
|
processedAssetsAmount !== undefined ? {
|
|
1692
1695
|
type: 'Assets',
|
|
@@ -1696,23 +1699,23 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1696
1699
|
amount: processedAssetsAmount
|
|
1697
1700
|
}
|
|
1698
1701
|
}
|
|
1699
|
-
} : undefined) !== null &&
|
|
1702
|
+
} : undefined) !== null && _ref12 !== void 0 ? _ref12 :
|
|
1700
1703
|
//
|
|
1701
1704
|
chain === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1702
1705
|
return event.type === 'Balances' && event.value.type === 'Issued';
|
|
1703
|
-
}) : undefined) !== null &&
|
|
1706
|
+
}) : undefined) !== null && _ref11 !== void 0 ? _ref11 :
|
|
1704
1707
|
//
|
|
1705
1708
|
origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
|
|
1706
1709
|
return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
|
|
1707
|
-
}) : undefined) !== null &&
|
|
1710
|
+
}) : undefined) !== null && _ref10 !== void 0 ? _ref10 :
|
|
1708
1711
|
// Prefer to Minted event
|
|
1709
1712
|
reversedEvents.find(function (event) {
|
|
1710
1713
|
return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
|
|
1711
|
-
})) !== null &&
|
|
1714
|
+
})) !== null && _ref1 !== void 0 ? _ref1 :
|
|
1712
1715
|
// Fallback an Issued event
|
|
1713
1716
|
reversedEvents.find(function (event) {
|
|
1714
1717
|
return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
|
|
1715
|
-
})) !== null &&
|
|
1718
|
+
})) !== null && _ref0 !== void 0 ? _ref0 : reversedEvents.find(function (event) {
|
|
1716
1719
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1717
1720
|
});
|
|
1718
1721
|
if (feeEvent) {
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ declare const getBalanceNative: (options: _paraspell_sdk_core.TGetBalanceNativeO
|
|
|
25
25
|
* @returns The balance of the foreign asset as a bigint, or null if not found.
|
|
26
26
|
*/
|
|
27
27
|
declare const getBalanceForeign: (options: _paraspell_sdk_core.TGetBalanceForeignOptionsBase & {
|
|
28
|
+
currency: _paraspell_sdk_core.TCurrencyCore;
|
|
29
|
+
} & {
|
|
28
30
|
api?: TPapiApiOrUrl;
|
|
29
31
|
}) => Promise<bigint>;
|
|
30
32
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, ChainNotSupportedError, createChainClient as createChainClient$1, Parents, Version, getChain, isForeignAsset, assertHasId, computeFeeFromDryRun, findAssetInfo, Native, getNativeAssetSymbol, hasXcmPaymentApiSupport, replaceBigInt, getAssetsObject, wrapTxBypass, assertHasLocation, localizeLocation, isRelayChain, padFeeBy, isAssetEqual, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$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, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1 } from '@paraspell/sdk-core';
|
|
1
|
+
import { InvalidParameterError, isConfig, BatchMode, getChainProviders, MissingChainApiError, ChainNotSupportedError, createChainClient as createChainClient$1, Parents, Version, getChain, isForeignAsset, assertHasId, computeFeeFromDryRun, findAssetInfo, Native, getNativeAssetSymbol, hasXcmPaymentApiSupport, findAssetInfoOrThrow, replaceBigInt, getAssetsObject, wrapTxBypass, assertHasLocation, localizeLocation, isRelayChain, padFeeBy, isAssetEqual, getBalanceNative as getBalanceNative$1, getBalanceForeign as getBalanceForeign$1, getAssetBalance as getAssetBalance$1, claimAssets as claimAssets$1, getOriginFeeDetails as getOriginFeeDetails$1, Foreign, ForeignAbstract, Override, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getExistentialDeposit, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, transferMoonbeamEvm, validateAddress, transferMoonbeamToEth, Builder as Builder$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, handleSwapExecuteTransfer as handleSwapExecuteTransfer$1 } from '@paraspell/sdk-core';
|
|
2
2
|
export * from '@paraspell/sdk-core';
|
|
3
3
|
import { blake2b } from '@noble/hashes/blake2';
|
|
4
4
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
@@ -1372,14 +1372,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1372
1372
|
}, {
|
|
1373
1373
|
key: "getDryRunCall",
|
|
1374
1374
|
value: function () {
|
|
1375
|
-
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(
|
|
1376
|
-
var _this = this
|
|
1377
|
-
|
|
1378
|
-
var tx, address, chain, asset, feeAsset, _ref6$useRootOrigin, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedSymbol, usedAsset, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t4;
|
|
1375
|
+
var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20(options) {
|
|
1376
|
+
var _this = this;
|
|
1377
|
+
var tx, chain, address, feeAsset, bypassOptions, _options$useRootOrigi, useRootOrigin, supportsDryRunApi, DEFAULT_XCM_VERSION, basePayload, resolvedTx, performDryRunCall, getExecutionSuccessFromResult, extractFailureReasonFromResult, result, isSuccess, failureOutputReason, initialFailureReason, usedAsset, usedSymbol, actualWeight, weight, forwardedXcms, destParaId, executionFee, nativeAsset, hasLocation, xcmFee, fee, _t4;
|
|
1379
1378
|
return _regenerator().w(function (_context20) {
|
|
1380
1379
|
while (1) switch (_context20.n) {
|
|
1381
1380
|
case 0:
|
|
1382
|
-
tx =
|
|
1381
|
+
tx = options.tx, chain = options.chain, address = options.address, feeAsset = options.feeAsset, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
|
|
1383
1382
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1384
1383
|
if (supportsDryRunApi) {
|
|
1385
1384
|
_context20.n = 1;
|
|
@@ -1402,7 +1401,9 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1402
1401
|
break;
|
|
1403
1402
|
}
|
|
1404
1403
|
_context20.n = 2;
|
|
1405
|
-
return wrapTxBypass(
|
|
1404
|
+
return wrapTxBypass(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
1405
|
+
api: this
|
|
1406
|
+
}), bypassOptions);
|
|
1406
1407
|
case 2:
|
|
1407
1408
|
_t4 = _context20.v;
|
|
1408
1409
|
_context20.n = 4;
|
|
@@ -1412,7 +1413,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1412
1413
|
case 4:
|
|
1413
1414
|
resolvedTx = _t4;
|
|
1414
1415
|
performDryRunCall = /*#__PURE__*/function () {
|
|
1415
|
-
var
|
|
1416
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(includeVersion) {
|
|
1416
1417
|
var _this$api$getUnsafeAp;
|
|
1417
1418
|
var callArgs;
|
|
1418
1419
|
return _regenerator().w(function (_context19) {
|
|
@@ -1427,7 +1428,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1427
1428
|
}, _callee19);
|
|
1428
1429
|
}));
|
|
1429
1430
|
return function performDryRunCall(_x36) {
|
|
1430
|
-
return
|
|
1431
|
+
return _ref6.apply(this, arguments);
|
|
1431
1432
|
};
|
|
1432
1433
|
}();
|
|
1433
1434
|
getExecutionSuccessFromResult = function getExecutionSuccessFromResult(result) {
|
|
@@ -1436,7 +1437,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1436
1437
|
return (result === null || result === void 0 ? void 0 : result.success) && ((_result$value = result.value) === null || _result$value === void 0 || (_result$value = _result$value.execution_result) === null || _result$value === void 0 ? void 0 : _result$value.success) && !errorInEvents;
|
|
1437
1438
|
};
|
|
1438
1439
|
extractFailureReasonFromResult = function extractFailureReasonFromResult(result) {
|
|
1439
|
-
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3,
|
|
1440
|
+
var _result$value2, _executionResultValue, _executionResultValue2, _result$value3, _ref7, _result$value4;
|
|
1440
1441
|
var executionResultValue = result === null || result === void 0 || (_result$value2 = result.value) === null || _result$value2 === void 0 || (_result$value2 = _result$value2.execution_result) === null || _result$value2 === void 0 ? void 0 : _result$value2.value;
|
|
1441
1442
|
if (executionResultValue !== null && executionResultValue !== void 0 && (_executionResultValue = executionResultValue.error) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && (_executionResultValue = _executionResultValue.value) !== null && _executionResultValue !== void 0 && _executionResultValue.type) {
|
|
1442
1443
|
return String(executionResultValue.error.value.value.type);
|
|
@@ -1451,7 +1452,7 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1451
1452
|
if (erroredEvent) {
|
|
1452
1453
|
return erroredEvent.value.value.result.value.value.value.type;
|
|
1453
1454
|
}
|
|
1454
|
-
return JSON.stringify((
|
|
1455
|
+
return JSON.stringify((_ref7 = (_result$value4 = result === null || result === void 0 ? void 0 : result.value) !== null && _result$value4 !== void 0 ? _result$value4 : result) !== null && _ref7 !== void 0 ? _ref7 : 'Unknown error structure', replaceBigInt);
|
|
1455
1456
|
};
|
|
1456
1457
|
failureOutputReason = '';
|
|
1457
1458
|
_context20.n = 5;
|
|
@@ -1480,8 +1481,10 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1480
1481
|
failureOutputReason = '';
|
|
1481
1482
|
}
|
|
1482
1483
|
case 7:
|
|
1483
|
-
|
|
1484
|
-
|
|
1484
|
+
usedAsset = feeAsset !== null && feeAsset !== void 0 ? feeAsset : findAssetInfoOrThrow(chain, {
|
|
1485
|
+
symbol: Native(getNativeAssetSymbol(chain))
|
|
1486
|
+
}, null);
|
|
1487
|
+
usedSymbol = usedAsset.symbol;
|
|
1485
1488
|
if (isSuccess) {
|
|
1486
1489
|
_context20.n = 8;
|
|
1487
1490
|
break;
|
|
@@ -1613,13 +1616,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1613
1616
|
}, {
|
|
1614
1617
|
key: "getDryRunXcm",
|
|
1615
1618
|
value: function () {
|
|
1616
|
-
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(
|
|
1617
|
-
var
|
|
1619
|
+
var _getDryRunXcm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(_ref8) {
|
|
1620
|
+
var _ref9, _processAssetsDeposit, _ref0, _ref1, _ref10, _ref11, _ref12;
|
|
1618
1621
|
var originLocation, xcm, chain, origin, asset, feeAsset, originFee, amount, supportsDryRunApi, transformedOriginLocation, result, symbol, isSuccess, failureReason, actualWeight, weight, forwardedXcms, destParaId, _fee, emitted, reversedEvents, palletsWithIssued, isFeeAsset, feeAssetFeeEvent, processedAssetsAmount, feeEvent, fee, processedFee;
|
|
1619
1622
|
return _regenerator().w(function (_context23) {
|
|
1620
1623
|
while (1) switch (_context23.n) {
|
|
1621
1624
|
case 0:
|
|
1622
|
-
originLocation =
|
|
1625
|
+
originLocation = _ref8.originLocation, xcm = _ref8.xcm, chain = _ref8.chain, origin = _ref8.origin, asset = _ref8.asset, feeAsset = _ref8.feeAsset, originFee = _ref8.originFee, amount = _ref8.amount;
|
|
1623
1626
|
supportsDryRunApi = getAssetsObject(chain).supportsDryRunApi;
|
|
1624
1627
|
if (supportsDryRunApi) {
|
|
1625
1628
|
_context23.n = 1;
|
|
@@ -1679,13 +1682,13 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1679
1682
|
reversedEvents = _toConsumableArray(emitted).reverse();
|
|
1680
1683
|
palletsWithIssued = ['Balances', 'ForeignAssets', 'Assets'];
|
|
1681
1684
|
isFeeAsset = origin === 'AssetHubPolkadot' && feeAsset && asset && isAssetEqual(feeAsset, asset);
|
|
1682
|
-
feeAssetFeeEvent = (
|
|
1685
|
+
feeAssetFeeEvent = (_ref9 = isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1683
1686
|
return (event.type === 'ForeignAssets' || event.type === 'Assets') && event.value.type === 'Issued';
|
|
1684
|
-
}) : undefined) !== null &&
|
|
1687
|
+
}) : undefined) !== null && _ref9 !== void 0 ? _ref9 : isFeeAsset ? _toConsumableArray(emitted).find(function (event) {
|
|
1685
1688
|
return event.type === 'Tokens' && event.value.type === 'Deposited';
|
|
1686
1689
|
}) : undefined;
|
|
1687
1690
|
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);
|
|
1688
|
-
feeEvent = (_ref1 = (_ref10 = (_ref11 = (_ref12 =
|
|
1691
|
+
feeEvent = (_ref0 = (_ref1 = (_ref10 = (_ref11 = (_ref12 = feeAssetFeeEvent !== null && feeAssetFeeEvent !== void 0 ? feeAssetFeeEvent :
|
|
1689
1692
|
//
|
|
1690
1693
|
processedAssetsAmount !== undefined ? {
|
|
1691
1694
|
type: 'Assets',
|
|
@@ -1695,23 +1698,23 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
1695
1698
|
amount: processedAssetsAmount
|
|
1696
1699
|
}
|
|
1697
1700
|
}
|
|
1698
|
-
} : undefined) !== null &&
|
|
1701
|
+
} : undefined) !== null && _ref12 !== void 0 ? _ref12 :
|
|
1699
1702
|
//
|
|
1700
1703
|
chain === 'Mythos' ? reversedEvents.find(function (event) {
|
|
1701
1704
|
return event.type === 'Balances' && event.value.type === 'Issued';
|
|
1702
|
-
}) : undefined) !== null &&
|
|
1705
|
+
}) : undefined) !== null && _ref11 !== void 0 ? _ref11 :
|
|
1703
1706
|
//
|
|
1704
1707
|
origin === 'Mythos' || chain === 'AssetHubPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== 'DOT' ? reversedEvents.find(function (event) {
|
|
1705
1708
|
return event.type === 'AssetConversion' && event.value.type === 'SwapCreditExecuted';
|
|
1706
|
-
}) : undefined) !== null &&
|
|
1709
|
+
}) : undefined) !== null && _ref10 !== void 0 ? _ref10 :
|
|
1707
1710
|
// Prefer to Minted event
|
|
1708
1711
|
reversedEvents.find(function (event) {
|
|
1709
1712
|
return ['Balances', 'ForeignAssets'].includes(event.type) && event.value.type === 'Minted';
|
|
1710
|
-
})) !== null &&
|
|
1713
|
+
})) !== null && _ref1 !== void 0 ? _ref1 :
|
|
1711
1714
|
// Fallback an Issued event
|
|
1712
1715
|
reversedEvents.find(function (event) {
|
|
1713
1716
|
return palletsWithIssued.includes(event.type) && event.value.type === 'Issued';
|
|
1714
|
-
})) !== null &&
|
|
1717
|
+
})) !== null && _ref0 !== void 0 ? _ref0 : reversedEvents.find(function (event) {
|
|
1715
1718
|
return ['Currencies', 'Tokens'].includes(event.type) && event.value.type === 'Deposited';
|
|
1716
1719
|
});
|
|
1717
1720
|
if (feeEvent) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.1",
|
|
4
4
|
"description": "SDK for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"viem": "^2.36.0",
|
|
28
|
-
"@paraspell/sdk-core": "11.
|
|
28
|
+
"@paraspell/sdk-core": "11.4.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"polkadot-api": ">= 1.16.3 < 2"
|