@paraspell/sdk-core 8.13.0 → 8.13.2

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/dist/index.cjs CHANGED
@@ -6759,26 +6759,42 @@ var dryRunInternal = /*#__PURE__*/function () {
6759
6759
  });
6760
6760
  case 9:
6761
6761
  initialForwardedXcms = originDryRun.forwardedXcms, initialDestParaId = originDryRun.destParaId;
6762
+ /* SPECIAL‑CASE: AssetHubKusama -> Kusama relay‑chain should bypass
6763
+ * forwarded XCM inspection - because of Rust panic */
6764
+ if (!(origin === 'AssetHubKusama' && destination === 'Kusama')) {
6765
+ _context.next = 12;
6766
+ break;
6767
+ }
6768
+ return _context.abrupt("return", {
6769
+ origin: originDryRun.success ? _objectSpread2(_objectSpread2({}, originDryRun), {}, {
6770
+ currency: assets.getNativeAssetSymbol(origin)
6771
+ }) : originDryRun,
6772
+ destination: {
6773
+ success: false,
6774
+ failureReason: 'Unknown error occurred. Please open an issue on GitHub.'
6775
+ }
6776
+ });
6777
+ case 12:
6762
6778
  currentOrigin = origin;
6763
6779
  forwardedXcms = initialForwardedXcms;
6764
6780
  nextParaId = initialDestParaId;
6765
6781
  intermediateFees = {};
6766
- case 14:
6782
+ case 16:
6767
6783
  if (!(Array.isArray(forwardedXcms) && forwardedXcms.length && forwardedXcms[1].length && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
6768
- _context.next = 41;
6784
+ _context.next = 43;
6769
6785
  break;
6770
6786
  }
6771
6787
  nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
6772
6788
  if (nextChain) {
6773
- _context.next = 18;
6789
+ _context.next = 20;
6774
6790
  break;
6775
6791
  }
6776
6792
  throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
6777
- case 18:
6793
+ case 20:
6778
6794
  hopApi = api.clone();
6779
- _context.prev = 19;
6795
+ _context.prev = 21;
6780
6796
  if (assets.hasDryRunSupport(nextChain)) {
6781
- _context.next = 23;
6797
+ _context.next = 25;
6782
6798
  break;
6783
6799
  }
6784
6800
  if (nextChain === destination) {
@@ -6787,19 +6803,19 @@ var dryRunInternal = /*#__PURE__*/function () {
6787
6803
  failureReason: "DryRunApi is not available on node ".concat(nextChain)
6788
6804
  };
6789
6805
  }
6790
- return _context.abrupt("break", 41);
6791
- case 23:
6792
- _context.next = 25;
6793
- return hopApi.init(nextChain);
6806
+ return _context.abrupt("break", 43);
6794
6807
  case 25:
6795
6808
  _context.next = 27;
6809
+ return hopApi.init(nextChain);
6810
+ case 27:
6811
+ _context.next = 29;
6796
6812
  return hopApi.getDryRunXcm({
6797
6813
  originLocation: addXcmVersionHeader(createOriginLocation(currentOrigin, nextChain), exports.Version.V4),
6798
6814
  xcm: forwardedXcms[1][0],
6799
6815
  node: nextChain,
6800
6816
  origin: currentOrigin
6801
6817
  });
6802
- case 27:
6818
+ case 29:
6803
6819
  hopDryRun = _context.sent;
6804
6820
  if (nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination)) {
6805
6821
  destinationDryRun = hopDryRun;
@@ -6809,25 +6825,25 @@ var dryRunInternal = /*#__PURE__*/function () {
6809
6825
  intermediateFees.bridgeHub = hopDryRun;
6810
6826
  }
6811
6827
  if (hopDryRun.success) {
6812
- _context.next = 31;
6828
+ _context.next = 33;
6813
6829
  break;
6814
6830
  }
6815
- return _context.abrupt("break", 41);
6816
- case 31:
6831
+ return _context.abrupt("break", 43);
6832
+ case 33:
6817
6833
  newXcms = hopDryRun.forwardedXcms, destParaId = hopDryRun.destParaId;
6818
6834
  forwardedXcms = newXcms;
6819
6835
  nextParaId = destParaId;
6820
6836
  currentOrigin = nextChain;
6821
- case 35:
6822
- _context.prev = 35;
6823
- _context.next = 38;
6837
+ case 37:
6838
+ _context.prev = 37;
6839
+ _context.next = 40;
6824
6840
  return hopApi.disconnect();
6825
- case 38:
6826
- return _context.finish(35);
6827
- case 39:
6828
- _context.next = 14;
6829
- break;
6841
+ case 40:
6842
+ return _context.finish(37);
6830
6843
  case 41:
6844
+ _context.next = 16;
6845
+ break;
6846
+ case 43:
6831
6847
  return _context.abrupt("return", {
6832
6848
  origin: originDryRun.success ? _objectSpread2(_objectSpread2({}, originDryRun), {}, {
6833
6849
  currency: assets.getNativeAssetSymbol(origin)
@@ -6842,11 +6858,11 @@ var dryRunInternal = /*#__PURE__*/function () {
6842
6858
  currency: asset.symbol
6843
6859
  }) : destinationDryRun
6844
6860
  });
6845
- case 42:
6861
+ case 44:
6846
6862
  case "end":
6847
6863
  return _context.stop();
6848
6864
  }
6849
- }, _callee, null, [[19,, 35, 39]]);
6865
+ }, _callee, null, [[21,, 37, 41]]);
6850
6866
  }));
6851
6867
  return function dryRunInternal(_x) {
6852
6868
  return _ref.apply(this, arguments);
@@ -7491,7 +7507,7 @@ var getFeeForOriginNode = /*#__PURE__*/function () {
7491
7507
  var getXcmFee = /*#__PURE__*/function () {
7492
7508
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7493
7509
  var _findAsset;
7494
- var api, tx, origin, destination, senderAddress, address, currency, disableFallback, asset, _yield$getFeeForOrigi, originFee, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, destFallback;
7510
+ var api, tx, origin, destination, senderAddress, address, currency, disableFallback, asset, _yield$getFeeForOrigi, originFee, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFee, _destApi, destFeeRes, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, destFallback;
7495
7511
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7496
7512
  while (1) switch (_context.prev = _context.next) {
7497
7513
  case 0:
@@ -7519,14 +7535,14 @@ var getXcmFee = /*#__PURE__*/function () {
7519
7535
  originDryRunError = _yield$getFeeForOrigi.dryRunError;
7520
7536
  initialForwardedXcm = _yield$getFeeForOrigi.forwardedXcms;
7521
7537
  initialDestParaId = _yield$getFeeForOrigi.destParaId;
7522
- api.setDisconnectAllowed(true);
7523
- _context.next = 15;
7524
- return api.disconnect();
7525
- case 15:
7526
- if (!originDryRunError) {
7538
+ if (!(origin === 'AssetHubKusama' && destination === 'Kusama')) {
7527
7539
  _context.next = 30;
7528
7540
  break;
7529
7541
  }
7542
+ api.setDisconnectAllowed(true);
7543
+ _context.next = 16;
7544
+ return api.disconnect();
7545
+ case 16:
7530
7546
  destApi = api.clone();
7531
7547
  _context.prev = 17;
7532
7548
  _context.next = 20;
@@ -7537,7 +7553,6 @@ var getXcmFee = /*#__PURE__*/function () {
7537
7553
  return getFeeForDestNode({
7538
7554
  api: destApi,
7539
7555
  forwardedXcms: undefined,
7540
- // force paymentInfo
7541
7556
  origin: origin,
7542
7557
  destination: destination,
7543
7558
  currency: currency,
@@ -7546,20 +7561,21 @@ var getXcmFee = /*#__PURE__*/function () {
7546
7561
  disableFallback: disableFallback
7547
7562
  });
7548
7563
  case 23:
7549
- destFeeRes = _context.sent;
7564
+ destFee = _context.sent;
7550
7565
  return _context.abrupt("return", {
7551
7566
  origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7552
7567
  fee: originFee
7553
7568
  }), originFeeType && {
7554
7569
  feeType: originFeeType
7555
7570
  }), {}, {
7556
- currency: assets.getNativeAssetSymbol(origin),
7571
+ currency: assets.getNativeAssetSymbol(origin)
7572
+ }, originDryRunError && {
7557
7573
  dryRunError: originDryRunError
7558
7574
  }),
7559
- destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7560
- fee: destFeeRes.fee
7561
- }), destFeeRes.feeType && {
7562
- feeType: destFeeRes.feeType
7575
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFee.fee && {
7576
+ fee: destFee.fee
7577
+ }), destFee.feeType && {
7578
+ feeType: destFee.feeType
7563
7579
  }), {}, {
7564
7580
  currency: assets.getNativeAssetSymbol(destination)
7565
7581
  })
@@ -7572,30 +7588,83 @@ var getXcmFee = /*#__PURE__*/function () {
7572
7588
  case 29:
7573
7589
  return _context.finish(25);
7574
7590
  case 30:
7591
+ api.setDisconnectAllowed(true);
7592
+ _context.next = 33;
7593
+ return api.disconnect();
7594
+ case 33:
7595
+ if (!originDryRunError) {
7596
+ _context.next = 48;
7597
+ break;
7598
+ }
7599
+ _destApi = api.clone();
7600
+ _context.prev = 35;
7601
+ _context.next = 38;
7602
+ return _destApi.init(destination);
7603
+ case 38:
7604
+ _destApi.setDisconnectAllowed(false);
7605
+ _context.next = 41;
7606
+ return getFeeForDestNode({
7607
+ api: _destApi,
7608
+ forwardedXcms: undefined,
7609
+ // force paymentInfo
7610
+ origin: origin,
7611
+ destination: destination,
7612
+ currency: currency,
7613
+ address: address,
7614
+ senderAddress: senderAddress,
7615
+ disableFallback: disableFallback
7616
+ });
7617
+ case 41:
7618
+ destFeeRes = _context.sent;
7619
+ return _context.abrupt("return", {
7620
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7621
+ fee: originFee
7622
+ }), originFeeType && {
7623
+ feeType: originFeeType
7624
+ }), {}, {
7625
+ currency: assets.getNativeAssetSymbol(origin),
7626
+ dryRunError: originDryRunError
7627
+ }),
7628
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7629
+ fee: destFeeRes.fee
7630
+ }), destFeeRes.feeType && {
7631
+ feeType: destFeeRes.feeType
7632
+ }), {}, {
7633
+ currency: assets.getNativeAssetSymbol(destination)
7634
+ })
7635
+ });
7636
+ case 43:
7637
+ _context.prev = 43;
7638
+ _destApi.setDisconnectAllowed(true);
7639
+ _context.next = 47;
7640
+ return _destApi.disconnect();
7641
+ case 47:
7642
+ return _context.finish(43);
7643
+ case 48:
7575
7644
  currentOrigin = origin;
7576
7645
  forwardedXcms = initialForwardedXcm;
7577
7646
  nextParaId = initialDestParaId;
7578
7647
  intermediateFees = {};
7579
7648
  destinationFee = 0n;
7580
7649
  destinationFeeType = 'paymentInfo';
7581
- case 36:
7650
+ case 54:
7582
7651
  if (!(Array.isArray(forwardedXcms) && forwardedXcms.length > 0 && forwardedXcms[1].length > 0 && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
7583
- _context.next = 68;
7652
+ _context.next = 86;
7584
7653
  break;
7585
7654
  }
7586
7655
  nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
7587
7656
  if (!(nextChain === null)) {
7588
- _context.next = 40;
7657
+ _context.next = 58;
7589
7658
  break;
7590
7659
  }
7591
7660
  throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
7592
- case 40:
7661
+ case 58:
7593
7662
  hopApi = api.clone();
7594
- _context.prev = 41;
7595
- _context.next = 44;
7663
+ _context.prev = 59;
7664
+ _context.next = 62;
7596
7665
  return hopApi.init(nextChain);
7597
- case 44:
7598
- _context.next = 46;
7666
+ case 62:
7667
+ _context.next = 64;
7599
7668
  return getFeeForDestNode({
7600
7669
  api: hopApi,
7601
7670
  forwardedXcms: forwardedXcms,
@@ -7606,10 +7675,10 @@ var getXcmFee = /*#__PURE__*/function () {
7606
7675
  senderAddress: senderAddress,
7607
7676
  disableFallback: disableFallback
7608
7677
  });
7609
- case 46:
7678
+ case 64:
7610
7679
  hopResult = _context.sent;
7611
7680
  if (!hopResult.dryRunError) {
7612
- _context.next = 58;
7681
+ _context.next = 76;
7613
7682
  break;
7614
7683
  }
7615
7684
  failingRecord = {
@@ -7628,17 +7697,15 @@ var getXcmFee = /*#__PURE__*/function () {
7628
7697
  } else if (nextChain === 'BridgeHubPolkadot') {
7629
7698
  intermediateFees.bridgeHub = failingRecord;
7630
7699
  }
7631
- // We failed *before* the true destination fallback via paymentInfo.
7700
+ // We failed before the true destination, use fallback via paymentInfo.
7632
7701
  if (hopIsDestination) {
7633
- _context.next = 57;
7702
+ _context.next = 75;
7634
7703
  break;
7635
7704
  }
7636
- _context.next = 54;
7705
+ _context.next = 72;
7637
7706
  return getFeeForDestNode({
7638
7707
  api: hopApi,
7639
- // already at failing hop
7640
7708
  forwardedXcms: undefined,
7641
- // forces paymentInfo path
7642
7709
  origin: nextChain,
7643
7710
  destination: destination,
7644
7711
  currency: currency,
@@ -7646,13 +7713,13 @@ var getXcmFee = /*#__PURE__*/function () {
7646
7713
  senderAddress: senderAddress,
7647
7714
  disableFallback: disableFallback
7648
7715
  });
7649
- case 54:
7716
+ case 72:
7650
7717
  destFallback = _context.sent;
7651
7718
  destinationFee = destFallback.fee;
7652
- destinationFeeType = destFallback.feeType; // paymentInfo
7653
- case 57:
7654
- return _context.abrupt("break", 68);
7655
- case 58:
7719
+ destinationFeeType = destFallback.feeType;
7720
+ case 75:
7721
+ return _context.abrupt("break", 86);
7722
+ case 76:
7656
7723
  if (nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination)) {
7657
7724
  destinationFee = hopResult.fee;
7658
7725
  destinationFeeType = hopResult.feeType;
@@ -7672,16 +7739,16 @@ var getXcmFee = /*#__PURE__*/function () {
7672
7739
  forwardedXcms = hopResult.forwardedXcms;
7673
7740
  nextParaId = hopResult.destParaId;
7674
7741
  currentOrigin = nextChain;
7675
- case 62:
7676
- _context.prev = 62;
7677
- _context.next = 65;
7742
+ case 80:
7743
+ _context.prev = 80;
7744
+ _context.next = 83;
7678
7745
  return hopApi.disconnect();
7679
- case 65:
7680
- return _context.finish(62);
7681
- case 66:
7682
- _context.next = 36;
7746
+ case 83:
7747
+ return _context.finish(80);
7748
+ case 84:
7749
+ _context.next = 54;
7683
7750
  break;
7684
- case 68:
7751
+ case 86:
7685
7752
  return _context.abrupt("return", _objectSpread2(_objectSpread2({
7686
7753
  origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7687
7754
  fee: originFee
@@ -7703,11 +7770,11 @@ var getXcmFee = /*#__PURE__*/function () {
7703
7770
  dryRunError: destinationDryRunError
7704
7771
  })
7705
7772
  }));
7706
- case 69:
7773
+ case 87:
7707
7774
  case "end":
7708
7775
  return _context.stop();
7709
7776
  }
7710
- }, _callee, null, [[17,, 25, 30], [41,, 62, 66]]);
7777
+ }, _callee, null, [[17,, 25, 30], [35,, 43, 48], [59,, 80, 84]]);
7711
7778
  }));
7712
7779
  return function getXcmFee(_x) {
7713
7780
  return _ref2.apply(this, arguments);
@@ -8658,6 +8725,7 @@ var Builder = function Builder(api) {
8658
8725
 
8659
8726
  var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
8660
8727
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
8728
+ var ASSETS_PALLET_ID, hasRequiredJunctions;
8661
8729
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8662
8730
  while (1) switch (_context.prev = _context.next) {
8663
8731
  case 0:
@@ -8671,7 +8739,7 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
8671
8739
  }
8672
8740
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
8673
8741
  case 3:
8674
- return _context.abrupt("return", api.getBalanceForeignAssetsAccount(address, BigInt(asset.assetId)));
8742
+ return _context.abrupt("return", api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
8675
8743
  case 4:
8676
8744
  if (!(node === 'Mythos')) {
8677
8745
  _context.next = 6;
@@ -8695,19 +8763,21 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
8695
8763
  }
8696
8764
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location"));
8697
8765
  case 11:
8698
- return _context.abrupt("return", api.getAssetHubForeignBalance(address, asset.multiLocation));
8766
+ return _context.abrupt("return", api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
8699
8767
  case 12:
8700
8768
  if (!(node === 'AssetHubPolkadot')) {
8701
8769
  _context.next = 18;
8702
8770
  break;
8703
8771
  }
8704
- if (!asset.multiLocation) {
8772
+ ASSETS_PALLET_ID = 50;
8773
+ hasRequiredJunctions = asset.multiLocation && sdkCommon.hasJunction(asset.multiLocation, 'PalletInstance', ASSETS_PALLET_ID) && sdkCommon.hasJunction(asset.multiLocation, 'GeneralIndex');
8774
+ if (!(!asset.multiLocation || hasRequiredJunctions)) {
8705
8775
  _context.next = 17;
8706
8776
  break;
8707
8777
  }
8708
- return _context.abrupt("return", api.getAssetHubForeignBalance(address, asset.multiLocation));
8778
+ return _context.abrupt("return", api.getBalanceAssetsPallet(address, Number(asset.assetId)));
8709
8779
  case 17:
8710
- return _context.abrupt("return", api.getBalanceForeignAssetsAccount(address, Number(asset.assetId)));
8780
+ return _context.abrupt("return", api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
8711
8781
  case 18:
8712
8782
  return _context.abrupt("return", api.getBalanceForeignPolkadotXcm(address, asset.assetId));
8713
8783
  case 19:
@@ -8736,7 +8806,7 @@ var getBalanceForeignXTokens = /*#__PURE__*/function () {
8736
8806
  }
8737
8807
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
8738
8808
  case 3:
8739
- return _context.abrupt("return", api.getBalanceForeignAssetsAccount(address, BigInt(asset.assetId)));
8809
+ return _context.abrupt("return", api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
8740
8810
  case 4:
8741
8811
  if (!(node === 'BifrostPolkadot' || node === 'BifrostKusama')) {
8742
8812
  _context.next = 6;
package/dist/index.d.ts CHANGED
@@ -740,11 +740,11 @@ interface IPolkadotApi<TApi, TRes> {
740
740
  getBalanceNativeAcala(address: string, symbol: string): Promise<bigint>;
741
741
  getBalanceForeignPolkadotXcm(address: string, id?: string): Promise<bigint>;
742
742
  getMythosForeignBalance(address: string): Promise<bigint>;
743
- getAssetHubForeignBalance(address: string, multiLocation: TMultiLocation): Promise<bigint>;
743
+ getBalanceForeignAssetsPallet(address: string, multiLocation: TMultiLocation): Promise<bigint>;
744
744
  getForeignAssetsByIdBalance(address: string, assetId: string): Promise<bigint>;
745
745
  getBalanceForeignXTokens(node: TNodePolkadotKusama, address: string, asset: TAsset): Promise<bigint>;
746
746
  getBalanceForeignBifrost(address: string, asset: TAsset): Promise<bigint>;
747
- getBalanceForeignAssetsAccount(address: string, assetId: bigint | number): Promise<bigint>;
747
+ getBalanceAssetsPallet(address: string, assetId: bigint | number): Promise<bigint>;
748
748
  getFromRpc(module: string, method: string, key: string): Promise<string>;
749
749
  blake2AsHex(data: Uint8Array): string;
750
750
  clone(): IPolkadotApi<TApi, TRes>;
package/dist/index.mjs CHANGED
@@ -6760,26 +6760,42 @@ var dryRunInternal = /*#__PURE__*/function () {
6760
6760
  });
6761
6761
  case 9:
6762
6762
  initialForwardedXcms = originDryRun.forwardedXcms, initialDestParaId = originDryRun.destParaId;
6763
+ /* SPECIAL‑CASE: AssetHubKusama -> Kusama relay‑chain should bypass
6764
+ * forwarded XCM inspection - because of Rust panic */
6765
+ if (!(origin === 'AssetHubKusama' && destination === 'Kusama')) {
6766
+ _context.next = 12;
6767
+ break;
6768
+ }
6769
+ return _context.abrupt("return", {
6770
+ origin: originDryRun.success ? _objectSpread2(_objectSpread2({}, originDryRun), {}, {
6771
+ currency: getNativeAssetSymbol(origin)
6772
+ }) : originDryRun,
6773
+ destination: {
6774
+ success: false,
6775
+ failureReason: 'Unknown error occurred. Please open an issue on GitHub.'
6776
+ }
6777
+ });
6778
+ case 12:
6763
6779
  currentOrigin = origin;
6764
6780
  forwardedXcms = initialForwardedXcms;
6765
6781
  nextParaId = initialDestParaId;
6766
6782
  intermediateFees = {};
6767
- case 14:
6783
+ case 16:
6768
6784
  if (!(Array.isArray(forwardedXcms) && forwardedXcms.length && forwardedXcms[1].length && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
6769
- _context.next = 41;
6785
+ _context.next = 43;
6770
6786
  break;
6771
6787
  }
6772
6788
  nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
6773
6789
  if (nextChain) {
6774
- _context.next = 18;
6790
+ _context.next = 20;
6775
6791
  break;
6776
6792
  }
6777
6793
  throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
6778
- case 18:
6794
+ case 20:
6779
6795
  hopApi = api.clone();
6780
- _context.prev = 19;
6796
+ _context.prev = 21;
6781
6797
  if (hasDryRunSupport(nextChain)) {
6782
- _context.next = 23;
6798
+ _context.next = 25;
6783
6799
  break;
6784
6800
  }
6785
6801
  if (nextChain === destination) {
@@ -6788,19 +6804,19 @@ var dryRunInternal = /*#__PURE__*/function () {
6788
6804
  failureReason: "DryRunApi is not available on node ".concat(nextChain)
6789
6805
  };
6790
6806
  }
6791
- return _context.abrupt("break", 41);
6792
- case 23:
6793
- _context.next = 25;
6794
- return hopApi.init(nextChain);
6807
+ return _context.abrupt("break", 43);
6795
6808
  case 25:
6796
6809
  _context.next = 27;
6810
+ return hopApi.init(nextChain);
6811
+ case 27:
6812
+ _context.next = 29;
6797
6813
  return hopApi.getDryRunXcm({
6798
6814
  originLocation: addXcmVersionHeader(createOriginLocation(currentOrigin, nextChain), Version.V4),
6799
6815
  xcm: forwardedXcms[1][0],
6800
6816
  node: nextChain,
6801
6817
  origin: currentOrigin
6802
6818
  });
6803
- case 27:
6819
+ case 29:
6804
6820
  hopDryRun = _context.sent;
6805
6821
  if (nextChain === destination || isRelayChain(nextChain) && !isRelayChain(destination)) {
6806
6822
  destinationDryRun = hopDryRun;
@@ -6810,25 +6826,25 @@ var dryRunInternal = /*#__PURE__*/function () {
6810
6826
  intermediateFees.bridgeHub = hopDryRun;
6811
6827
  }
6812
6828
  if (hopDryRun.success) {
6813
- _context.next = 31;
6829
+ _context.next = 33;
6814
6830
  break;
6815
6831
  }
6816
- return _context.abrupt("break", 41);
6817
- case 31:
6832
+ return _context.abrupt("break", 43);
6833
+ case 33:
6818
6834
  newXcms = hopDryRun.forwardedXcms, destParaId = hopDryRun.destParaId;
6819
6835
  forwardedXcms = newXcms;
6820
6836
  nextParaId = destParaId;
6821
6837
  currentOrigin = nextChain;
6822
- case 35:
6823
- _context.prev = 35;
6824
- _context.next = 38;
6838
+ case 37:
6839
+ _context.prev = 37;
6840
+ _context.next = 40;
6825
6841
  return hopApi.disconnect();
6826
- case 38:
6827
- return _context.finish(35);
6828
- case 39:
6829
- _context.next = 14;
6830
- break;
6842
+ case 40:
6843
+ return _context.finish(37);
6831
6844
  case 41:
6845
+ _context.next = 16;
6846
+ break;
6847
+ case 43:
6832
6848
  return _context.abrupt("return", {
6833
6849
  origin: originDryRun.success ? _objectSpread2(_objectSpread2({}, originDryRun), {}, {
6834
6850
  currency: getNativeAssetSymbol(origin)
@@ -6843,11 +6859,11 @@ var dryRunInternal = /*#__PURE__*/function () {
6843
6859
  currency: asset.symbol
6844
6860
  }) : destinationDryRun
6845
6861
  });
6846
- case 42:
6862
+ case 44:
6847
6863
  case "end":
6848
6864
  return _context.stop();
6849
6865
  }
6850
- }, _callee, null, [[19,, 35, 39]]);
6866
+ }, _callee, null, [[21,, 37, 41]]);
6851
6867
  }));
6852
6868
  return function dryRunInternal(_x) {
6853
6869
  return _ref.apply(this, arguments);
@@ -7492,7 +7508,7 @@ var getFeeForOriginNode = /*#__PURE__*/function () {
7492
7508
  var getXcmFee = /*#__PURE__*/function () {
7493
7509
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7494
7510
  var _findAsset;
7495
- var api, tx, origin, destination, senderAddress, address, currency, disableFallback, asset, _yield$getFeeForOrigi, originFee, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, destFallback;
7511
+ var api, tx, origin, destination, senderAddress, address, currency, disableFallback, asset, _yield$getFeeForOrigi, originFee, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFee, _destApi, destFeeRes, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, destFallback;
7496
7512
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7497
7513
  while (1) switch (_context.prev = _context.next) {
7498
7514
  case 0:
@@ -7520,14 +7536,14 @@ var getXcmFee = /*#__PURE__*/function () {
7520
7536
  originDryRunError = _yield$getFeeForOrigi.dryRunError;
7521
7537
  initialForwardedXcm = _yield$getFeeForOrigi.forwardedXcms;
7522
7538
  initialDestParaId = _yield$getFeeForOrigi.destParaId;
7523
- api.setDisconnectAllowed(true);
7524
- _context.next = 15;
7525
- return api.disconnect();
7526
- case 15:
7527
- if (!originDryRunError) {
7539
+ if (!(origin === 'AssetHubKusama' && destination === 'Kusama')) {
7528
7540
  _context.next = 30;
7529
7541
  break;
7530
7542
  }
7543
+ api.setDisconnectAllowed(true);
7544
+ _context.next = 16;
7545
+ return api.disconnect();
7546
+ case 16:
7531
7547
  destApi = api.clone();
7532
7548
  _context.prev = 17;
7533
7549
  _context.next = 20;
@@ -7538,7 +7554,6 @@ var getXcmFee = /*#__PURE__*/function () {
7538
7554
  return getFeeForDestNode({
7539
7555
  api: destApi,
7540
7556
  forwardedXcms: undefined,
7541
- // force paymentInfo
7542
7557
  origin: origin,
7543
7558
  destination: destination,
7544
7559
  currency: currency,
@@ -7547,20 +7562,21 @@ var getXcmFee = /*#__PURE__*/function () {
7547
7562
  disableFallback: disableFallback
7548
7563
  });
7549
7564
  case 23:
7550
- destFeeRes = _context.sent;
7565
+ destFee = _context.sent;
7551
7566
  return _context.abrupt("return", {
7552
7567
  origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7553
7568
  fee: originFee
7554
7569
  }), originFeeType && {
7555
7570
  feeType: originFeeType
7556
7571
  }), {}, {
7557
- currency: getNativeAssetSymbol(origin),
7572
+ currency: getNativeAssetSymbol(origin)
7573
+ }, originDryRunError && {
7558
7574
  dryRunError: originDryRunError
7559
7575
  }),
7560
- destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7561
- fee: destFeeRes.fee
7562
- }), destFeeRes.feeType && {
7563
- feeType: destFeeRes.feeType
7576
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFee.fee && {
7577
+ fee: destFee.fee
7578
+ }), destFee.feeType && {
7579
+ feeType: destFee.feeType
7564
7580
  }), {}, {
7565
7581
  currency: getNativeAssetSymbol(destination)
7566
7582
  })
@@ -7573,30 +7589,83 @@ var getXcmFee = /*#__PURE__*/function () {
7573
7589
  case 29:
7574
7590
  return _context.finish(25);
7575
7591
  case 30:
7592
+ api.setDisconnectAllowed(true);
7593
+ _context.next = 33;
7594
+ return api.disconnect();
7595
+ case 33:
7596
+ if (!originDryRunError) {
7597
+ _context.next = 48;
7598
+ break;
7599
+ }
7600
+ _destApi = api.clone();
7601
+ _context.prev = 35;
7602
+ _context.next = 38;
7603
+ return _destApi.init(destination);
7604
+ case 38:
7605
+ _destApi.setDisconnectAllowed(false);
7606
+ _context.next = 41;
7607
+ return getFeeForDestNode({
7608
+ api: _destApi,
7609
+ forwardedXcms: undefined,
7610
+ // force paymentInfo
7611
+ origin: origin,
7612
+ destination: destination,
7613
+ currency: currency,
7614
+ address: address,
7615
+ senderAddress: senderAddress,
7616
+ disableFallback: disableFallback
7617
+ });
7618
+ case 41:
7619
+ destFeeRes = _context.sent;
7620
+ return _context.abrupt("return", {
7621
+ origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7622
+ fee: originFee
7623
+ }), originFeeType && {
7624
+ feeType: originFeeType
7625
+ }), {}, {
7626
+ currency: getNativeAssetSymbol(origin),
7627
+ dryRunError: originDryRunError
7628
+ }),
7629
+ destination: _objectSpread2(_objectSpread2(_objectSpread2({}, destFeeRes.fee && {
7630
+ fee: destFeeRes.fee
7631
+ }), destFeeRes.feeType && {
7632
+ feeType: destFeeRes.feeType
7633
+ }), {}, {
7634
+ currency: getNativeAssetSymbol(destination)
7635
+ })
7636
+ });
7637
+ case 43:
7638
+ _context.prev = 43;
7639
+ _destApi.setDisconnectAllowed(true);
7640
+ _context.next = 47;
7641
+ return _destApi.disconnect();
7642
+ case 47:
7643
+ return _context.finish(43);
7644
+ case 48:
7576
7645
  currentOrigin = origin;
7577
7646
  forwardedXcms = initialForwardedXcm;
7578
7647
  nextParaId = initialDestParaId;
7579
7648
  intermediateFees = {};
7580
7649
  destinationFee = 0n;
7581
7650
  destinationFeeType = 'paymentInfo';
7582
- case 36:
7651
+ case 54:
7583
7652
  if (!(Array.isArray(forwardedXcms) && forwardedXcms.length > 0 && forwardedXcms[1].length > 0 && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
7584
- _context.next = 68;
7653
+ _context.next = 86;
7585
7654
  break;
7586
7655
  }
7587
7656
  nextChain = getTNode(nextParaId, determineRelayChain(origin) === 'Polkadot' ? 'polkadot' : 'kusama');
7588
7657
  if (!(nextChain === null)) {
7589
- _context.next = 40;
7658
+ _context.next = 58;
7590
7659
  break;
7591
7660
  }
7592
7661
  throw new Error("Unable to find TNode for paraId ".concat(nextParaId));
7593
- case 40:
7662
+ case 58:
7594
7663
  hopApi = api.clone();
7595
- _context.prev = 41;
7596
- _context.next = 44;
7664
+ _context.prev = 59;
7665
+ _context.next = 62;
7597
7666
  return hopApi.init(nextChain);
7598
- case 44:
7599
- _context.next = 46;
7667
+ case 62:
7668
+ _context.next = 64;
7600
7669
  return getFeeForDestNode({
7601
7670
  api: hopApi,
7602
7671
  forwardedXcms: forwardedXcms,
@@ -7607,10 +7676,10 @@ var getXcmFee = /*#__PURE__*/function () {
7607
7676
  senderAddress: senderAddress,
7608
7677
  disableFallback: disableFallback
7609
7678
  });
7610
- case 46:
7679
+ case 64:
7611
7680
  hopResult = _context.sent;
7612
7681
  if (!hopResult.dryRunError) {
7613
- _context.next = 58;
7682
+ _context.next = 76;
7614
7683
  break;
7615
7684
  }
7616
7685
  failingRecord = {
@@ -7629,17 +7698,15 @@ var getXcmFee = /*#__PURE__*/function () {
7629
7698
  } else if (nextChain === 'BridgeHubPolkadot') {
7630
7699
  intermediateFees.bridgeHub = failingRecord;
7631
7700
  }
7632
- // We failed *before* the true destination fallback via paymentInfo.
7701
+ // We failed before the true destination, use fallback via paymentInfo.
7633
7702
  if (hopIsDestination) {
7634
- _context.next = 57;
7703
+ _context.next = 75;
7635
7704
  break;
7636
7705
  }
7637
- _context.next = 54;
7706
+ _context.next = 72;
7638
7707
  return getFeeForDestNode({
7639
7708
  api: hopApi,
7640
- // already at failing hop
7641
7709
  forwardedXcms: undefined,
7642
- // forces paymentInfo path
7643
7710
  origin: nextChain,
7644
7711
  destination: destination,
7645
7712
  currency: currency,
@@ -7647,13 +7714,13 @@ var getXcmFee = /*#__PURE__*/function () {
7647
7714
  senderAddress: senderAddress,
7648
7715
  disableFallback: disableFallback
7649
7716
  });
7650
- case 54:
7717
+ case 72:
7651
7718
  destFallback = _context.sent;
7652
7719
  destinationFee = destFallback.fee;
7653
- destinationFeeType = destFallback.feeType; // paymentInfo
7654
- case 57:
7655
- return _context.abrupt("break", 68);
7656
- case 58:
7720
+ destinationFeeType = destFallback.feeType;
7721
+ case 75:
7722
+ return _context.abrupt("break", 86);
7723
+ case 76:
7657
7724
  if (nextChain === destination || isRelayChain(nextChain) && !isRelayChain(destination)) {
7658
7725
  destinationFee = hopResult.fee;
7659
7726
  destinationFeeType = hopResult.feeType;
@@ -7673,16 +7740,16 @@ var getXcmFee = /*#__PURE__*/function () {
7673
7740
  forwardedXcms = hopResult.forwardedXcms;
7674
7741
  nextParaId = hopResult.destParaId;
7675
7742
  currentOrigin = nextChain;
7676
- case 62:
7677
- _context.prev = 62;
7678
- _context.next = 65;
7743
+ case 80:
7744
+ _context.prev = 80;
7745
+ _context.next = 83;
7679
7746
  return hopApi.disconnect();
7680
- case 65:
7681
- return _context.finish(62);
7682
- case 66:
7683
- _context.next = 36;
7747
+ case 83:
7748
+ return _context.finish(80);
7749
+ case 84:
7750
+ _context.next = 54;
7684
7751
  break;
7685
- case 68:
7752
+ case 86:
7686
7753
  return _context.abrupt("return", _objectSpread2(_objectSpread2({
7687
7754
  origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
7688
7755
  fee: originFee
@@ -7704,11 +7771,11 @@ var getXcmFee = /*#__PURE__*/function () {
7704
7771
  dryRunError: destinationDryRunError
7705
7772
  })
7706
7773
  }));
7707
- case 69:
7774
+ case 87:
7708
7775
  case "end":
7709
7776
  return _context.stop();
7710
7777
  }
7711
- }, _callee, null, [[17,, 25, 30], [41,, 62, 66]]);
7778
+ }, _callee, null, [[17,, 25, 30], [35,, 43, 48], [59,, 80, 84]]);
7712
7779
  }));
7713
7780
  return function getXcmFee(_x) {
7714
7781
  return _ref2.apply(this, arguments);
@@ -8659,6 +8726,7 @@ var Builder = function Builder(api) {
8659
8726
 
8660
8727
  var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
8661
8728
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
8729
+ var ASSETS_PALLET_ID, hasRequiredJunctions;
8662
8730
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8663
8731
  while (1) switch (_context.prev = _context.next) {
8664
8732
  case 0:
@@ -8672,7 +8740,7 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
8672
8740
  }
8673
8741
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
8674
8742
  case 3:
8675
- return _context.abrupt("return", api.getBalanceForeignAssetsAccount(address, BigInt(asset.assetId)));
8743
+ return _context.abrupt("return", api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
8676
8744
  case 4:
8677
8745
  if (!(node === 'Mythos')) {
8678
8746
  _context.next = 6;
@@ -8696,19 +8764,21 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
8696
8764
  }
8697
8765
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location"));
8698
8766
  case 11:
8699
- return _context.abrupt("return", api.getAssetHubForeignBalance(address, asset.multiLocation));
8767
+ return _context.abrupt("return", api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
8700
8768
  case 12:
8701
8769
  if (!(node === 'AssetHubPolkadot')) {
8702
8770
  _context.next = 18;
8703
8771
  break;
8704
8772
  }
8705
- if (!asset.multiLocation) {
8773
+ ASSETS_PALLET_ID = 50;
8774
+ hasRequiredJunctions = asset.multiLocation && hasJunction(asset.multiLocation, 'PalletInstance', ASSETS_PALLET_ID) && hasJunction(asset.multiLocation, 'GeneralIndex');
8775
+ if (!(!asset.multiLocation || hasRequiredJunctions)) {
8706
8776
  _context.next = 17;
8707
8777
  break;
8708
8778
  }
8709
- return _context.abrupt("return", api.getAssetHubForeignBalance(address, asset.multiLocation));
8779
+ return _context.abrupt("return", api.getBalanceAssetsPallet(address, Number(asset.assetId)));
8710
8780
  case 17:
8711
- return _context.abrupt("return", api.getBalanceForeignAssetsAccount(address, Number(asset.assetId)));
8781
+ return _context.abrupt("return", api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
8712
8782
  case 18:
8713
8783
  return _context.abrupt("return", api.getBalanceForeignPolkadotXcm(address, asset.assetId));
8714
8784
  case 19:
@@ -8737,7 +8807,7 @@ var getBalanceForeignXTokens = /*#__PURE__*/function () {
8737
8807
  }
8738
8808
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
8739
8809
  case 3:
8740
- return _context.abrupt("return", api.getBalanceForeignAssetsAccount(address, BigInt(asset.assetId)));
8810
+ return _context.abrupt("return", api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
8741
8811
  case 4:
8742
8812
  if (!(node === 'BifrostPolkadot' || node === 'BifrostKusama')) {
8743
8813
  _context.next = 6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "8.13.0",
3
+ "version": "8.13.2",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,9 +25,9 @@
25
25
  "dependencies": {
26
26
  "ethers": "^6.13.7",
27
27
  "viem": "^2.28.1",
28
- "@paraspell/assets": "8.13.0",
29
- "@paraspell/sdk-common": "8.13.0",
30
- "@paraspell/pallets": "8.13.0"
28
+ "@paraspell/assets": "8.13.2",
29
+ "@paraspell/sdk-common": "8.13.2",
30
+ "@paraspell/pallets": "8.13.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/plugin-syntax-import-attributes": "^7.27.1",