@paraspell/sdk-core 10.4.1 → 10.4.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
@@ -2873,61 +2873,55 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
2873
2873
  while (1) switch (_context.n) {
2874
2874
  case 0:
2875
2875
  if (!(node === 'Moonbeam' || node === 'Moonriver')) {
2876
- _context.n = 3;
2876
+ _context.n = 2;
2877
2877
  break;
2878
2878
  }
2879
- if (!(!assets.isForeignAsset(asset) || !asset.assetId)) {
2879
+ if (!(!assets.isForeignAsset(asset) || !asset.assetId || !asset.multiLocation)) {
2880
2880
  _context.n = 1;
2881
2881
  break;
2882
2882
  }
2883
- throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
2883
+ throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location or assetId"));
2884
2884
  case 1:
2885
- if (!(asset.multiLocation && sdkCommon.hasJunction(asset.multiLocation, 'GlobalConsensus'))) {
2886
- _context.n = 2;
2887
- break;
2888
- }
2889
2885
  return _context.a(2, getMoonbeamErc20Balance(node, asset.assetId, address));
2890
2886
  case 2:
2891
- return _context.a(2, api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
2892
- case 3:
2893
2887
  if (!(node === 'Mythos')) {
2894
- _context.n = 4;
2888
+ _context.n = 3;
2895
2889
  break;
2896
2890
  }
2897
2891
  return _context.a(2, api.getMythosForeignBalance(address));
2898
- case 4:
2892
+ case 3:
2899
2893
  if (assets.isForeignAsset(asset)) {
2900
- _context.n = 5;
2894
+ _context.n = 4;
2901
2895
  break;
2902
2896
  }
2903
2897
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
2904
- case 5:
2898
+ case 4:
2905
2899
  if (!(node === 'Polimec')) {
2906
- _context.n = 7;
2900
+ _context.n = 6;
2907
2901
  break;
2908
2902
  }
2909
2903
  if (!(asset.multiLocation === undefined)) {
2910
- _context.n = 6;
2904
+ _context.n = 5;
2911
2905
  break;
2912
2906
  }
2913
2907
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location"));
2914
- case 6:
2908
+ case 5:
2915
2909
  return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
2916
- case 7:
2910
+ case 6:
2917
2911
  if (!(node === 'AssetHubPolkadot')) {
2918
- _context.n = 9;
2912
+ _context.n = 8;
2919
2913
  break;
2920
2914
  }
2921
2915
  ASSETS_PALLET_ID = 50;
2922
2916
  hasRequiredJunctions = asset.multiLocation && sdkCommon.hasJunction(asset.multiLocation, 'PalletInstance', ASSETS_PALLET_ID) && sdkCommon.hasJunction(asset.multiLocation, 'GeneralIndex');
2923
2917
  if (!(!asset.multiLocation || hasRequiredJunctions)) {
2924
- _context.n = 8;
2918
+ _context.n = 7;
2925
2919
  break;
2926
2920
  }
2927
2921
  return _context.a(2, api.getBalanceAssetsPallet(address, Number(asset.assetId)));
2928
- case 8:
2922
+ case 7:
2929
2923
  return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
2930
- case 9:
2924
+ case 8:
2931
2925
  return _context.a(2, api.getBalanceForeignPolkadotXcm(address, asset.assetId));
2932
2926
  }
2933
2927
  }, _callee);
@@ -6993,7 +6987,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
6993
6987
  var _this;
6994
6988
  _classCallCheck(this, AssetHubPolkadot);
6995
6989
  _this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', exports.Version.V3]);
6996
- _this.handleBifrostEthTransfer = function (input) {
6990
+ _this.handleLocalReserveTransfer = function (input) {
6997
6991
  var useDOTAsFeeAsset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6998
6992
  var api = input.api,
6999
6993
  scenario = input.scenario,
@@ -7324,6 +7318,9 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
7324
7318
  if (!assets.isAssetEqual(feeAsset, asset)) {
7325
7319
  throw new assets.InvalidCurrencyError("Fee asset does not match transfer asset.");
7326
7320
  }
7321
+ if (assets.normalizeSymbol(asset.symbol) === assets.normalizeSymbol('KSM')) {
7322
+ return Promise.resolve(this.handleLocalReserveTransfer(input));
7323
+ }
7327
7324
  var isNativeAsset = asset.symbol === this.getNativeAssetSymbol();
7328
7325
  if (!isNativeAsset) {
7329
7326
  return Promise.resolve(this.handleExecuteTransfer(input));
@@ -7340,10 +7337,10 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
7340
7337
  }
7341
7338
  var isEthereumAsset = asset.multiLocation && assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
7342
7339
  if (destination === 'BifrostPolkadot' && isEthereumAsset) {
7343
- return Promise.resolve(this.handleBifrostEthTransfer(input));
7340
+ return Promise.resolve(this.handleLocalReserveTransfer(input));
7344
7341
  }
7345
7342
  if (isEthereumAsset) {
7346
- return Promise.resolve(this.handleBifrostEthTransfer(input, true));
7343
+ return Promise.resolve(this.handleLocalReserveTransfer(input, true));
7347
7344
  }
7348
7345
  var isSystemNode = !sdkCommon.isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
7349
7346
  if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !assets.isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode) {
package/dist/index.d.ts CHANGED
@@ -1298,7 +1298,7 @@ declare class AssetHubPolkadot<TApi, TRes> extends ParachainNode<TApi, TRes> imp
1298
1298
  handleEthBridgeNativeTransfer<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): Promise<TRes>;
1299
1299
  handleEthBridgeTransfer<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): Promise<TRes>;
1300
1300
  handleMythosTransfer<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): TRes;
1301
- handleBifrostEthTransfer: <TApi_1, TRes_1>(input: TPolkadotXCMTransferOptions<TApi_1, TRes_1>, useDOTAsFeeAsset?: boolean) => TRes_1;
1301
+ handleLocalReserveTransfer: <TApi_1, TRes_1>(input: TPolkadotXCMTransferOptions<TApi_1, TRes_1>, useDOTAsFeeAsset?: boolean) => TRes_1;
1302
1302
  patchInput<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): TPolkadotXCMTransferOptions<TApi, TRes>;
1303
1303
  private getMethod;
1304
1304
  private handleExecuteTransfer;
package/dist/index.mjs CHANGED
@@ -2874,61 +2874,55 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
2874
2874
  while (1) switch (_context.n) {
2875
2875
  case 0:
2876
2876
  if (!(node === 'Moonbeam' || node === 'Moonriver')) {
2877
- _context.n = 3;
2877
+ _context.n = 2;
2878
2878
  break;
2879
2879
  }
2880
- if (!(!isForeignAsset(asset) || !asset.assetId)) {
2880
+ if (!(!isForeignAsset(asset) || !asset.assetId || !asset.multiLocation)) {
2881
2881
  _context.n = 1;
2882
2882
  break;
2883
2883
  }
2884
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
2884
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location or assetId"));
2885
2885
  case 1:
2886
- if (!(asset.multiLocation && hasJunction(asset.multiLocation, 'GlobalConsensus'))) {
2887
- _context.n = 2;
2888
- break;
2889
- }
2890
2886
  return _context.a(2, getMoonbeamErc20Balance(node, asset.assetId, address));
2891
2887
  case 2:
2892
- return _context.a(2, api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
2893
- case 3:
2894
2888
  if (!(node === 'Mythos')) {
2895
- _context.n = 4;
2889
+ _context.n = 3;
2896
2890
  break;
2897
2891
  }
2898
2892
  return _context.a(2, api.getMythosForeignBalance(address));
2899
- case 4:
2893
+ case 3:
2900
2894
  if (isForeignAsset(asset)) {
2901
- _context.n = 5;
2895
+ _context.n = 4;
2902
2896
  break;
2903
2897
  }
2904
2898
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
2905
- case 5:
2899
+ case 4:
2906
2900
  if (!(node === 'Polimec')) {
2907
- _context.n = 7;
2901
+ _context.n = 6;
2908
2902
  break;
2909
2903
  }
2910
2904
  if (!(asset.multiLocation === undefined)) {
2911
- _context.n = 6;
2905
+ _context.n = 5;
2912
2906
  break;
2913
2907
  }
2914
2908
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location"));
2915
- case 6:
2909
+ case 5:
2916
2910
  return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
2917
- case 7:
2911
+ case 6:
2918
2912
  if (!(node === 'AssetHubPolkadot')) {
2919
- _context.n = 9;
2913
+ _context.n = 8;
2920
2914
  break;
2921
2915
  }
2922
2916
  ASSETS_PALLET_ID = 50;
2923
2917
  hasRequiredJunctions = asset.multiLocation && hasJunction(asset.multiLocation, 'PalletInstance', ASSETS_PALLET_ID) && hasJunction(asset.multiLocation, 'GeneralIndex');
2924
2918
  if (!(!asset.multiLocation || hasRequiredJunctions)) {
2925
- _context.n = 8;
2919
+ _context.n = 7;
2926
2920
  break;
2927
2921
  }
2928
2922
  return _context.a(2, api.getBalanceAssetsPallet(address, Number(asset.assetId)));
2929
- case 8:
2923
+ case 7:
2930
2924
  return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
2931
- case 9:
2925
+ case 8:
2932
2926
  return _context.a(2, api.getBalanceForeignPolkadotXcm(address, asset.assetId));
2933
2927
  }
2934
2928
  }, _callee);
@@ -6994,7 +6988,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
6994
6988
  var _this;
6995
6989
  _classCallCheck(this, AssetHubPolkadot);
6996
6990
  _this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', Version.V3]);
6997
- _this.handleBifrostEthTransfer = function (input) {
6991
+ _this.handleLocalReserveTransfer = function (input) {
6998
6992
  var useDOTAsFeeAsset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
6999
6993
  var api = input.api,
7000
6994
  scenario = input.scenario,
@@ -7325,6 +7319,9 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
7325
7319
  if (!isAssetEqual(feeAsset, asset)) {
7326
7320
  throw new InvalidCurrencyError("Fee asset does not match transfer asset.");
7327
7321
  }
7322
+ if (normalizeSymbol(asset.symbol) === normalizeSymbol('KSM')) {
7323
+ return Promise.resolve(this.handleLocalReserveTransfer(input));
7324
+ }
7328
7325
  var isNativeAsset = asset.symbol === this.getNativeAssetSymbol();
7329
7326
  if (!isNativeAsset) {
7330
7327
  return Promise.resolve(this.handleExecuteTransfer(input));
@@ -7341,10 +7338,10 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
7341
7338
  }
7342
7339
  var isEthereumAsset = asset.multiLocation && findAssetByMultiLocation(getOtherAssets('Ethereum'), asset.multiLocation);
7343
7340
  if (destination === 'BifrostPolkadot' && isEthereumAsset) {
7344
- return Promise.resolve(this.handleBifrostEthTransfer(input));
7341
+ return Promise.resolve(this.handleLocalReserveTransfer(input));
7345
7342
  }
7346
7343
  if (isEthereumAsset) {
7347
- return Promise.resolve(this.handleBifrostEthTransfer(input, true));
7344
+ return Promise.resolve(this.handleLocalReserveTransfer(input, true));
7348
7345
  }
7349
7346
  var isSystemNode = !isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
7350
7347
  if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "10.4.1",
3
+ "version": "10.4.2",
4
4
  "description": "SDK core for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,9 +26,9 @@
26
26
  "@noble/hashes": "^1.8.0",
27
27
  "@scure/base": "^1.2.6",
28
28
  "viem": "^2.30.5",
29
- "@paraspell/pallets": "10.4.1",
30
- "@paraspell/assets": "10.4.1",
31
- "@paraspell/sdk-common": "10.4.1"
29
+ "@paraspell/assets": "10.4.2",
30
+ "@paraspell/sdk-common": "10.4.2",
31
+ "@paraspell/pallets": "10.4.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/plugin-syntax-import-attributes": "^7.27.1",