@paraspell/sdk-core 8.0.0 → 8.0.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
@@ -13,6 +13,31 @@ function _assertThisInitialized(e) {
13
13
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14
14
  return e;
15
15
  }
16
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
17
+ try {
18
+ var i = n[a](c),
19
+ u = i.value;
20
+ } catch (n) {
21
+ return void e(n);
22
+ }
23
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
24
+ }
25
+ function _asyncToGenerator(n) {
26
+ return function () {
27
+ var t = this,
28
+ e = arguments;
29
+ return new Promise(function (r, o) {
30
+ var a = n.apply(t, e);
31
+ function _next(n) {
32
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
33
+ }
34
+ function _throw(n) {
35
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
36
+ }
37
+ _next(void 0);
38
+ });
39
+ };
40
+ }
16
41
  function _callSuper(t, o, e) {
17
42
  return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
18
43
  }
@@ -140,6 +165,27 @@ function _iterableToArray(r) {
140
165
  function _nonIterableSpread() {
141
166
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
142
167
  }
168
+ function ownKeys(e, r) {
169
+ var t = Object.keys(e);
170
+ if (Object.getOwnPropertySymbols) {
171
+ var o = Object.getOwnPropertySymbols(e);
172
+ r && (o = o.filter(function (r) {
173
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
174
+ })), t.push.apply(t, o);
175
+ }
176
+ return t;
177
+ }
178
+ function _objectSpread2(e) {
179
+ for (var r = 1; r < arguments.length; r++) {
180
+ var t = null != arguments[r] ? arguments[r] : {};
181
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
182
+ _defineProperty(e, r, t[r]);
183
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
184
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
185
+ });
186
+ }
187
+ return e;
188
+ }
143
189
  function _possibleConstructorReturn(t, e) {
144
190
  if (e && ("object" == typeof e || "function" == typeof e)) return e;
145
191
  if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
@@ -517,38 +563,6 @@ function _wrapNativeSuper(t) {
517
563
  }, _wrapNativeSuper(t);
518
564
  }
519
565
 
520
- /******************************************************************************
521
- Copyright (c) Microsoft Corporation.
522
-
523
- Permission to use, copy, modify, and/or distribute this software for any
524
- purpose with or without fee is hereby granted.
525
-
526
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
527
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
528
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
529
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
530
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
531
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
532
- PERFORMANCE OF THIS SOFTWARE.
533
- ***************************************************************************** */
534
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
535
-
536
-
537
- function __awaiter(thisArg, _arguments, P, generator) {
538
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
539
- return new (P || (P = Promise))(function (resolve, reject) {
540
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
541
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
542
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
543
- step((generator = generator.apply(thisArg, _arguments || [])).next());
544
- });
545
- }
546
-
547
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
548
- var e = new Error(message);
549
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
550
- };
551
-
552
566
  var Polkadot$2 = {
553
567
  relayChainAssetSymbol: "DOT",
554
568
  nativeAssetSymbol: "DOT",
@@ -11400,7 +11414,7 @@ var PolkadotXcmError;
11400
11414
  })(PolkadotXcmError || (PolkadotXcmError = {}));
11401
11415
 
11402
11416
  var DEFAULT_FEE_ASSET = 0;
11403
- var ETH_CHAIN_ID = BigInt(1);
11417
+ var ETH_CHAIN_ID = 1n;
11404
11418
  var ETHEREUM_JUNCTION = {
11405
11419
  GlobalConsensus: {
11406
11420
  Ethereum: {
@@ -13097,7 +13111,7 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
13097
13111
  includeFee = _ref2.includeFee;
13098
13112
  var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
13099
13113
  var paraId = !isRelayDestination && _typeof(destination) !== 'object' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
13100
- return Object.assign({
13114
+ return _objectSpread2({
13101
13115
  dest: createPolkadotXcmHeader('RelayToPara', version, destination, paraId),
13102
13116
  beneficiary: generateAddressPayload(api, 'RelayToPara', null, address, version, paraId),
13103
13117
  assets: createCurrencySpec(asset.amount, version, Parents.ZERO),
@@ -13183,14 +13197,14 @@ var createBridgePolkadotXcmDest = function createBridgePolkadotXcmDest(version,
13183
13197
  return _defineProperty({}, version, isMultiLocationDestination ? destination : multiLocation);
13184
13198
  };
13185
13199
  var resolveTNodeFromMultiLocation = function resolveTNodeFromMultiLocation(relayChain, multiLocation) {
13186
- var _a;
13200
+ var _NODE_NAMES_DOT_KSM$f;
13187
13201
  var parachainId = findParachainJunction(multiLocation);
13188
13202
  if (parachainId === null) {
13189
13203
  throw new Error('Parachain ID not found in destination multi location.');
13190
13204
  }
13191
- var node = (_a = NODE_NAMES_DOT_KSM.find(function (nodeName) {
13205
+ var node = (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
13192
13206
  return getParaId(nodeName) === parachainId && determineRelayChain(nodeName) === relayChain;
13193
- })) !== null && _a !== void 0 ? _a : null;
13207
+ })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
13194
13208
  if (node === null) {
13195
13209
  throw new Error('Node with specified paraId not found in destination multi location.');
13196
13210
  }
@@ -13222,8 +13236,8 @@ var buildMultiLocation = function buildMultiLocation(_ref) {
13222
13236
  }
13223
13237
  // If it is a native asset, search by symbol on AssetHub and use the multiLocation from there
13224
13238
  var assetHubAsset = getOtherAssets(destination).find(function (ahAsset) {
13225
- var _a, _b;
13226
- return ((_a = ahAsset.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = asset.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase());
13239
+ var _ahAsset$symbol, _asset$symbol;
13240
+ return ((_ahAsset$symbol = ahAsset.symbol) === null || _ahAsset$symbol === void 0 ? void 0 : _ahAsset$symbol.toLowerCase()) === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase());
13227
13241
  });
13228
13242
  if (assetHubAsset === undefined) {
13229
13243
  throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " not found in AssetHub"));
@@ -13292,9 +13306,9 @@ var getXTokensParameters = function getXTokensParameters(isMultiAssetTransfer, c
13292
13306
  var feeAssetIndex = isMultiAsset ? overriddenAsset.findIndex(function (asset) {
13293
13307
  return asset.isFeeAsset;
13294
13308
  }) : undefined;
13295
- return Object.assign(Object.assign(_defineProperty({}, isMultiAsset ? 'assets' : 'asset', currencySelection), isMultiAsset && {
13309
+ return _objectSpread2(_objectSpread2(_defineProperty({}, isMultiAsset ? 'assets' : 'asset', currencySelection), isMultiAsset && {
13296
13310
  fee_item: feeAssetIndex
13297
- }), {
13311
+ }), {}, {
13298
13312
  dest: addressSelection,
13299
13313
  dest_weight_limit: fees
13300
13314
  });
@@ -13315,7 +13329,6 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
13315
13329
  key: "transferXTokens",
13316
13330
  value: function transferXTokens(input, currencySelection) {
13317
13331
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
13318
- var _a;
13319
13332
  var api = input.api,
13320
13333
  origin = input.origin,
13321
13334
  asset = input.asset,
@@ -13338,7 +13351,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
13338
13351
  var section = shouldUseMultiasset ? isMultiAsset ? 'transfer_multiassets' : 'transfer_multiasset' : 'transfer';
13339
13352
  var parameters = getXTokensParameters(shouldUseMultiasset, modifiedCurrencySelection, addressSelection, asset.amount, fees, overriddenAsset);
13340
13353
  var call = {
13341
- module: (_a = pallet) !== null && _a !== void 0 ? _a : 'XTokens',
13354
+ module: pallet !== null && pallet !== void 0 ? pallet : 'XTokens',
13342
13355
  section: method !== null && method !== void 0 ? method : section,
13343
13356
  parameters: parameters
13344
13357
  };
@@ -13397,8 +13410,8 @@ var ParachainNode = /*#__PURE__*/function () {
13397
13410
  }
13398
13411
  }, {
13399
13412
  key: "transfer",
13400
- value: function transfer(options) {
13401
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
13413
+ value: function () {
13414
+ var _transfer = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
13402
13415
  var api, asset, address, destination, paraIdTo, overriddenAsset, version, ahAddress, pallet, method, isRelayDestination, scenario, paraId, versionOrDefault, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input;
13403
13416
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13404
13417
  while (1) switch (_context.prev = _context.next) {
@@ -13486,7 +13499,11 @@ var ParachainNode = /*#__PURE__*/function () {
13486
13499
  }
13487
13500
  }, _callee, this);
13488
13501
  }));
13489
- }
13502
+ function transfer(_x) {
13503
+ return _transfer.apply(this, arguments);
13504
+ }
13505
+ return transfer;
13506
+ }()
13490
13507
  }, {
13491
13508
  key: "getRelayToParaOverrides",
13492
13509
  value: function getRelayToParaOverrides() {
@@ -13498,7 +13515,6 @@ var ParachainNode = /*#__PURE__*/function () {
13498
13515
  }, {
13499
13516
  key: "transferRelayToPara",
13500
13517
  value: function transferRelayToPara(options) {
13501
- var _a;
13502
13518
  var _options$version = options.version,
13503
13519
  version = _options$version === void 0 ? Version.V3 : _options$version,
13504
13520
  pallet = options.pallet,
@@ -13507,7 +13523,7 @@ var ParachainNode = /*#__PURE__*/function () {
13507
13523
  section = _this$getRelayToParaO.section,
13508
13524
  includeFee = _this$getRelayToParaO.includeFee;
13509
13525
  return {
13510
- module: (_a = pallet) !== null && _a !== void 0 ? _a : 'XcmPallet',
13526
+ module: pallet !== null && pallet !== void 0 ? pallet : 'XcmPallet',
13511
13527
  section: method !== null && method !== void 0 ? method : section,
13512
13528
  parameters: constructRelayToParaParameters(options, version, {
13513
13529
  includeFee: includeFee
@@ -13617,14 +13633,13 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
13617
13633
  pallet = _ref.pallet,
13618
13634
  method = _ref.method;
13619
13635
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
13620
- var _a;
13621
13636
  var feeAssetIndex = overriddenAsset === undefined || isTMultiLocation(overriddenAsset) ? DEFAULT_FEE_ASSET : overriddenAsset.findIndex(function (asset) {
13622
13637
  return asset.isFeeAsset;
13623
13638
  });
13624
13639
  var call = {
13625
- module: (_a = pallet) !== null && _a !== void 0 ? _a : 'PolkadotXcm',
13640
+ module: pallet !== null && pallet !== void 0 ? pallet : 'PolkadotXcm',
13626
13641
  section: method !== null && method !== void 0 ? method : section,
13627
- parameters: Object.assign({
13642
+ parameters: _objectSpread2({
13628
13643
  dest: header,
13629
13644
  beneficiary: addressSelection,
13630
13645
  assets: currencySelection,
@@ -13685,14 +13700,14 @@ var BifrostPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
13685
13700
  }, {
13686
13701
  key: "transferPolkadotXCM",
13687
13702
  value: function transferPolkadotXCM(input) {
13688
- var _a;
13703
+ var _getAssetId;
13689
13704
  var overriddenAsset = input.overriddenAsset,
13690
13705
  asset = input.asset;
13691
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
13706
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
13692
13707
  currencySelection: createCurrencySpec(asset.amount, this.version, asset.symbol === 'DOT' ? Parents.ONE : Parents.TWO, overriddenAsset, asset.symbol === 'WETH' ? {
13693
13708
  X2: [ETHEREUM_JUNCTION, {
13694
13709
  AccountKey20: {
13695
- key: (_a = getAssetId('Ethereum', 'WETH')) !== null && _a !== void 0 ? _a : ''
13710
+ key: (_getAssetId = getAssetId('Ethereum', 'WETH')) !== null && _getAssetId !== void 0 ? _getAssetId : ''
13696
13711
  }
13697
13712
  }]
13698
13713
  } : undefined)
@@ -13775,13 +13790,13 @@ var createEthereumTokenLocation = function createEthereumTokenLocation(currencyI
13775
13790
  };
13776
13791
  };
13777
13792
 
13778
- var calculateFee = function calculateFee(api) {
13779
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
13793
+ var calculateFee = /*#__PURE__*/function () {
13794
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api) {
13780
13795
  var DEFAULT_FEE, ahApi, feeStorageItem, leFeeHex, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
13781
13796
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13782
13797
  while (1) switch (_context.prev = _context.next) {
13783
13798
  case 0:
13784
- DEFAULT_FEE = BigInt(2750872500000);
13799
+ DEFAULT_FEE = 2750872500000n;
13785
13800
  _context.next = 3;
13786
13801
  return api.createApiForNode('AssetHubPolkadot');
13787
13802
  case 3:
@@ -13792,8 +13807,8 @@ var calculateFee = function calculateFee(api) {
13792
13807
  feeStorageItem = _context.sent;
13793
13808
  leFeeHex = feeStorageItem.replace('0x', '');
13794
13809
  leFee = BigInt('0x' + leFeeHex.split('').reverse().join(''));
13795
- transfer_bridge_fee = leFee === BigInt(0) ? DEFAULT_FEE : BigInt(leFee.toString());
13796
- transfer_assethub_execution_fee = BigInt(2200000000);
13810
+ transfer_bridge_fee = leFee === 0n ? DEFAULT_FEE : BigInt(leFee.toString());
13811
+ transfer_assethub_execution_fee = 2200000000n;
13797
13812
  return _context.abrupt("return", (transfer_bridge_fee + transfer_assethub_execution_fee).toString());
13798
13813
  case 12:
13799
13814
  case "end":
@@ -13801,11 +13816,14 @@ var calculateFee = function calculateFee(api) {
13801
13816
  }
13802
13817
  }, _callee);
13803
13818
  }));
13804
- };
13805
- var createCustomXcmAh = function createCustomXcmAh(_ref, version) {
13806
- var api = _ref.api,
13807
- scenario = _ref.scenario,
13808
- address = _ref.address;
13819
+ return function calculateFee(_x) {
13820
+ return _ref.apply(this, arguments);
13821
+ };
13822
+ }();
13823
+ var createCustomXcmAh = function createCustomXcmAh(_ref2, version) {
13824
+ var api = _ref2.api,
13825
+ scenario = _ref2.scenario,
13826
+ address = _ref2.address;
13809
13827
  return _defineProperty({}, version, [{
13810
13828
  DepositAsset: {
13811
13829
  assets: {
@@ -13817,13 +13835,13 @@ var createCustomXcmAh = function createCustomXcmAh(_ref, version) {
13817
13835
  }
13818
13836
  }]);
13819
13837
  };
13820
- var createCustomXcmOnDest = function createCustomXcmOnDest(_ref3, version) {
13821
- var api = _ref3.api,
13822
- address = _ref3.address,
13823
- asset = _ref3.asset,
13824
- scenario = _ref3.scenario,
13825
- ahAddress = _ref3.ahAddress;
13826
- var _a;
13838
+ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref4, version) {
13839
+ var _asset$assetId;
13840
+ var api = _ref4.api,
13841
+ address = _ref4.address,
13842
+ asset = _ref4.asset,
13843
+ scenario = _ref4.scenario,
13844
+ ahAddress = _ref4.ahAddress;
13827
13845
  if (!isForeignAsset(asset)) {
13828
13846
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
13829
13847
  }
@@ -13841,7 +13859,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref3, version) {
13841
13859
  assets: {
13842
13860
  Wild: {
13843
13861
  AllOf: {
13844
- id: createEthereumTokenLocation((_a = asset.assetId) !== null && _a !== void 0 ? _a : ''),
13862
+ id: createEthereumTokenLocation((_asset$assetId = asset.assetId) !== null && _asset$assetId !== void 0 ? _asset$assetId : ''),
13845
13863
  fun: 'Fungible'
13846
13864
  }
13847
13865
  }
@@ -13867,7 +13885,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref3, version) {
13867
13885
  }
13868
13886
  },
13869
13887
  fun: {
13870
- Fungible: BigInt(1)
13888
+ Fungible: 1n
13871
13889
  }
13872
13890
  },
13873
13891
  weight_limit: 'Unlimited'
@@ -13903,9 +13921,10 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
13903
13921
  _inherits(Hydration, _ParachainNode);
13904
13922
  return _createClass(Hydration, [{
13905
13923
  key: "transferToEthereum",
13906
- value: function transferToEthereum(input) {
13907
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
13908
- var _a, _b, api, address, asset, scenario, version, destination, ahAddress, versionOrDefault, ethMultiAsset, fee, call;
13924
+ value: function () {
13925
+ var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(input) {
13926
+ var _asset$symbol, _asset$assetId2;
13927
+ var api, address, asset, scenario, version, destination, ahAddress, versionOrDefault, ethMultiAsset, fee, call;
13909
13928
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
13910
13929
  while (1) switch (_context2.prev = _context2.next) {
13911
13930
  case 0:
@@ -13916,7 +13935,7 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
13916
13935
  }
13917
13936
  throw new Error('Only Ethereum addresses are supported for Ethereum transfers');
13918
13937
  case 3:
13919
- if (!(((_a = asset.symbol) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== 'WETH')) {
13938
+ if (!(((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toUpperCase()) !== 'WETH')) {
13920
13939
  _context2.next = 5;
13921
13940
  break;
13922
13941
  }
@@ -13935,7 +13954,7 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
13935
13954
  throw new Error('AssetHub address is required for Ethereum transfers');
13936
13955
  case 9:
13937
13956
  versionOrDefault = version !== null && version !== void 0 ? version : Version.V4;
13938
- ethMultiAsset = Object.values(createCurrencySpec(asset.amount, versionOrDefault, Parents.TWO, createEthereumTokenLocation((_b = asset.assetId) !== null && _b !== void 0 ? _b : '')))[0][0];
13957
+ ethMultiAsset = Object.values(createCurrencySpec(asset.amount, versionOrDefault, Parents.TWO, createEthereumTokenLocation((_asset$assetId2 = asset.assetId) !== null && _asset$assetId2 !== void 0 ? _asset$assetId2 : '')))[0][0];
13939
13958
  _context2.next = 13;
13940
13959
  return calculateFee(api);
13941
13960
  case 13:
@@ -13963,7 +13982,11 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
13963
13982
  }
13964
13983
  }, _callee2, this);
13965
13984
  }));
13966
- }
13985
+ function transferToEthereum(_x2) {
13986
+ return _transferToEthereum.apply(this, arguments);
13987
+ }
13988
+ return transferToEthereum;
13989
+ }()
13967
13990
  }, {
13968
13991
  key: "transferToAssetHub",
13969
13992
  value: function transferToAssetHub(input) {
@@ -13996,8 +14019,8 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
13996
14019
  // Handles WETH Ethereum transfers
13997
14020
  }, {
13998
14021
  key: "transferPolkadotXCM",
13999
- value: function transferPolkadotXCM(input) {
14000
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
14022
+ value: function () {
14023
+ var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(input) {
14001
14024
  var destination;
14002
14025
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
14003
14026
  while (1) switch (_context3.prev = _context3.next) {
@@ -14016,7 +14039,11 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
14016
14039
  }
14017
14040
  }, _callee3, this);
14018
14041
  }));
14019
- }
14042
+ function transferPolkadotXCM(_x3) {
14043
+ return _transferPolkadotXCM.apply(this, arguments);
14044
+ }
14045
+ return transferPolkadotXCM;
14046
+ }()
14020
14047
  }, {
14021
14048
  key: "transferXTokens",
14022
14049
  value: function transferXTokens(input) {
@@ -14031,9 +14058,9 @@ var Hydration$1 = /*#__PURE__*/function (_ParachainNode) {
14031
14058
  }
14032
14059
  }, {
14033
14060
  key: "canUseXTokens",
14034
- value: function canUseXTokens(_ref5) {
14035
- var destination = _ref5.destination,
14036
- asset = _ref5.asset;
14061
+ value: function canUseXTokens(_ref6) {
14062
+ var destination = _ref6.destination,
14063
+ asset = _ref6.asset;
14037
14064
  return destination !== 'Ethereum' && !(destination === 'AssetHubPolkadot' && asset.symbol === 'DOT');
14038
14065
  }
14039
14066
  }]);
@@ -14107,7 +14134,7 @@ var Moonbeam$1 = /*#__PURE__*/function (_ParachainNode) {
14107
14134
  version = _input$version === void 0 ? this.version : _input$version,
14108
14135
  overriddenAsset = input.overriddenAsset;
14109
14136
  var multiLocation = this.getJunctions(asset, scenario);
14110
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
14137
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
14111
14138
  currencySelection: createCurrencySpec(asset.amount, version, multiLocation.parents, overriddenAsset, multiLocation.interior)
14112
14139
  }), 'transfer_assets', 'Unlimited'));
14113
14140
  }
@@ -14330,7 +14357,7 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
14330
14357
  version = _input$version === void 0 ? this.version : _input$version,
14331
14358
  overriddenAsset = input.overriddenAsset;
14332
14359
  var multiLocation = this.getJunctions(asset, scenario);
14333
- return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
14360
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
14334
14361
  currencySelection: createCurrencySpec(asset.amount, version, multiLocation.parents, overriddenAsset, multiLocation.interior)
14335
14362
  }), 'transfer_assets', 'Unlimited'));
14336
14363
  }
@@ -14496,9 +14523,9 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
14496
14523
  return _defineProperty({}, version, {
14497
14524
  parents: pallet === 'XTokens' ? Parents.ONE : Parents.ZERO,
14498
14525
  interior: createX1Payload(version, {
14499
- AccountId32: Object.assign(Object.assign({}, version === Version.V1 && {
14526
+ AccountId32: _objectSpread2(_objectSpread2({}, version === Version.V1 && {
14500
14527
  network: 'any'
14501
- }), {
14528
+ }), {}, {
14502
14529
  id: api.createAccountId(recipientAddress)
14503
14530
  })
14504
14531
  })
@@ -14511,15 +14538,15 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
14511
14538
  X2: [{
14512
14539
  Parachain: nodeId
14513
14540
  }, isEthAddress ? {
14514
- AccountKey20: Object.assign(Object.assign({}, (version === Version.V1 || version === Version.V2) && {
14541
+ AccountKey20: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
14515
14542
  network: 'any'
14516
- }), {
14543
+ }), {}, {
14517
14544
  key: recipientAddress
14518
14545
  })
14519
14546
  } : {
14520
- AccountId32: Object.assign(Object.assign({}, (version === Version.V1 || version === Version.V2) && {
14547
+ AccountId32: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
14521
14548
  network: 'any'
14522
- }), {
14549
+ }), {}, {
14523
14550
  id: api.createAccountId(recipientAddress)
14524
14551
  })
14525
14552
  }]
@@ -14530,15 +14557,15 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
14530
14557
  return _defineProperty({}, version, {
14531
14558
  parents: Parents.ZERO,
14532
14559
  interior: createX1Payload(version, isEthAddress ? {
14533
- AccountKey20: Object.assign(Object.assign({}, (version === Version.V1 || version === Version.V2) && {
14560
+ AccountKey20: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
14534
14561
  network: 'any'
14535
- }), {
14562
+ }), {}, {
14536
14563
  key: recipientAddress
14537
14564
  })
14538
14565
  } : {
14539
- AccountId32: Object.assign(Object.assign({}, (version === Version.V1 || version === Version.V2) && {
14566
+ AccountId32: _objectSpread2(_objectSpread2({}, (version === Version.V1 || version === Version.V2) && {
14540
14567
  network: 'any'
14541
- }), {
14568
+ }), {}, {
14542
14569
  id: api.createAccountId(recipientAddress)
14543
14570
  })
14544
14571
  })
@@ -14577,7 +14604,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14577
14604
  _classCallCheck(this, AssetHubPolkadot);
14578
14605
  _this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', Version.V3]);
14579
14606
  _this.handleBifrostEthTransfer = function (input) {
14580
- var _a;
14607
+ var _asset$assetId;
14581
14608
  var api = input.api,
14582
14609
  scenario = input.scenario,
14583
14610
  version = input.version,
@@ -14587,7 +14614,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14587
14614
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
14588
14615
  }
14589
14616
  var versionOrDefault = version !== null && version !== void 0 ? version : _this.version;
14590
- var ethereumTokenLocation = createEthereumTokenLocation((_a = asset.assetId) !== null && _a !== void 0 ? _a : '');
14617
+ var ethereumTokenLocation = createEthereumTokenLocation((_asset$assetId = asset.assetId) !== null && _asset$assetId !== void 0 ? _asset$assetId : '');
14591
14618
  var call = {
14592
14619
  module: 'PolkadotXcm',
14593
14620
  section: 'transfer_assets_using_type_and_then',
@@ -14611,16 +14638,16 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14611
14638
  return _createClass(AssetHubPolkadot, [{
14612
14639
  key: "handleBridgeTransfer",
14613
14640
  value: function handleBridgeTransfer(input, targetChain) {
14614
- var _a, _b, _c, _d;
14615
- if (targetChain === 'Kusama' && ((_a = input.asset.symbol) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'KSM' || targetChain === 'Polkadot' && ((_b = input.asset.symbol) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'DOT') {
14616
- var modifiedInput = Object.assign(Object.assign({}, input), {
14641
+ var _input$asset$symbol, _input$asset$symbol2, _input$asset$symbol3, _input$asset$symbol4;
14642
+ if (targetChain === 'Kusama' && ((_input$asset$symbol = input.asset.symbol) === null || _input$asset$symbol === void 0 ? void 0 : _input$asset$symbol.toUpperCase()) === 'KSM' || targetChain === 'Polkadot' && ((_input$asset$symbol2 = input.asset.symbol) === null || _input$asset$symbol2 === void 0 ? void 0 : _input$asset$symbol2.toUpperCase()) === 'DOT') {
14643
+ var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
14617
14644
  header: createBridgePolkadotXcmDest(Version.V4, targetChain, input.destination, input.paraIdTo),
14618
14645
  addressSelection: generateAddressMultiLocationV4(input.api, input.address),
14619
14646
  currencySelection: createBridgeCurrencySpec(input.asset.amount, targetChain)
14620
14647
  });
14621
14648
  return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'transfer_assets', 'Unlimited');
14622
- } else if (targetChain === 'Polkadot' && ((_c = input.asset.symbol) === null || _c === void 0 ? void 0 : _c.toUpperCase()) === 'KSM' || targetChain === 'Kusama' && ((_d = input.asset.symbol) === null || _d === void 0 ? void 0 : _d.toUpperCase()) === 'DOT') {
14623
- var _modifiedInput = Object.assign(Object.assign({}, input), {
14649
+ } else if (targetChain === 'Polkadot' && ((_input$asset$symbol3 = input.asset.symbol) === null || _input$asset$symbol3 === void 0 ? void 0 : _input$asset$symbol3.toUpperCase()) === 'KSM' || targetChain === 'Kusama' && ((_input$asset$symbol4 = input.asset.symbol) === null || _input$asset$symbol4 === void 0 ? void 0 : _input$asset$symbol4.toUpperCase()) === 'DOT') {
14650
+ var _modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
14624
14651
  header: createBridgePolkadotXcmDest(Version.V3, targetChain, input.destination, input.paraIdTo),
14625
14652
  currencySelection: createCurrencySpec(input.asset.amount, Version.V3, Parents.ONE, input.overriddenAsset)
14626
14653
  });
@@ -14631,7 +14658,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14631
14658
  }, {
14632
14659
  key: "handleEthBridgeTransfer",
14633
14660
  value: function handleEthBridgeTransfer(input) {
14634
- var _a;
14661
+ var _ethAsset$assetId;
14635
14662
  var api = input.api,
14636
14663
  scenario = input.scenario,
14637
14664
  destination = input.destination,
@@ -14648,7 +14675,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14648
14675
  if (!ethAsset) {
14649
14676
  throw new InvalidCurrencyError("Currency ".concat(asset.symbol, " is not supported for Ethereum transfers"));
14650
14677
  }
14651
- var modifiedInput = Object.assign(Object.assign({}, input), {
14678
+ var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
14652
14679
  header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
14653
14680
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, this.version, paraIdTo),
14654
14681
  currencySelection: createCurrencySpec(input.asset.amount, Version.V3, Parents.TWO, {
@@ -14656,7 +14683,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14656
14683
  interior: {
14657
14684
  X2: [ETHEREUM_JUNCTION, {
14658
14685
  AccountKey20: {
14659
- key: (_a = ethAsset.assetId) !== null && _a !== void 0 ? _a : ''
14686
+ key: (_ethAsset$assetId = ethAsset.assetId) !== null && _ethAsset$assetId !== void 0 ? _ethAsset$assetId : ''
14660
14687
  }
14661
14688
  }]
14662
14689
  }
@@ -14685,7 +14712,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14685
14712
  }
14686
14713
  }
14687
14714
  };
14688
- var modifiedInput = Object.assign(Object.assign({}, input), {
14715
+ var modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
14689
14716
  header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
14690
14717
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, version, paraId),
14691
14718
  currencySelection: this.createCurrencySpec(asset.amount, scenario, version, asset, overriddenAsset !== null && overriddenAsset !== void 0 ? overriddenAsset : customMultiLocation)
@@ -14695,7 +14722,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14695
14722
  }, {
14696
14723
  key: "patchInput",
14697
14724
  value: function patchInput(input) {
14698
- var _a, _b, _c;
14725
+ var _asset$symbol, _asset$symbol2;
14699
14726
  var asset = input.asset,
14700
14727
  destination = input.destination,
14701
14728
  paraIdTo = input.paraIdTo,
@@ -14704,9 +14731,10 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14704
14731
  api = input.api,
14705
14732
  version = input.version,
14706
14733
  address = input.address;
14707
- if ((((_a = asset.symbol) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'USDT' || ((_b = asset.symbol) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'USDC') && destination === 'BifrostPolkadot') {
14708
- var versionOrDefault = (_c = input.version) !== null && _c !== void 0 ? _c : Version.V2;
14709
- return Object.assign(Object.assign({}, input), {
14734
+ if ((((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toUpperCase()) === 'USDT' || ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toUpperCase()) === 'USDC') && destination === 'BifrostPolkadot') {
14735
+ var _input$version;
14736
+ var versionOrDefault = (_input$version = input.version) !== null && _input$version !== void 0 ? _input$version : Version.V2;
14737
+ return _objectSpread2(_objectSpread2({}, input), {}, {
14710
14738
  header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
14711
14739
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraIdTo),
14712
14740
  currencySelection: this.createCurrencySpec(asset.amount, scenario, versionOrDefault, asset, overriddenAsset)
@@ -14714,7 +14742,7 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
14714
14742
  }
14715
14743
  if ((destination === 'Hydration' || destination === 'Polimec') && asset.symbol === 'DOT') {
14716
14744
  var _versionOrDefault = version !== null && version !== void 0 ? version : this.version;
14717
- return Object.assign(Object.assign({}, input), {
14745
+ return _objectSpread2(_objectSpread2({}, input), {}, {
14718
14746
  currencySelection: _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([asset.amount, 'ParaToRelay', _versionOrDefault, asset, overriddenAsset])
14719
14747
  });
14720
14748
  }
@@ -15353,7 +15381,6 @@ var XTransferTransferImpl = /*#__PURE__*/function () {
15353
15381
  return _createClass(XTransferTransferImpl, null, [{
15354
15382
  key: "transferXTransfer",
15355
15383
  value: function transferXTransfer(input) {
15356
- var _a;
15357
15384
  var api = input.api,
15358
15385
  origin = input.origin,
15359
15386
  destination = input.destination,
@@ -15370,7 +15397,7 @@ var XTransferTransferImpl = /*#__PURE__*/function () {
15370
15397
  var section = 'transfer';
15371
15398
  var destWeight = origin === 'Khala' ? null : determineDestWeight(destination);
15372
15399
  var call = {
15373
- module: (_a = pallet) !== null && _a !== void 0 ? _a : 'XTransfer',
15400
+ module: pallet !== null && pallet !== void 0 ? pallet : 'XTransfer',
15374
15401
  section: method !== null && method !== void 0 ? method : section,
15375
15402
  parameters: {
15376
15403
  asset: currencySpec,
@@ -15599,7 +15626,7 @@ var Peaq$1 = /*#__PURE__*/function (_ParachainNode) {
15599
15626
  }]);
15600
15627
  }(ParachainNode);
15601
15628
 
15602
- var GAS_LIMIT = BigInt('1000000000');
15629
+ var GAS_LIMIT = 1000000000n;
15603
15630
  var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scenario, destination, paraIdTo, version) {
15604
15631
  var isRelayDestination = !isTMultiLocation(destination) && isRelayChain(destination);
15605
15632
  var paraId = !isRelayDestination && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
@@ -15621,7 +15648,7 @@ var createCustomXcmPolimec = function createCustomXcmPolimec(api, address, scena
15621
15648
  }
15622
15649
  },
15623
15650
  fun: {
15624
- Fungible: BigInt(GAS_LIMIT)
15651
+ Fungible: GAS_LIMIT
15625
15652
  }
15626
15653
  },
15627
15654
  weight_limit: 'Unlimited'
@@ -15658,8 +15685,8 @@ var Polimec$1 = /*#__PURE__*/function (_ParachainNode) {
15658
15685
  _inherits(Polimec, _ParachainNode);
15659
15686
  return _createClass(Polimec, [{
15660
15687
  key: "transferPolkadotXCM",
15661
- value: function transferPolkadotXCM(input) {
15662
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
15688
+ value: function () {
15689
+ var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {
15663
15690
  var api, _input$version, version, asset, destination, address, scenario, paraIdTo, currencySelection, versionOrDefault, call;
15664
15691
  return _regeneratorRuntime().wrap(function _callee$(_context) {
15665
15692
  while (1) switch (_context.prev = _context.next) {
@@ -15670,7 +15697,7 @@ var Polimec$1 = /*#__PURE__*/function (_ParachainNode) {
15670
15697
  break;
15671
15698
  }
15672
15699
  currencySelection = _defineProperty({}, version, [createMultiAsset(version, asset.amount.toString(), this.getAssetMultiLocation(input.asset))]);
15673
- return _context.abrupt("return", Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
15700
+ return _context.abrupt("return", Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(_objectSpread2(_objectSpread2({}, input), {}, {
15674
15701
  currencySelection: currencySelection
15675
15702
  }), 'transfer_assets', 'Unlimited')));
15676
15703
  case 4:
@@ -15706,7 +15733,11 @@ var Polimec$1 = /*#__PURE__*/function (_ParachainNode) {
15706
15733
  }
15707
15734
  }, _callee, this);
15708
15735
  }));
15709
- }
15736
+ function transferPolkadotXCM(_x) {
15737
+ return _transferPolkadotXCM.apply(this, arguments);
15738
+ }
15739
+ return transferPolkadotXCM;
15740
+ }()
15710
15741
  }, {
15711
15742
  key: "transferRelayToPara",
15712
15743
  value: function transferRelayToPara(options) {
@@ -15848,8 +15879,8 @@ var findBestMatches = function findBestMatches(assets, value) {
15848
15879
  }
15849
15880
  // Case-insensitive match
15850
15881
  matches = assets.filter(function (asset) {
15851
- var _a;
15852
- return ((_a = asset[property]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === lowerValue;
15882
+ var _asset$property;
15883
+ return ((_asset$property = asset[property]) === null || _asset$property === void 0 ? void 0 : _asset$property.toLowerCase()) === lowerValue;
15853
15884
  });
15854
15885
  return matches;
15855
15886
  };
@@ -16029,9 +16060,9 @@ var findAssetByMultiLocation = function findAssetByMultiLocation(foreignAssets,
16029
16060
  if (typeof multiLocation === 'string') {
16030
16061
  var sanitizedInput = sanitizeMultiLocation(multiLocation);
16031
16062
  return foreignAssets.find(function (asset) {
16032
- var _a, _b;
16033
- var assetMLStr = JSON.stringify((_a = asset.multiLocation) !== null && _a !== void 0 ? _a : '');
16034
- var assetMLInteriorStr = JSON.stringify((_b = asset.xcmInterior) !== null && _b !== void 0 ? _b : '');
16063
+ var _asset$multiLocation, _asset$xcmInterior;
16064
+ var assetMLStr = JSON.stringify((_asset$multiLocation = asset.multiLocation) !== null && _asset$multiLocation !== void 0 ? _asset$multiLocation : '');
16065
+ var assetMLInteriorStr = JSON.stringify((_asset$xcmInterior = asset.xcmInterior) !== null && _asset$xcmInterior !== void 0 ? _asset$xcmInterior : '');
16035
16066
  var sanitizedAssetMLStr = sanitizeMultiLocation(assetMLStr);
16036
16067
  var sanitizedAssetMLInteriorStr = sanitizeMultiLocation(assetMLInteriorStr);
16037
16068
  return (
@@ -16087,16 +16118,17 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency, destina
16087
16118
  * @returns The existential deposit as a string if available; otherwise, null.
16088
16119
  */
16089
16120
  var getExistentialDeposit = function getExistentialDeposit(node, currency) {
16090
- var _a, _b, _c;
16121
+ var _getAssetBySymbolOrId, _asset$existentialDep;
16091
16122
  var assetsObject = getAssetsObject(node);
16092
16123
  if (!currency) {
16093
- return (_a = assetsObject.nativeAssets[0].existentialDeposit) !== null && _a !== void 0 ? _a : null;
16124
+ var _assetsObject$nativeA;
16125
+ return (_assetsObject$nativeA = assetsObject.nativeAssets[0].existentialDeposit) !== null && _assetsObject$nativeA !== void 0 ? _assetsObject$nativeA : null;
16094
16126
  }
16095
- var asset = (_b = getAssetBySymbolOrId(node, currency, null)) !== null && _b !== void 0 ? _b : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
16127
+ var asset = (_getAssetBySymbolOrId = getAssetBySymbolOrId(node, currency, null)) !== null && _getAssetBySymbolOrId !== void 0 ? _getAssetBySymbolOrId : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
16096
16128
  if (!asset) {
16097
16129
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
16098
16130
  }
16099
- return (_c = asset.existentialDeposit) !== null && _c !== void 0 ? _c : null;
16131
+ return (_asset$existentialDep = asset.existentialDeposit) !== null && _asset$existentialDep !== void 0 ? _asset$existentialDep : null;
16100
16132
  };
16101
16133
 
16102
16134
  var assetsMap = assetsMapJson;
@@ -16249,13 +16281,13 @@ var getAssetDecimals = function getAssetDecimals(node, symbol) {
16249
16281
  * @returns The node name if found; otherwise, null.
16250
16282
  */
16251
16283
  var getTNode = function getTNode(paraId, ecosystem) {
16252
- var _a;
16284
+ var _NODE_NAMES_DOT_KSM$f;
16253
16285
  if (paraId === 0) {
16254
16286
  return ecosystem === 'polkadot' ? 'Polkadot' : 'Kusama';
16255
16287
  }
16256
- return (_a = NODE_NAMES_DOT_KSM.find(function (nodeName) {
16288
+ return (_NODE_NAMES_DOT_KSM$f = NODE_NAMES_DOT_KSM.find(function (nodeName) {
16257
16289
  return getNode(nodeName).type === ecosystem && getParaId(nodeName) === paraId;
16258
- })) !== null && _a !== void 0 ? _a : null;
16290
+ })) !== null && _NODE_NAMES_DOT_KSM$f !== void 0 ? _NODE_NAMES_DOT_KSM$f : null;
16259
16291
  };
16260
16292
 
16261
16293
  var AssetHubPolkadot = {
@@ -17085,8 +17117,8 @@ var getSupportedPalletsDetails = function getSupportedPalletsDetails(node) {
17085
17117
  return palletsMap[node].supportedPallets;
17086
17118
  };
17087
17119
 
17088
- var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(api, node, address, asset) {
17089
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17120
+ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
17121
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
17090
17122
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17091
17123
  while (1) switch (_context.prev = _context.next) {
17092
17124
  case 0:
@@ -17145,10 +17177,13 @@ var getBalanceForeignPolkadotXcm = function getBalanceForeignPolkadotXcm(api, no
17145
17177
  }
17146
17178
  }, _callee);
17147
17179
  }));
17148
- };
17180
+ return function getBalanceForeignPolkadotXcm(_x, _x2, _x3, _x4) {
17181
+ return _ref.apply(this, arguments);
17182
+ };
17183
+ }();
17149
17184
 
17150
- var getBalanceForeignXTokens = function getBalanceForeignXTokens(api, node, address, asset) {
17151
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17185
+ var getBalanceForeignXTokens = /*#__PURE__*/function () {
17186
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node, address, asset) {
17152
17187
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17153
17188
  while (1) switch (_context.prev = _context.next) {
17154
17189
  case 0:
@@ -17177,53 +17212,55 @@ var getBalanceForeignXTokens = function getBalanceForeignXTokens(api, node, addr
17177
17212
  }
17178
17213
  }, _callee);
17179
17214
  }));
17180
- };
17215
+ return function getBalanceForeignXTokens(_x, _x2, _x3, _x4) {
17216
+ return _ref.apply(this, arguments);
17217
+ };
17218
+ }();
17181
17219
 
17182
- var getBalanceForeignInternal = function getBalanceForeignInternal(_a) {
17183
- return __awaiter(void 0, [_a], void 0, function (_ref) {
17184
- var address = _ref.address,
17185
- node = _ref.node,
17186
- currency = _ref.currency,
17187
- api = _ref.api;
17188
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17189
- var _b, asset, defaultPallet;
17190
- return _regeneratorRuntime().wrap(function _callee$(_context) {
17191
- while (1) switch (_context.prev = _context.next) {
17192
- case 0:
17193
- _context.next = 2;
17194
- return api.init(node);
17195
- case 2:
17196
- asset = (_b = getAssetBySymbolOrId(node, currency, null)) !== null && _b !== void 0 ? _b : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
17197
- if (asset) {
17198
- _context.next = 5;
17199
- break;
17200
- }
17201
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
17202
- case 5:
17203
- defaultPallet = getDefaultPallet(node);
17204
- if (!(defaultPallet === 'XTokens')) {
17205
- _context.next = 10;
17206
- break;
17207
- }
17208
- return _context.abrupt("return", getBalanceForeignXTokens(api, node, address, asset));
17209
- case 10:
17210
- if (!(defaultPallet === 'PolkadotXcm')) {
17211
- _context.next = 12;
17212
- break;
17213
- }
17214
- return _context.abrupt("return", getBalanceForeignPolkadotXcm(api, node, address, asset));
17215
- case 12:
17216
- throw new Error('Unsupported pallet');
17217
- case 13:
17218
- case "end":
17219
- return _context.stop();
17220
- }
17221
- }, _callee);
17222
- })();
17223
- });
17224
- };
17225
- var getBalanceForeign = function getBalanceForeign(options) {
17226
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
17220
+ var getBalanceForeignInternal = /*#__PURE__*/function () {
17221
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
17222
+ var _getAssetBySymbolOrId;
17223
+ var address, node, currency, api, asset, defaultPallet;
17224
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17225
+ while (1) switch (_context.prev = _context.next) {
17226
+ case 0:
17227
+ address = _ref.address, node = _ref.node, currency = _ref.currency, api = _ref.api;
17228
+ _context.next = 3;
17229
+ return api.init(node);
17230
+ case 3:
17231
+ asset = (_getAssetBySymbolOrId = getAssetBySymbolOrId(node, currency, null)) !== null && _getAssetBySymbolOrId !== void 0 ? _getAssetBySymbolOrId : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
17232
+ if (asset) {
17233
+ _context.next = 6;
17234
+ break;
17235
+ }
17236
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
17237
+ case 6:
17238
+ defaultPallet = getDefaultPallet(node);
17239
+ if (!(defaultPallet === 'XTokens')) {
17240
+ _context.next = 11;
17241
+ break;
17242
+ }
17243
+ return _context.abrupt("return", getBalanceForeignXTokens(api, node, address, asset));
17244
+ case 11:
17245
+ if (!(defaultPallet === 'PolkadotXcm')) {
17246
+ _context.next = 13;
17247
+ break;
17248
+ }
17249
+ return _context.abrupt("return", getBalanceForeignPolkadotXcm(api, node, address, asset));
17250
+ case 13:
17251
+ throw new Error('Unsupported pallet');
17252
+ case 14:
17253
+ case "end":
17254
+ return _context.stop();
17255
+ }
17256
+ }, _callee);
17257
+ }));
17258
+ return function getBalanceForeignInternal(_x) {
17259
+ return _ref2.apply(this, arguments);
17260
+ };
17261
+ }();
17262
+ var getBalanceForeign = /*#__PURE__*/function () {
17263
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
17227
17264
  var api;
17228
17265
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
17229
17266
  while (1) switch (_context2.prev = _context2.next) {
@@ -17246,59 +17283,60 @@ var getBalanceForeign = function getBalanceForeign(options) {
17246
17283
  }
17247
17284
  }, _callee2, null, [[1,, 5, 9]]);
17248
17285
  }));
17249
- };
17286
+ return function getBalanceForeign(_x2) {
17287
+ return _ref3.apply(this, arguments);
17288
+ };
17289
+ }();
17250
17290
 
17251
- var getBalanceNativeInternal = function getBalanceNativeInternal(_a) {
17252
- return __awaiter(void 0, [_a], void 0, function (_ref) {
17253
- var address = _ref.address,
17254
- node = _ref.node,
17255
- api = _ref.api,
17256
- currency = _ref.currency;
17257
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17258
- var symbol;
17259
- return _regeneratorRuntime().wrap(function _callee$(_context) {
17260
- while (1) switch (_context.prev = _context.next) {
17261
- case 0:
17262
- _context.next = 2;
17263
- return api.init(node);
17264
- case 2:
17265
- if (!(node === 'Interlay' || node === 'Kintsugi')) {
17266
- _context.next = 4;
17267
- break;
17268
- }
17269
- return _context.abrupt("return", getBalanceForeignInternal({
17270
- address: address,
17271
- node: node,
17272
- api: api,
17273
- currency: {
17274
- symbol: currency ? currency.symbol : getAssetsObject(node).nativeAssetSymbol
17275
- }
17276
- }));
17277
- case 4:
17278
- if (!(currency && currency.symbol !== getNativeAssetSymbol(node) && (node === 'Acala' || node === 'Karura'))) {
17279
- _context.next = 9;
17280
- break;
17281
- }
17282
- symbol = currency.symbol === 'aSEED' ? 'AUSD' : currency.symbol;
17283
- if (!(symbol.toLowerCase() === 'lcdot')) {
17284
- _context.next = 8;
17285
- break;
17291
+ var getBalanceNativeInternal = /*#__PURE__*/function () {
17292
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
17293
+ var address, node, api, currency, symbol;
17294
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17295
+ while (1) switch (_context.prev = _context.next) {
17296
+ case 0:
17297
+ address = _ref.address, node = _ref.node, api = _ref.api, currency = _ref.currency;
17298
+ _context.next = 3;
17299
+ return api.init(node);
17300
+ case 3:
17301
+ if (!(node === 'Interlay' || node === 'Kintsugi')) {
17302
+ _context.next = 5;
17303
+ break;
17304
+ }
17305
+ return _context.abrupt("return", getBalanceForeignInternal({
17306
+ address: address,
17307
+ node: node,
17308
+ api: api,
17309
+ currency: {
17310
+ symbol: currency ? currency.symbol : getAssetsObject(node).nativeAssetSymbol
17286
17311
  }
17287
- throw new InvalidCurrencyError('LcDOT balance is not supported');
17288
- case 8:
17289
- return _context.abrupt("return", api.getBalanceNativeAcala(address, symbol));
17290
- case 9:
17291
- return _context.abrupt("return", api.getBalanceNative(address));
17292
- case 10:
17293
- case "end":
17294
- return _context.stop();
17295
- }
17296
- }, _callee);
17297
- })();
17298
- });
17299
- };
17300
- var getBalanceNative = function getBalanceNative(options) {
17301
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
17312
+ }));
17313
+ case 5:
17314
+ if (!(currency && currency.symbol !== getNativeAssetSymbol(node) && (node === 'Acala' || node === 'Karura'))) {
17315
+ _context.next = 10;
17316
+ break;
17317
+ }
17318
+ symbol = currency.symbol === 'aSEED' ? 'AUSD' : currency.symbol;
17319
+ if (!(symbol.toLowerCase() === 'lcdot')) {
17320
+ _context.next = 9;
17321
+ break;
17322
+ }
17323
+ throw new InvalidCurrencyError('LcDOT balance is not supported');
17324
+ case 9:
17325
+ return _context.abrupt("return", api.getBalanceNativeAcala(address, symbol));
17326
+ case 10:
17327
+ return _context.abrupt("return", api.getBalanceNative(address));
17328
+ case 11:
17329
+ case "end":
17330
+ return _context.stop();
17331
+ }
17332
+ }, _callee);
17333
+ }));
17334
+ return function getBalanceNativeInternal(_x) {
17335
+ return _ref2.apply(this, arguments);
17336
+ };
17337
+ }();
17338
+ var getBalanceNative = /*#__PURE__*/function () {
17339
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
17302
17340
  var api;
17303
17341
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
17304
17342
  while (1) switch (_context2.prev = _context2.next) {
@@ -17321,77 +17359,79 @@ var getBalanceNative = function getBalanceNative(options) {
17321
17359
  }
17322
17360
  }, _callee2, null, [[1,, 5, 9]]);
17323
17361
  }));
17324
- };
17362
+ return function getBalanceNative(_x2) {
17363
+ return _ref3.apply(this, arguments);
17364
+ };
17365
+ }();
17325
17366
 
17326
- var getAssetBalanceInternal = function getAssetBalanceInternal(_a) {
17327
- return __awaiter(void 0, [_a], void 0, function (_ref) {
17328
- var address = _ref.address,
17329
- node = _ref.node,
17330
- currency = _ref.currency,
17331
- api = _ref.api;
17332
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17333
- var _b, isNativeSymbol;
17334
- return _regeneratorRuntime().wrap(function _callee$(_context) {
17335
- while (1) switch (_context.prev = _context.next) {
17336
- case 0:
17337
- _context.next = 2;
17338
- return api.init(node);
17339
- case 2:
17340
- isNativeSymbol = 'symbol' in currency ? getNativeAssetSymbol(node) === currency.symbol : false;
17341
- if (!(isNativeSymbol && node !== 'Interlay' && node !== 'Kintsugi')) {
17342
- _context.next = 9;
17343
- break;
17344
- }
17345
- _context.next = 6;
17346
- return getBalanceNativeInternal({
17347
- address: address,
17348
- node: node,
17349
- api: api
17350
- });
17351
- case 6:
17352
- _context.t0 = _context.sent;
17353
- _context.next = 21;
17367
+ var getAssetBalanceInternal = /*#__PURE__*/function () {
17368
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
17369
+ var _yield$getBalanceFore;
17370
+ var address, node, currency, api, isNativeSymbol;
17371
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17372
+ while (1) switch (_context.prev = _context.next) {
17373
+ case 0:
17374
+ address = _ref.address, node = _ref.node, currency = _ref.currency, api = _ref.api;
17375
+ _context.next = 3;
17376
+ return api.init(node);
17377
+ case 3:
17378
+ isNativeSymbol = 'symbol' in currency ? getNativeAssetSymbol(node) === currency.symbol : false;
17379
+ if (!(isNativeSymbol && node !== 'Interlay' && node !== 'Kintsugi')) {
17380
+ _context.next = 10;
17354
17381
  break;
17355
- case 9:
17356
- _context.next = 11;
17357
- return getBalanceForeignInternal({
17358
- address: address,
17359
- node: node,
17360
- api: api,
17361
- currency: currency
17362
- });
17363
- case 11:
17364
- _context.t2 = _b = _context.sent;
17365
- _context.t1 = _context.t2 !== null;
17366
- if (!_context.t1) {
17367
- _context.next = 15;
17368
- break;
17369
- }
17370
- _context.t1 = _b !== void 0;
17371
- case 15:
17372
- if (!_context.t1) {
17373
- _context.next = 19;
17374
- break;
17375
- }
17376
- _context.t3 = _b;
17382
+ }
17383
+ _context.next = 7;
17384
+ return getBalanceNativeInternal({
17385
+ address: address,
17386
+ node: node,
17387
+ api: api
17388
+ });
17389
+ case 7:
17390
+ _context.t0 = _context.sent;
17391
+ _context.next = 22;
17392
+ break;
17393
+ case 10:
17394
+ _context.next = 12;
17395
+ return getBalanceForeignInternal({
17396
+ address: address,
17397
+ node: node,
17398
+ api: api,
17399
+ currency: currency
17400
+ });
17401
+ case 12:
17402
+ _context.t2 = _yield$getBalanceFore = _context.sent;
17403
+ _context.t1 = _context.t2 !== null;
17404
+ if (!_context.t1) {
17405
+ _context.next = 16;
17406
+ break;
17407
+ }
17408
+ _context.t1 = _yield$getBalanceFore !== void 0;
17409
+ case 16:
17410
+ if (!_context.t1) {
17377
17411
  _context.next = 20;
17378
17412
  break;
17379
- case 19:
17380
- _context.t3 = BigInt(0);
17381
- case 20:
17382
- _context.t0 = _context.t3;
17383
- case 21:
17384
- return _context.abrupt("return", _context.t0);
17385
- case 22:
17386
- case "end":
17387
- return _context.stop();
17388
- }
17389
- }, _callee);
17390
- })();
17391
- });
17392
- };
17393
- var getAssetBalance = function getAssetBalance(options) {
17394
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
17413
+ }
17414
+ _context.t3 = _yield$getBalanceFore;
17415
+ _context.next = 21;
17416
+ break;
17417
+ case 20:
17418
+ _context.t3 = 0n;
17419
+ case 21:
17420
+ _context.t0 = _context.t3;
17421
+ case 22:
17422
+ return _context.abrupt("return", _context.t0);
17423
+ case 23:
17424
+ case "end":
17425
+ return _context.stop();
17426
+ }
17427
+ }, _callee);
17428
+ }));
17429
+ return function getAssetBalanceInternal(_x) {
17430
+ return _ref2.apply(this, arguments);
17431
+ };
17432
+ }();
17433
+ var getAssetBalance = /*#__PURE__*/function () {
17434
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
17395
17435
  var api;
17396
17436
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
17397
17437
  while (1) switch (_context2.prev = _context2.next) {
@@ -17414,7 +17454,10 @@ var getAssetBalance = function getAssetBalance(options) {
17414
17454
  }
17415
17455
  }, _callee2, null, [[1,, 5, 9]]);
17416
17456
  }));
17417
- };
17457
+ return function getAssetBalance(_x2) {
17458
+ return _ref3.apply(this, arguments);
17459
+ };
17460
+ }();
17418
17461
 
17419
17462
  var isPjsClient = function isPjsClient(api) {
17420
17463
  return _typeof(api) === 'object' && api !== null && 'disconnect' in api && typeof api.disconnect === 'function';
@@ -17453,8 +17496,8 @@ var buildClaimAssetsInput = function buildClaimAssetsInput(_ref) {
17453
17496
  };
17454
17497
  };
17455
17498
 
17456
- var claimAssets = function claimAssets(options) {
17457
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17499
+ var claimAssets = /*#__PURE__*/function () {
17500
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
17458
17501
  var api, node, args, module, call;
17459
17502
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17460
17503
  while (1) switch (_context.prev = _context.next) {
@@ -17488,7 +17531,10 @@ var claimAssets = function claimAssets(options) {
17488
17531
  }
17489
17532
  }, _callee, null, [[3,, 8, 13]]);
17490
17533
  }));
17491
- };
17534
+ return function claimAssets(_x) {
17535
+ return _ref.apply(this, arguments);
17536
+ };
17537
+ }();
17492
17538
 
17493
17539
  /**
17494
17540
  * Builder class for constructing asset claim transactions.
@@ -17554,8 +17600,8 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
17554
17600
  */
17555
17601
  }, {
17556
17602
  key: "build",
17557
- value: function build() {
17558
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17603
+ value: (function () {
17604
+ var _build = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17559
17605
  var options;
17560
17606
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17561
17607
  while (1) switch (_context.prev = _context.next) {
@@ -17571,7 +17617,11 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
17571
17617
  }
17572
17618
  }, _callee, this);
17573
17619
  }));
17574
- }
17620
+ function build() {
17621
+ return _build.apply(this, arguments);
17622
+ }
17623
+ return build;
17624
+ }())
17575
17625
  }], [{
17576
17626
  key: "create",
17577
17627
  value: function create(api, node) {
@@ -17597,58 +17647,64 @@ var BatchTransactionManager = /*#__PURE__*/function () {
17597
17647
  }
17598
17648
  }, {
17599
17649
  key: "buildBatch",
17600
- value: function buildBatch(api_1, from_1) {
17601
- return __awaiter(this, arguments, void 0, function (api, from) {
17602
- var _this = this;
17603
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
17604
- mode: BatchMode.BATCH_ALL
17605
- };
17606
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17607
- var mode, sameFrom, results, txs;
17608
- return _regeneratorRuntime().wrap(function _callee$(_context) {
17609
- while (1) switch (_context.prev = _context.next) {
17610
- case 0:
17611
- _context.next = 2;
17612
- return api.init(from);
17613
- case 2:
17614
- mode = options.mode;
17615
- if (!(_this.transactionOptions.length === 0)) {
17616
- _context.next = 5;
17617
- break;
17618
- }
17619
- throw new Error('No transactions to batch.');
17620
- case 5:
17621
- sameFrom = _this.transactionOptions.every(function (tx) {
17622
- return tx.origin === from;
17623
- });
17624
- if (sameFrom) {
17625
- _context.next = 8;
17626
- break;
17650
+ value: function () {
17651
+ var _buildBatch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, from) {
17652
+ var options,
17653
+ mode,
17654
+ sameFrom,
17655
+ results,
17656
+ txs,
17657
+ _args = arguments;
17658
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17659
+ while (1) switch (_context.prev = _context.next) {
17660
+ case 0:
17661
+ options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {
17662
+ mode: BatchMode.BATCH_ALL
17663
+ };
17664
+ _context.next = 3;
17665
+ return api.init(from);
17666
+ case 3:
17667
+ mode = options.mode;
17668
+ if (!(this.transactionOptions.length === 0)) {
17669
+ _context.next = 6;
17670
+ break;
17671
+ }
17672
+ throw new Error('No transactions to batch.');
17673
+ case 6:
17674
+ sameFrom = this.transactionOptions.every(function (tx) {
17675
+ return tx.origin === from;
17676
+ });
17677
+ if (sameFrom) {
17678
+ _context.next = 9;
17679
+ break;
17680
+ }
17681
+ throw new Error('All transactions must have the same origin.');
17682
+ case 9:
17683
+ results = this.transactionOptions.map(function (options) {
17684
+ return send(options);
17685
+ });
17686
+ _context.next = 12;
17687
+ return Promise.all(results);
17688
+ case 12:
17689
+ txs = _context.sent;
17690
+ return _context.abrupt("return", api.callTxMethod({
17691
+ module: 'Utility',
17692
+ section: mode === BatchMode.BATCH_ALL ? 'batch_all' : 'batch',
17693
+ parameters: {
17694
+ data: [txs]
17627
17695
  }
17628
- throw new Error('All transactions must have the same origin.');
17629
- case 8:
17630
- results = _this.transactionOptions.map(function (options) {
17631
- return send(options);
17632
- });
17633
- _context.next = 11;
17634
- return Promise.all(results);
17635
- case 11:
17636
- txs = _context.sent;
17637
- return _context.abrupt("return", api.callTxMethod({
17638
- module: 'Utility',
17639
- section: mode === BatchMode.BATCH_ALL ? 'batch_all' : 'batch',
17640
- parameters: {
17641
- data: [txs]
17642
- }
17643
- }));
17644
- case 13:
17645
- case "end":
17646
- return _context.stop();
17647
- }
17648
- }, _callee);
17649
- })();
17650
- });
17651
- }
17696
+ }));
17697
+ case 14:
17698
+ case "end":
17699
+ return _context.stop();
17700
+ }
17701
+ }, _callee, this);
17702
+ }));
17703
+ function buildBatch(_x, _x2) {
17704
+ return _buildBatch.apply(this, arguments);
17705
+ }
17706
+ return buildBatch;
17707
+ }()
17652
17708
  }]);
17653
17709
  }();
17654
17710
 
@@ -17729,19 +17785,6 @@ var GeneralBuilder = /*#__PURE__*/function () {
17729
17785
  this._ahAddress = ahAddress;
17730
17786
  return this;
17731
17787
  }
17732
- /**
17733
- * Specifies to use the keep-alive option for the destination account to keep account active.
17734
- *
17735
- * @param destApi - The API instance of the destination chain.
17736
- * @returns An instance of Builder
17737
- */
17738
- }, {
17739
- key: "useKeepAlive",
17740
- value: function useKeepAlive(destApi) {
17741
- this._destApi = this.api.clone();
17742
- this._destApi.setApi(destApi);
17743
- return this;
17744
- }
17745
17788
  /**
17746
17789
  * Sets the XCM version to be used for the transfer.
17747
17790
  *
@@ -17777,7 +17820,6 @@ var GeneralBuilder = /*#__PURE__*/function () {
17777
17820
  address: this._address,
17778
17821
  destination: this._to,
17779
17822
  paraIdTo: this._paraIdTo,
17780
- destApiForKeepAlive: this._destApi,
17781
17823
  version: this._version,
17782
17824
  ahAddress: this._ahAddress,
17783
17825
  pallet: this._pallet,
@@ -17803,8 +17845,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
17803
17845
  */
17804
17846
  }, {
17805
17847
  key: "buildBatch",
17806
- value: function buildBatch(options) {
17807
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17848
+ value: (function () {
17849
+ var _buildBatch = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
17808
17850
  return _regeneratorRuntime().wrap(function _callee$(_context) {
17809
17851
  while (1) switch (_context.prev = _context.next) {
17810
17852
  case 0:
@@ -17815,16 +17857,21 @@ var GeneralBuilder = /*#__PURE__*/function () {
17815
17857
  }
17816
17858
  }, _callee, this);
17817
17859
  }));
17818
- }
17860
+ function buildBatch(_x) {
17861
+ return _buildBatch.apply(this, arguments);
17862
+ }
17863
+ return buildBatch;
17864
+ }()
17819
17865
  /**
17820
17866
  * Builds and returns the transfer extrinsic.
17821
17867
  *
17822
17868
  * @returns A Promise that resolves to the transfer extrinsic.
17823
17869
  */
17870
+ )
17824
17871
  }, {
17825
17872
  key: "build",
17826
- value: function build() {
17827
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
17873
+ value: (function () {
17874
+ var _build = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
17828
17875
  var options;
17829
17876
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
17830
17877
  while (1) switch (_context2.prev = _context2.next) {
@@ -17849,11 +17896,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
17849
17896
  }
17850
17897
  }, _callee2, this);
17851
17898
  }));
17852
- }
17899
+ function build() {
17900
+ return _build.apply(this, arguments);
17901
+ }
17902
+ return build;
17903
+ }())
17853
17904
  }, {
17854
17905
  key: "dryRun",
17855
- value: function dryRun() {
17856
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
17906
+ value: function () {
17907
+ var _dryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
17857
17908
  var tx;
17858
17909
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
17859
17910
  while (1) switch (_context3.prev = _context3.next) {
@@ -17882,7 +17933,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
17882
17933
  }
17883
17934
  }, _callee3, this);
17884
17935
  }));
17885
- }
17936
+ function dryRun() {
17937
+ return _dryRun.apply(this, arguments);
17938
+ }
17939
+ return dryRun;
17940
+ }()
17886
17941
  }]);
17887
17942
  }();
17888
17943
  /**
@@ -17895,57 +17950,52 @@ var Builder = function Builder(api) {
17895
17950
  return new GeneralBuilder(new BatchTransactionManager(), api);
17896
17951
  };
17897
17952
 
17898
- var getOriginFeeDetailsInternal = function getOriginFeeDetailsInternal(_a) {
17899
- return __awaiter(void 0, [_a], void 0, function (_ref) {
17900
- var api = _ref.api,
17901
- account = _ref.account,
17902
- accountDestination = _ref.accountDestination,
17903
- currency = _ref.currency,
17904
- origin = _ref.origin,
17905
- destination = _ref.destination,
17906
- _ref$feeMarginPercent = _ref.feeMarginPercentage,
17907
- feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
17908
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17909
- var _b, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
17910
- return _regeneratorRuntime().wrap(function _callee$(_context) {
17911
- while (1) switch (_context.prev = _context.next) {
17912
- case 0:
17913
- _context.next = 2;
17914
- return api.init(origin);
17915
- case 2:
17916
- _context.next = 4;
17917
- return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).build();
17918
- case 4:
17919
- tx = _context.sent;
17920
- _context.next = 7;
17921
- return api.calculateTransactionFee(tx, account);
17922
- case 7:
17923
- xcmFee = _context.sent;
17924
- xcmFeeWithMargin = xcmFee + xcmFee / BigInt(feeMarginPercentage);
17925
- _context.next = 11;
17926
- return getBalanceNativeInternal({
17927
- address: account,
17928
- node: origin,
17929
- api: api
17930
- });
17931
- case 11:
17932
- nativeBalance = _context.sent;
17933
- existentialDeposit = BigInt((_b = getExistentialDeposit(origin)) !== null && _b !== void 0 ? _b : '0');
17934
- sufficientForXCM = nativeBalance - existentialDeposit - xcmFeeWithMargin > 0;
17935
- return _context.abrupt("return", {
17936
- sufficientForXCM: sufficientForXCM,
17937
- xcmFee: xcmFee
17938
- });
17939
- case 15:
17940
- case "end":
17941
- return _context.stop();
17942
- }
17943
- }, _callee);
17944
- })();
17945
- });
17946
- };
17947
- var getOriginFeeDetails = function getOriginFeeDetails(options) {
17948
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
17953
+ var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
17954
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
17955
+ var _getExistentialDeposi;
17956
+ var api, account, accountDestination, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
17957
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
17958
+ while (1) switch (_context.prev = _context.next) {
17959
+ case 0:
17960
+ api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
17961
+ _context.next = 3;
17962
+ return api.init(origin);
17963
+ case 3:
17964
+ _context.next = 5;
17965
+ return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).build();
17966
+ case 5:
17967
+ tx = _context.sent;
17968
+ _context.next = 8;
17969
+ return api.calculateTransactionFee(tx, account);
17970
+ case 8:
17971
+ xcmFee = _context.sent;
17972
+ xcmFeeWithMargin = xcmFee + xcmFee / BigInt(feeMarginPercentage);
17973
+ _context.next = 12;
17974
+ return getBalanceNativeInternal({
17975
+ address: account,
17976
+ node: origin,
17977
+ api: api
17978
+ });
17979
+ case 12:
17980
+ nativeBalance = _context.sent;
17981
+ existentialDeposit = BigInt((_getExistentialDeposi = getExistentialDeposit(origin)) !== null && _getExistentialDeposi !== void 0 ? _getExistentialDeposi : '0');
17982
+ sufficientForXCM = nativeBalance - existentialDeposit - xcmFeeWithMargin > 0;
17983
+ return _context.abrupt("return", {
17984
+ sufficientForXCM: sufficientForXCM,
17985
+ xcmFee: xcmFee
17986
+ });
17987
+ case 16:
17988
+ case "end":
17989
+ return _context.stop();
17990
+ }
17991
+ }, _callee);
17992
+ }));
17993
+ return function getOriginFeeDetailsInternal(_x) {
17994
+ return _ref2.apply(this, arguments);
17995
+ };
17996
+ }();
17997
+ var getOriginFeeDetails = /*#__PURE__*/function () {
17998
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
17949
17999
  var api;
17950
18000
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
17951
18001
  while (1) switch (_context2.prev = _context2.next) {
@@ -17970,7 +18020,10 @@ var getOriginFeeDetails = function getOriginFeeDetails(options) {
17970
18020
  }
17971
18021
  }, _callee2, null, [[2,, 6, 11]]);
17972
18022
  }));
17973
- };
18023
+ return function getOriginFeeDetails(_x2) {
18024
+ return _ref3.apply(this, arguments);
18025
+ };
18026
+ }();
17974
18027
 
17975
18028
  var validateAddress = function validateAddress(address, node) {
17976
18029
  var isDestination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -17987,276 +18040,268 @@ var validateAddress = function validateAddress(address, node) {
17987
18040
  }
17988
18041
  };
17989
18042
 
17990
- var getMaxNativeTransferableAmount = function getMaxNativeTransferableAmount(_a) {
17991
- return __awaiter(void 0, [_a], void 0, function (_ref) {
17992
- var api = _ref.api,
17993
- address = _ref.address,
17994
- node = _ref.node,
17995
- currency = _ref.currency;
17996
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
17997
- var ed, edBN, nativeBalance, maxTransferableAmount;
17998
- return _regeneratorRuntime().wrap(function _callee$(_context) {
17999
- while (1) switch (_context.prev = _context.next) {
18000
- case 0:
18001
- validateAddress(address, node, false);
18002
- ed = getExistentialDeposit(node, currency);
18003
- if (!(ed === null)) {
18004
- _context.next = 4;
18005
- break;
18006
- }
18007
- throw new Error("Cannot get existential deposit for node ".concat(node));
18008
- case 4:
18009
- edBN = BigInt(ed);
18010
- _context.next = 7;
18011
- return getBalanceNativeInternal({
18012
- address: address,
18013
- node: node,
18014
- api: api,
18015
- currency: currency
18016
- });
18017
- case 7:
18018
- nativeBalance = _context.sent;
18019
- maxTransferableAmount = nativeBalance - edBN;
18020
- return _context.abrupt("return", maxTransferableAmount > BigInt(0) ? maxTransferableAmount : BigInt(0));
18021
- case 10:
18022
- case "end":
18023
- return _context.stop();
18024
- }
18025
- }, _callee);
18026
- })();
18027
- });
18028
- };
18029
- var getMaxForeignTransferableAmount = function getMaxForeignTransferableAmount(_a) {
18030
- return __awaiter(void 0, [_a], void 0, function (_ref2) {
18031
- var api = _ref2.api,
18032
- address = _ref2.address,
18033
- node = _ref2.node,
18034
- currency = _ref2.currency;
18035
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
18036
- var _b, asset, ed, edBN, balance, maxTransferableAmount;
18037
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
18038
- while (1) switch (_context2.prev = _context2.next) {
18039
- case 0:
18040
- validateAddress(address, node, false);
18041
- asset = (_b = getAssetBySymbolOrId(node, currency, null)) !== null && _b !== void 0 ? _b : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
18042
- if (asset) {
18043
- _context2.next = 4;
18044
- break;
18045
- }
18046
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
18047
- case 4:
18048
- if (isForeignAsset(asset)) {
18049
- _context2.next = 6;
18050
- break;
18051
- }
18052
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " is not a foreign asset"));
18053
- case 6:
18054
- ed = asset.existentialDeposit;
18055
- if (ed) {
18056
- _context2.next = 9;
18057
- break;
18058
- }
18059
- throw new Error("Cannot get existential deposit for asset ".concat(JSON.stringify(asset)));
18060
- case 9:
18061
- edBN = BigInt(ed);
18062
- _context2.next = 12;
18063
- return getBalanceForeignInternal({
18064
- address: address,
18065
- node: node,
18066
- api: api,
18067
- currency: currency
18068
- });
18069
- case 12:
18070
- balance = _context2.sent;
18071
- maxTransferableAmount = balance - edBN;
18072
- return _context2.abrupt("return", maxTransferableAmount > BigInt(0) ? maxTransferableAmount : BigInt(0));
18073
- case 15:
18074
- case "end":
18075
- return _context2.stop();
18076
- }
18077
- }, _callee2);
18078
- })();
18079
- });
18080
- };
18081
- var getTransferableAmount = function getTransferableAmount(_a) {
18082
- return __awaiter(void 0, [_a], void 0, function (_ref3) {
18083
- var api = _ref3.api,
18084
- address = _ref3.address,
18085
- node = _ref3.node,
18086
- currency = _ref3.currency;
18087
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
18088
- var _b, asset;
18089
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
18090
- while (1) switch (_context3.prev = _context3.next) {
18091
- case 0:
18092
- validateAddress(address, node, false);
18093
- asset = (_b = getAssetBySymbolOrId(node, currency, null)) !== null && _b !== void 0 ? _b : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
18094
- if (asset) {
18095
- _context3.next = 4;
18096
- break;
18097
- }
18098
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
18099
- case 4:
18100
- if (!(isForeignAsset(asset) && !isRelayChain(node))) {
18101
- _context3.next = 8;
18102
- break;
18103
- }
18104
- return _context3.abrupt("return", getMaxForeignTransferableAmount({
18105
- api: api,
18106
- address: address,
18107
- node: node,
18108
- currency: currency
18109
- }));
18110
- case 8:
18111
- return _context3.abrupt("return", getMaxNativeTransferableAmount({
18112
- api: api,
18113
- address: address,
18114
- node: node,
18115
- currency: {
18116
- symbol: asset.symbol
18117
- }
18118
- }));
18119
- case 9:
18120
- case "end":
18121
- return _context3.stop();
18122
- }
18123
- }, _callee3);
18124
- })();
18125
- });
18126
- };
18127
-
18128
- var getTransferInfo = function getTransferInfo(_a) {
18129
- return __awaiter(void 0, [_a], void 0, function (_ref) {
18130
- var origin = _ref.origin,
18131
- destination = _ref.destination,
18132
- accountOrigin = _ref.accountOrigin,
18133
- accountDestination = _ref.accountDestination,
18134
- currency = _ref.currency,
18135
- api = _ref.api;
18136
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18137
- var _b, _c, _d, _e, _f, destApi, originBalance, xcmFeeDetails, expectedBalanceAfterXCMDelivery, asset;
18138
- return _regeneratorRuntime().wrap(function _callee$(_context) {
18139
- while (1) switch (_context.prev = _context.next) {
18140
- case 0:
18141
- _context.next = 2;
18142
- return api.init(origin);
18143
- case 2:
18144
- api.setDisconnectAllowed(false);
18145
- destApi = api.clone();
18146
- _context.next = 6;
18147
- return destApi.init(destination);
18148
- case 6:
18149
- destApi.setDisconnectAllowed(false);
18150
- _context.prev = 7;
18151
- _context.next = 10;
18152
- return getBalanceNativeInternal({
18153
- address: accountOrigin,
18154
- node: origin,
18155
- api: api
18156
- });
18157
- case 10:
18158
- originBalance = _context.sent;
18159
- _context.next = 13;
18160
- return getOriginFeeDetailsInternal({
18161
- origin: origin,
18162
- destination: destination,
18163
- currency: currency,
18164
- account: accountOrigin,
18165
- accountDestination: accountDestination,
18166
- api: api
18167
- });
18168
- case 13:
18169
- xcmFeeDetails = _context.sent;
18170
- expectedBalanceAfterXCMDelivery = originBalance - xcmFeeDetails.xcmFee;
18171
- asset = (_b = getAssetBySymbolOrId(origin, currency, destination)) !== null && _b !== void 0 ? _b : origin === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
18172
- if (asset) {
18173
- _context.next = 18;
18174
- break;
18043
+ var getMaxNativeTransferableAmount = /*#__PURE__*/function () {
18044
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
18045
+ var api, address, node, currency, ed, edBN, nativeBalance, maxTransferableAmount;
18046
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18047
+ while (1) switch (_context.prev = _context.next) {
18048
+ case 0:
18049
+ api = _ref.api, address = _ref.address, node = _ref.node, currency = _ref.currency;
18050
+ validateAddress(address, node, false);
18051
+ ed = getExistentialDeposit(node, currency);
18052
+ if (!(ed === null)) {
18053
+ _context.next = 5;
18054
+ break;
18055
+ }
18056
+ throw new Error("Cannot get existential deposit for node ".concat(node));
18057
+ case 5:
18058
+ edBN = BigInt(ed);
18059
+ _context.next = 8;
18060
+ return getBalanceNativeInternal({
18061
+ address: address,
18062
+ node: node,
18063
+ api: api,
18064
+ currency: currency
18065
+ });
18066
+ case 8:
18067
+ nativeBalance = _context.sent;
18068
+ maxTransferableAmount = nativeBalance - edBN;
18069
+ return _context.abrupt("return", maxTransferableAmount > 0n ? maxTransferableAmount : 0n);
18070
+ case 11:
18071
+ case "end":
18072
+ return _context.stop();
18073
+ }
18074
+ }, _callee);
18075
+ }));
18076
+ return function getMaxNativeTransferableAmount(_x) {
18077
+ return _ref2.apply(this, arguments);
18078
+ };
18079
+ }();
18080
+ var getMaxForeignTransferableAmount = /*#__PURE__*/function () {
18081
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
18082
+ var _getAssetBySymbolOrId;
18083
+ var api, address, node, currency, asset, ed, edBN, balance, maxTransferableAmount;
18084
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
18085
+ while (1) switch (_context2.prev = _context2.next) {
18086
+ case 0:
18087
+ api = _ref3.api, address = _ref3.address, node = _ref3.node, currency = _ref3.currency;
18088
+ validateAddress(address, node, false);
18089
+ asset = (_getAssetBySymbolOrId = getAssetBySymbolOrId(node, currency, null)) !== null && _getAssetBySymbolOrId !== void 0 ? _getAssetBySymbolOrId : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
18090
+ if (asset) {
18091
+ _context2.next = 5;
18092
+ break;
18093
+ }
18094
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
18095
+ case 5:
18096
+ if (isForeignAsset(asset)) {
18097
+ _context2.next = 7;
18098
+ break;
18099
+ }
18100
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " is not a foreign asset"));
18101
+ case 7:
18102
+ ed = asset.existentialDeposit;
18103
+ if (ed) {
18104
+ _context2.next = 10;
18105
+ break;
18106
+ }
18107
+ throw new Error("Cannot get existential deposit for asset ".concat(JSON.stringify(asset)));
18108
+ case 10:
18109
+ edBN = BigInt(ed);
18110
+ _context2.next = 13;
18111
+ return getBalanceForeignInternal({
18112
+ address: address,
18113
+ node: node,
18114
+ api: api,
18115
+ currency: currency
18116
+ });
18117
+ case 13:
18118
+ balance = _context2.sent;
18119
+ maxTransferableAmount = balance - edBN;
18120
+ return _context2.abrupt("return", maxTransferableAmount > 0n ? maxTransferableAmount : 0n);
18121
+ case 16:
18122
+ case "end":
18123
+ return _context2.stop();
18124
+ }
18125
+ }, _callee2);
18126
+ }));
18127
+ return function getMaxForeignTransferableAmount(_x2) {
18128
+ return _ref4.apply(this, arguments);
18129
+ };
18130
+ }();
18131
+ var getTransferableAmount = /*#__PURE__*/function () {
18132
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
18133
+ var _getAssetBySymbolOrId2;
18134
+ var api, address, node, currency, asset;
18135
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
18136
+ while (1) switch (_context3.prev = _context3.next) {
18137
+ case 0:
18138
+ api = _ref5.api, address = _ref5.address, node = _ref5.node, currency = _ref5.currency;
18139
+ validateAddress(address, node, false);
18140
+ asset = (_getAssetBySymbolOrId2 = getAssetBySymbolOrId(node, currency, null)) !== null && _getAssetBySymbolOrId2 !== void 0 ? _getAssetBySymbolOrId2 : node === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
18141
+ if (asset) {
18142
+ _context3.next = 5;
18143
+ break;
18144
+ }
18145
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(node));
18146
+ case 5:
18147
+ if (!(isForeignAsset(asset) && !isRelayChain(node))) {
18148
+ _context3.next = 9;
18149
+ break;
18150
+ }
18151
+ return _context3.abrupt("return", getMaxForeignTransferableAmount({
18152
+ api: api,
18153
+ address: address,
18154
+ node: node,
18155
+ currency: currency
18156
+ }));
18157
+ case 9:
18158
+ return _context3.abrupt("return", getMaxNativeTransferableAmount({
18159
+ api: api,
18160
+ address: address,
18161
+ node: node,
18162
+ currency: {
18163
+ symbol: asset.symbol
18175
18164
  }
18176
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(origin));
18177
- case 18:
18178
- _context.t0 = {
18179
- origin: origin,
18180
- destination: destination,
18181
- ecosystem: getRelayChainSymbol(origin)
18182
- };
18183
- _context.next = 21;
18184
- return getAssetBalanceInternal({
18185
- api: api,
18186
- address: accountOrigin,
18187
- node: origin,
18188
- currency: currency
18189
- });
18190
- case 21:
18191
- _context.t1 = _context.sent;
18192
- _context.t2 = (_c = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _c !== void 0 ? _c : '';
18193
- _context.t3 = {
18194
- balance: _context.t1,
18195
- currency: _context.t2
18196
- };
18197
- _context.t4 = originBalance;
18198
- _context.t5 = expectedBalanceAfterXCMDelivery;
18199
- _context.t6 = xcmFeeDetails;
18200
- _context.t7 = BigInt((_d = getExistentialDeposit(origin)) !== null && _d !== void 0 ? _d : 0);
18201
- _context.t8 = getNativeAssetSymbol(origin);
18202
- _context.t9 = BigInt((_e = getExistentialDeposit(origin)) !== null && _e !== void 0 ? _e : '0');
18203
- _context.next = 32;
18204
- return getMaxNativeTransferableAmount({
18205
- api: api,
18206
- address: accountOrigin,
18207
- node: origin
18208
- });
18209
- case 32:
18210
- _context.t10 = _context.sent;
18211
- _context.t11 = {
18212
- balance: _context.t4,
18213
- expectedBalanceAfterXCMFee: _context.t5,
18214
- xcmFee: _context.t6,
18215
- existentialDeposit: _context.t7,
18216
- asset: _context.t8,
18217
- minNativeTransferableAmount: _context.t9,
18218
- maxNativeTransferableAmount: _context.t10
18219
- };
18220
- _context.next = 36;
18221
- return getBalanceNativeInternal({
18222
- address: accountDestination,
18223
- node: destination,
18224
- api: destApi
18225
- });
18226
- case 36:
18227
- _context.t12 = _context.sent;
18228
- _context.t13 = getNativeAssetSymbol(destination);
18229
- _context.t14 = BigInt((_f = getExistentialDeposit(destination)) !== null && _f !== void 0 ? _f : '0');
18230
- _context.t15 = {
18231
- balance: _context.t12,
18232
- currency: _context.t13,
18233
- existentialDeposit: _context.t14
18234
- };
18235
- return _context.abrupt("return", {
18236
- chain: _context.t0,
18237
- currencyBalanceOrigin: _context.t3,
18238
- originFeeBalance: _context.t11,
18239
- destinationFeeBalance: _context.t15
18240
- });
18241
- case 41:
18242
- _context.prev = 41;
18243
- api.setDisconnectAllowed(true);
18244
- api.setDisconnectAllowed(true);
18245
- _context.next = 46;
18246
- return api.disconnect();
18247
- case 46:
18248
- _context.next = 48;
18249
- return destApi.disconnect();
18250
- case 48:
18251
- return _context.finish(41);
18252
- case 49:
18253
- case "end":
18254
- return _context.stop();
18255
- }
18256
- }, _callee, null, [[7,, 41, 49]]);
18257
- })();
18258
- });
18259
- };
18165
+ }));
18166
+ case 10:
18167
+ case "end":
18168
+ return _context3.stop();
18169
+ }
18170
+ }, _callee3);
18171
+ }));
18172
+ return function getTransferableAmount(_x3) {
18173
+ return _ref6.apply(this, arguments);
18174
+ };
18175
+ }();
18176
+
18177
+ var getTransferInfo = /*#__PURE__*/function () {
18178
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
18179
+ var origin, destination, accountOrigin, accountDestination, currency, api, destApi, _getAssetBySymbolOrId, _asset$symbol, _getExistentialDeposi, _getExistentialDeposi2, _getExistentialDeposi3, originBalance, xcmFeeDetails, expectedBalanceAfterXCMDelivery, asset;
18180
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
18181
+ while (1) switch (_context.prev = _context.next) {
18182
+ case 0:
18183
+ origin = _ref.origin, destination = _ref.destination, accountOrigin = _ref.accountOrigin, accountDestination = _ref.accountDestination, currency = _ref.currency, api = _ref.api;
18184
+ _context.next = 3;
18185
+ return api.init(origin);
18186
+ case 3:
18187
+ api.setDisconnectAllowed(false);
18188
+ destApi = api.clone();
18189
+ _context.next = 7;
18190
+ return destApi.init(destination);
18191
+ case 7:
18192
+ destApi.setDisconnectAllowed(false);
18193
+ _context.prev = 8;
18194
+ _context.next = 11;
18195
+ return getBalanceNativeInternal({
18196
+ address: accountOrigin,
18197
+ node: origin,
18198
+ api: api
18199
+ });
18200
+ case 11:
18201
+ originBalance = _context.sent;
18202
+ _context.next = 14;
18203
+ return getOriginFeeDetailsInternal({
18204
+ origin: origin,
18205
+ destination: destination,
18206
+ currency: currency,
18207
+ account: accountOrigin,
18208
+ accountDestination: accountDestination,
18209
+ api: api
18210
+ });
18211
+ case 14:
18212
+ xcmFeeDetails = _context.sent;
18213
+ expectedBalanceAfterXCMDelivery = originBalance - xcmFeeDetails.xcmFee;
18214
+ asset = (_getAssetBySymbolOrId = getAssetBySymbolOrId(origin, currency, destination)) !== null && _getAssetBySymbolOrId !== void 0 ? _getAssetBySymbolOrId : origin === 'AssetHubPolkadot' ? getAssetBySymbolOrId('Ethereum', currency, null) : null;
18215
+ if (asset) {
18216
+ _context.next = 19;
18217
+ break;
18218
+ }
18219
+ throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " not found on ").concat(origin));
18220
+ case 19:
18221
+ _context.t0 = {
18222
+ origin: origin,
18223
+ destination: destination,
18224
+ ecosystem: getRelayChainSymbol(origin)
18225
+ };
18226
+ _context.next = 22;
18227
+ return getAssetBalanceInternal({
18228
+ api: api,
18229
+ address: accountOrigin,
18230
+ node: origin,
18231
+ currency: currency
18232
+ });
18233
+ case 22:
18234
+ _context.t1 = _context.sent;
18235
+ _context.t2 = (_asset$symbol = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _asset$symbol !== void 0 ? _asset$symbol : '';
18236
+ _context.t3 = {
18237
+ balance: _context.t1,
18238
+ currency: _context.t2
18239
+ };
18240
+ _context.t4 = originBalance;
18241
+ _context.t5 = expectedBalanceAfterXCMDelivery;
18242
+ _context.t6 = xcmFeeDetails;
18243
+ _context.t7 = BigInt((_getExistentialDeposi = getExistentialDeposit(origin)) !== null && _getExistentialDeposi !== void 0 ? _getExistentialDeposi : 0);
18244
+ _context.t8 = getNativeAssetSymbol(origin);
18245
+ _context.t9 = BigInt((_getExistentialDeposi2 = getExistentialDeposit(origin)) !== null && _getExistentialDeposi2 !== void 0 ? _getExistentialDeposi2 : 0);
18246
+ _context.next = 33;
18247
+ return getMaxNativeTransferableAmount({
18248
+ api: api,
18249
+ address: accountOrigin,
18250
+ node: origin
18251
+ });
18252
+ case 33:
18253
+ _context.t10 = _context.sent;
18254
+ _context.t11 = {
18255
+ balance: _context.t4,
18256
+ expectedBalanceAfterXCMFee: _context.t5,
18257
+ xcmFee: _context.t6,
18258
+ existentialDeposit: _context.t7,
18259
+ asset: _context.t8,
18260
+ minNativeTransferableAmount: _context.t9,
18261
+ maxNativeTransferableAmount: _context.t10
18262
+ };
18263
+ _context.next = 37;
18264
+ return getBalanceNativeInternal({
18265
+ address: accountDestination,
18266
+ node: destination,
18267
+ api: destApi
18268
+ });
18269
+ case 37:
18270
+ _context.t12 = _context.sent;
18271
+ _context.t13 = getNativeAssetSymbol(destination);
18272
+ _context.t14 = BigInt((_getExistentialDeposi3 = getExistentialDeposit(destination)) !== null && _getExistentialDeposi3 !== void 0 ? _getExistentialDeposi3 : 0);
18273
+ _context.t15 = {
18274
+ balance: _context.t12,
18275
+ currency: _context.t13,
18276
+ existentialDeposit: _context.t14
18277
+ };
18278
+ return _context.abrupt("return", {
18279
+ chain: _context.t0,
18280
+ currencyBalanceOrigin: _context.t3,
18281
+ originFeeBalance: _context.t11,
18282
+ destinationFeeBalance: _context.t15
18283
+ });
18284
+ case 42:
18285
+ _context.prev = 42;
18286
+ api.setDisconnectAllowed(true);
18287
+ api.setDisconnectAllowed(true);
18288
+ _context.next = 47;
18289
+ return api.disconnect();
18290
+ case 47:
18291
+ _context.next = 49;
18292
+ return destApi.disconnect();
18293
+ case 49:
18294
+ return _context.finish(42);
18295
+ case 50:
18296
+ case "end":
18297
+ return _context.stop();
18298
+ }
18299
+ }, _callee, null, [[8,, 42, 50]]);
18300
+ }));
18301
+ return function getTransferInfo(_x) {
18302
+ return _ref2.apply(this, arguments);
18303
+ };
18304
+ }();
18260
18305
 
18261
18306
  var Native = function Native(symbol) {
18262
18307
  return {
@@ -18335,42 +18380,6 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
18335
18380
  return supportedAssets;
18336
18381
  };
18337
18382
 
18338
- var index$1 = /*#__PURE__*/Object.freeze({
18339
- __proto__: null,
18340
- Foreign: Foreign,
18341
- ForeignAbstract: ForeignAbstract,
18342
- Native: Native,
18343
- Override: Override,
18344
- claimAssets: claimAssets,
18345
- getAllAssetsSymbols: getAllAssetsSymbols,
18346
- getAssetBalance: getAssetBalance,
18347
- getAssetBalanceInternal: getAssetBalanceInternal,
18348
- getAssetBySymbolOrId: getAssetBySymbolOrId,
18349
- getAssetDecimals: getAssetDecimals,
18350
- getAssetId: getAssetId,
18351
- getAssets: getAssets,
18352
- getAssetsObject: getAssetsObject,
18353
- getBalanceForeign: getBalanceForeign,
18354
- getBalanceForeignInternal: getBalanceForeignInternal,
18355
- getBalanceNative: getBalanceNative,
18356
- getBalanceNativeInternal: getBalanceNativeInternal,
18357
- getExistentialDeposit: getExistentialDeposit,
18358
- getMaxForeignTransferableAmount: getMaxForeignTransferableAmount,
18359
- getMaxNativeTransferableAmount: getMaxNativeTransferableAmount,
18360
- getNativeAssetSymbol: getNativeAssetSymbol,
18361
- getNativeAssets: getNativeAssets,
18362
- getOriginFeeDetails: getOriginFeeDetails,
18363
- getOriginFeeDetailsInternal: getOriginFeeDetailsInternal,
18364
- getOtherAssets: getOtherAssets,
18365
- getRelayChainSymbol: getRelayChainSymbol,
18366
- getSupportedAssets: getSupportedAssets,
18367
- getTNode: getTNode,
18368
- getTransferInfo: getTransferInfo,
18369
- getTransferableAmount: getTransferableAmount,
18370
- hasSupportForAsset: hasSupportForAsset,
18371
- isNodeEvm: isNodeEvm
18372
- });
18373
-
18374
18383
  var isPrimitive = function isPrimitive(obj) {
18375
18384
  return obj !== Object(obj);
18376
18385
  };
@@ -18444,8 +18453,8 @@ var getNode = function getNode(node) {
18444
18453
  return nodeMap[node];
18445
18454
  };
18446
18455
 
18447
- var createApiInstanceForNode = function createApiInstanceForNode(api, node) {
18448
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18456
+ var createApiInstanceForNode = /*#__PURE__*/function () {
18457
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, node) {
18449
18458
  var wsUrl;
18450
18459
  return _regeneratorRuntime().wrap(function _callee$(_context) {
18451
18460
  while (1) switch (_context.prev = _context.next) {
@@ -18458,7 +18467,10 @@ var createApiInstanceForNode = function createApiInstanceForNode(api, node) {
18458
18467
  }
18459
18468
  }, _callee);
18460
18469
  }));
18461
- };
18470
+ return function createApiInstanceForNode(_x, _x2) {
18471
+ return _ref.apply(this, arguments);
18472
+ };
18473
+ }();
18462
18474
 
18463
18475
  var resolveModuleError = function resolveModuleError(node, error) {
18464
18476
  var palletDetails = getSupportedPalletsDetails(node).find(function (p) {
@@ -18484,7 +18496,6 @@ var resolveModuleError = function resolveModuleError(node, error) {
18484
18496
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
18485
18497
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
18486
18498
  var getMultiLocationTokenId = function getMultiLocationTokenId(location, node) {
18487
- var _a, _b;
18488
18499
  if (location.interior.type === 'Here') {
18489
18500
  // native token
18490
18501
  return getNativeAssetSymbol(node);
@@ -18492,10 +18503,11 @@ var getMultiLocationTokenId = function getMultiLocationTokenId(location, node) {
18492
18503
  var foreignAssets = getOtherAssets(node);
18493
18504
  if (location.interior.type === 'X2') {
18494
18505
  if (location.interior.value[0].type === 'PalletInstance' && location.interior.value[0].value === 50 && location.interior.value[1].type === 'GeneralIndex') {
18506
+ var _foreignAssets$find$a, _foreignAssets$find;
18495
18507
  var assetId = location.interior.value[1].value;
18496
- return (_b = (_a = foreignAssets.find(function (asset) {
18508
+ return (_foreignAssets$find$a = (_foreignAssets$find = foreignAssets.find(function (asset) {
18497
18509
  return asset.assetId === String(assetId);
18498
- })) === null || _a === void 0 ? void 0 : _a.assetId) !== null && _b !== void 0 ? _b : null;
18510
+ })) === null || _foreignAssets$find === void 0 ? void 0 : _foreignAssets$find.assetId) !== null && _foreignAssets$find$a !== void 0 ? _foreignAssets$find$a : null;
18499
18511
  }
18500
18512
  }
18501
18513
  return null;
@@ -18544,7 +18556,7 @@ var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, node, execution
18544
18556
  return df.tokenSymbol === nativeAssetSymbol;
18545
18557
  }).reduce(function (acc, df) {
18546
18558
  return acc + df.plancks;
18547
- }, BigInt(0));
18559
+ }, 0n);
18548
18560
  return totalDeliveryFees + executionFee;
18549
18561
  };
18550
18562
 
@@ -18552,7 +18564,6 @@ var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, node, execution
18552
18564
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
18553
18565
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
18554
18566
  var getMultiLocationTokenIdPjs = function getMultiLocationTokenIdPjs(location, node) {
18555
- var _a, _b;
18556
18567
  if (location.interior === 'Here') {
18557
18568
  // native token
18558
18569
  return getNativeAssetSymbol(node);
@@ -18561,10 +18572,11 @@ var getMultiLocationTokenIdPjs = function getMultiLocationTokenIdPjs(location, n
18561
18572
  if (Object.keys(location.interior)[0] === 'X2') {
18562
18573
  var junctions = Object.values(location.interior)[0];
18563
18574
  if (Object.keys(junctions[0])[0] === 'PalletInstance' && junctions[0].PalletInstance === '50' && Object.keys(junctions[1])[0] === 'GeneralIndex') {
18575
+ var _foreignAssets$find$s, _foreignAssets$find;
18564
18576
  var assetId = junctions[1].GeneralIndex;
18565
- return (_b = (_a = foreignAssets.find(function (asset) {
18577
+ return (_foreignAssets$find$s = (_foreignAssets$find = foreignAssets.find(function (asset) {
18566
18578
  return asset.assetId === String(assetId);
18567
- })) === null || _a === void 0 ? void 0 : _a.symbol) !== null && _b !== void 0 ? _b : null;
18579
+ })) === null || _foreignAssets$find === void 0 ? void 0 : _foreignAssets$find.symbol) !== null && _foreignAssets$find$s !== void 0 ? _foreignAssets$find$s : null;
18568
18580
  }
18569
18581
  }
18570
18582
  return null;
@@ -18613,7 +18625,7 @@ var computeFeeFromDryRunPjs = function computeFeeFromDryRunPjs(dryRun, node, exe
18613
18625
  return df.tokenSymbol === nativeAssetSymbol;
18614
18626
  }).reduce(function (acc, df) {
18615
18627
  return acc + df.plancks;
18616
- }, BigInt(0));
18628
+ }, 0n);
18617
18629
  return totalDeliveryFees + executionFee;
18618
18630
  };
18619
18631
 
@@ -18653,175 +18665,6 @@ var isBridgeTransfer = function isBridgeTransfer(origin, destination) {
18653
18665
  return origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
18654
18666
  };
18655
18667
 
18656
- var KeepAliveError = /*#__PURE__*/function (_Error) {
18657
- function KeepAliveError(message) {
18658
- var _this;
18659
- _classCallCheck(this, KeepAliveError);
18660
- _this = _callSuper(this, KeepAliveError, [message]);
18661
- _this.name = 'KeepAliveError';
18662
- return _this;
18663
- }
18664
- _inherits(KeepAliveError, _Error);
18665
- return _createClass(KeepAliveError);
18666
- }(/*#__PURE__*/_wrapNativeSuper(Error));
18667
-
18668
- var checkKeepAlive = function checkKeepAlive(_a) {
18669
- return __awaiter(void 0, [_a], void 0, function (_ref) {
18670
- var api = _ref.api,
18671
- address = _ref.address,
18672
- origin = _ref.origin,
18673
- destApi = _ref.destApi,
18674
- asset = _ref.asset,
18675
- destination = _ref.destination;
18676
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18677
- var symbol, amount, balance, balanceOrigin, amountBN, ed, edOrigin, oldDisconnectAllowed, tx, xcmFee, increasedFee, amountBNWithoutFee, amountOriginBNWithoutFee;
18678
- return _regeneratorRuntime().wrap(function _callee$(_context) {
18679
- while (1) switch (_context.prev = _context.next) {
18680
- case 0:
18681
- if (!(destApi.getApi() === undefined)) {
18682
- _context.next = 2;
18683
- break;
18684
- }
18685
- return _context.abrupt("return");
18686
- case 2:
18687
- symbol = asset.symbol, amount = asset.amount;
18688
- if (!(symbol !== getAssetsObject(destination).nativeAssetSymbol)) {
18689
- _context.next = 5;
18690
- break;
18691
- }
18692
- throw new KeepAliveError('Keep alive check is only supported when sending native asset of destination parachain.');
18693
- case 5:
18694
- _context.next = 7;
18695
- return destApi.getBalanceNative(address);
18696
- case 7:
18697
- balance = _context.sent;
18698
- _context.next = 10;
18699
- return api.getBalanceNative(address);
18700
- case 10:
18701
- balanceOrigin = _context.sent;
18702
- amountBN = BigInt(amount);
18703
- ed = getExistentialDeposit(destination);
18704
- edOrigin = getExistentialDeposit(origin);
18705
- oldDisconnectAllowed = api.getDisconnectAllowed();
18706
- api.setDisconnectAllowed(false);
18707
- _context.next = 18;
18708
- return Builder(api).from(origin).to(destination).currency({
18709
- symbol: symbol,
18710
- amount: amount
18711
- }).address(address).build();
18712
- case 18:
18713
- tx = _context.sent;
18714
- api.setDisconnectAllowed(oldDisconnectAllowed);
18715
- if (!(tx === null)) {
18716
- _context.next = 22;
18717
- break;
18718
- }
18719
- throw new KeepAliveError('Transaction for XCM fee calculation could not be created.');
18720
- case 22:
18721
- _context.next = 24;
18722
- return api.calculateTransactionFee(tx, address);
18723
- case 24:
18724
- xcmFee = _context.sent;
18725
- if (!(ed === null)) {
18726
- _context.next = 27;
18727
- break;
18728
- }
18729
- throw new KeepAliveError('Existential deposit not found for destination parachain.');
18730
- case 27:
18731
- if (!(edOrigin === null)) {
18732
- _context.next = 29;
18733
- break;
18734
- }
18735
- throw new KeepAliveError('Existential deposit not found for origin parachain.');
18736
- case 29:
18737
- increasedFee = xcmFee + xcmFee / BigInt(2);
18738
- amountBNWithoutFee = amountBN - increasedFee;
18739
- if (!(balance + amountBNWithoutFee < BigInt(ed))) {
18740
- _context.next = 33;
18741
- break;
18742
- }
18743
- throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(symbol, " to ").concat(destination, " would result in an account balance below the required existential deposit.\n Please increase the amount to meet the minimum balance requirement of the destination chain."));
18744
- case 33:
18745
- amountOriginBNWithoutFee = amountBN - (xcmFee + xcmFee / BigInt(2));
18746
- if (!((symbol === 'DOT' || symbol === 'KSM') && balanceOrigin - amountOriginBNWithoutFee > BigInt(edOrigin))) {
18747
- _context.next = 36;
18748
- break;
18749
- }
18750
- throw new KeepAliveError("Keep alive check failed: Sending ".concat(amount, " ").concat(symbol, " to ").concat(destination, " would result in an account balance below the required existential deposit on origin.\n Please decrease the amount to meet the minimum balance requirement of the origin chain."));
18751
- case 36:
18752
- case "end":
18753
- return _context.stop();
18754
- }
18755
- }, _callee);
18756
- })();
18757
- });
18758
- };
18759
-
18760
- var performKeepAliveCheck = function performKeepAliveCheck(options, asset) {
18761
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18762
- var api, origin, destination, currency, address, destApiForKeepAlive, destApi;
18763
- return _regeneratorRuntime().wrap(function _callee$(_context) {
18764
- while (1) switch (_context.prev = _context.next) {
18765
- case 0:
18766
- api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, address = options.address, destApiForKeepAlive = options.destApiForKeepAlive;
18767
- if (!('multilocation' in currency || 'multiasset' in currency)) {
18768
- _context.next = 5;
18769
- break;
18770
- }
18771
- console.warn('Keep alive check is not supported when using MultiLocation / MultiAsset as currency.');
18772
- _context.next = 24;
18773
- break;
18774
- case 5:
18775
- if (!(_typeof(address) === 'object')) {
18776
- _context.next = 9;
18777
- break;
18778
- }
18779
- console.warn('Keep alive check is not supported when using MultiLocation as address.');
18780
- _context.next = 24;
18781
- break;
18782
- case 9:
18783
- if (!(_typeof(destination) === 'object')) {
18784
- _context.next = 13;
18785
- break;
18786
- }
18787
- console.warn('Keep alive check is not supported when using MultiLocation as destination.');
18788
- _context.next = 24;
18789
- break;
18790
- case 13:
18791
- if (!(destination === 'Ethereum')) {
18792
- _context.next = 17;
18793
- break;
18794
- }
18795
- console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
18796
- _context.next = 24;
18797
- break;
18798
- case 17:
18799
- if (asset) {
18800
- _context.next = 21;
18801
- break;
18802
- }
18803
- console.warn('Keep alive check is not supported when asset check is disabled.');
18804
- _context.next = 24;
18805
- break;
18806
- case 21:
18807
- destApi = destApiForKeepAlive !== null && destApiForKeepAlive !== void 0 ? destApiForKeepAlive : api.clone();
18808
- _context.next = 24;
18809
- return checkKeepAlive({
18810
- api: api,
18811
- origin: origin,
18812
- destination: destination,
18813
- address: address,
18814
- destApi: destApi,
18815
- asset: asset
18816
- });
18817
- case 24:
18818
- case "end":
18819
- return _context.stop();
18820
- }
18821
- }, _callee);
18822
- }));
18823
- };
18824
-
18825
18668
  var resolveAsset = function resolveAsset(currency, origin, destination, assetCheckEnabled) {
18826
18669
  return assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, !isTMultiLocation(destination) ? destination : null) : null;
18827
18670
  };
@@ -18886,8 +18729,8 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
18886
18729
  });
18887
18730
  }
18888
18731
  if ('symbol' in currency && nativeAssets.some(function (nativeAsset) {
18889
- var _a;
18890
- return nativeAsset.symbol.toLowerCase() === ((_a = asset === null || asset === void 0 ? void 0 : asset.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase());
18732
+ var _asset$symbol;
18733
+ return nativeAsset.symbol.toLowerCase() === (asset === null || asset === void 0 || (_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase());
18891
18734
  })) {
18892
18735
  throw new InvalidCurrencyError("".concat(JSON.stringify(asset === null || asset === void 0 ? void 0 : asset.symbol), " is not supported for transfers to ").concat(destination, "."));
18893
18736
  }
@@ -18900,82 +18743,56 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
18900
18743
  }
18901
18744
  };
18902
18745
 
18903
- var transferRelayToPara = function transferRelayToPara(options) {
18904
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18905
- var api, origin, destination, asset, address, paraIdTo, destApiForKeepAlive, version, pallet, method, isMultiLocationDestination, isAddressMultiLocation, destApi, serializedApiCall;
18746
+ var transferRelayToPara = /*#__PURE__*/function () {
18747
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
18748
+ var api, origin, destination, asset, address, paraIdTo, version, pallet, method, isMultiLocationDestination, serializedApiCall;
18906
18749
  return _regeneratorRuntime().wrap(function _callee$(_context) {
18907
18750
  while (1) switch (_context.prev = _context.next) {
18908
18751
  case 0:
18909
- api = options.api, origin = options.origin, destination = options.destination, asset = options.asset, address = options.address, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, pallet = options.pallet, method = options.method;
18752
+ api = options.api, origin = options.origin, destination = options.destination, asset = options.asset, address = options.address, paraIdTo = options.paraIdTo, version = options.version, pallet = options.pallet, method = options.method;
18910
18753
  isMultiLocationDestination = _typeof(destination) === 'object';
18911
- isAddressMultiLocation = _typeof(address) === 'object';
18912
18754
  if (!(api.getApiOrUrl() === undefined && isMultiLocationDestination)) {
18913
- _context.next = 5;
18755
+ _context.next = 4;
18914
18756
  break;
18915
18757
  }
18916
18758
  throw new Error('API is required when using MultiLocation as destination.');
18917
- case 5:
18918
- _context.next = 7;
18759
+ case 4:
18760
+ _context.next = 6;
18919
18761
  return api.init(origin);
18920
- case 7:
18921
- _context.prev = 7;
18922
- if (!isMultiLocationDestination) {
18923
- _context.next = 12;
18924
- break;
18925
- }
18926
- console.warn('Keep alive check is not supported when using MultiLocation as destination.');
18927
- _context.next = 19;
18928
- break;
18929
- case 12:
18930
- if (!isAddressMultiLocation) {
18931
- _context.next = 16;
18932
- break;
18933
- }
18934
- console.warn('Keep alive check is not supported when using MultiLocation as address.');
18935
- _context.next = 19;
18936
- break;
18937
- case 16:
18938
- destApi = destApiForKeepAlive !== null && destApiForKeepAlive !== void 0 ? destApiForKeepAlive : api.clone();
18939
- _context.next = 19;
18940
- return checkKeepAlive({
18941
- api: api,
18942
- address: address,
18943
- destApi: destApi,
18944
- asset: asset,
18945
- origin: origin,
18946
- destination: destination
18947
- });
18948
- case 19:
18762
+ case 6:
18763
+ _context.prev = 6;
18949
18764
  serializedApiCall = getNode(isMultiLocationDestination ? resolveTNodeFromMultiLocation(origin, destination) : destination).transferRelayToPara({
18950
18765
  api: api,
18951
18766
  origin: origin,
18952
18767
  destination: destination,
18953
18768
  address: address,
18954
18769
  paraIdTo: paraIdTo,
18955
- destApiForKeepAlive: destApiForKeepAlive,
18956
18770
  asset: asset,
18957
18771
  version: version,
18958
18772
  pallet: pallet,
18959
18773
  method: method
18960
18774
  });
18961
18775
  return _context.abrupt("return", api.callTxMethod(serializedApiCall));
18962
- case 21:
18963
- _context.prev = 21;
18776
+ case 9:
18777
+ _context.prev = 9;
18964
18778
  if (!isPjsClient(api.getApi())) {
18965
- _context.next = 25;
18779
+ _context.next = 13;
18966
18780
  break;
18967
18781
  }
18968
- _context.next = 25;
18782
+ _context.next = 13;
18969
18783
  return api.disconnect();
18970
- case 25:
18971
- return _context.finish(21);
18972
- case 26:
18784
+ case 13:
18785
+ return _context.finish(9);
18786
+ case 14:
18973
18787
  case "end":
18974
18788
  return _context.stop();
18975
18789
  }
18976
- }, _callee, null, [[7,, 21, 26]]);
18790
+ }, _callee, null, [[6,, 9, 14]]);
18977
18791
  }));
18978
- };
18792
+ return function transferRelayToPara(_x) {
18793
+ return _ref.apply(this, arguments);
18794
+ };
18795
+ }();
18979
18796
 
18980
18797
  var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge, assetCheckEnabled) {
18981
18798
  var currency = options.currency,
@@ -18992,7 +18809,7 @@ var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge,
18992
18809
  }
18993
18810
  // MultiAsset is an array of TCurrencyCore, search for assets
18994
18811
  var assets = currency.multiasset.map(function (currency) {
18995
- var _a;
18812
+ var _currency$isFeeAsset;
18996
18813
  var asset = getAssetBySymbolOrId(origin, currency, !isTMultiLocation(destination) ? destination : null);
18997
18814
  if (asset && (!isForeignAsset(asset) || !asset.multiLocation)) {
18998
18815
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency), " does not have a multiLocation"));
@@ -19000,8 +18817,8 @@ var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge,
19000
18817
  validateAssetSupport(options, assetCheckEnabled, isBridge, asset);
19001
18818
  var originTyped = origin;
19002
18819
  var originNode = getNode(originTyped);
19003
- return Object.assign({
19004
- isFeeAsset: (_a = currency.isFeeAsset) !== null && _a !== void 0 ? _a : false
18820
+ return _objectSpread2({
18821
+ isFeeAsset: (_currency$isFeeAsset = currency.isFeeAsset) !== null && _currency$isFeeAsset !== void 0 ? _currency$isFeeAsset : false
19005
18822
  }, createMultiAsset(originNode.version, currency.amount, asset === null || asset === void 0 ? void 0 : asset.multiLocation));
19006
18823
  });
19007
18824
  return assets;
@@ -19009,13 +18826,13 @@ var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge,
19009
18826
  return undefined;
19010
18827
  };
19011
18828
 
19012
- var send = function send(options) {
19013
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
19014
- var api, origin, currency, address, destination, paraIdTo, destApiForKeepAlive, version, ahAddress, pallet, method, isBridge, assetCheckEnabled, asset, overriddenAsset, resolvedAsset, originNode;
18829
+ var send = /*#__PURE__*/function () {
18830
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
18831
+ var api, origin, currency, address, destination, paraIdTo, version, ahAddress, pallet, method, isBridge, assetCheckEnabled, asset, overriddenAsset, resolvedAsset, originNode;
19015
18832
  return _regeneratorRuntime().wrap(function _callee$(_context) {
19016
18833
  while (1) switch (_context.prev = _context.next) {
19017
18834
  case 0:
19018
- api = options.api, origin = options.origin, currency = options.currency, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, version = options.version, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
18835
+ api = options.api, origin = options.origin, currency = options.currency, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, version = options.version, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
19019
18836
  validateCurrency(currency);
19020
18837
  validateDestination(origin, destination);
19021
18838
  validateDestinationAddress(address, destination);
@@ -19051,11 +18868,10 @@ var send = function send(options) {
19051
18868
  origin: origin,
19052
18869
  destination: destination,
19053
18870
  address: address,
19054
- asset: Object.assign(Object.assign({}, asset), {
18871
+ asset: _objectSpread2(_objectSpread2({}, asset), {}, {
19055
18872
  amount: 'multiasset' in currency ? 0 : currency.amount
19056
18873
  }),
19057
18874
  paraIdTo: paraIdTo,
19058
- destApiForKeepAlive: destApiForKeepAlive,
19059
18875
  version: version,
19060
18876
  pallet: pallet,
19061
18877
  method: method
@@ -19066,20 +18882,15 @@ var send = function send(options) {
19066
18882
  return api.init(origin);
19067
18883
  case 20:
19068
18884
  _context.prev = 20;
19069
- _context.next = 23;
19070
- return performKeepAliveCheck(options, asset ? Object.assign(Object.assign({}, asset), {
19071
- amount: 'multiasset' in currency ? 0 : currency.amount
19072
- }) : null);
19073
- case 23:
19074
18885
  // In case asset check is disabled, we create asset object from currency symbol
19075
18886
  resolvedAsset = asset !== null && asset !== void 0 ? asset : {
19076
18887
  symbol: 'symbol' in currency ? currency.symbol : undefined
19077
18888
  };
19078
18889
  originNode = getNode(origin);
19079
- _context.next = 27;
18890
+ _context.next = 25;
19080
18891
  return originNode.transfer({
19081
18892
  api: api,
19082
- asset: Object.assign(Object.assign({}, resolvedAsset), {
18893
+ asset: _objectSpread2(_objectSpread2({}, resolvedAsset), {}, {
19083
18894
  amount: 'multiasset' in currency ? 0 : currency.amount
19084
18895
  }),
19085
18896
  address: address,
@@ -19087,33 +18898,35 @@ var send = function send(options) {
19087
18898
  paraIdTo: paraIdTo,
19088
18899
  overriddenAsset: overriddenAsset,
19089
18900
  version: version,
19090
- destApiForKeepAlive: destApiForKeepAlive,
19091
18901
  ahAddress: ahAddress,
19092
18902
  pallet: pallet,
19093
18903
  method: method
19094
18904
  });
19095
- case 27:
18905
+ case 25:
19096
18906
  return _context.abrupt("return", _context.sent);
19097
- case 28:
19098
- _context.prev = 28;
18907
+ case 26:
18908
+ _context.prev = 26;
19099
18909
  if (!isPjsClient(api.getApi())) {
19100
- _context.next = 32;
18910
+ _context.next = 30;
19101
18911
  break;
19102
18912
  }
19103
- _context.next = 32;
18913
+ _context.next = 30;
19104
18914
  return api.disconnect();
19105
- case 32:
19106
- return _context.finish(28);
19107
- case 33:
18915
+ case 30:
18916
+ return _context.finish(26);
18917
+ case 31:
19108
18918
  case "end":
19109
18919
  return _context.stop();
19110
18920
  }
19111
- }, _callee, null, [[20,, 28, 33]]);
18921
+ }, _callee, null, [[20,, 26, 31]]);
19112
18922
  }));
19113
- };
18923
+ return function send(_x) {
18924
+ return _ref.apply(this, arguments);
18925
+ };
18926
+ }();
19114
18927
 
19115
- var getDryRun = function getDryRun(options) {
19116
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
18928
+ var getDryRun = /*#__PURE__*/function () {
18929
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
19117
18930
  var api, node;
19118
18931
  return _regeneratorRuntime().wrap(function _callee$(_context) {
19119
18932
  while (1) switch (_context.prev = _context.next) {
@@ -19145,7 +18958,10 @@ var getDryRun = function getDryRun(options) {
19145
18958
  }
19146
18959
  }, _callee, null, [[5,, 9, 13]]);
19147
18960
  }));
19148
- };
18961
+ return function getDryRun(_x) {
18962
+ return _ref.apply(this, arguments);
18963
+ };
18964
+ }();
19149
18965
 
19150
18966
  var isEthersSigner = function isEthersSigner(signer) {
19151
18967
  return _typeof(signer) === 'object' && signer !== null && 'provider' in signer;
@@ -19176,7 +18992,7 @@ var getDestinationMultilocation = function getDestinationMultilocation(api, addr
19176
18992
  var acc = "0x".concat(accountType).concat(addressHex, "00");
19177
18993
  var _getNodeConfig = getNodeConfig(destination),
19178
18994
  paraId = _getNodeConfig.paraId;
19179
- return [1, ["0x0000000".concat(paraId.toString(16)), acc]];
18995
+ return [1, paraId ? ["0x0000000".concat(paraId.toString(16)), acc] : [acc]];
19180
18996
  };
19181
18997
 
19182
18998
  var abi = [
@@ -19276,106 +19092,107 @@ var abi = [
19276
19092
  }
19277
19093
  ];
19278
19094
 
19279
- var U_64_MAX = BigInt('18446744073709551615');
19095
+ var U_64_MAX = 18446744073709551615n;
19280
19096
  var CONTRACT_ADDRESS = '0x0000000000000000000000000000000000000804';
19281
19097
  var NATIVE_ASSET_ID = '0x0000000000000000000000000000000000000802';
19282
19098
  // Partially inspired by Moonbeam XCM-SDK
19283
- var transferMoonbeamEvm = function transferMoonbeamEvm(_a) {
19284
- return __awaiter(void 0, [_a], void 0, function (_ref) {
19285
- var api = _ref.api,
19286
- from = _ref.from,
19287
- to = _ref.to,
19288
- signer = _ref.signer,
19289
- address = _ref.address,
19290
- currency = _ref.currency;
19291
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
19292
- var _b, contract, foundAsset, asset, destMultiLocation, weight, createTx, multiCurrencySymbols, useMultiAssets, usdtAsset, tx;
19293
- return _regeneratorRuntime().wrap(function _callee$(_context) {
19294
- while (1) switch (_context.prev = _context.next) {
19295
- case 0:
19296
- contract = isEthersSigner(signer) ? new Contract(CONTRACT_ADDRESS, abi, signer) : getContract({
19297
- abi: abi,
19298
- address: CONTRACT_ADDRESS,
19299
- client: {
19300
- "public": createPublicClient({
19301
- chain: signer.chain,
19302
- transport: http()
19303
- }),
19304
- wallet: signer
19305
- }
19306
- });
19307
- foundAsset = getAssetBySymbolOrId(from, currency, to);
19308
- if (!(foundAsset === null)) {
19309
- _context.next = 4;
19310
- break;
19311
- }
19312
- throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
19313
- case 4:
19314
- if (!(foundAsset.symbol === getNativeAssetSymbol(from))) {
19315
- _context.next = 8;
19316
- break;
19317
- }
19318
- asset = NATIVE_ASSET_ID;
19319
- _context.next = 11;
19099
+ var transferMoonbeamEvm = /*#__PURE__*/function () {
19100
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
19101
+ var _usdtAsset$assetId;
19102
+ var api, from, to, signer, address, currency, contract, foundAsset, asset, destMultiLocation, weight, createTx, multiCurrencySymbols, useMultiAssets, usdtAsset, tx;
19103
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
19104
+ while (1) switch (_context.prev = _context.next) {
19105
+ case 0:
19106
+ api = _ref.api, from = _ref.from, to = _ref.to, signer = _ref.signer, address = _ref.address, currency = _ref.currency;
19107
+ if (!('multiasset' in currency)) {
19108
+ _context.next = 3;
19320
19109
  break;
19321
- case 8:
19322
- if (!(!isForeignAsset(foundAsset) || !foundAsset.assetId)) {
19323
- _context.next = 10;
19324
- break;
19110
+ }
19111
+ throw new Error('Multiassets syntax is not supported for Evm transfers');
19112
+ case 3:
19113
+ if (!('multilocation' in currency && isOverrideMultiLocationSpecifier(currency.multilocation))) {
19114
+ _context.next = 5;
19115
+ break;
19116
+ }
19117
+ throw new Error('Override multilocation is not supported for Evm transfers');
19118
+ case 5:
19119
+ contract = isEthersSigner(signer) ? new Contract(CONTRACT_ADDRESS, abi, signer) : getContract({
19120
+ abi: abi,
19121
+ address: CONTRACT_ADDRESS,
19122
+ client: {
19123
+ "public": createPublicClient({
19124
+ chain: signer.chain,
19125
+ transport: http()
19126
+ }),
19127
+ wallet: signer
19325
19128
  }
19326
- throw new InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
19327
- case 10:
19328
- asset = formatAssetIdToERC20(foundAsset.assetId);
19329
- case 11:
19330
- destMultiLocation = getDestinationMultilocation(api, address, to);
19331
- weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
19332
- // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
19333
- createTx = function createTx(func, args) {
19334
- if (isEthersContract(contract)) {
19335
- return contract[func].apply(contract, _toConsumableArray(args));
19336
- }
19337
- return contract.write[func](args);
19338
- };
19339
- multiCurrencySymbols = ['xcPINK', 'xcDED', 'xcSTINK', 'xcWIFD', 'xcNCTR'];
19340
- useMultiAssets = from === 'Moonbeam' && to === 'AssetHubPolkadot' && multiCurrencySymbols.includes(foundAsset.symbol);
19341
- usdtAsset = getAssetBySymbolOrId(from, {
19342
- symbol: 'xcUSDT'
19343
- }, to);
19344
- if (!useMultiAssets) {
19345
- _context.next = 23;
19346
- break;
19129
+ });
19130
+ foundAsset = getAssetBySymbolOrId(from, currency, to);
19131
+ if (!(foundAsset === null)) {
19132
+ _context.next = 9;
19133
+ break;
19134
+ }
19135
+ throw new InvalidCurrencyError("Origin node ".concat(from, " does not support currency ").concat(JSON.stringify(currency), "."));
19136
+ case 9:
19137
+ if (!(foundAsset.symbol === getNativeAssetSymbol(from))) {
19138
+ _context.next = 13;
19139
+ break;
19140
+ }
19141
+ asset = NATIVE_ASSET_ID;
19142
+ _context.next = 16;
19143
+ break;
19144
+ case 13:
19145
+ if (!(!isForeignAsset(foundAsset) || !foundAsset.assetId)) {
19146
+ _context.next = 15;
19147
+ break;
19148
+ }
19149
+ throw new InvalidCurrencyError('Currency must be a foreign asset with valid assetId');
19150
+ case 15:
19151
+ asset = formatAssetIdToERC20(foundAsset.assetId);
19152
+ case 16:
19153
+ destMultiLocation = getDestinationMultilocation(api, address, to);
19154
+ weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
19155
+ // https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
19156
+ createTx = function createTx(func, args) {
19157
+ if (isEthersContract(contract)) {
19158
+ return contract[func].apply(contract, _toConsumableArray(args));
19347
19159
  }
19348
- _context.next = 20;
19349
- return createTx('transferMultiCurrencies', [[[asset, currency.amount], [formatAssetIdToERC20((_b = usdtAsset.assetId) !== null && _b !== void 0 ? _b : ''), '200000']], 1,
19350
- // index of the fee asset
19351
- destMultiLocation, weight]);
19352
- case 20:
19353
- _context.t0 = _context.sent;
19354
- _context.next = 26;
19160
+ return contract.write[func](args);
19161
+ };
19162
+ multiCurrencySymbols = ['xcPINK', 'xcDED', 'xcSTINK', 'xcWIFD', 'xcNCTR'];
19163
+ useMultiAssets = from === 'Moonbeam' && to === 'AssetHubPolkadot' && multiCurrencySymbols.includes(foundAsset.symbol);
19164
+ usdtAsset = getAssetBySymbolOrId(from, {
19165
+ symbol: 'xcUSDT'
19166
+ }, to);
19167
+ if (!useMultiAssets) {
19168
+ _context.next = 28;
19355
19169
  break;
19356
- case 23:
19357
- _context.next = 25;
19358
- return createTx('transfer', [asset, currency.amount, destMultiLocation, weight]);
19359
- case 25:
19360
- _context.t0 = _context.sent;
19361
- case 26:
19362
- tx = _context.t0;
19363
- return _context.abrupt("return", _typeof(tx) === 'object' ? tx.hash : tx);
19364
- case 28:
19365
- case "end":
19366
- return _context.stop();
19367
- }
19368
- }, _callee);
19369
- })();
19370
- });
19371
- };
19372
-
19373
- var index = /*#__PURE__*/Object.freeze({
19374
- __proto__: null,
19375
- getDryRun: getDryRun,
19376
- send: send,
19377
- transferMoonbeamEvm: transferMoonbeamEvm,
19378
- transferRelayToPara: transferRelayToPara
19379
- });
19170
+ }
19171
+ _context.next = 25;
19172
+ return createTx('transferMultiCurrencies', [[[asset, currency.amount], [formatAssetIdToERC20((_usdtAsset$assetId = usdtAsset.assetId) !== null && _usdtAsset$assetId !== void 0 ? _usdtAsset$assetId : ''), '200000']], 1,
19173
+ // index of the fee asset
19174
+ destMultiLocation, weight]);
19175
+ case 25:
19176
+ _context.t0 = _context.sent;
19177
+ _context.next = 31;
19178
+ break;
19179
+ case 28:
19180
+ _context.next = 30;
19181
+ return createTx('transfer', [asset, currency.amount, destMultiLocation, weight]);
19182
+ case 30:
19183
+ _context.t0 = _context.sent;
19184
+ case 31:
19185
+ tx = _context.t0;
19186
+ return _context.abrupt("return", _typeof(tx) === 'object' ? tx.hash : tx);
19187
+ case 33:
19188
+ case "end":
19189
+ return _context.stop();
19190
+ }
19191
+ }, _callee);
19192
+ }));
19193
+ return function transferMoonbeamEvm(_x) {
19194
+ return _ref2.apply(this, arguments);
19195
+ };
19196
+ }();
19380
19197
 
19381
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, XTokensError, index$1 as assets, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, _deepEqual as deepEqual, determineRelayChain, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isRelayChain, resolveModuleError, send, transferMoonbeamEvm, transferRelayToPara, index as xcmPallet };
19198
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, GeneralBuilder, IncompatibleNodesError, InvalidAddressError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, Native, NoXCMSupportImplementedError, NodeNotSupportedError, Override, Parents, PolkadotXcmError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, XTokensError, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, createApiInstanceForNode, createX1Payload, _deepEqual as deepEqual, determineRelayChain, generateAddressMultiLocationV4, generateAddressPayload, getAllAssetsSymbols, getAssetBalance, getAssetBalanceInternal, getAssetBySymbolOrId, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getDefaultPallet, getDryRun, getExistentialDeposit, getFees, getMaxForeignTransferableAmount, getMaxNativeTransferableAmount, getNativeAssetSymbol, getNativeAssets, getNode, getNodeConfig, getNodeProviders, getOriginFeeDetails, getOriginFeeDetailsInternal, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getSupportedPalletsDetails, getTNode, getTransferInfo, getTransferableAmount, hasSupportForAsset, isForeignAsset, isNodeEvm, isOverrideMultiLocationSpecifier, isRelayChain, resolveModuleError, send, transferMoonbeamEvm, transferRelayToPara };