@paraspell/sdk 5.7.0 → 5.8.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.
package/dist/index.cjs CHANGED
@@ -1486,6 +1486,11 @@ var Hydration$3 = {
1486
1486
  symbol: "iBTC",
1487
1487
  decimals: 8
1488
1488
  },
1489
+ {
1490
+ assetId: "1000085",
1491
+ symbol: "WUD",
1492
+ decimals: 10
1493
+ },
1489
1494
  {
1490
1495
  assetId: "1000099",
1491
1496
  symbol: "ACA",
@@ -1704,6 +1709,16 @@ var Interlay$3 = {
1704
1709
  symbol: "WBTC.wh",
1705
1710
  decimals: 8
1706
1711
  },
1712
+ {
1713
+ assetId: "14",
1714
+ symbol: "PHA",
1715
+ decimals: 12
1716
+ },
1717
+ {
1718
+ assetId: "15",
1719
+ symbol: "stDOT",
1720
+ decimals: 10
1721
+ },
1707
1722
  {
1708
1723
  assetId: "2",
1709
1724
  symbol: "USDT",
@@ -2191,11 +2206,21 @@ var AssetHubPolkadot$3 = {
2191
2206
  }
2192
2207
  ],
2193
2208
  otherAssets: [
2209
+ {
2210
+ assetId: "",
2211
+ symbol: "MYTH",
2212
+ decimals: 18
2213
+ },
2194
2214
  {
2195
2215
  assetId: "9999",
2196
2216
  symbol: "TOM",
2197
2217
  decimals: 10
2198
2218
  },
2219
+ {
2220
+ assetId: "20090142",
2221
+ symbol: "ELONA",
2222
+ decimals: 10
2223
+ },
2199
2224
  {
2200
2225
  assetId: "100",
2201
2226
  symbol: "WETH",
@@ -2226,6 +2251,11 @@ var AssetHubPolkadot$3 = {
2226
2251
  symbol: "123",
2227
2252
  decimals: 20
2228
2253
  },
2254
+ {
2255
+ assetId: "52",
2256
+ symbol: "TeMe8",
2257
+ decimals: 12
2258
+ },
2229
2259
  {
2230
2260
  assetId: "9000",
2231
2261
  symbol: "PLAY",
@@ -2341,6 +2371,16 @@ var AssetHubPolkadot$3 = {
2341
2371
  symbol: "MATIC",
2342
2372
  decimals: 10
2343
2373
  },
2374
+ {
2375
+ assetId: "7006",
2376
+ symbol: "ttt",
2377
+ decimals: 0
2378
+ },
2379
+ {
2380
+ assetId: "20090138",
2381
+ symbol: "LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG",
2382
+ decimals: 10
2383
+ },
2344
2384
  {
2345
2385
  assetId: "67",
2346
2386
  symbol: "LINK",
@@ -2351,6 +2391,11 @@ var AssetHubPolkadot$3 = {
2351
2391
  symbol: "StabCP",
2352
2392
  decimals: 10
2353
2393
  },
2394
+ {
2395
+ assetId: "20090140",
2396
+ symbol: "Grift ",
2397
+ decimals: 10
2398
+ },
2354
2399
  {
2355
2400
  assetId: "999",
2356
2401
  symbol: "gold",
@@ -2481,6 +2526,11 @@ var AssetHubPolkadot$3 = {
2481
2526
  symbol: "TST",
2482
2527
  decimals: 10
2483
2528
  },
2529
+ {
2530
+ assetId: "669",
2531
+ symbol: "lish",
2532
+ decimals: 9
2533
+ },
2484
2534
  {
2485
2535
  assetId: "8889",
2486
2536
  symbol: "BNDT",
@@ -2496,6 +2546,11 @@ var AssetHubPolkadot$3 = {
2496
2546
  symbol: "STINK",
2497
2547
  decimals: 10
2498
2548
  },
2549
+ {
2550
+ assetId: "20090143",
2551
+ symbol: "DMSTR",
2552
+ decimals: 10
2553
+ },
2499
2554
  {
2500
2555
  assetId: "20090117",
2501
2556
  symbol: "DEDX",
@@ -2521,6 +2576,11 @@ var AssetHubPolkadot$3 = {
2521
2576
  symbol: "DOTTY",
2522
2577
  decimals: 10
2523
2578
  },
2579
+ {
2580
+ assetId: "323",
2581
+ symbol: "DGNNNC",
2582
+ decimals: 6
2583
+ },
2524
2584
  {
2525
2585
  assetId: "77",
2526
2586
  symbol: "TRQ",
@@ -2666,11 +2726,21 @@ var AssetHubPolkadot$3 = {
2666
2726
  symbol: "STEEBOR",
2667
2727
  decimals: 20
2668
2728
  },
2729
+ {
2730
+ assetId: "20090136",
2731
+ symbol: "HTG",
2732
+ decimals: 10
2733
+ },
2669
2734
  {
2670
2735
  assetId: "32",
2671
2736
  symbol: "CLAY",
2672
2737
  decimals: 10
2673
2738
  },
2739
+ {
2740
+ assetId: "2106",
2741
+ symbol: "STREAK",
2742
+ decimals: 10
2743
+ },
2674
2744
  {
2675
2745
  assetId: "9527",
2676
2746
  symbol: "LSCAT",
@@ -2706,6 +2776,11 @@ var AssetHubPolkadot$3 = {
2706
2776
  symbol: "JTO",
2707
2777
  decimals: 10
2708
2778
  },
2779
+ {
2780
+ assetId: "53",
2781
+ symbol: "TeMe9",
2782
+ decimals: 12
2783
+ },
2709
2784
  {
2710
2785
  assetId: "29",
2711
2786
  symbol: "SHRIMP",
@@ -2718,8 +2793,8 @@ var AssetHubPolkadot$3 = {
2718
2793
  },
2719
2794
  {
2720
2795
  assetId: "42",
2721
- symbol: "PJS",
2722
- decimals: 18
2796
+ symbol: "GAVUN",
2797
+ decimals: 10
2723
2798
  },
2724
2799
  {
2725
2800
  assetId: "43",
@@ -2751,6 +2826,11 @@ var AssetHubPolkadot$3 = {
2751
2826
  symbol: "lucky7",
2752
2827
  decimals: 20
2753
2828
  },
2829
+ {
2830
+ assetId: "4242",
2831
+ symbol: "GAVUN",
2832
+ decimals: 10
2833
+ },
2754
2834
  {
2755
2835
  assetId: "26",
2756
2836
  symbol: "POKA",
@@ -2841,6 +2921,11 @@ var AssetHubPolkadot$3 = {
2841
2921
  symbol: "ANT",
2842
2922
  decimals: 6
2843
2923
  },
2924
+ {
2925
+ assetId: "54",
2926
+ symbol: "TeMe10",
2927
+ decimals: 12
2928
+ },
2844
2929
  {
2845
2930
  assetId: "1230",
2846
2931
  symbol: "HAM",
@@ -2891,6 +2976,11 @@ var AssetHubPolkadot$3 = {
2891
2976
  symbol: "GOVD",
2892
2977
  decimals: 10
2893
2978
  },
2979
+ {
2980
+ assetId: "20090139",
2981
+ symbol: "DUSTY",
2982
+ decimals: 10
2983
+ },
2894
2984
  {
2895
2985
  assetId: "1864",
2896
2986
  symbol: "JUNK",
@@ -3081,6 +3171,11 @@ var AssetHubPolkadot$3 = {
3081
3171
  symbol: "MMM",
3082
3172
  decimals: 10
3083
3173
  },
3174
+ {
3175
+ assetId: "20090137",
3176
+ symbol: "hawn",
3177
+ decimals: 10
3178
+ },
3084
3179
  {
3085
3180
  assetId: "69",
3086
3181
  symbol: "DAL",
@@ -3101,6 +3196,11 @@ var AssetHubPolkadot$3 = {
3101
3196
  symbol: "DODA",
3102
3197
  decimals: 6
3103
3198
  },
3199
+ {
3200
+ assetId: "20090141",
3201
+ symbol: "Guzzler",
3202
+ decimals: 10
3203
+ },
3104
3204
  {
3105
3205
  assetId: "5417",
3106
3206
  symbol: "HASH",
@@ -6640,7 +6740,9 @@ var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
6640
6740
  return getAssetsObject(node).nativeAssetSymbol;
6641
6741
  };
6642
6742
  var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
6643
- return getAllAssetsSymbols(node).includes(symbol);
6743
+ return getAllAssetsSymbols(node).map(function (s) {
6744
+ return s.toLowerCase();
6745
+ }).includes(symbol.toLowerCase());
6644
6746
  };
6645
6747
  var getAssetDecimals = function getAssetDecimals(node, symbol) {
6646
6748
  var _getAssetsObject2 = getAssetsObject(node),
@@ -7205,6 +7307,69 @@ var getSupportedPallets = function getSupportedPallets(node) {
7205
7307
  return palletsMap$1[node].supportedPallets;
7206
7308
  };
7207
7309
 
7310
+ // Used to inform user, that currency they wish to use is not registered on either origin or destination Parachain
7311
+ var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
7312
+ function InvalidCurrencyError(message) {
7313
+ var _this;
7314
+ _classCallCheck(this, InvalidCurrencyError);
7315
+ _this = _callSuper(this, InvalidCurrencyError, [message]);
7316
+ _this.name = 'InvalidCurrencyError';
7317
+ return _this;
7318
+ }
7319
+ _inherits(InvalidCurrencyError, _Error);
7320
+ return _createClass(InvalidCurrencyError);
7321
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
7322
+
7323
+ // Used to inform user, that Parachain they wish to use is not supported yet
7324
+ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
7325
+ function NodeNotSupportedError(message) {
7326
+ var _this;
7327
+ _classCallCheck(this, NodeNotSupportedError);
7328
+ _this = _callSuper(this, NodeNotSupportedError, [message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.']);
7329
+ _this.name = 'NodeNotSupported';
7330
+ return _this;
7331
+ }
7332
+ _inherits(NodeNotSupportedError, _Error);
7333
+ return _createClass(NodeNotSupportedError);
7334
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
7335
+
7336
+ // Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
7337
+ var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
7338
+ function ScenarioNotSupportedError(node, scenario, message) {
7339
+ var _this;
7340
+ _classCallCheck(this, ScenarioNotSupportedError);
7341
+ _this = _callSuper(this, ScenarioNotSupportedError, [message !== null && message !== void 0 ? message : "Scenario ".concat(scenario, " not supported for node ").concat(node)]);
7342
+ _this.name = 'ScenarioNotSupported';
7343
+ return _this;
7344
+ }
7345
+ _inherits(ScenarioNotSupportedError, _Error);
7346
+ return _createClass(ScenarioNotSupportedError);
7347
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
7348
+
7349
+ var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
7350
+ function IncompatibleNodesError() {
7351
+ var _this;
7352
+ _classCallCheck(this, IncompatibleNodesError);
7353
+ _this = _callSuper(this, IncompatibleNodesError, ['Transactions between nodes on different relaychains are not yet possible.']);
7354
+ _this.name = 'IncompatibleNodes';
7355
+ return _this;
7356
+ }
7357
+ _inherits(IncompatibleNodesError, _Error);
7358
+ return _createClass(IncompatibleNodesError);
7359
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
7360
+
7361
+ var DuplicateAssetError = /*#__PURE__*/function (_Error) {
7362
+ function DuplicateAssetError(symbol) {
7363
+ var _this;
7364
+ _classCallCheck(this, DuplicateAssetError);
7365
+ _this = _callSuper(this, DuplicateAssetError, ["Multiple assets found with the same symbol: ".concat(symbol, ". Please specify asset ID directly by .currency({id: <ASSET_ID>})")]);
7366
+ _this.name = 'DuplicateAsset';
7367
+ return _this;
7368
+ }
7369
+ _inherits(DuplicateAssetError, _Error);
7370
+ return _createClass(DuplicateAssetError);
7371
+ }( /*#__PURE__*/_wrapNativeSuper(Error));
7372
+
7208
7373
  var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
7209
7374
  var api = _ref.api,
7210
7375
  destination = _ref.destination,
@@ -7220,13 +7385,17 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
7220
7385
  return parameters;
7221
7386
  };
7222
7387
  var isTMulti = function isTMulti(value) {
7223
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
7224
7388
  return value && _typeof(value) === 'object' || Array.isArray(value);
7225
7389
  };
7226
7390
  var isTMultiLocation = function isTMultiLocation(value) {
7227
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
7228
7391
  return value && typeof value.parents !== 'undefined' && typeof value.interior !== 'undefined';
7229
7392
  };
7393
+ var isTCurrencySpecifier = function isTCurrencySpecifier(value) {
7394
+ if (_typeof(value) !== 'object' || value === null) {
7395
+ return false;
7396
+ }
7397
+ return 'symbol' in value && typeof value.symbol === 'string' || 'id' in value && (typeof value.id === 'string' || typeof value.id === 'number' || typeof value.id === 'bigint');
7398
+ };
7230
7399
  var createBridgeCurrencySpec = function createBridgeCurrencySpec(amount, ecosystem) {
7231
7400
  return _defineProperty({}, exports.Version.V4, [{
7232
7401
  id: {
@@ -7319,7 +7488,7 @@ var calculateTransactionFee$1 = function calculateTransactionFee(tx, address) {
7319
7488
  var findParachainJunction = function findParachainJunction(multilocation) {
7320
7489
  var interior = multilocation.interior;
7321
7490
  for (var key in interior) {
7322
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
7491
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
7323
7492
  var junctions = interior[key];
7324
7493
  if (Array.isArray(junctions)) {
7325
7494
  var _iterator = _createForOfIteratorHelper(junctions),
@@ -7328,7 +7497,6 @@ var findParachainJunction = function findParachainJunction(multilocation) {
7328
7497
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
7329
7498
  var junction = _step.value;
7330
7499
  if ('Parachain' in junction) {
7331
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
7332
7500
  return Number(junction.Parachain);
7333
7501
  }
7334
7502
  }
@@ -7338,7 +7506,6 @@ var findParachainJunction = function findParachainJunction(multilocation) {
7338
7506
  _iterator.f();
7339
7507
  }
7340
7508
  } else if (junctions !== undefined && 'Parachain' in junctions) {
7341
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
7342
7509
  return Number(junctions.Parachain);
7343
7510
  }
7344
7511
  }
@@ -7356,7 +7523,29 @@ var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(multi
7356
7523
  return node;
7357
7524
  };
7358
7525
 
7526
+ var findAssetBySymbol = function findAssetBySymbol(otherAssets, nativeAssets, symbol, isRelayDestination) {
7527
+ var otherAssetsMatches = otherAssets.filter(function (_ref) {
7528
+ var assetSymbol = _ref.symbol;
7529
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
7530
+ });
7531
+ var nativeAssetsMatches = nativeAssets.filter(function (_ref2) {
7532
+ var assetSymbol = _ref2.symbol;
7533
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
7534
+ });
7535
+ if (otherAssetsMatches.length > 1 && !isRelayDestination) {
7536
+ throw new DuplicateAssetError(symbol);
7537
+ }
7538
+ return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
7539
+ };
7540
+ var findAssetById = function findAssetById(assets, assetId) {
7541
+ return assets.find(function (_ref3) {
7542
+ var currentAssetId = _ref3.assetId;
7543
+ return currentAssetId === assetId;
7544
+ });
7545
+ };
7359
7546
  var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
7547
+ var isRelayDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7548
+ var isSymbol = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
7360
7549
  if (isTMulti(currency)) {
7361
7550
  return null;
7362
7551
  }
@@ -7365,22 +7554,26 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
7365
7554
  otherAssets = _getAssetsObject.otherAssets,
7366
7555
  nativeAssets = _getAssetsObject.nativeAssets,
7367
7556
  relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol;
7368
- var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (_ref) {
7369
- var symbol = _ref.symbol,
7370
- assetId = _ref.assetId;
7371
- return symbol === currencyString || assetId === currencyString;
7372
- });
7373
- if (asset !== undefined) {
7374
- var symbol = asset.symbol,
7375
- assetId = asset.assetId;
7557
+ var combinedAssets = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets));
7558
+ var asset;
7559
+ if (isSymbol === true) {
7560
+ asset = findAssetBySymbol(otherAssets, nativeAssets, currencyString, isRelayDestination);
7561
+ } else if (isSymbol === false) {
7562
+ asset = findAssetById(combinedAssets, currencyString);
7563
+ } else {
7564
+ asset = findAssetBySymbol(otherAssets, nativeAssets, currencyString, isRelayDestination) || findAssetById(combinedAssets, currencyString);
7565
+ }
7566
+ if (asset) {
7376
7567
  return {
7377
- symbol: symbol,
7378
- assetId: assetId
7568
+ symbol: asset.symbol,
7569
+ assetId: asset.assetId
7570
+ };
7571
+ }
7572
+ if (relayChainAssetSymbol === currencyString && isSymbol !== false) {
7573
+ return {
7574
+ symbol: relayChainAssetSymbol
7379
7575
  };
7380
7576
  }
7381
- if (relayChainAssetSymbol === currencyString) return {
7382
- symbol: relayChainAssetSymbol
7383
- };
7384
7577
  return null;
7385
7578
  };
7386
7579
 
@@ -8413,57 +8606,6 @@ var Builder = function Builder(api) {
8413
8606
  return new GeneralBuilder(api);
8414
8607
  };
8415
8608
 
8416
- // Used to inform user, that currency they wish to use is not registered on either origin or destination Parachain
8417
- var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
8418
- function InvalidCurrencyError(message) {
8419
- var _this;
8420
- _classCallCheck(this, InvalidCurrencyError);
8421
- _this = _callSuper(this, InvalidCurrencyError, [message]);
8422
- _this.name = 'InvalidCurrencyError';
8423
- return _this;
8424
- }
8425
- _inherits(InvalidCurrencyError, _Error);
8426
- return _createClass(InvalidCurrencyError);
8427
- }( /*#__PURE__*/_wrapNativeSuper(Error));
8428
-
8429
- // Used to inform user, that Parachain they wish to use is not supported yet
8430
- var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
8431
- function NodeNotSupportedError(message) {
8432
- var _this;
8433
- _classCallCheck(this, NodeNotSupportedError);
8434
- _this = _callSuper(this, NodeNotSupportedError, [message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.']);
8435
- _this.name = 'NodeNotSupported';
8436
- return _this;
8437
- }
8438
- _inherits(NodeNotSupportedError, _Error);
8439
- return _createClass(NodeNotSupportedError);
8440
- }( /*#__PURE__*/_wrapNativeSuper(Error));
8441
-
8442
- // Used to inform user, that Parachain they wish to use does not support scenario they wish to use yet
8443
- var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
8444
- function ScenarioNotSupportedError(node, scenario, message) {
8445
- var _this;
8446
- _classCallCheck(this, ScenarioNotSupportedError);
8447
- _this = _callSuper(this, ScenarioNotSupportedError, [message !== null && message !== void 0 ? message : "Scenario ".concat(scenario, " not supported for node ").concat(node)]);
8448
- _this.name = 'ScenarioNotSupported';
8449
- return _this;
8450
- }
8451
- _inherits(ScenarioNotSupportedError, _Error);
8452
- return _createClass(ScenarioNotSupportedError);
8453
- }( /*#__PURE__*/_wrapNativeSuper(Error));
8454
-
8455
- var IncompatibleNodesError = /*#__PURE__*/function (_Error) {
8456
- function IncompatibleNodesError() {
8457
- var _this;
8458
- _classCallCheck(this, IncompatibleNodesError);
8459
- _this = _callSuper(this, IncompatibleNodesError, ['Transactions between nodes on different relaychains are not yet possible.']);
8460
- _this.name = 'IncompatibleNodes';
8461
- return _this;
8462
- }
8463
- _inherits(IncompatibleNodesError, _Error);
8464
- return _createClass(IncompatibleNodesError);
8465
- }( /*#__PURE__*/_wrapNativeSuper(Error));
8466
-
8467
8609
  var transferEthToPolkadot = function transferEthToPolkadot(provider_1, _a) {
8468
8610
  return __awaiter(void 0, [provider_1, _a], void 0, function (provider, _ref) {
8469
8611
  var signer = _ref.signer,
@@ -9733,31 +9875,29 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
9733
9875
 
9734
9876
  var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
9735
9877
  function AssetHubPolkadot() {
9736
- var _this;
9737
9878
  _classCallCheck(this, AssetHubPolkadot);
9738
- _this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', exports.Version.V3]);
9739
- _this._assetCheckEnabled = false;
9740
- return _this;
9879
+ return _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', exports.Version.V3]);
9741
9880
  }
9742
9881
  _inherits(AssetHubPolkadot, _ParachainNode);
9743
9882
  return _createClass(AssetHubPolkadot, [{
9744
9883
  key: "handleBridgeTransfer",
9745
9884
  value: function handleBridgeTransfer(input, targetChain) {
9746
- if (targetChain === 'Kusama' && input.currencyId === 'KSM' || targetChain === 'Polkadot' && input.currencyId === 'DOT') {
9885
+ var _a, _b, _c, _d;
9886
+ if (targetChain === 'Kusama' && ((_a = input.currencySymbol) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'KSM' || targetChain === 'Polkadot' && ((_b = input.currencySymbol) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'DOT') {
9747
9887
  var modifiedInput = Object.assign(Object.assign({}, input), {
9748
9888
  header: createBridgePolkadotXcmDest(exports.Version.V4, targetChain, input.destination, input.paraIdTo),
9749
9889
  addressSelection: generateAddressMultiLocationV4(input.api, input.address),
9750
9890
  currencySelection: createBridgeCurrencySpec(input.amount, targetChain)
9751
9891
  });
9752
9892
  return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'transferAssets', 'Unlimited');
9753
- } else if (targetChain === 'Polkadot' && input.currencyId === 'KSM' || targetChain === 'Kusama' && input.currencyId === 'DOT') {
9893
+ } else if (targetChain === 'Polkadot' && ((_c = input.currencySymbol) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === 'KSM' || targetChain === 'Kusama' && ((_d = input.currencySymbol) === null || _d === void 0 ? void 0 : _d.toUpperCase()) === 'DOT') {
9754
9894
  var _modifiedInput = Object.assign(Object.assign({}, input), {
9755
9895
  header: createBridgePolkadotXcmDest(exports.Version.V3, targetChain, input.destination, input.paraIdTo),
9756
9896
  currencySelection: createCurrencySpec(input.amount, exports.Version.V3, exports.Parents.ONE, input.overridedCurrency)
9757
9897
  });
9758
9898
  return PolkadotXCMTransferImpl.transferPolkadotXCM(_modifiedInput, 'limitedReserveTransferAssets', 'Unlimited');
9759
9899
  }
9760
- throw new InvalidCurrencyError('Polkadot <-> Kusama bridge does not support this currency');
9900
+ throw new InvalidCurrencyError("Polkadot <-> Kusama bridge does not support currency ".concat(input.currencySymbol));
9761
9901
  }
9762
9902
  }, {
9763
9903
  key: "handleEthBridgeTransfer",
@@ -9767,16 +9907,16 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
9767
9907
  destination = input.destination,
9768
9908
  paraIdTo = input.paraIdTo,
9769
9909
  address = input.address,
9770
- currencyId = input.currencyId;
9910
+ currencySymbol = input.currencySymbol;
9771
9911
  if (!ethers.ethers.isAddress(address)) {
9772
9912
  throw new Error('Only Ethereum addresses are supported for Ethereum transfers');
9773
9913
  }
9774
9914
  var ethAssets = getOtherAssets('Ethereum');
9775
9915
  var ethAsset = ethAssets.find(function (asset) {
9776
- return asset.symbol === currencyId;
9916
+ return asset.symbol === currencySymbol;
9777
9917
  });
9778
9918
  if (!ethAsset) {
9779
- throw new InvalidCurrencyError("Currency ".concat(currencyId, " is not supported for Ethereum transfers"));
9919
+ throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers"));
9780
9920
  }
9781
9921
  var ETH_CHAIN_ID = 1;
9782
9922
  var ethJunction = {
@@ -9802,6 +9942,34 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
9802
9942
  });
9803
9943
  return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'transferAssets', 'Unlimited');
9804
9944
  }
9945
+ }, {
9946
+ key: "handleMythosTransfer",
9947
+ value: function handleMythosTransfer(input) {
9948
+ var api = input.api,
9949
+ address = input.address,
9950
+ amount = input.amount,
9951
+ currencyId = input.currencyId,
9952
+ overridedCurrency = input.overridedCurrency,
9953
+ scenario = input.scenario,
9954
+ destination = input.destination,
9955
+ paraIdTo = input.paraIdTo;
9956
+ var version = exports.Version.V2;
9957
+ var paraId = destination !== undefined && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
9958
+ var customMultiLocation = {
9959
+ parents: exports.Parents.ONE,
9960
+ interior: {
9961
+ X1: {
9962
+ Parachain: paraId
9963
+ }
9964
+ }
9965
+ };
9966
+ var modifiedInput = Object.assign(Object.assign({}, input), {
9967
+ header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
9968
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, version, paraId),
9969
+ currencySelection: this.createCurrencySpec(amount, scenario, version, currencyId, overridedCurrency !== null && overridedCurrency !== void 0 ? overridedCurrency : customMultiLocation)
9970
+ });
9971
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'limitedTeleportAssets', 'Unlimited');
9972
+ }
9805
9973
  }, {
9806
9974
  key: "transferPolkadotXCM",
9807
9975
  value: function transferPolkadotXCM(input) {
@@ -9812,6 +9980,9 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
9812
9980
  if (input.destination === 'Ethereum') {
9813
9981
  return this.handleEthBridgeTransfer(input);
9814
9982
  }
9983
+ if (input.destination === 'Mythos') {
9984
+ return this.handleMythosTransfer(input);
9985
+ }
9815
9986
  var method = scenario === 'ParaToPara' ? 'limitedReserveTransferAssets' : 'limitedTeleportAssets';
9816
9987
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method, 'Unlimited');
9817
9988
  }
@@ -9847,11 +10018,8 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
9847
10018
 
9848
10019
  var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
9849
10020
  function AssetHubKusama() {
9850
- var _this;
9851
10021
  _classCallCheck(this, AssetHubKusama);
9852
- _this = _callSuper(this, AssetHubKusama, ['AssetHubKusama', 'KusamaAssetHub', 'kusama', exports.Version.V3]);
9853
- _this._assetCheckEnabled = false;
9854
- return _this;
10022
+ return _callSuper(this, AssetHubKusama, ['AssetHubKusama', 'KusamaAssetHub', 'kusama', exports.Version.V3]);
9855
10023
  }
9856
10024
  _inherits(AssetHubKusama, _ParachainNode);
9857
10025
  return _createClass(AssetHubKusama, [{
@@ -11009,13 +11177,33 @@ var checkKeepAlive = function checkKeepAlive(_a) {
11009
11177
  });
11010
11178
  };
11011
11179
 
11180
+ var transformOptions = function transformOptions(options) {
11181
+ var currency = options.currency;
11182
+ if (isTCurrencySpecifier(currency)) {
11183
+ if ('symbol' in currency) {
11184
+ return Object.assign(Object.assign({}, options), {
11185
+ currency: currency.symbol,
11186
+ isSymbol: true
11187
+ });
11188
+ } else if ('id' in currency) {
11189
+ return Object.assign(Object.assign({}, options), {
11190
+ currency: currency.id,
11191
+ isSymbol: false
11192
+ });
11193
+ }
11194
+ }
11195
+ return Object.assign(Object.assign({}, options), {
11196
+ currency: currency,
11197
+ isSymbol: undefined
11198
+ });
11199
+ };
11012
11200
  var sendCommon = function sendCommon(options) {
11013
11201
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11014
- var _a, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, _options$serializedAp, serializedApiCallEnabled, asset, isMultiLocationDestination, isMultiLocationCurrency, originRelayChainSymbol, destinationRelayChainSymbol, supportsBridge, originNode, assetCheckEnabled, apiWithFallback, amountStr, currencyStr, currencyId;
11202
+ var _a, _b, _transformOptions, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isSymbol, _transformOptions$ser, serializedApiCallEnabled, isMultiLocationDestination, isMultiLocationCurrency, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, asset, apiWithFallback, amountStr, currencyStr;
11015
11203
  return _regeneratorRuntime().wrap(function _callee$(_context) {
11016
11204
  while (1) switch (_context.prev = _context.next) {
11017
11205
  case 0:
11018
- api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
11206
+ _transformOptions = transformOptions(options), api = _transformOptions.api, origin = _transformOptions.origin, currency = _transformOptions.currency, amount = _transformOptions.amount, address = _transformOptions.address, destination = _transformOptions.destination, paraIdTo = _transformOptions.paraIdTo, destApiForKeepAlive = _transformOptions.destApiForKeepAlive, feeAsset = _transformOptions.feeAsset, version = _transformOptions.version, isSymbol = _transformOptions.isSymbol, _transformOptions$ser = _transformOptions.serializedApiCallEnabled, serializedApiCallEnabled = _transformOptions$ser === void 0 ? false : _transformOptions$ser;
11019
11207
  if (!((!isTMulti(currency) || isTMultiLocation(currency)) && amount === null)) {
11020
11208
  _context.next = 3;
11021
11209
  break;
@@ -11065,84 +11253,85 @@ var sendCommon = function sendCommon(options) {
11065
11253
  }
11066
11254
  throw new InvalidCurrencyError('Fee asset index is out of bounds. Please provide a valid index.');
11067
11255
  case 17:
11068
- asset = getAssetBySymbolOrId(origin, currency);
11069
11256
  isMultiLocationDestination = _typeof(destination) === 'object';
11070
11257
  isMultiLocationCurrency = _typeof(currency) === 'object';
11071
- if (!(destination !== undefined && !isMultiLocationDestination)) {
11258
+ isBridge = origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot' || destination === 'Ethereum';
11259
+ isRelayDestination = destination === undefined;
11260
+ if (!(!isRelayDestination && !isMultiLocationDestination)) {
11072
11261
  _context.next = 26;
11073
11262
  break;
11074
11263
  }
11075
11264
  originRelayChainSymbol = getRelayChainSymbol(origin);
11076
11265
  destinationRelayChainSymbol = getRelayChainSymbol(destination);
11077
- supportsBridge = (origin === 'AssetHubPolkadot' || origin === 'AssetHubKusama') && (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama');
11078
- if (!(!supportsBridge && originRelayChainSymbol !== destinationRelayChainSymbol)) {
11266
+ if (!(!isBridge && originRelayChainSymbol !== destinationRelayChainSymbol)) {
11079
11267
  _context.next = 26;
11080
11268
  break;
11081
11269
  }
11082
11270
  throw new IncompatibleNodesError();
11083
11271
  case 26:
11084
11272
  originNode = getNode(origin);
11085
- assetCheckEnabled = destination === 'AssetHubKusama' || destination === 'AssetHubPolkadot' || isMultiLocationCurrency ? false : originNode.assetCheckEnabled;
11086
- if (!(asset === null && assetCheckEnabled)) {
11087
- _context.next = 30;
11273
+ assetCheckEnabled = isMultiLocationCurrency || isBridge ? false : originNode.assetCheckEnabled;
11274
+ asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isSymbol) : null;
11275
+ if (!(!isBridge && asset === null && assetCheckEnabled)) {
11276
+ _context.next = 31;
11088
11277
  break;
11089
11278
  }
11090
11279
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
11091
- case 30:
11092
- if (!(destination !== undefined && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !hasSupportForAsset(destination, asset.symbol))) {
11093
- _context.next = 32;
11280
+ case 31:
11281
+ if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && isSymbol !== false && asset.assetId !== currency && !hasSupportForAsset(destination, asset.symbol))) {
11282
+ _context.next = 33;
11094
11283
  break;
11095
11284
  }
11096
11285
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
11097
- case 32:
11286
+ case 33:
11098
11287
  if (!(api !== null && api !== void 0)) {
11099
- _context.next = 36;
11288
+ _context.next = 37;
11100
11289
  break;
11101
11290
  }
11102
11291
  _context.t0 = api;
11103
- _context.next = 39;
11292
+ _context.next = 40;
11104
11293
  break;
11105
- case 36:
11106
- _context.next = 38;
11294
+ case 37:
11295
+ _context.next = 39;
11107
11296
  return createApiInstanceForNode(origin);
11108
- case 38:
11109
- _context.t0 = _context.sent;
11110
11297
  case 39:
11298
+ _context.t0 = _context.sent;
11299
+ case 40:
11111
11300
  apiWithFallback = _context.t0;
11112
11301
  amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
11113
11302
  if (!isTMulti(currency)) {
11114
- _context.next = 45;
11303
+ _context.next = 46;
11115
11304
  break;
11116
11305
  }
11117
11306
  console.warn('Keep alive check is not supported when using MultiLocation as currency.');
11118
- _context.next = 59;
11307
+ _context.next = 60;
11119
11308
  break;
11120
- case 45:
11309
+ case 46:
11121
11310
  if (!(_typeof(address) === 'object')) {
11122
- _context.next = 49;
11311
+ _context.next = 50;
11123
11312
  break;
11124
11313
  }
11125
11314
  console.warn('Keep alive check is not supported when using MultiLocation as address.');
11126
- _context.next = 59;
11315
+ _context.next = 60;
11127
11316
  break;
11128
- case 49:
11317
+ case 50:
11129
11318
  if (!(_typeof(destination) === 'object')) {
11130
- _context.next = 53;
11319
+ _context.next = 54;
11131
11320
  break;
11132
11321
  }
11133
11322
  console.warn('Keep alive check is not supported when using MultiLocation as destination.');
11134
- _context.next = 59;
11323
+ _context.next = 60;
11135
11324
  break;
11136
- case 53:
11325
+ case 54:
11137
11326
  if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
11138
- _context.next = 57;
11327
+ _context.next = 58;
11139
11328
  break;
11140
11329
  }
11141
11330
  console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
11142
- _context.next = 59;
11331
+ _context.next = 60;
11143
11332
  break;
11144
- case 57:
11145
- _context.next = 59;
11333
+ case 58:
11334
+ _context.next = 60;
11146
11335
  return checkKeepAlive({
11147
11336
  originApi: apiWithFallback,
11148
11337
  address: address,
@@ -11152,13 +11341,12 @@ var sendCommon = function sendCommon(options) {
11152
11341
  currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : currency.toString(),
11153
11342
  destNode: destination
11154
11343
  });
11155
- case 59:
11344
+ case 60:
11156
11345
  currencyStr = isTMulti(currency) ? undefined : currency.toString();
11157
- currencyId = assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencyStr;
11158
11346
  return _context.abrupt("return", originNode.transfer({
11159
11347
  api: apiWithFallback,
11160
- currencySymbol: asset === null || asset === void 0 ? void 0 : asset.symbol,
11161
- currencyId: currencyId,
11348
+ currencySymbol: (_b = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _b !== void 0 ? _b : currencyStr,
11349
+ currencyId: asset === null || asset === void 0 ? void 0 : asset.assetId,
11162
11350
  amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
11163
11351
  address: address,
11164
11352
  destination: destination,
@@ -11211,11 +11399,11 @@ var send = function send(options) {
11211
11399
  };
11212
11400
  var transferRelayToParaCommon = function transferRelayToParaCommon(options) {
11213
11401
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
11214
- var api, destination, amount, address, paraIdTo, destApiForKeepAlive, version, _options$serializedAp2, serializedApiCallEnabled, isMultiLocationDestination, isAddressMultiLocation, apiWithFallback, amountStr, serializedApiCall;
11402
+ var api, destination, amount, address, paraIdTo, destApiForKeepAlive, version, _options$serializedAp, serializedApiCallEnabled, isMultiLocationDestination, isAddressMultiLocation, apiWithFallback, amountStr, serializedApiCall;
11215
11403
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11216
11404
  while (1) switch (_context4.prev = _context4.next) {
11217
11405
  case 0:
11218
- api = options.api, destination = options.destination, amount = options.amount, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, _options$serializedAp2 = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp2 === void 0 ? false : _options$serializedAp2;
11406
+ api = options.api, destination = options.destination, amount = options.amount, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
11219
11407
  isMultiLocationDestination = _typeof(destination) === 'object';
11220
11408
  isAddressMultiLocation = _typeof(address) === 'object';
11221
11409
  if (!(api === undefined && isMultiLocationDestination)) {
@@ -11342,6 +11530,7 @@ var index = /*#__PURE__*/Object.freeze({
11342
11530
 
11343
11531
  exports.Builder = Builder;
11344
11532
  exports.CloseChannelBuilder = CloseChannelBuilder;
11533
+ exports.DuplicateAssetError = DuplicateAssetError;
11345
11534
  exports.EvmBuilder = EvmBuilder;
11346
11535
  exports.IncompatibleNodesError = IncompatibleNodesError;
11347
11536
  exports.InvalidCurrencyError = InvalidCurrencyError;