@paraspell/sdk 7.1.1 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2503,14 +2503,16 @@ var AssetHubPolkadot$3 = {
2503
2503
  },
2504
2504
  {
2505
2505
  symbol: "KSM",
2506
- decimals: 12
2506
+ decimals: 12,
2507
+ manuallyAdded: true
2507
2508
  }
2508
2509
  ],
2509
2510
  otherAssets: [
2510
2511
  {
2511
2512
  assetId: "",
2512
2513
  symbol: "MYTH",
2513
- decimals: 18
2514
+ decimals: 18,
2515
+ manuallyAdded: true
2514
2516
  },
2515
2517
  {
2516
2518
  assetId: "22222005",
@@ -6343,7 +6345,8 @@ var AssetHubKusama$3 = {
6343
6345
  nativeAssets: [
6344
6346
  {
6345
6347
  symbol: "KSM",
6346
- decimals: 12
6348
+ decimals: 12,
6349
+ manuallyAdded: true
6347
6350
  },
6348
6351
  {
6349
6352
  symbol: "DOT",
@@ -9251,6 +9254,19 @@ var ComposableFinance$2 = /*#__PURE__*/function (_ParachainNode) {
9251
9254
  }]);
9252
9255
  }(ParachainNode);
9253
9256
 
9257
+ var createEthereumTokenLocation = function createEthereumTokenLocation(currencyId) {
9258
+ return {
9259
+ parents: Parents.TWO,
9260
+ interior: {
9261
+ X2: [ETHEREUM_JUNCTION, {
9262
+ AccountKey20: {
9263
+ key: currencyId
9264
+ }
9265
+ }]
9266
+ }
9267
+ };
9268
+ };
9269
+
9254
9270
  var calculateFee = function calculateFee(api) {
9255
9271
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9256
9272
  var DEFAULT_FEE, ahApi, feeStorageItem, leFeeHex, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
@@ -9278,18 +9294,6 @@ var calculateFee = function calculateFee(api) {
9278
9294
  }, _callee);
9279
9295
  }));
9280
9296
  };
9281
- var createEthereumTokenLocation = function createEthereumTokenLocation(currencyId) {
9282
- return {
9283
- parents: Parents.TWO,
9284
- interior: {
9285
- X2: [ETHEREUM_JUNCTION, {
9286
- AccountKey20: {
9287
- key: currencyId
9288
- }
9289
- }]
9290
- }
9291
- };
9292
- };
9293
9297
  var createCustomXcmAh = function createCustomXcmAh(_ref, version) {
9294
9298
  var api = _ref.api,
9295
9299
  scenario = _ref.scenario,
@@ -9938,10 +9942,50 @@ var Karura$2 = /*#__PURE__*/function (_ParachainNode) {
9938
9942
  }]);
9939
9943
  }(ParachainNode);
9940
9944
 
9945
+ var createCustomXcmToBifrost = function createCustomXcmToBifrost(_ref, version) {
9946
+ var api = _ref.api,
9947
+ address = _ref.address,
9948
+ scenario = _ref.scenario;
9949
+ return _defineProperty({}, version, [{
9950
+ DepositAsset: {
9951
+ assets: {
9952
+ Wild: 'All'
9953
+ },
9954
+ beneficiary: Object.values(generateAddressPayload(api, scenario, 'PolkadotXcm', address, version, undefined))[0]
9955
+ }
9956
+ }]);
9957
+ };
9941
9958
  var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9942
9959
  function AssetHubPolkadot() {
9960
+ var _this;
9943
9961
  _classCallCheck(this, AssetHubPolkadot);
9944
- return _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', Version.V3]);
9962
+ _this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', Version.V3]);
9963
+ _this.handleBifrostEthTransfer = function (input) {
9964
+ var api = input.api,
9965
+ amount = input.amount,
9966
+ scenario = input.scenario,
9967
+ version = input.version,
9968
+ destination = input.destination,
9969
+ currencyId = input.currencyId;
9970
+ var versionOrDefault = version !== null && version !== void 0 ? version : _this.version;
9971
+ var call = {
9972
+ module: 'PolkadotXcm',
9973
+ section: 'transfer_assets_using_type_and_then',
9974
+ parameters: {
9975
+ dest: _this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('BifrostPolkadot')),
9976
+ assets: _defineProperty({}, versionOrDefault, [Object.values(createCurrencySpec(amount, versionOrDefault, Parents.TWO, createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : '')))[0][0]]),
9977
+ assets_transfer_type: 'LocalReserve',
9978
+ remote_fees_id: _defineProperty({}, versionOrDefault, {
9979
+ Concrete: createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : '')
9980
+ }),
9981
+ fees_transfer_type: 'LocalReserve',
9982
+ custom_xcm_on_dest: createCustomXcmToBifrost(input, versionOrDefault),
9983
+ weight_limit: 'Unlimited'
9984
+ }
9985
+ };
9986
+ return api.callTxMethod(call);
9987
+ };
9988
+ return _this;
9945
9989
  }
9946
9990
  _inherits(AssetHubPolkadot, _ParachainNode);
9947
9991
  return _createClass(AssetHubPolkadot, [{
@@ -10049,8 +10093,8 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
10049
10093
  currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrency)
10050
10094
  });
10051
10095
  }
10052
- var dotAsset = getOtherAssets(this.node).find(function (_ref) {
10053
- var symbol = _ref.symbol;
10096
+ var dotAsset = getOtherAssets(this.node).find(function (_ref3) {
10097
+ var symbol = _ref3.symbol;
10054
10098
  return symbol === 'DOT';
10055
10099
  });
10056
10100
  if (destination === 'Hydration' && (currencySymbol === (dotAsset === null || dotAsset === void 0 ? void 0 : dotAsset.symbol) || currencyId === (dotAsset === null || dotAsset === void 0 ? void 0 : dotAsset.assetId))) {
@@ -10077,6 +10121,13 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
10077
10121
  if (destination === 'Mythos') {
10078
10122
  return Promise.resolve(this.handleMythosTransfer(input));
10079
10123
  }
10124
+ var wethAsset = getOtherAssets('Ethereum').find(function (_ref4) {
10125
+ var symbol = _ref4.symbol;
10126
+ return symbol === 'WETH';
10127
+ });
10128
+ if (destination === 'BifrostPolkadot' && (currencySymbol === (wethAsset === null || wethAsset === void 0 ? void 0 : wethAsset.symbol) || currencyId === (wethAsset === null || wethAsset === void 0 ? void 0 : wethAsset.assetId))) {
10129
+ return Promise.resolve(this.handleBifrostEthTransfer(input));
10130
+ }
10080
10131
  if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined && destination !== 'Hydration') {
10081
10132
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
10082
10133
  }
@@ -11618,82 +11669,138 @@ var getSupportedPallets = function getSupportedPallets(node) {
11618
11669
  };
11619
11670
 
11620
11671
  // Contains function for getting Asset ID or Symbol used in XCM call creation
11621
- var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination) {
11622
- var lowerSymbol = symbol.toLowerCase();
11623
- if (destination === 'Ethereum') {
11624
- return combinedAssets.find(function (_ref) {
11625
- var assetSymbol = _ref.symbol;
11626
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11627
- });
11672
+ var findBestMatches = function findBestMatches(assets, symbol) {
11673
+ // First, exact match
11674
+ var matches = assets.filter(function (asset) {
11675
+ return asset.symbol === symbol;
11676
+ });
11677
+ if (matches.length > 0) {
11678
+ return matches;
11628
11679
  }
11629
- var otherAssetsMatches = otherAssets.filter(function (_ref2) {
11630
- var assetSymbol = _ref2.symbol;
11631
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11680
+ // Uppercase match
11681
+ var upperSymbol = symbol.toUpperCase();
11682
+ matches = assets.filter(function (asset) {
11683
+ return asset.symbol === upperSymbol;
11632
11684
  });
11633
- var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
11634
- var assetSymbol = _ref3.symbol;
11635
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11685
+ if (matches.length > 0) {
11686
+ return matches;
11687
+ }
11688
+ // Lowercase match
11689
+ var lowerSymbol = symbol.toLowerCase();
11690
+ matches = assets.filter(function (asset) {
11691
+ return asset.symbol === lowerSymbol;
11636
11692
  });
11693
+ if (matches.length > 0) {
11694
+ return matches;
11695
+ }
11696
+ // Case-insensitive match
11697
+ matches = assets.filter(function (asset) {
11698
+ var _a;
11699
+ return ((_a = asset.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === lowerSymbol;
11700
+ });
11701
+ return matches;
11702
+ };
11703
+ var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, symbol, isRelayDestination) {
11704
+ var lowerSymbol = symbol.toLowerCase();
11637
11705
  var isPolkadotXcm = !isRelayChain(node) && node !== 'Ethereum' && getDefaultPallet(node) === 'PolkadotXcm';
11638
- if (otherAssetsMatches.length === 0 && nativeAssetsMatches.length === 0) {
11639
- if (lowerSymbol.startsWith('xc')) {
11640
- // No exact matches found, and symbol starts with 'xc', try stripping 'xc'
11641
- var strippedSymbol = symbol.substring(2);
11642
- var strippedLowerSymbol = strippedSymbol.toLowerCase();
11643
- otherAssetsMatches = otherAssets.filter(function (_ref4) {
11644
- var assetSymbol = _ref4.symbol;
11645
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
11646
- });
11647
- nativeAssetsMatches = nativeAssets.filter(function (_ref5) {
11648
- var assetSymbol = _ref5.symbol;
11649
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
11650
- });
11651
- if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11652
- return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11706
+ var otherAssetsMatches = [];
11707
+ var nativeAssetsMatches = [];
11708
+ if (destination === 'Ethereum') {
11709
+ var ethereumAssets = getOtherAssets('Ethereum');
11710
+ var assetsMatches = findBestMatches(ethereumAssets, symbol);
11711
+ if (assetsMatches.length === 0) {
11712
+ if (lowerSymbol.endsWith('.e')) {
11713
+ // Symbol ends with '.e', strip it and search again
11714
+ var strippedSymbol = symbol.slice(0, -2).toLowerCase();
11715
+ assetsMatches = findBestMatches(ethereumAssets, strippedSymbol);
11716
+ } else {
11717
+ // Symbol does not end with '.e', add '.e' suffix and search
11718
+ var suffixedSymbol = "".concat(symbol, ".e").toLowerCase();
11719
+ assetsMatches = findBestMatches(ethereumAssets, suffixedSymbol);
11653
11720
  }
11654
- var totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11655
- if (totalMatches > 1) {
11656
- throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after stripping 'xc' prefix. Please specify by ID."));
11721
+ }
11722
+ return assetsMatches[0];
11723
+ }
11724
+ var supportsESuffix = node === 'AssetHubPolkadot' || node === 'AssetHubKusama' || destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama' || node === 'Ethereum';
11725
+ if (lowerSymbol.endsWith('.e') && supportsESuffix) {
11726
+ // Symbol ends with '.e', indicating a Snowbridge asset
11727
+ var _strippedSymbol = symbol.slice(0, -2);
11728
+ // Search in Ethereum assets without the '.e' suffix
11729
+ var _ethereumAssets = getOtherAssets('Ethereum');
11730
+ var ethereumMatches = findBestMatches(_ethereumAssets, _strippedSymbol);
11731
+ if (ethereumMatches.length > 0) {
11732
+ return ethereumMatches[0];
11733
+ }
11734
+ // If not found, search normal assets with '.e' suffix
11735
+ otherAssetsMatches = findBestMatches(otherAssets, symbol);
11736
+ nativeAssetsMatches = findBestMatches(nativeAssets, symbol);
11737
+ if (nativeAssetsMatches.length > 0 || otherAssetsMatches.length > 0) {
11738
+ if (isPolkadotXcm) {
11739
+ return nativeAssetsMatches[0] || otherAssetsMatches[0];
11657
11740
  }
11658
- } else {
11659
- // No matches found, and symbol does not start with 'xc', try adding 'xc' prefix
11660
- var prefixedSymbol = "xc".concat(symbol);
11661
- var prefixedLowerSymbol = prefixedSymbol.toLowerCase();
11662
- otherAssetsMatches = otherAssets.filter(function (_ref6) {
11663
- var assetSymbol = _ref6.symbol;
11664
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
11665
- });
11666
- nativeAssetsMatches = nativeAssets.filter(function (_ref7) {
11667
- var assetSymbol = _ref7.symbol;
11668
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
11669
- });
11670
- if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11671
- return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11741
+ return otherAssetsMatches[0] || nativeAssetsMatches[0];
11742
+ }
11743
+ // If still not found, search normal assets without suffix
11744
+ otherAssetsMatches = findBestMatches(otherAssets, _strippedSymbol);
11745
+ nativeAssetsMatches = findBestMatches(nativeAssets, _strippedSymbol);
11746
+ if (nativeAssetsMatches.length > 0 || otherAssetsMatches.length > 0) {
11747
+ if (isPolkadotXcm) {
11748
+ return nativeAssetsMatches[0] || otherAssetsMatches[0];
11672
11749
  }
11673
- var _totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11674
- if (_totalMatches > 1) {
11675
- throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after adding 'xc' prefix. Please specify by ID."));
11750
+ return otherAssetsMatches[0] || nativeAssetsMatches[0];
11751
+ }
11752
+ // No matches found
11753
+ return undefined;
11754
+ } else {
11755
+ // Symbol does not end with '.e', proceed with existing logic
11756
+ otherAssetsMatches = findBestMatches(otherAssets, symbol);
11757
+ nativeAssetsMatches = findBestMatches(nativeAssets, symbol);
11758
+ if (otherAssetsMatches.length === 0 && nativeAssetsMatches.length === 0) {
11759
+ if (lowerSymbol.startsWith('xc')) {
11760
+ // Symbol starts with 'xc', try stripping 'xc' prefix
11761
+ var _strippedSymbol2 = symbol.substring(2);
11762
+ otherAssetsMatches = findBestMatches(otherAssets, _strippedSymbol2);
11763
+ nativeAssetsMatches = findBestMatches(nativeAssets, _strippedSymbol2);
11764
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11765
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || undefined;
11766
+ }
11767
+ var totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11768
+ if (totalMatches > 1) {
11769
+ throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after stripping 'xc' prefix. Please specify by ID."));
11770
+ }
11771
+ } else {
11772
+ // Try adding 'xc' prefix
11773
+ var prefixedSymbol = "xc".concat(symbol);
11774
+ otherAssetsMatches = findBestMatches(otherAssets, prefixedSymbol);
11775
+ nativeAssetsMatches = findBestMatches(nativeAssets, prefixedSymbol);
11776
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11777
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || undefined;
11778
+ }
11779
+ var _totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11780
+ if (_totalMatches > 1) {
11781
+ throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after adding 'xc' prefix. Please specify by ID."));
11782
+ }
11676
11783
  }
11677
11784
  }
11785
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11786
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || undefined;
11787
+ }
11788
+ if (otherAssetsMatches.length > 1 && !isRelayDestination) {
11789
+ throw new DuplicateAssetError(symbol);
11790
+ }
11791
+ return otherAssetsMatches[0] || nativeAssetsMatches[0] || undefined;
11678
11792
  }
11679
- if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11680
- return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11681
- }
11682
- if (otherAssetsMatches.length > 1 && !isRelayDestination) {
11683
- throw new DuplicateAssetError(symbol);
11684
- }
11685
- return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
11686
11793
  };
11687
11794
  var findAssetById = function findAssetById(assets, assetId) {
11688
- var otherAssetsMatches = assets.filter(function (_ref8) {
11689
- var currentAssetId = _ref8.assetId;
11795
+ var otherAssetsMatches = assets.filter(function (_ref) {
11796
+ var currentAssetId = _ref.assetId;
11690
11797
  return currentAssetId === assetId.toString();
11691
11798
  });
11692
11799
  if (otherAssetsMatches.length > 1) {
11693
11800
  throw new DuplicateAssetIdError(assetId.toString());
11694
11801
  }
11695
- return assets.find(function (_ref9) {
11696
- var currentAssetId = _ref9.assetId;
11802
+ return assets.find(function (_ref2) {
11803
+ var currentAssetId = _ref2.assetId;
11697
11804
  return currentAssetId === assetId.toString();
11698
11805
  });
11699
11806
  };
@@ -11711,7 +11818,7 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
11711
11818
  var combinedAssets = destination === 'Ethereum' ? _toConsumableArray(getOtherAssets('Ethereum')) : [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets));
11712
11819
  var asset;
11713
11820
  if ('symbol' in currency) {
11714
- asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, currency.symbol, isRelayDestination);
11821
+ asset = findAssetBySymbol(node, destination, otherAssets, nativeAssets, currency.symbol, isRelayDestination);
11715
11822
  } else {
11716
11823
  asset = findAssetById(combinedAssets, currency.id);
11717
11824
  }
@@ -11846,6 +11953,11 @@ var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
11846
11953
  } else {
11847
11954
  symbolsToCheck.add("xc".concat(lowerSymbol));
11848
11955
  }
11956
+ if (lowerSymbol.endsWith('.e')) {
11957
+ symbolsToCheck.add(lowerSymbol.substring(0, lowerSymbol.length - 2));
11958
+ } else {
11959
+ symbolsToCheck.add("".concat(lowerSymbol, ".e"));
11960
+ }
11849
11961
  var nodeSymbols = getAllAssetsSymbols(node).map(function (s) {
11850
11962
  return s.toLowerCase();
11851
11963
  });
@@ -12189,8 +12301,8 @@ var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(api, no
12189
12301
  _context.next = 13;
12190
12302
  break;
12191
12303
  }
12192
- multiLocation = getAssetHubMultiLocation(asset.symbol);
12193
- if (!multiLocation) {
12304
+ multiLocation = getAssetHubMultiLocation(asset.symbol); // Ethereum address ID indicates that it is an Ethereum asset
12305
+ if (!(multiLocation && ethers.isAddress(asset.assetId))) {
12194
12306
  _context.next = 10;
12195
12307
  break;
12196
12308
  }
@@ -13495,6 +13607,7 @@ var getOriginFeeDetails$1 = function getOriginFeeDetails(_a) {
13495
13607
  return __awaiter(void 0, [_a], void 0, function (_ref) {
13496
13608
  var api = _ref.api,
13497
13609
  account = _ref.account,
13610
+ accountDestination = _ref.accountDestination,
13498
13611
  amount = _ref.amount,
13499
13612
  currency = _ref.currency,
13500
13613
  origin = _ref.origin,
@@ -13516,7 +13629,7 @@ var getOriginFeeDetails$1 = function getOriginFeeDetails(_a) {
13516
13629
  nativeBalance = _context2.sent;
13517
13630
  minTransferableAmount = getMinNativeTransferableAmount(origin);
13518
13631
  _context2.next = 6;
13519
- return createTx$1(api, account, amount, currency, origin, destination);
13632
+ return createTx$1(api, accountDestination, amount, currency, origin, destination);
13520
13633
  case 6:
13521
13634
  tx = _context2.sent;
13522
13635
  _context2.next = 9;
@@ -13548,7 +13661,7 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13548
13661
  amount = _ref.amount,
13549
13662
  originApi = _ref.api;
13550
13663
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
13551
- var _b, _c, _d, originBalance, _yield$getOriginFeeDe, destXcmFee, expectedBalanceAfterXCMDelivery, asset;
13664
+ var _b, _c, _d, originBalance, xcmFeeDetails, expectedBalanceAfterXCMDelivery, asset;
13552
13665
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13553
13666
  while (1) switch (_context.prev = _context.next) {
13554
13667
  case 0:
@@ -13570,64 +13683,54 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13570
13683
  currency: currency,
13571
13684
  amount: amount,
13572
13685
  account: accountOrigin,
13686
+ accountDestination: accountDestination,
13573
13687
  api: originApi
13574
13688
  });
13575
13689
  case 7:
13576
- _yield$getOriginFeeDe = _context.sent;
13577
- destXcmFee = _yield$getOriginFeeDe.xcmFee;
13578
- expectedBalanceAfterXCMDelivery = originBalance - destXcmFee;
13690
+ xcmFeeDetails = _context.sent;
13691
+ expectedBalanceAfterXCMDelivery = originBalance - xcmFeeDetails.xcmFee;
13579
13692
  asset = (_b = getAssetBySymbolOrId(origin, currency)) !== null && _b !== void 0 ? _b : origin === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency) : null;
13580
13693
  if (asset) {
13581
- _context.next = 13;
13694
+ _context.next = 12;
13582
13695
  break;
13583
13696
  }
13584
13697
  throw new InvalidCurrencyError("Asset ".concat('symbol' in currency ? currency.symbol : currency.id, " not found on ").concat(origin));
13585
- case 13:
13698
+ case 12:
13586
13699
  _context.t0 = {
13587
13700
  origin: origin,
13588
13701
  destination: destination,
13589
13702
  ecosystem: determineRelayChainSymbol(origin)
13590
13703
  };
13591
- _context.next = 16;
13704
+ _context.next = 15;
13592
13705
  return getAssetBalance$1({
13593
13706
  api: originApi,
13594
13707
  address: accountOrigin,
13595
13708
  node: origin,
13596
13709
  currency: currency
13597
13710
  });
13598
- case 16:
13711
+ case 15:
13599
13712
  _context.t1 = _context.sent;
13600
13713
  _context.t2 = (_c = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _c !== void 0 ? _c : '';
13601
13714
  _context.t3 = {
13602
13715
  balance: _context.t1,
13603
13716
  currency: _context.t2
13604
13717
  };
13605
- _context.next = 21;
13718
+ _context.next = 20;
13606
13719
  return getBalanceNative$1({
13607
13720
  address: accountOrigin,
13608
13721
  node: origin,
13609
13722
  api: originApi
13610
13723
  });
13611
- case 21:
13724
+ case 20:
13612
13725
  _context.t4 = _context.sent;
13613
13726
  _context.t5 = expectedBalanceAfterXCMDelivery;
13614
- _context.next = 25;
13615
- return getOriginFeeDetails$1({
13616
- origin: origin,
13617
- destination: destination,
13618
- currency: currency,
13619
- amount: amount,
13620
- account: accountOrigin,
13621
- api: originApi
13622
- });
13623
- case 25:
13624
- _context.t6 = _context.sent;
13727
+ _context.t6 = xcmFeeDetails;
13625
13728
  _context.t7 = BigInt((_d = getExistentialDeposit(origin)) !== null && _d !== void 0 ? _d : 0);
13626
13729
  _context.t8 = getNativeAssetSymbol(origin);
13627
13730
  _context.t9 = getMinNativeTransferableAmount(origin);
13628
- _context.next = 31;
13731
+ _context.next = 28;
13629
13732
  return getMaxNativeTransferableAmount(originApi, accountOrigin, origin);
13630
- case 31:
13733
+ case 28:
13631
13734
  _context.t10 = _context.sent;
13632
13735
  _context.t11 = {
13633
13736
  balance: _context.t4,
@@ -13638,13 +13741,13 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13638
13741
  minNativeTransferableAmount: _context.t9,
13639
13742
  maxNativeTransferableAmount: _context.t10
13640
13743
  };
13641
- _context.next = 35;
13744
+ _context.next = 32;
13642
13745
  return getBalanceNative$1({
13643
13746
  address: accountDestination,
13644
13747
  node: destination,
13645
13748
  api: originApi
13646
13749
  });
13647
- case 35:
13750
+ case 32:
13648
13751
  _context.t12 = _context.sent;
13649
13752
  _context.t13 = getNativeAssetSymbol(destination);
13650
13753
  _context.t14 = getExistentialDeposit(destination);
@@ -13659,7 +13762,7 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13659
13762
  originFeeBalance: _context.t11,
13660
13763
  destinationFeeBalance: _context.t15
13661
13764
  });
13662
- case 40:
13765
+ case 37:
13663
13766
  case "end":
13664
13767
  return _context.stop();
13665
13768
  }
@@ -13714,6 +13817,16 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
13714
13817
  return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
13715
13818
  });
13716
13819
  });
13820
+ if (origin === 'AssetHubPolkadot' && destination === 'BifrostPolkadot') {
13821
+ var wethAsset = getOtherAssets('Ethereum').find(function (_ref) {
13822
+ var symbol = _ref.symbol;
13823
+ return symbol === 'WETH';
13824
+ });
13825
+ if (wethAsset) supportedAssets.push({
13826
+ assetId: wethAsset.assetId,
13827
+ symbol: "".concat(wethAsset.symbol, ".e")
13828
+ });
13829
+ }
13717
13830
  return supportedAssets;
13718
13831
  };
13719
13832