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