@paraspell/sdk-core 11.14.6 → 11.14.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { blake2b } from '@noble/hashes/blake2';
2
- import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getOtherAssets, isTAsset, findNativeAssetInfoOrThrow, findAssetInfo, getExistentialDepositOrThrow, isSymbolMatch, getNativeAssetSymbol, getEdFromAssetOrThrow, hasDryRunSupport, findAssetOnDestOrThrow, findAssetInfoOnDest, hasSupportForAsset, isAssetEqual, isOverrideLocationSpecifier, getRelayChainSymbol, isSymbolSpecifier, findAssetInfoByLoc, findNativeAssetInfo, isAssetXcEqual, getExistentialDeposit, normalizeLocation, normalizeSymbol, Native, hasXcmPaymentApiSupport } from '@paraspell/assets';
2
+ import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getOtherAssets, isTAsset, findNativeAssetInfoOrThrow, findAssetInfo, getExistentialDepositOrThrow, isSymbolMatch, getNativeAssetSymbol, getEdFromAssetOrThrow, hasDryRunSupport, findAssetOnDestOrThrow, findAssetInfoOnDest, hasSupportForAsset, isAssetEqual, isOverrideLocationSpecifier, getRelayChainSymbol, isSymbolSpecifier, findNativeAssetInfo, isAssetXcEqual, getExistentialDeposit, normalizeLocation, normalizeSymbol, Native, hasXcmPaymentApiSupport, findAssetInfoByLoc } from '@paraspell/assets';
3
3
  export * from '@paraspell/assets';
4
4
  import { base58 } from '@scure/base';
5
5
  import { isAddress, parseUnits as parseUnits$1, formatUnits as formatUnits$1, getContract, createPublicClient, http, pad, toHex, getAddress, concat, keccak256 } from 'viem';
6
- import { replaceBigInt, isTLocation, Version, hasJunction, getJunctionValue, isRelayChain, deepEqual, Parents, isExternalChain, isSubstrateBridge, PARACHAINS, isSystemChain, isTrustedChain } from '@paraspell/sdk-common';
6
+ import { replaceBigInt, isTLocation, Version, hasJunction, getJunctionValue, isRelayChain, deepEqual, Parents, isExternalChain, isSubstrateBridge, PARACHAINS, RELAYCHAINS, isSystemChain, isTrustedChain } from '@paraspell/sdk-common';
7
7
  export * from '@paraspell/sdk-common';
8
8
  import { mainnet, moonbeam, moonriver } from 'viem/chains';
9
9
  import { getSupportedPallets, getNativeAssetsPallet, getOtherAssetsPallets, getSupportedPalletsDetails } from '@paraspell/pallets';
@@ -1194,10 +1194,6 @@ var Astar$1 = {
1194
1194
  name: "Astar",
1195
1195
  endpoint: "wss://rpc.astar.network"
1196
1196
  },
1197
- {
1198
- name: "Blast",
1199
- endpoint: "wss://astar.public.blastapi.io"
1200
- },
1201
1197
  {
1202
1198
  name: "Dwellir",
1203
1199
  endpoint: "wss://astar-rpc.n.dwellir.com"
@@ -1302,10 +1298,6 @@ var Darwinia$1 = {
1302
1298
  name: "Darwinia",
1303
1299
  endpoint: "wss://rpc.darwinia.network"
1304
1300
  },
1305
- {
1306
- name: "Dwellir",
1307
- endpoint: "wss://darwinia-rpc.n.dwellir.com"
1308
- },
1309
1301
  {
1310
1302
  name: "Subquery",
1311
1303
  endpoint: "wss://darwinia.rpc.subquery.network/public/ws"
@@ -1346,17 +1338,6 @@ var Hydration$1 = {
1346
1338
  }
1347
1339
  ]
1348
1340
  };
1349
- var IntegriteePolkadot$1 = {
1350
- name: "Integritee Network",
1351
- info: "integritee",
1352
- paraId: 2039,
1353
- providers: [
1354
- {
1355
- name: "Integritee",
1356
- endpoint: "wss://polkadot.api.integritee.network"
1357
- }
1358
- ]
1359
- };
1360
1341
  var Interlay$1 = {
1361
1342
  name: "Interlay",
1362
1343
  info: "interlay",
@@ -1407,10 +1388,6 @@ var Moonbeam$1 = {
1407
1388
  name: "Allnodes",
1408
1389
  endpoint: "wss://moonbeam-rpc.publicnode.com"
1409
1390
  },
1410
- {
1411
- name: "Blast",
1412
- endpoint: "wss://moonbeam.public.blastapi.io"
1413
- },
1414
1391
  {
1415
1392
  name: "IBP1",
1416
1393
  endpoint: "wss://moonbeam.ibp.network"
@@ -1554,10 +1531,6 @@ var Nodle$1 = {
1554
1531
  info: "nodle",
1555
1532
  paraId: 2026,
1556
1533
  providers: [
1557
- {
1558
- name: "Dwellir",
1559
- endpoint: "wss://nodle-rpc.dwellir.com"
1560
- },
1561
1534
  {
1562
1535
  name: "OnFinality",
1563
1536
  endpoint: "wss://nodle-parachain.api.onfinality.io/public-ws"
@@ -1595,14 +1568,6 @@ var Phala$1 = {
1595
1568
  name: "Dwellir",
1596
1569
  endpoint: "wss://phala-rpc.n.dwellir.com"
1597
1570
  },
1598
- {
1599
- name: "Helikon",
1600
- endpoint: "wss://rpc.helikon.io/phala"
1601
- },
1602
- {
1603
- name: "OnFinality",
1604
- endpoint: "wss://phala.api.onfinality.io/public-ws"
1605
- },
1606
1571
  {
1607
1572
  name: "RadiumBlock",
1608
1573
  endpoint: "wss://phala.public.curie.radiumblock.co/ws"
@@ -1839,21 +1804,6 @@ var BridgeHubKusama$1 = {
1839
1804
  }
1840
1805
  ]
1841
1806
  };
1842
- var IntegriteeKusama$1 = {
1843
- name: "Integritee Network",
1844
- info: "integritee",
1845
- paraId: 2015,
1846
- providers: [
1847
- {
1848
- name: "Integritee",
1849
- endpoint: "wss://kusama.api.integritee.network"
1850
- },
1851
- {
1852
- name: "OnFinality",
1853
- endpoint: "wss://integritee-kusama.api.onfinality.io/public-ws"
1854
- }
1855
- ]
1856
- };
1857
1807
  var Karura$1 = {
1858
1808
  name: "Karura",
1859
1809
  info: "karura",
@@ -2068,10 +2018,6 @@ var Crab$1 = {
2068
2018
  {
2069
2019
  name: "Darwinia",
2070
2020
  endpoint: "wss://crab-rpc.darwinia.network/"
2071
- },
2072
- {
2073
- name: "Dwellir",
2074
- endpoint: "wss://darwiniacrab-rpc.n.dwellir.com"
2075
2021
  }
2076
2022
  ]
2077
2023
  };
@@ -2197,10 +2143,6 @@ var AssetHubWestend$1 = {
2197
2143
  {
2198
2144
  name: "Parity",
2199
2145
  endpoint: "wss://westend-asset-hub-rpc.polkadot.io"
2200
- },
2201
- {
2202
- name: "Permanence DAO EU",
2203
- endpoint: "wss://asset-hub-westend.rpc.permanence.io"
2204
2146
  }
2205
2147
  ]
2206
2148
  };
@@ -2329,6 +2271,10 @@ var BifrostPaseo$1 = {
2329
2271
  {
2330
2272
  name: "Liebi",
2331
2273
  endpoint: "wss://bifrost-rpc.paseo.liebi.com/ws"
2274
+ },
2275
+ {
2276
+ name: "Liebi2",
2277
+ endpoint: "wss://bifrost-rpc.paseo2.liebi.com/ws"
2332
2278
  }
2333
2279
  ]
2334
2280
  };
@@ -2395,17 +2341,6 @@ var HydrationPaseo$1 = {
2395
2341
  }
2396
2342
  ]
2397
2343
  };
2398
- var IntegriteePaseo$1 = {
2399
- name: "Integritee Network (Paseo)",
2400
- info: "integritee",
2401
- paraId: 2039,
2402
- providers: [
2403
- {
2404
- name: "Integritee",
2405
- endpoint: "wss://paseo.api.integritee.network"
2406
- }
2407
- ]
2408
- };
2409
2344
  var KiltPaseo$1 = {
2410
2345
  name: "KILT Peregrine",
2411
2346
  info: "kilt",
@@ -2439,17 +2374,6 @@ var NeuroWebPaseo$1 = {
2439
2374
  }
2440
2375
  ]
2441
2376
  };
2442
- var NodlePaseo$1 = {
2443
- name: "Nodle",
2444
- info: "NodleParadis",
2445
- paraId: 2026,
2446
- providers: [
2447
- {
2448
- name: "OnFinality",
2449
- endpoint: "wss://node-7273232234617282560.nv.onfinality.io/ws?apikey=b937a7d7-7395-49b9-b745-60a0342fa365"
2450
- }
2451
- ]
2452
- };
2453
2377
  var PAssetHub$1 = {
2454
2378
  name: "PAssetHub - Contracts",
2455
2379
  info: "PAssetHub - Contracts",
@@ -2678,7 +2602,6 @@ var configs = {
2678
2602
  Darwinia: Darwinia$1,
2679
2603
  EnergyWebX: EnergyWebX$1,
2680
2604
  Hydration: Hydration$1,
2681
- IntegriteePolkadot: IntegriteePolkadot$1,
2682
2605
  Interlay: Interlay$1,
2683
2606
  Heima: Heima$1,
2684
2607
  Jamton: Jamton$1,
@@ -2701,7 +2624,6 @@ var configs = {
2701
2624
  Xode: Xode$1,
2702
2625
  AssetHubKusama: AssetHubKusama$1,
2703
2626
  BridgeHubKusama: BridgeHubKusama$1,
2704
- IntegriteeKusama: IntegriteeKusama$1,
2705
2627
  Karura: Karura$1,
2706
2628
  Kintsugi: Kintsugi$1,
2707
2629
  Moonriver: Moonriver$1,
@@ -2733,11 +2655,9 @@ var configs = {
2733
2655
  EnergyWebXPaseo: EnergyWebXPaseo$1,
2734
2656
  HeimaPaseo: HeimaPaseo$1,
2735
2657
  HydrationPaseo: HydrationPaseo$1,
2736
- IntegriteePaseo: IntegriteePaseo$1,
2737
2658
  KiltPaseo: KiltPaseo$1,
2738
2659
  LaosPaseo: LaosPaseo$1,
2739
2660
  NeuroWebPaseo: NeuroWebPaseo$1,
2740
- NodlePaseo: NodlePaseo$1,
2741
2661
  PAssetHub: PAssetHub$1,
2742
2662
  PeoplePaseo: PeoplePaseo$1,
2743
2663
  ZeitgeistPaseo: ZeitgeistPaseo$1,
@@ -2996,7 +2916,7 @@ var getMythosOriginFee = /*#__PURE__*/function () {
2996
2916
  return ahApi.init('AssetHubPolkadot');
2997
2917
  case 1:
2998
2918
  _context.n = 2;
2999
- return getParaEthTransferFees(ahApi);
2919
+ return getParaEthTransferFees(ahApi, false);
3000
2920
  case 2:
3001
2921
  _yield$getParaEthTran = _context.v;
3002
2922
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
@@ -3008,12 +2928,15 @@ var getMythosOriginFee = /*#__PURE__*/function () {
3008
2928
  return ahApi.quoteAhPrice(DOT_LOCATION, nativeAsset.location, bridgeFee + ahExecutionFee);
3009
2929
  case 3:
3010
2930
  feeConverted = _context.v;
2931
+ _context.n = 4;
2932
+ return ahApi.disconnect();
2933
+ case 4:
3011
2934
  if (feeConverted) {
3012
- _context.n = 4;
2935
+ _context.n = 5;
3013
2936
  break;
3014
2937
  }
3015
2938
  throw new InvalidParameterError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
3016
- case 4:
2939
+ case 5:
3017
2940
  return _context.a(2, padValueBy(feeConverted, 10));
3018
2941
  }
3019
2942
  }, _callee);
@@ -3799,7 +3722,9 @@ var GeneralBuilder = /*#__PURE__*/function () {
3799
3722
  }, {
3800
3723
  key: "getXcmFee",
3801
3724
  value: (function () {
3802
- var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(options) {
3725
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(
3726
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
3727
+ options) {
3803
3728
  var _options$disableFallb;
3804
3729
  var disableFallback, _yield$this$prepareNo2, normalizedOptions, buildTx, api, from, to, senderAddress, address, currency, feeAsset;
3805
3730
  return _regenerator().w(function (_context8) {
@@ -4599,6 +4524,30 @@ var validateBridgeAsset = function validateBridgeAsset(origin, destination, asse
4599
4524
  throw new InvalidCurrencyError("Substrate bridge does not support currency ".concat(JSON.stringify(currency, replaceBigInt), "."));
4600
4525
  }
4601
4526
  };
4527
+ var validateEthereumAsset = function validateEthereumAsset(origin, destination, asset) {
4528
+ var _asset$location2;
4529
+ if (!asset || destination !== 'Ethereum' || origin === 'Mythos') return;
4530
+ var ADDITIONAL_ALLOWED_LOCATIONS = [RELAY_LOCATION, {
4531
+ parents: 2,
4532
+ interior: {
4533
+ X1: [{
4534
+ GlobalConsensus: {
4535
+ Kusama: null
4536
+ }
4537
+ }]
4538
+ }
4539
+ }];
4540
+ var isEthCompatibleAsset = ((_asset$location2 = asset.location) === null || _asset$location2 === void 0 ? void 0 : _asset$location2.parents) === Parents.TWO && deepEqual(getJunctionValue(asset.location, 'GlobalConsensus'), {
4541
+ Ethereum: {
4542
+ chainId: 1
4543
+ }
4544
+ }) || ADDITIONAL_ALLOWED_LOCATIONS.some(function (loc) {
4545
+ return deepEqual(asset.location, loc);
4546
+ });
4547
+ if (!isEthCompatibleAsset) {
4548
+ throw new InvalidCurrencyError("Currency ".concat(JSON.stringify(asset, replaceBigInt), " is not transferable to Ethereum."));
4549
+ }
4550
+ };
4602
4551
  var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled, isBridge, asset) {
4603
4552
  var origin = _ref.from,
4604
4553
  destination = _ref.to,
@@ -4612,6 +4561,7 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
4612
4561
  throwUnsupportedCurrency(currency, origin);
4613
4562
  }
4614
4563
  validateBridgeAsset(origin, destination, asset, currency, isBridge);
4564
+ validateEthereumAsset(origin, destination, asset);
4615
4565
  };
4616
4566
 
4617
4567
  var resolveOverriddenAsset = function resolveOverriddenAsset(options, isBridge, assetCheckEnabled, resolvedFeeAsset) {
@@ -4839,16 +4789,32 @@ var getTChain = function getTChain(paraId, ecosystem) {
4839
4789
 
4840
4790
  var getParaEthTransferFees = /*#__PURE__*/function () {
4841
4791
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ahApi) {
4842
- var DEFAULT_FEE, feeStorageItem, leFeeHex, bytes, reversedHex, validReversedHex, leFee, transferBridgeFee, finalBridgeFee, finalAssethubExecutionFee;
4792
+ var shouldDisconnect,
4793
+ DEFAULT_FEE,
4794
+ feeStorageItem,
4795
+ leFeeHex,
4796
+ bytes,
4797
+ reversedHex,
4798
+ validReversedHex,
4799
+ leFee,
4800
+ transferBridgeFee,
4801
+ finalBridgeFee,
4802
+ finalAssethubExecutionFee,
4803
+ _args = arguments;
4843
4804
  return _regenerator().w(function (_context) {
4844
4805
  while (1) switch (_context.n) {
4845
4806
  case 0:
4807
+ shouldDisconnect = _args.length > 1 && _args[1] !== undefined ? _args[1] : true;
4846
4808
  DEFAULT_FEE = 2750872500000n;
4847
4809
  _context.n = 1;
4848
4810
  return ahApi.getFromRpc('state', 'getStorage', '0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
4849
4811
  case 1:
4850
4812
  feeStorageItem = _context.v;
4851
4813
  leFeeHex = feeStorageItem.replace('0x', '');
4814
+ if (!shouldDisconnect) {
4815
+ _context.n = 2;
4816
+ break;
4817
+ }
4852
4818
  _context.n = 2;
4853
4819
  return ahApi.disconnect();
4854
4820
  case 2:
@@ -5235,25 +5201,9 @@ var reverseTransformLocation = function reverseTransformLocation(location) {
5235
5201
  });
5236
5202
  };
5237
5203
 
5238
- var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, messageId) {
5239
- var api = _ref.api,
5240
- address = _ref.address,
5241
- asset = _ref.assetInfo,
5242
- senderAddress = _ref.senderAddress,
5243
- ahAddress = _ref.ahAddress,
5244
- version = _ref.version;
5245
- if (!isForeignAsset(asset)) {
5246
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " is not a foreign asset"));
5247
- }
5204
+ var createMainInstruction = function createMainInstruction(origin, asset, ethAsset, address, messageId) {
5205
+ assertHasId(ethAsset);
5248
5206
  assertHasLocation(asset);
5249
- assertSenderAddress(senderAddress);
5250
- if (isChainEvm(origin) && !ahAddress) {
5251
- throw new InvalidParameterError("Please provide ahAddress");
5252
- }
5253
- var ethAsset = findAssetInfoByLoc(getOtherAssets('Ethereum'), asset.location);
5254
- if (!ethAsset) {
5255
- throw new InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset, replaceBigInt)));
5256
- }
5257
5207
  var interiorSb = ethAsset.symbol === 'ETH' ? {
5258
5208
  Here: null
5259
5209
  } : {
@@ -5264,25 +5214,91 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
5264
5214
  }
5265
5215
  }]
5266
5216
  };
5267
- return _defineProperty({}, version, [{
5268
- SetAppendix: origin === 'Mythos' ? [] : [{
5217
+ var isAssetNativeToPolkadot = !deepEqual(getJunctionValue(asset.location, 'GlobalConsensus'), {
5218
+ Ethereum: {
5219
+ chainId: 1
5220
+ }
5221
+ // MYTH needs to use InitiateReserveWithdraw
5222
+ }) && origin !== 'Mythos';
5223
+ var beneficiary = {
5224
+ parents: Parents.ZERO,
5225
+ interior: {
5226
+ X1: [{
5227
+ AccountKey20: {
5228
+ network: null,
5229
+ key: address
5230
+ }
5231
+ }]
5232
+ }
5233
+ };
5234
+ var makeBuyExecution = function makeBuyExecution(feesId) {
5235
+ return {
5236
+ BuyExecution: {
5237
+ fees: {
5238
+ id: feesId,
5239
+ fun: {
5240
+ Fungible: 1n
5241
+ }
5242
+ },
5243
+ weight_limit: 'Unlimited'
5244
+ }
5245
+ };
5246
+ };
5247
+ var makeDepositAsset = function makeDepositAsset() {
5248
+ return {
5269
5249
  DepositAsset: {
5270
5250
  assets: {
5271
- Wild: 'All'
5251
+ Wild: {
5252
+ AllCounted: 1
5253
+ }
5272
5254
  },
5273
- beneficiary: createBeneficiaryLocation({
5274
- api: api,
5275
- address: isChainEvm(origin) ? ahAddress : senderAddress,
5276
- version: version
5255
+ beneficiary: beneficiary
5256
+ }
5257
+ };
5258
+ };
5259
+ var commonXcm = function commonXcm(feesId) {
5260
+ return [makeBuyExecution(feesId), makeDepositAsset(), {
5261
+ SetTopic: messageId
5262
+ }];
5263
+ };
5264
+ if (isAssetNativeToPolkadot) {
5265
+ var assetEcosystem = RELAYCHAINS.find(function (chain) {
5266
+ return asset.symbol.includes(getNativeAssetSymbol(chain));
5267
+ });
5268
+ if (!assetEcosystem) throw new InvalidParameterError('Unsupported native polkadot asset');
5269
+ return {
5270
+ DepositReserveAsset: {
5271
+ assets: {
5272
+ Wild: {
5273
+ AllOf: {
5274
+ id: asset.location,
5275
+ fun: 'Fungible'
5276
+ }
5277
+ }
5278
+ },
5279
+ dest: {
5280
+ parents: Parents.TWO,
5281
+ interior: {
5282
+ X1: [ETHEREUM_JUNCTION]
5283
+ }
5284
+ },
5285
+ xcm: commonXcm({
5286
+ parents: Parents.ONE,
5287
+ interior: {
5288
+ X1: [{
5289
+ GlobalConsensus: _defineProperty({}, assetEcosystem.toLowerCase(), null)
5290
+ }]
5291
+ }
5277
5292
  })
5278
5293
  }
5279
- }]
5280
- }, {
5294
+ };
5295
+ }
5296
+ return {
5281
5297
  InitiateReserveWithdraw: {
5282
5298
  assets: {
5283
5299
  Wild: {
5284
5300
  AllOf: {
5285
- id: asset.location,
5301
+ id: ethAsset.location,
5286
5302
  fun: 'Fungible'
5287
5303
  }
5288
5304
  }
@@ -5293,43 +5309,38 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
5293
5309
  X1: [ETHEREUM_JUNCTION]
5294
5310
  }
5295
5311
  },
5296
- xcm: [{
5297
- BuyExecution: {
5298
- fees: {
5299
- id: {
5300
- parents: Parents.ZERO,
5301
- interior: interiorSb
5302
- },
5303
- fun: {
5304
- Fungible: 1n
5305
- }
5306
- },
5307
- weight_limit: 'Unlimited'
5308
- }
5309
- }, {
5310
- DepositAsset: {
5311
- assets: {
5312
- Wild: {
5313
- AllCounted: 1
5314
- }
5315
- },
5316
- beneficiary: {
5317
- parents: Parents.ZERO,
5318
- interior: {
5319
- X1: [{
5320
- AccountKey20: {
5321
- network: null,
5322
- key: address
5323
- }
5324
- }]
5325
- }
5326
- }
5327
- }
5328
- }, {
5329
- SetTopic: messageId
5330
- }]
5312
+ xcm: commonXcm({
5313
+ parents: Parents.ZERO,
5314
+ interior: interiorSb
5315
+ })
5331
5316
  }
5332
- }, {
5317
+ };
5318
+ };
5319
+ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, messageId, ethAsset) {
5320
+ var api = _ref.api,
5321
+ address = _ref.address,
5322
+ assetInfo = _ref.assetInfo,
5323
+ senderAddress = _ref.senderAddress,
5324
+ ahAddress = _ref.ahAddress,
5325
+ version = _ref.version;
5326
+ assertSenderAddress(senderAddress);
5327
+ if (isChainEvm(origin) && !ahAddress) {
5328
+ throw new InvalidParameterError("Please provide ahAddress");
5329
+ }
5330
+ return _defineProperty({}, version, [{
5331
+ SetAppendix: origin === 'Mythos' ? [] : [{
5332
+ DepositAsset: {
5333
+ assets: {
5334
+ Wild: 'All'
5335
+ },
5336
+ beneficiary: createBeneficiaryLocation({
5337
+ api: api,
5338
+ address: isChainEvm(origin) ? ahAddress : senderAddress,
5339
+ version: version
5340
+ })
5341
+ }
5342
+ }]
5343
+ }, createMainInstruction(origin, assetInfo, ethAsset, address, messageId), {
5333
5344
  SetTopic: messageId
5334
5345
  }]);
5335
5346
  };
@@ -5491,19 +5502,9 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5491
5502
  case 5:
5492
5503
  foundAsset = findAssetInfoOrThrow(from, currency, to);
5493
5504
  amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
5494
- if (!(!isForeignAsset(foundAsset) || !foundAsset.location)) {
5495
- _context.n = 6;
5496
- break;
5497
- }
5498
- throw new InvalidCurrencyError('Currency must be a foreign asset with a valid location');
5499
- case 6:
5500
- ethAsset = findAssetInfoByLoc(getOtherAssets('Ethereum'), foundAsset.location);
5501
- if (!(!ethAsset || !ethAsset.assetId)) {
5502
- _context.n = 7;
5503
- break;
5504
- }
5505
- throw new InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(foundAsset)));
5506
- case 7:
5505
+ ethAsset = findAssetInfoOrThrow('Ethereum', {
5506
+ symbol: foundAsset.symbol
5507
+ }, null);
5507
5508
  contract = getContract({
5508
5509
  abi: abi,
5509
5510
  address: xcmInterfacePrecompile,
@@ -5517,12 +5518,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5517
5518
  });
5518
5519
  senderAddress = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
5519
5520
  assertSenderAddress(senderAddress);
5520
- _context.n = 8;
5521
+ assertHasId(ethAsset);
5522
+ _context.n = 6;
5521
5523
  return api.init(from, TX_CLIENT_TIMEOUT_MS);
5522
- case 8:
5523
- _context.n = 9;
5524
+ case 6:
5525
+ _context.n = 7;
5524
5526
  return generateMessageId(api, senderAddress, getParaId(from), ethAsset.assetId, address, amount);
5525
- case 9:
5527
+ case 7:
5526
5528
  messageId = _context.v;
5527
5529
  customXcm = createCustomXcmOnDest({
5528
5530
  api: api,
@@ -5533,18 +5535,18 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5533
5535
  amount: amount
5534
5536
  }),
5535
5537
  version: Version.V4
5536
- }, from, messageId);
5537
- _context.n = 10;
5538
+ }, from, messageId, ethAsset);
5539
+ _context.n = 8;
5538
5540
  return api.objectToHex(customXcm, 'XcmVersionedXcm');
5539
- case 10:
5541
+ case 8:
5540
5542
  customXcmOnDest = _context.v;
5541
- _context.n = 11;
5543
+ _context.n = 9;
5542
5544
  return api.createApiForChain('AssetHubPolkadot');
5543
- case 11:
5545
+ case 9:
5544
5546
  assetHubApi = _context.v;
5545
- _context.n = 12;
5547
+ _context.n = 10;
5546
5548
  return getParaEthTransferFees(assetHubApi);
5547
- case 12:
5549
+ case 10:
5548
5550
  _yield$getParaEthTran = _context.v;
5549
5551
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
5550
5552
  bridgeFee = _yield$getParaEthTran2[0];
@@ -5559,7 +5561,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5559
5561
  throw new InvalidParameterError('Input must be a valid number');
5560
5562
  }() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
5561
5563
  }; // Execute the custom XCM message with the precompile
5562
- _context.n = 13;
5564
+ _context.n = 11;
5563
5565
  return createTx('transferAssetsUsingTypeAndThenAddress', [
5564
5566
  // This represents (1,X1(Parachain(1000)))
5565
5567
  [1, ['0x00' + numberToHex32(getParaId('AssetHubPolkadot')).slice(2)]],
@@ -5571,7 +5573,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5571
5573
  0,
5572
5574
  // The TransferType corresponding to fee asset
5573
5575
  2, customXcmOnDest]);
5574
- case 13:
5576
+ case 11:
5575
5577
  tx = _context.v;
5576
5578
  return _context.a(2, tx);
5577
5579
  }
@@ -7469,7 +7471,7 @@ var send = /*#__PURE__*/function () {
7469
7471
 
7470
7472
  var buildDestInfo = /*#__PURE__*/function () {
7471
7473
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
7472
- var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail, totalHopFee, bridgeFee, destApi, destAsset, edDest, destBalance, destAmount, effectiveAmountForBalance, destBalanceSufficient, destBalanceSufficientResult, destBalanceAfter, destbalanceAfterResult, receivedAmount, isAssetHubToAssetHubRoute, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
7474
+ var api, origin, destination, address, 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;
7473
7475
  return _regenerator().w(function (_context) {
7474
7476
  while (1) switch (_context.n) {
7475
7477
  case 0:
@@ -7490,13 +7492,19 @@ var buildDestInfo = /*#__PURE__*/function () {
7490
7492
  case 2:
7491
7493
  destBalance = _context.v;
7492
7494
  destAmount = isFeeAssetAh ? currency.amount - originFee : currency.amount;
7495
+ destFeeAssetEqual = isSymbolMatch(destFeeDetail.asset.symbol, destAsset.symbol);
7496
+ effectiveDestFee = destFeeAssetEqual ? destFeeDetail.fee : 0n;
7493
7497
  effectiveAmountForBalance = destAmount - totalHopFee;
7494
- destBalanceSufficient = effectiveAmountForBalance - destFeeDetail.fee > (destBalance < edDest ? edDest : 0n);
7495
- destBalanceSufficientResult = destFeeDetail.currency !== destAsset.symbol && destination !== 'Ethereum' ? new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same') : destBalanceSufficient;
7496
- destBalanceAfter = destBalance - (destFeeDetail.currency === destAsset.symbol ? destFeeDetail.fee : 0n) + effectiveAmountForBalance;
7497
- destbalanceAfterResult = destFeeDetail.currency !== destAsset.symbol && destination !== 'Ethereum' ? new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same') : destBalanceAfter;
7498
- isAssetHubToAssetHubRoute = origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot' || origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama';
7499
- if (isAssetHubToAssetHubRoute) {
7498
+ destBalanceSufficient = effectiveAmountForBalance - effectiveDestFee > (destBalance < edDest ? edDest : 0n);
7499
+ destBalanceAfter = destBalance - effectiveDestFee + effectiveAmountForBalance;
7500
+ createUnableToComputeError = function createUnableToComputeError() {
7501
+ return new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same');
7502
+ };
7503
+ isUnableToCompute = destFeeDetail.feeType === 'paymentInfo' && !destFeeAssetEqual;
7504
+ destbalanceAfterResult = isUnableToCompute ? createUnableToComputeError() : destBalanceAfter;
7505
+ destBalanceSufficientResult = isUnableToCompute ? createUnableToComputeError() : destBalanceSufficient;
7506
+ isSubBridge = isSubstrateBridge(origin, destination);
7507
+ if (isSubBridge) {
7500
7508
  nativeAssetOfOriginSymbol = getNativeAssetSymbol(origin);
7501
7509
  isOriginAssetNative = false;
7502
7510
  if (destAsset.symbol === nativeAssetOfOriginSymbol) {
@@ -7537,7 +7545,7 @@ var buildDestInfo = /*#__PURE__*/function () {
7537
7545
  case 4:
7538
7546
  destXcmFeeBalance = destBalance;
7539
7547
  case 5:
7540
- destXcmFeeBalanceAfter = isFeeAssetAh ? destBalanceAfter : destXcmFeeBalance - destFeeDetail.fee + (destFeeDetail.currency === destAsset.symbol ? effectiveAmountForBalance : 0n);
7548
+ destXcmFeeBalanceAfter = isFeeAssetAh ? destBalanceAfter : destXcmFeeBalance - destFeeDetail.fee + (destFeeAssetEqual ? effectiveAmountForBalance : 0n);
7541
7549
  return _context.a(2, {
7542
7550
  receivedCurrency: {
7543
7551
  sufficient: destBalanceSufficientResult,
@@ -7552,7 +7560,7 @@ var buildDestInfo = /*#__PURE__*/function () {
7552
7560
  fee: destFeeDetail.fee,
7553
7561
  balance: destXcmFeeBalance,
7554
7562
  balanceAfter: destXcmFeeBalanceAfter,
7555
- currencySymbol: destFeeDetail.currency,
7563
+ currencySymbol: destFeeDetail.asset.symbol,
7556
7564
  asset: destFeeDetail.asset
7557
7565
  }
7558
7566
  });
@@ -8567,20 +8575,16 @@ var createTypeThenAutoReserve = /*#__PURE__*/function () {
8567
8575
  };
8568
8576
  }();
8569
8577
 
8570
- var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
8571
- var _feeResult$assetHub;
8572
- var totalFee = 0n;
8573
- if (((_feeResult$assetHub = feeResult.assetHub) === null || _feeResult$assetHub === void 0 ? void 0 : _feeResult$assetHub.fee) !== undefined) {
8574
- totalFee += feeResult.assetHub.fee;
8575
- }
8576
- if (feeResult.destination.fee !== undefined) {
8577
- totalFee += feeResult.destination.fee;
8578
- }
8579
- return totalFee;
8578
+ var calculateTotalXcmFee = function calculateTotalXcmFee(asset, feeResult) {
8579
+ var totalHopFee = feeResult.hops.reduce(function (acc, hop) {
8580
+ return isAssetXcEqual(hop.result.asset, asset) ? acc + hop.result.fee : acc;
8581
+ }, 0n);
8582
+ var destFee = isAssetXcEqual(feeResult.destination.asset, asset) ? feeResult.destination.fee : 0n;
8583
+ return totalHopFee + destFee;
8580
8584
  };
8581
8585
  var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
8582
8586
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
8583
- var api, buildTx, origin, destination, currency, address, senderAddress, feeAsset, destApi, asset, amount, destAsset, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, tx, totalFee, method, feeToSubtract;
8587
+ var api, buildTx, origin, destination, currency, address, senderAddress, feeAsset, isSubBridge, destApi, asset, amount, destAsset, ed, balance, xcmFeeResult, dryRunError, hops, _xcmFeeResult$destina, destFee, destFeeType, destFeeAsset, destDryRunError, erroredHop, hopError, isUnableToCompute, tx, totalFee, method, feeToSubtract;
8584
8588
  return _regenerator().w(function (_context) {
8585
8589
  while (1) switch (_context.n) {
8586
8590
  case 0:
@@ -8592,36 +8596,31 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
8592
8596
  return _context.a(2, true);
8593
8597
  case 1:
8594
8598
  validateAddress(api, address, destination, true);
8595
- if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama')) {
8599
+ isSubBridge = isSubstrateBridge(origin, destination);
8600
+ if (!isSubBridge) {
8596
8601
  _context.n = 2;
8597
8602
  break;
8598
8603
  }
8599
- throw new InvalidParameterError('Kusama is outside of Polkadot ecosystem, thus function is unable to verify the existential deposit for it.');
8604
+ throw new InvalidParameterError('Unable to verify the existential deposit for substrate bridge scenarios');
8600
8605
  case 2:
8601
- if (!(origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
8602
- _context.n = 3;
8603
- break;
8604
- }
8605
- throw new InvalidParameterError('Polkadot is outside of Kusama ecosystem, thus function is unable to verify the existential deposit for it.');
8606
- case 3:
8607
8606
  destApi = api.clone();
8608
- _context.n = 4;
8607
+ _context.n = 3;
8609
8608
  return destApi.init(destination);
8610
- case 4:
8609
+ case 3:
8611
8610
  asset = findAssetOnDestOrThrow(origin, destination, currency);
8612
8611
  amount = abstractDecimals(currency.amount, asset.decimals, api);
8613
8612
  destAsset = findAssetOnDestOrThrow(origin, destination, currency);
8614
8613
  ed = getEdFromAssetOrThrow(destAsset);
8615
- _context.n = 5;
8614
+ _context.n = 4;
8616
8615
  return getAssetBalanceInternal({
8617
8616
  address: address,
8618
8617
  chain: destination,
8619
8618
  api: destApi,
8620
8619
  asset: destAsset
8621
8620
  });
8622
- case 5:
8621
+ case 4:
8623
8622
  balance = _context.v;
8624
- _context.n = 6;
8623
+ _context.n = 5;
8625
8624
  return getXcmFeeInternal({
8626
8625
  api: api,
8627
8626
  buildTx: buildTx,
@@ -8635,39 +8634,43 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
8635
8634
  feeAsset: feeAsset,
8636
8635
  disableFallback: false
8637
8636
  });
8638
- case 6:
8637
+ case 5:
8639
8638
  xcmFeeResult = _context.v;
8640
- dryRunError = xcmFeeResult.origin.dryRunError, assetHubFeeResult = xcmFeeResult.assetHub, bridgeHubFeeResult = xcmFeeResult.bridgeHub, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeCurrency = _xcmFeeResult$destina.currency, destDryRunError = _xcmFeeResult$destina.dryRunError;
8639
+ dryRunError = xcmFeeResult.origin.dryRunError, hops = xcmFeeResult.hops, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeType = _xcmFeeResult$destina.feeType, destFeeAsset = _xcmFeeResult$destina.asset, destDryRunError = _xcmFeeResult$destina.dryRunError;
8641
8640
  if (!dryRunError) {
8642
- _context.n = 7;
8641
+ _context.n = 6;
8643
8642
  break;
8644
8643
  }
8645
8644
  throw new DryRunFailedError(dryRunError, 'origin');
8646
- case 7:
8647
- hopDryRunError = (assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.dryRunError) || (bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.dryRunError);
8648
- if (!hopDryRunError) {
8649
- _context.n = 8;
8645
+ case 6:
8646
+ erroredHop = hops.find(function (hop) {
8647
+ return hop.result.dryRunError;
8648
+ });
8649
+ hopError = erroredHop === null || erroredHop === void 0 ? void 0 : erroredHop.result.dryRunError;
8650
+ if (!hopError) {
8651
+ _context.n = 7;
8650
8652
  break;
8651
8653
  }
8652
- throw new DryRunFailedError(hopDryRunError, assetHubFeeResult !== null && assetHubFeeResult !== void 0 && assetHubFeeResult.dryRunError ? 'assetHub' : 'bridgeHub');
8653
- case 8:
8654
+ throw new DryRunFailedError(hopError, erroredHop.chain);
8655
+ case 7:
8654
8656
  if (!destDryRunError) {
8655
- _context.n = 9;
8657
+ _context.n = 8;
8656
8658
  break;
8657
8659
  }
8658
8660
  throw new UnableToComputeError("Unable to compute fee for the destination asset. Destination dry run error: ".concat(destDryRunError));
8659
- case 9:
8660
- if (!(normalizeSymbol(asset.symbol) !== normalizeSymbol(destFeeCurrency))) {
8661
- _context.n = 10;
8661
+ case 8:
8662
+ isUnableToCompute = !isSymbolMatch(normalizeSymbol(destAsset.symbol), normalizeSymbol(destFeeAsset.symbol)) && destFeeType === 'paymentInfo';
8663
+ if (!isUnableToCompute) {
8664
+ _context.n = 9;
8662
8665
  break;
8663
8666
  }
8664
8667
  throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
8665
- case 10:
8666
- _context.n = 11;
8668
+ case 9:
8669
+ _context.n = 10;
8667
8670
  return buildTx();
8668
- case 11:
8671
+ case 10:
8669
8672
  tx = _context.v;
8670
- totalFee = calculateTotalXcmFee(xcmFeeResult);
8673
+ totalFee = calculateTotalXcmFee(asset, xcmFeeResult);
8671
8674
  method = api.getMethod(tx);
8672
8675
  if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
8673
8676
  feeToSubtract = totalFee;
@@ -8796,7 +8799,7 @@ var Parachain = /*#__PURE__*/function () {
8796
8799
  throw new InvalidParameterError('Relaychain assets can only be transferred using the type-and-then method which is not supported by this chain');
8797
8800
  case 3:
8798
8801
  isSubBridge = !isTLocation(destination) && isSubstrateBridge(this.chain, destination);
8799
- useTypeAndThen = isRelayAsset && supportsTypeThen && destChain && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain)) || isSubBridge;
8802
+ useTypeAndThen = isRelayAsset && supportsTypeThen && destChain && !isExternalChain(destChain) && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain)) || isSubBridge;
8800
8803
  if (!(supportsXTokens(this) && this.canUseXTokens(sendOptions) && !useTypeAndThen)) {
8801
8804
  _context.n = 5;
8802
8805
  break;
@@ -9208,6 +9211,8 @@ var Parachain = /*#__PURE__*/function () {
9208
9211
  PARA_TO_PARA_FEE_DOT,
9209
9212
  fee,
9210
9213
  ethAssetInfo,
9214
+ systemAssetInfo,
9215
+ shouldIncludeFeeAsset,
9211
9216
  customXcmOnDest,
9212
9217
  messageId,
9213
9218
  call,
@@ -9244,15 +9249,13 @@ var Parachain = /*#__PURE__*/function () {
9244
9249
  executionFee = _yield$getParaEthTran2[1];
9245
9250
  PARA_TO_PARA_FEE_DOT = 5000000000n; // 0.5 DOT
9246
9251
  fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
9247
- ethAssetInfo = findAssetInfoByLoc(getOtherAssets('Ethereum'), asset.location);
9248
- if (ethAssetInfo) {
9249
- _context4.n = 5;
9250
- break;
9251
- }
9252
- throw new InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset, replaceBigInt)));
9253
- case 5:
9252
+ ethAssetInfo = findAssetInfoOrThrow('Ethereum', {
9253
+ symbol: asset.symbol
9254
+ }, null);
9255
+ systemAssetInfo = findNativeAssetInfoOrThrow(getRelayChainOf(this.chain));
9256
+ shouldIncludeFeeAsset = feeAsset && !isAssetEqual(feeAsset, asset) || !isAssetEqual(asset, systemAssetInfo);
9254
9257
  if (!useOnlyDepositInstruction) {
9255
- _context4.n = 6;
9258
+ _context4.n = 5;
9256
9259
  break;
9257
9260
  }
9258
9261
  customXcmOnDest = addXcmVersionHeader([{
@@ -9269,24 +9272,24 @@ var Parachain = /*#__PURE__*/function () {
9269
9272
  })
9270
9273
  }
9271
9274
  }], version);
9272
- _context4.n = 8;
9275
+ _context4.n = 7;
9273
9276
  break;
9274
- case 6:
9277
+ case 5:
9275
9278
  assertHasId(ethAssetInfo);
9276
- _context4.n = 7;
9279
+ _context4.n = 6;
9277
9280
  return generateMessageId(api, senderAddress, getParaId(this.chain), ethAssetInfo.assetId, address, asset.amount);
9278
- case 7:
9281
+ case 6:
9279
9282
  messageId = _context4.v;
9280
- customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId);
9281
- case 8:
9283
+ customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId, ethAssetInfo);
9284
+ case 7:
9282
9285
  call = {
9283
9286
  module: 'PolkadotXcm',
9284
9287
  method: 'transfer_assets_using_type_and_then',
9285
9288
  params: {
9286
9289
  dest: createVersionedDestination(version, this.chain, destination, getParaId('AssetHubPolkadot')),
9287
- assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createAsset(version, fee, DOT_LOCATION)] : []), [ethAsset]), version),
9290
+ assets: addXcmVersionHeader([].concat(_toConsumableArray(shouldIncludeFeeAsset ? [createAsset(version, fee, DOT_LOCATION)] : []), [ethAsset]), version),
9288
9291
  assets_transfer_type: 'DestinationReserve',
9289
- remote_fees_id: addXcmVersionHeader((_feeAsset$location = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.location) !== null && _feeAsset$location !== void 0 ? _feeAsset$location : DOT_LOCATION, version),
9292
+ 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),
9290
9293
  fees_transfer_type: 'DestinationReserve',
9291
9294
  custom_xcm_on_dest: customXcmOnDest,
9292
9295
  weight_limit: 'Unlimited'
@@ -9388,7 +9391,7 @@ var Acala = /*#__PURE__*/function (_Parachain) {
9388
9391
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Acala';
9389
9392
  var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'acala';
9390
9393
  var ecosystem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Polkadot';
9391
- var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V4;
9394
+ var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V5;
9392
9395
  _classCallCheck(this, Acala);
9393
9396
  return _callSuper(this, Acala, [chain, info, ecosystem, version]);
9394
9397
  }
@@ -9500,7 +9503,7 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
9500
9503
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Ajuna';
9501
9504
  var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ajuna';
9502
9505
  var ecosystem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Polkadot';
9503
- var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V4;
9506
+ var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V5;
9504
9507
  _classCallCheck(this, Ajuna);
9505
9508
  return _callSuper(this, Ajuna, [chain, info, ecosystem, version]);
9506
9509
  }
@@ -9592,7 +9595,7 @@ var transferPolkadotXcm = function transferPolkadotXcm(_ref, method) {
9592
9595
  var AjunaPaseo = /*#__PURE__*/function (_Parachain) {
9593
9596
  function AjunaPaseo() {
9594
9597
  _classCallCheck(this, AjunaPaseo);
9595
- return _callSuper(this, AjunaPaseo, ['AjunaPaseo', 'Ajuna(paseo)', 'Paseo', Version.V4]);
9598
+ return _callSuper(this, AjunaPaseo, ['AjunaPaseo', 'Ajuna(paseo)', 'Paseo', Version.V5]);
9596
9599
  }
9597
9600
  _inherits(AjunaPaseo, _Parachain);
9598
9601
  return _createClass(AjunaPaseo, [{
@@ -9727,7 +9730,6 @@ var AssetHubKusama = /*#__PURE__*/function (_Parachain) {
9727
9730
  key: "getMethod",
9728
9731
  value: function getMethod(scenario, destination) {
9729
9732
  var isTrusted = !isTLocation(destination) && isTrustedChain(destination);
9730
- if (destination === 'IntegriteeKusama') return 'transfer_assets';
9731
9733
  return scenario === 'ParaToPara' && !isTrusted ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
9732
9734
  }
9733
9735
  }, {
@@ -10674,7 +10676,6 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
10674
10676
  }
10675
10677
  throw new InvalidParameterError('Location address is not supported for Ethereum transfers');
10676
10678
  case 3:
10677
- assertIsForeign(asset);
10678
10679
  assertHasLocation(asset);
10679
10680
  _context.n = 4;
10680
10681
  return generateMessageId(api, senderAddress, getParaId(this.chain), JSON.stringify(asset.location), address, asset.amount);
@@ -10737,7 +10738,6 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
10737
10738
  }
10738
10739
  throw new BridgeHaltedError();
10739
10740
  case 2:
10740
- assertIsForeign(asset);
10741
10741
  assertHasLocation(asset);
10742
10742
  if (!(asset.symbol === this.getNativeAssetSymbol() || asset.symbol === getNativeAssetSymbol('Kusama'))) {
10743
10743
  _context2.n = 3;
@@ -11937,104 +11937,6 @@ var HydrationPaseo = /*#__PURE__*/function (_Hydration) {
11937
11937
  return _createClass(HydrationPaseo);
11938
11938
  }(Hydration);
11939
11939
 
11940
- var IntegriteePolkadot = /*#__PURE__*/function (_Parachain) {
11941
- function IntegriteePolkadot() {
11942
- var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'IntegriteePolkadot';
11943
- var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'integritee';
11944
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Polkadot';
11945
- var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V5;
11946
- _classCallCheck(this, IntegriteePolkadot);
11947
- return _callSuper(this, IntegriteePolkadot, [chain, info, type, version]);
11948
- }
11949
- _inherits(IntegriteePolkadot, _Parachain);
11950
- return _createClass(IntegriteePolkadot, [{
11951
- key: "transferPolkadotXCM",
11952
- value: function transferPolkadotXCM(input) {
11953
- return transferPolkadotXcm(input, 'transfer_assets', 'Unlimited');
11954
- }
11955
- }, {
11956
- key: "transferRelayToPara",
11957
- value: function transferRelayToPara() {
11958
- throw new ChainNotSupportedError();
11959
- }
11960
- }, {
11961
- key: "isSendingTempDisabled",
11962
- value: function isSendingTempDisabled(_options) {
11963
- return true;
11964
- }
11965
- }, {
11966
- key: "isReceivingTempDisabled",
11967
- value: function isReceivingTempDisabled(_scenario) {
11968
- return true;
11969
- }
11970
- }, {
11971
- key: "transferLocalNonNativeAsset",
11972
- value: function transferLocalNonNativeAsset(options) {
11973
- var api = options.api,
11974
- asset = options.assetInfo,
11975
- address = options.address,
11976
- isAmountAll = options.isAmountAll;
11977
- assertHasId(asset);
11978
- var assetId = Number(asset.assetId);
11979
- var dest = {
11980
- Id: address
11981
- };
11982
- if (isAmountAll) {
11983
- return api.deserializeExtrinsics({
11984
- module: 'Assets',
11985
- method: 'transfer_all',
11986
- params: {
11987
- id: assetId,
11988
- dest: dest,
11989
- keep_alive: false
11990
- }
11991
- });
11992
- }
11993
- return api.deserializeExtrinsics({
11994
- module: 'Assets',
11995
- method: 'transfer',
11996
- params: {
11997
- id: assetId,
11998
- target: dest,
11999
- amount: asset.amount
12000
- }
12001
- });
12002
- }
12003
- }]);
12004
- }(Parachain);
12005
-
12006
- var IntegriteeKusama = /*#__PURE__*/function (_IntegriteePolkadot) {
12007
- function IntegriteeKusama() {
12008
- var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'IntegriteeKusama';
12009
- var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'integritee';
12010
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Kusama';
12011
- var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V5;
12012
- _classCallCheck(this, IntegriteeKusama);
12013
- return _callSuper(this, IntegriteeKusama, [chain, info, type, version]);
12014
- }
12015
- _inherits(IntegriteeKusama, _IntegriteePolkadot);
12016
- return _createClass(IntegriteeKusama);
12017
- }(IntegriteePolkadot);
12018
-
12019
- var IntegriteePaseo = /*#__PURE__*/function (_IntegriteeKusama) {
12020
- function IntegriteePaseo() {
12021
- _classCallCheck(this, IntegriteePaseo);
12022
- return _callSuper(this, IntegriteePaseo, ['IntegriteePaseo', 'integritee', 'Paseo', Version.V4]);
12023
- }
12024
- _inherits(IntegriteePaseo, _IntegriteeKusama);
12025
- return _createClass(IntegriteePaseo, [{
12026
- key: "isSendingTempDisabled",
12027
- value: function isSendingTempDisabled(_options) {
12028
- return true;
12029
- }
12030
- }, {
12031
- key: "isReceivingTempDisabled",
12032
- value: function isReceivingTempDisabled(_scenario) {
12033
- return true;
12034
- }
12035
- }]);
12036
- }(IntegriteeKusama);
12037
-
12038
11940
  var Interlay = /*#__PURE__*/function (_Parachain) {
12039
11941
  function Interlay() {
12040
11942
  _classCallCheck(this, Interlay);
@@ -12155,7 +12057,7 @@ Jamton.NATIVE_ASSET_IDS = {
12155
12057
  var Karura = /*#__PURE__*/function (_Acala) {
12156
12058
  function Karura() {
12157
12059
  _classCallCheck(this, Karura);
12158
- return _callSuper(this, Karura, ['Karura', 'karura', 'Kusama', Version.V4]);
12060
+ return _callSuper(this, Karura, ['Karura', 'karura', 'Kusama', Version.V5]);
12159
12061
  }
12160
12062
  _inherits(Karura, _Acala);
12161
12063
  return _createClass(Karura);
@@ -12195,7 +12097,17 @@ var KiltPaseo = /*#__PURE__*/function (_KiltSpiritnet) {
12195
12097
  return _callSuper(this, KiltPaseo, ['KiltPaseo', 'kilt', 'Paseo', Version.V4]);
12196
12098
  }
12197
12099
  _inherits(KiltPaseo, _KiltSpiritnet);
12198
- return _createClass(KiltPaseo);
12100
+ return _createClass(KiltPaseo, [{
12101
+ key: "isSendingTempDisabled",
12102
+ value: function isSendingTempDisabled(_options) {
12103
+ return true;
12104
+ }
12105
+ }, {
12106
+ key: "isReceivingTempDisabled",
12107
+ value: function isReceivingTempDisabled(_scenario) {
12108
+ return true;
12109
+ }
12110
+ }]);
12199
12111
  }(KiltSpiritnet);
12200
12112
 
12201
12113
  var Kintsugi = /*#__PURE__*/function (_Parachain) {
@@ -12328,16 +12240,6 @@ var Manta = /*#__PURE__*/function (_Parachain) {
12328
12240
  };
12329
12241
  return transferXTokens(input, currencySelection);
12330
12242
  }
12331
- }, {
12332
- key: "isSendingTempDisabled",
12333
- value: function isSendingTempDisabled(_options) {
12334
- return true;
12335
- }
12336
- }, {
12337
- key: "isReceivingTempDisabled",
12338
- value: function isReceivingTempDisabled(_scenario) {
12339
- return true;
12340
- }
12341
12243
  }, {
12342
12244
  key: "transferLocalNonNativeAsset",
12343
12245
  value: function transferLocalNonNativeAsset(options) {
@@ -12434,27 +12336,25 @@ var Moonriver = /*#__PURE__*/function (_Parachain) {
12434
12336
 
12435
12337
  var createTypeAndThenTransfer = /*#__PURE__*/function () {
12436
12338
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, chain, version) {
12437
- var api, asset, senderAddress, address, destination, messageId, nativeMythAmount;
12339
+ var api, asset, senderAddress, address, destination, ethAsset, messageId, nativeMythAmount;
12438
12340
  return _regenerator().w(function (_context) {
12439
12341
  while (1) switch (_context.n) {
12440
12342
  case 0:
12441
12343
  api = options.api, asset = options.assetInfo, senderAddress = options.senderAddress, address = options.address, destination = options.destination;
12442
- assertHasLocation(asset);
12344
+ ethAsset = findAssetInfoOrThrow('Ethereum', {
12345
+ symbol: asset.symbol
12346
+ }, null);
12347
+ assertHasLocation(ethAsset);
12348
+ assertHasId(ethAsset);
12443
12349
  assertAddressIsString(address);
12444
12350
  assertSenderAddress(senderAddress);
12445
- if (!(!isForeignAsset(asset) || !asset.assetId)) {
12446
- _context.n = 1;
12447
- break;
12448
- }
12449
- throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " is not a foreign asset"));
12351
+ _context.n = 1;
12352
+ return generateMessageId(api, senderAddress, getParaId(chain), ethAsset.assetId, address, asset.amount);
12450
12353
  case 1:
12451
- _context.n = 2;
12452
- return generateMessageId(api, senderAddress, getParaId(chain), asset.assetId, address, asset.amount);
12453
- case 2:
12454
12354
  messageId = _context.v;
12455
- _context.n = 3;
12355
+ _context.n = 2;
12456
12356
  return getMythosOriginFee(api);
12457
- case 3:
12357
+ case 2:
12458
12358
  nativeMythAmount = _context.v;
12459
12359
  return _context.a(2, {
12460
12360
  module: 'PolkadotXcm',
@@ -12464,14 +12364,14 @@ var createTypeAndThenTransfer = /*#__PURE__*/function () {
12464
12364
  assets: _defineProperty({}, version, [createAsset(version, nativeMythAmount, {
12465
12365
  parents: Parents.ZERO,
12466
12366
  interior: 'Here'
12467
- }), createAsset(version, asset.amount, asset.location)]),
12367
+ }), createAsset(version, asset.amount, ethAsset.location)]),
12468
12368
  assets_transfer_type: 'DestinationReserve',
12469
12369
  remote_fees_id: _defineProperty({}, version, {
12470
12370
  parents: Parents.ZERO,
12471
12371
  interior: 'Here'
12472
12372
  }),
12473
12373
  fees_transfer_type: 'Teleport',
12474
- custom_xcm_on_dest: createCustomXcmOnDest(options, chain, messageId),
12374
+ custom_xcm_on_dest: createCustomXcmOnDest(options, chain, messageId, ethAsset),
12475
12375
  weight_limit: 'Unlimited'
12476
12376
  }
12477
12377
  });
@@ -12492,15 +12392,10 @@ var Mythos = /*#__PURE__*/function (_Parachain) {
12492
12392
  key: "createTx",
12493
12393
  value: function createTx(input) {
12494
12394
  var scenario = input.scenario,
12495
- asset = input.assetInfo,
12496
12395
  destination = input.destination;
12497
12396
  if (scenario !== 'ParaToPara') {
12498
12397
  throw new ScenarioNotSupportedError(this.chain, scenario);
12499
12398
  }
12500
- var nativeSymbol = this.getNativeAssetSymbol();
12501
- if (asset.symbol !== nativeSymbol) {
12502
- throw new InvalidCurrencyError("Chain ".concat(this.chain, " does not support currency ").concat(asset.symbol));
12503
- }
12504
12399
  return transferPolkadotXcm(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited');
12505
12400
  }
12506
12401
  }, {
@@ -12654,25 +12549,6 @@ var Nodle = /*#__PURE__*/function (_Parachain) {
12654
12549
  }]);
12655
12550
  }(Parachain);
12656
12551
 
12657
- var NodlePaseo = /*#__PURE__*/function (_Nodle) {
12658
- function NodlePaseo() {
12659
- _classCallCheck(this, NodlePaseo);
12660
- return _callSuper(this, NodlePaseo, ['NodlePaseo', 'NodleParadis', 'Paseo', Version.V4]);
12661
- }
12662
- _inherits(NodlePaseo, _Nodle);
12663
- return _createClass(NodlePaseo, [{
12664
- key: "isSendingTempDisabled",
12665
- value: function isSendingTempDisabled(_options) {
12666
- return true;
12667
- }
12668
- }, {
12669
- key: "isReceivingTempDisabled",
12670
- value: function isReceivingTempDisabled(_scenario) {
12671
- return true;
12672
- }
12673
- }]);
12674
- }(Nodle);
12675
-
12676
12552
  var PeoplePolkadot = /*#__PURE__*/function (_Parachain) {
12677
12553
  function PeoplePolkadot() {
12678
12554
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'PeoplePolkadot';
@@ -12744,16 +12620,6 @@ var Peaq = /*#__PURE__*/function (_Parachain) {
12744
12620
  value: function transferRelayToPara() {
12745
12621
  throw new ChainNotSupportedError();
12746
12622
  }
12747
- }, {
12748
- key: "isSendingTempDisabled",
12749
- value: function isSendingTempDisabled(_options) {
12750
- return true;
12751
- }
12752
- }, {
12753
- key: "isReceivingTempDisabled",
12754
- value: function isReceivingTempDisabled(_scenario) {
12755
- return true;
12756
- }
12757
12623
  }, {
12758
12624
  key: "transferLocalNonNativeAsset",
12759
12625
  value: function transferLocalNonNativeAsset(options) {
@@ -13011,6 +12877,16 @@ var RobonomicsKusama = /*#__PURE__*/function (_Parachain) {
13011
12877
  value: function transferLocalNonNativeAsset(options) {
13012
12878
  return getChain('RobonomicsPolkadot').transferLocalNonNativeAsset(options);
13013
12879
  }
12880
+ }, {
12881
+ key: "isSendingTempDisabled",
12882
+ value: function isSendingTempDisabled(_options) {
12883
+ return true;
12884
+ }
12885
+ }, {
12886
+ key: "isReceivingTempDisabled",
12887
+ value: function isReceivingTempDisabled(_scenario) {
12888
+ return true;
12889
+ }
13014
12890
  }]);
13015
12891
  }(Parachain);
13016
12892
 
@@ -13276,7 +13152,6 @@ var chains = function chains() {
13276
13152
  Darwinia: new Darwinia(),
13277
13153
  EnergyWebX: new EnergyWebX(),
13278
13154
  Hydration: new Hydration(),
13279
- IntegriteePolkadot: new IntegriteePolkadot(),
13280
13155
  Interlay: new Interlay(),
13281
13156
  Heima: new Heima(),
13282
13157
  Jamton: new Jamton(),
@@ -13299,7 +13174,6 @@ var chains = function chains() {
13299
13174
  AssetHubKusama: new AssetHubKusama(),
13300
13175
  BridgeHubKusama: new BridgeHubKusama(),
13301
13176
  CoretimeKusama: new CoretimeKusama(),
13302
- IntegriteeKusama: new IntegriteeKusama(),
13303
13177
  Encointer: new Encointer(),
13304
13178
  Altair: new Altair(),
13305
13179
  Amplitude: new Amplitude(),
@@ -13328,7 +13202,6 @@ var chains = function chains() {
13328
13202
  BridgeHubPaseo: new BridgeHubPaseo(),
13329
13203
  CoretimePaseo: new CoretimePaseo(),
13330
13204
  EnergyWebXPaseo: new EnergyWebXPaseo(),
13331
- IntegriteePaseo: new IntegriteePaseo(),
13332
13205
  KiltPaseo: new KiltPaseo(),
13333
13206
  PAssetHub: new PAssetHub(),
13334
13207
  PeoplePaseo: new PeoplePaseo(),
@@ -13338,7 +13211,6 @@ var chains = function chains() {
13338
13211
  HydrationPaseo: new HydrationPaseo(),
13339
13212
  LaosPaseo: new LaosPaseo(),
13340
13213
  NeuroWebPaseo: new NeuroWebPaseo(),
13341
- NodlePaseo: new NodlePaseo(),
13342
13214
  ZeitgeistPaseo: new ZeitgeistPaseo()
13343
13215
  };
13344
13216
  };