@paraspell/sdk-pjs 13.10.1 → 13.11.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.
Files changed (2) hide show
  1. package/dist/index.mjs +15 -12
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, findNativeAssetInfoOrThrowImpl, isCustomChain, getChainProvidersImpl, isSenderSigner, PolkadotApi, findAssetInfoOrThrowImpl, hasXcmPaymentApiSupportImpl, resolveModuleError, hasDryRunSupportImpl, RuntimeApiUnavailableError, wrapTxBypass, normalizeLocation, localizeLocation, createAssetId, addXcmVersionHeader, isAssetEqual, RELAY_LOCATION, getRelayChainOfImpl, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, findAssetInfoOrThrow, assertHasId, getParaId, RoutingResolutionError, abstractDecimals, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$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';
1
+ import { getNativeAssetSymbol, getOtherAssets, hasJunction, getJunctionValue, getEvmPrivateKeyHex, UnsupportedOperationError, createClientCache, MAX_CLIENTS, EXTENSION_MS, createClientPoolHelpers, BatchMode, isConfig, isCustomChain, isSenderSigner, PolkadotApi, getFailingInstruction, resolveModuleError, RuntimeApiUnavailableError, wrapTxBypass, normalizeLocation, localizeLocation, createAssetId, addXcmVersionHeader, isAssetEqual, RELAY_LOCATION, SubmitTransactionError, createChainClient as createChainClient$1, getBalance as getBalance$1, Foreign, ForeignAbstract, Native, Override, findAssetInfo, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getExistentialDeposit, getNativeAssets, getRelayChainSymbol, getSupportedAssets, getTChain, hasSupportForAsset, isChainEvm, convertSs58 as convertSs58$1, findAssetInfoOrThrow, assertHasId, getParaId, RoutingResolutionError, abstractDecimals, MissingParameterError, isOverrideLocationSpecifier, transferMoonbeamEvm, transferMoonbeamToEth, validateAddress as validateAddress$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 { Keyring, WsProvider, ApiPromise } from '@polkadot/api';
4
4
  import { snakeToCamel, lowercaseFirstLetter } from '@paraspell/sdk-common';
@@ -781,7 +781,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
781
781
  value: function resolveDefaultFeeAsset(_ref5) {
782
782
  var chain = _ref5.chain,
783
783
  feeAsset = _ref5.feeAsset;
784
- return feeAsset !== null && feeAsset !== void 0 ? feeAsset : findNativeAssetInfoOrThrowImpl(chain, this._customCtx);
784
+ return feeAsset !== null && feeAsset !== void 0 ? feeAsset : this.findNativeAssetInfoOrThrow(chain);
785
785
  }
786
786
  }, {
787
787
  key: "resolveFeeAsset",
@@ -817,9 +817,9 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
817
817
  case 3:
818
818
  return _context8.a(2, {
819
819
  isCustomAsset: true,
820
- asset: findAssetInfoOrThrowImpl(chain, {
820
+ asset: this.findAssetInfoOrThrow(chain, {
821
821
  id: assetId
822
- }, undefined, this._customCtx)
822
+ })
823
823
  });
824
824
  }
825
825
  }, _callee8, this);
@@ -834,12 +834,12 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
834
834
  value: function () {
835
835
  var _getDryRunCall = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
836
836
  var _this3 = this;
837
- var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _msg, forwardedXcms, actualWeight, weight, destParaId, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
837
+ var tx, address, feeAsset, chain, destination, version, _options$useRootOrigi, useRootOrigin, bypassOptions, supportsDryRunApi, basePayload, resolvedTx, resolvedFeeAsset, performDryRunCall, findFailingEventInResult, getExecutionSuccessFromResult, extractFailureReasonFromResult, response, resultHuman, resultJson, isSuccess, failureErr, shouldRetryWithVersion, msg, _resultJson, _msg, _resultJson2, forwardedXcms, actualWeight, weight, destParaId, overriddenWeight, xcmFee, _yield$this$getPaymen, executionFee, fee, _t, _t2, _t3, _t4;
838
838
  return _regenerator().w(function (_context0) {
839
839
  while (1) switch (_context0.p = _context0.n) {
840
840
  case 0:
841
841
  tx = options.tx, address = options.address, feeAsset = options.feeAsset, chain = options.chain, destination = options.destination, version = options.version, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi, bypassOptions = options.bypassOptions;
842
- supportsDryRunApi = hasDryRunSupportImpl(chain, this._customCtx);
842
+ supportsDryRunApi = this.hasDryRunSupport(chain);
843
843
  if (supportsDryRunApi) {
844
844
  _context0.n = 1;
845
845
  break;
@@ -1013,6 +1013,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1013
1013
  failureReason: failureErr.failureReason,
1014
1014
  failureSubReason: failureErr.failureSubReason,
1015
1015
  failureIndex: failureErr.failureIndex,
1016
+ failureInstruction: getFailingInstruction((_resultJson = resultJson) === null || _resultJson === void 0 || (_resultJson = _resultJson.ok) === null || _resultJson === void 0 ? void 0 : _resultJson.local_xcm, failureErr.failureIndex),
1016
1017
  asset: resolvedFeeAsset.asset
1017
1018
  });
1018
1019
  case 14:
@@ -1025,6 +1026,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1025
1026
  failureReason: failureErr.failureReason || 'Unknown error',
1026
1027
  failureSubReason: failureErr.failureSubReason,
1027
1028
  failureIndex: failureErr.failureIndex,
1029
+ failureInstruction: getFailingInstruction((_resultJson2 = resultJson) === null || _resultJson2 === void 0 || (_resultJson2 = _resultJson2.ok) === null || _resultJson2 === void 0 ? void 0 : _resultJson2.local_xcm, failureErr.failureIndex),
1028
1030
  asset: resolvedFeeAsset.asset
1029
1031
  });
1030
1032
  case 15:
@@ -1037,7 +1039,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1037
1039
  destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref8) {
1038
1040
  return i.here === null ? 0 : (_ref8 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref8 === void 0 ? void 0 : _ref8.parachain;
1039
1041
  }(Object.values(forwardedXcms[0])[0].interior);
1040
- if (!(hasXcmPaymentApiSupportImpl(chain, this._customCtx) && resultJson.ok.local_xcm && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
1042
+ if (!(this.hasXcmPaymentApiSupport(chain) && resultJson.ok.local_xcm && (feeAsset || chain.startsWith('AssetHub') && destination === 'Ethereum') || resolvedFeeAsset.isCustomAsset)) {
1041
1043
  _context0.n = 21;
1042
1044
  break;
1043
1045
  }
@@ -1213,7 +1215,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1213
1215
  case 6:
1214
1216
  deliveryFeeResJson = (_deliveryFeeRes = deliveryFeeRes) === null || _deliveryFeeRes === void 0 ? void 0 : _deliveryFeeRes.toJSON();
1215
1217
  deliveryFeeResolved = deliveryFeeRes && ((_ref9 = (_deliveryFeeResJson$o = (_deliveryFeeResJson$o2 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o2 === void 0 ? void 0 : _deliveryFeeResJson$o2.v4) !== null && _deliveryFeeResJson$o !== void 0 ? _deliveryFeeResJson$o : (_deliveryFeeResJson$o3 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o3 === void 0 ? void 0 : _deliveryFeeResJson$o3.v3) === null || _ref9 === void 0 ? void 0 : _ref9.length) > 0 ? BigInt((_ref0 = (_deliveryFeeResJson$o4 = deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o5 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o5 === void 0 ? void 0 : _deliveryFeeResJson$o5.v4) !== null && _deliveryFeeResJson$o4 !== void 0 ? _deliveryFeeResJson$o4 : deliveryFeeResJson === null || deliveryFeeResJson === void 0 || (_deliveryFeeResJson$o6 = deliveryFeeResJson.ok) === null || _deliveryFeeResJson$o6 === void 0 ? void 0 : _deliveryFeeResJson$o6.v3) === null || _ref0 === void 0 || (_ref0 = _ref0[0]) === null || _ref0 === void 0 || (_ref0 = _ref0.fun) === null || _ref0 === void 0 ? void 0 : _ref0.fungible) : 0n;
1216
- nativeAsset = findNativeAssetInfoOrThrowImpl(chain, this._customCtx);
1218
+ nativeAsset = this.findNativeAssetInfoOrThrow(chain);
1217
1219
  if (!(isAssetEqual(asset, nativeAsset) || usedThirdParam)) {
1218
1220
  _context10.n = 7;
1219
1221
  break;
@@ -1264,7 +1266,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1264
1266
  return _context11.a(2, undefined);
1265
1267
  case 2:
1266
1268
  ahApi = this.clone();
1267
- assetHubChain = "AssetHub".concat(getRelayChainOfImpl(this, chain));
1269
+ assetHubChain = "AssetHub".concat(this.getRelayChainOf(chain));
1268
1270
  _context11.n = 3;
1269
1271
  return ahApi.init(assetHubChain);
1270
1272
  case 3:
@@ -1324,7 +1326,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1324
1326
  while (1) switch (_context13.n) {
1325
1327
  case 0:
1326
1328
  originLocation = _ref1.originLocation, xcm = _ref1.xcm, asset = _ref1.asset, chain = _ref1.chain, version = _ref1.version, origin = _ref1.origin;
1327
- supportsDryRunApi = hasDryRunSupportImpl(chain, this._customCtx);
1329
+ supportsDryRunApi = this.hasDryRunSupport(chain);
1328
1330
  if (supportsDryRunApi) {
1329
1331
  _context13.n = 1;
1330
1332
  break;
@@ -1351,6 +1353,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1351
1353
  success: false,
1352
1354
  failureReason: failureReason,
1353
1355
  failureIndex: failureIndex,
1356
+ failureInstruction: getFailingInstruction(xcm, failureIndex),
1354
1357
  asset: asset
1355
1358
  });
1356
1359
  case 3:
@@ -1363,7 +1366,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1363
1366
  destParaId = forwardedXcms.length === 0 ? undefined : function (i, _ref10) {
1364
1367
  return i.Here ? 0 : (_ref10 = Array.isArray(i.x1) ? i.x1[0] : i.x1) === null || _ref10 === void 0 ? void 0 : _ref10.parachain;
1365
1368
  }(Object.values(forwardedXcms[0])[0].interior);
1366
- if (!(hasXcmPaymentApiSupportImpl(chain, this._customCtx) && asset)) {
1369
+ if (!(this.hasXcmPaymentApiSupport(chain) && asset)) {
1367
1370
  _context13.n = 5;
1368
1371
  break;
1369
1372
  }
@@ -1500,7 +1503,7 @@ var PolkadotJsApi = /*#__PURE__*/function (_PolkadotApi) {
1500
1503
  if (force) {
1501
1504
  void this.api.disconnect();
1502
1505
  } else {
1503
- var key = api === undefined ? getChainProvidersImpl(chain, this._customCtx) : api;
1506
+ var key = api === undefined ? this.getChainProviders(chain) : api;
1504
1507
  releaseClient(key);
1505
1508
  }
1506
1509
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-pjs",
3
- "version": "13.10.1",
3
+ "version": "13.11.0",
4
4
  "description": "Polkadot.js based SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,8 +29,8 @@
29
29
  "@snowbridge/registry": "^1.1.6",
30
30
  "ethers": "6.16.0",
31
31
  "viem": "^2.53.1",
32
- "@paraspell/sdk-common": "13.10.1",
33
- "@paraspell/sdk-core": "13.10.1"
32
+ "@paraspell/sdk-common": "13.11.0",
33
+ "@paraspell/sdk-core": "13.11.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@polkadot/api": ">= 16.0 < 17",