@paraspell/sdk-core 14.1.1 → 14.2.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/dist/index.d.ts CHANGED
@@ -159,6 +159,7 @@ declare abstract class SubstrateChain<TApi, TRes, TSigner, TCustomChain extends
159
159
  transferLocal(options: TTransferInternalOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
160
160
  transferLocalNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
161
161
  transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner, TCustomChain>): TRes;
162
+ protected getLocalCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, asset: TAssetInfo): unknown;
162
163
  getBalanceNative(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, address: string, asset: TAssetInfo): Promise<bigint>;
163
164
  getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, _asset: TAssetInfo): unknown;
164
165
  getBalanceForeign(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, address: string, asset: TAssetInfo): Promise<bigint>;
@@ -355,6 +356,14 @@ declare class CrustShadow<TApi, TRes, TSigner, TCustomChain extends string = nev
355
356
  transferLocalNonNativeAsset(options: TTransferLocalOptions<TApi, TRes, TSigner, TCustomChain>): TRes;
356
357
  }
357
358
 
359
+ declare class Curio<TApi, TRes, TSigner, TCustomChain extends string = never> extends SubstrateChain<TApi, TRes, TSigner, TCustomChain> implements IPolkadotXCMTransfer<TApi, TRes, TSigner, TCustomChain> {
360
+ constructor();
361
+ getCustomCurrencyId(_api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, asset: TAssetInfo): TForeignOrTokenAsset;
362
+ protected getLocalCurrencyId(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, asset: TAssetInfo): TForeignOrTokenAsset;
363
+ protected getMintConfig(): TMintConfig;
364
+ transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
365
+ }
366
+
358
367
  declare class Darwinia<TApi, TRes, TSigner, TCustomChain extends string = never> extends SubstrateChain<TApi, TRes, TSigner, TCustomChain> implements IPolkadotXCMTransfer<TApi, TRes, TSigner, TCustomChain> {
359
368
  constructor();
360
369
  protected getMintConfig(): TMintConfig;
@@ -411,6 +420,14 @@ declare class Jamton<TApi, TRes, TSigner, TCustomChain extends string = never> e
411
420
  ForeignAsset: number;
412
421
  Native?: undefined;
413
422
  };
423
+ protected getLocalCurrencyId(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, asset: TAssetInfo): {
424
+ Native: number;
425
+ ForeignAsset?: undefined;
426
+ } | {
427
+ ForeignAsset: number;
428
+ Native?: undefined;
429
+ };
430
+ protected getMintConfig(): TMintConfig;
414
431
  transferPolkadotXCM(input: TPolkadotXCMTransferOptions<TApi, TRes, TSigner, TCustomChain>): Promise<TRes>;
415
432
  }
416
433
 
@@ -550,6 +567,7 @@ declare const chains: <TApi, TRes, TSigner>() => {
550
567
  Encointer: Encointer<TApi, TRes, TSigner, never>;
551
568
  Basilisk: Basilisk<TApi, TRes, TSigner, never>;
552
569
  BifrostKusama: BifrostKusama<TApi, TRes, TSigner, never>;
570
+ Curio: Curio<TApi, TRes, TSigner, never>;
553
571
  CrustShadow: CrustShadow<TApi, TRes, TSigner, never>;
554
572
  Crab: Crab<TApi, TRes, TSigner, never>;
555
573
  Karura: Karura<TApi, TRes, TSigner, never>;
@@ -1020,6 +1038,7 @@ type TDryRunBaseOptions<TRes, TCustomChain extends string = never> = {
1020
1038
  swapConfig?: TSwapConfig;
1021
1039
  useRootOrigin?: boolean;
1022
1040
  bypassOptions?: TBypassOptions;
1041
+ keepAlive?: boolean;
1023
1042
  };
1024
1043
  type TDryRunOptions<TApi, TRes, TSigner, TCustomChain extends string = never> = WithApi<TDryRunBaseOptions<TRes, TCustomChain>, TApi, TRes, TSigner, TCustomChain>;
1025
1044
  type TDryRunCallBaseOptions<TRes, TCustomChain extends string = never> = {
@@ -1051,6 +1070,7 @@ type TDryRunCallBaseOptions<TRes, TCustomChain extends string = never> = {
1051
1070
  assets?: WithAmount<TAssetInfo>[];
1052
1071
  bypassOptions?: TBypassOptions;
1053
1072
  feeAsset?: TAssetInfo;
1073
+ keepAlive?: boolean;
1054
1074
  };
1055
1075
  type TDryRunBypassOptions<TApi, TRes, TSigner, TCustomChain extends string = never> = WithApi<Omit<TDryRunCallBaseOptions<TRes, TCustomChain>, 'useRootOrigin' | 'destination'>, TApi, TRes, TSigner, TCustomChain>;
1056
1076
  type TDryRunCallOptions<TApi, TRes, TSigner, TCustomChain extends string = never> = WithApi<TDryRunCallBaseOptions<TRes, TCustomChain>, TApi, TRes, TSigner, TCustomChain>;
@@ -2506,7 +2526,7 @@ declare const reverseTransformLocation: (location: TLocation) => TLocation;
2506
2526
 
2507
2527
  declare const normalizeAmount: (amount: bigint) => bigint;
2508
2528
 
2509
- declare const resolveDestChain: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, originChain: TSubstrateChain | TCustomChain, paraId: number | undefined) => "AssetHubPolkadot" | "Acala" | "Ajuna" | "Astar" | "BifrostPolkadot" | "BridgeHubPolkadot" | "Centrifuge" | "Darwinia" | "EnergyWebX" | "Hydration" | "Heima" | "Jamton" | "CoretimePolkadot" | "Collectives" | "Crust" | "NeuroWeb" | "Pendulum" | "Mythos" | "Peaq" | "PeoplePolkadot" | "Unique" | "Xode" | "AssetHubKusama" | "BridgeHubKusama" | "Karura" | "CoretimeKusama" | "Encointer" | "Basilisk" | "BifrostKusama" | "CrustShadow" | "Crab" | "RobonomicsPolkadot" | "PeopleKusama" | "Shiden" | "AssetHubWestend" | "BridgeHubWestend" | "CollectivesWestend" | "CoretimeWestend" | "Penpal" | "PeopleWestend" | "AssetHubPaseo" | "EnergyWebXPaseo" | "HeimaPaseo" | "HydrationPaseo" | "NeuroWebPaseo" | "PeoplePaseo" | undefined;
2529
+ declare const resolveDestChain: <TApi, TRes, TSigner, TCustomChain extends string = never>(api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>, originChain: TSubstrateChain | TCustomChain, paraId: number | undefined) => "AssetHubPolkadot" | "Acala" | "Ajuna" | "Astar" | "BifrostPolkadot" | "BridgeHubPolkadot" | "Centrifuge" | "Darwinia" | "EnergyWebX" | "Hydration" | "Heima" | "Jamton" | "CoretimePolkadot" | "Collectives" | "Crust" | "NeuroWeb" | "Pendulum" | "Mythos" | "Peaq" | "PeoplePolkadot" | "Unique" | "Xode" | "AssetHubKusama" | "BridgeHubKusama" | "Karura" | "CoretimeKusama" | "Encointer" | "Basilisk" | "BifrostKusama" | "Curio" | "CrustShadow" | "Crab" | "RobonomicsPolkadot" | "PeopleKusama" | "Shiden" | "AssetHubWestend" | "BridgeHubWestend" | "CollectivesWestend" | "CoretimeWestend" | "Penpal" | "PeopleWestend" | "AssetHubPaseo" | "EnergyWebXPaseo" | "HeimaPaseo" | "HydrationPaseo" | "NeuroWebPaseo" | "PeoplePaseo" | undefined;
2510
2530
 
2511
2531
  declare const resolveParaId: <TApi, TRes, TSigner, TCustomChain extends string = never>(paraId: number | undefined, destination: TDestination, api: PolkadotApi<TApi, TRes, TSigner, TCustomChain>) => number | undefined;
2512
2532
 
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { blake2b } from '@noble/hashes/blake2.js';
2
- import { isChainEvm, getAssetsObject, InvalidCurrencyError, isSymbolMatch, isAssetEqual, isStableCoinAsset, isBridgedSystemAsset, isSymbolSpecifier, normalizeLocation, getNativeAssetSymbol, getEdFromAssetOrThrow, extractAssetLocation, hasDryRunSupport, normalizeSymbol, Native, getOtherAssets, canonicalizeLocation, getAssetsObjectImpl, getAssetsImpl, getNativeAssetsImpl, getOtherAssetsImpl, findAssetInfoImpl, findAssetInfoOrThrowImpl, findAssetInfoOnDestImpl, findAssetOnDestOrThrowImpl, findNativeAssetInfoImpl, findNativeAssetInfoOrThrowImpl, isChainEvmImpl, getNativeAssetSymbolImpl, getRelayChainSymbolImpl, hasDryRunSupportImpl, hasXcmPaymentApiSupportImpl, getExistentialDepositOrThrowImpl, normalizeCustomAssets } from '@paraspell/assets';
2
+ import { isChainEvm, getAssetsObject, InvalidCurrencyError, isSymbolMatch, isAssetEqual, isStableCoinAsset, isAdditionalSubstrateBridgeAsset, isBridgedSystemAsset, STABLECOIN_IDS, isSymbolSpecifier, normalizeLocation, getNativeAssetSymbol, getEdFromAssetOrThrow, extractAssetLocation, hasDryRunSupport, normalizeSymbol, Native, getOtherAssets, canonicalizeLocation, getAssetsObjectImpl, getAssetsImpl, getNativeAssetsImpl, getOtherAssetsImpl, findAssetInfoImpl, findAssetInfoOrThrowImpl, findAssetInfoOnDestImpl, findAssetOnDestOrThrowImpl, findNativeAssetInfoImpl, findNativeAssetInfoOrThrowImpl, isChainEvmImpl, getNativeAssetSymbolImpl, getRelayChainSymbolImpl, hasDryRunSupportImpl, hasXcmPaymentApiSupportImpl, getExistentialDepositOrThrowImpl, normalizeCustomAssets } from '@paraspell/assets';
3
3
  export * from '@paraspell/assets';
4
4
  import { base58 } from '@scure/base';
5
5
  import { isAddress, pad, toHex, getAddress, concat, keccak256, isHex, createPublicClient, http, formatUnits as formatUnits$1, parseUnits as parseUnits$1 } from 'viem';
6
- import { ParaSpellError, isTLocation, replaceBigInt, isExternalChain, CHAINS, Version, isRelayChain, isSubstrateBridge, Parents, deepEqual, isTrustedChain, isCustomChain, isSnowbridge, getJunctionValue, ETHEREUM_BRIDGE_ORIGINS, isBridge, hasJunction, RELAYCHAINS, DEFAULT_SS58_PREFIX } from '@paraspell/sdk-common';
6
+ import { ParaSpellError, isTLocation, replaceBigInt, isExternalChain, CHAINS, Version, isRelayChain, isSubstrateBridge, Parents, deepEqual, isTrustedChain, isCustomChain, isSnowbridge, getJunctionValue, hasJunction, ETHEREUM_BRIDGE_ORIGINS, isBridge, RELAYCHAINS, DEFAULT_SS58_PREFIX } from '@paraspell/sdk-common';
7
7
  export * from '@paraspell/sdk-common';
8
8
  import { getXcmPallet, getOtherAssetsPallets, getNativeAssetsPallet, getSupportedPalletsDetails, ASSETS_PALLETS, NATIVE_ASSETS_PALLET_PRIORITY, OTHER_ASSETS_PALLET_PRIORITY, hasPalletImpl, getXcmPalletImpl } from '@paraspell/pallets';
9
9
  export * from '@paraspell/pallets';
@@ -819,18 +819,13 @@ var keyFromWs = function keyFromWs(ws) {
819
819
  return Array.isArray(ws) ? JSON.stringify(ws) : ws;
820
820
  };
821
821
  var createClientPoolHelpers = function createClientPoolHelpers(clientPool, createClient) {
822
- var leaseClient = /*#__PURE__*/function () {
823
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ws, ttlMs) {
824
- var key, entry, client;
822
+ var pendingClients = new Map();
823
+ var createEntry = /*#__PURE__*/function () {
824
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(key, ws, ttlMs) {
825
+ var client, entry;
825
826
  return _regenerator().w(function (_context) {
826
827
  while (1) switch (_context.n) {
827
828
  case 0:
828
- key = keyFromWs(ws);
829
- entry = clientPool.peek(key);
830
- if (entry) {
831
- _context.n = 2;
832
- break;
833
- }
834
829
  _context.n = 1;
835
830
  return createClient(ws);
836
831
  case 1:
@@ -841,16 +836,51 @@ var createClientPoolHelpers = function createClientPoolHelpers(clientPool, creat
841
836
  destroyWanted: false
842
837
  };
843
838
  clientPool.set(key, entry, ttlMs);
839
+ return _context.a(2, entry);
840
+ }
841
+ }, _callee);
842
+ }));
843
+ return function createEntry(_x, _x2, _x3) {
844
+ return _ref.apply(this, arguments);
845
+ };
846
+ }();
847
+ var getOrCreateEntry = function getOrCreateEntry(key, ws, ttlMs) {
848
+ var pending = pendingClients.get(key);
849
+ if (pending) return pending;
850
+ var creation = Promise.resolve().then(function () {
851
+ return createEntry(key, ws, ttlMs);
852
+ })["finally"](function () {
853
+ pendingClients["delete"](key);
854
+ });
855
+ pendingClients.set(key, creation);
856
+ return creation;
857
+ };
858
+ var leaseClient = /*#__PURE__*/function () {
859
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(ws, ttlMs) {
860
+ var key, entry;
861
+ return _regenerator().w(function (_context2) {
862
+ while (1) switch (_context2.n) {
863
+ case 0:
864
+ key = keyFromWs(ws);
865
+ entry = clientPool.peek(key);
866
+ if (entry) {
867
+ _context2.n = 2;
868
+ break;
869
+ }
870
+ _context2.n = 1;
871
+ return getOrCreateEntry(key, ws, ttlMs);
872
+ case 1:
873
+ entry = _context2.v;
844
874
  case 2:
845
875
  entry.refs += 1;
846
- clientPool.revive(key, ttlMs);
847
876
  entry.destroyWanted = false;
848
- return _context.a(2, entry.client);
877
+ clientPool.revive(key, ttlMs);
878
+ return _context2.a(2, entry.client);
849
879
  }
850
- }, _callee);
880
+ }, _callee2);
851
881
  }));
852
- return function leaseClient(_x, _x2) {
853
- return _ref.apply(this, arguments);
882
+ return function leaseClient(_x4, _x5) {
883
+ return _ref2.apply(this, arguments);
854
884
  };
855
885
  }();
856
886
  var releaseClient = function releaseClient(ws) {
@@ -1449,6 +1479,17 @@ var BifrostKusama$1 = {
1449
1479
  }
1450
1480
  ]
1451
1481
  };
1482
+ var Curio$1 = {
1483
+ name: "Curio",
1484
+ info: "curio",
1485
+ paraId: 3339,
1486
+ providers: [
1487
+ {
1488
+ name: "Curio",
1489
+ endpoint: "wss://parachain.curioinvest.com/"
1490
+ }
1491
+ ]
1492
+ };
1452
1493
  var CrustShadow$1 = {
1453
1494
  name: "Crust Shadow",
1454
1495
  info: "shadow",
@@ -1854,6 +1895,7 @@ var configs = {
1854
1895
  Encointer: Encointer$1,
1855
1896
  Basilisk: Basilisk$1,
1856
1897
  BifrostKusama: BifrostKusama$1,
1898
+ Curio: Curio$1,
1857
1899
  CrustShadow: CrustShadow$1,
1858
1900
  Crab: Crab$1,
1859
1901
  RobonomicsPolkadot: RobonomicsPolkadot$1,
@@ -3096,11 +3138,10 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
3096
3138
  recipient = options.recipient,
3097
3139
  isAmountAll = options.isAmountAll,
3098
3140
  keepAlive = options.keepAlive;
3099
- assertHasId(asset);
3100
3141
  var dest = {
3101
3142
  Id: recipient
3102
3143
  };
3103
- var currencyId = BigInt(asset.assetId);
3144
+ var currencyId = this.getLocalCurrencyId(api, asset);
3104
3145
  if (isAmountAll) {
3105
3146
  return api.deserializeExtrinsics({
3106
3147
  module: 'Tokens',
@@ -3122,6 +3163,12 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
3122
3163
  }
3123
3164
  });
3124
3165
  }
3166
+ }, {
3167
+ key: "getLocalCurrencyId",
3168
+ value: function getLocalCurrencyId(_api, asset) {
3169
+ assertHasId(asset);
3170
+ return BigInt(asset.assetId);
3171
+ }
3125
3172
  }, {
3126
3173
  key: "getBalanceNative",
3127
3174
  value: function getBalanceNative(api, address, asset) {
@@ -3369,14 +3416,24 @@ var getEthereumJunction = function getEthereumJunction(api, chain) {
3369
3416
  };
3370
3417
  };
3371
3418
 
3419
+ var validateSubBridgeRules = function validateSubBridgeRules(origin, destination, asset) {
3420
+ var isBlocked = origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot' && STABLECOIN_IDS.some(function (id) {
3421
+ return hasJunction(asset.location, 'GeneralIndex', id);
3422
+ }) && !hasJunction(asset.location, 'GlobalConsensus');
3423
+ if (isBlocked) {
3424
+ throw new InvalidCurrencyError("The selected asset is not the correct ".concat(asset.symbol, " for the Substrate bridge."));
3425
+ }
3426
+ };
3372
3427
  var validateBridgeAsset = function validateBridgeAsset(origin, destination, asset, currency, isBridge, api) {
3373
3428
  if (!asset || isTLocation(destination) || isExternalChain(destination) || !isBridge) {
3374
3429
  return;
3375
3430
  }
3431
+ validateSubBridgeRules(origin, destination, asset);
3376
3432
  var nativeAsset = api.findNativeAssetInfoOrThrow(origin);
3377
3433
  var isNativeAsset = isAssetEqual(asset, nativeAsset);
3378
3434
  var isBridgedStablecoin = isStableCoinAsset(asset);
3379
- if (!(isNativeAsset || isBridgedSystemAsset(asset, [getRelayChainOf(destination)]) || isBridgedStablecoin)) {
3435
+ var isAdditionalBridgedAsset = isAdditionalSubstrateBridgeAsset(asset);
3436
+ if (!(isNativeAsset || isBridgedSystemAsset(asset, [getRelayChainOf(destination)]) || isBridgedStablecoin || isAdditionalBridgedAsset)) {
3380
3437
  throw new InvalidCurrencyError("Substrate bridge does not support currency ".concat(JSON.stringify(currency, replaceBigInt), "."));
3381
3438
  }
3382
3439
  };
@@ -4027,7 +4084,8 @@ var buildDryRun = function buildDryRun(api, tx, options, bypassOptions) {
4027
4084
  feeAsset = options.feeAsset,
4028
4085
  from = options.from,
4029
4086
  currency = options.currency,
4030
- version = options.version;
4087
+ version = options.version,
4088
+ keepAlive = options.keepAlive;
4031
4089
  if (isTLocation(to)) {
4032
4090
  throw new InvalidAddressError('Location destination is not supported for XCM fee calculation.');
4033
4091
  }
@@ -4040,7 +4098,8 @@ var buildDryRun = function buildDryRun(api, tx, options, bypassOptions) {
4040
4098
  currency: currency,
4041
4099
  feeAsset: feeAsset,
4042
4100
  version: version,
4043
- bypassOptions: bypassOptions
4101
+ bypassOptions: bypassOptions,
4102
+ keepAlive: from === to ? keepAlive !== null && keepAlive !== void 0 ? keepAlive : true : false
4044
4103
  });
4045
4104
  };
4046
4105
 
@@ -5819,11 +5878,11 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
5819
5878
 
5820
5879
  var dryRunInternal = /*#__PURE__*/function () {
5821
5880
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
5822
- var api, origin, destination, currency, tx, sender, feeAsset, swapConfig, version, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, _resolveCurrency, assets, asset, amount, resolvedVersion, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, relayChain, bridgeHubChain, assetHubChain, bridgeHubHop, processedBridgeHub, bridgeHubHopIndex, result, dryRunError, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
5881
+ var api, origin, destination, currency, tx, sender, feeAsset, swapConfig, version, bypassOptions, keepAlive, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, _resolveCurrency, assets, asset, amount, resolvedVersion, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, relayChain, bridgeHubChain, assetHubChain, bridgeHubHop, processedBridgeHub, bridgeHubHopIndex, result, dryRunError, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
5823
5882
  return _regenerator().w(function (_context2) {
5824
5883
  while (1) switch (_context2.n) {
5825
5884
  case 0:
5826
- api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, tx = options.tx, sender = options.sender, feeAsset = options.feeAsset, swapConfig = options.swapConfig, version = options.version, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
5885
+ api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, tx = options.tx, sender = options.sender, feeAsset = options.feeAsset, swapConfig = options.swapConfig, version = options.version, bypassOptions = options.bypassOptions, keepAlive = options.keepAlive, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
5827
5886
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(api, feeAsset, origin, destination, currency) : undefined;
5828
5887
  _resolveCurrency = resolveCurrency(api, currency, resolvedFeeAsset, origin, destination), assets = _resolveCurrency.assets, asset = _resolveCurrency.asset;
5829
5888
  amount = asset.amount;
@@ -5841,6 +5900,7 @@ var dryRunInternal = /*#__PURE__*/function () {
5841
5900
  feeAsset: resolvedFeeAsset,
5842
5901
  version: resolvedVersion,
5843
5902
  bypassOptions: bypassOptions,
5903
+ keepAlive: keepAlive,
5844
5904
  useRootOrigin: useRootOrigin || !!bypassOptions
5845
5905
  });
5846
5906
  case 1:
@@ -6176,6 +6236,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
6176
6236
  mintFeeAssetRes,
6177
6237
  amount,
6178
6238
  mintSentAsset,
6239
+ sentAssets,
6179
6240
  mintAssetResults,
6180
6241
  _args2 = arguments,
6181
6242
  _t,
@@ -6243,7 +6304,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
6243
6304
  case 8:
6244
6305
  mintSentAsset = /*#__PURE__*/function () {
6245
6306
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sentAsset) {
6246
- var balance, bonus, mintAmount, _calcPreviewMintAmoun, missing, total;
6307
+ var balance, bonus, mintAmount, _calcPreviewMintAmoun, keepAliveBuffer, desiredBalance, missing, total;
6247
6308
  return _regenerator().w(function (_context) {
6248
6309
  while (1) switch (_context.n) {
6249
6310
  case 0:
@@ -6260,7 +6321,9 @@ var wrapTxBypass = /*#__PURE__*/function () {
6260
6321
  if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
6261
6322
  mintAmount = parseUnits(bypassMintAmount, sentAsset.decimals) + sentAsset.amount;
6262
6323
  } else {
6263
- missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, sentAsset.amount)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
6324
+ keepAliveBuffer = dryRunOptions.keepAlive ? getEdFromAssetOrThrow(sentAsset) : 0n;
6325
+ desiredBalance = sentAsset.amount + keepAliveBuffer;
6326
+ missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, desiredBalance)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
6264
6327
  total = missing + bonus;
6265
6328
  mintAmount = total > 0n ? total : null;
6266
6329
  }
@@ -6274,8 +6337,9 @@ var wrapTxBypass = /*#__PURE__*/function () {
6274
6337
  return _ref3.apply(this, arguments);
6275
6338
  };
6276
6339
  }(); // mint assets that are being sent
6340
+ sentAssets = (_dryRunOptions$assets = dryRunOptions.assets) !== null && _dryRunOptions$assets !== void 0 ? _dryRunOptions$assets : [asset];
6277
6341
  _context2.n = 9;
6278
- return Promise.all(((_dryRunOptions$assets = dryRunOptions.assets) !== null && _dryRunOptions$assets !== void 0 ? _dryRunOptions$assets : [asset]).map(mintSentAsset));
6342
+ return Promise.all(sentAssets.map(mintSentAsset));
6279
6343
  case 9:
6280
6344
  mintAssetResults = _context2.v;
6281
6345
  return _context2.a(2, api.callBatchMethod([].concat(_toConsumableArray([mintNativeAssetRes, mintRelayAssetRes, mintFeeAssetRes].concat(_toConsumableArray(mintAssetResults)).flatMap(function (tx) {
@@ -8044,8 +8108,8 @@ var createDestination = function createDestination(api, version, origin, destina
8044
8108
  }
8045
8109
  };
8046
8110
  }
8047
- var isSb = !isLocDestination && isSnowbridge(origin, destination);
8048
- if (isSb) {
8111
+ var isExternalDestination = !isLocDestination && isExternalChain(destination);
8112
+ if (isExternalDestination) {
8049
8113
  return {
8050
8114
  parents: Parents.TWO,
8051
8115
  interior: {
@@ -8271,6 +8335,26 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(context, isDotAsset, cu
8271
8335
  };
8272
8336
  };
8273
8337
 
8338
+ var PINK_LOCATION = {
8339
+ parents: 1,
8340
+ interior: {
8341
+ X3: [{
8342
+ Parachain: 1000
8343
+ }, {
8344
+ PalletInstance: 50
8345
+ }, {
8346
+ GeneralIndex: 23
8347
+ }]
8348
+ }
8349
+ };
8350
+ var requiresSystemAssetByLocation = function requiresSystemAssetByLocation(api, assetLocation) {
8351
+ var wudLocation = api.findAssetInfoOrThrow('Jamton', {
8352
+ symbol: 'WUD'
8353
+ }).location;
8354
+ return [wudLocation, PINK_LOCATION].some(function (location) {
8355
+ return deepEqual(assetLocation, location);
8356
+ });
8357
+ };
8274
8358
  var getBridgeReserve = function getBridgeReserve(api, chain, destination, location) {
8275
8359
  var expectedConsensus = isExternalChain(destination) ? getEthereumJunction(api, chain, false).GlobalConsensus : _defineProperty({}, getRelayChainOf(destination).toLowerCase(), null);
8276
8360
  var isDestReserve = deepEqual(getJunctionValue(location, 'GlobalConsensus'), expectedConsensus);
@@ -8283,12 +8367,12 @@ var resolveReserveChain = function resolveReserveChain(api, chain, destination,
8283
8367
  if (overrideReserve !== undefined) {
8284
8368
  return overrideReserve;
8285
8369
  }
8286
- return api.getAssetReserveChain(chain, assetLocation, true);
8370
+ return api.getAssetReserveChain(chain, assetLocation, isExternalChain(destination));
8287
8371
  };
8288
8372
  var createTypeAndThenCallContext = /*#__PURE__*/function () {
8289
8373
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, overrides) {
8290
8374
  var _overrides$noFeeAsset;
8291
- var api, chain, destination, assetInfo, isSubBridge, isSb, reserveChain, NO_FEE_ASSET_LOCS, systemAsset, assetGlobalConsensus, originRelayChain, isAssetHubToExternal, isForeignRelayToExternal, isRelayAsset, bridgeHopChain, destApi, reserveApi;
8375
+ var api, chain, destination, assetInfo, isSubBridge, isSb, reserveChain, NO_FEE_ASSET_LOCS, systemAsset, assetGlobalConsensus, originRelayChain, isExternalDestination, isSnowbridgeAsset, requiresSystemAsset, isAssetHubToExternal, isForeignRelayToExternal, isRelayAsset, assetHubChain, bridgeHopChain, destApi, reserveApi;
8292
8376
  return _regenerator().w(function (_context) {
8293
8377
  while (1) switch (_context.n) {
8294
8378
  case 0:
@@ -8326,14 +8410,18 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
8326
8410
  systemAsset = api.findNativeAssetInfoOrThrow(api.getRelayChainOf(chain));
8327
8411
  assetGlobalConsensus = getJunctionValue(assetInfo.location, 'GlobalConsensus');
8328
8412
  originRelayChain = api.getRelayChainOf(chain);
8329
- isAssetHubToExternal = chain.startsWith('AssetHub') && isExternalChain(destination);
8330
- isForeignRelayToExternal = isExternalChain(destination) && !chain.startsWith('AssetHub') && assetInfo.location.parents === 2 && RELAYCHAINS.some(function (relay) {
8413
+ isExternalDestination = isExternalChain(destination);
8414
+ isSnowbridgeAsset = deepEqual(assetGlobalConsensus, getEthereumJunction(api, chain, false).GlobalConsensus);
8415
+ requiresSystemAsset = !isExternalDestination && (isSnowbridgeAsset || !isRelayChain(destination) && requiresSystemAssetByLocation(api, assetInfo.location));
8416
+ isAssetHubToExternal = chain.startsWith('AssetHub') && isExternalDestination;
8417
+ isForeignRelayToExternal = isExternalDestination && !chain.startsWith('AssetHub') && assetInfo.location.parents === 2 && RELAYCHAINS.some(function (relay) {
8331
8418
  return relay !== originRelayChain && deepEqual(assetGlobalConsensus, _defineProperty({}, relay.toLowerCase(), null));
8332
8419
  });
8333
- isRelayAsset = !isForeignRelayToExternal && (isAssetHubToExternal || NO_FEE_ASSET_LOCS.some(function (loc) {
8420
+ isRelayAsset = !requiresSystemAsset && !isForeignRelayToExternal && (isAssetHubToExternal || NO_FEE_ASSET_LOCS.some(function (loc) {
8334
8421
  return deepEqual(assetInfo.location, loc);
8335
8422
  }) || isSubBridge || ((_overrides$noFeeAsset = overrides.noFeeAsset) !== null && _overrides$noFeeAsset !== void 0 ? _overrides$noFeeAsset : false));
8336
- bridgeHopChain = !chain.startsWith('AssetHub') && assetGlobalConsensus !== undefined ? "AssetHub".concat(originRelayChain) : undefined;
8423
+ assetHubChain = "AssetHub".concat(originRelayChain);
8424
+ bridgeHopChain = !chain.startsWith('AssetHub') && destination !== assetHubChain && assetGlobalConsensus !== undefined ? assetHubChain : undefined;
8337
8425
  destApi = api.clone();
8338
8426
  _context.n = 1;
8339
8427
  return destApi.init(destination);
@@ -9165,7 +9253,9 @@ var isNativeAssetTeleport = function isNativeAssetTeleport(api, origin, dest, as
9165
9253
  var isOriginAh = origin.includes('AssetHub');
9166
9254
  var isDestAh = dest.includes('AssetHub');
9167
9255
  if (isOriginAh === isDestAh) return false;
9256
+ if (api.getRelayChainOf(origin) !== api.getRelayChainOf(dest)) return false;
9168
9257
  var para = isDestAh ? origin : dest;
9258
+ if (para === 'Curio') return false;
9169
9259
  return isAssetEqual(api.findNativeAssetInfoOrThrow(para), asset);
9170
9260
  };
9171
9261
 
@@ -11445,6 +11535,43 @@ var CrustShadow = /*#__PURE__*/function (_SubstrateChain) {
11445
11535
  }]);
11446
11536
  }(SubstrateChain);
11447
11537
 
11538
+ var Curio = /*#__PURE__*/function (_SubstrateChain) {
11539
+ function Curio() {
11540
+ _classCallCheck(this, Curio);
11541
+ return _callSuper(this, Curio, ['Curio', 'curio', 'Kusama', Version.V4]);
11542
+ }
11543
+ _inherits(Curio, _SubstrateChain);
11544
+ return _createClass(Curio, [{
11545
+ key: "getCustomCurrencyId",
11546
+ value: function getCustomCurrencyId(_api, asset) {
11547
+ if (asset.isNative) return {
11548
+ Token: asset.symbol
11549
+ };
11550
+ assertHasId(asset);
11551
+ return {
11552
+ ForeignAsset: Number(asset.assetId)
11553
+ };
11554
+ }
11555
+ }, {
11556
+ key: "getLocalCurrencyId",
11557
+ value: function getLocalCurrencyId(api, asset) {
11558
+ return this.getCustomCurrencyId(api, asset);
11559
+ }
11560
+ }, {
11561
+ key: "getMintConfig",
11562
+ value: function getMintConfig() {
11563
+ return {
11564
+ useCustomCurrencyId: true
11565
+ };
11566
+ }
11567
+ }, {
11568
+ key: "transferPolkadotXCM",
11569
+ value: function transferPolkadotXCM(input) {
11570
+ return transferPolkadotXcm(input);
11571
+ }
11572
+ }]);
11573
+ }(SubstrateChain);
11574
+
11448
11575
  var Darwinia = /*#__PURE__*/function (_SubstrateChain) {
11449
11576
  function Darwinia() {
11450
11577
  _classCallCheck(this, Darwinia);
@@ -11694,29 +11821,28 @@ var Jamton = /*#__PURE__*/function (_SubstrateChain) {
11694
11821
  ForeignAsset: assetId
11695
11822
  };
11696
11823
  }
11824
+ }, {
11825
+ key: "getLocalCurrencyId",
11826
+ value: function getLocalCurrencyId(api, asset) {
11827
+ return this.getCustomCurrencyId(api, asset);
11828
+ }
11829
+ }, {
11830
+ key: "getMintConfig",
11831
+ value: function getMintConfig() {
11832
+ return {
11833
+ useCustomCurrencyId: true
11834
+ };
11835
+ }
11697
11836
  }, {
11698
11837
  key: "transferPolkadotXCM",
11699
11838
  value: function transferPolkadotXCM(input) {
11700
- var api = input.api,
11701
- assetInfo = input.assetInfo,
11839
+ var assetInfo = input.assetInfo,
11702
11840
  scenario = input.scenario,
11703
- destination = input.destination,
11704
- version = input.version;
11841
+ destination = input.destination;
11705
11842
  if (assetInfo.isNative) return transferPolkadotXcm(input);
11706
11843
  if (scenario === 'ParaToPara' && destination !== 'AssetHubPolkadot') {
11707
11844
  throw new ScenarioNotSupportedError("Transfer from ".concat(this.chain, " to ").concat(JSON.stringify(destination), " is not yet supported"));
11708
11845
  }
11709
- if (isSymbolMatch(assetInfo.symbol, 'WUD')) {
11710
- var usdt = api.findAssetInfoOrThrow(this.chain, {
11711
- symbol: 'USDt'
11712
- });
11713
- var MIN_USDT_AMOUNT = 180000n; // 0.18 USDt
11714
- return transferPolkadotXcm(_objectSpread2(_objectSpread2({}, input), {}, {
11715
- overriddenAsset: [_objectSpread2(_objectSpread2({}, createAsset(version, MIN_USDT_AMOUNT, usdt.location)), {}, {
11716
- isFeeAsset: true
11717
- }), createAsset(version, assetInfo.amount, assetInfo.location)]
11718
- }));
11719
- }
11720
11846
  return transferPolkadotXcm(input);
11721
11847
  }
11722
11848
  }]);
@@ -12356,6 +12482,7 @@ var chains = function chains() {
12356
12482
  Encointer: new Encointer(),
12357
12483
  Basilisk: new Basilisk(),
12358
12484
  BifrostKusama: new BifrostKusama(),
12485
+ Curio: new Curio(),
12359
12486
  CrustShadow: new CrustShadow(),
12360
12487
  Crab: new Crab(),
12361
12488
  Karura: new Karura(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk-core",
3
- "version": "14.1.1",
3
+ "version": "14.2.1",
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
  "@noble/hashes": "^2.2.0",
26
26
  "@scure/base": "^2.2.0",
27
27
  "viem": "^2.55.10",
28
- "@paraspell/assets": "14.1.1",
29
- "@paraspell/pallets": "14.1.1",
30
- "@paraspell/sdk-common": "14.1.1"
28
+ "@paraspell/sdk-common": "14.2.1",
29
+ "@paraspell/pallets": "14.2.1",
30
+ "@paraspell/assets": "14.2.1"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/plugin-syntax-import-attributes": "^7.29.7",