@paraspell/sdk-core 13.4.0 → 13.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +1396 -1347
  2. package/dist/index.mjs +652 -747
  3. package/package.json +14 -14
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { blake2b } from '@noble/hashes/blake2.js';
2
- import { isChainEvm, getAssetsObject, InvalidCurrencyError, extractAssetLocation, isTAsset, findAssetInfoOrThrow, findNativeAssetInfoOrThrow, findAssetInfo, findAssetOnDestOrThrow, findAssetInfoOnDest, isAssetEqual, isStableCoinAsset, isBridgedSystemAsset, isOverrideLocationSpecifier, getRelayChainSymbol, isSymbolSpecifier, normalizeLocation, getNativeAssetSymbol, getExistentialDepositOrThrow, isSymbolMatch, getEdFromAssetOrThrow, hasDryRunSupport, findNativeAssetInfo, isAssetXcEqual, normalizeSymbol, Native, hasXcmPaymentApiSupport, getOtherAssets } from '@paraspell/assets';
2
+ import { isChainEvm, getAssetsObject, InvalidCurrencyError, isOverrideLocationSpecifier, extractAssetLocation, isTAsset, findAssetInfoOrThrow, findNativeAssetInfoOrThrow, findAssetInfo, findAssetOnDestOrThrow, findAssetInfoOnDest, isAssetEqual, isStableCoinAsset, isBridgedSystemAsset, isSymbolSpecifier, getRelayChainSymbol, normalizeLocation, getNativeAssetSymbol, getEdFromAssetOrThrow, isSymbolMatch, getExistentialDepositOrThrow, hasDryRunSupport, findNativeAssetInfo, isAssetXcEqual, normalizeSymbol, Native, hasXcmPaymentApiSupport, getOtherAssets } from '@paraspell/assets';
3
3
  export * from '@paraspell/assets';
4
4
  import { base58 } from '@scure/base';
5
- import { isAddress, isHex, pad, toHex, getAddress, concat, keccak256, createPublicClient, http, getContract, parseUnits as parseUnits$1, formatUnits as formatUnits$1 } from 'viem';
6
- import { Version, isTLocation, replaceBigInt, isExternalChain, hasJunction, getJunctionValue, isRelayChain, deepEqual, Parents, isSnowbridge, isBridge, isSubstrateBridge, PARACHAINS, RELAYCHAINS, isTrustedChain } from '@paraspell/sdk-common';
5
+ import { isAddress, isHex, pad, toHex, getAddress, concat, keccak256, createPublicClient, http, getContract, formatUnits as formatUnits$1, parseUnits as parseUnits$1 } from 'viem';
6
+ import { Version, isTLocation, replaceBigInt, isExternalChain, getJunctionValue, isRelayChain, deepEqual, Parents, hasJunction, isSnowbridge, isBridge, isSubstrateBridge, PARACHAINS, RELAYCHAINS, isTrustedChain } from '@paraspell/sdk-common';
7
7
  export * from '@paraspell/sdk-common';
8
8
  import { getSupportedPallets, getNativeAssetsPallet, getOtherAssetsPallets, getXcmPallet, getSupportedPalletsDetails, hasPallet } from '@paraspell/pallets';
9
9
  export * from '@paraspell/pallets';
@@ -505,14 +505,18 @@ var DryRunFailedError = /*#__PURE__*/function (_Error) {
505
505
  *
506
506
  * @param reason - The reason why the dry run failed.
507
507
  * @param dryRunType - Optional. Specifies if the error is related to the 'origin' or 'destination' dry run.
508
+ * @param prefix - Optional. A short sentence prepended to the message
508
509
  */
509
- function DryRunFailedError(reason, dryRunType) {
510
+ function DryRunFailedError(reason, dryRunType, prefix) {
510
511
  var _this;
511
512
  _classCallCheck(this, DryRunFailedError);
512
513
  var message = "Dry run failed: ".concat(reason);
513
514
  if (dryRunType) {
514
515
  message = "Dry run on ".concat(dryRunType, " failed: ").concat(reason);
515
516
  }
517
+ if (prefix) {
518
+ message = "".concat(prefix, " ").concat(message);
519
+ }
516
520
  _this = _callSuper(this, DryRunFailedError, [message]);
517
521
  _this.name = 'DryRunFailedError';
518
522
  _this.reason = reason;
@@ -961,20 +965,29 @@ var createClientPoolHelpers = function createClientPoolHelpers(clientPool, creat
961
965
  };
962
966
  };
963
967
 
964
- // PayFees instruction is removed temporarily in favor of BuyExecution everywhere,
965
- // but we keep this function for now in case we need to add it back in the future
966
- var createPayFees = function createPayFees(_version, asset, weight) {
968
+ var createPayFees = function createPayFees(version, asset, weight) {
969
+ var includeRefundSurplus = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
970
+ var forceBuyExecution = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
971
+ if (forceBuyExecution || version < Version.V5) {
972
+ return [{
973
+ BuyExecution: {
974
+ fees: asset,
975
+ weight_limit: weight ? {
976
+ Limited: {
977
+ ref_time: weight.refTime,
978
+ proof_size: weight.proofSize
979
+ }
980
+ } : 'Unlimited'
981
+ }
982
+ }];
983
+ }
967
984
  return [{
968
- BuyExecution: {
969
- fees: asset,
970
- weight_limit: weight ? {
971
- Limited: {
972
- ref_time: weight.refTime,
973
- proof_size: weight.proofSize
974
- }
975
- } : 'Unlimited'
985
+ PayFees: {
986
+ asset: asset
976
987
  }
977
- }];
988
+ }].concat(_toConsumableArray(includeRefundSurplus ? [{
989
+ RefundSurplus: undefined
990
+ }] : []));
978
991
  };
979
992
 
980
993
  var resolveTx = /*#__PURE__*/function () {
@@ -1138,11 +1151,28 @@ var assertSender = function assertSender(address) {
1138
1151
  throw new MissingParameterError('sender');
1139
1152
  }
1140
1153
  };
1154
+ var assertEvmAddress = function assertEvmAddress(address) {
1155
+ if (!isAddress(address)) {
1156
+ throw new InvalidAddressError(address);
1157
+ }
1158
+ };
1141
1159
  var assertHasId = function assertHasId(asset) {
1142
1160
  if (asset.assetId === undefined) {
1143
1161
  throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " has no assetId"));
1144
1162
  }
1145
1163
  };
1164
+ var assertCurrencyCore = function assertCurrencyCore(value) {
1165
+ if (value === undefined) return;
1166
+ if (value === null) {
1167
+ throw new InvalidCurrencyError('A currency selector is required.');
1168
+ }
1169
+ if (Array.isArray(value)) {
1170
+ throw new InvalidCurrencyError('Multi-asset currency input is not supported here. Provide a single currency selector ({ symbol }, { id }, or { location }).');
1171
+ }
1172
+ if (_typeof(value) === 'object' && 'location' in value && isOverrideLocationSpecifier(value.location)) {
1173
+ throw new InvalidCurrencyError('Override location specifier is not supported here. Provide a regular location.');
1174
+ }
1175
+ };
1146
1176
  var assertSenderSource = function assertSenderSource(sender) {
1147
1177
  if (sender === undefined) {
1148
1178
  throw new InvalidAddressError('Sender address needs to be a derivation path or signer to sign and submit transaction using this method.');
@@ -1177,7 +1207,12 @@ var assertExtensionInstalled = function assertExtensionInstalled(extension, exte
1177
1207
  };
1178
1208
 
1179
1209
  var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
1180
- var hasGlobalConsensusJunction = hasJunction(assetLocation, 'GlobalConsensus');
1210
+ var resolveExternalReserve = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1211
+ var globalConsensus = getJunctionValue(assetLocation, 'GlobalConsensus');
1212
+ if (resolveExternalReserve && globalConsensus && 'Ethereum' in globalConsensus) {
1213
+ var _relaychain = getRelayChainOf(chain);
1214
+ return _relaychain === 'Westend' || _relaychain === 'Paseo' ? 'EthereumTestnet' : 'Ethereum';
1215
+ }
1181
1216
  var paraId = getJunctionValue(assetLocation, 'Parachain');
1182
1217
  if (paraId) {
1183
1218
  var resolvedChain = getTChain(paraId, getRelayChainOf(chain));
@@ -1189,7 +1224,7 @@ var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
1189
1224
  if (isRelayChain(chain)) return chain;
1190
1225
  var relaychain = getRelayChainOf(chain);
1191
1226
  var ahChain = "AssetHub".concat(relaychain);
1192
- if (hasGlobalConsensusJunction) {
1227
+ if (globalConsensus) {
1193
1228
  return ahChain;
1194
1229
  }
1195
1230
  if (deepEqual(assetLocation, {
@@ -1492,14 +1527,6 @@ var Acala$1 = {
1492
1527
  {
1493
1528
  name: "Dwellir",
1494
1529
  endpoint: "wss://acala-rpc.n.dwellir.com"
1495
- },
1496
- {
1497
- name: "IBP1",
1498
- endpoint: "wss://acala.ibp.network"
1499
- },
1500
- {
1501
- name: "IBP2",
1502
- endpoint: "wss://acala.dotters.network"
1503
1530
  }
1504
1531
  ]
1505
1532
  };
@@ -1511,14 +1538,6 @@ var Ajuna$1 = {
1511
1538
  {
1512
1539
  name: "AjunaNetwork",
1513
1540
  endpoint: "wss://rpc-para.ajuna.network"
1514
- },
1515
- {
1516
- name: "IBP1",
1517
- endpoint: "wss://ajuna.ibp.network"
1518
- },
1519
- {
1520
- name: "IBP2",
1521
- endpoint: "wss://ajuna.dotters.network"
1522
1541
  }
1523
1542
  ]
1524
1543
  };
@@ -1550,14 +1569,6 @@ var BifrostPolkadot$1 = {
1550
1569
  info: "bifrost",
1551
1570
  paraId: 2030,
1552
1571
  providers: [
1553
- {
1554
- name: "IBP1",
1555
- endpoint: "wss://bifrost-polkadot.ibp.network"
1556
- },
1557
- {
1558
- name: "IBP2",
1559
- endpoint: "wss://bifrost-polkadot.dotters.network"
1560
- },
1561
1572
  {
1562
1573
  name: "Liebi",
1563
1574
  endpoint: "wss://hk.p.bifrost-rpc.liebi.com/ws"
@@ -1722,12 +1733,8 @@ var Moonbeam$1 = {
1722
1733
  endpoint: "wss://moonbeam-rpc.publicnode.com"
1723
1734
  },
1724
1735
  {
1725
- name: "IBP1",
1726
- endpoint: "wss://moonbeam.ibp.network"
1727
- },
1728
- {
1729
- name: "IBP2",
1730
- endpoint: "wss://moonbeam.dotters.network"
1736
+ name: "Dwellir",
1737
+ endpoint: "wss://moonbeam-rpc.n.dwellir.com"
1731
1738
  },
1732
1739
  {
1733
1740
  name: "Moonbeam Foundation",
@@ -1737,10 +1744,6 @@ var Moonbeam$1 = {
1737
1744
  name: "OnFinality",
1738
1745
  endpoint: "wss://moonbeam.api.onfinality.io/public-ws"
1739
1746
  },
1740
- {
1741
- name: "RadiumBlock",
1742
- endpoint: "wss://moonbeam.public.curie.radiumblock.co/ws"
1743
- },
1744
1747
  {
1745
1748
  name: "UnitedBloc",
1746
1749
  endpoint: "wss://moonbeam.unitedbloc.com"
@@ -1844,17 +1847,6 @@ var Crust$1 = {
1844
1847
  }
1845
1848
  ]
1846
1849
  };
1847
- var Manta$1 = {
1848
- name: "Manta",
1849
- info: "manta",
1850
- paraId: 2104,
1851
- providers: [
1852
- {
1853
- name: "Manta Network",
1854
- endpoint: "wss://ws.manta.systems"
1855
- }
1856
- ]
1857
- };
1858
1850
  var NeuroWeb$1 = {
1859
1851
  name: "NeuroWeb",
1860
1852
  info: "neuroweb",
@@ -1883,8 +1875,8 @@ var Mythos$1 = {
1883
1875
  paraId: 3369,
1884
1876
  providers: [
1885
1877
  {
1886
- name: "parity",
1887
- endpoint: "wss://polkadot-mythos-rpc.polkadot.io"
1878
+ name: "dmarket",
1879
+ endpoint: "wss://mythos-rpc.dmarket.com/"
1888
1880
  }
1889
1881
  ]
1890
1882
  };
@@ -1942,14 +1934,6 @@ var Unique$1 = {
1942
1934
  {
1943
1935
  name: "Geo Load Balancer",
1944
1936
  endpoint: "wss://ws.unique.network"
1945
- },
1946
- {
1947
- name: "IBP1",
1948
- endpoint: "wss://unique.ibp.network"
1949
- },
1950
- {
1951
- name: "IBP2",
1952
- endpoint: "wss://unique.dotters.network"
1953
1937
  }
1954
1938
  ]
1955
1939
  };
@@ -2105,6 +2089,10 @@ var Moonriver$1 = {
2105
2089
  name: "Allnodes",
2106
2090
  endpoint: "wss://moonriver-rpc.publicnode.com"
2107
2091
  },
2092
+ {
2093
+ name: "Dwellir",
2094
+ endpoint: "wss://moonriver-rpc.n.dwellir.com"
2095
+ },
2108
2096
  {
2109
2097
  name: "Moonbeam Foundation",
2110
2098
  endpoint: "wss://wss.api.moonriver.moonbeam.network"
@@ -2113,10 +2101,6 @@ var Moonriver$1 = {
2113
2101
  name: "OnFinality",
2114
2102
  endpoint: "wss://moonriver.api.onfinality.io/public-ws"
2115
2103
  },
2116
- {
2117
- name: "RadiumBlock",
2118
- endpoint: "wss://moonriver.public.curie.radiumblock.co/ws"
2119
- },
2120
2104
  {
2121
2105
  name: "UnitedBloc",
2122
2106
  endpoint: "wss://moonriver.unitedbloc.com"
@@ -2742,7 +2726,7 @@ var Westend$1 = {
2742
2726
  },
2743
2727
  {
2744
2728
  name: "RadiumBlock",
2745
- endpoint: "wss://westend.public.curie.radiumblock.co/ws"
2729
+ endpoint: "wss://rpc.public.curie.radiumblock.xyz/ws-westend"
2746
2730
  }
2747
2731
  ]
2748
2732
  };
@@ -2787,7 +2771,6 @@ var configs = {
2787
2771
  CoretimePolkadot: CoretimePolkadot$1,
2788
2772
  Collectives: Collectives$1,
2789
2773
  Crust: Crust$1,
2790
- Manta: Manta$1,
2791
2774
  NeuroWeb: NeuroWeb$1,
2792
2775
  Pendulum: Pendulum$1,
2793
2776
  Mythos: Mythos$1,
@@ -2920,7 +2903,7 @@ var resolveHopAsset = function resolveHopAsset(_ref) {
2920
2903
 
2921
2904
  var getEthereumJunction = function getEthereumJunction(chain) {
2922
2905
  var useBigInt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2923
- var relayChain = getRelayChainOf(chain);
2906
+ var relayChain = !isExternalChain(chain) ? getRelayChainOf(chain) : undefined;
2924
2907
  var isTestnet = relayChain === 'Westend' || relayChain === 'Paseo';
2925
2908
  var chainId = isTestnet ? ETH_TESTNET_PARA_ID : ETH_MAINNET_PARA_ID;
2926
2909
  return {
@@ -3630,6 +3613,7 @@ var normalizeAmountAll = /*#__PURE__*/function () {
3630
3613
  buildTx = builderWithMinAmount['createTxFactory']();
3631
3614
  assertToIsString(options.to);
3632
3615
  assertSender(options.sender);
3616
+ assertCurrencyCore(currency);
3633
3617
  if (!swapOptions) {
3634
3618
  _context.n = 3;
3635
3619
  break;
@@ -4118,6 +4102,31 @@ var GeneralBuilder = /*#__PURE__*/function () {
4118
4102
  }
4119
4103
  return build;
4120
4104
  }()
4105
+ /**
4106
+ * Builds an unsigned EIP-1559 transaction (viem `TransactionSerializableEIP1559`) for an
4107
+ * EVM-compatible origin. `nonce`, `gas`, and fees are populated from the origin chain's RPC.
4108
+ */
4109
+ )
4110
+ }, {
4111
+ key: "buildEvm",
4112
+ value: (function () {
4113
+ var _buildEvm = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
4114
+ var _this$prepareEvmDispa, ext, options;
4115
+ return _regenerator().w(function (_context4) {
4116
+ while (1) switch (_context4.n) {
4117
+ case 0:
4118
+ _this$prepareEvmDispa = this.prepareEvmDispatch(), ext = _this$prepareEvmDispa.ext, options = _this$prepareEvmDispa.options;
4119
+ return _context4.a(2, ext.buildTransfer(_objectSpread2(_objectSpread2({}, options), {}, {
4120
+ sender: this._options.sender
4121
+ })));
4122
+ }
4123
+ }, _callee4, this);
4124
+ }));
4125
+ function buildEvm() {
4126
+ return _buildEvm.apply(this, arguments);
4127
+ }
4128
+ return buildEvm;
4129
+ }()
4121
4130
  /**
4122
4131
  * Builds and returns multiple transfer or swap extrinsics
4123
4132
  *
@@ -4127,21 +4136,21 @@ var GeneralBuilder = /*#__PURE__*/function () {
4127
4136
  }, {
4128
4137
  key: "buildAll",
4129
4138
  value: (function () {
4130
- var _buildAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
4139
+ var _buildAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
4131
4140
  var _this$_options4, from, senderSource, _yield$this$buildComm2, txContexts;
4132
- return _regenerator().w(function (_context4) {
4133
- while (1) switch (_context4.n) {
4141
+ return _regenerator().w(function (_context5) {
4142
+ while (1) switch (_context5.n) {
4134
4143
  case 0:
4135
4144
  _this$_options4 = this._options, from = _this$_options4.from, senderSource = _this$_options4.senderSource;
4136
4145
  assertNotEvmTransfer(from, senderSource);
4137
- _context4.n = 1;
4146
+ _context5.n = 1;
4138
4147
  return this.buildCommonAll();
4139
4148
  case 1:
4140
- _yield$this$buildComm2 = _context4.v;
4149
+ _yield$this$buildComm2 = _context5.v;
4141
4150
  txContexts = _yield$this$buildComm2.txContexts;
4142
- return _context4.a(2, txContexts);
4151
+ return _context5.a(2, txContexts);
4143
4152
  }
4144
- }, _callee4, this);
4153
+ }, _callee5, this);
4145
4154
  }));
4146
4155
  function buildAll() {
4147
4156
  return _buildAll.apply(this, arguments);
@@ -4158,42 +4167,42 @@ var GeneralBuilder = /*#__PURE__*/function () {
4158
4167
  }, {
4159
4168
  key: "buildCommon",
4160
4169
  value: function () {
4161
- var _buildCommon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
4170
+ var _buildCommon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
4162
4171
  var isCalledInternally,
4163
4172
  _yield$this$prepareNo,
4164
4173
  normalizedOptions,
4165
4174
  from,
4166
4175
  substrateOptions,
4167
4176
  tx,
4168
- _args5 = arguments;
4169
- return _regenerator().w(function (_context5) {
4170
- while (1) switch (_context5.n) {
4177
+ _args6 = arguments;
4178
+ return _regenerator().w(function (_context6) {
4179
+ while (1) switch (_context6.n) {
4171
4180
  case 0:
4172
- isCalledInternally = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
4181
+ isCalledInternally = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
4173
4182
  this.validateBatchState(isCalledInternally);
4174
- _context5.n = 1;
4183
+ _context6.n = 1;
4175
4184
  return this.prepareNormalizedOptions(this._options);
4176
4185
  case 1:
4177
- _yield$this$prepareNo = _context5.v;
4186
+ _yield$this$prepareNo = _context6.v;
4178
4187
  normalizedOptions = _yield$this$prepareNo.normalizedOptions;
4179
4188
  from = normalizedOptions.from;
4180
4189
  assertSubstrateOrigin(from);
4181
4190
  substrateOptions = _objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4182
4191
  from: from
4183
4192
  });
4184
- _context5.n = 2;
4193
+ _context6.n = 2;
4185
4194
  return createTransferOrSwap(substrateOptions);
4186
4195
  case 2:
4187
- tx = _context5.v;
4188
- _context5.n = 3;
4196
+ tx = _context6.v;
4197
+ _context6.n = 3;
4189
4198
  return this.maybePerformXcmFormatCheck(tx, substrateOptions, isCalledInternally);
4190
4199
  case 3:
4191
- return _context5.a(2, {
4200
+ return _context6.a(2, {
4192
4201
  tx: tx,
4193
4202
  options: normalizedOptions
4194
4203
  });
4195
4204
  }
4196
- }, _callee5, this);
4205
+ }, _callee6, this);
4197
4206
  }));
4198
4207
  function buildCommon() {
4199
4208
  return _buildCommon.apply(this, arguments);
@@ -4203,39 +4212,39 @@ var GeneralBuilder = /*#__PURE__*/function () {
4203
4212
  }, {
4204
4213
  key: "buildCommonAll",
4205
4214
  value: function () {
4206
- var _buildCommonAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
4215
+ var _buildCommonAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
4207
4216
  var isCalledInternally,
4208
4217
  _yield$this$prepareNo2,
4209
4218
  normalizedOptions,
4210
4219
  from,
4211
4220
  substrateOptions,
4212
4221
  txContexts,
4213
- _args6 = arguments;
4214
- return _regenerator().w(function (_context6) {
4215
- while (1) switch (_context6.n) {
4222
+ _args7 = arguments;
4223
+ return _regenerator().w(function (_context7) {
4224
+ while (1) switch (_context7.n) {
4216
4225
  case 0:
4217
- isCalledInternally = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : false;
4226
+ isCalledInternally = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
4218
4227
  this.validateBatchState(isCalledInternally);
4219
- _context6.n = 1;
4228
+ _context7.n = 1;
4220
4229
  return this.prepareNormalizedOptions(this._options);
4221
4230
  case 1:
4222
- _yield$this$prepareNo2 = _context6.v;
4231
+ _yield$this$prepareNo2 = _context7.v;
4223
4232
  normalizedOptions = _yield$this$prepareNo2.normalizedOptions;
4224
4233
  from = normalizedOptions.from;
4225
4234
  assertSubstrateOrigin(from);
4226
4235
  substrateOptions = _objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4227
4236
  from: from
4228
4237
  });
4229
- _context6.n = 2;
4238
+ _context7.n = 2;
4230
4239
  return createTransferOrSwapAll(substrateOptions);
4231
4240
  case 2:
4232
- txContexts = _context6.v;
4233
- return _context6.a(2, {
4241
+ txContexts = _context7.v;
4242
+ return _context7.a(2, {
4234
4243
  txContexts: txContexts,
4235
4244
  options: normalizedOptions
4236
4245
  });
4237
4246
  }
4238
- }, _callee6, this);
4247
+ }, _callee7, this);
4239
4248
  }));
4240
4249
  function buildCommonAll() {
4241
4250
  return _buildCommonAll.apply(this, arguments);
@@ -4245,35 +4254,35 @@ var GeneralBuilder = /*#__PURE__*/function () {
4245
4254
  }, {
4246
4255
  key: "maybePerformXcmFormatCheck",
4247
4256
  value: function () {
4248
- var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(tx, options, isCalledInternally) {
4257
+ var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(tx, options, isCalledInternally) {
4249
4258
  var sender, config, dryRunResult;
4250
- return _regenerator().w(function (_context7) {
4251
- while (1) switch (_context7.n) {
4259
+ return _regenerator().w(function (_context8) {
4260
+ while (1) switch (_context8.n) {
4252
4261
  case 0:
4253
4262
  sender = options.sender;
4254
4263
  config = this.api.config;
4255
4264
  if (!(isConfig(config) && config.xcmFormatCheck && !isCalledInternally)) {
4256
- _context7.n = 2;
4265
+ _context8.n = 2;
4257
4266
  break;
4258
4267
  }
4259
4268
  assertSender(sender);
4260
- _context7.n = 1;
4269
+ _context8.n = 1;
4261
4270
  return buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
4262
4271
  sender: sender
4263
4272
  }), {
4264
4273
  sentAssetMintMode: 'bypass'
4265
4274
  });
4266
4275
  case 1:
4267
- dryRunResult = _context7.v;
4276
+ dryRunResult = _context8.v;
4268
4277
  if (!dryRunResult.failureReason) {
4269
- _context7.n = 2;
4278
+ _context8.n = 2;
4270
4279
  break;
4271
4280
  }
4272
- throw new DryRunFailedError(dryRunResult.failureReason, dryRunResult.failureChain);
4281
+ throw new DryRunFailedError(dryRunResult.failureReason, dryRunResult.failureChain, 'XCM format check failed.');
4273
4282
  case 2:
4274
- return _context7.a(2);
4283
+ return _context8.a(2);
4275
4284
  }
4276
- }, _callee7, this);
4285
+ }, _callee8, this);
4277
4286
  }));
4278
4287
  function maybePerformXcmFormatCheck(_x3, _x4, _x5) {
4279
4288
  return _maybePerformXcmFormatCheck.apply(this, arguments);
@@ -4283,18 +4292,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
4283
4292
  }, {
4284
4293
  key: "dryRun",
4285
4294
  value: function () {
4286
- var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
4295
+ var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
4287
4296
  var _this$_options5, from, senderSource, swapOptions, _yield$this$buildInte, tx, options;
4288
- return _regenerator().w(function (_context8) {
4289
- while (1) switch (_context8.n) {
4297
+ return _regenerator().w(function (_context9) {
4298
+ while (1) switch (_context9.n) {
4290
4299
  case 0:
4291
4300
  _this$_options5 = this._options, from = _this$_options5.from, senderSource = _this$_options5.senderSource, swapOptions = _this$_options5.swapOptions;
4292
4301
  assertNotEvmTransfer(from, senderSource);
4293
4302
  if (!swapOptions) {
4294
- _context8.n = 1;
4303
+ _context9.n = 1;
4295
4304
  break;
4296
4305
  }
4297
- return _context8.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4306
+ return _context9.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4298
4307
  from: from,
4299
4308
  api: this.api,
4300
4309
  swapOptions: swapOptions
@@ -4302,17 +4311,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
4302
4311
  return builder.dryRun();
4303
4312
  }));
4304
4313
  case 1:
4305
- _context8.n = 2;
4314
+ _context9.n = 2;
4306
4315
  return this.buildInternal();
4307
4316
  case 2:
4308
- _yield$this$buildInte = _context8.v;
4317
+ _yield$this$buildInte = _context9.v;
4309
4318
  tx = _yield$this$buildInte.tx;
4310
4319
  options = _yield$this$buildInte.options;
4311
- return _context8.a(2, buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
4320
+ return _context9.a(2, buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
4312
4321
  from: from
4313
4322
  })));
4314
4323
  }
4315
- }, _callee8, this);
4324
+ }, _callee9, this);
4316
4325
  }));
4317
4326
  function dryRun() {
4318
4327
  return _dryRun.apply(this, arguments);
@@ -4322,28 +4331,39 @@ var GeneralBuilder = /*#__PURE__*/function () {
4322
4331
  }, {
4323
4332
  key: "dryRunPreview",
4324
4333
  value: function () {
4325
- var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(dryRunOptions) {
4334
+ var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(dryRunOptions) {
4326
4335
  var _this$_options6, from, senderSource, swapOptions, _yield$this$buildInte2, tx, options;
4327
- return _regenerator().w(function (_context9) {
4328
- while (1) switch (_context9.n) {
4336
+ return _regenerator().w(function (_context0) {
4337
+ while (1) switch (_context0.n) {
4329
4338
  case 0:
4330
4339
  _this$_options6 = this._options, from = _this$_options6.from, senderSource = _this$_options6.senderSource, swapOptions = _this$_options6.swapOptions;
4331
4340
  assertNotEvmTransfer(from, senderSource);
4332
- assertSwapSupport(swapOptions);
4333
- _context9.n = 1;
4334
- return this.buildInternal();
4341
+ if (!swapOptions) {
4342
+ _context0.n = 1;
4343
+ break;
4344
+ }
4345
+ return _context0.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4346
+ from: from,
4347
+ api: this.api,
4348
+ swapOptions: swapOptions
4349
+ }), function (builder) {
4350
+ return builder.dryRunPreview(dryRunOptions);
4351
+ }));
4335
4352
  case 1:
4336
- _yield$this$buildInte2 = _context9.v;
4353
+ _context0.n = 2;
4354
+ return this.buildInternal();
4355
+ case 2:
4356
+ _yield$this$buildInte2 = _context0.v;
4337
4357
  tx = _yield$this$buildInte2.tx;
4338
4358
  options = _yield$this$buildInte2.options;
4339
- return _context9.a(2, buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
4359
+ return _context0.a(2, buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
4340
4360
  from: from
4341
4361
  }), {
4342
4362
  sentAssetMintMode: 'preview',
4343
4363
  mintFeeAssets: dryRunOptions === null || dryRunOptions === void 0 ? void 0 : dryRunOptions.mintFeeAssets
4344
4364
  }));
4345
4365
  }
4346
- }, _callee9, this);
4366
+ }, _callee0, this);
4347
4367
  }));
4348
4368
  function dryRunPreview(_x6) {
4349
4369
  return _dryRunPreview.apply(this, arguments);
@@ -4368,18 +4388,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
4368
4388
  }, {
4369
4389
  key: "getXcmFee",
4370
4390
  value: (function () {
4371
- var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
4391
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(options) {
4372
4392
  var _options$disableFallb;
4373
4393
  var disableFallback, senderSource, _yield$this$prepareNo3, normalizedOptions, buildTx, api, from, to, sender, recipient, currency, feeAsset, version, swapOptions;
4374
- return _regenerator().w(function (_context0) {
4375
- while (1) switch (_context0.n) {
4394
+ return _regenerator().w(function (_context1) {
4395
+ while (1) switch (_context1.n) {
4376
4396
  case 0:
4377
4397
  disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
4378
4398
  senderSource = this._options.senderSource;
4379
- _context0.n = 1;
4399
+ _context1.n = 1;
4380
4400
  return this.prepareNormalizedOptions(this._options);
4381
4401
  case 1:
4382
- _yield$this$prepareNo3 = _context0.v;
4402
+ _yield$this$prepareNo3 = _context1.v;
4383
4403
  normalizedOptions = _yield$this$prepareNo3.normalizedOptions;
4384
4404
  buildTx = _yield$this$prepareNo3.buildTx;
4385
4405
  api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
@@ -4387,17 +4407,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
4387
4407
  assertAddressIsString(recipient);
4388
4408
  assertNotEvmTransfer(from, senderSource);
4389
4409
  if (!swapOptions) {
4390
- _context0.n = 2;
4410
+ _context1.n = 2;
4391
4411
  break;
4392
4412
  }
4393
- return _context0.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4413
+ return _context1.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4394
4414
  from: from,
4395
4415
  swapOptions: swapOptions
4396
4416
  }), function (builder) {
4397
4417
  return builder.getXcmFees(options);
4398
4418
  }));
4399
4419
  case 2:
4400
- return _context0.a(2, getXcmFee({
4420
+ return _context1.a(2, getXcmFee({
4401
4421
  api: api,
4402
4422
  buildTx: buildTx,
4403
4423
  origin: from,
@@ -4410,7 +4430,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4410
4430
  disableFallback: disableFallback
4411
4431
  }));
4412
4432
  }
4413
- }, _callee0, this);
4433
+ }, _callee1, this);
4414
4434
  }));
4415
4435
  function getXcmFee$1(_x7) {
4416
4436
  return _getXcmFee2.apply(this, arguments);
@@ -4426,41 +4446,36 @@ var GeneralBuilder = /*#__PURE__*/function () {
4426
4446
  }, {
4427
4447
  key: "getOriginXcmFee",
4428
4448
  value: (function () {
4429
- var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
4430
- var _ref,
4431
- disableFallback,
4432
- senderSource,
4433
- _yield$this$prepareNo4,
4434
- normalizedOptions,
4435
- buildTx,
4436
- api,
4437
- from,
4438
- to,
4439
- sender,
4440
- currency,
4441
- feeAsset,
4442
- version,
4443
- swapOptions,
4444
- _args1 = arguments;
4445
- return _regenerator().w(function (_context1) {
4446
- while (1) switch (_context1.p = _context1.n) {
4449
+ var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(options) {
4450
+ var _options$disableFallb2;
4451
+ var disableFallback, senderSource, _yield$this$prepareNo4, normalizedOptions, buildTx, api, from, to, sender, currency, feeAsset, version, swapOptions;
4452
+ return _regenerator().w(function (_context10) {
4453
+ while (1) switch (_context10.p = _context10.n) {
4447
4454
  case 0:
4448
- _ref = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : {
4449
- disableFallback: false
4450
- }, disableFallback = _ref.disableFallback;
4455
+ disableFallback = (_options$disableFallb2 = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb2 !== void 0 ? _options$disableFallb2 : false;
4451
4456
  senderSource = this._options.senderSource;
4452
- _context1.n = 1;
4457
+ _context10.n = 1;
4453
4458
  return this.prepareNormalizedOptions(this._options);
4454
4459
  case 1:
4455
- _yield$this$prepareNo4 = _context1.v;
4460
+ _yield$this$prepareNo4 = _context10.v;
4456
4461
  normalizedOptions = _yield$this$prepareNo4.normalizedOptions;
4457
4462
  buildTx = _yield$this$prepareNo4.buildTx;
4458
4463
  api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
4459
4464
  assertToIsString(to);
4460
- assertSwapSupport(swapOptions);
4461
4465
  assertNotEvmTransfer(from, senderSource);
4462
- _context1.p = 2;
4463
- _context1.n = 3;
4466
+ if (!swapOptions) {
4467
+ _context10.n = 2;
4468
+ break;
4469
+ }
4470
+ return _context10.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4471
+ from: from,
4472
+ swapOptions: swapOptions
4473
+ }), function (builder) {
4474
+ return builder.getOriginXcmFee(options);
4475
+ }));
4476
+ case 2:
4477
+ _context10.p = 2;
4478
+ _context10.n = 3;
4464
4479
  return getOriginXcmFee({
4465
4480
  api: api,
4466
4481
  buildTx: buildTx,
@@ -4473,19 +4488,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
4473
4488
  disableFallback: disableFallback
4474
4489
  });
4475
4490
  case 3:
4476
- return _context1.a(2, _context1.v);
4491
+ return _context10.a(2, _context10.v);
4477
4492
  case 4:
4478
- _context1.p = 4;
4479
- _context1.n = 5;
4493
+ _context10.p = 4;
4494
+ _context10.n = 5;
4480
4495
  return this.api.disconnect();
4481
4496
  case 5:
4482
- return _context1.f(4);
4497
+ return _context10.f(4);
4483
4498
  case 6:
4484
- return _context1.a(2);
4499
+ return _context10.a(2);
4485
4500
  }
4486
- }, _callee1, this, [[2,, 4, 6]]);
4501
+ }, _callee10, this, [[2,, 4, 6]]);
4487
4502
  }));
4488
- function getOriginXcmFee$1() {
4503
+ function getOriginXcmFee$1(_x8) {
4489
4504
  return _getOriginXcmFee2.apply(this, arguments);
4490
4505
  }
4491
4506
  return getOriginXcmFee$1;
@@ -4499,33 +4514,33 @@ var GeneralBuilder = /*#__PURE__*/function () {
4499
4514
  }, {
4500
4515
  key: "getTransferableAmount",
4501
4516
  value: (function () {
4502
- var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
4517
+ var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
4503
4518
  var senderSource, _yield$this$prepareNo5, normalizedOptions, buildTx, api, from, to, sender, currency, feeAsset, version, swapOptions;
4504
- return _regenerator().w(function (_context10) {
4505
- while (1) switch (_context10.n) {
4519
+ return _regenerator().w(function (_context11) {
4520
+ while (1) switch (_context11.n) {
4506
4521
  case 0:
4507
4522
  senderSource = this._options.senderSource;
4508
- _context10.n = 1;
4523
+ _context11.n = 1;
4509
4524
  return this.prepareNormalizedOptions(this._options);
4510
4525
  case 1:
4511
- _yield$this$prepareNo5 = _context10.v;
4526
+ _yield$this$prepareNo5 = _context11.v;
4512
4527
  normalizedOptions = _yield$this$prepareNo5.normalizedOptions;
4513
4528
  buildTx = _yield$this$prepareNo5.buildTx;
4514
4529
  api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
4515
4530
  assertToIsString(to);
4516
4531
  assertNotEvmTransfer(from, senderSource);
4517
4532
  if (!swapOptions) {
4518
- _context10.n = 2;
4533
+ _context11.n = 2;
4519
4534
  break;
4520
4535
  }
4521
- return _context10.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4536
+ return _context11.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4522
4537
  from: from,
4523
4538
  swapOptions: swapOptions
4524
4539
  }), function (builder) {
4525
4540
  return builder.getTransferableAmount();
4526
4541
  }));
4527
4542
  case 2:
4528
- return _context10.a(2, getTransferableAmount({
4543
+ return _context11.a(2, getTransferableAmount({
4529
4544
  api: api,
4530
4545
  buildTx: buildTx,
4531
4546
  origin: from,
@@ -4536,7 +4551,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4536
4551
  currency: currency
4537
4552
  }));
4538
4553
  }
4539
- }, _callee10, this);
4554
+ }, _callee11, this);
4540
4555
  }));
4541
4556
  function getTransferableAmount$1() {
4542
4557
  return _getTransferableAmount2.apply(this, arguments);
@@ -4552,16 +4567,16 @@ var GeneralBuilder = /*#__PURE__*/function () {
4552
4567
  }, {
4553
4568
  key: "getMinTransferableAmount",
4554
4569
  value: (function () {
4555
- var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
4570
+ var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
4556
4571
  var senderSource, _yield$this$prepareNo6, normalizedOptions, buildTx, api, from, to, sender, recipient, currency, feeAsset, version, swapOptions;
4557
- return _regenerator().w(function (_context11) {
4558
- while (1) switch (_context11.n) {
4572
+ return _regenerator().w(function (_context12) {
4573
+ while (1) switch (_context12.n) {
4559
4574
  case 0:
4560
4575
  senderSource = this._options.senderSource;
4561
- _context11.n = 1;
4576
+ _context12.n = 1;
4562
4577
  return this.prepareNormalizedOptions(this._options);
4563
4578
  case 1:
4564
- _yield$this$prepareNo6 = _context11.v;
4579
+ _yield$this$prepareNo6 = _context12.v;
4565
4580
  normalizedOptions = _yield$this$prepareNo6.normalizedOptions;
4566
4581
  buildTx = _yield$this$prepareNo6.buildTx;
4567
4582
  api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
@@ -4569,17 +4584,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
4569
4584
  assertAddressIsString(recipient);
4570
4585
  assertNotEvmTransfer(from, senderSource);
4571
4586
  if (!swapOptions) {
4572
- _context11.n = 2;
4587
+ _context12.n = 2;
4573
4588
  break;
4574
4589
  }
4575
- return _context11.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4590
+ return _context12.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4576
4591
  from: from,
4577
4592
  swapOptions: swapOptions
4578
4593
  }), function (builder) {
4579
4594
  return builder.getMinTransferableAmount();
4580
4595
  }));
4581
4596
  case 2:
4582
- return _context11.a(2, getMinTransferableAmount({
4597
+ return _context12.a(2, getMinTransferableAmount({
4583
4598
  api: api,
4584
4599
  buildTx: buildTx,
4585
4600
  origin: from,
@@ -4592,7 +4607,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4592
4607
  builder: this
4593
4608
  }));
4594
4609
  }
4595
- }, _callee11, this);
4610
+ }, _callee12, this);
4596
4611
  }));
4597
4612
  function getMinTransferableAmount$1() {
4598
4613
  return _getMinTransferableAmount2.apply(this, arguments);
@@ -4608,16 +4623,16 @@ var GeneralBuilder = /*#__PURE__*/function () {
4608
4623
  }, {
4609
4624
  key: "verifyEdOnDestination",
4610
4625
  value: (function () {
4611
- var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
4626
+ var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
4612
4627
  var senderSource, _yield$this$prepareNo7, normalizedOptions, buildTx, api, from, to, sender, recipient, currency, feeAsset, version, swapOptions;
4613
- return _regenerator().w(function (_context12) {
4614
- while (1) switch (_context12.n) {
4628
+ return _regenerator().w(function (_context13) {
4629
+ while (1) switch (_context13.n) {
4615
4630
  case 0:
4616
4631
  senderSource = this._options.senderSource;
4617
- _context12.n = 1;
4632
+ _context13.n = 1;
4618
4633
  return this.prepareNormalizedOptions(this._options);
4619
4634
  case 1:
4620
- _yield$this$prepareNo7 = _context12.v;
4635
+ _yield$this$prepareNo7 = _context13.v;
4621
4636
  normalizedOptions = _yield$this$prepareNo7.normalizedOptions;
4622
4637
  buildTx = _yield$this$prepareNo7.buildTx;
4623
4638
  api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
@@ -4625,7 +4640,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4625
4640
  assertAddressIsString(recipient);
4626
4641
  assertSwapSupport(swapOptions);
4627
4642
  assertNotEvmTransfer(from, senderSource);
4628
- return _context12.a(2, verifyEdOnDestination({
4643
+ return _context13.a(2, verifyEdOnDestination({
4629
4644
  api: api,
4630
4645
  buildTx: buildTx,
4631
4646
  origin: from,
@@ -4637,7 +4652,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4637
4652
  currency: currency
4638
4653
  }));
4639
4654
  }
4640
- }, _callee12, this);
4655
+ }, _callee13, this);
4641
4656
  }));
4642
4657
  function verifyEdOnDestination$1() {
4643
4658
  return _verifyEdOnDestination2.apply(this, arguments);
@@ -4653,24 +4668,35 @@ var GeneralBuilder = /*#__PURE__*/function () {
4653
4668
  }, {
4654
4669
  key: "getTransferInfo",
4655
4670
  value: (function () {
4656
- var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
4671
+ var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
4657
4672
  var senderSource, _yield$this$prepareNo8, normalizedOptions, buildTx, api, from, to, recipient, currency, ahAddress, sender, feeAsset, version, swapOptions;
4658
- return _regenerator().w(function (_context13) {
4659
- while (1) switch (_context13.n) {
4673
+ return _regenerator().w(function (_context14) {
4674
+ while (1) switch (_context14.n) {
4660
4675
  case 0:
4661
4676
  senderSource = this._options.senderSource;
4662
- _context13.n = 1;
4677
+ _context14.n = 1;
4663
4678
  return this.prepareNormalizedOptions(this._options);
4664
4679
  case 1:
4665
- _yield$this$prepareNo8 = _context13.v;
4680
+ _yield$this$prepareNo8 = _context14.v;
4666
4681
  normalizedOptions = _yield$this$prepareNo8.normalizedOptions;
4667
4682
  buildTx = _yield$this$prepareNo8.buildTx;
4668
4683
  api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, ahAddress = normalizedOptions.ahAddress, sender = normalizedOptions.sender, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
4669
4684
  assertToIsString(to);
4670
4685
  assertAddressIsString(recipient);
4671
- assertSwapSupport(swapOptions);
4672
4686
  assertNotEvmTransfer(from, senderSource);
4673
- return _context13.a(2, getTransferInfo({
4687
+ if (!swapOptions) {
4688
+ _context14.n = 2;
4689
+ break;
4690
+ }
4691
+ return _context14.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
4692
+ from: from,
4693
+ swapOptions: swapOptions
4694
+ }), function (builder) {
4695
+ return builder.getSwapInfo();
4696
+ }));
4697
+ case 2:
4698
+ assertCurrencyCore(feeAsset);
4699
+ return _context14.a(2, getTransferInfo({
4674
4700
  api: api,
4675
4701
  buildTx: buildTx,
4676
4702
  origin: from,
@@ -4683,7 +4709,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4683
4709
  feeAsset: feeAsset
4684
4710
  }));
4685
4711
  }
4686
- }, _callee13, this);
4712
+ }, _callee14, this);
4687
4713
  }));
4688
4714
  function getTransferInfo$1() {
4689
4715
  return _getTransferInfo2.apply(this, arguments);
@@ -4700,25 +4726,25 @@ var GeneralBuilder = /*#__PURE__*/function () {
4700
4726
  }, {
4701
4727
  key: "getReceivableAmount",
4702
4728
  value: (function () {
4703
- var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
4729
+ var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
4704
4730
  var _yield$this$getTransf, receivedAmount;
4705
- return _regenerator().w(function (_context14) {
4706
- while (1) switch (_context14.n) {
4731
+ return _regenerator().w(function (_context15) {
4732
+ while (1) switch (_context15.n) {
4707
4733
  case 0:
4708
- _context14.n = 1;
4734
+ _context15.n = 1;
4709
4735
  return this.getTransferInfo();
4710
4736
  case 1:
4711
- _yield$this$getTransf = _context14.v;
4737
+ _yield$this$getTransf = _context15.v;
4712
4738
  receivedAmount = _yield$this$getTransf.destination.receivedCurrency.receivedAmount;
4713
4739
  if (!(receivedAmount instanceof UnableToComputeError)) {
4714
- _context14.n = 2;
4740
+ _context15.n = 2;
4715
4741
  break;
4716
4742
  }
4717
4743
  throw receivedAmount;
4718
4744
  case 2:
4719
- return _context14.a(2, receivedAmount);
4745
+ return _context15.a(2, receivedAmount);
4720
4746
  }
4721
- }, _callee14, this);
4747
+ }, _callee15, this);
4722
4748
  }));
4723
4749
  function getReceivableAmount() {
4724
4750
  return _getReceivableAmount.apply(this, arguments);
@@ -4728,14 +4754,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
4728
4754
  }, {
4729
4755
  key: "getBestAmountOut",
4730
4756
  value: function () {
4731
- var _getBestAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
4757
+ var _getBestAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
4732
4758
  var _this$_options7, from, senderSource, swapOptions;
4733
- return _regenerator().w(function (_context15) {
4734
- while (1) switch (_context15.n) {
4759
+ return _regenerator().w(function (_context16) {
4760
+ while (1) switch (_context16.n) {
4735
4761
  case 0:
4736
4762
  _this$_options7 = this._options, from = _this$_options7.from, senderSource = _this$_options7.senderSource, swapOptions = _this$_options7.swapOptions;
4737
4763
  assertNotEvmTransfer(from, senderSource);
4738
- return _context15.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4764
+ return _context16.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4739
4765
  from: from,
4740
4766
  api: this.api,
4741
4767
  swapOptions: swapOptions
@@ -4743,7 +4769,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
4743
4769
  return builder.getBestAmountOut();
4744
4770
  }));
4745
4771
  }
4746
- }, _callee15, this);
4772
+ }, _callee16, this);
4747
4773
  }));
4748
4774
  function getBestAmountOut() {
4749
4775
  return _getBestAmountOut.apply(this, arguments);
@@ -4753,31 +4779,31 @@ var GeneralBuilder = /*#__PURE__*/function () {
4753
4779
  }, {
4754
4780
  key: "signAndSubmit",
4755
4781
  value: function () {
4756
- var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
4782
+ var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
4757
4783
  var _this$_options8, from, senderSource, swapOptions, txHashes, _yield$this$buildInte3, tx;
4758
- return _regenerator().w(function (_context16) {
4759
- while (1) switch (_context16.n) {
4784
+ return _regenerator().w(function (_context17) {
4785
+ while (1) switch (_context17.n) {
4760
4786
  case 0:
4761
4787
  _this$_options8 = this._options, from = _this$_options8.from, senderSource = _this$_options8.senderSource, swapOptions = _this$_options8.swapOptions;
4762
4788
  assertSenderSource(senderSource);
4763
4789
  if (!isViemSigner(senderSource)) {
4764
- _context16.n = 1;
4790
+ _context17.n = 1;
4765
4791
  break;
4766
4792
  }
4767
- return _context16.a(2, this.executeWithEvmSigner(senderSource));
4793
+ return _context17.a(2, this.executeWithEvmSigner(senderSource));
4768
4794
  case 1:
4769
4795
  assertSubstrateOrigin(from);
4770
4796
  if (!swapOptions) {
4771
- _context16.n = 4;
4797
+ _context17.n = 4;
4772
4798
  break;
4773
4799
  }
4774
4800
  if (isSenderSigner(senderSource)) {
4775
- _context16.n = 2;
4801
+ _context17.n = 2;
4776
4802
  break;
4777
4803
  }
4778
4804
  throw new UnsupportedOperationError('Swap operations do not support local accounts yet. Please provider a signer');
4779
4805
  case 2:
4780
- _context16.n = 3;
4806
+ _context17.n = 3;
4781
4807
  return executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4782
4808
  from: from,
4783
4809
  swapOptions: swapOptions,
@@ -4786,17 +4812,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
4786
4812
  return builder.signer(senderSource).signAndSubmit();
4787
4813
  });
4788
4814
  case 3:
4789
- txHashes = _context16.v;
4790
- return _context16.a(2, txHashes[0]);
4815
+ txHashes = _context17.v;
4816
+ return _context17.a(2, txHashes[0]);
4791
4817
  case 4:
4792
- _context16.n = 5;
4818
+ _context17.n = 5;
4793
4819
  return this.buildInternal();
4794
4820
  case 5:
4795
- _yield$this$buildInte3 = _context16.v;
4821
+ _yield$this$buildInte3 = _context17.v;
4796
4822
  tx = _yield$this$buildInte3.tx;
4797
- return _context16.a(2, this.api.signAndSubmit(tx, senderSource));
4823
+ return _context17.a(2, this.api.signAndSubmit(tx, senderSource));
4798
4824
  }
4799
- }, _callee16, this);
4825
+ }, _callee17, this);
4800
4826
  }));
4801
4827
  function signAndSubmit() {
4802
4828
  return _signAndSubmit.apply(this, arguments);
@@ -4806,35 +4832,35 @@ var GeneralBuilder = /*#__PURE__*/function () {
4806
4832
  }, {
4807
4833
  key: "signAndSubmitAll",
4808
4834
  value: function () {
4809
- var _signAndSubmitAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
4835
+ var _signAndSubmitAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
4810
4836
  var _this$_options9, from, senderSource, swapOptions, hash, _yield$this$buildInte4, tx, txHash;
4811
- return _regenerator().w(function (_context17) {
4812
- while (1) switch (_context17.n) {
4837
+ return _regenerator().w(function (_context18) {
4838
+ while (1) switch (_context18.n) {
4813
4839
  case 0:
4814
4840
  _this$_options9 = this._options, from = _this$_options9.from, senderSource = _this$_options9.senderSource, swapOptions = _this$_options9.swapOptions;
4815
4841
  assertSenderSource(senderSource);
4816
4842
  if (!isViemSigner(senderSource)) {
4817
- _context17.n = 2;
4843
+ _context18.n = 2;
4818
4844
  break;
4819
4845
  }
4820
- _context17.n = 1;
4846
+ _context18.n = 1;
4821
4847
  return this.executeWithEvmSigner(senderSource);
4822
4848
  case 1:
4823
- hash = _context17.v;
4824
- return _context17.a(2, [hash]);
4849
+ hash = _context18.v;
4850
+ return _context18.a(2, [hash]);
4825
4851
  case 2:
4826
4852
  assertSubstrateOrigin(from);
4827
4853
  if (!swapOptions) {
4828
- _context17.n = 4;
4854
+ _context18.n = 4;
4829
4855
  break;
4830
4856
  }
4831
4857
  if (isSenderSigner(senderSource)) {
4832
- _context17.n = 3;
4858
+ _context18.n = 3;
4833
4859
  break;
4834
4860
  }
4835
4861
  throw new UnsupportedOperationError('Swap operations do not support local accounts yet. Please provider a signer');
4836
4862
  case 3:
4837
- return _context17.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4863
+ return _context18.a(2, executeWithSwap(_objectSpread2(_objectSpread2({}, this._options), {}, {
4838
4864
  from: from,
4839
4865
  swapOptions: swapOptions,
4840
4866
  api: this.api
@@ -4842,18 +4868,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
4842
4868
  return builder.signer(senderSource).signAndSubmit();
4843
4869
  }));
4844
4870
  case 4:
4845
- _context17.n = 5;
4871
+ _context18.n = 5;
4846
4872
  return this.buildInternal();
4847
4873
  case 5:
4848
- _yield$this$buildInte4 = _context17.v;
4874
+ _yield$this$buildInte4 = _context18.v;
4849
4875
  tx = _yield$this$buildInte4.tx;
4850
- _context17.n = 6;
4876
+ _context18.n = 6;
4851
4877
  return this.api.signAndSubmit(tx, senderSource);
4852
4878
  case 6:
4853
- txHash = _context17.v;
4854
- return _context17.a(2, [txHash]);
4879
+ txHash = _context18.v;
4880
+ return _context18.a(2, [txHash]);
4855
4881
  }
4856
- }, _callee17, this);
4882
+ }, _callee18, this);
4857
4883
  }));
4858
4884
  function signAndSubmitAll() {
4859
4885
  return _signAndSubmitAll.apply(this, arguments);
@@ -4863,45 +4889,47 @@ var GeneralBuilder = /*#__PURE__*/function () {
4863
4889
  }, {
4864
4890
  key: "executeWithEvmSigner",
4865
4891
  value: function () {
4866
- var _executeWithEvmSigner = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18(signer) {
4867
- var _this$_options0, from, to, currency, recipient, ahAddress;
4868
- return _regenerator().w(function (_context18) {
4869
- while (1) switch (_context18.n) {
4892
+ var _executeWithEvmSigner = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(signer) {
4893
+ var _this$prepareEvmDispa2, ext, options;
4894
+ return _regenerator().w(function (_context19) {
4895
+ while (1) switch (_context19.n) {
4870
4896
  case 0:
4871
- _this$_options0 = this._options, from = _this$_options0.from, to = _this$_options0.to, currency = _this$_options0.currency, recipient = _this$_options0.recipient, ahAddress = _this$_options0.ahAddress;
4872
- assertToIsString(to);
4873
- assertAddressIsString(recipient);
4874
- if (!isExternalChain(from)) {
4875
- _context18.n = 1;
4876
- break;
4877
- }
4878
- return _context18.a(2, getEvmSnowbridgeExtensionOrThrow().executeEvmSnowbridgeTransfer({
4879
- api: this.api,
4880
- from: from,
4881
- to: to,
4882
- currency: currency,
4883
- recipient: recipient,
4884
- ahAddress: ahAddress,
4885
- signer: signer
4886
- }));
4887
- case 1:
4888
- return _context18.a(2, getEvmExtensionOrThrow().executeEvmTransfer({
4889
- api: this.api,
4890
- from: from,
4891
- to: to,
4892
- currency: currency,
4893
- recipient: recipient,
4894
- ahAddress: ahAddress,
4897
+ _this$prepareEvmDispa2 = this.prepareEvmDispatch(), ext = _this$prepareEvmDispa2.ext, options = _this$prepareEvmDispa2.options;
4898
+ return _context19.a(2, ext.executeTransfer(_objectSpread2(_objectSpread2({}, options), {}, {
4895
4899
  signer: signer
4896
- }));
4900
+ })));
4897
4901
  }
4898
- }, _callee18, this);
4902
+ }, _callee19, this);
4899
4903
  }));
4900
- function executeWithEvmSigner(_x8) {
4904
+ function executeWithEvmSigner(_x9) {
4901
4905
  return _executeWithEvmSigner.apply(this, arguments);
4902
4906
  }
4903
4907
  return executeWithEvmSigner;
4904
4908
  }()
4909
+ }, {
4910
+ key: "prepareEvmDispatch",
4911
+ value: function prepareEvmDispatch() {
4912
+ var _this$_options0 = this._options,
4913
+ from = _this$_options0.from,
4914
+ to = _this$_options0.to,
4915
+ currency = _this$_options0.currency,
4916
+ recipient = _this$_options0.recipient,
4917
+ ahAddress = _this$_options0.ahAddress;
4918
+ assertToIsString(to);
4919
+ assertAddressIsString(recipient);
4920
+ var ext = isExternalChain(from) ? getEvmSnowbridgeExtensionOrThrow() : getEvmExtensionOrThrow();
4921
+ return {
4922
+ ext: ext,
4923
+ options: {
4924
+ api: this.api,
4925
+ from: from,
4926
+ to: to,
4927
+ currency: currency,
4928
+ recipient: recipient,
4929
+ ahAddress: ahAddress
4930
+ }
4931
+ };
4932
+ }
4905
4933
  /**
4906
4934
  * Returns the API instance used by the builder.
4907
4935
  *
@@ -6469,6 +6497,23 @@ var localizeLocation = function localizeLocation(chain, location, origin) {
6469
6497
  }
6470
6498
  var isOriginRelayHere = deepEqual(location, RELAY_LOCATION);
6471
6499
  var hasGlobalConsensus = hasJunction(location, 'GlobalConsensus');
6500
+ if (origin && isExternalChain(chain) && originRelay !== undefined && isOriginRelayHere && !hasGlobalConsensus) {
6501
+ return {
6502
+ parents: Parents.ONE,
6503
+ interior: {
6504
+ X1: [{
6505
+ GlobalConsensus: _defineProperty({}, originRelay, null)
6506
+ }]
6507
+ }
6508
+ };
6509
+ }
6510
+ if (isExternalChain(chain) && location.parents === Parents.TWO && RELAYCHAINS.some(function (relay) {
6511
+ return deepEqual(getJunctionValue(location, 'GlobalConsensus'), _defineProperty({}, relay.toLowerCase(), null));
6512
+ })) {
6513
+ return _objectSpread2(_objectSpread2({}, location), {}, {
6514
+ parents: Parents.ONE
6515
+ });
6516
+ }
6472
6517
  if (origin && ecosystemDiffers && isOriginRelayHere && !hasGlobalConsensus && originRelay !== undefined) {
6473
6518
  return {
6474
6519
  parents: Parents.TWO,
@@ -7058,6 +7103,7 @@ var dryRunInternal = /*#__PURE__*/function () {
7058
7103
  while (1) switch (_context2.n) {
7059
7104
  case 0:
7060
7105
  api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, tx = options.tx, sender = options.sender, feeAsset = options.feeAsset, swapConfig = options.swapConfig, version = options.version, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
7106
+ assertCurrencyCore(currency);
7061
7107
  asset = findAssetInfoOrThrow(origin, currency, destination);
7062
7108
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
7063
7109
  amount = abstractDecimals(currency.amount, asset.decimals, api);
@@ -7313,6 +7359,9 @@ var dryRunOrigin = /*#__PURE__*/function () {
7313
7359
  var parseUnits = parseUnits$1;
7314
7360
  var formatUnits = formatUnits$1;
7315
7361
 
7362
+ var resolveBypassMintAmount = function resolveBypassMintAmount(chain) {
7363
+ return HIGH_BYPASS_MINT_CHAINS.includes(chain) ? HIGH_BYPASS_MINT_AMOUNT : BYPASS_MINT_AMOUNT;
7364
+ };
7316
7365
  var pickOtherPallet = function pickOtherPallet(asset, pallets) {
7317
7366
  if (!asset.isNative && (!asset.assetId || asset.assetId.startsWith('0x'))) {
7318
7367
  var _pallets$find;
@@ -7378,7 +7427,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
7378
7427
  });
7379
7428
  return preminted.some(function (a) {
7380
7429
  return isAssetXcEqual(a, sent);
7381
- }) ? parseUnits(BYPASS_MINT_AMOUNT, sent.decimals) : 0n;
7430
+ }) ? parseUnits(resolveBypassMintAmount(chain), sent.decimals) : 0n;
7382
7431
  };
7383
7432
  var wrapTxBypass = /*#__PURE__*/function () {
7384
7433
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dryRunOptions) {
@@ -7390,6 +7439,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
7390
7439
  feeAsset,
7391
7440
  tx,
7392
7441
  mintFeeAssets,
7442
+ bypassMintAmount,
7393
7443
  relayCurrency,
7394
7444
  nativeInfo,
7395
7445
  relayInfo,
@@ -7418,6 +7468,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
7418
7468
  };
7419
7469
  api = dryRunOptions.api, chain = dryRunOptions.chain, address = dryRunOptions.address, asset = dryRunOptions.asset, feeAsset = dryRunOptions.feeAsset, tx = dryRunOptions.tx;
7420
7470
  mintFeeAssets = options.mintFeeAssets;
7471
+ bypassMintAmount = resolveBypassMintAmount(chain);
7421
7472
  relayCurrency = {
7422
7473
  location: {
7423
7474
  parents: Parents.ONE,
@@ -7434,7 +7485,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
7434
7485
  break;
7435
7486
  }
7436
7487
  _context.n = 1;
7437
- return createRequiredMintTxs(chain, findNativeAssetInfoOrThrow(chain), BYPASS_MINT_AMOUNT, 0n, address, api);
7488
+ return createRequiredMintTxs(chain, findNativeAssetInfoOrThrow(chain), bypassMintAmount, 0n, address, api);
7438
7489
  case 1:
7439
7490
  _t = _context.v;
7440
7491
  _context.n = 3;
@@ -7448,7 +7499,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
7448
7499
  break;
7449
7500
  }
7450
7501
  _context.n = 4;
7451
- return createOptionalMintTxs(chain, relayCurrency, BYPASS_MINT_AMOUNT, 0n, address, api);
7502
+ return createOptionalMintTxs(chain, relayCurrency, bypassMintAmount, 0n, address, api);
7452
7503
  case 4:
7453
7504
  _t2 = _context.v;
7454
7505
  _context.n = 6;
@@ -7461,7 +7512,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
7461
7512
  _context.n = 8;
7462
7513
  break;
7463
7514
  }
7464
- amount = parseUnits(BYPASS_MINT_AMOUNT, feeAsset.decimals);
7515
+ amount = parseUnits(bypassMintAmount, feeAsset.decimals);
7465
7516
  _context.n = 7;
7466
7517
  return createMintTxs(chain, _objectSpread2(_objectSpread2({}, feeAsset), {}, {
7467
7518
  amount: amount
@@ -7480,7 +7531,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
7480
7531
  balance = _context.v;
7481
7532
  bonus = mintBonusForSent(chain, asset, feeAsset, !!mintFeeAssets);
7482
7533
  if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
7483
- mintAmount = parseUnits(BYPASS_MINT_AMOUNT, asset.decimals) + asset.amount;
7534
+ mintAmount = parseUnits(bypassMintAmount, asset.decimals) + asset.amount;
7484
7535
  } else {
7485
7536
  missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, asset.amount)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
7486
7537
  total = missing + bonus;
@@ -8359,6 +8410,20 @@ var getXcmFee = /*#__PURE__*/function () {
8359
8410
  };
8360
8411
  }();
8361
8412
 
8413
+ var aggregateHopFees = function aggregateHopFees(hops, matchAsset) {
8414
+ var totalHopFee = hops.reduce(function (acc, hop) {
8415
+ var _hop$result$fee;
8416
+ return isAssetXcEqual(hop.result.asset, matchAsset) ? acc + ((_hop$result$fee = hop.result.fee) !== null && _hop$result$fee !== void 0 ? _hop$result$fee : 0n) : acc;
8417
+ }, 0n);
8418
+ var bridgeHop = hops.find(function (hop) {
8419
+ return hop.chain.startsWith('BridgeHub');
8420
+ });
8421
+ return {
8422
+ totalHopFee: totalHopFee,
8423
+ bridgeFee: bridgeHop === null || bridgeHop === void 0 ? void 0 : bridgeHop.result.fee
8424
+ };
8425
+ };
8426
+
8362
8427
  var buildDestInfo = /*#__PURE__*/function () {
8363
8428
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
8364
8429
  var api, origin, destination, recipient, currency, originFee, isFeeAssetAh, destFeeDetail, totalHopFee, bridgeFee, destApi, destAsset, edDest, destBalance, destAmount, destFeeAssetEqual, effectiveDestFee, effectiveAmountForBalance, destBalanceSufficient, destBalanceAfter, createUnableToComputeError, isUnableToCompute, destbalanceAfterResult, destBalanceSufficientResult, receivedAmount, isSubBridge, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
@@ -8461,7 +8526,7 @@ var buildDestInfo = /*#__PURE__*/function () {
8461
8526
 
8462
8527
  var buildHopInfo = /*#__PURE__*/function () {
8463
8528
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
8464
- var api, chain, fee, originChain, asset, currency, hopApi, xcmFeeDetails, isBridgeHub, nativeAsset, hopAsset, ed;
8529
+ var api, chain, fee, originChain, asset, currency, hopApi, xcmFeeDetails, isBridgeHub, nativeAsset, hopAsset;
8465
8530
  return _regenerator().w(function (_context) {
8466
8531
  while (1) switch (_context.p = _context.n) {
8467
8532
  case 0:
@@ -8488,12 +8553,8 @@ var buildHopInfo = /*#__PURE__*/function () {
8488
8553
  });
8489
8554
  case 3:
8490
8555
  hopAsset = findAssetOnDestOrThrow(originChain, chain, currency);
8491
- ed = getExistentialDepositOrThrow(chain, {
8492
- location: hopAsset.location
8493
- });
8494
8556
  return _context.a(2, {
8495
8557
  asset: hopAsset,
8496
- existentialDeposit: ed,
8497
8558
  xcmFee: xcmFeeDetails
8498
8559
  });
8499
8560
  case 4:
@@ -8513,9 +8574,62 @@ var buildHopInfo = /*#__PURE__*/function () {
8513
8574
  };
8514
8575
  }();
8515
8576
 
8577
+ var buildOriginInfo = /*#__PURE__*/function () {
8578
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
8579
+ var api, origin, sender, currency, originAsset, amount, originFee, originFeeAsset, isFeeAssetAh, originBalance, edOrigin, originBalanceFee, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient;
8580
+ return _regenerator().w(function (_context) {
8581
+ while (1) switch (_context.n) {
8582
+ case 0:
8583
+ api = _ref.api, origin = _ref.origin, sender = _ref.sender, currency = _ref.currency, originAsset = _ref.originAsset, amount = _ref.amount, originFee = _ref.originFee, originFeeAsset = _ref.originFeeAsset, isFeeAssetAh = _ref.isFeeAssetAh;
8584
+ _context.n = 1;
8585
+ return getAssetBalanceInternal({
8586
+ api: api,
8587
+ address: sender,
8588
+ chain: origin,
8589
+ asset: originAsset
8590
+ });
8591
+ case 1:
8592
+ originBalance = _context.v;
8593
+ edOrigin = getExistentialDepositOrThrow(origin, currency);
8594
+ _context.n = 2;
8595
+ return getAssetBalanceInternal({
8596
+ api: api,
8597
+ address: sender,
8598
+ chain: origin,
8599
+ asset: originFeeAsset
8600
+ });
8601
+ case 2:
8602
+ originBalanceFee = _context.v;
8603
+ originBalanceAfter = originBalance - amount;
8604
+ originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - amount : originBalanceFee - originFee;
8605
+ originBalanceNativeSufficient = originBalanceFee >= originFee;
8606
+ originBalanceSufficient = originBalanceAfter >= edOrigin;
8607
+ return _context.a(2, {
8608
+ selectedCurrency: {
8609
+ sufficient: originBalanceSufficient,
8610
+ balance: originBalance,
8611
+ balanceAfter: originBalanceAfter,
8612
+ asset: originAsset
8613
+ },
8614
+ xcmFee: {
8615
+ sufficient: originBalanceNativeSufficient,
8616
+ fee: originFee,
8617
+ balance: originBalanceFee,
8618
+ balanceAfter: originBalanceFeeAfter,
8619
+ asset: originFeeAsset
8620
+ }
8621
+ });
8622
+ }
8623
+ }, _callee);
8624
+ }));
8625
+ return function buildOriginInfo(_x) {
8626
+ return _ref2.apply(this, arguments);
8627
+ };
8628
+ }();
8629
+
8516
8630
  var getTransferInfo = /*#__PURE__*/function () {
8517
8631
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
8518
- var api, buildTx, origin, destination, sender, ahAddress, recipient, currency, feeAsset, version, resolvedFeeAsset, originAsset, amount, originBalance, edOrigin, _yield$getXcmFeeInter, _yield$getXcmFeeInter2, originFee, originFeeAsset, destFeeDetail, hops, originBalanceFee, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, builtHops, totalHopFee, bridgeHop, destinationInfo;
8632
+ var api, buildTx, origin, destination, sender, ahAddress, recipient, currency, feeAsset, version, resolvedFeeAsset, originAsset, amount, _yield$getXcmFeeInter, _yield$getXcmFeeInter2, originFee, originFeeAsset, destFeeDetail, hops, isFeeAssetAh, originInfo, builtHops, _aggregateHopFees, totalHopFee, bridgeFee, destinationInfo;
8519
8633
  return _regenerator().w(function (_context2) {
8520
8634
  while (1) switch (_context2.p = _context2.n) {
8521
8635
  case 0:
@@ -8535,16 +8649,6 @@ var getTransferInfo = /*#__PURE__*/function () {
8535
8649
  originAsset = findAssetInfoOrThrow(origin, currency, destination);
8536
8650
  amount = abstractDecimals(currency.amount, originAsset.decimals, api);
8537
8651
  _context2.n = 4;
8538
- return getAssetBalanceInternal({
8539
- api: api,
8540
- address: sender,
8541
- chain: origin,
8542
- asset: originAsset
8543
- });
8544
- case 4:
8545
- originBalance = _context2.v;
8546
- edOrigin = getExistentialDepositOrThrow(origin, currency);
8547
- _context2.n = 5;
8548
8652
  return getXcmFee({
8549
8653
  api: api,
8550
8654
  buildTx: buildTx,
@@ -8557,33 +8661,34 @@ var getTransferInfo = /*#__PURE__*/function () {
8557
8661
  version: version,
8558
8662
  disableFallback: false
8559
8663
  });
8560
- case 5:
8664
+ case 4:
8561
8665
  _yield$getXcmFeeInter = _context2.v;
8562
8666
  _yield$getXcmFeeInter2 = _yield$getXcmFeeInter.origin;
8563
8667
  originFee = _yield$getXcmFeeInter2.fee;
8564
8668
  originFeeAsset = _yield$getXcmFeeInter2.asset;
8565
8669
  destFeeDetail = _yield$getXcmFeeInter.destination;
8566
8670
  hops = _yield$getXcmFeeInter.hops;
8567
- _context2.n = 6;
8568
- return getAssetBalanceInternal({
8671
+ isFeeAssetAh = origin === 'AssetHubPolkadot' && !!resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
8672
+ _context2.n = 5;
8673
+ return buildOriginInfo({
8569
8674
  api: api,
8570
- address: sender,
8571
- chain: origin,
8572
- asset: originFeeAsset
8675
+ origin: origin,
8676
+ sender: sender,
8677
+ currency: currency,
8678
+ originAsset: originAsset,
8679
+ amount: amount,
8680
+ originFee: originFee,
8681
+ originFeeAsset: originFeeAsset,
8682
+ isFeeAssetAh: isFeeAssetAh
8573
8683
  });
8574
- case 6:
8575
- originBalanceFee = _context2.v;
8576
- isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
8577
- originBalanceAfter = originBalance - amount;
8578
- originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - amount : originBalanceFee - originFee;
8579
- originBalanceNativeSufficient = originBalanceFee >= originFee;
8580
- originBalanceSufficient = originBalanceAfter >= edOrigin;
8684
+ case 5:
8685
+ originInfo = _context2.v;
8581
8686
  builtHops = [];
8582
8687
  if (!(hops && hops.length > 0)) {
8583
- _context2.n = 8;
8688
+ _context2.n = 7;
8584
8689
  break;
8585
8690
  }
8586
- _context2.n = 7;
8691
+ _context2.n = 6;
8587
8692
  return Promise.all(hops.map(/*#__PURE__*/function () {
8588
8693
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(hop) {
8589
8694
  var result;
@@ -8614,16 +8719,11 @@ var getTransferInfo = /*#__PURE__*/function () {
8614
8719
  return _ref3.apply(this, arguments);
8615
8720
  };
8616
8721
  }()));
8617
- case 7:
8722
+ case 6:
8618
8723
  builtHops = _context2.v;
8619
- case 8:
8620
- totalHopFee = hops.reduce(function (acc, hop) {
8621
- return isAssetXcEqual(hop.result.asset, originAsset) ? acc + hop.result.fee : acc;
8622
- }, 0n);
8623
- bridgeHop = hops.find(function (hop) {
8624
- return hop.chain.startsWith('BridgeHub');
8625
- });
8626
- _context2.n = 9;
8724
+ case 7:
8725
+ _aggregateHopFees = aggregateHopFees(hops, originAsset), totalHopFee = _aggregateHopFees.totalHopFee, bridgeFee = _aggregateHopFees.bridgeFee;
8726
+ _context2.n = 8;
8627
8727
  return buildDestInfo({
8628
8728
  api: api,
8629
8729
  origin: origin,
@@ -8633,12 +8733,12 @@ var getTransferInfo = /*#__PURE__*/function () {
8633
8733
  amount: amount
8634
8734
  }),
8635
8735
  originFee: originFee,
8636
- isFeeAssetAh: !!isFeeAssetAh,
8736
+ isFeeAssetAh: isFeeAssetAh,
8637
8737
  destFeeDetail: destFeeDetail,
8638
8738
  totalHopFee: totalHopFee,
8639
- bridgeFee: bridgeHop === null || bridgeHop === void 0 ? void 0 : bridgeHop.result.fee
8739
+ bridgeFee: bridgeFee
8640
8740
  });
8641
- case 9:
8741
+ case 8:
8642
8742
  destinationInfo = _context2.v;
8643
8743
  return _context2.a(2, {
8644
8744
  chain: {
@@ -8646,35 +8746,21 @@ var getTransferInfo = /*#__PURE__*/function () {
8646
8746
  destination: destination,
8647
8747
  ecosystem: getRelayChainSymbol(origin)
8648
8748
  },
8649
- origin: {
8650
- selectedCurrency: {
8651
- sufficient: originBalanceSufficient,
8652
- balance: originBalance,
8653
- balanceAfter: originBalanceAfter,
8654
- asset: originAsset
8655
- },
8656
- xcmFee: {
8657
- sufficient: originBalanceNativeSufficient,
8658
- fee: originFee,
8659
- balance: originBalanceFee,
8660
- balanceAfter: originBalanceFeeAfter,
8661
- asset: originFeeAsset
8662
- }
8663
- },
8749
+ origin: originInfo,
8664
8750
  hops: builtHops,
8665
8751
  destination: destinationInfo
8666
8752
  });
8667
- case 10:
8668
- _context2.p = 10;
8753
+ case 9:
8754
+ _context2.p = 9;
8669
8755
  api.disconnectAllowed = true;
8670
- _context2.n = 11;
8756
+ _context2.n = 10;
8671
8757
  return api.disconnect();
8758
+ case 10:
8759
+ return _context2.f(9);
8672
8760
  case 11:
8673
- return _context2.f(10);
8674
- case 12:
8675
8761
  return _context2.a(2);
8676
8762
  }
8677
- }, _callee2, null, [[3,, 10, 12]]);
8763
+ }, _callee2, null, [[3,, 9, 11]]);
8678
8764
  }));
8679
8765
  return function getTransferInfo(_x) {
8680
8766
  return _ref2.apply(this, arguments);
@@ -9012,15 +9098,16 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(context, isDotAsset, cu
9012
9098
  reserve = context.reserve,
9013
9099
  dest = context.dest,
9014
9100
  assetInfo = context.assetInfo,
9101
+ bridgeHopChain = context.bridgeHopChain,
9015
9102
  _context$options = context.options,
9016
9103
  version = _context$options.version,
9017
9104
  pallet = _context$options.pallet,
9018
9105
  method = _context$options.method,
9019
9106
  overriddenAsset = _context$options.overriddenAsset;
9020
9107
  var feeAssetLocation = !isDotAsset ? RELAY_LOCATION : assetInfo.location;
9021
- var finalDest = origin.chain === reserve.chain ? dest.chain : reserve.chain;
9108
+ var finalDest = bridgeHopChain !== null && bridgeHopChain !== void 0 ? bridgeHopChain : origin.chain === reserve.chain ? dest.chain : reserve.chain;
9022
9109
  var destLocation = createDestination(version, origin.chain, finalDest, getParaId(finalDest));
9023
- var transferType = resolveTransferType(context);
9110
+ var transferType = bridgeHopChain ? 'DestinationReserve' : resolveTransferType(context);
9024
9111
  var feeAsset = Array.isArray(overriddenAsset) ? overriddenAsset.find(function (a) {
9025
9112
  return a.isFeeAsset;
9026
9113
  }) : null;
@@ -9043,34 +9130,31 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(context, isDotAsset, cu
9043
9130
  };
9044
9131
 
9045
9132
  var getBridgeReserve = function getBridgeReserve(chain, destination, location) {
9046
- var isExternal = isExternalChain(destination);
9047
- var destRelay = isExternal ? destination : getRelayChainOf(destination).toLowerCase();
9048
- var expectedConsensus = isExternal ? getEthereumJunction(chain, false).GlobalConsensus : _defineProperty({}, destRelay, null);
9133
+ var expectedConsensus = isExternalChain(destination) ? getEthereumJunction(chain, false).GlobalConsensus : _defineProperty({}, getRelayChainOf(destination).toLowerCase(), null);
9049
9134
  var isDestReserve = deepEqual(getJunctionValue(location, 'GlobalConsensus'), expectedConsensus);
9050
9135
  return isDestReserve ? destination : chain;
9051
9136
  };
9052
- var resolveReserveChain = function resolveReserveChain(chain, destination, assetLocation, isSubBridge, isSnowbridge, overrideReserve) {
9053
- if (isSubBridge || isSnowbridge) {
9137
+ var resolveReserveChain = function resolveReserveChain(chain, destination, assetLocation, isSubBridge, overrideReserve) {
9138
+ if (isSubBridge) {
9054
9139
  return getBridgeReserve(chain, destination, assetLocation);
9055
9140
  }
9056
9141
  if (overrideReserve !== undefined) {
9057
9142
  return overrideReserve;
9058
9143
  }
9059
- return getAssetReserveChain(chain, assetLocation);
9144
+ return getAssetReserveChain(chain, assetLocation, true);
9060
9145
  };
9061
9146
  var createTypeAndThenCallContext = /*#__PURE__*/function () {
9062
9147
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, overrides) {
9063
9148
  var _overrides$noFeeAsset;
9064
- var api, chain, destination, assetInfo, destinationChain, isSubBridge, isSb, reserveChain, NO_FEE_ASSET_LOCS, systemAsset, isRelayAsset, destApi, reserveApi;
9149
+ var api, chain, destination, assetInfo, isSubBridge, isSb, reserveChain, NO_FEE_ASSET_LOCS, systemAsset, assetGlobalConsensus, originRelayChain, isAssetHubToExternal, isForeignRelayToExternal, isRelayAsset, bridgeHopChain, destApi, reserveApi;
9065
9150
  return _regenerator().w(function (_context) {
9066
9151
  while (1) switch (_context.n) {
9067
9152
  case 0:
9068
9153
  api = options.api, chain = options.chain, destination = options.destination, assetInfo = options.assetInfo;
9069
9154
  assertToIsString(destination);
9070
- destinationChain = destination;
9071
- isSubBridge = isSubstrateBridge(chain, destinationChain);
9072
- isSb = isSnowbridge(chain, destinationChain);
9073
- reserveChain = resolveReserveChain(chain, destinationChain, assetInfo.location, isSubBridge, isSb, overrides.reserveChain);
9155
+ isSubBridge = isSubstrateBridge(chain, destination);
9156
+ isSb = isSnowbridge(chain, destination);
9157
+ reserveChain = resolveReserveChain(chain, destination, assetInfo.location, isSubBridge, overrides.reserveChain);
9074
9158
  NO_FEE_ASSET_LOCS = [RELAY_LOCATION, {
9075
9159
  parents: 2,
9076
9160
  interior: {
@@ -9098,14 +9182,21 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
9098
9182
  }
9099
9183
  }];
9100
9184
  systemAsset = findNativeAssetInfoOrThrow(getRelayChainOf(chain));
9101
- isRelayAsset = NO_FEE_ASSET_LOCS.some(function (loc) {
9185
+ assetGlobalConsensus = getJunctionValue(assetInfo.location, 'GlobalConsensus');
9186
+ originRelayChain = getRelayChainOf(chain);
9187
+ isAssetHubToExternal = chain.startsWith('AssetHub') && isExternalChain(destination);
9188
+ isForeignRelayToExternal = isExternalChain(destination) && !chain.startsWith('AssetHub') && assetInfo.location.parents === 2 && RELAYCHAINS.some(function (relay) {
9189
+ return relay !== originRelayChain && deepEqual(assetGlobalConsensus, _defineProperty({}, relay.toLowerCase(), null));
9190
+ });
9191
+ isRelayAsset = !isForeignRelayToExternal && (isAssetHubToExternal || NO_FEE_ASSET_LOCS.some(function (loc) {
9102
9192
  return deepEqual(assetInfo.location, loc);
9103
- }) || isSubBridge || ((_overrides$noFeeAsset = overrides.noFeeAsset) !== null && _overrides$noFeeAsset !== void 0 ? _overrides$noFeeAsset : false);
9193
+ }) || isSubBridge || ((_overrides$noFeeAsset = overrides.noFeeAsset) !== null && _overrides$noFeeAsset !== void 0 ? _overrides$noFeeAsset : false));
9194
+ bridgeHopChain = !chain.startsWith('AssetHub') && assetGlobalConsensus !== undefined ? "AssetHub".concat(originRelayChain) : undefined;
9104
9195
  destApi = api.clone();
9105
9196
  _context.n = 1;
9106
- return destApi.init(destinationChain);
9197
+ return destApi.init(destination);
9107
9198
  case 1:
9108
- reserveApi = reserveChain === chain ? api : reserveChain === destinationChain ? destApi : api.clone();
9199
+ reserveApi = reserveChain === chain ? api : reserveChain === destination ? destApi : api.clone();
9109
9200
  _context.n = 2;
9110
9201
  return reserveApi.init(reserveChain);
9111
9202
  case 2:
@@ -9116,7 +9207,7 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
9116
9207
  },
9117
9208
  dest: {
9118
9209
  api: destApi,
9119
- chain: destinationChain
9210
+ chain: destination
9120
9211
  },
9121
9212
  reserve: {
9122
9213
  api: reserveApi,
@@ -9127,7 +9218,8 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
9127
9218
  isRelayAsset: isRelayAsset,
9128
9219
  assetInfo: assetInfo,
9129
9220
  options: options,
9130
- systemAsset: systemAsset
9221
+ systemAsset: systemAsset,
9222
+ bridgeHopChain: bridgeHopChain
9131
9223
  });
9132
9224
  }
9133
9225
  }, _callee);
@@ -9149,24 +9241,39 @@ var resolveBuyExecutionAmount = function resolveBuyExecutionAmount(_ref, isForFe
9149
9241
  // We have actual fees, calculate exact buy execution amount
9150
9242
  return isRelayAsset ? assetInfo.amount - hopFees : destFee;
9151
9243
  };
9244
+ var resolveSnowbridgeMessageId = function resolveSnowbridgeMessageId(_ref3) {
9245
+ var origin = _ref3.origin,
9246
+ isSnowbridge = _ref3.isSnowbridge,
9247
+ assetInfo = _ref3.assetInfo,
9248
+ _ref3$options = _ref3.options,
9249
+ sender = _ref3$options.sender,
9250
+ recipient = _ref3$options.recipient;
9251
+ if (!isSnowbridge) return Promise.resolve(null);
9252
+ assertSender(sender);
9253
+ return generateMessageId(origin.api, sender, getParaId(origin.chain), JSON.stringify(assetInfo.location), JSON.stringify(recipient), assetInfo.amount);
9254
+ };
9152
9255
  var createCustomXcm = /*#__PURE__*/function () {
9153
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, assetCount, isForFeeCalc, systemAssetAmount, refundInstruction) {
9256
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, assetCount, isForFeeCalc, systemAssetAmount) {
9154
9257
  var fees,
9155
9258
  origin,
9156
9259
  dest,
9157
9260
  reserve,
9158
9261
  isSubBridge,
9159
- isSnowbridge,
9160
9262
  isRelayAsset,
9161
9263
  assetInfo,
9264
+ bridgeHopChain,
9162
9265
  options,
9163
9266
  destination,
9164
9267
  version,
9165
- sender,
9166
9268
  recipient,
9167
9269
  paraIdTo,
9270
+ sender,
9271
+ ahAddress,
9272
+ buildRefundInstruction,
9168
9273
  hopFees,
9169
9274
  destFee,
9275
+ messageId,
9276
+ setTopic,
9170
9277
  feeAssetLocation,
9171
9278
  feeLocLocalized,
9172
9279
  assetLocLocalized,
@@ -9174,22 +9281,59 @@ var createCustomXcm = /*#__PURE__*/function () {
9174
9281
  allOfSelector,
9175
9282
  depositInstruction,
9176
9283
  assetsFilter,
9284
+ isAssetEthereumNative,
9177
9285
  buyExecutionAmount,
9178
9286
  filter,
9287
+ buyExecutionAsset,
9179
9288
  buyExecution,
9180
9289
  destLoc,
9181
- messageId,
9290
+ _refund,
9291
+ buyExecutionAtReserve,
9292
+ _refund2,
9293
+ refund,
9182
9294
  _args = arguments;
9183
9295
  return _regenerator().w(function (_context) {
9184
9296
  while (1) switch (_context.n) {
9185
9297
  case 0:
9186
- fees = _args.length > 5 && _args[5] !== undefined ? _args[5] : {
9298
+ fees = _args.length > 4 && _args[4] !== undefined ? _args[4] : {
9187
9299
  hopFees: 0n,
9188
9300
  destFee: 0n
9189
9301
  };
9190
- origin = context.origin, dest = context.dest, reserve = context.reserve, isSubBridge = context.isSubBridge, isSnowbridge = context.isSnowbridge, isRelayAsset = context.isRelayAsset, assetInfo = context.assetInfo, options = context.options;
9191
- destination = options.destination, version = options.version, sender = options.sender, recipient = options.recipient, paraIdTo = options.paraIdTo;
9302
+ origin = context.origin, dest = context.dest, reserve = context.reserve, isSubBridge = context.isSubBridge, isRelayAsset = context.isRelayAsset, assetInfo = context.assetInfo, bridgeHopChain = context.bridgeHopChain, options = context.options;
9303
+ destination = options.destination, version = options.version, recipient = options.recipient, paraIdTo = options.paraIdTo, sender = options.sender, ahAddress = options.ahAddress;
9304
+ buildRefundInstruction = function buildRefundInstruction() {
9305
+ if (!sender || isSubBridge) return null;
9306
+ var resolveRefundAddress = function resolveRefundAddress() {
9307
+ if (ahAddress) return ahAddress;
9308
+ if (!isChainEvm(origin.chain)) return sender;
9309
+ if (!isChainEvm(dest.chain)) return recipient;
9310
+ throw new MissingParameterError('ahAddress');
9311
+ };
9312
+ return {
9313
+ SetAppendix: [{
9314
+ DepositAsset: {
9315
+ assets: {
9316
+ Wild: {
9317
+ AllCounted: assetCount
9318
+ }
9319
+ },
9320
+ beneficiary: createBeneficiaryLocation({
9321
+ api: origin.api,
9322
+ address: resolveRefundAddress(),
9323
+ version: version
9324
+ })
9325
+ }
9326
+ }]
9327
+ };
9328
+ };
9192
9329
  hopFees = fees.hopFees, destFee = fees.destFee;
9330
+ _context.n = 1;
9331
+ return resolveSnowbridgeMessageId(context);
9332
+ case 1:
9333
+ messageId = _context.v;
9334
+ setTopic = messageId ? [{
9335
+ SetTopic: messageId
9336
+ }] : [];
9193
9337
  feeAssetLocation = !isRelayAsset ? RELAY_LOCATION : assetInfo.location;
9194
9338
  feeLocLocalized = localizeLocation(dest.chain, feeAssetLocation, origin.chain);
9195
9339
  assetLocLocalized = localizeLocation(dest.chain, assetInfo.location, origin.chain);
@@ -9215,19 +9359,20 @@ var createCustomXcm = /*#__PURE__*/function () {
9215
9359
  }
9216
9360
  };
9217
9361
  assetsFilter = [];
9218
- if (!isRelayAsset) assetsFilter.push(createAsset(version, hopFees + destFee, localizeLocation(reserve.chain, RELAY_LOCATION)));
9362
+ if (!isRelayAsset && !isExternalChain(dest.chain)) assetsFilter.push(createAsset(version, hopFees + destFee, localizeLocation(reserve.chain, RELAY_LOCATION)));
9219
9363
  assetsFilter.push(createAsset(version, assetInfo.amount, normalizeLocation(localizeLocation(reserve.chain, assetInfo.location), version)));
9220
- if (!(isSubBridge || origin.chain !== reserve.chain && dest.chain !== reserve.chain)) {
9221
- _context.n = 4;
9364
+ isAssetEthereumNative = deepEqual(getJunctionValue(assetInfo.location, 'GlobalConsensus'), getEthereumJunction(origin.chain, false).GlobalConsensus);
9365
+ if (!(isSubBridge || bridgeHopChain || origin.chain !== reserve.chain && dest.chain !== reserve.chain)) {
9366
+ _context.n = 6;
9222
9367
  break;
9223
9368
  }
9224
- buyExecutionAmount = resolveBuyExecutionAmount(context, isForFeeCalc, fees, systemAssetAmount);
9369
+ buyExecutionAmount = isExternalChain(dest.chain) ? 1n : resolveBuyExecutionAmount(context, isForFeeCalc, fees, systemAssetAmount);
9225
9370
  if (!(buyExecutionAmount < 0n && !isForFeeCalc)) {
9226
- _context.n = 1;
9371
+ _context.n = 2;
9227
9372
  break;
9228
9373
  }
9229
9374
  throw new AmountTooLowError();
9230
- case 1:
9375
+ case 2:
9231
9376
  filter = isForFeeCalc ? {
9232
9377
  Wild: {
9233
9378
  AllCounted: assetCount
@@ -9235,81 +9380,78 @@ var createCustomXcm = /*#__PURE__*/function () {
9235
9380
  } : {
9236
9381
  Definite: assetsFilter
9237
9382
  };
9383
+ buyExecutionAsset = isExternalChain(dest.chain) ? createAsset(version, buyExecutionAmount, assetLocLocalized) : createAsset(version, normalizeAmount(buyExecutionAmount), feeLocLocalized);
9238
9384
  buyExecution = {
9239
9385
  BuyExecution: {
9240
- fees: createAsset(version, normalizeAmount(buyExecutionAmount), feeLocLocalized),
9386
+ fees: buyExecutionAsset,
9241
9387
  weight_limit: 'Unlimited'
9242
9388
  }
9243
9389
  };
9244
9390
  if (!isSubBridge) {
9245
- _context.n = 2;
9391
+ _context.n = 3;
9246
9392
  break;
9247
9393
  }
9248
9394
  return _context.a(2, [buyExecution, depositInstruction]);
9249
- case 2:
9395
+ case 3:
9250
9396
  destLoc = createDestination(version, origin.chain, destination, paraIdTo); // If both reserve (B) and destination (C) are trusted chains,
9251
9397
  // use teleport instead of DepositReserveAsset
9252
9398
  if (!(isTrustedChain(reserve.chain) && isTrustedChain(dest.chain))) {
9253
- _context.n = 3;
9399
+ _context.n = 4;
9254
9400
  break;
9255
9401
  }
9256
- return _context.a(2, [].concat(_toConsumableArray(refundInstruction ? [refundInstruction] : []), [{
9402
+ _refund = buildRefundInstruction();
9403
+ return _context.a(2, [].concat(_toConsumableArray(_refund ? [_refund] : []), [{
9257
9404
  InitiateTeleport: {
9258
9405
  assets: filter,
9259
9406
  dest: destLoc,
9260
- xcm: [buyExecution, depositInstruction]
9261
- }
9262
- }]));
9263
- case 3:
9264
- return _context.a(2, [].concat(_toConsumableArray(refundInstruction ? [refundInstruction] : []), [{
9265
- DepositReserveAsset: {
9266
- assets: filter,
9267
- dest: destLoc,
9268
- xcm: [buyExecution, depositInstruction]
9407
+ xcm: [buyExecution, depositInstruction].concat(setTopic)
9269
9408
  }
9270
- }]));
9409
+ }], setTopic));
9271
9410
  case 4:
9272
- if (!isSnowbridge) {
9273
- _context.n = 6;
9411
+ if (!(isExternalChain(dest.chain) && (isAssetEthereumNative || origin.chain === 'Mythos'))) {
9412
+ _context.n = 5;
9274
9413
  break;
9275
9414
  }
9276
- assertSender(sender);
9277
- _context.n = 5;
9278
- return generateMessageId(origin.api, sender, getParaId(origin.chain), JSON.stringify(assetInfo.location), JSON.stringify(recipient), assetInfo.amount);
9415
+ buyExecutionAtReserve = {
9416
+ BuyExecution: {
9417
+ fees: buyExecutionAsset,
9418
+ weight_limit: 'Unlimited'
9419
+ }
9420
+ };
9421
+ _refund2 = buildRefundInstruction();
9422
+ return _context.a(2, [].concat(_toConsumableArray(_refund2 ? [_refund2] : []), [{
9423
+ InitiateReserveWithdraw: {
9424
+ assets: {
9425
+ Wild: {
9426
+ AllOf: {
9427
+ id: assetInfo.location,
9428
+ fun: 'Fungible'
9429
+ }
9430
+ }
9431
+ },
9432
+ reserve: destLoc,
9433
+ xcm: [buyExecutionAtReserve, depositInstruction].concat(setTopic)
9434
+ }
9435
+ }], setTopic));
9279
9436
  case 5:
9280
- messageId = _context.v;
9281
- return _context.a(2, [depositInstruction, {
9282
- SetTopic: messageId
9283
- }]);
9437
+ refund = buildRefundInstruction();
9438
+ return _context.a(2, [].concat(_toConsumableArray(refund ? [refund] : []), [{
9439
+ DepositReserveAsset: {
9440
+ assets: filter,
9441
+ dest: destLoc,
9442
+ xcm: [buyExecution, depositInstruction].concat(setTopic)
9443
+ }
9444
+ }], setTopic));
9284
9445
  case 6:
9285
- return _context.a(2, [depositInstruction]);
9446
+ return _context.a(2, [depositInstruction].concat(setTopic));
9286
9447
  }
9287
9448
  }, _callee);
9288
9449
  }));
9289
- return function createCustomXcm(_x, _x2, _x3, _x4, _x5) {
9290
- return _ref3.apply(this, arguments);
9450
+ return function createCustomXcm(_x, _x2, _x3, _x4) {
9451
+ return _ref4.apply(this, arguments);
9291
9452
  };
9292
9453
  }();
9293
9454
 
9294
- var createRefundInstruction = function createRefundInstruction(api, address, version, assetCount) {
9295
- return {
9296
- SetAppendix: [{
9297
- DepositAsset: {
9298
- assets: {
9299
- Wild: {
9300
- AllCounted: assetCount
9301
- }
9302
- },
9303
- beneficiary: createBeneficiaryLocation({
9304
- api: api,
9305
- address: address,
9306
- version: version
9307
- })
9308
- }
9309
- }]
9310
- };
9311
- };
9312
-
9313
9455
  var buildAssets = function buildAssets(chain, asset, feeAmount, isRelayAsset, _ref) {
9314
9456
  var version = _ref.version,
9315
9457
  overriddenAsset = _ref.overriddenAsset;
@@ -9331,26 +9473,25 @@ var resolveAssetCount = function resolveAssetCount(overriddenAsset, isRelayAsset
9331
9473
  return isRelayAsset ? 1 : 2;
9332
9474
  };
9333
9475
  var DEFAULT_SYSTEM_ASSET_AMOUNT = '1';
9476
+ var DEFAULT_SYSTEM_ASSET_AMOUNT_EXTERNAL = '10';
9334
9477
  var resolveSystemAssetAmount = function resolveSystemAssetAmount(_ref2, isForFeeCalc, fees) {
9335
- var systemAsset = _ref2.systemAsset;
9478
+ var systemAsset = _ref2.systemAsset,
9479
+ dest = _ref2.dest;
9336
9480
  if (isForFeeCalc) {
9337
- return parseUnits(DEFAULT_SYSTEM_ASSET_AMOUNT, systemAsset.decimals);
9481
+ var defaultAmount = isExternalChain(dest.chain) ? DEFAULT_SYSTEM_ASSET_AMOUNT_EXTERNAL : DEFAULT_SYSTEM_ASSET_AMOUNT;
9482
+ return parseUnits(defaultAmount, systemAsset.decimals);
9338
9483
  }
9339
- return fees.destFee + fees.hopFees;
9484
+ return normalizeAmount(fees.destFee + fees.hopFees);
9340
9485
  };
9341
9486
  var constructTypeAndThenCall = /*#__PURE__*/function () {
9342
9487
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context) {
9343
9488
  var fees,
9344
9489
  origin,
9345
9490
  assetInfo,
9346
- isSubBridge,
9347
9491
  isRelayAsset,
9348
9492
  options,
9349
- sender,
9350
- version,
9351
9493
  overriddenAsset,
9352
9494
  assetCount,
9353
- refundInstruction,
9354
9495
  resolvedFees,
9355
9496
  isForFeeCalc,
9356
9497
  systemAssetAmount,
@@ -9361,10 +9502,9 @@ var constructTypeAndThenCall = /*#__PURE__*/function () {
9361
9502
  while (1) switch (_context.n) {
9362
9503
  case 0:
9363
9504
  fees = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
9364
- origin = context.origin, assetInfo = context.assetInfo, isSubBridge = context.isSubBridge, isRelayAsset = context.isRelayAsset, options = context.options;
9365
- sender = options.sender, version = options.version, overriddenAsset = options.overriddenAsset;
9505
+ origin = context.origin, assetInfo = context.assetInfo, isRelayAsset = context.isRelayAsset, options = context.options;
9506
+ overriddenAsset = options.overriddenAsset;
9366
9507
  assetCount = resolveAssetCount(overriddenAsset, isRelayAsset);
9367
- refundInstruction = sender && !isSubBridge ? createRefundInstruction(origin.api, sender, version, assetCount) : null;
9368
9508
  resolvedFees = fees !== null && fees !== void 0 ? fees : {
9369
9509
  hopFees: 0n,
9370
9510
  destFee: 0n
@@ -9372,7 +9512,7 @@ var constructTypeAndThenCall = /*#__PURE__*/function () {
9372
9512
  isForFeeCalc = fees === null;
9373
9513
  systemAssetAmount = resolveSystemAssetAmount(context, isForFeeCalc, resolvedFees);
9374
9514
  _context.n = 1;
9375
- return createCustomXcm(context, assetCount, isForFeeCalc, systemAssetAmount, refundInstruction, resolvedFees);
9515
+ return createCustomXcm(context, assetCount, isForFeeCalc, systemAssetAmount, resolvedFees);
9376
9516
  case 1:
9377
9517
  customXcm = _context.v;
9378
9518
  assets = buildAssets(origin.chain, assetInfo, systemAssetAmount, isRelayAsset, options);
@@ -10092,6 +10232,8 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
10092
10232
  paraIdTo = options.paraIdTo,
10093
10233
  transactOptions = options.transactOptions,
10094
10234
  useFeeAssetOnHops = options.useFeeAssetOnHops,
10235
+ _options$forceBuyExec = options.forceBuyExecution,
10236
+ forceBuyExecution = _options$forceBuyExec === void 0 ? false : _options$forceBuyExec,
10095
10237
  _options$suffixXcm = options.suffixXcm,
10096
10238
  suffixXcm = _options$suffixXcm === void 0 ? [] : _options$suffixXcm;
10097
10239
  var _prepareExecuteContex = prepareExecuteContext(options),
@@ -10123,7 +10265,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
10123
10265
  DepositReserveAsset: {
10124
10266
  assets: createAssetsFilter(assetLocalizedToReserve, version),
10125
10267
  dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
10126
- xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, reserveFee === 1000n ? amount / 2n : amount - originFeeDeduction - reserveFee))), _toConsumableArray(suffixXcm))
10268
+ xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, reserveFee === 1000n ? amount / 2n : amount - originFeeDeduction - reserveFee), undefined, true, forceBuyExecution)), _toConsumableArray(suffixXcm))
10127
10269
  }
10128
10270
  }];
10129
10271
  var mainInstructions;
@@ -10150,7 +10292,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
10150
10292
  InitiateTeleport: {
10151
10293
  assets: routingAssetsFilter,
10152
10294
  dest: destLocation,
10153
- xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, amount - originFeeDeduction))), _toConsumableArray(suffixXcm))
10295
+ xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToDest !== null && hopFeeAssetToDest !== void 0 ? hopFeeAssetToDest : updateAsset(assetLocalizedToDest, amount - originFeeDeduction), undefined, true, forceBuyExecution)), _toConsumableArray(suffixXcm))
10154
10296
  }
10155
10297
  }];
10156
10298
  break;
@@ -10160,7 +10302,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
10160
10302
  InitiateTeleport: {
10161
10303
  assets: routingAssetsFilter,
10162
10304
  dest: getChainLocation(chain, reserveChain),
10163
- xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToReserve !== null && hopFeeAssetToReserve !== void 0 ? hopFeeAssetToReserve : updateAsset(assetLocalizedToReserve, amount - originFeeDeduction))), _toConsumableArray(resolvedDepositInstruction))
10305
+ xcm: [].concat(_toConsumableArray(createPayFees(version, hopFeeAssetToReserve !== null && hopFeeAssetToReserve !== void 0 ? hopFeeAssetToReserve : updateAsset(assetLocalizedToReserve, amount - originFeeDeduction), undefined, true, forceBuyExecution)), _toConsumableArray(resolvedDepositInstruction))
10164
10306
  }
10165
10307
  }];
10166
10308
  break;
@@ -10172,7 +10314,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
10172
10314
  reserve: getChainLocation(chain, reserveChain),
10173
10315
  xcm: [].concat(_toConsumableArray(createPayFees(version, // Decrease amount by 2 units because for some reason polkadot withdraws 2 units less
10174
10316
  // than requested, so we need to account for that
10175
- hopFeeAssetToReserve !== null && hopFeeAssetToReserve !== void 0 ? hopFeeAssetToReserve : updateAsset(assetLocalizedToReserve, amount - 2n))), _toConsumableArray(resolvedDepositInstruction))
10317
+ hopFeeAssetToReserve !== null && hopFeeAssetToReserve !== void 0 ? hopFeeAssetToReserve : updateAsset(assetLocalizedToReserve, amount - 2n), undefined, true, forceBuyExecution)), _toConsumableArray(resolvedDepositInstruction))
10176
10318
  }
10177
10319
  }];
10178
10320
  break;
@@ -10292,7 +10434,9 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
10292
10434
  feeAsset = options.feeAssetInfo,
10293
10435
  useJitWithdraw = options.useJitWithdraw,
10294
10436
  recipient = options.recipient,
10295
- version = options.version;
10437
+ version = options.version,
10438
+ _options$forceBuyExec = options.forceBuyExecution,
10439
+ forceBuyExecution = _options$forceBuyExec === void 0 ? false : _options$forceBuyExec;
10296
10440
  var context = prepareExecuteContext(options);
10297
10441
  var assetLocalized = context.assetLocalized,
10298
10442
  assetLocalizedToDest = context.assetLocalizedToDest,
@@ -10306,7 +10450,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
10306
10450
  prefix.push.apply(prefix, _toConsumableArray(createPayFees(version, feeAssetLocalized !== null && feeAssetLocalized !== void 0 ? feeAssetLocalized : assetLocalized, {
10307
10451
  refTime: 450n,
10308
10452
  proofSize: 0n
10309
- })));
10453
+ }, false, forceBuyExecution)));
10310
10454
  } else {
10311
10455
  prefix.push({
10312
10456
  SetFeesMode: {
@@ -10574,7 +10718,8 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
10574
10718
  originFee: hasSeparateFeeAsset ? ethBridgeFee || originFee : originFee,
10575
10719
  reserveFee: originReserveFee
10576
10720
  },
10577
- version: version
10721
+ version: version,
10722
+ forceBuyExecution: true
10578
10723
  }, assetToLocalizedToDest), prefix = _prepareCommonExecute.prefix, depositInstruction = _prepareCommonExecute.depositInstruction;
10579
10724
  _context2.n = 4;
10580
10725
  return createExchangeInstructions(options, assetFrom, assetTo, isEthereumDest && hasSeparateFeeAsset);
@@ -10611,6 +10756,7 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
10611
10756
  originFee: hasSeparateFeeAsset ? ethBridgeFee : 0n,
10612
10757
  reserveFee: destReserveFee
10613
10758
  },
10759
+ forceBuyExecution: true,
10614
10760
  suffixXcm: snowbridgeInstructions
10615
10761
  });
10616
10762
  _context2.n = 7;
@@ -10628,6 +10774,7 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
10628
10774
  originFee: 0n,
10629
10775
  reserveFee: destReserveFee
10630
10776
  },
10777
+ forceBuyExecution: true,
10631
10778
  suffixXcm: [depositInstruction]
10632
10779
  });
10633
10780
  } else {
@@ -10646,6 +10793,7 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
10646
10793
  originFee: hasSeparateFeeAsset ? ethBridgeFee : 0n,
10647
10794
  reserveFee: originReserveFee
10648
10795
  },
10796
+ forceBuyExecution: true,
10649
10797
  suffixXcm: [].concat(_toConsumableArray(exchangeInstructions), _toConsumableArray(exchangeToDestXcm))
10650
10798
  }) : [].concat(_toConsumableArray(exchangeInstructions), _toConsumableArray(exchangeToDestXcm));
10651
10799
  fullXcm = [].concat(_toConsumableArray(prefix), _toConsumableArray(finalXcm));
@@ -10823,6 +10971,7 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
10823
10971
  while (1) switch (_context3.n) {
10824
10972
  case 0:
10825
10973
  api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetFrom = options.assetInfoFrom, assetTo = options.assetInfoTo, currencyTo = options.currencyTo, feeAssetInfo = options.feeAssetInfo, sender = options.sender, recipient = options.recipient, calculateMinAmountOut = options.calculateMinAmountOut;
10974
+ assertCurrencyCore(currencyTo);
10826
10975
  _context3.n = 1;
10827
10976
  return api.init(chain !== null && chain !== void 0 ? chain : exchangeChain);
10828
10977
  case 1:
@@ -11105,6 +11254,7 @@ var transferPolkadotXcm = /*#__PURE__*/function () {
11105
11254
  version,
11106
11255
  methodOverride,
11107
11256
  paraIdTo,
11257
+ noFeeAsset,
11108
11258
  resolvedMultiAssets,
11109
11259
  destLocation,
11110
11260
  feeAssetIndex,
@@ -11121,10 +11271,11 @@ var transferPolkadotXcm = /*#__PURE__*/function () {
11121
11271
  _context.n = 2;
11122
11272
  break;
11123
11273
  }
11274
+ noFeeAsset = !(_typeof(destination) !== 'object' && isExternalChain(destination));
11124
11275
  _t = api;
11125
11276
  _context.n = 1;
11126
11277
  return createTypeAndThenCall(options, {
11127
- noFeeAsset: true
11278
+ noFeeAsset: noFeeAsset
11128
11279
  });
11129
11280
  case 1:
11130
11281
  return _context.a(2, _t.deserializeExtrinsics.call(_t, _context.v));
@@ -11694,122 +11845,6 @@ var Chain = /*#__PURE__*/function () {
11694
11845
  }
11695
11846
  });
11696
11847
  }
11697
- }, {
11698
- key: "transferToEthereum",
11699
- value: function () {
11700
- var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
11701
- var _feeAsset$location;
11702
- var useOnlyDepositInstruction,
11703
- api,
11704
- asset,
11705
- version,
11706
- sender,
11707
- recipient,
11708
- feeAsset,
11709
- bridgeStatus,
11710
- ethAsset,
11711
- ahApi,
11712
- _yield$getParaEthTran,
11713
- _yield$getParaEthTran2,
11714
- bridgeFee,
11715
- executionFee,
11716
- PARA_TO_PARA_FEE_DOT,
11717
- fee,
11718
- ethAssetInfo,
11719
- systemAssetInfo,
11720
- shouldIncludeFeeAsset,
11721
- customXcmOnDest,
11722
- messageId,
11723
- hopDestination,
11724
- call,
11725
- _args3 = arguments;
11726
- return _regenerator().w(function (_context3) {
11727
- while (1) switch (_context3.n) {
11728
- case 0:
11729
- useOnlyDepositInstruction = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
11730
- api = input.api, asset = input.assetInfo, version = input.version, sender = input.sender, recipient = input.recipient, feeAsset = input.feeAssetInfo;
11731
- _context3.n = 1;
11732
- return getBridgeStatus(api.clone());
11733
- case 1:
11734
- bridgeStatus = _context3.v;
11735
- if (!(bridgeStatus !== 'Normal')) {
11736
- _context3.n = 2;
11737
- break;
11738
- }
11739
- throw new BridgeHaltedError();
11740
- case 2:
11741
- assertAddressIsString(recipient);
11742
- assertSender(sender);
11743
- ethAsset = createAsset(version, asset.amount, asset.location);
11744
- _context3.n = 3;
11745
- return api.createApiForChain('AssetHubPolkadot');
11746
- case 3:
11747
- ahApi = _context3.v;
11748
- _context3.n = 4;
11749
- return getParaEthTransferFees(ahApi);
11750
- case 4:
11751
- _yield$getParaEthTran = _context3.v;
11752
- _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
11753
- bridgeFee = _yield$getParaEthTran2[0];
11754
- executionFee = _yield$getParaEthTran2[1];
11755
- PARA_TO_PARA_FEE_DOT = 5000000000n; // 0.5 DOT
11756
- fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
11757
- ethAssetInfo = findAssetInfoOrThrow('Ethereum', {
11758
- symbol: asset.symbol
11759
- });
11760
- systemAssetInfo = findNativeAssetInfoOrThrow(getRelayChainOf(this.chain));
11761
- shouldIncludeFeeAsset = feeAsset && !isAssetEqual(feeAsset, asset) || !isAssetEqual(asset, systemAssetInfo);
11762
- if (!useOnlyDepositInstruction) {
11763
- _context3.n = 5;
11764
- break;
11765
- }
11766
- customXcmOnDest = addXcmVersionHeader([{
11767
- DepositAsset: {
11768
- assets: {
11769
- Wild: {
11770
- AllCounted: 2
11771
- }
11772
- },
11773
- beneficiary: createBeneficiaryLocation({
11774
- api: api,
11775
- address: recipient,
11776
- version: version
11777
- })
11778
- }
11779
- }], version);
11780
- _context3.n = 7;
11781
- break;
11782
- case 5:
11783
- assertHasId(ethAssetInfo);
11784
- _context3.n = 6;
11785
- return generateMessageId(api, sender, getParaId(this.chain), ethAssetInfo.assetId, recipient, asset.amount);
11786
- case 6:
11787
- messageId = _context3.v;
11788
- customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId, ethAssetInfo);
11789
- case 7:
11790
- hopDestination = 'AssetHubPolkadot';
11791
- call = {
11792
- module: 'PolkadotXcm',
11793
- method: 'transfer_assets_using_type_and_then',
11794
- params: {
11795
- dest: createVersionedDestination(version, this.chain, hopDestination, getParaId(hopDestination)),
11796
- assets: addXcmVersionHeader([].concat(_toConsumableArray(shouldIncludeFeeAsset ? [createAsset(version, fee, DOT_LOCATION)] : []), [ethAsset]), version),
11797
- assets_transfer_type: 'DestinationReserve',
11798
- remote_fees_id: addXcmVersionHeader((_feeAsset$location = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.location) !== null && _feeAsset$location !== void 0 ? _feeAsset$location : shouldIncludeFeeAsset ? DOT_LOCATION : asset.location, version),
11799
- fees_transfer_type: 'DestinationReserve',
11800
- custom_xcm_on_dest: customXcmOnDest,
11801
- weight_limit: 'Unlimited'
11802
- }
11803
- };
11804
- return _context3.a(2, api.deserializeExtrinsics(call));
11805
- }
11806
- }, _callee3, this);
11807
- }));
11808
- function transferToEthereum(_x3) {
11809
- return _transferToEthereum.apply(this, arguments);
11810
- }
11811
- return transferToEthereum;
11812
- }()
11813
11848
  }, {
11814
11849
  key: "getBalanceNative",
11815
11850
  value: function getBalanceNative(api, address, asset) {
@@ -11824,60 +11859,60 @@ var Chain = /*#__PURE__*/function () {
11824
11859
  }, {
11825
11860
  key: "getBalanceForeign",
11826
11861
  value: function () {
11827
- var _getBalanceForeign = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(api, address, asset) {
11862
+ var _getBalanceForeign = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(api, address, asset) {
11828
11863
  var pallets, lastError, customCurrencyId, _iterator, _step, pallet, instance, _t2, _t3;
11829
- return _regenerator().w(function (_context4) {
11830
- while (1) switch (_context4.p = _context4.n) {
11864
+ return _regenerator().w(function (_context3) {
11865
+ while (1) switch (_context3.p = _context3.n) {
11831
11866
  case 0:
11832
11867
  pallets = getOtherAssetsPallets(this.chain);
11833
11868
  if (!(pallets.length === 0)) {
11834
- _context4.n = 1;
11869
+ _context3.n = 1;
11835
11870
  break;
11836
11871
  }
11837
11872
  throw new RoutingResolutionError("No foreign asset pallets found for ".concat(this.chain));
11838
11873
  case 1:
11839
11874
  customCurrencyId = this.getCustomCurrencyId(asset);
11840
11875
  _iterator = _createForOfIteratorHelper(pallets);
11841
- _context4.p = 2;
11876
+ _context3.p = 2;
11842
11877
  _iterator.s();
11843
11878
  case 3:
11844
11879
  if ((_step = _iterator.n()).done) {
11845
- _context4.n = 8;
11880
+ _context3.n = 8;
11846
11881
  break;
11847
11882
  }
11848
11883
  pallet = _step.value;
11849
11884
  instance = getPalletInstance(pallet);
11850
- _context4.p = 4;
11851
- _context4.n = 5;
11885
+ _context3.p = 4;
11886
+ _context3.n = 5;
11852
11887
  return instance.getBalance(api, address, asset, customCurrencyId);
11853
11888
  case 5:
11854
- return _context4.a(2, _context4.v);
11889
+ return _context3.a(2, _context3.v);
11855
11890
  case 6:
11856
- _context4.p = 6;
11857
- _t2 = _context4.v;
11891
+ _context3.p = 6;
11892
+ _t2 = _context3.v;
11858
11893
  lastError = _t2;
11859
11894
  case 7:
11860
- _context4.n = 3;
11895
+ _context3.n = 3;
11861
11896
  break;
11862
11897
  case 8:
11863
- _context4.n = 10;
11898
+ _context3.n = 10;
11864
11899
  break;
11865
11900
  case 9:
11866
- _context4.p = 9;
11867
- _t3 = _context4.v;
11901
+ _context3.p = 9;
11902
+ _t3 = _context3.v;
11868
11903
  _iterator.e(_t3);
11869
11904
  case 10:
11870
- _context4.p = 10;
11905
+ _context3.p = 10;
11871
11906
  _iterator.f();
11872
- return _context4.f(10);
11907
+ return _context3.f(10);
11873
11908
  case 11:
11874
11909
  throw lastError;
11875
11910
  case 12:
11876
- return _context4.a(2);
11911
+ return _context3.a(2);
11877
11912
  }
11878
- }, _callee4, this, [[4, 6], [2, 9, 10, 11]]);
11913
+ }, _callee3, this, [[4, 6], [2, 9, 10, 11]]);
11879
11914
  }));
11880
- function getBalanceForeign(_x4, _x5, _x6) {
11915
+ function getBalanceForeign(_x3, _x4, _x5) {
11881
11916
  return _getBalanceForeign.apply(this, arguments);
11882
11917
  }
11883
11918
  return getBalanceForeign;
@@ -12105,99 +12140,47 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
12105
12140
  }
12106
12141
  _inherits(AssetHubPolkadot, _Chain);
12107
12142
  return _createClass(AssetHubPolkadot, [{
12108
- key: "handleEthBridgeNativeTransfer",
12109
- value: function () {
12110
- var _handleEthBridgeNativeTransfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
12111
- var api, version, destination, sender, recipient, paraIdTo, asset, messageId, location, call;
12112
- return _regenerator().w(function (_context) {
12113
- while (1) switch (_context.n) {
12114
- case 0:
12115
- api = input.api, version = input.version, destination = input.destination, sender = input.sender, recipient = input.recipient, paraIdTo = input.paraIdTo, asset = input.assetInfo;
12116
- assertSender(sender);
12117
- _context.n = 1;
12118
- return generateMessageId(api, sender, getParaId(this.chain), JSON.stringify(asset.location), JSON.stringify(recipient), asset.amount);
12119
- case 1:
12120
- messageId = _context.v;
12121
- location = asset.symbol === this.getNativeAssetSymbol() ? DOT_LOCATION : asset.location;
12122
- call = {
12123
- module: 'PolkadotXcm',
12124
- method: 'transfer_assets_using_type_and_then',
12125
- params: {
12126
- dest: createVersionedDestination(this.version, this.chain, destination, paraIdTo, getEthereumJunction(this.chain), Parents.TWO),
12127
- assets: addXcmVersionHeader([createAsset(version, asset.amount, location)], version),
12128
- assets_transfer_type: 'LocalReserve',
12129
- remote_fees_id: addXcmVersionHeader(location, version),
12130
- fees_transfer_type: 'LocalReserve',
12131
- custom_xcm_on_dest: addXcmVersionHeader([{
12132
- DepositAsset: {
12133
- assets: {
12134
- Wild: {
12135
- AllCounted: 1
12136
- }
12137
- },
12138
- beneficiary: createBeneficiaryLocation({
12139
- api: api,
12140
- address: recipient,
12141
- version: version
12142
- })
12143
- }
12144
- }, {
12145
- SetTopic: messageId
12146
- }], version),
12147
- weight_limit: 'Unlimited'
12148
- }
12149
- };
12150
- return _context.a(2, api.deserializeExtrinsics(call));
12151
- }
12152
- }, _callee, this);
12153
- }));
12154
- function handleEthBridgeNativeTransfer(_x) {
12155
- return _handleEthBridgeNativeTransfer.apply(this, arguments);
12156
- }
12157
- return handleEthBridgeNativeTransfer;
12158
- }()
12159
- }, {
12160
12143
  key: "transferPolkadotXCM",
12161
12144
  value: function () {
12162
- var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
12145
+ var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
12163
12146
  var api, assetInfo, feeAssetInfo, overriddenAsset, isNativeAsset, isNativeFeeAsset, _t;
12164
- return _regenerator().w(function (_context2) {
12165
- while (1) switch (_context2.n) {
12147
+ return _regenerator().w(function (_context) {
12148
+ while (1) switch (_context.n) {
12166
12149
  case 0:
12167
12150
  api = options.api, assetInfo = options.assetInfo, feeAssetInfo = options.feeAssetInfo, overriddenAsset = options.overriddenAsset;
12168
12151
  if (!feeAssetInfo) {
12169
- _context2.n = 4;
12152
+ _context.n = 4;
12170
12153
  break;
12171
12154
  }
12172
12155
  if (!overriddenAsset) {
12173
- _context2.n = 1;
12156
+ _context.n = 1;
12174
12157
  break;
12175
12158
  }
12176
12159
  throw new InvalidCurrencyError('Cannot use overridden multi-assets with XCM execute');
12177
12160
  case 1:
12178
12161
  if (!isSymbolMatch(assetInfo.symbol, 'KSM')) {
12179
- _context2.n = 2;
12162
+ _context.n = 2;
12180
12163
  break;
12181
12164
  }
12182
- return _context2.a(2, transferPolkadotXcm(options));
12165
+ return _context.a(2, transferPolkadotXcm(options));
12183
12166
  case 2:
12184
12167
  isNativeAsset = isSymbolMatch(assetInfo.symbol, this.getNativeAssetSymbol());
12185
12168
  isNativeFeeAsset = isSymbolMatch(feeAssetInfo.symbol, this.getNativeAssetSymbol());
12186
12169
  if (!(!isNativeAsset || !isNativeFeeAsset)) {
12187
- _context2.n = 4;
12170
+ _context.n = 4;
12188
12171
  break;
12189
12172
  }
12190
12173
  _t = api;
12191
- _context2.n = 3;
12174
+ _context.n = 3;
12192
12175
  return handleExecuteTransfer(options);
12193
12176
  case 3:
12194
- return _context2.a(2, _t.deserializeExtrinsics.call(_t, _context2.v));
12177
+ return _context.a(2, _t.deserializeExtrinsics.call(_t, _context.v));
12195
12178
  case 4:
12196
- return _context2.a(2, transferPolkadotXcm(options));
12179
+ return _context.a(2, transferPolkadotXcm(options));
12197
12180
  }
12198
- }, _callee2, this);
12181
+ }, _callee, this);
12199
12182
  }));
12200
- function transferPolkadotXCM(_x2) {
12183
+ function transferPolkadotXCM(_x) {
12201
12184
  return _transferPolkadotXCM.apply(this, arguments);
12202
12185
  }
12203
12186
  return transferPolkadotXCM;
@@ -12368,40 +12351,34 @@ var Hydration = /*#__PURE__*/function (_Chain) {
12368
12351
  while (1) switch (_context.n) {
12369
12352
  case 0:
12370
12353
  destination = input.destination, asset = input.assetInfo, feeAsset = input.feeAssetInfo, overriddenAsset = input.overriddenAsset, api = input.api;
12371
- if (!(destination === 'Ethereum')) {
12372
- _context.n = 1;
12373
- break;
12374
- }
12375
- return _context.a(2, this.transferToEthereum(input));
12376
- case 1:
12377
12354
  if (!feeAsset) {
12378
- _context.n = 4;
12355
+ _context.n = 3;
12379
12356
  break;
12380
12357
  }
12381
12358
  if (!overriddenAsset) {
12382
- _context.n = 2;
12359
+ _context.n = 1;
12383
12360
  break;
12384
12361
  }
12385
12362
  throw new InvalidCurrencyError('Cannot use overridden assets with XCM execute');
12386
- case 2:
12363
+ case 1:
12387
12364
  isNativeAsset = isSymbolMatch(asset.symbol, this.getNativeAssetSymbol());
12388
12365
  isNativeFeeAsset = isSymbolMatch(feeAsset.symbol, this.getNativeAssetSymbol());
12389
12366
  if (!(!isNativeAsset || !isNativeFeeAsset)) {
12390
- _context.n = 4;
12367
+ _context.n = 3;
12391
12368
  break;
12392
12369
  }
12393
12370
  _t = api;
12394
- _context.n = 3;
12371
+ _context.n = 2;
12395
12372
  return handleExecuteTransfer(input);
12396
- case 3:
12373
+ case 2:
12397
12374
  return _context.a(2, _t.deserializeExtrinsics.call(_t, _context.v));
12398
- case 4:
12375
+ case 3:
12399
12376
  if (!(isMoonbeamWhAsset(asset.location) && destination === 'Moonbeam')) {
12400
- _context.n = 5;
12377
+ _context.n = 4;
12401
12378
  break;
12402
12379
  }
12403
12380
  return _context.a(2, this.transferMoonbeamWhAsset(input));
12404
- case 5:
12381
+ case 4:
12405
12382
  return _context.a(2, transferPolkadotXcm(input));
12406
12383
  }
12407
12384
  }, _callee, this);
@@ -12544,10 +12521,6 @@ var BifrostPolkadot = /*#__PURE__*/function (_Chain) {
12544
12521
  }, {
12545
12522
  key: "transferPolkadotXCM",
12546
12523
  value: function transferPolkadotXCM(options) {
12547
- var destination = options.destination;
12548
- if (destination === 'Ethereum') {
12549
- return this.transferToEthereum(options);
12550
- }
12551
12524
  return transferPolkadotXcm(options);
12552
12525
  }
12553
12526
  }, {
@@ -13383,56 +13356,6 @@ var LaosPaseo = /*#__PURE__*/function (_Laos) {
13383
13356
  return _createClass(LaosPaseo);
13384
13357
  }(Laos);
13385
13358
 
13386
- var Manta = /*#__PURE__*/function (_Chain) {
13387
- function Manta() {
13388
- _classCallCheck(this, Manta);
13389
- return _callSuper(this, Manta, ['Manta', 'manta', 'Polkadot', Version.V3]);
13390
- }
13391
- _inherits(Manta, _Chain);
13392
- return _createClass(Manta, [{
13393
- key: "getAssetId",
13394
- value: function getAssetId(asset) {
13395
- if (asset.symbol === this.getNativeAssetSymbol()) return Manta.NATIVE_ASSET_ID;
13396
- assertHasId(asset);
13397
- return BigInt(asset.assetId);
13398
- }
13399
- }, {
13400
- key: "transferXTokens",
13401
- value: function transferXTokens$1(input) {
13402
- var asset = input.asset;
13403
- var currencySelection = {
13404
- MantaCurrency: this.getAssetId(asset)
13405
- };
13406
- return transferXTokens(input, currencySelection);
13407
- }
13408
- }, {
13409
- key: "transferLocalNonNativeAsset",
13410
- value: function transferLocalNonNativeAsset(options) {
13411
- var api = options.api,
13412
- asset = options.assetInfo,
13413
- recipient = options.recipient,
13414
- balance = options.balance,
13415
- isAmountAll = options.isAmountAll,
13416
- keepAlive = options.keepAlive;
13417
- assertHasId(asset);
13418
- var assetId = BigInt(asset.assetId);
13419
- var amount = isAmountAll ? balance : asset.amount;
13420
- return api.deserializeExtrinsics({
13421
- module: 'Assets',
13422
- method: keepAlive ? 'transfer_keep_alive' : 'transfer',
13423
- params: {
13424
- id: assetId,
13425
- target: {
13426
- Id: recipient
13427
- },
13428
- amount: amount
13429
- }
13430
- });
13431
- }
13432
- }]);
13433
- }(Chain);
13434
- Manta.NATIVE_ASSET_ID = 1n;
13435
-
13436
13359
  var Moonbeam = /*#__PURE__*/function (_Chain) {
13437
13360
  function Moonbeam() {
13438
13361
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Moonbeam';
@@ -13445,28 +13368,9 @@ var Moonbeam = /*#__PURE__*/function (_Chain) {
13445
13368
  _inherits(Moonbeam, _Chain);
13446
13369
  return _createClass(Moonbeam, [{
13447
13370
  key: "transferPolkadotXCM",
13448
- value: function () {
13449
- var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
13450
- var destination;
13451
- return _regenerator().w(function (_context) {
13452
- while (1) switch (_context.n) {
13453
- case 0:
13454
- destination = options.destination;
13455
- if (!(destination === 'Ethereum')) {
13456
- _context.n = 1;
13457
- break;
13458
- }
13459
- return _context.a(2, this.transferToEthereum(options));
13460
- case 1:
13461
- return _context.a(2, transferPolkadotXcm(options));
13462
- }
13463
- }, _callee, this);
13464
- }));
13465
- function transferPolkadotXCM(_x) {
13466
- return _transferPolkadotXCM.apply(this, arguments);
13467
- }
13468
- return transferPolkadotXCM;
13469
- }()
13371
+ value: function transferPolkadotXCM(options) {
13372
+ return transferPolkadotXcm(options);
13373
+ }
13470
13374
  }, {
13471
13375
  key: "transferLocalNonNativeAsset",
13472
13376
  value: function transferLocalNonNativeAsset(_options) {
@@ -14129,7 +14033,6 @@ var chains = function chains() {
14129
14033
  CoretimePolkadot: new CoretimePolkadot(),
14130
14034
  PeoplePolkadot: new PeoplePolkadot(),
14131
14035
  RobonomicsPolkadot: new RobonomicsPolkadot(),
14132
- Manta: new Manta(),
14133
14036
  NeuroWeb: new NeuroWeb(),
14134
14037
  Pendulum: new Pendulum(),
14135
14038
  Collectives: new Collectives(),
@@ -14210,6 +14113,8 @@ var MAX_WEIGHT = {
14210
14113
  refTime: MAX_U64
14211
14114
  };
14212
14115
  var BYPASS_MINT_AMOUNT = '1000';
14116
+ var HIGH_BYPASS_MINT_AMOUNT = '10000';
14117
+ var HIGH_BYPASS_MINT_CHAINS = ['Mythos'];
14213
14118
  var MIN_AMOUNT = 2n;
14214
14119
  var AMOUNT_ALL = 'ALL';
14215
14120
  var TRANSACT_ORIGINS = ['Native', 'SovereignAccount', 'Superuser', 'Xcm'];
@@ -14478,4 +14383,4 @@ var createClientCache = function createClientCache(maxSize, pingClient, onEvicti
14478
14383
  };
14479
14384
  };
14480
14385
 
14481
- export { API_TYPES, AmountTooLowError, ApiNotInitializedError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getFailureInfo$1 as getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
14386
+ export { API_TYPES, AmountTooLowError, ApiNotInitializedError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2b256, blake2b512, buildDestInfo, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createExecuteExchangeXcm, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getFailureInfo$1 as getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };