@paraspell/swap 13.4.1 → 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 +51 -11
  2. package/dist/index.mjs +2010 -900
  3. package/package.json +10 -11
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createChainClient as createChainClient$1, registerSwapExtension } from '@paraspell/sdk';
2
- import { getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, getAssetDecimals, InvalidCurrencyError, findAssetInfoOrThrow, isOverrideLocationSpecifier, UnsupportedOperationError, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, findAssetInfoByLoc, deepEqual, normalizeExchange, EXCHANGE_CHAINS, reverseTransformLocation, isAssetEqual, isExternalChain, isSystemAsset, TransferToAhNotSupported, ScenarioNotSupportedError, applyDecimalAbstraction, isConfig, findAssetInfo, getRelayChainOf, hasSupportForAsset, Builder, isChainEvm, convertBuilderConfig, InvalidAddressError, MissingParameterError, DryRunFailedError, handleSwapExecuteTransfer, BatchMode, dryRun, getFailureInfo, getOriginXcmFee, getXcmFee, createChainClient as createChainClient$2, getExistentialDepositOrThrow } from '@paraspell/sdk-core';
2
+ import { UnsupportedOperationError, assertCurrencyCore, dryRun, getFailureInfo, DryRunFailedError, isConfig, getNativeAssets, RoutingResolutionError, findAssetInfoById, getOtherAssets, getChainProviders, parseUnits, getNativeAssetSymbol, padValueBy, formatUnits as formatUnits$1, AmountTooLowError, getBalance, localizeLocation, getAssets, Parents, isSymbolMatch, getParaId, UnableToComputeError, getAssetDecimals, findNativeAssetInfoOrThrow, InvalidCurrencyError, findAssetInfoOrThrow, isOverrideLocationSpecifier, isSymbolSpecifier, findBestMatches, findAssetInfoBySymbol, findAssetInfoByLoc, deepEqual, normalizeExchange, EXCHANGE_CHAINS, reverseTransformLocation, isAssetEqual, isExternalChain, isSystemAsset, TransferToAhNotSupported, ScenarioNotSupportedError, applyDecimalAbstraction, findAssetInfo, getRelayChainOf, hasSupportForAsset, Builder, isChainEvm, convertBuilderConfig, handleSwapExecuteTransfer, getXcmFee, getOriginXcmFee as getOriginXcmFee$1, InvalidAddressError, MissingParameterError, BatchMode, createChainClient as createChainClient$2, getExistentialDepositOrThrow, buildHopInfo, getRelayChainSymbol, aggregateHopFees, buildDestInfo, buildOriginInfo } from '@paraspell/sdk-core';
3
+ import { toHex } from 'polkadot-api/utils';
3
4
  import 'polkadot-api';
4
5
  import { Wallet } from '@acala-network/sdk';
5
6
  import { FixedPointNumber } from '@acala-network/sdk-core';
@@ -15,7 +16,7 @@ import { Trade, Pair } from '@crypto-dex-sdk/amm';
15
16
  import { ParachainId } from '@crypto-dex-sdk/chain';
16
17
  import { addressToZenlinkAssetId } from '@crypto-dex-sdk/format';
17
18
  import { DEFULT_TOKEN_LIST_MAP, WrappedTokenInfo } from '@crypto-dex-sdk/token-lists';
18
- import { BigNumber, createSdkContext } from '@galacticcouncil/sdk';
19
+ import { createSdkContext } from '@galacticcouncil/sdk-next';
19
20
  import { parseUnits as parseUnits$1, ethers } from 'ethers-v6';
20
21
 
21
22
  function _arrayLikeToArray(r, a) {
@@ -368,6 +369,66 @@ function _unsupportedIterableToArray(r, a) {
368
369
  }
369
370
  }
370
371
 
372
+ var buildExchangeApiVariant = /*#__PURE__*/function () {
373
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, builderOptions) {
374
+ var _t, _t2;
375
+ return _regenerator().w(function (_context) {
376
+ while (1) switch (_context.n) {
377
+ case 0:
378
+ if (!(dex.apiType === 'PAPI')) {
379
+ _context.n = 2;
380
+ break;
381
+ }
382
+ _context.n = 1;
383
+ return dex.createApiInstancePapi(builderOptions);
384
+ case 1:
385
+ _t = _context.v;
386
+ return _context.a(2, {
387
+ apiType: 'PAPI',
388
+ apiPapi: _t
389
+ });
390
+ case 2:
391
+ if (!(dex.apiType === 'PJS')) {
392
+ _context.n = 4;
393
+ break;
394
+ }
395
+ _context.n = 3;
396
+ return dex.createApiInstance(builderOptions);
397
+ case 3:
398
+ _t2 = _context.v;
399
+ return _context.a(2, {
400
+ apiType: 'PJS',
401
+ apiPjs: _t2
402
+ });
403
+ case 4:
404
+ return _context.a(2, {
405
+ apiType: 'GENERIC'
406
+ });
407
+ }
408
+ }, _callee);
409
+ }));
410
+ return function buildExchangeApiVariant(_x, _x2) {
411
+ return _ref.apply(this, arguments);
412
+ };
413
+ }();
414
+ var pickExchangeApiVariant = function pickExchangeApiVariant(exchange) {
415
+ if (exchange.apiType === 'PAPI') {
416
+ return {
417
+ apiType: 'PAPI',
418
+ apiPapi: exchange.apiPapi
419
+ };
420
+ }
421
+ if (exchange.apiType === 'PJS') {
422
+ return {
423
+ apiType: 'PJS',
424
+ apiPjs: exchange.apiPjs
425
+ };
426
+ }
427
+ return {
428
+ apiType: 'GENERIC'
429
+ };
430
+ };
431
+
371
432
  var calculateTxFeePjs = /*#__PURE__*/function () {
372
433
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(tx, address) {
373
434
  var _yield$tx$paymentInfo, partialFee;
@@ -388,6 +449,10 @@ var calculateTxFeePjs = /*#__PURE__*/function () {
388
449
  };
389
450
  }();
390
451
 
452
+ var isPapiTransaction = function isPapiTransaction(tx) {
453
+ return _typeof(tx) === 'object' && tx !== null && 'getEncodedData' in tx && typeof tx.getEncodedData === 'function' && 'signSubmitAndWatch' in tx && typeof tx.signSubmitAndWatch === 'function';
454
+ };
455
+
391
456
  var isPjsExtrinsic = function isPjsExtrinsic(tx) {
392
457
  return _typeof(tx) === 'object' && tx !== null && 'send' in tx && typeof tx.send === 'function' && 'signAndSend' in tx && typeof tx.signAndSend === 'function' && 'signAsync' in tx && typeof tx.signAsync === 'function' && 'paymentInfo' in tx && typeof tx.paymentInfo === 'function';
393
458
  };
@@ -399,6 +464,14 @@ var pow10n = function pow10n(d) {
399
464
  return result;
400
465
  };
401
466
 
467
+ var SAFE_INT = BigInt(Number.MAX_SAFE_INTEGER);
468
+ // JSON.stringify replacer that converts bigint to number (or hex string if out
469
+ // of safe-integer range) so papi-decoded values stringify identically to the
470
+ // numeric form used in stored asset locations.
471
+ var replaceBigIntNumeric = function replaceBigIntNumeric(_key, value) {
472
+ return typeof value === 'bigint' ? value <= SAFE_INT ? Number(value) : "0x".concat(value.toString(16)) : value;
473
+ };
474
+
402
475
  var stripHeaderBytes = function stripHeaderBytes(hex, byteCount) {
403
476
  return '0x' + hex.slice(2 + byteCount * 2);
404
477
  };
@@ -413,44 +486,236 @@ var convertTxToTarget = /*#__PURE__*/function () {
413
486
  _context.n = 1;
414
487
  break;
415
488
  }
416
- _t = tx.toHex();
417
- _context.n = 3;
489
+ hex = tx.toHex();
490
+ _context.n = 5;
418
491
  break;
419
492
  case 1:
493
+ if (!isPapiTransaction(tx)) {
494
+ _context.n = 3;
495
+ break;
496
+ }
497
+ _t = toHex;
420
498
  _context.n = 2;
421
- return api.txToHex(tx);
499
+ return tx.getEncodedData();
422
500
  case 2:
423
- _t = _context.v;
501
+ hex = _t(_context.v);
502
+ _context.n = 5;
503
+ break;
424
504
  case 3:
425
- hex = _t;
505
+ _context.n = 4;
506
+ return api.txToHex(tx);
507
+ case 4:
508
+ hex = _context.v;
509
+ case 5:
426
510
  if (!(isPjsTx && api.type === 'PAPI')) {
427
- _context.n = 8;
511
+ _context.n = 10;
428
512
  break;
429
513
  }
430
- _context.p = 4;
514
+ _context.p = 6;
431
515
  hex2 = stripHeaderBytes(hex, 2);
432
- _context.n = 5;
516
+ _context.n = 7;
433
517
  return api.txFromHex(hex2);
434
- case 5:
518
+ case 7:
435
519
  return _context.a(2, _context.v);
436
- case 6:
437
- _context.p = 6;
520
+ case 8:
521
+ _context.p = 8;
438
522
  _context.v;
439
523
  hex3 = stripHeaderBytes(hex, 3);
440
- _context.n = 7;
524
+ _context.n = 9;
441
525
  return api.txFromHex(hex3);
442
- case 7:
526
+ case 9:
443
527
  return _context.a(2, _context.v);
444
- case 8:
528
+ case 10:
445
529
  return _context.a(2, api.txFromHex(hex));
446
530
  }
447
- }, _callee, null, [[4, 6]]);
531
+ }, _callee, null, [[6, 8]]);
448
532
  }));
449
533
  return function convertTxToTarget(_x, _x2) {
450
534
  return _ref.apply(this, arguments);
451
535
  };
452
536
  }();
453
537
 
538
+ var assignIsExchange = function assignIsExchange(result, options) {
539
+ var origin = options.origin,
540
+ exchange = options.exchange,
541
+ destination = options.destination;
542
+ if (!origin) {
543
+ result.origin.isExchange = true;
544
+ }
545
+ if (!destination && result.destination) {
546
+ result.destination.isExchange = true;
547
+ }
548
+ result.hops = result.hops.map(function (hop) {
549
+ var isExchange = hop.chain === exchange.chain;
550
+ return _objectSpread2(_objectSpread2({}, hop), {}, {
551
+ result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
552
+ isExchange: isExchange
553
+ }),
554
+ isExchange: isExchange
555
+ });
556
+ });
557
+ return result;
558
+ };
559
+ var dryRunTransaction = /*#__PURE__*/function () {
560
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, transaction, destChain, bypassOptions) {
561
+ var _ref2;
562
+ var api, exchange, sender, evmSenderAddress, destination, currencyFrom, currencyTo, amount, tx, chain, senderResolved, resolvedDest;
563
+ return _regenerator().w(function (_context) {
564
+ while (1) switch (_context.n) {
565
+ case 0:
566
+ api = options.api, exchange = options.exchange, sender = options.sender, evmSenderAddress = options.evmSenderAddress, destination = options.destination, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, amount = options.amount;
567
+ tx = transaction.tx, chain = transaction.chain;
568
+ assertCurrencyCore(currencyTo);
569
+ senderResolved = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
570
+ resolvedDest = (_ref2 = destChain !== null && destChain !== void 0 ? destChain : destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _ref2 !== void 0 ? _ref2 : exchange.chain;
571
+ return _context.a(2, dryRun({
572
+ api: api.clone(),
573
+ tx: tx,
574
+ origin: chain,
575
+ destination: resolvedDest,
576
+ sender: senderResolved,
577
+ swapConfig: {
578
+ currencyTo: currencyTo,
579
+ exchangeChain: exchange.chain
580
+ },
581
+ currency: _objectSpread2(_objectSpread2({}, currencyFrom), {}, {
582
+ amount: BigInt(amount)
583
+ }),
584
+ bypassOptions: bypassOptions
585
+ }));
586
+ }
587
+ }, _callee);
588
+ }));
589
+ return function dryRunTransaction(_x, _x2, _x3, _x4) {
590
+ return _ref.apply(this, arguments);
591
+ };
592
+ }();
593
+ var mergeDryRunResults = function mergeDryRunResults(options, originResult, exchangeResult) {
594
+ var exchange = options.exchange,
595
+ destination = options.destination;
596
+ var result = {
597
+ origin: originResult.origin,
598
+ destination: destination ? exchangeResult.destination : exchangeResult.origin,
599
+ hops: [].concat(_toConsumableArray(originResult.hops), _toConsumableArray(destination ? [{
600
+ chain: exchange.chain,
601
+ result: exchangeResult.origin
602
+ }] : []), _toConsumableArray(exchangeResult.hops))
603
+ };
604
+ return _objectSpread2(_objectSpread2({}, getFailureInfo(result)), result);
605
+ };
606
+ var dryRun2Transactions = /*#__PURE__*/function () {
607
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options, transactions, originBypass, exchangeBypass) {
608
+ var _originBypass$mintFee;
609
+ var exchange, _transactions, firstTx, secondTx, firstRes, _getFailureInfo, failureReason, exchangeBypassOptions, secondRes;
610
+ return _regenerator().w(function (_context2) {
611
+ while (1) switch (_context2.n) {
612
+ case 0:
613
+ exchange = options.exchange;
614
+ _transactions = _slicedToArray(transactions, 2), firstTx = _transactions[0], secondTx = _transactions[1];
615
+ _context2.n = 1;
616
+ return dryRunTransaction(options, firstTx, exchange.chain, originBypass);
617
+ case 1:
618
+ firstRes = _context2.v;
619
+ _getFailureInfo = getFailureInfo(firstRes), failureReason = _getFailureInfo.failureReason;
620
+ exchangeBypassOptions = exchangeBypass !== null && exchangeBypass !== void 0 ? exchangeBypass : !failureReason ? {
621
+ sentAssetMintMode: 'preview',
622
+ mintFeeAssets: (_originBypass$mintFee = originBypass === null || originBypass === void 0 ? void 0 : originBypass.mintFeeAssets) !== null && _originBypass$mintFee !== void 0 ? _originBypass$mintFee : false
623
+ } : undefined;
624
+ _context2.n = 2;
625
+ return dryRunTransaction(options, secondTx, undefined, exchangeBypassOptions);
626
+ case 2:
627
+ secondRes = _context2.v;
628
+ return _context2.a(2, mergeDryRunResults(options, firstRes, secondRes));
629
+ }
630
+ }, _callee2);
631
+ }));
632
+ return function dryRun2Transactions(_x5, _x6, _x7, _x8) {
633
+ return _ref3.apply(this, arguments);
634
+ };
635
+ }();
636
+ var dryRunTransactions = function dryRunTransactions(transactions, options, originBypass, exchangeBypass) {
637
+ if (transactions.length === 1) {
638
+ return dryRunTransaction(options, transactions[0], undefined, originBypass);
639
+ }
640
+ if (transactions.length === 2) {
641
+ return dryRun2Transactions(options, transactions, originBypass, exchangeBypass);
642
+ }
643
+ throw new UnsupportedOperationError('Router dry run supports up to two transactions per flow.');
644
+ };
645
+ var runDryRun = /*#__PURE__*/function () {
646
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(initialOptions, originBypassOptions) {
647
+ var _yield$prepareTransfo, options, dex, routerPlan, result;
648
+ return _regenerator().w(function (_context3) {
649
+ while (1) switch (_context3.n) {
650
+ case 0:
651
+ validateTransferOptions(initialOptions);
652
+ _context3.n = 1;
653
+ return prepareTransformedOptions(initialOptions);
654
+ case 1:
655
+ _yield$prepareTransfo = _context3.v;
656
+ options = _yield$prepareTransfo.options;
657
+ dex = _yield$prepareTransfo.dex;
658
+ _context3.n = 2;
659
+ return buildTransactions(dex, options);
660
+ case 2:
661
+ routerPlan = _context3.v;
662
+ _context3.n = 3;
663
+ return dryRunTransactions(routerPlan, options, originBypassOptions);
664
+ case 3:
665
+ result = _context3.v;
666
+ return _context3.a(2, assignIsExchange(result, options));
667
+ }
668
+ }, _callee3);
669
+ }));
670
+ return function runDryRun(_x9, _x0) {
671
+ return _ref4.apply(this, arguments);
672
+ };
673
+ }();
674
+ var dryRunRouter = function dryRunRouter(initialOptions) {
675
+ return runDryRun(initialOptions);
676
+ };
677
+ var dryRunRouterPreview = function dryRunRouterPreview(initialOptions, previewOptions) {
678
+ return runDryRun(initialOptions, {
679
+ sentAssetMintMode: 'preview',
680
+ mintFeeAssets: previewOptions === null || previewOptions === void 0 ? void 0 : previewOptions.mintFeeAssets
681
+ });
682
+ };
683
+
684
+ var BYPASS = {
685
+ sentAssetMintMode: 'bypass'
686
+ };
687
+ var maybePerformXcmFormatCheck = /*#__PURE__*/function () {
688
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, options, routerPlan) {
689
+ var config, result;
690
+ return _regenerator().w(function (_context) {
691
+ while (1) switch (_context.n) {
692
+ case 0:
693
+ config = api.config;
694
+ if (!(!isConfig(config) || !config.xcmFormatCheck)) {
695
+ _context.n = 1;
696
+ break;
697
+ }
698
+ return _context.a(2);
699
+ case 1:
700
+ _context.n = 2;
701
+ return dryRunTransactions(routerPlan, options, BYPASS, BYPASS);
702
+ case 2:
703
+ result = _context.v;
704
+ if (!result.failureReason) {
705
+ _context.n = 3;
706
+ break;
707
+ }
708
+ throw new DryRunFailedError(result.failureReason, result.failureChain, 'XCM format check failed.');
709
+ case 3:
710
+ return _context.a(2);
711
+ }
712
+ }, _callee);
713
+ }));
714
+ return function maybePerformXcmFormatCheck(_x, _x2, _x3) {
715
+ return _ref.apply(this, arguments);
716
+ };
717
+ }();
718
+
454
719
  var AssetHubPolkadot = {
455
720
  isOmni: true,
456
721
  assets: [
@@ -1150,6 +1415,16 @@ var AssetHubPaseo = {
1150
1415
  ]
1151
1416
  }
1152
1417
  },
1418
+ {
1419
+ parents: 1,
1420
+ interior: {
1421
+ X1: [
1422
+ {
1423
+ Parachain: 3377
1424
+ }
1425
+ ]
1426
+ }
1427
+ },
1153
1428
  {
1154
1429
  parents: 1,
1155
1430
  interior: {
@@ -1272,17 +1547,13 @@ var Hydration = {
1272
1547
  isOmni: true,
1273
1548
  assets: [
1274
1549
  {
1275
- parents: 1,
1550
+ parents: 2,
1276
1551
  interior: {
1277
- X3: [
1278
- {
1279
- Parachain: 1000
1280
- },
1281
- {
1282
- PalletInstance: 50
1283
- },
1552
+ X1: [
1284
1553
  {
1285
- GeneralIndex: 1337
1554
+ GlobalConsensus: {
1555
+ kusama: null
1556
+ }
1286
1557
  }
1287
1558
  ]
1288
1559
  }
@@ -1297,7 +1568,7 @@ var Hydration = {
1297
1568
  {
1298
1569
  AccountKey20: {
1299
1570
  network: null,
1300
- key: "0x2ec4884088d84e5c2970a034732e5209b0acfa93"
1571
+ key: "0x52e1311e26610e6662a1e5b5bd113130b6815213"
1301
1572
  }
1302
1573
  }
1303
1574
  ]
@@ -1306,15 +1577,15 @@ var Hydration = {
1306
1577
  {
1307
1578
  parents: 1,
1308
1579
  interior: {
1309
- X3: [
1310
- {
1311
- Parachain: 1000
1312
- },
1580
+ X2: [
1313
1581
  {
1314
- PalletInstance: 50
1582
+ Parachain: 2034
1315
1583
  },
1316
1584
  {
1317
- GeneralIndex: 1984
1585
+ AccountKey20: {
1586
+ network: null,
1587
+ key: "0x531a654d1696ed52e7275a8cede955e82620f99a"
1588
+ }
1318
1589
  }
1319
1590
  ]
1320
1591
  }
@@ -1329,7 +1600,7 @@ var Hydration = {
1329
1600
  {
1330
1601
  AccountKey20: {
1331
1602
  network: null,
1332
- key: "0xc64980e4eaf9a1151bd21712b9946b81e41e2b92"
1603
+ key: "0x2b55b6a5751f26c5cfb02429085bfd5236751443"
1333
1604
  }
1334
1605
  }
1335
1606
  ]
@@ -1338,17 +1609,14 @@ var Hydration = {
1338
1609
  {
1339
1610
  parents: 1,
1340
1611
  interior: {
1341
- X3: [
1342
- {
1343
- Parachain: 2004
1344
- },
1612
+ X2: [
1345
1613
  {
1346
- PalletInstance: 110
1614
+ Parachain: 2034
1347
1615
  },
1348
1616
  {
1349
1617
  AccountKey20: {
1350
1618
  network: null,
1351
- key: "0xe57ebd2d67b462e9926e04a8e33f01cd0d64346d"
1619
+ key: "0x987ddc8b236fb23e1e48882b206396ca9b42648b"
1352
1620
  }
1353
1621
  }
1354
1622
  ]
@@ -1364,7 +1632,7 @@ var Hydration = {
1364
1632
  {
1365
1633
  AccountKey20: {
1366
1634
  network: null,
1367
- key: "0x02759d14d0d4f452b9c76f5a230750e8857d36f2"
1635
+ key: "0x8a598fe3e3a471ce865332e330d303502a0e2f52"
1368
1636
  }
1369
1637
  }
1370
1638
  ]
@@ -1373,7 +1641,30 @@ var Hydration = {
1373
1641
  {
1374
1642
  parents: 1,
1375
1643
  interior: {
1376
- Here: null
1644
+ X2: [
1645
+ {
1646
+ Parachain: 2034
1647
+ },
1648
+ {
1649
+ GeneralIndex: 0
1650
+ }
1651
+ ]
1652
+ }
1653
+ },
1654
+ {
1655
+ parents: 1,
1656
+ interior: {
1657
+ X3: [
1658
+ {
1659
+ Parachain: 1000
1660
+ },
1661
+ {
1662
+ PalletInstance: 50
1663
+ },
1664
+ {
1665
+ GeneralIndex: 1984
1666
+ }
1667
+ ]
1377
1668
  }
1378
1669
  },
1379
1670
  {
@@ -1397,12 +1688,12 @@ var Hydration = {
1397
1688
  interior: {
1398
1689
  X2: [
1399
1690
  {
1400
- Parachain: 2030
1691
+ Parachain: 2034
1401
1692
  },
1402
1693
  {
1403
- GeneralKey: {
1404
- length: 2,
1405
- data: "0x0900000000000000000000000000000000000000000000000000000000000000"
1694
+ AccountKey20: {
1695
+ network: null,
1696
+ key: "0x1806860d27ee903c1ec7586d4f7d598d7591f124"
1406
1697
  }
1407
1698
  }
1408
1699
  ]
@@ -1413,32 +1704,31 @@ var Hydration = {
1413
1704
  interior: {
1414
1705
  X2: [
1415
1706
  {
1416
- Parachain: 2034
1707
+ Parachain: 2000
1417
1708
  },
1418
1709
  {
1419
- AccountKey20: {
1420
- network: null,
1421
- key: "0x0e13b904f4168f93814216b6874ca8349457f263"
1710
+ GeneralKey: {
1711
+ length: 21,
1712
+ data: "0x025a4d6acdc4e3e5ab15717f407afe957f7a2425780000000000000000000000"
1422
1713
  }
1423
1714
  }
1424
1715
  ]
1425
1716
  }
1426
1717
  },
1427
1718
  {
1428
- parents: 2,
1719
+ parents: 1,
1429
1720
  interior: {
1430
- X2: [
1721
+ X3: [
1431
1722
  {
1432
- GlobalConsensus: {
1433
- Ethereum: {
1434
- chainId: 1
1435
- }
1436
- }
1723
+ Parachain: 2004
1724
+ },
1725
+ {
1726
+ PalletInstance: 110
1437
1727
  },
1438
1728
  {
1439
1729
  AccountKey20: {
1440
1730
  network: null,
1441
- key: "0x18084fba666a33d37592fa2633fd49a74dd93a88"
1731
+ key: "0x931715fee2d06333043d11f658c8ce934ac61d0c"
1442
1732
  }
1443
1733
  }
1444
1734
  ]
@@ -1447,14 +1737,27 @@ var Hydration = {
1447
1737
  {
1448
1738
  parents: 1,
1449
1739
  interior: {
1450
- X2: [
1740
+ X1: [
1451
1741
  {
1452
- Parachain: 2034
1742
+ Parachain: 2086
1743
+ }
1744
+ ]
1745
+ }
1746
+ },
1747
+ {
1748
+ parents: 1,
1749
+ interior: {
1750
+ X3: [
1751
+ {
1752
+ Parachain: 2004
1753
+ },
1754
+ {
1755
+ PalletInstance: 110
1453
1756
  },
1454
1757
  {
1455
1758
  AccountKey20: {
1456
1759
  network: null,
1457
- key: "0x69003a65189f6ed993d3bd3e2b74f1db39f405ce"
1760
+ key: "0xab3f0245b83feb11d15aaffefd7ad465a59817ed"
1458
1761
  }
1459
1762
  }
1460
1763
  ]
@@ -1462,31 +1765,65 @@ var Hydration = {
1462
1765
  },
1463
1766
  {
1464
1767
  parents: 1,
1768
+ interior: {
1769
+ X3: [
1770
+ {
1771
+ Parachain: 2094
1772
+ },
1773
+ {
1774
+ PalletInstance: 53
1775
+ },
1776
+ {
1777
+ GeneralIndex: 2
1778
+ }
1779
+ ]
1780
+ }
1781
+ },
1782
+ {
1783
+ parents: 1,
1784
+ interior: {
1785
+ X1: [
1786
+ {
1787
+ Parachain: 3369
1788
+ }
1789
+ ]
1790
+ }
1791
+ },
1792
+ {
1793
+ parents: 2,
1465
1794
  interior: {
1466
1795
  X2: [
1467
1796
  {
1468
- Parachain: 2034
1797
+ GlobalConsensus: {
1798
+ Ethereum: {
1799
+ chainId: 1
1800
+ }
1801
+ }
1469
1802
  },
1470
1803
  {
1471
1804
  AccountKey20: {
1472
1805
  network: null,
1473
- key: "0x34d5ffb83d14d82f87aaf2f13be895a3c814c2ad"
1806
+ key: "0x45804880de22913dafe09f4980848ece6ecbaf78"
1474
1807
  }
1475
1808
  }
1476
1809
  ]
1477
1810
  }
1478
1811
  },
1479
1812
  {
1480
- parents: 1,
1813
+ parents: 2,
1481
1814
  interior: {
1482
1815
  X2: [
1483
1816
  {
1484
- Parachain: 2034
1817
+ GlobalConsensus: {
1818
+ Ethereum: {
1819
+ chainId: 1
1820
+ }
1821
+ }
1485
1822
  },
1486
1823
  {
1487
1824
  AccountKey20: {
1488
1825
  network: null,
1489
- key: "0x8a598fe3e3a471ce865332e330d303502a0e2f52"
1826
+ key: "0x57e114b691db790c35207b2e685d4a43181e6061"
1490
1827
  }
1491
1828
  }
1492
1829
  ]
@@ -1511,13 +1848,10 @@ var Hydration = {
1511
1848
  interior: {
1512
1849
  X2: [
1513
1850
  {
1514
- Parachain: 2034
1851
+ Parachain: 2004
1515
1852
  },
1516
1853
  {
1517
- AccountKey20: {
1518
- network: null,
1519
- key: "0x11a8f7ffbb7e0fbed88bc20179dd45b4bd6874ff"
1520
- }
1854
+ PalletInstance: 10
1521
1855
  }
1522
1856
  ]
1523
1857
  }
@@ -1527,12 +1861,12 @@ var Hydration = {
1527
1861
  interior: {
1528
1862
  X2: [
1529
1863
  {
1530
- Parachain: 2034
1864
+ Parachain: 2032
1531
1865
  },
1532
1866
  {
1533
- AccountKey20: {
1534
- network: null,
1535
- key: "0xc09cf2f85367f3c2ab66e094283de3a499cb9108"
1867
+ GeneralKey: {
1868
+ length: 2,
1869
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
1536
1870
  }
1537
1871
  }
1538
1872
  ]
@@ -1548,7 +1882,7 @@ var Hydration = {
1548
1882
  {
1549
1883
  AccountKey20: {
1550
1884
  network: null,
1551
- key: "0x35774c305aaf441a102d47988d35f0f5428471b3"
1885
+ key: "0xc09cf2f85367f3c2ab66e094283de3a499cb9108"
1552
1886
  }
1553
1887
  }
1554
1888
  ]
@@ -1557,15 +1891,15 @@ var Hydration = {
1557
1891
  {
1558
1892
  parents: 1,
1559
1893
  interior: {
1560
- X2: [
1894
+ X3: [
1561
1895
  {
1562
- Parachain: 2034
1896
+ Parachain: 1000
1563
1897
  },
1564
1898
  {
1565
- AccountKey20: {
1566
- network: null,
1567
- key: "0x1806860d27ee903c1ec7586d4f7d598d7591f124"
1568
- }
1899
+ PalletInstance: 50
1900
+ },
1901
+ {
1902
+ GeneralIndex: 31337
1569
1903
  }
1570
1904
  ]
1571
1905
  }
@@ -1591,12 +1925,12 @@ var Hydration = {
1591
1925
  interior: {
1592
1926
  X2: [
1593
1927
  {
1594
- Parachain: 2034
1928
+ Parachain: 2000
1595
1929
  },
1596
1930
  {
1597
- AccountKey20: {
1598
- network: null,
1599
- key: "0x52e1311e26610e6662a1e5b5bd113130b6815213"
1931
+ GeneralKey: {
1932
+ length: 2,
1933
+ data: "0x0000000000000000000000000000000000000000000000000000000000000000"
1600
1934
  }
1601
1935
  }
1602
1936
  ]
@@ -1616,7 +1950,7 @@ var Hydration = {
1616
1950
  {
1617
1951
  AccountKey20: {
1618
1952
  network: null,
1619
- key: "0x45804880de22913dafe09f4980848ece6ecbaf78"
1953
+ key: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
1620
1954
  }
1621
1955
  }
1622
1956
  ]
@@ -1627,12 +1961,12 @@ var Hydration = {
1627
1961
  interior: {
1628
1962
  X2: [
1629
1963
  {
1630
- Parachain: 2034
1964
+ Parachain: 2030
1631
1965
  },
1632
1966
  {
1633
- AccountKey20: {
1634
- network: null,
1635
- key: "0x00f283c7a97ecb60dd905cdab52febceec04dc0f"
1967
+ GeneralKey: {
1968
+ length: 2,
1969
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
1636
1970
  }
1637
1971
  }
1638
1972
  ]
@@ -1641,17 +1975,14 @@ var Hydration = {
1641
1975
  {
1642
1976
  parents: 1,
1643
1977
  interior: {
1644
- X3: [
1645
- {
1646
- Parachain: 2004
1647
- },
1978
+ X2: [
1648
1979
  {
1649
- PalletInstance: 110
1980
+ Parachain: 2034
1650
1981
  },
1651
1982
  {
1652
1983
  AccountKey20: {
1653
1984
  network: null,
1654
- key: "0x52b2f622f5676e92dbea3092004eb9ffb85a8d07"
1985
+ key: "0x69003a65189f6ed993d3bd3e2b74f1db39f405ce"
1655
1986
  }
1656
1987
  }
1657
1988
  ]
@@ -1662,28 +1993,32 @@ var Hydration = {
1662
1993
  interior: {
1663
1994
  X2: [
1664
1995
  {
1665
- Parachain: 2034
1996
+ Parachain: 2000
1666
1997
  },
1667
1998
  {
1668
- AccountKey20: {
1669
- network: null,
1670
- key: "0x4c892a298a9c6b4ced988b3d6e9cf93333aadcf7"
1999
+ GeneralKey: {
2000
+ length: 21,
2001
+ data: "0x02f4c723e61709d90f89939c1852f516e373d418a80000000000000000000000"
1671
2002
  }
1672
2003
  }
1673
2004
  ]
1674
2005
  }
1675
2006
  },
1676
2007
  {
1677
- parents: 1,
2008
+ parents: 2,
1678
2009
  interior: {
1679
2010
  X2: [
1680
2011
  {
1681
- Parachain: 2034
2012
+ GlobalConsensus: {
2013
+ Ethereum: {
2014
+ chainId: 1
2015
+ }
2016
+ }
1682
2017
  },
1683
2018
  {
1684
2019
  AccountKey20: {
1685
2020
  network: null,
1686
- key: "0xf5f744a4d14a5f49ce173e39b8361733a6e55152"
2021
+ key: "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
1687
2022
  }
1688
2023
  }
1689
2024
  ]
@@ -1702,23 +2037,27 @@ var Hydration = {
1702
2037
  {
1703
2038
  AccountKey20: {
1704
2039
  network: null,
1705
- key: "0x99fec54a5ad36d50a4bba3a41cab983a5bb86a7d"
2040
+ key: "0xe57ebd2d67b462e9926e04a8e33f01cd0d64346d"
1706
2041
  }
1707
2042
  }
1708
2043
  ]
1709
2044
  }
1710
2045
  },
1711
2046
  {
1712
- parents: 1,
2047
+ parents: 2,
1713
2048
  interior: {
1714
2049
  X2: [
1715
2050
  {
1716
- Parachain: 2034
2051
+ GlobalConsensus: {
2052
+ Ethereum: {
2053
+ chainId: 1
2054
+ }
2055
+ }
1717
2056
  },
1718
2057
  {
1719
2058
  AccountKey20: {
1720
2059
  network: null,
1721
- key: "0x2b55b6a5751f26c5cfb02429085bfd5236751443"
2060
+ key: "0x56072c95faa701256059aa122697b133aded9279"
1722
2061
  }
1723
2062
  }
1724
2063
  ]
@@ -1727,33 +2066,34 @@ var Hydration = {
1727
2066
  {
1728
2067
  parents: 1,
1729
2068
  interior: {
1730
- X3: [
1731
- {
1732
- Parachain: 2004
1733
- },
2069
+ X2: [
1734
2070
  {
1735
- PalletInstance: 110
2071
+ Parachain: 2034
1736
2072
  },
1737
2073
  {
1738
2074
  AccountKey20: {
1739
2075
  network: null,
1740
- key: "0x3f9610a50630bc7d4530736942ee2bc9e00e8de8"
2076
+ key: "0x49f925bf72718f4abbc57adef1b705931f928a2a"
1741
2077
  }
1742
2078
  }
1743
2079
  ]
1744
2080
  }
1745
2081
  },
1746
2082
  {
1747
- parents: 1,
2083
+ parents: 2,
1748
2084
  interior: {
1749
2085
  X2: [
1750
2086
  {
1751
- Parachain: 2034
2087
+ GlobalConsensus: {
2088
+ Ethereum: {
2089
+ chainId: 1
2090
+ }
2091
+ }
1752
2092
  },
1753
2093
  {
1754
2094
  AccountKey20: {
1755
2095
  network: null,
1756
- key: "0xca30f9ff99394c55deda293df223e3740635c72e"
2096
+ key: "0xaa7a9ca87d3694b5755f213b5d04094b8d0f0a6f"
1757
2097
  }
1758
2098
  }
1759
2099
  ]
@@ -1764,13 +2104,10 @@ var Hydration = {
1764
2104
  interior: {
1765
2105
  X2: [
1766
2106
  {
1767
- Parachain: 2034
2107
+ Parachain: 2043
1768
2108
  },
1769
2109
  {
1770
- AccountKey20: {
1771
- network: null,
1772
- key: "0x49f925bf72718f4abbc57adef1b705931f928a2a"
1773
- }
2110
+ PalletInstance: 10
1774
2111
  }
1775
2112
  ]
1776
2113
  }
@@ -1780,13 +2117,10 @@ var Hydration = {
1780
2117
  interior: {
1781
2118
  X2: [
1782
2119
  {
1783
- Parachain: 2034
2120
+ Parachain: 2046
1784
2121
  },
1785
2122
  {
1786
- AccountKey20: {
1787
- network: null,
1788
- key: "0x987ddc8b236fb23e1e48882b206396ca9b42648b"
1789
- }
2123
+ PalletInstance: 5
1790
2124
  }
1791
2125
  ]
1792
2126
  }
@@ -1796,33 +2130,33 @@ var Hydration = {
1796
2130
  interior: {
1797
2131
  X2: [
1798
2132
  {
1799
- Parachain: 2034
2133
+ Parachain: 2030
1800
2134
  },
1801
2135
  {
1802
- GeneralIndex: 0
2136
+ GeneralKey: {
2137
+ length: 2,
2138
+ data: "0x0903000000000000000000000000000000000000000000000000000000000000"
2139
+ }
1803
2140
  }
1804
2141
  ]
1805
2142
  }
1806
2143
  },
1807
2144
  {
1808
- parents: 1,
1809
- interior: {
1810
- X1: [
1811
- {
1812
- Parachain: 2008
1813
- }
1814
- ]
1815
- }
1816
- },
1817
- {
1818
- parents: 1,
2145
+ parents: 2,
1819
2146
  interior: {
1820
2147
  X2: [
1821
2148
  {
1822
- Parachain: 2026
2149
+ GlobalConsensus: {
2150
+ Ethereum: {
2151
+ chainId: 1
2152
+ }
2153
+ }
1823
2154
  },
1824
2155
  {
1825
- PalletInstance: 2
2156
+ AccountKey20: {
2157
+ network: null,
2158
+ key: "0xcccccccccc33d538dbc2ee4feab0a7a1ff4e8a94"
2159
+ }
1826
2160
  }
1827
2161
  ]
1828
2162
  }
@@ -1830,9 +2164,18 @@ var Hydration = {
1830
2164
  {
1831
2165
  parents: 1,
1832
2166
  interior: {
1833
- X1: [
2167
+ X3: [
1834
2168
  {
1835
- Parachain: 2037
2169
+ Parachain: 2004
2170
+ },
2171
+ {
2172
+ PalletInstance: 110
2173
+ },
2174
+ {
2175
+ AccountKey20: {
2176
+ network: null,
2177
+ key: "0x3f9610a50630bc7d4530736942ee2bc9e00e8de8"
2178
+ }
1836
2179
  }
1837
2180
  ]
1838
2181
  }
@@ -1840,9 +2183,15 @@ var Hydration = {
1840
2183
  {
1841
2184
  parents: 1,
1842
2185
  interior: {
1843
- X1: [
2186
+ X2: [
1844
2187
  {
1845
- Parachain: 3369
2188
+ Parachain: 2030
2189
+ },
2190
+ {
2191
+ GeneralKey: {
2192
+ length: 2,
2193
+ data: "0x0900000000000000000000000000000000000000000000000000000000000000"
2194
+ }
1846
2195
  }
1847
2196
  ]
1848
2197
  }
@@ -1852,20 +2201,33 @@ var Hydration = {
1852
2201
  interior: {
1853
2202
  X2: [
1854
2203
  {
1855
- Parachain: 2094
2204
+ Parachain: 2034
1856
2205
  },
1857
2206
  {
1858
- PalletInstance: 10
2207
+ AccountKey20: {
2208
+ network: null,
2209
+ key: "0x00f283c7a97ecb60dd905cdab52febceec04dc0f"
2210
+ }
1859
2211
  }
1860
2212
  ]
1861
2213
  }
1862
2214
  },
1863
2215
  {
1864
- parents: 1,
2216
+ parents: 2,
1865
2217
  interior: {
1866
- X1: [
2218
+ X2: [
1867
2219
  {
1868
- Parachain: 3370
2220
+ GlobalConsensus: {
2221
+ Ethereum: {
2222
+ chainId: 1
2223
+ }
2224
+ }
2225
+ },
2226
+ {
2227
+ AccountKey20: {
2228
+ network: null,
2229
+ key: "0x514910771af9ca656af840dff83e8264ecf986ca"
2230
+ }
1869
2231
  }
1870
2232
  ]
1871
2233
  }
@@ -1883,7 +2245,7 @@ var Hydration = {
1883
2245
  {
1884
2246
  AccountKey20: {
1885
2247
  network: null,
1886
- key: "0x931715fee2d06333043d11f658c8ce934ac61d0c"
2248
+ key: "0xe9f9a2e3deae4093c00fbc57b22bb51a4c05ad88"
1887
2249
  }
1888
2250
  }
1889
2251
  ]
@@ -1892,15 +2254,15 @@ var Hydration = {
1892
2254
  {
1893
2255
  parents: 1,
1894
2256
  interior: {
1895
- X3: [
1896
- {
1897
- Parachain: 1000
1898
- },
2257
+ X2: [
1899
2258
  {
1900
- PalletInstance: 50
2259
+ Parachain: 2000
1901
2260
  },
1902
2261
  {
1903
- GeneralIndex: 31337
2262
+ GeneralKey: {
2263
+ length: 21,
2264
+ data: "0x0254a37a01cd75b616d63e0ab665bffdb0143c52ae0000000000000000000000"
2265
+ }
1904
2266
  }
1905
2267
  ]
1906
2268
  }
@@ -1910,10 +2272,10 @@ var Hydration = {
1910
2272
  interior: {
1911
2273
  X2: [
1912
2274
  {
1913
- Parachain: 2043
2275
+ Parachain: 3417
1914
2276
  },
1915
2277
  {
1916
- PalletInstance: 10
2278
+ GeneralIndex: 0
1917
2279
  }
1918
2280
  ]
1919
2281
  }
@@ -1921,19 +2283,15 @@ var Hydration = {
1921
2283
  {
1922
2284
  parents: 1,
1923
2285
  interior: {
1924
- X1: [
2286
+ X2: [
1925
2287
  {
1926
- Parachain: 3345
1927
- }
1928
- ]
1929
- }
1930
- },
1931
- {
1932
- parents: 1,
1933
- interior: {
1934
- X1: [
2288
+ Parachain: 2031
2289
+ },
1935
2290
  {
1936
- Parachain: 2101
2291
+ GeneralKey: {
2292
+ length: 2,
2293
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
2294
+ }
1937
2295
  }
1938
2296
  ]
1939
2297
  }
@@ -1948,7 +2306,7 @@ var Hydration = {
1948
2306
  {
1949
2307
  AccountKey20: {
1950
2308
  network: null,
1951
- key: "0x531a654d1696ed52e7275a8cede955e82620f99a"
2309
+ key: "0xc64980e4eaf9a1151bd21712b9946b81e41e2b92"
1952
2310
  }
1953
2311
  }
1954
2312
  ]
@@ -1973,27 +2331,28 @@ var Hydration = {
1973
2331
  {
1974
2332
  parents: 1,
1975
2333
  interior: {
1976
- X2: [
2334
+ X3: [
1977
2335
  {
1978
- Parachain: 2032
2336
+ Parachain: 2004
1979
2337
  },
1980
2338
  {
1981
- GeneralKey: {
1982
- length: 2,
1983
- data: "0x0002000000000000000000000000000000000000000000000000000000000000"
2339
+ PalletInstance: 110
2340
+ },
2341
+ {
2342
+ AccountKey20: {
2343
+ network: null,
2344
+ key: "0xda430218862d3db25de9f61458645dde49a9e9c1"
1984
2345
  }
1985
2346
  }
1986
2347
  ]
1987
2348
  }
1988
2349
  },
1989
2350
  {
1990
- parents: 2,
2351
+ parents: 1,
1991
2352
  interior: {
1992
2353
  X1: [
1993
2354
  {
1994
- GlobalConsensus: {
1995
- kusama: null
1996
- }
2355
+ Parachain: 2008
1997
2356
  }
1998
2357
  ]
1999
2358
  }
@@ -2012,7 +2371,7 @@ var Hydration = {
2012
2371
  {
2013
2372
  AccountKey20: {
2014
2373
  network: null,
2015
- key: "0x57e114b691db790c35207b2e685d4a43181e6061"
2374
+ key: "0x9d39a5de30e57443bff2a8307a4256c8797a3497"
2016
2375
  }
2017
2376
  }
2018
2377
  ]
@@ -2021,28 +2380,9 @@ var Hydration = {
2021
2380
  {
2022
2381
  parents: 1,
2023
2382
  interior: {
2024
- X2: [
2025
- {
2026
- Parachain: 2004
2027
- },
2028
- {
2029
- PalletInstance: 10
2030
- }
2031
- ]
2032
- }
2033
- },
2034
- {
2035
- parents: 1,
2036
- interior: {
2037
- X2: [
2038
- {
2039
- Parachain: 2030
2040
- },
2383
+ X1: [
2041
2384
  {
2042
- GeneralKey: {
2043
- length: 2,
2044
- data: "0x0001000000000000000000000000000000000000000000000000000000000000"
2045
- }
2385
+ Parachain: 3344
2046
2386
  }
2047
2387
  ]
2048
2388
  }
@@ -2061,47 +2401,45 @@ var Hydration = {
2061
2401
  {
2062
2402
  AccountKey20: {
2063
2403
  network: null,
2064
- key: "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
2404
+ key: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c"
2065
2405
  }
2066
2406
  }
2067
2407
  ]
2068
2408
  }
2069
2409
  },
2070
2410
  {
2071
- parents: 2,
2411
+ parents: 1,
2072
2412
  interior: {
2073
- X2: [
2413
+ X3: [
2074
2414
  {
2075
- GlobalConsensus: {
2076
- Ethereum: {
2077
- chainId: 1
2078
- }
2079
- }
2415
+ Parachain: 2004
2416
+ },
2417
+ {
2418
+ PalletInstance: 110
2080
2419
  },
2081
2420
  {
2082
2421
  AccountKey20: {
2083
2422
  network: null,
2084
- key: "0x56072c95faa701256059aa122697b133aded9279"
2423
+ key: "0x484ecce6775143d3335ed2c7bcb22151c53b9f49"
2085
2424
  }
2086
2425
  }
2087
2426
  ]
2088
2427
  }
2089
2428
  },
2090
2429
  {
2091
- parents: 2,
2430
+ parents: 1,
2092
2431
  interior: {
2093
- X2: [
2432
+ X3: [
2094
2433
  {
2095
- GlobalConsensus: {
2096
- Ethereum: {
2097
- chainId: 1
2098
- }
2099
- }
2434
+ Parachain: 2004
2435
+ },
2436
+ {
2437
+ PalletInstance: 110
2100
2438
  },
2101
2439
  {
2102
2440
  AccountKey20: {
2103
2441
  network: null,
2104
- key: "0xaa7a9ca87d3694b5755f213b5d04094b8d0f0a6f"
2442
+ key: "0x52b2f622f5676e92dbea3092004eb9ffb85a8d07"
2105
2443
  }
2106
2444
  }
2107
2445
  ]
@@ -2110,34 +2448,23 @@ var Hydration = {
2110
2448
  {
2111
2449
  parents: 1,
2112
2450
  interior: {
2113
- X2: [
2114
- {
2115
- Parachain: 2030
2116
- },
2117
- {
2118
- GeneralKey: {
2119
- length: 2,
2120
- data: "0x0903000000000000000000000000000000000000000000000000000000000000"
2121
- }
2122
- }
2123
- ]
2451
+ Here: null
2124
2452
  }
2125
2453
  },
2126
2454
  {
2127
- parents: 2,
2455
+ parents: 1,
2128
2456
  interior: {
2129
- X2: [
2457
+ X3: [
2130
2458
  {
2131
- GlobalConsensus: {
2132
- Ethereum: {
2133
- chainId: 1
2134
- }
2135
- }
2459
+ Parachain: 2004
2460
+ },
2461
+ {
2462
+ PalletInstance: 110
2136
2463
  },
2137
2464
  {
2138
2465
  AccountKey20: {
2139
2466
  network: null,
2140
- key: "0x514910771af9ca656af840dff83e8264ecf986ca"
2467
+ key: "0x06e605775296e851ff43b4daa541bb0984e9d6fd"
2141
2468
  }
2142
2469
  }
2143
2470
  ]
@@ -2146,17 +2473,14 @@ var Hydration = {
2146
2473
  {
2147
2474
  parents: 1,
2148
2475
  interior: {
2149
- X3: [
2150
- {
2151
- Parachain: 2004
2152
- },
2476
+ X2: [
2153
2477
  {
2154
- PalletInstance: 110
2478
+ Parachain: 2000
2155
2479
  },
2156
2480
  {
2157
- AccountKey20: {
2158
- network: null,
2159
- key: "0x484ecce6775143d3335ed2c7bcb22151c53b9f49"
2481
+ GeneralKey: {
2482
+ length: 21,
2483
+ data: "0x0207df96d1341a7d16ba1ad431e2c847d978bc2bce0000000000000000000000"
2160
2484
  }
2161
2485
  }
2162
2486
  ]
@@ -2185,9 +2509,12 @@ var Hydration = {
2185
2509
  {
2186
2510
  parents: 1,
2187
2511
  interior: {
2188
- X1: [
2512
+ X2: [
2189
2513
  {
2190
- Parachain: 2006
2514
+ Parachain: 2026
2515
+ },
2516
+ {
2517
+ PalletInstance: 2
2191
2518
  }
2192
2519
  ]
2193
2520
  }
@@ -2195,18 +2522,9 @@ var Hydration = {
2195
2522
  {
2196
2523
  parents: 1,
2197
2524
  interior: {
2198
- X3: [
2199
- {
2200
- Parachain: 2004
2201
- },
2202
- {
2203
- PalletInstance: 110
2204
- },
2525
+ X1: [
2205
2526
  {
2206
- AccountKey20: {
2207
- network: null,
2208
- key: "0x06e605775296e851ff43b4daa541bb0984e9d6fd"
2209
- }
2527
+ Parachain: 3370
2210
2528
  }
2211
2529
  ]
2212
2530
  }
@@ -2214,17 +2532,14 @@ var Hydration = {
2214
2532
  {
2215
2533
  parents: 1,
2216
2534
  interior: {
2217
- X3: [
2218
- {
2219
- Parachain: 2004
2220
- },
2535
+ X2: [
2221
2536
  {
2222
- PalletInstance: 110
2537
+ Parachain: 2034
2223
2538
  },
2224
2539
  {
2225
2540
  AccountKey20: {
2226
2541
  network: null,
2227
- key: "0xc30e9ca94cf52f3bf5692aacf81353a27052c46f"
2542
+ key: "0x2ec4884088d84e5c2970a034732e5209b0acfa93"
2228
2543
  }
2229
2544
  }
2230
2545
  ]
@@ -2235,12 +2550,12 @@ var Hydration = {
2235
2550
  interior: {
2236
2551
  X2: [
2237
2552
  {
2238
- Parachain: 2032
2553
+ Parachain: 2034
2239
2554
  },
2240
2555
  {
2241
- GeneralKey: {
2242
- length: 2,
2243
- data: "0x0001000000000000000000000000000000000000000000000000000000000000"
2556
+ AccountKey20: {
2557
+ network: null,
2558
+ key: "0xca30f9ff99394c55deda293df223e3740635c72e"
2244
2559
  }
2245
2560
  }
2246
2561
  ]
@@ -2260,18 +2575,76 @@ var Hydration = {
2260
2575
  {
2261
2576
  AccountKey20: {
2262
2577
  network: null,
2263
- key: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
2578
+ key: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"
2264
2579
  }
2265
2580
  }
2266
2581
  ]
2267
2582
  }
2268
2583
  },
2269
2584
  {
2270
- parents: 2,
2585
+ parents: 1,
2271
2586
  interior: {
2272
- X2: [
2587
+ X3: [
2273
2588
  {
2274
- GlobalConsensus: {
2589
+ Parachain: 1000
2590
+ },
2591
+ {
2592
+ PalletInstance: 50
2593
+ },
2594
+ {
2595
+ GeneralIndex: 1337
2596
+ }
2597
+ ]
2598
+ }
2599
+ },
2600
+ {
2601
+ parents: 1,
2602
+ interior: {
2603
+ X2: [
2604
+ {
2605
+ Parachain: 2034
2606
+ },
2607
+ {
2608
+ AccountKey20: {
2609
+ network: null,
2610
+ key: "0x0e13b904f4168f93814216b6874ca8349457f263"
2611
+ }
2612
+ }
2613
+ ]
2614
+ }
2615
+ },
2616
+ {
2617
+ parents: 1,
2618
+ interior: {
2619
+ X2: [
2620
+ {
2621
+ Parachain: 2034
2622
+ },
2623
+ {
2624
+ AccountKey20: {
2625
+ network: null,
2626
+ key: "0x11a8f7ffbb7e0fbed88bc20179dd45b4bd6874ff"
2627
+ }
2628
+ }
2629
+ ]
2630
+ }
2631
+ },
2632
+ {
2633
+ parents: 1,
2634
+ interior: {
2635
+ X1: [
2636
+ {
2637
+ Parachain: 2101
2638
+ }
2639
+ ]
2640
+ }
2641
+ },
2642
+ {
2643
+ parents: 2,
2644
+ interior: {
2645
+ X2: [
2646
+ {
2647
+ GlobalConsensus: {
2275
2648
  Ethereum: {
2276
2649
  chainId: 1
2277
2650
  }
@@ -2280,12 +2653,22 @@ var Hydration = {
2280
2653
  {
2281
2654
  AccountKey20: {
2282
2655
  network: null,
2283
- key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
2656
+ key: "0xa3931d71877c0e7a3148cb7eb4463524fec27fbd"
2284
2657
  }
2285
2658
  }
2286
2659
  ]
2287
2660
  }
2288
2661
  },
2662
+ {
2663
+ parents: 1,
2664
+ interior: {
2665
+ X1: [
2666
+ {
2667
+ Parachain: 2035
2668
+ }
2669
+ ]
2670
+ }
2671
+ },
2289
2672
  {
2290
2673
  parents: 2,
2291
2674
  interior: {
@@ -2306,6 +2689,219 @@ var Hydration = {
2306
2689
  ]
2307
2690
  }
2308
2691
  },
2692
+ {
2693
+ parents: 1,
2694
+ interior: {
2695
+ X2: [
2696
+ {
2697
+ Parachain: 2034
2698
+ },
2699
+ {
2700
+ AccountKey20: {
2701
+ network: null,
2702
+ key: "0x35774c305aaf441a102d47988d35f0f5428471b3"
2703
+ }
2704
+ }
2705
+ ]
2706
+ }
2707
+ },
2708
+ {
2709
+ parents: 1,
2710
+ interior: {
2711
+ X2: [
2712
+ {
2713
+ Parachain: 2000
2714
+ },
2715
+ {
2716
+ GeneralKey: {
2717
+ length: 2,
2718
+ data: "0x0003000000000000000000000000000000000000000000000000000000000000"
2719
+ }
2720
+ }
2721
+ ]
2722
+ }
2723
+ },
2724
+ {
2725
+ parents: 1,
2726
+ interior: {
2727
+ X2: [
2728
+ {
2729
+ Parachain: 2034
2730
+ },
2731
+ {
2732
+ AccountKey20: {
2733
+ network: null,
2734
+ key: "0x02759d14d0d4f452b9c76f5a230750e8857d36f2"
2735
+ }
2736
+ }
2737
+ ]
2738
+ }
2739
+ },
2740
+ {
2741
+ parents: 2,
2742
+ interior: {
2743
+ X2: [
2744
+ {
2745
+ GlobalConsensus: {
2746
+ Ethereum: {
2747
+ chainId: 1
2748
+ }
2749
+ }
2750
+ },
2751
+ {
2752
+ AccountKey20: {
2753
+ network: null,
2754
+ key: "0xdac17f958d2ee523a2206206994597c13d831ec7"
2755
+ }
2756
+ }
2757
+ ]
2758
+ }
2759
+ },
2760
+ {
2761
+ parents: 2,
2762
+ interior: {
2763
+ X2: [
2764
+ {
2765
+ GlobalConsensus: {
2766
+ Ethereum: {
2767
+ chainId: 1
2768
+ }
2769
+ }
2770
+ },
2771
+ {
2772
+ AccountKey20: {
2773
+ network: null,
2774
+ key: "0x18084fba666a33d37592fa2633fd49a74dd93a88"
2775
+ }
2776
+ }
2777
+ ]
2778
+ }
2779
+ },
2780
+ {
2781
+ parents: 1,
2782
+ interior: {
2783
+ X1: [
2784
+ {
2785
+ Parachain: 3345
2786
+ }
2787
+ ]
2788
+ }
2789
+ },
2790
+ {
2791
+ parents: 1,
2792
+ interior: {
2793
+ X2: [
2794
+ {
2795
+ Parachain: 2092
2796
+ },
2797
+ {
2798
+ GeneralKey: {
2799
+ length: 2,
2800
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
2801
+ }
2802
+ }
2803
+ ]
2804
+ }
2805
+ },
2806
+ {
2807
+ parents: 1,
2808
+ interior: {
2809
+ X2: [
2810
+ {
2811
+ Parachain: 2094
2812
+ },
2813
+ {
2814
+ PalletInstance: 10
2815
+ }
2816
+ ]
2817
+ }
2818
+ },
2819
+ {
2820
+ parents: 1,
2821
+ interior: {
2822
+ X2: [
2823
+ {
2824
+ Parachain: 2000
2825
+ },
2826
+ {
2827
+ GeneralKey: {
2828
+ length: 21,
2829
+ data: "0x02c80084af223c8b598536178d9361dc55bfda68180000000000000000000000"
2830
+ }
2831
+ }
2832
+ ]
2833
+ }
2834
+ },
2835
+ {
2836
+ parents: 1,
2837
+ interior: {
2838
+ X2: [
2839
+ {
2840
+ Parachain: 2032
2841
+ },
2842
+ {
2843
+ GeneralKey: {
2844
+ length: 2,
2845
+ data: "0x0002000000000000000000000000000000000000000000000000000000000000"
2846
+ }
2847
+ }
2848
+ ]
2849
+ }
2850
+ },
2851
+ {
2852
+ parents: 1,
2853
+ interior: {
2854
+ X1: [
2855
+ {
2856
+ Parachain: 2037
2857
+ }
2858
+ ]
2859
+ }
2860
+ },
2861
+ {
2862
+ parents: 1,
2863
+ interior: {
2864
+ X5: [
2865
+ {
2866
+ Parachain: 2094
2867
+ },
2868
+ {
2869
+ PalletInstance: 53
2870
+ },
2871
+ {
2872
+ GeneralIndex: 2
2873
+ },
2874
+ {
2875
+ GeneralKey: {
2876
+ length: 4,
2877
+ data: "0x4555524300000000000000000000000000000000000000000000000000000000"
2878
+ }
2879
+ },
2880
+ {
2881
+ GeneralKey: {
2882
+ length: 32,
2883
+ data: "0xcf4f5a26e2090bb3adcf02c7a9d73dbfe6659cc690461475b86437fa49c71136"
2884
+ }
2885
+ }
2886
+ ]
2887
+ }
2888
+ },
2889
+ {
2890
+ parents: 1,
2891
+ interior: {
2892
+ X2: [
2893
+ {
2894
+ Parachain: 2034
2895
+ },
2896
+ {
2897
+ AccountKey20: {
2898
+ network: null,
2899
+ key: "0x34d5ffb83d14d82f87aaf2f13be895a3c814c2ad"
2900
+ }
2901
+ }
2902
+ ]
2903
+ }
2904
+ },
2309
2905
  {
2310
2906
  parents: 1,
2311
2907
  interior: {
@@ -2319,7 +2915,7 @@ var Hydration = {
2319
2915
  {
2320
2916
  AccountKey20: {
2321
2917
  network: null,
2322
- key: "0xab3f0245b83feb11d15aaffefd7ad465a59817ed"
2918
+ key: "0xc30e9ca94cf52f3bf5692aacf81353a27052c46f"
2323
2919
  }
2324
2920
  }
2325
2921
  ]
@@ -2328,22 +2924,81 @@ var Hydration = {
2328
2924
  {
2329
2925
  parents: 1,
2330
2926
  interior: {
2331
- X3: [
2927
+ X2: [
2332
2928
  {
2333
2929
  Parachain: 2004
2334
2930
  },
2335
2931
  {
2336
- PalletInstance: 110
2932
+ AccountKey20: {
2933
+ network: null,
2934
+ key: "0x9c4c6eaad9b926ba09f702f4ad880ef71998ef18"
2935
+ }
2936
+ }
2937
+ ]
2938
+ }
2939
+ },
2940
+ {
2941
+ parents: 2,
2942
+ interior: {
2943
+ X2: [
2944
+ {
2945
+ GlobalConsensus: {
2946
+ Ethereum: {
2947
+ chainId: 1
2948
+ }
2949
+ }
2337
2950
  },
2338
2951
  {
2339
2952
  AccountKey20: {
2340
2953
  network: null,
2341
- key: "0xe9f9a2e3deae4093c00fbc57b22bb51a4c05ad88"
2954
+ key: "0x8236a87084f8b84306f72007f36f2618a5634494"
2955
+ }
2956
+ }
2957
+ ]
2958
+ }
2959
+ },
2960
+ {
2961
+ parents: 1,
2962
+ interior: {
2963
+ X2: [
2964
+ {
2965
+ Parachain: 2034
2966
+ },
2967
+ {
2968
+ AccountKey20: {
2969
+ network: null,
2970
+ key: "0xf5f744a4d14a5f49ce173e39b8361733a6e55152"
2342
2971
  }
2343
2972
  }
2344
2973
  ]
2345
2974
  }
2346
2975
  },
2976
+ {
2977
+ parents: 1,
2978
+ interior: {
2979
+ X2: [
2980
+ {
2981
+ Parachain: 2034
2982
+ },
2983
+ {
2984
+ AccountKey20: {
2985
+ network: null,
2986
+ key: "0x4c892a298a9c6b4ced988b3d6e9cf93333aadcf7"
2987
+ }
2988
+ }
2989
+ ]
2990
+ }
2991
+ },
2992
+ {
2993
+ parents: 1,
2994
+ interior: {
2995
+ X1: [
2996
+ {
2997
+ Parachain: 2006
2998
+ }
2999
+ ]
3000
+ }
3001
+ },
2347
3002
  {
2348
3003
  parents: 1,
2349
3004
  interior: {
@@ -2357,7 +3012,7 @@ var Hydration = {
2357
3012
  {
2358
3013
  AccountKey20: {
2359
3014
  network: null,
2360
- key: "0xda430218862d3db25de9f61458645dde49a9e9c1"
3015
+ key: "0x99fec54a5ad36d50a4bba3a41cab983a5bb86a7d"
2361
3016
  }
2362
3017
  }
2363
3018
  ]
@@ -2377,7 +3032,7 @@ var Hydration = {
2377
3032
  {
2378
3033
  AccountKey20: {
2379
3034
  network: null,
2380
- key: "0x9d39a5de30e57443bff2a8307a4256c8797a3497"
3035
+ key: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
2381
3036
  }
2382
3037
  }
2383
3038
  ]
@@ -5390,6 +6045,40 @@ var Acala = {
5390
6045
  }
5391
6046
  }
5392
6047
  ],
6048
+ [
6049
+ {
6050
+ parents: 1,
6051
+ interior: {
6052
+ X2: [
6053
+ {
6054
+ Parachain: 2000
6055
+ },
6056
+ {
6057
+ GeneralKey: {
6058
+ length: 2,
6059
+ data: "0x0000000000000000000000000000000000000000000000000000000000000000"
6060
+ }
6061
+ }
6062
+ ]
6063
+ }
6064
+ },
6065
+ {
6066
+ parents: 1,
6067
+ interior: {
6068
+ X2: [
6069
+ {
6070
+ Parachain: 2032
6071
+ },
6072
+ {
6073
+ GeneralKey: {
6074
+ length: 2,
6075
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
6076
+ }
6077
+ }
6078
+ ]
6079
+ }
6080
+ }
6081
+ ],
5393
6082
  [
5394
6083
  {
5395
6084
  parents: 1,
@@ -5874,6 +6563,40 @@ var Acala = {
5874
6563
  }
5875
6564
  }
5876
6565
  ],
6566
+ [
6567
+ {
6568
+ parents: 1,
6569
+ interior: {
6570
+ X3: [
6571
+ {
6572
+ Parachain: 1000
6573
+ },
6574
+ {
6575
+ PalletInstance: 50
6576
+ },
6577
+ {
6578
+ GeneralIndex: 22222012
6579
+ }
6580
+ ]
6581
+ }
6582
+ },
6583
+ {
6584
+ parents: 1,
6585
+ interior: {
6586
+ X2: [
6587
+ {
6588
+ Parachain: 2032
6589
+ },
6590
+ {
6591
+ GeneralKey: {
6592
+ length: 2,
6593
+ data: "0x0001000000000000000000000000000000000000000000000000000000000000"
6594
+ }
6595
+ }
6596
+ ]
6597
+ }
6598
+ }
6599
+ ],
5877
6600
  [
5878
6601
  {
5879
6602
  parents: 1,
@@ -7495,8 +8218,11 @@ var createAcalaClient = /*#__PURE__*/function () {
7495
8218
 
7496
8219
  var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
7497
8220
  function AcalaExchange() {
8221
+ var _this;
7498
8222
  _classCallCheck(this, AcalaExchange);
7499
- return _callSuper(this, AcalaExchange, arguments);
8223
+ _this = _callSuper(this, AcalaExchange, arguments);
8224
+ _this.apiType = 'PJS';
8225
+ return _this;
7500
8226
  }
7501
8227
  _inherits(AcalaExchange, _ExchangeChain);
7502
8228
  return _createClass(AcalaExchange, [{
@@ -7673,97 +8399,80 @@ var AcalaExchange = /*#__PURE__*/function (_ExchangeChain) {
7673
8399
  }]);
7674
8400
  }(ExchangeChain);
7675
8401
 
7676
- /* eslint-disable @typescript-eslint/no-unsafe-return */
7677
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
7678
- /* eslint-disable @typescript-eslint/no-explicit-any */
7679
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
7680
- var capitalizeLocation = function capitalizeLocation(obj) {
7681
- obj.interior = _capitalizeKeys(obj.interior);
7682
- return obj;
8402
+ // NetworkId enum variants that polkadot.js `.toJSON()` lowercases when the
8403
+ // variant carries no data (e.g. `Kusama` -> `kusama`). Struct/tuple variants
8404
+ // like `Ethereum { chain_id }` keep their PascalCase.
8405
+ var LOWERCASED_PLAIN_VARIANTS = new Set(['Polkadot', 'Kusama', 'Westend', 'Rococo', 'Wococo', 'BitcoinCore', 'BitcoinCash', 'PolkadotBulletin']);
8406
+ var snakeToCamel = function snakeToCamel(key) {
8407
+ return key.replace(/_([a-z])/g, function (_, c) {
8408
+ return c.toUpperCase();
8409
+ });
7683
8410
  };
7684
- var _capitalizeKeys = function capitalizeKeys(obj) {
7685
- var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
7686
- if (_typeof(obj) !== 'object' || obj === null) {
7687
- return obj; // Primitive value, return as is
7688
- }
7689
- if (Array.isArray(obj)) {
7690
- // Process each element in the array
7691
- return obj.map(function (element) {
7692
- return _capitalizeKeys(element, depth);
7693
- });
7694
- }
7695
- var newObj = {};
7696
- for (var key in obj) {
7697
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
7698
- var value = obj[key];
7699
- var isLeafNode = _typeof(value) !== 'object' || value === null;
7700
- var capitalizedKey = void 0;
7701
- if (depth <= 2 || !isLeafNode) {
7702
- // Capitalize the key
7703
- capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
7704
- } else {
7705
- // Do not capitalize leaf nodes beyond depth 2
7706
- capitalizedKey = key;
7707
- }
7708
- if (key === 'generalKey' && typeof value === 'string') {
7709
- var data = value;
7710
- var hexString = data.startsWith('0x') ? data.slice(2) : data;
7711
- var byteLength = hexString.length / 2; // Each byte is two hex characters
7712
- // Pad hexString with trailing zeros to make it 32 bytes (64 hex characters)
7713
- var paddedHexString = hexString.padEnd(64, '0'); // 64 hex chars = 32 bytes
7714
- data = '0x' + paddedHexString;
7715
- value = {
7716
- length: byteLength,
7717
- data: data
7718
- };
7719
- }
7720
- // Recursively process nested objects
7721
- newObj[capitalizedKey] = _capitalizeKeys(value, depth + 1);
8411
+ var isBinary = function isBinary(v) {
8412
+ return _typeof(v) === 'object' && v !== null && 'asHex' in v && typeof v.asHex === 'function';
8413
+ };
8414
+ var JUNCTIONS_VARIANT = /^X[1-8]$/;
8415
+ // Recursively convert polkadot-api's `{ type, value }` enum encoding into the
8416
+ // flat `{ VariantName: value }` shape used by stored asset locations (which
8417
+ // originate from polkadot.js's `.toJSON()`).
8418
+ //
8419
+ // Reproduces three pjs `.toJSON()` quirks so output is byte-identical:
8420
+ // - plain NetworkId variants lowercased (`Kusama` -> `kusama`)
8421
+ // - struct field names snake_case -> camelCase (`chain_id` -> `chainId`)
8422
+ // - `Binary` byte values rendered as `0x...` hex strings
8423
+ var _papiLocationToJson = function papiLocationToJson(value) {
8424
+ if (value === undefined) return null;
8425
+ if (isBinary(value)) return value.asHex();
8426
+ if (_typeof(value) !== 'object' || value === null) return value;
8427
+ if (Array.isArray(value)) return value.map(_papiLocationToJson);
8428
+ var obj = value;
8429
+ if (Object.keys(obj).length === 2 && typeof obj.type === 'string' && Object.prototype.hasOwnProperty.call(obj, 'value')) {
8430
+ // v3 Junctions encode X1 as a single Junction (not an array). pjs
8431
+ // normalizes X1..X8 to array form, so we do the same.
8432
+ if (JUNCTIONS_VARIANT.test(obj.type) && !Array.isArray(obj.value)) {
8433
+ return _defineProperty({}, obj.type, [_papiLocationToJson(obj.value)]);
7722
8434
  }
8435
+ var variant = obj.value === undefined && LOWERCASED_PLAIN_VARIANTS.has(obj.type) ? obj.type[0].toLowerCase() + obj.type.slice(1) : obj.type;
8436
+ return _defineProperty({}, variant, _papiLocationToJson(obj.value));
7723
8437
  }
7724
- return newObj;
8438
+ var out = {};
8439
+ for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
8440
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
8441
+ k = _Object$entries$_i[0],
8442
+ v = _Object$entries$_i[1];
8443
+ out[snakeToCamel(k)] = _papiLocationToJson(v);
8444
+ }
8445
+ return out;
7725
8446
  };
7726
8447
 
7727
8448
  var getDexConfig$1 = /*#__PURE__*/function () {
7728
8449
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, chain) {
7729
- var assets, response, pairs, poolLocations, filteredAssets, locations;
8450
+ var assets, entries, poolLocations, filteredAssets;
7730
8451
  return _regenerator().w(function (_context) {
7731
8452
  while (1) switch (_context.n) {
7732
8453
  case 0:
7733
8454
  assets = getAssets(chain);
7734
8455
  _context.n = 1;
7735
- return api.query.assetConversion.pools.entries();
8456
+ return api.getUnsafeApi().query.AssetConversion.Pools.getEntries();
7736
8457
  case 1:
7737
- response = _context.v;
7738
- pairs = response.map(function (_ref2) {
7739
- var _ref3 = _slicedToArray(_ref2, 1),
7740
- _ref3$0$args = _slicedToArray(_ref3[0].args, 1),
7741
- era = _ref3$0$args[0];
7742
- var _era$toJSON = era.toJSON(),
7743
- _era$toJSON2 = _slicedToArray(_era$toJSON, 2),
7744
- ml1 = _era$toJSON2[0],
7745
- ml2 = _era$toJSON2[1];
7746
- return [ml1, ml2];
7747
- });
8458
+ entries = _context.v;
7748
8459
  poolLocations = new Set();
7749
- pairs.forEach(function (_ref4) {
7750
- var _ref5 = _slicedToArray(_ref4, 2),
7751
- ml1 = _ref5[0],
7752
- ml2 = _ref5[1];
7753
- var ml1Transformed = capitalizeLocation(ml1);
7754
- var ml2Transformed = capitalizeLocation(ml2);
7755
- poolLocations.add(JSON.stringify(ml1Transformed));
7756
- poolLocations.add(JSON.stringify(ml2Transformed));
8460
+ entries.forEach(function (_ref2) {
8461
+ var _ref2$keyArgs = _slicedToArray(_ref2.keyArgs, 1),
8462
+ _ref2$keyArgs$ = _slicedToArray(_ref2$keyArgs[0], 2),
8463
+ ml1 = _ref2$keyArgs$[0],
8464
+ ml2 = _ref2$keyArgs$[1];
8465
+ poolLocations.add(JSON.stringify(_papiLocationToJson(ml1), replaceBigIntNumeric));
8466
+ poolLocations.add(JSON.stringify(_papiLocationToJson(ml2), replaceBigIntNumeric));
7757
8467
  });
7758
8468
  filteredAssets = assets.filter(function (asset) {
7759
- return poolLocations.has(JSON.stringify(asset.location)) || poolLocations.has(JSON.stringify(localizeLocation('AssetHubPolkadot', asset.location)));
7760
- });
7761
- locations = filteredAssets.map(function (asset) {
7762
- return asset.location;
8469
+ return poolLocations.has(JSON.stringify(asset.location, replaceBigIntNumeric)) || poolLocations.has(JSON.stringify(localizeLocation('AssetHubPolkadot', asset.location), replaceBigIntNumeric));
7763
8470
  });
7764
8471
  return _context.a(2, {
7765
8472
  isOmni: true,
7766
- assets: locations,
8473
+ assets: filteredAssets.map(function (asset) {
8474
+ return asset.location;
8475
+ }),
7767
8476
  pairs: []
7768
8477
  });
7769
8478
  }
@@ -7776,8 +8485,11 @@ var getDexConfig$1 = /*#__PURE__*/function () {
7776
8485
 
7777
8486
  var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
7778
8487
  function AssetHubExchange() {
8488
+ var _this;
7779
8489
  _classCallCheck(this, AssetHubExchange);
7780
- return _callSuper(this, AssetHubExchange, arguments);
8490
+ _this = _callSuper(this, AssetHubExchange, arguments);
8491
+ _this.apiType = 'GENERIC';
8492
+ return _this;
7781
8493
  }
7782
8494
  _inherits(AssetHubExchange, _ExchangeChain);
7783
8495
  return _createClass(AssetHubExchange, [{
@@ -7950,7 +8662,7 @@ var AssetHubExchange = /*#__PURE__*/function (_ExchangeChain) {
7950
8662
  hop1Received = resultHop1.amountOut;
7951
8663
  assumedInputForHop2 = padValueBy(hop1Received, -2);
7952
8664
  optionsHop2 = {
7953
- apiPjs: options.apiPjs,
8665
+ apiType: 'GENERIC',
7954
8666
  api: options.api,
7955
8667
  slippagePct: options.slippagePct,
7956
8668
  sender: options.sender,
@@ -8408,8 +9120,11 @@ var getDexConfig = /*#__PURE__*/function () {
8408
9120
 
8409
9121
  var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
8410
9122
  function BifrostExchange() {
9123
+ var _this;
8411
9124
  _classCallCheck(this, BifrostExchange);
8412
- return _callSuper(this, BifrostExchange, arguments);
9125
+ _this = _callSuper(this, BifrostExchange, arguments);
9126
+ _this.apiType = 'PJS';
9127
+ return _this;
8413
9128
  }
8414
9129
  _inherits(BifrostExchange, _ExchangeChain);
8415
9130
  return _createClass(BifrostExchange, [{
@@ -8572,17 +9287,17 @@ var BifrostExchange = /*#__PURE__*/function (_ExchangeChain) {
8572
9287
  }(ExchangeChain);
8573
9288
 
8574
9289
  var getAssetInfo = /*#__PURE__*/function () {
8575
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(tradeRouter, asset) {
9290
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(assetClient, asset) {
8576
9291
  var assets;
8577
9292
  return _regenerator().w(function (_context) {
8578
9293
  while (1) switch (_context.n) {
8579
9294
  case 0:
8580
9295
  _context.n = 1;
8581
- return tradeRouter.getAllAssets();
9296
+ return assetClient.getSupported();
8582
9297
  case 1:
8583
9298
  assets = _context.v;
8584
9299
  return _context.a(2, asset.assetId ? assets.find(function (a) {
8585
- return a.id === asset.assetId;
9300
+ return a.id.toString() === asset.assetId;
8586
9301
  }) : assets.find(function (a) {
8587
9302
  return a.symbol === asset.symbol;
8588
9303
  }));
@@ -8595,8 +9310,8 @@ var getAssetInfo = /*#__PURE__*/function () {
8595
9310
  }();
8596
9311
 
8597
9312
  var calculateFee = /*#__PURE__*/function () {
8598
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromDecimals, chain, toDestTransactionFee) {
8599
- var amount, slippagePct, feeCalcAddress, sender, trade, nativeCurrencyInfo, nativeCurrencyDecimals, substrateTx, tx, swapFee, feeNative, currencyFromPriceInfo, currencyFromPrice, feeInCurrencyFrom, finalFee;
9313
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, tradeRouter, txBuilderFactory, assetClient, currencyFromInfo, currencyToInfo, currencyFromDecimals, chain, toDestTransactionFee) {
9314
+ var amount, slippagePct, feeCalcAddress, sender, trade, nativeCurrencyInfo, nativeCurrencyDecimals, substrateTx, tx, _yield$tx$getPaymentI, swapFee, feeNative, currencyFromPriceInfo, currencyFromPrice, feeInCurrencyFrom, finalFee;
8600
9315
  return _regenerator().w(function (_context) {
8601
9316
  while (1) switch (_context.n) {
8602
9317
  case 0:
@@ -8606,7 +9321,7 @@ var calculateFee = /*#__PURE__*/function () {
8606
9321
  case 1:
8607
9322
  trade = _context.v;
8608
9323
  _context.n = 2;
8609
- return getAssetInfo(tradeRouter, {
9324
+ return getAssetInfo(assetClient, {
8610
9325
  symbol: getNativeAssetSymbol(chain)
8611
9326
  });
8612
9327
  case 2:
@@ -8630,9 +9345,10 @@ var calculateFee = /*#__PURE__*/function () {
8630
9345
  substrateTx = _context.v;
8631
9346
  tx = substrateTx.get();
8632
9347
  _context.n = 6;
8633
- return calculateTxFeePjs(tx, feeCalcAddress);
9348
+ return tx.getPaymentInfo(feeCalcAddress);
8634
9349
  case 6:
8635
- swapFee = _context.v;
9350
+ _yield$tx$getPaymentI = _context.v;
9351
+ swapFee = _yield$tx$getPaymentI.partial_fee;
8636
9352
  feeNative = swapFee + toDestTransactionFee + toDestTransactionFee;
8637
9353
  Logger.log('XCM to exch. fee:', toDestTransactionFee, nativeCurrencyInfo.symbol);
8638
9354
  Logger.log('XCM to dest. fee:', toDestTransactionFee, nativeCurrencyInfo.symbol);
@@ -8645,7 +9361,7 @@ var calculateFee = /*#__PURE__*/function () {
8645
9361
  return _context.a(2, feeNative);
8646
9362
  case 7:
8647
9363
  _context.n = 8;
8648
- return tradeRouter.getBestSpotPrice(currencyFromInfo.id, nativeCurrencyInfo.id);
9364
+ return tradeRouter.getSpotPrice(currencyFromInfo.id, nativeCurrencyInfo.id);
8649
9365
  case 8:
8650
9366
  currencyFromPriceInfo = _context.v;
8651
9367
  if (!(currencyFromPriceInfo === undefined)) {
@@ -8654,7 +9370,7 @@ var calculateFee = /*#__PURE__*/function () {
8654
9370
  }
8655
9371
  throw new UnableToComputeError('Price not found');
8656
9372
  case 9:
8657
- currencyFromPrice = BigInt(currencyFromPriceInfo.amount.decimalPlaces(0).toString());
9373
+ currencyFromPrice = currencyFromPriceInfo.amount;
8658
9374
  feeInCurrencyFrom = feeNative * pow10n(currencyFromPriceInfo.decimals + currencyFromDecimals) / (currencyFromPrice * pow10n(nativeCurrencyDecimals));
8659
9375
  Logger.log('Total fee in currency from:', feeInCurrencyFrom, currencyFromInfo.symbol);
8660
9376
  finalFee = padValueBy(feeInCurrencyFrom, FEE_BUFFER_PCT);
@@ -8663,97 +9379,100 @@ var calculateFee = /*#__PURE__*/function () {
8663
9379
  }
8664
9380
  }, _callee);
8665
9381
  }));
8666
- return function calculateFee(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
9382
+ return function calculateFee(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
8667
9383
  return _ref2.apply(this, arguments);
8668
9384
  };
8669
9385
  }();
8670
9386
 
8671
9387
  var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
8672
9388
  function HydrationExchange() {
9389
+ var _this;
8673
9390
  _classCallCheck(this, HydrationExchange);
8674
- return _callSuper(this, HydrationExchange, arguments);
9391
+ _this = _callSuper(this, HydrationExchange, arguments);
9392
+ _this.apiType = 'PAPI';
9393
+ return _this;
8675
9394
  }
8676
9395
  _inherits(HydrationExchange, _ExchangeChain);
8677
9396
  return _createClass(HydrationExchange, [{
8678
9397
  key: "swapCurrency",
8679
9398
  value: function () {
8680
9399
  var _swapCurrency = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, toDestTransactionFee) {
8681
- var apiPjs, origin, assetFrom, assetTo, sender, slippagePct, amount, _createSdkContext, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, tradeFee, amountWithoutFee, amountNormalized, trade, substrateTx, tx, amountOut, nativeCurrencyInfo, nativeCurrencyDecimals, priceInfo, currencyToPrice, feeInCurrencyTo, amountOutModified;
9400
+ var apiPapi, origin, assetFrom, assetTo, sender, slippagePct, amount, _yield$createSdkConte, tradeRouter, assetClient, txBuilderFactory, currencyFromInfo, currencyToInfo, tradeFee, amountWithoutFee, amountNormalized, trade, substrateTx, tx, amountOut, nativeCurrencyInfo, _findNativeAssetInfoO, nativeCurrencyDecimals, priceInfo, currencyToPrice, feeInCurrencyTo, amountOutModified;
8682
9401
  return _regenerator().w(function (_context) {
8683
9402
  while (1) switch (_context.n) {
8684
9403
  case 0:
8685
- apiPjs = options.apiPjs, origin = options.origin, assetFrom = options.assetFrom, assetTo = options.assetTo, sender = options.sender, slippagePct = options.slippagePct, amount = options.amount;
8686
- _createSdkContext = createSdkContext(apiPjs), tradeRouter = _createSdkContext.api.router, txBuilderFactory = _createSdkContext.tx;
9404
+ apiPapi = options.apiPapi, origin = options.origin, assetFrom = options.assetFrom, assetTo = options.assetTo, sender = options.sender, slippagePct = options.slippagePct, amount = options.amount;
8687
9405
  _context.n = 1;
8688
- return getAssetInfo(tradeRouter, assetFrom);
9406
+ return createSdkContext(apiPapi);
8689
9407
  case 1:
8690
- currencyFromInfo = _context.v;
9408
+ _yield$createSdkConte = _context.v;
9409
+ tradeRouter = _yield$createSdkConte.api.router;
9410
+ assetClient = _yield$createSdkConte.client.asset;
9411
+ txBuilderFactory = _yield$createSdkConte.tx;
8691
9412
  _context.n = 2;
8692
- return getAssetInfo(tradeRouter, assetTo);
9413
+ return getAssetInfo(assetClient, assetFrom);
8693
9414
  case 2:
9415
+ currencyFromInfo = _context.v;
9416
+ _context.n = 3;
9417
+ return getAssetInfo(assetClient, assetTo);
9418
+ case 3:
8694
9419
  currencyToInfo = _context.v;
8695
9420
  if (!(currencyFromInfo === undefined)) {
8696
- _context.n = 3;
9421
+ _context.n = 4;
8697
9422
  break;
8698
9423
  }
8699
9424
  throw new InvalidCurrencyError("Currency from doesn't exist");
8700
- case 3:
9425
+ case 4:
8701
9426
  if (!(currencyToInfo === undefined)) {
8702
- _context.n = 4;
9427
+ _context.n = 5;
8703
9428
  break;
8704
9429
  }
8705
9430
  throw new InvalidCurrencyError("Currency to doesn't exist");
8706
- case 4:
8707
- _context.n = 5;
8708
- return calculateFee(options, tradeRouter, txBuilderFactory, currencyFromInfo, currencyToInfo, currencyFromInfo.decimals, this.chain, toDestTransactionFee);
8709
9431
  case 5:
9432
+ _context.n = 6;
9433
+ return calculateFee(options, tradeRouter, txBuilderFactory, assetClient, currencyFromInfo, currencyToInfo, currencyFromInfo.decimals, this.chain, toDestTransactionFee);
9434
+ case 6:
8710
9435
  tradeFee = _context.v;
8711
9436
  amountWithoutFee = origin ? amount - tradeFee : amount;
8712
9437
  if (!(amountWithoutFee <= 0n)) {
8713
- _context.n = 6;
9438
+ _context.n = 7;
8714
9439
  break;
8715
9440
  }
8716
9441
  throw new AmountTooLowError();
8717
- case 6:
9442
+ case 7:
8718
9443
  amountNormalized = formatUnits$1(amountWithoutFee, currencyFromInfo.decimals);
8719
9444
  Logger.log('Original amount', amount);
8720
9445
  Logger.log('Amount modified', amountWithoutFee);
8721
- _context.n = 7;
9446
+ _context.n = 8;
8722
9447
  return tradeRouter.getBestSell(currencyFromInfo.id, currencyToInfo.id, amountNormalized);
8723
- case 7:
9448
+ case 8:
8724
9449
  trade = _context.v;
8725
- _context.n = 8;
9450
+ _context.n = 9;
8726
9451
  return txBuilderFactory.trade(trade).withSlippage(Number(slippagePct)).withBeneficiary(sender).build();
8727
- case 8:
9452
+ case 9:
8728
9453
  substrateTx = _context.v;
8729
9454
  tx = substrateTx.get();
8730
- amountOut = BigInt(trade.amountOut.decimalPlaces(0).toString());
8731
- _context.n = 9;
8732
- return getAssetInfo(tradeRouter, {
9455
+ amountOut = trade.amountOut;
9456
+ _context.n = 10;
9457
+ return getAssetInfo(assetClient, {
8733
9458
  symbol: getNativeAssetSymbol(this.chain)
8734
9459
  });
8735
- case 9:
9460
+ case 10:
8736
9461
  nativeCurrencyInfo = _context.v;
8737
9462
  if (!(nativeCurrencyInfo === undefined)) {
8738
- _context.n = 10;
8739
- break;
8740
- }
8741
- throw new InvalidCurrencyError('Native currency not found');
8742
- case 10:
8743
- nativeCurrencyDecimals = getAssetDecimals(this.chain, nativeCurrencyInfo.symbol);
8744
- if (!(nativeCurrencyDecimals === null)) {
8745
9463
  _context.n = 11;
8746
9464
  break;
8747
9465
  }
8748
- throw new UnableToComputeError('Native currency decimals not found');
9466
+ throw new InvalidCurrencyError('Native currency not found');
8749
9467
  case 11:
9468
+ _findNativeAssetInfoO = findNativeAssetInfoOrThrow(this.chain), nativeCurrencyDecimals = _findNativeAssetInfoO.decimals;
8750
9469
  _context.n = 12;
8751
- return tradeRouter.getBestSpotPrice(currencyToInfo.id, nativeCurrencyInfo.id);
9470
+ return tradeRouter.getSpotPrice(currencyToInfo.id, nativeCurrencyInfo.id);
8752
9471
  case 12:
8753
9472
  priceInfo = _context.v;
8754
9473
  if (currencyToInfo.id === nativeCurrencyInfo.id) {
8755
9474
  priceInfo = {
8756
- amount: BigNumber(parseUnits$1('1', nativeCurrencyDecimals)),
9475
+ amount: parseUnits$1('1', nativeCurrencyDecimals),
8757
9476
  decimals: nativeCurrencyDecimals
8758
9477
  };
8759
9478
  }
@@ -8763,7 +9482,7 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
8763
9482
  }
8764
9483
  throw new UnableToComputeError('Price not found');
8765
9484
  case 13:
8766
- currencyToPrice = BigInt(priceInfo.amount.decimalPlaces(0).toString());
9485
+ currencyToPrice = priceInfo.amount;
8767
9486
  feeInCurrencyTo = toDestTransactionFee * pow10n(priceInfo.decimals + currencyToInfo.decimals) * BigInt(FEE_BUFFER_PCT) / (currencyToPrice * pow10n(nativeCurrencyDecimals) * 100n);
8768
9487
  Logger.log('Amount out fee', feeInCurrencyTo, nativeCurrencyInfo.symbol);
8769
9488
  amountOutModified = amountOut - feeInCurrencyTo;
@@ -8791,40 +9510,45 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
8791
9510
  key: "getAmountOut",
8792
9511
  value: function () {
8793
9512
  var _getAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
8794
- var apiPjs, assetFrom, assetTo, amount, origin, _options$slippagePct, slippagePct, _createSdkContext2, tradeRouter, currencyFromInfo, currencyToInfo, pctDestFee, amountWithoutFee, amountNormalized, trade, amountOut, slippageMultiplier;
9513
+ var apiPapi, assetFrom, assetTo, amount, origin, _options$slippagePct, slippagePct, _yield$createSdkConte2, tradeRouter, assetClient, currencyFromInfo, currencyToInfo, pctDestFee, amountWithoutFee, amountNormalized, trade, amountOut, slippageMultiplier;
8795
9514
  return _regenerator().w(function (_context2) {
8796
9515
  while (1) switch (_context2.n) {
8797
9516
  case 0:
8798
- apiPjs = options.apiPjs, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin, _options$slippagePct = options.slippagePct, slippagePct = _options$slippagePct === void 0 ? '0' : _options$slippagePct;
8799
- _createSdkContext2 = createSdkContext(apiPjs), tradeRouter = _createSdkContext2.api.router;
9517
+ apiPapi = options.apiPapi, assetFrom = options.assetFrom, assetTo = options.assetTo, amount = options.amount, origin = options.origin, _options$slippagePct = options.slippagePct, slippagePct = _options$slippagePct === void 0 ? '0' : _options$slippagePct;
8800
9518
  _context2.n = 1;
8801
- return getAssetInfo(tradeRouter, assetFrom);
9519
+ return createSdkContext(apiPapi);
8802
9520
  case 1:
8803
- currencyFromInfo = _context2.v;
9521
+ _yield$createSdkConte2 = _context2.v;
9522
+ tradeRouter = _yield$createSdkConte2.api.router;
9523
+ assetClient = _yield$createSdkConte2.client.asset;
8804
9524
  _context2.n = 2;
8805
- return getAssetInfo(tradeRouter, assetTo);
9525
+ return getAssetInfo(assetClient, assetFrom);
8806
9526
  case 2:
9527
+ currencyFromInfo = _context2.v;
9528
+ _context2.n = 3;
9529
+ return getAssetInfo(assetClient, assetTo);
9530
+ case 3:
8807
9531
  currencyToInfo = _context2.v;
8808
9532
  if (!(currencyFromInfo === undefined)) {
8809
- _context2.n = 3;
9533
+ _context2.n = 4;
8810
9534
  break;
8811
9535
  }
8812
9536
  throw new InvalidCurrencyError("Currency from doesn't exist");
8813
- case 3:
9537
+ case 4:
8814
9538
  if (!(currencyToInfo === undefined)) {
8815
- _context2.n = 4;
9539
+ _context2.n = 5;
8816
9540
  break;
8817
9541
  }
8818
9542
  throw new InvalidCurrencyError("Currency to doesn't exist");
8819
- case 4:
9543
+ case 5:
8820
9544
  pctDestFee = origin ? DEST_FEE_BUFFER_PCT : 0;
8821
9545
  amountWithoutFee = padValueBy(amount, pctDestFee);
8822
9546
  amountNormalized = formatUnits$1(amountWithoutFee, currencyFromInfo.decimals);
8823
- _context2.n = 5;
9547
+ _context2.n = 6;
8824
9548
  return tradeRouter.getBestSell(currencyFromInfo.id, currencyToInfo.id, amountNormalized);
8825
- case 5:
9549
+ case 6:
8826
9550
  trade = _context2.v;
8827
- amountOut = BigInt(trade.amountOut.decimalPlaces(0).toString());
9551
+ amountOut = trade.amountOut;
8828
9552
  slippageMultiplier = Number(slippagePct);
8829
9553
  return _context2.a(2, padValueBy(amountOut, -slippageMultiplier));
8830
9554
  }
@@ -8839,14 +9563,18 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
8839
9563
  key: "getDexConfig",
8840
9564
  value: function () {
8841
9565
  var _getDexConfig = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(api) {
8842
- var _createSdkContext3, tradeRouter, assets, sdkAssets, transformedAssets;
9566
+ var sdk, assets, sdkAssets, transformedAssets;
8843
9567
  return _regenerator().w(function (_context3) {
8844
- while (1) switch (_context3.n) {
9568
+ while (1) switch (_context3.p = _context3.n) {
8845
9569
  case 0:
8846
- _createSdkContext3 = createSdkContext(api), tradeRouter = _createSdkContext3.api.router;
8847
9570
  _context3.n = 1;
8848
- return tradeRouter.getAllAssets();
9571
+ return createSdkContext(api);
8849
9572
  case 1:
9573
+ sdk = _context3.v;
9574
+ _context3.p = 2;
9575
+ _context3.n = 3;
9576
+ return sdk.client.asset.getSupported();
9577
+ case 3:
8850
9578
  assets = _context3.v;
8851
9579
  sdkAssets = getAssets(this.chain);
8852
9580
  transformedAssets = assets.map(function (_ref) {
@@ -8854,7 +9582,7 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
8854
9582
  var symbol = _ref.symbol,
8855
9583
  id = _ref.id;
8856
9584
  var asset = (_sdkAssets$find = sdkAssets.find(function (a) {
8857
- return !a.isNative && a.assetId === id;
9585
+ return !a.isNative && a.assetId === id.toString();
8858
9586
  })) !== null && _sdkAssets$find !== void 0 ? _sdkAssets$find : sdkAssets.find(function (a) {
8859
9587
  return a.symbol.toLowerCase() === symbol.toLowerCase();
8860
9588
  });
@@ -8870,8 +9598,14 @@ var HydrationExchange = /*#__PURE__*/function (_ExchangeChain) {
8870
9598
  }),
8871
9599
  pairs: []
8872
9600
  });
9601
+ case 4:
9602
+ _context3.p = 4;
9603
+ sdk.destroy();
9604
+ return _context3.f(4);
9605
+ case 5:
9606
+ return _context3.a(2);
8873
9607
  }
8874
- }, _callee3, this);
9608
+ }, _callee3, this, [[2,, 4, 5]]);
8875
9609
  }));
8876
9610
  function getDexConfig(_x4) {
8877
9611
  return _getDexConfig.apply(this, arguments);
@@ -9327,65 +10061,116 @@ var selectBestExchangeCommon = /*#__PURE__*/function () {
9327
10061
  };
9328
10062
  }();
9329
10063
 
10064
+ var createToExchangeBuilder = function createToExchangeBuilder(_ref) {
10065
+ var origin = _ref.origin,
10066
+ exchange = _ref.exchange,
10067
+ sender = _ref.sender,
10068
+ evmSenderAddress = _ref.evmSenderAddress,
10069
+ amount = _ref.amount,
10070
+ api = _ref.api;
10071
+ return Builder(api.clone()).from(origin.chain).to(exchange.chain).currency({
10072
+ location: origin.assetFrom.location,
10073
+ amount: amount
10074
+ }).sender(isChainEvm(origin.chain) ? evmSenderAddress : sender).recipient(sender);
10075
+ };
10076
+ var buildToExchangeExtrinsic = function buildToExchangeExtrinsic(options) {
10077
+ return createToExchangeBuilder(options).build();
10078
+ };
10079
+ var getToExchangeFee = function getToExchangeFee(options, disableFallback) {
10080
+ return createToExchangeBuilder(options).getXcmFee({
10081
+ disableFallback: disableFallback
10082
+ });
10083
+ };
10084
+ var getToExchangeOriginFee = function getToExchangeOriginFee(options, disableFallback) {
10085
+ return createToExchangeBuilder(options).getOriginXcmFee({
10086
+ disableFallback: disableFallback
10087
+ });
10088
+ };
10089
+ var createFromExchangeBuilder = function createFromExchangeBuilder(_ref2) {
10090
+ var exchange = _ref2.exchange,
10091
+ destination = _ref2.destination,
10092
+ amount = _ref2.amount,
10093
+ sender = _ref2.sender,
10094
+ api = _ref2.api;
10095
+ var apiForChain = api.clone();
10096
+ return Builder(apiForChain).from(exchange.chain).to(destination.chain).currency({
10097
+ location: exchange.assetTo.location,
10098
+ amount: amount
10099
+ }).sender(sender).recipient(destination.address);
10100
+ };
10101
+ var buildFromExchangeExtrinsic = function buildFromExchangeExtrinsic(options) {
10102
+ return createFromExchangeBuilder(options).build();
10103
+ };
10104
+ var getFromExchangeFee = function getFromExchangeFee(options, disableFallback) {
10105
+ return createFromExchangeBuilder(options).getXcmFee({
10106
+ disableFallback: disableFallback
10107
+ });
10108
+ };
10109
+ var determineFeeCalcAddress = function determineFeeCalcAddress(sender, recipient) {
10110
+ if (!ethers.isAddress(sender)) {
10111
+ // Use wallet address for fee calculation
10112
+ return sender;
10113
+ }
10114
+ if (recipient && !ethers.isAddress(recipient)) {
10115
+ // Use recipient address for fee calculation
10116
+ return recipient;
10117
+ }
10118
+ // If both addresses are ethereum addresses, use fallback address for fee calculation
10119
+ return FALLBACK_FEE_CALC_ADDRESS;
10120
+ };
10121
+
9330
10122
  var selectBestExchange = /*#__PURE__*/function () {
9331
10123
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options, originApi, isForFeeEstimation) {
9332
- var api;
10124
+ var api, exchangeConfig;
9333
10125
  return _regenerator().w(function (_context2) {
9334
10126
  while (1) switch (_context2.n) {
9335
10127
  case 0:
9336
10128
  api = options.api;
10129
+ exchangeConfig = convertBuilderConfig(api.config);
9337
10130
  return _context2.a(2, selectBestExchangeCommon(options, originApi, /*#__PURE__*/function () {
9338
10131
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, assetFromExchange, assetTo, options, parsedAmount) {
9339
- var modifiedOptions, toDestTxFee, _yield$dex$handleMult, amountOut, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10;
10132
+ var exchangeInfo, modifiedOptions, toDestTxFee, _yield$dex$handleMult, amountOut, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
9340
10133
  return _regenerator().w(function (_context) {
9341
10134
  while (1) switch (_context.n) {
9342
10135
  case 0:
9343
10136
  _t = _objectSpread2;
9344
- _t2 = _objectSpread2({}, options);
10137
+ _t2 = _objectSpread2;
9345
10138
  _t3 = {};
9346
- _t4 = BigInt(parsedAmount);
9347
10139
  _context.n = 1;
9348
- return dex.createApiInstance();
10140
+ return buildExchangeApiVariant(dex, exchangeConfig);
9349
10141
  case 1:
9350
- _t5 = _context.v;
10142
+ _t4 = _t2(_t3, _context.v);
10143
+ _t5 = {};
9351
10144
  _context.n = 2;
9352
- return dex.createApiInstancePapi();
10145
+ return api.createApiForChain(dex.chain);
9353
10146
  case 2:
9354
10147
  _t6 = _context.v;
9355
- _context.n = 3;
9356
- return api.createApiForChain(dex.chain);
9357
- case 3:
9358
- _t7 = _context.v;
9359
- _t8 = dex.chain;
9360
- _t9 = assetFromExchange;
9361
- _t0 = assetTo;
9362
- _t1 = {
9363
- apiPjs: _t5,
9364
- apiPapi: _t6,
9365
- api: _t7,
9366
- chain: _t8,
9367
- assetFrom: _t9,
9368
- assetTo: _t0
9369
- };
9370
- _t10 = determineFeeCalcAddress(options.sender, options.recipient);
9371
- modifiedOptions = _t(_t2, _t3, {
9372
- amount: _t4,
9373
- exchange: _t1,
9374
- feeCalcAddress: _t10
10148
+ _t7 = dex.chain;
10149
+ _t8 = assetFromExchange;
10150
+ _t9 = assetTo;
10151
+ exchangeInfo = _t(_t4, _t5, {
10152
+ api: _t6,
10153
+ chain: _t7,
10154
+ assetFrom: _t8,
10155
+ assetTo: _t9
9375
10156
  });
9376
- _context.n = 4;
10157
+ modifiedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
10158
+ amount: BigInt(parsedAmount),
10159
+ exchange: exchangeInfo,
10160
+ feeCalcAddress: determineFeeCalcAddress(options.sender, options.recipient)
10161
+ });
10162
+ _context.n = 3;
9377
10163
  return calculateFromExchangeFee(modifiedOptions);
9378
- case 4:
10164
+ case 3:
9379
10165
  toDestTxFee = _context.v;
9380
- _context.n = 5;
9381
- return dex.handleMultiSwap(_objectSpread2(_objectSpread2({}, modifiedOptions), {}, {
10166
+ _context.n = 4;
10167
+ return dex.handleMultiSwap(_objectSpread2(_objectSpread2(_objectSpread2({}, modifiedOptions), pickExchangeApiVariant(modifiedOptions.exchange)), {}, {
9382
10168
  api: modifiedOptions.exchange.api,
9383
- apiPjs: modifiedOptions.exchange.apiPjs,
9384
10169
  assetFrom: modifiedOptions.exchange.assetFrom,
9385
10170
  assetTo: modifiedOptions.exchange.assetTo,
9386
10171
  isForFeeEstimation: isForFeeEstimation
9387
10172
  }), toDestTxFee);
9388
- case 5:
10173
+ case 4:
9389
10174
  _yield$dex$handleMult = _context.v;
9390
10175
  amountOut = _yield$dex$handleMult.amountOut;
9391
10176
  return _context.a(2, amountOut);
@@ -9454,59 +10239,6 @@ var resolveAssets = function resolveAssets(dex, _ref) {
9454
10239
  };
9455
10240
  };
9456
10241
 
9457
- var createToExchangeBuilder = function createToExchangeBuilder(_ref) {
9458
- var origin = _ref.origin,
9459
- exchange = _ref.exchange,
9460
- sender = _ref.sender,
9461
- evmSenderAddress = _ref.evmSenderAddress,
9462
- amount = _ref.amount,
9463
- api = _ref.api;
9464
- return Builder(api.clone()).from(origin.chain).to(exchange.chain).currency({
9465
- location: origin.assetFrom.location,
9466
- amount: amount
9467
- }).sender(isChainEvm(origin.chain) ? evmSenderAddress : sender).recipient(sender);
9468
- };
9469
- var buildToExchangeExtrinsic = function buildToExchangeExtrinsic(options) {
9470
- return createToExchangeBuilder(options).build();
9471
- };
9472
- var getToExchangeFee = function getToExchangeFee(options, disableFallback) {
9473
- return createToExchangeBuilder(options).getXcmFee({
9474
- disableFallback: disableFallback
9475
- });
9476
- };
9477
- var createFromExchangeBuilder = function createFromExchangeBuilder(_ref2) {
9478
- var exchange = _ref2.exchange,
9479
- destination = _ref2.destination,
9480
- amount = _ref2.amount,
9481
- sender = _ref2.sender,
9482
- api = _ref2.api;
9483
- var apiForChain = api.clone();
9484
- return Builder(apiForChain).from(exchange.chain).to(destination.chain).currency({
9485
- location: exchange.assetTo.location,
9486
- amount: amount
9487
- }).sender(sender).recipient(destination.address);
9488
- };
9489
- var buildFromExchangeExtrinsic = function buildFromExchangeExtrinsic(options) {
9490
- return createFromExchangeBuilder(options).build();
9491
- };
9492
- var getFromExchangeFee = function getFromExchangeFee(options, disableFallback) {
9493
- return createFromExchangeBuilder(options).getXcmFee({
9494
- disableFallback: disableFallback
9495
- });
9496
- };
9497
- var determineFeeCalcAddress = function determineFeeCalcAddress(sender, recipient) {
9498
- if (!ethers.isAddress(sender)) {
9499
- // Use wallet address for fee calculation
9500
- return sender;
9501
- }
9502
- if (recipient && !ethers.isAddress(recipient)) {
9503
- // Use recipient address for fee calculation
9504
- return recipient;
9505
- }
9506
- // If both addresses are ethereum addresses, use fallback address for fee calculation
9507
- return FALLBACK_FEE_CALC_ADDRESS;
9508
- };
9509
-
9510
10242
  var prepareTransformedOptions = /*#__PURE__*/function () {
9511
10243
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
9512
10244
  var _assetFromOrigin$deci;
@@ -9545,11 +10277,7 @@ var prepareTransformedOptions = /*#__PURE__*/function () {
9545
10277
  _t0,
9546
10278
  _t1,
9547
10279
  _t10,
9548
- _t11,
9549
- _t12,
9550
- _t13,
9551
- _t14,
9552
- _t15;
10280
+ _t11;
9553
10281
  return _regenerator().w(function (_context) {
9554
10282
  while (1) switch (_context.n) {
9555
10283
  case 0:
@@ -9608,39 +10336,30 @@ var prepareTransformedOptions = /*#__PURE__*/function () {
9608
10336
  assetFrom: assetFromOrigin,
9609
10337
  feeAssetInfo: feeAssetFromOrigin
9610
10338
  } : undefined;
10339
+ _t8 = _objectSpread2;
10340
+ _t9 = _objectSpread2;
10341
+ _t0 = {};
9611
10342
  _context.n = 9;
9612
- return dex.createApiInstance(exchangeConfig);
10343
+ return buildExchangeApiVariant(dex, exchangeConfig);
9613
10344
  case 9:
9614
- _t8 = _context.v;
9615
- _context.n = 10;
9616
- return dex.createApiInstancePapi(exchangeConfig);
9617
- case 10:
9618
- _t9 = _context.v;
9619
- _t0 = exchangeApi;
9620
- _t1 = dex.chain;
9621
- _t10 = assetFromExchange;
9622
- _t11 = assetTo;
9623
- _t12 = feeAssetFromExchange;
9624
- _t13 = {
9625
- apiPjs: _t8,
9626
- apiPapi: _t9,
9627
- api: _t0,
9628
- chain: _t1,
9629
- assetFrom: _t10,
9630
- assetTo: _t11,
9631
- feeAssetInfo: _t12
9632
- };
9633
- _t14 = destinationSpecified && recipient ? {
10345
+ _t1 = _t8(_t9(_t0, _context.v), {}, {
10346
+ api: exchangeApi,
10347
+ chain: dex.chain,
10348
+ assetFrom: assetFromExchange,
10349
+ assetTo: assetTo,
10350
+ feeAssetInfo: feeAssetFromExchange
10351
+ });
10352
+ _t10 = destinationSpecified && recipient ? {
9634
10353
  chain: to,
9635
10354
  address: recipient
9636
10355
  } : undefined;
9637
- _t15 = determineFeeCalcAddress(sender, recipient);
10356
+ _t11 = determineFeeCalcAddress(sender, recipient);
9638
10357
  transformed = _t3(_t4, _t5, {
9639
10358
  amount: _t6,
9640
10359
  origin: _t7,
9641
- exchange: _t13,
9642
- destination: _t14,
9643
- feeCalcAddress: _t15
10360
+ exchange: _t1,
10361
+ destination: _t10,
10362
+ feeCalcAddress: _t11
9644
10363
  });
9645
10364
  return _context.a(2, {
9646
10365
  dex: dex,
@@ -9654,6 +10373,199 @@ var prepareTransformedOptions = /*#__PURE__*/function () {
9654
10373
  };
9655
10374
  }();
9656
10375
 
10376
+ var callDexAmountOut = function callDexAmountOut(dex, options) {
10377
+ var _overrides$amount, _overrides$assetTo;
10378
+ var overrides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10379
+ return dex.getAmountOut(_objectSpread2(_objectSpread2(_objectSpread2({}, options), pickExchangeApiVariant(options.exchange)), {}, {
10380
+ amount: (_overrides$amount = overrides.amount) !== null && _overrides$amount !== void 0 ? _overrides$amount : options.amount,
10381
+ api: options.exchange.api,
10382
+ assetFrom: options.exchange.assetFrom,
10383
+ assetTo: (_overrides$assetTo = overrides.assetTo) !== null && _overrides$assetTo !== void 0 ? _overrides$assetTo : options.exchange.assetTo
10384
+ }, overrides.slippagePct !== undefined && {
10385
+ slippagePct: overrides.slippagePct
10386
+ }));
10387
+ };
10388
+ var buildSwapExecuteTx = /*#__PURE__*/function () {
10389
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
10390
+ var _overrides$amount2, _origin$assetFrom, _origin$feeAssetInfo;
10391
+ var overrides,
10392
+ api,
10393
+ origin,
10394
+ exchange,
10395
+ destination,
10396
+ currencyTo,
10397
+ amount,
10398
+ sender,
10399
+ recipient,
10400
+ evmSenderAddress,
10401
+ amt,
10402
+ minAmountOutSlippage,
10403
+ amountOut,
10404
+ tx,
10405
+ _args = arguments;
10406
+ return _regenerator().w(function (_context) {
10407
+ while (1) switch (_context.n) {
10408
+ case 0:
10409
+ overrides = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
10410
+ api = options.api, origin = options.origin, exchange = options.exchange, destination = options.destination, currencyTo = options.currencyTo, amount = options.amount, sender = options.sender, recipient = options.recipient, evmSenderAddress = options.evmSenderAddress;
10411
+ amt = (_overrides$amount2 = overrides.amount) !== null && _overrides$amount2 !== void 0 ? _overrides$amount2 : amount;
10412
+ minAmountOutSlippage = overrides.feeEstimation ? '1' : undefined;
10413
+ _context.n = 1;
10414
+ return callDexAmountOut(dex, options, {
10415
+ amount: amt
10416
+ });
10417
+ case 1:
10418
+ amountOut = _context.v;
10419
+ _context.n = 2;
10420
+ return handleSwapExecuteTransfer({
10421
+ api: api,
10422
+ chain: origin === null || origin === void 0 ? void 0 : origin.chain,
10423
+ exchangeChain: exchange.chain,
10424
+ destChain: destination === null || destination === void 0 ? void 0 : destination.chain,
10425
+ assetInfoFrom: _objectSpread2(_objectSpread2({}, (_origin$assetFrom = origin === null || origin === void 0 ? void 0 : origin.assetFrom) !== null && _origin$assetFrom !== void 0 ? _origin$assetFrom : exchange.assetFrom), {}, {
10426
+ amount: amt
10427
+ }),
10428
+ assetInfoTo: _objectSpread2(_objectSpread2({}, exchange.assetTo), {}, {
10429
+ amount: amountOut
10430
+ }),
10431
+ currencyTo: currencyTo,
10432
+ feeAssetInfo: (_origin$feeAssetInfo = origin === null || origin === void 0 ? void 0 : origin.feeAssetInfo) !== null && _origin$feeAssetInfo !== void 0 ? _origin$feeAssetInfo : exchange.feeAssetInfo,
10433
+ sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
10434
+ recipient: recipient !== null && recipient !== void 0 ? recipient : sender,
10435
+ calculateMinAmountOut: function calculateMinAmountOut(amountIn, assetTo) {
10436
+ return callDexAmountOut(dex, options, {
10437
+ amount: amountIn,
10438
+ assetTo: assetTo,
10439
+ slippagePct: minAmountOutSlippage
10440
+ });
10441
+ }
10442
+ });
10443
+ case 2:
10444
+ tx = _context.v;
10445
+ return _context.a(2, {
10446
+ tx: tx,
10447
+ amountOut: amountOut
10448
+ });
10449
+ }
10450
+ }, _callee);
10451
+ }));
10452
+ return function buildSwapExecuteTx(_x, _x2) {
10453
+ return _ref.apply(this, arguments);
10454
+ };
10455
+ }();
10456
+ var createSwapExecuteBuildTx = function createSwapExecuteBuildTx(dex, options) {
10457
+ return /*#__PURE__*/function () {
10458
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(overrideAmount) {
10459
+ var amt, _yield$buildSwapExecu, tx;
10460
+ return _regenerator().w(function (_context2) {
10461
+ while (1) switch (_context2.n) {
10462
+ case 0:
10463
+ amt = overrideAmount !== undefined ? applyDecimalAbstraction(overrideAmount, options.exchange.assetFrom.decimals, true) : options.amount;
10464
+ _context2.n = 1;
10465
+ return buildSwapExecuteTx(dex, options, {
10466
+ amount: amt,
10467
+ feeEstimation: true
10468
+ });
10469
+ case 1:
10470
+ _yield$buildSwapExecu = _context2.v;
10471
+ tx = _yield$buildSwapExecu.tx;
10472
+ return _context2.a(2, tx);
10473
+ }
10474
+ }, _callee2);
10475
+ }));
10476
+ return function (_x3) {
10477
+ return _ref2.apply(this, arguments);
10478
+ };
10479
+ }();
10480
+ };
10481
+ var canUseExecuteTransfer = function canUseExecuteTransfer(dex, options) {
10482
+ return Boolean(options.origin || options.destination) && (dex.chain.includes('AssetHub') || dex.chain === 'Hydration');
10483
+ };
10484
+ var isFilteredError = function isFilteredError(error) {
10485
+ return error instanceof DryRunFailedError && error.dryRunType === 'origin' && error.reason === 'Filtered';
10486
+ };
10487
+ var getSwapExecuteXcmFee = /*#__PURE__*/function () {
10488
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(dex, options, disableFallback) {
10489
+ var _origin$chain, _destination$chain;
10490
+ var api, origin, exchange, currencyFrom, currencyTo, feeAsset, destination, amount, sender, recipient, evmSenderAddress, buildTx, amountOut, result;
10491
+ return _regenerator().w(function (_context3) {
10492
+ while (1) switch (_context3.n) {
10493
+ case 0:
10494
+ api = options.api, origin = options.origin, exchange = options.exchange, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, feeAsset = options.feeAsset, destination = options.destination, amount = options.amount, sender = options.sender, recipient = options.recipient, evmSenderAddress = options.evmSenderAddress;
10495
+ assertCurrencyCore(currencyTo);
10496
+ buildTx = createSwapExecuteBuildTx(dex, options);
10497
+ _context3.n = 1;
10498
+ return callDexAmountOut(dex, options);
10499
+ case 1:
10500
+ amountOut = _context3.v;
10501
+ _context3.n = 2;
10502
+ return getXcmFee({
10503
+ api: api,
10504
+ buildTx: buildTx,
10505
+ origin: (_origin$chain = origin === null || origin === void 0 ? void 0 : origin.chain) !== null && _origin$chain !== void 0 ? _origin$chain : exchange.chain,
10506
+ destination: (_destination$chain = destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _destination$chain !== void 0 ? _destination$chain : exchange.chain,
10507
+ sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
10508
+ recipient: recipient !== null && recipient !== void 0 ? recipient : sender,
10509
+ currency: _objectSpread2(_objectSpread2({}, currencyFrom), {}, {
10510
+ amount: amount
10511
+ }),
10512
+ feeAsset: feeAsset,
10513
+ disableFallback: disableFallback,
10514
+ swapConfig: {
10515
+ currencyTo: currencyTo,
10516
+ exchangeChain: exchange.chain,
10517
+ amountOut: amountOut
10518
+ }
10519
+ });
10520
+ case 2:
10521
+ result = _context3.v;
10522
+ if (!(result.failureReason === 'NoDeal' && exchange.chain === 'Hydration')) {
10523
+ _context3.n = 3;
10524
+ break;
10525
+ }
10526
+ throw new RoutingResolutionError('An error occured, either this route is not registered for swap on exchange chain, or the amount out was not able to be calculated.');
10527
+ case 3:
10528
+ return _context3.a(2, {
10529
+ result: result,
10530
+ amountOut: amountOut
10531
+ });
10532
+ }
10533
+ }, _callee3);
10534
+ }));
10535
+ return function getSwapExecuteXcmFee(_x4, _x5, _x6) {
10536
+ return _ref3.apply(this, arguments);
10537
+ };
10538
+ }();
10539
+ var getSwapExecuteOriginXcmFee = /*#__PURE__*/function () {
10540
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(dex, options, disableFallback) {
10541
+ var _origin$chain2, _destination$chain2;
10542
+ var api, origin, exchange, currencyFrom, feeAsset, destination, amount, sender, evmSenderAddress, buildTx;
10543
+ return _regenerator().w(function (_context4) {
10544
+ while (1) switch (_context4.n) {
10545
+ case 0:
10546
+ api = options.api, origin = options.origin, exchange = options.exchange, currencyFrom = options.currencyFrom, feeAsset = options.feeAsset, destination = options.destination, amount = options.amount, sender = options.sender, evmSenderAddress = options.evmSenderAddress;
10547
+ buildTx = createSwapExecuteBuildTx(dex, options);
10548
+ assertCurrencyCore(currencyFrom);
10549
+ return _context4.a(2, getOriginXcmFee$1({
10550
+ api: api,
10551
+ buildTx: buildTx,
10552
+ origin: (_origin$chain2 = origin === null || origin === void 0 ? void 0 : origin.chain) !== null && _origin$chain2 !== void 0 ? _origin$chain2 : exchange.chain,
10553
+ destination: (_destination$chain2 = destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _destination$chain2 !== void 0 ? _destination$chain2 : exchange.chain,
10554
+ sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
10555
+ currency: _objectSpread2(_objectSpread2({}, currencyFrom), {}, {
10556
+ amount: amount
10557
+ }),
10558
+ feeAsset: feeAsset,
10559
+ disableFallback: disableFallback
10560
+ }));
10561
+ }
10562
+ }, _callee4);
10563
+ }));
10564
+ return function getSwapExecuteOriginXcmFee(_x7, _x8, _x9) {
10565
+ return _ref4.apply(this, arguments);
10566
+ };
10567
+ }();
10568
+
9657
10569
  var validateDestinationAddress = function validateDestinationAddress(address, destination) {
9658
10570
  if (typeof address === 'string') {
9659
10571
  var isDestinationEvm = isChainEvm(destination);
@@ -9749,9 +10661,8 @@ var createSwapTx = /*#__PURE__*/function () {
9749
10661
  case 1:
9750
10662
  toDestTxFee = _context2.v;
9751
10663
  _context2.n = 2;
9752
- return exchange.handleMultiSwap(_objectSpread2(_objectSpread2({}, options), {}, {
10664
+ return exchange.handleMultiSwap(_objectSpread2(_objectSpread2(_objectSpread2({}, options), pickExchangeApiVariant(options.exchange)), {}, {
9753
10665
  api: options.exchange.api,
9754
- apiPjs: options.exchange.apiPjs,
9755
10666
  assetFrom: options.exchange.assetFrom,
9756
10667
  assetTo: options.exchange.assetTo,
9757
10668
  isForFeeEstimation: isForFeeEstimation
@@ -9772,100 +10683,69 @@ var createSwapTx = /*#__PURE__*/function () {
9772
10683
  }, _callee2);
9773
10684
  }));
9774
10685
  return function createSwapTx(_x2, _x3) {
9775
- return _ref2.apply(this, arguments);
9776
- };
9777
- }();
9778
-
9779
- var prepareExtrinsics = /*#__PURE__*/function () {
9780
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
9781
- var api, origin, exchange, destination, currencyTo, amount, evmSenderAddress, sender, recipient, _origin$assetFrom, _origin$feeAssetInfo, _amountOut, tx, toExchangeTx, _yield$createSwapTx, swapTxs, amountOut, toDestTx, _t, _t2, _t3;
9782
- return _regenerator().w(function (_context) {
9783
- while (1) switch (_context.p = _context.n) {
9784
- case 0:
9785
- api = options.api, origin = options.origin, exchange = options.exchange, destination = options.destination, currencyTo = options.currencyTo, amount = options.amount, evmSenderAddress = options.evmSenderAddress, sender = options.sender, recipient = options.recipient;
9786
- if (!((origin || destination) && (dex.chain.includes('AssetHub') || dex.chain === 'Hydration'))) {
9787
- _context.n = 5;
9788
- break;
9789
- }
9790
- _context.p = 1;
9791
- _context.n = 2;
9792
- return dex.getAmountOut(_objectSpread2(_objectSpread2({}, options), {}, {
9793
- api: exchange.api,
9794
- apiPjs: exchange.apiPjs,
9795
- assetFrom: exchange.assetFrom,
9796
- assetTo: exchange.assetTo
9797
- }));
9798
- case 2:
9799
- _amountOut = _context.v;
9800
- _context.n = 3;
9801
- return handleSwapExecuteTransfer({
9802
- api: api,
9803
- chain: origin === null || origin === void 0 ? void 0 : origin.chain,
9804
- exchangeChain: exchange.chain,
9805
- destChain: destination === null || destination === void 0 ? void 0 : destination.chain,
9806
- assetInfoFrom: _objectSpread2(_objectSpread2({}, (_origin$assetFrom = origin === null || origin === void 0 ? void 0 : origin.assetFrom) !== null && _origin$assetFrom !== void 0 ? _origin$assetFrom : exchange.assetFrom), {}, {
9807
- amount: BigInt(amount)
9808
- }),
9809
- assetInfoTo: _objectSpread2(_objectSpread2({}, exchange.assetTo), {}, {
9810
- amount: _amountOut
9811
- }),
9812
- sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
9813
- recipient: recipient !== null && recipient !== void 0 ? recipient : sender,
9814
- currencyTo: currencyTo,
9815
- feeAssetInfo: (_origin$feeAssetInfo = origin === null || origin === void 0 ? void 0 : origin.feeAssetInfo) !== null && _origin$feeAssetInfo !== void 0 ? _origin$feeAssetInfo : exchange.feeAssetInfo,
9816
- calculateMinAmountOut: function calculateMinAmountOut(amountIn, assetTo) {
9817
- return dex.getAmountOut(_objectSpread2(_objectSpread2({}, options), {}, {
9818
- amount: amountIn,
9819
- api: options.exchange.api,
9820
- apiPjs: options.exchange.apiPjs,
9821
- assetFrom: options.exchange.assetFrom,
9822
- assetTo: assetTo !== null && assetTo !== void 0 ? assetTo : options.exchange.assetTo
9823
- }));
9824
- }
9825
- });
9826
- case 3:
9827
- tx = _context.v;
10686
+ return _ref2.apply(this, arguments);
10687
+ };
10688
+ }();
10689
+
10690
+ var prepareExtrinsics = /*#__PURE__*/function () {
10691
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
10692
+ var api, origin, exchange, destination, sender, _yield$buildSwapExecu, tx, _amountOut, toExchangeTx, _yield$createSwapTx, swapTxs, amountOut, toDestTx, _t, _t2, _t3;
10693
+ return _regenerator().w(function (_context) {
10694
+ while (1) switch (_context.p = _context.n) {
10695
+ case 0:
10696
+ api = options.api, origin = options.origin, exchange = options.exchange, destination = options.destination, sender = options.sender;
10697
+ if (!canUseExecuteTransfer(dex, options)) {
10698
+ _context.n = 4;
10699
+ break;
10700
+ }
10701
+ _context.p = 1;
10702
+ _context.n = 2;
10703
+ return buildSwapExecuteTx(dex, options);
10704
+ case 2:
10705
+ _yield$buildSwapExecu = _context.v;
10706
+ tx = _yield$buildSwapExecu.tx;
10707
+ _amountOut = _yield$buildSwapExecu.amountOut;
9828
10708
  return _context.a(2, {
9829
10709
  swapTxs: [tx],
9830
10710
  isExecute: true,
9831
10711
  amountOut: _amountOut
9832
10712
  });
9833
- case 4:
9834
- _context.p = 4;
10713
+ case 3:
10714
+ _context.p = 3;
9835
10715
  _t = _context.v;
9836
- if (_t instanceof DryRunFailedError && _t.dryRunType === 'origin' && _t.reason === 'Filtered') {
9837
- _context.n = 5;
10716
+ if (isFilteredError(_t)) {
10717
+ _context.n = 4;
9838
10718
  break;
9839
10719
  }
9840
10720
  throw _t;
9841
- case 5:
10721
+ case 4:
9842
10722
  if (!(origin && origin.chain !== exchange.chain)) {
9843
- _context.n = 7;
10723
+ _context.n = 6;
9844
10724
  break;
9845
10725
  }
9846
- _context.n = 6;
10726
+ _context.n = 5;
9847
10727
  return buildToExchangeExtrinsic(_objectSpread2(_objectSpread2({}, options), {}, {
9848
10728
  origin: origin
9849
10729
  }));
9850
- case 6:
10730
+ case 5:
9851
10731
  _t2 = _context.v;
9852
- _context.n = 8;
10732
+ _context.n = 7;
9853
10733
  break;
9854
- case 7:
10734
+ case 6:
9855
10735
  _t2 = undefined;
9856
- case 8:
10736
+ case 7:
9857
10737
  toExchangeTx = _t2;
9858
- _context.n = 9;
10738
+ _context.n = 8;
9859
10739
  return createSwapTx(dex, options);
9860
- case 9:
10740
+ case 8:
9861
10741
  _yield$createSwapTx = _context.v;
9862
10742
  swapTxs = _yield$createSwapTx.txs;
9863
10743
  amountOut = _yield$createSwapTx.amountOut;
9864
10744
  if (!(destination && destination.chain !== exchange.chain)) {
9865
- _context.n = 11;
10745
+ _context.n = 10;
9866
10746
  break;
9867
10747
  }
9868
- _context.n = 10;
10748
+ _context.n = 9;
9869
10749
  return buildFromExchangeExtrinsic({
9870
10750
  exchange: exchange,
9871
10751
  destination: destination,
@@ -9873,13 +10753,13 @@ var prepareExtrinsics = /*#__PURE__*/function () {
9873
10753
  sender: sender,
9874
10754
  api: api
9875
10755
  });
9876
- case 10:
10756
+ case 9:
9877
10757
  _t3 = _context.v;
9878
- _context.n = 12;
10758
+ _context.n = 11;
9879
10759
  break;
9880
- case 11:
10760
+ case 10:
9881
10761
  _t3 = undefined;
9882
- case 12:
10762
+ case 11:
9883
10763
  toDestTx = _t3;
9884
10764
  return _context.a(2, {
9885
10765
  toExchangeTx: toExchangeTx,
@@ -9888,7 +10768,7 @@ var prepareExtrinsics = /*#__PURE__*/function () {
9888
10768
  amountOut: BigInt(amountOut)
9889
10769
  });
9890
10770
  }
9891
- }, _callee, null, [[1, 4]]);
10771
+ }, _callee, null, [[1, 3]]);
9892
10772
  }));
9893
10773
  return function prepareExtrinsics(_x, _x2) {
9894
10774
  return _ref.apply(this, arguments);
@@ -9962,7 +10842,7 @@ var buildTransactions = /*#__PURE__*/function () {
9962
10842
 
9963
10843
  var buildApiTransactions = /*#__PURE__*/function () {
9964
10844
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(initialOptions) {
9965
- var _yield$prepareTransfo, options, dex;
10845
+ var _yield$prepareTransfo, options, dex, routerPlan;
9966
10846
  return _regenerator().w(function (_context) {
9967
10847
  while (1) switch (_context.n) {
9968
10848
  case 0:
@@ -9973,7 +10853,14 @@ var buildApiTransactions = /*#__PURE__*/function () {
9973
10853
  _yield$prepareTransfo = _context.v;
9974
10854
  options = _yield$prepareTransfo.options;
9975
10855
  dex = _yield$prepareTransfo.dex;
9976
- return _context.a(2, buildTransactions(dex, options));
10856
+ _context.n = 2;
10857
+ return buildTransactions(dex, options);
10858
+ case 2:
10859
+ routerPlan = _context.v;
10860
+ _context.n = 3;
10861
+ return maybePerformXcmFormatCheck(initialOptions.api, options, routerPlan);
10862
+ case 3:
10863
+ return _context.a(2, routerPlan);
9977
10864
  }
9978
10865
  }, _callee);
9979
10866
  }));
@@ -9982,143 +10869,78 @@ var buildApiTransactions = /*#__PURE__*/function () {
9982
10869
  };
9983
10870
  }();
9984
10871
 
9985
- var assignIsExchange = function assignIsExchange(result, options) {
9986
- var origin = options.origin,
9987
- exchange = options.exchange,
9988
- destination = options.destination;
9989
- if (!origin) {
9990
- result.origin.isExchange = true;
9991
- }
9992
- if (!destination && result.destination) {
9993
- result.destination.isExchange = true;
9994
- }
9995
- result.hops = result.hops.map(function (hop) {
9996
- var isExchange = hop.chain === exchange.chain;
9997
- return _objectSpread2(_objectSpread2({}, hop), {}, {
9998
- result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
9999
- isExchange: isExchange
10000
- }),
10001
- isExchange: isExchange
10002
- });
10003
- });
10004
- return result;
10005
- };
10006
- var dryRunTransaction = /*#__PURE__*/function () {
10007
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, transaction, destChain, bypassOptions) {
10008
- var _ref2;
10009
- var api, exchange, sender, evmSenderAddress, destination, currencyFrom, currencyTo, amount, tx, chain, senderResolved, resolvedDest;
10872
+ var getSwapOriginFee = /*#__PURE__*/function () {
10873
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options, disableFallback) {
10874
+ var origin, exchange, _yield$getSwapFee, result, _t;
10010
10875
  return _regenerator().w(function (_context) {
10011
- while (1) switch (_context.n) {
10012
- case 0:
10013
- api = options.api, exchange = options.exchange, sender = options.sender, evmSenderAddress = options.evmSenderAddress, destination = options.destination, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, amount = options.amount;
10014
- tx = transaction.tx, chain = transaction.chain;
10015
- senderResolved = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
10016
- resolvedDest = (_ref2 = destChain !== null && destChain !== void 0 ? destChain : destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _ref2 !== void 0 ? _ref2 : exchange.chain;
10017
- return _context.a(2, dryRun({
10018
- api: api.clone(),
10019
- tx: tx,
10020
- origin: chain,
10021
- destination: resolvedDest,
10022
- sender: senderResolved,
10023
- swapConfig: {
10024
- currencyTo: currencyTo,
10025
- exchangeChain: exchange.chain
10026
- },
10027
- currency: _objectSpread2(_objectSpread2({}, currencyFrom), {}, {
10028
- amount: BigInt(amount)
10029
- }),
10030
- bypassOptions: bypassOptions
10031
- }));
10032
- }
10033
- }, _callee);
10034
- }));
10035
- return function dryRunTransaction(_x, _x2, _x3, _x4) {
10036
- return _ref.apply(this, arguments);
10037
- };
10038
- }();
10039
- var mergeDryRunResults = function mergeDryRunResults(options, originResult, exchangeResult) {
10040
- var exchange = options.exchange,
10041
- destination = options.destination;
10042
- var result = {
10043
- origin: originResult.origin,
10044
- destination: destination ? exchangeResult.destination : exchangeResult.origin,
10045
- hops: [].concat(_toConsumableArray(originResult.hops), _toConsumableArray(destination ? [{
10046
- chain: exchange.chain,
10047
- result: exchangeResult.origin
10048
- }] : []), _toConsumableArray(exchangeResult.hops))
10049
- };
10050
- return _objectSpread2(_objectSpread2({}, getFailureInfo(result)), result);
10051
- };
10052
- var dryRun2Transactions = /*#__PURE__*/function () {
10053
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options, transactions) {
10054
- var exchange, _transactions, firstTx, secondTx, firstRes, _getFailureInfo, failureReason, bypassOptions, secondRes;
10055
- return _regenerator().w(function (_context2) {
10056
- while (1) switch (_context2.n) {
10876
+ while (1) switch (_context.p = _context.n) {
10057
10877
  case 0:
10058
- exchange = options.exchange;
10059
- _transactions = _slicedToArray(transactions, 2), firstTx = _transactions[0], secondTx = _transactions[1];
10060
- _context2.n = 1;
10061
- return dryRunTransaction(options, firstTx, exchange.chain);
10062
- case 1:
10063
- firstRes = _context2.v;
10064
- _getFailureInfo = getFailureInfo(firstRes), failureReason = _getFailureInfo.failureReason;
10065
- bypassOptions = !failureReason ? {
10066
- sentAssetMintMode: 'preview',
10067
- mintFeeAssets: false
10068
- } : undefined;
10069
- _context2.n = 2;
10070
- return dryRunTransaction(options, secondTx, undefined, bypassOptions);
10878
+ origin = options.origin, exchange = options.exchange;
10879
+ if (!canUseExecuteTransfer(dex, options)) {
10880
+ _context.n = 4;
10881
+ break;
10882
+ }
10883
+ _context.p = 1;
10884
+ _context.n = 2;
10885
+ return getSwapExecuteOriginXcmFee(dex, options, disableFallback);
10071
10886
  case 2:
10072
- secondRes = _context2.v;
10073
- return _context2.a(2, mergeDryRunResults(options, firstRes, secondRes));
10887
+ return _context.a(2, _context.v);
10888
+ case 3:
10889
+ _context.p = 3;
10890
+ _t = _context.v;
10891
+ if (isFilteredError(_t)) {
10892
+ _context.n = 4;
10893
+ break;
10894
+ }
10895
+ throw _t;
10896
+ case 4:
10897
+ if (!(origin && origin.chain !== exchange.chain)) {
10898
+ _context.n = 5;
10899
+ break;
10900
+ }
10901
+ return _context.a(2, getToExchangeOriginFee(_objectSpread2(_objectSpread2({}, options), {}, {
10902
+ origin: origin
10903
+ }), disableFallback));
10904
+ case 5:
10905
+ _context.n = 6;
10906
+ return getSwapFee(dex, options, disableFallback);
10907
+ case 6:
10908
+ _yield$getSwapFee = _context.v;
10909
+ result = _yield$getSwapFee.result;
10910
+ return _context.a(2, result);
10074
10911
  }
10075
- }, _callee2);
10912
+ }, _callee, null, [[1, 3]]);
10076
10913
  }));
10077
- return function dryRun2Transactions(_x5, _x6) {
10078
- return _ref3.apply(this, arguments);
10914
+ return function getSwapOriginFee(_x, _x2, _x3) {
10915
+ return _ref.apply(this, arguments);
10079
10916
  };
10080
10917
  }();
10081
- var dryRunTransactions = function dryRunTransactions(transactions, options) {
10082
- if (transactions.length === 1) {
10083
- return dryRunTransaction(options, transactions[0]);
10084
- }
10085
- if (transactions.length === 2) {
10086
- return dryRun2Transactions(options, transactions);
10087
- }
10088
- throw new UnsupportedOperationError('Router dry run supports up to two transactions per flow.');
10089
- };
10090
- var dryRunRouter = /*#__PURE__*/function () {
10091
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(initialOptions) {
10092
- var _yield$prepareTransfo, options, dex, routerPlan, result;
10093
- return _regenerator().w(function (_context3) {
10094
- while (1) switch (_context3.n) {
10918
+
10919
+ var getOriginXcmFee = /*#__PURE__*/function () {
10920
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(initialOptions, disableFallback) {
10921
+ var _yield$prepareTransfo, options, dex;
10922
+ return _regenerator().w(function (_context) {
10923
+ while (1) switch (_context.n) {
10095
10924
  case 0:
10096
10925
  validateTransferOptions(initialOptions);
10097
- _context3.n = 1;
10098
- return prepareTransformedOptions(initialOptions);
10926
+ _context.n = 1;
10927
+ return prepareTransformedOptions(initialOptions, true);
10099
10928
  case 1:
10100
- _yield$prepareTransfo = _context3.v;
10929
+ _yield$prepareTransfo = _context.v;
10101
10930
  options = _yield$prepareTransfo.options;
10102
10931
  dex = _yield$prepareTransfo.dex;
10103
- _context3.n = 2;
10104
- return buildTransactions(dex, options);
10105
- case 2:
10106
- routerPlan = _context3.v;
10107
- _context3.n = 3;
10108
- return dryRunTransactions(routerPlan, options);
10109
- case 3:
10110
- result = _context3.v;
10111
- return _context3.a(2, assignIsExchange(result, options));
10932
+ return _context.a(2, getSwapOriginFee(dex, options, disableFallback));
10112
10933
  }
10113
- }, _callee3);
10934
+ }, _callee);
10114
10935
  }));
10115
- return function dryRunRouter(_x7) {
10116
- return _ref4.apply(this, arguments);
10936
+ return function getOriginXcmFee(_x, _x2) {
10937
+ return _ref.apply(this, arguments);
10117
10938
  };
10118
10939
  }();
10119
10940
 
10120
10941
  var getSwapFee = /*#__PURE__*/function () {
10121
10942
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(exchange, options, disableFallback) {
10943
+ var _result$fee;
10122
10944
  var sender, _options$exchange, assetFrom, api, amount, txs, amountOut, isForFeeEstimation, swapResult, buildTx, result, finalFee, _t;
10123
10945
  return _regenerator().w(function (_context2) {
10124
10946
  while (1) switch (_context2.p = _context2.n) {
@@ -10169,7 +10991,7 @@ var getSwapFee = /*#__PURE__*/function () {
10169
10991
  };
10170
10992
  }();
10171
10993
  _context2.n = 6;
10172
- return getOriginXcmFee({
10994
+ return getOriginXcmFee$1({
10173
10995
  api: api,
10174
10996
  buildTx: buildTx,
10175
10997
  origin: exchange.chain,
@@ -10183,7 +11005,7 @@ var getSwapFee = /*#__PURE__*/function () {
10183
11005
  });
10184
11006
  case 6:
10185
11007
  result = _context2.v;
10186
- finalFee = result.fee * BigInt(txs.length);
11008
+ finalFee = ((_result$fee = result.fee) !== null && _result$fee !== void 0 ? _result$fee : 0n) * BigInt(txs.length);
10187
11009
  return _context2.a(2, {
10188
11010
  result: _objectSpread2(_objectSpread2({}, result), {}, {
10189
11011
  fee: finalFee
@@ -10199,166 +11021,76 @@ var getSwapFee = /*#__PURE__*/function () {
10199
11021
  }();
10200
11022
 
10201
11023
  var getRouterFees = /*#__PURE__*/function () {
10202
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(dex, options, disableFallback) {
11024
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options, disableFallback) {
10203
11025
  var _sendingChain$hops, _receivingChain$origi, _receivingChain$hops, _sendingChain$origin, _receivingChain$desti, _sendingChain$failure, _sendingChain$failure2;
10204
- var api, origin, exchange, currencyFrom, currencyTo, feeAsset, destination, amount, sender, recipient, evmSenderAddress, _origin$chain, _destination$chain, buildTx, mainAmountOut, executeResult, transformedHops, sendingChain, _yield$getSwapFee, swapChain, amountOut, receivingChain, mergedHops, finalOrigin, finalDestination, _t, _t2, _t3;
10205
- return _regenerator().w(function (_context2) {
10206
- while (1) switch (_context2.p = _context2.n) {
11026
+ var api, origin, exchange, destination, sender, _yield$getSwapExecute, result, transformedHops, sendingChain, _yield$getSwapFee, swapChain, amountOut, receivingChain, mergedHops, finalOrigin, finalDestination, _t, _t2, _t3;
11027
+ return _regenerator().w(function (_context) {
11028
+ while (1) switch (_context.p = _context.n) {
10207
11029
  case 0:
10208
- api = options.api, origin = options.origin, exchange = options.exchange, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, feeAsset = options.feeAsset, destination = options.destination, amount = options.amount, sender = options.sender, recipient = options.recipient, evmSenderAddress = options.evmSenderAddress;
10209
- if (!((origin || destination) && (dex.chain.includes('AssetHub') || dex.chain === 'Hydration'))) {
10210
- _context2.n = 6;
10211
- break;
10212
- }
10213
- _context2.p = 1;
10214
- buildTx = /*#__PURE__*/function () {
10215
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(overrideAmount) {
10216
- var _origin$assetFrom, _origin$feeAssetInfo;
10217
- var amt, amountOut, tx;
10218
- return _regenerator().w(function (_context) {
10219
- while (1) switch (_context.n) {
10220
- case 0:
10221
- amt = overrideAmount !== undefined ? applyDecimalAbstraction(overrideAmount, exchange.assetFrom.decimals, true) : amount;
10222
- _context.n = 1;
10223
- return dex.getAmountOut(_objectSpread2(_objectSpread2({}, options), {}, {
10224
- amount: amt,
10225
- api: exchange.api,
10226
- apiPjs: exchange.apiPjs,
10227
- assetFrom: exchange.assetFrom,
10228
- assetTo: exchange.assetTo
10229
- }));
10230
- case 1:
10231
- amountOut = _context.v;
10232
- _context.n = 2;
10233
- return handleSwapExecuteTransfer({
10234
- api: api,
10235
- chain: origin === null || origin === void 0 ? void 0 : origin.chain,
10236
- exchangeChain: exchange.chain,
10237
- destChain: destination === null || destination === void 0 ? void 0 : destination.chain,
10238
- assetInfoFrom: _objectSpread2(_objectSpread2({}, (_origin$assetFrom = origin === null || origin === void 0 ? void 0 : origin.assetFrom) !== null && _origin$assetFrom !== void 0 ? _origin$assetFrom : exchange.assetFrom), {}, {
10239
- amount: BigInt(amt)
10240
- }),
10241
- assetInfoTo: _objectSpread2(_objectSpread2({}, exchange.assetTo), {}, {
10242
- amount: amountOut
10243
- }),
10244
- currencyTo: currencyTo,
10245
- feeAssetInfo: (_origin$feeAssetInfo = origin === null || origin === void 0 ? void 0 : origin.feeAssetInfo) !== null && _origin$feeAssetInfo !== void 0 ? _origin$feeAssetInfo : exchange.feeAssetInfo,
10246
- sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
10247
- recipient: recipient !== null && recipient !== void 0 ? recipient : sender,
10248
- calculateMinAmountOut: function calculateMinAmountOut(amountIn, assetTo) {
10249
- return dex.getAmountOut(_objectSpread2(_objectSpread2({}, options), {}, {
10250
- amount: amountIn,
10251
- apiPjs: options.exchange.apiPjs,
10252
- api: options.exchange.api,
10253
- assetFrom: options.exchange.assetFrom,
10254
- assetTo: assetTo !== null && assetTo !== void 0 ? assetTo : options.exchange.assetTo,
10255
- slippagePct: '1'
10256
- }));
10257
- }
10258
- });
10259
- case 2:
10260
- tx = _context.v;
10261
- return _context.a(2, tx);
10262
- }
10263
- }, _callee);
10264
- }));
10265
- return function buildTx(_x4) {
10266
- return _ref2.apply(this, arguments);
10267
- };
10268
- }();
10269
- _context2.n = 2;
10270
- return dex.getAmountOut(_objectSpread2(_objectSpread2({}, options), {}, {
10271
- amount: amount,
10272
- api: exchange.api,
10273
- apiPjs: exchange.apiPjs,
10274
- assetFrom: exchange.assetFrom,
10275
- assetTo: exchange.assetTo
10276
- }));
10277
- case 2:
10278
- mainAmountOut = _context2.v;
10279
- _context2.n = 3;
10280
- return getXcmFee({
10281
- api: api,
10282
- buildTx: buildTx,
10283
- origin: (_origin$chain = origin === null || origin === void 0 ? void 0 : origin.chain) !== null && _origin$chain !== void 0 ? _origin$chain : exchange.chain,
10284
- destination: (_destination$chain = destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _destination$chain !== void 0 ? _destination$chain : exchange.chain,
10285
- sender: evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender,
10286
- recipient: recipient !== null && recipient !== void 0 ? recipient : sender,
10287
- currency: _objectSpread2(_objectSpread2({}, currencyFrom), {}, {
10288
- amount: BigInt(amount)
10289
- }),
10290
- feeAsset: feeAsset,
10291
- disableFallback: disableFallback,
10292
- swapConfig: {
10293
- currencyTo: currencyTo,
10294
- exchangeChain: exchange.chain,
10295
- amountOut: mainAmountOut
10296
- }
10297
- });
10298
- case 3:
10299
- executeResult = _context2.v;
10300
- if (!(executeResult.failureReason === 'NoDeal' && exchange.chain === 'Hydration')) {
10301
- _context2.n = 4;
10302
- break;
10303
- }
10304
- throw new RoutingResolutionError('An error occured, either this route is not registered for swap on exchange chain, or the amount out was not able to be calculated.');
10305
- case 4:
10306
- transformedHops = executeResult.hops.map(function (hop) {
10307
- if (hop.chain === exchange.chain) {
10308
- return {
10309
- chain: hop.chain,
10310
- result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
10311
- isExchange: true
10312
- })
10313
- };
10314
- }
10315
- return hop;
11030
+ api = options.api, origin = options.origin, exchange = options.exchange, destination = options.destination, sender = options.sender;
11031
+ if (!canUseExecuteTransfer(dex, options)) {
11032
+ _context.n = 4;
11033
+ break;
11034
+ }
11035
+ _context.p = 1;
11036
+ _context.n = 2;
11037
+ return getSwapExecuteXcmFee(dex, options, disableFallback);
11038
+ case 2:
11039
+ _yield$getSwapExecute = _context.v;
11040
+ result = _yield$getSwapExecute.result;
11041
+ transformedHops = result.hops.map(function (hop) {
11042
+ return hop.chain === exchange.chain ? {
11043
+ chain: hop.chain,
11044
+ result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
11045
+ isExchange: true
11046
+ })
11047
+ } : hop;
10316
11048
  });
10317
- return _context2.a(2, _objectSpread2(_objectSpread2({}, executeResult), {}, {
10318
- origin: _objectSpread2(_objectSpread2({}, executeResult.origin), !origin && {
11049
+ return _context.a(2, _objectSpread2(_objectSpread2({}, result), {}, {
11050
+ origin: _objectSpread2(_objectSpread2({}, result.origin), !origin && {
10319
11051
  isExchange: true
10320
11052
  }),
10321
- destination: _objectSpread2(_objectSpread2({}, executeResult.destination), !destination && {
11053
+ destination: _objectSpread2(_objectSpread2({}, result.destination), !destination && {
10322
11054
  isExchange: true
10323
11055
  }),
10324
11056
  hops: transformedHops
10325
11057
  }));
10326
- case 5:
10327
- _context2.p = 5;
10328
- _t = _context2.v;
10329
- if (_t instanceof DryRunFailedError && _t.dryRunType === 'origin' && _t.reason === 'Filtered') {
10330
- _context2.n = 6;
11058
+ case 3:
11059
+ _context.p = 3;
11060
+ _t = _context.v;
11061
+ if (isFilteredError(_t)) {
11062
+ _context.n = 4;
10331
11063
  break;
10332
11064
  }
10333
11065
  throw _t;
10334
- case 6:
11066
+ case 4:
10335
11067
  if (!(origin && origin.chain !== exchange.chain)) {
10336
- _context2.n = 8;
11068
+ _context.n = 6;
10337
11069
  break;
10338
11070
  }
10339
- _context2.n = 7;
11071
+ _context.n = 5;
10340
11072
  return getToExchangeFee(_objectSpread2(_objectSpread2({}, options), {}, {
10341
11073
  origin: origin
10342
11074
  }), disableFallback);
10343
- case 7:
10344
- _t2 = _context2.v;
10345
- _context2.n = 9;
11075
+ case 5:
11076
+ _t2 = _context.v;
11077
+ _context.n = 7;
10346
11078
  break;
10347
- case 8:
11079
+ case 6:
10348
11080
  _t2 = undefined;
10349
- case 9:
11081
+ case 7:
10350
11082
  sendingChain = _t2;
10351
- _context2.n = 10;
11083
+ _context.n = 8;
10352
11084
  return getSwapFee(dex, options);
10353
- case 10:
10354
- _yield$getSwapFee = _context2.v;
11085
+ case 8:
11086
+ _yield$getSwapFee = _context.v;
10355
11087
  swapChain = _yield$getSwapFee.result;
10356
11088
  amountOut = _yield$getSwapFee.amountOut;
10357
11089
  if (!(destination && destination.chain !== exchange.chain)) {
10358
- _context2.n = 12;
11090
+ _context.n = 10;
10359
11091
  break;
10360
11092
  }
10361
- _context2.n = 11;
11093
+ _context.n = 9;
10362
11094
  return getFromExchangeFee({
10363
11095
  exchange: exchange,
10364
11096
  destination: destination,
@@ -10366,13 +11098,13 @@ var getRouterFees = /*#__PURE__*/function () {
10366
11098
  sender: sender,
10367
11099
  api: api
10368
11100
  }, disableFallback);
10369
- case 11:
10370
- _t3 = _context2.v;
10371
- _context2.n = 13;
11101
+ case 9:
11102
+ _t3 = _context.v;
11103
+ _context.n = 11;
10372
11104
  break;
10373
- case 12:
11105
+ case 10:
10374
11106
  _t3 = undefined;
10375
- case 13:
11107
+ case 11:
10376
11108
  receivingChain = _t3;
10377
11109
  mergedHops = [].concat(_toConsumableArray((_sendingChain$hops = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.hops) !== null && _sendingChain$hops !== void 0 ? _sendingChain$hops : []), _toConsumableArray(sendingChain && receivingChain ? [{
10378
11110
  chain: exchange.chain,
@@ -10389,7 +11121,7 @@ var getRouterFees = /*#__PURE__*/function () {
10389
11121
  }), !origin && !destination && {
10390
11122
  fee: 0n
10391
11123
  });
10392
- return _context2.a(2, {
11124
+ return _context.a(2, {
10393
11125
  failureReason: (_sendingChain$failure = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.failureReason) !== null && _sendingChain$failure !== void 0 ? _sendingChain$failure : receivingChain === null || receivingChain === void 0 ? void 0 : receivingChain.failureReason,
10394
11126
  failureChain: (_sendingChain$failure2 = sendingChain === null || sendingChain === void 0 ? void 0 : sendingChain.failureChain) !== null && _sendingChain$failure2 !== void 0 ? _sendingChain$failure2 : receivingChain === null || receivingChain === void 0 ? void 0 : receivingChain.failureChain,
10395
11127
  origin: finalOrigin,
@@ -10397,7 +11129,7 @@ var getRouterFees = /*#__PURE__*/function () {
10397
11129
  hops: mergedHops
10398
11130
  });
10399
11131
  }
10400
- }, _callee2, null, [[1, 5]]);
11132
+ }, _callee, null, [[1, 3]]);
10401
11133
  }));
10402
11134
  return function getRouterFees(_x, _x2, _x3) {
10403
11135
  return _ref.apply(this, arguments);
@@ -10428,12 +11160,14 @@ var getXcmFees = /*#__PURE__*/function () {
10428
11160
 
10429
11161
  var selectBestExchangeAmountOut = /*#__PURE__*/function () {
10430
11162
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options, originApi) {
11163
+ var exchangeConfig;
10431
11164
  return _regenerator().w(function (_context2) {
10432
11165
  while (1) switch (_context2.n) {
10433
11166
  case 0:
11167
+ exchangeConfig = convertBuilderConfig(options.api.config);
10434
11168
  return _context2.a(2, selectBestExchangeCommon(options, originApi, /*#__PURE__*/function () {
10435
11169
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, assetFromExchange, assetTo, _options, parsedAmount) {
10436
- var exchangeApi, exchangePjsApi;
11170
+ var exchangeApi, _t, _t2, _t3, _t4;
10437
11171
  return _regenerator().w(function (_context) {
10438
11172
  while (1) switch (_context.n) {
10439
11173
  case 0:
@@ -10441,17 +11175,19 @@ var selectBestExchangeAmountOut = /*#__PURE__*/function () {
10441
11175
  return options.api.createApiForChain(dex.chain);
10442
11176
  case 1:
10443
11177
  exchangeApi = _context.v;
11178
+ _t = dex;
11179
+ _t2 = _objectSpread2;
11180
+ _t3 = _objectSpread2;
11181
+ _t4 = {};
10444
11182
  _context.n = 2;
10445
- return dex.createApiInstance();
11183
+ return buildExchangeApiVariant(dex, exchangeConfig);
10446
11184
  case 2:
10447
- exchangePjsApi = _context.v;
10448
- return _context.a(2, dex.getAmountOut({
11185
+ return _context.a(2, _t.getAmountOut.call(_t, _t2(_t3(_t4, _context.v), {}, {
10449
11186
  api: exchangeApi,
10450
- apiPjs: exchangePjsApi,
10451
11187
  assetFrom: assetFromExchange,
10452
11188
  assetTo: assetTo,
10453
11189
  amount: BigInt(parsedAmount)
10454
- }));
11190
+ })));
10455
11191
  }
10456
11192
  }, _callee);
10457
11193
  }));
@@ -10470,7 +11206,7 @@ var selectBestExchangeAmountOut = /*#__PURE__*/function () {
10470
11206
  var getBestAmountOut = /*#__PURE__*/function () {
10471
11207
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10472
11208
  var _assetFromOrigin$deci;
10473
- var api, exchange, amount, from, originApi, isExchangeAutoSelect, dex, _resolveAssets, assetFromOrigin, assetFrom, assetTo, res, config, exchangeConfig, pjsApi, exchangeApi, _t, _t2, _t3, _t4;
11209
+ var api, exchange, amount, from, originApi, isExchangeAutoSelect, dex, _resolveAssets, assetFromOrigin, assetFrom, assetTo, res, config, exchangeConfig, exchangeApi, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8;
10474
11210
  return _regenerator().w(function (_context) {
10475
11211
  while (1) switch (_context.n) {
10476
11212
  case 0:
@@ -10522,27 +11258,29 @@ var getBestAmountOut = /*#__PURE__*/function () {
10522
11258
  config = api.config;
10523
11259
  exchangeConfig = convertBuilderConfig(config);
10524
11260
  _context.n = 9;
10525
- return dex.createApiInstance(exchangeConfig);
10526
- case 9:
10527
- pjsApi = _context.v;
10528
- _context.n = 10;
10529
11261
  return api.createApiForChain(dex.chain);
10530
- case 10:
11262
+ case 9:
10531
11263
  exchangeApi = _context.v;
10532
11264
  _t3 = dex.chain;
11265
+ _t4 = dex;
11266
+ _t5 = _objectSpread2;
11267
+ _t6 = _objectSpread2;
11268
+ _t7 = {};
11269
+ _context.n = 10;
11270
+ return buildExchangeApiVariant(dex, exchangeConfig);
11271
+ case 10:
10533
11272
  _context.n = 11;
10534
- return dex.getAmountOut({
11273
+ return _t4.getAmountOut.call(_t4, _t5(_t6(_t7, _context.v), {}, {
10535
11274
  api: exchangeApi,
10536
- apiPjs: pjsApi,
10537
11275
  assetFrom: assetFrom,
10538
11276
  assetTo: assetTo,
10539
11277
  amount: applyDecimalAbstraction(amount, (_assetFromOrigin$deci = assetFromOrigin === null || assetFromOrigin === void 0 ? void 0 : assetFromOrigin.decimals) !== null && _assetFromOrigin$deci !== void 0 ? _assetFromOrigin$deci : assetFrom.decimals, (exchangeConfig === null || exchangeConfig === void 0 ? void 0 : exchangeConfig.abstractDecimals) !== false)
10540
- });
11278
+ }));
10541
11279
  case 11:
10542
- _t4 = _context.v;
11280
+ _t8 = _context.v;
10543
11281
  return _context.a(2, {
10544
11282
  exchange: _t3,
10545
- amountOut: _t4
11283
+ amountOut: _t8
10546
11284
  });
10547
11285
  }
10548
11286
  }, _callee);
@@ -10813,6 +11551,9 @@ var transfer = /*#__PURE__*/function () {
10813
11551
  return buildTransactions(dex, options);
10814
11552
  case 5:
10815
11553
  routerPlan = _context.v;
11554
+ _context.n = 6;
11555
+ return maybePerformXcmFormatCheck(api, options, routerPlan);
11556
+ case 6:
10816
11557
  return _context.a(2, executeRouterPlan(routerPlan, {
10817
11558
  signer: signer,
10818
11559
  sender: sender,
@@ -10830,6 +11571,329 @@ var transfer = /*#__PURE__*/function () {
10830
11571
  };
10831
11572
  }();
10832
11573
 
11574
+ var buildExecuteSwapHops = /*#__PURE__*/function () {
11575
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
11576
+ var api, hops, originChain, exchangeChain, currencyFrom, currencyTo, sender, exchangeHopIdx;
11577
+ return _regenerator().w(function (_context2) {
11578
+ while (1) switch (_context2.n) {
11579
+ case 0:
11580
+ api = _ref.api, hops = _ref.hops, originChain = _ref.originChain, exchangeChain = _ref.exchangeChain, currencyFrom = _ref.currencyFrom, currencyTo = _ref.currencyTo, sender = _ref.sender;
11581
+ exchangeHopIdx = hops.findIndex(function (h) {
11582
+ return h.chain === exchangeChain;
11583
+ });
11584
+ return _context2.a(2, Promise.all(hops.map(/*#__PURE__*/function () {
11585
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(hop, idx) {
11586
+ var _hop$result$fee;
11587
+ var isSwapHop, isAfterSwap, result;
11588
+ return _regenerator().w(function (_context) {
11589
+ while (1) switch (_context.n) {
11590
+ case 0:
11591
+ isSwapHop = hop.chain === exchangeChain;
11592
+ isAfterSwap = exchangeHopIdx >= 0 && idx > exchangeHopIdx;
11593
+ _context.n = 1;
11594
+ return buildHopInfo({
11595
+ api: api,
11596
+ chain: hop.chain,
11597
+ fee: (_hop$result$fee = hop.result.fee) !== null && _hop$result$fee !== void 0 ? _hop$result$fee : 0n,
11598
+ originChain: originChain,
11599
+ currency: isAfterSwap ? currencyTo : currencyFrom,
11600
+ asset: hop.result.asset,
11601
+ sender: sender
11602
+ });
11603
+ case 1:
11604
+ result = _context.v;
11605
+ return _context.a(2, {
11606
+ chain: hop.chain,
11607
+ result: _objectSpread2(_objectSpread2({}, result), isSwapHop && {
11608
+ isExchange: true
11609
+ })
11610
+ });
11611
+ }
11612
+ }, _callee);
11613
+ }));
11614
+ return function (_x2, _x3) {
11615
+ return _ref3.apply(this, arguments);
11616
+ };
11617
+ }())));
11618
+ }
11619
+ }, _callee2);
11620
+ }));
11621
+ return function buildExecuteSwapHops(_x) {
11622
+ return _ref2.apply(this, arguments);
11623
+ };
11624
+ }();
11625
+
11626
+ var getExecuteSwapInfo = /*#__PURE__*/function () {
11627
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dex, options) {
11628
+ var _origin$chain, _destination$chain;
11629
+ var api, origin, exchange, currencyFrom, currencyTo, destination, amount, sender, recipient, evmSenderAddress, _yield$getSwapExecute, xcmFeeResult, amountOut, originChain, destChain, senderAddress, recipientAddress, originAsset, originInfo, builtHops, exchangeHopIdx, postSwapHops, _aggregateHopFees, totalHopFee, bridgeFee, destinationInfo;
11630
+ return _regenerator().w(function (_context) {
11631
+ while (1) switch (_context.n) {
11632
+ case 0:
11633
+ api = options.api, origin = options.origin, exchange = options.exchange, currencyFrom = options.currencyFrom, currencyTo = options.currencyTo, destination = options.destination, amount = options.amount, sender = options.sender, recipient = options.recipient, evmSenderAddress = options.evmSenderAddress;
11634
+ assertCurrencyCore(currencyFrom);
11635
+ assertCurrencyCore(currencyTo);
11636
+ _context.n = 1;
11637
+ return getSwapExecuteXcmFee(dex, options, false);
11638
+ case 1:
11639
+ _yield$getSwapExecute = _context.v;
11640
+ xcmFeeResult = _yield$getSwapExecute.result;
11641
+ amountOut = _yield$getSwapExecute.amountOut;
11642
+ originChain = (_origin$chain = origin === null || origin === void 0 ? void 0 : origin.chain) !== null && _origin$chain !== void 0 ? _origin$chain : exchange.chain;
11643
+ destChain = (_destination$chain = destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _destination$chain !== void 0 ? _destination$chain : exchange.chain;
11644
+ senderAddress = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
11645
+ recipientAddress = recipient !== null && recipient !== void 0 ? recipient : sender;
11646
+ originAsset = origin ? findAssetInfoOrThrow(originChain, currencyFrom, destChain) : exchange.assetFrom;
11647
+ _context.n = 2;
11648
+ return buildOriginInfo({
11649
+ api: api,
11650
+ origin: originChain,
11651
+ sender: senderAddress,
11652
+ currency: currencyFrom,
11653
+ originAsset: originAsset,
11654
+ amount: BigInt(amount),
11655
+ originFee: xcmFeeResult.origin.fee,
11656
+ originFeeAsset: xcmFeeResult.origin.asset,
11657
+ isFeeAssetAh: false
11658
+ });
11659
+ case 2:
11660
+ originInfo = _context.v;
11661
+ _context.n = 3;
11662
+ return buildExecuteSwapHops({
11663
+ api: api,
11664
+ hops: xcmFeeResult.hops,
11665
+ originChain: originChain,
11666
+ exchangeChain: exchange.chain,
11667
+ currencyFrom: currencyFrom,
11668
+ currencyTo: currencyTo,
11669
+ sender: senderAddress
11670
+ });
11671
+ case 3:
11672
+ builtHops = _context.v;
11673
+ exchangeHopIdx = xcmFeeResult.hops.findIndex(function (h) {
11674
+ return h.chain === exchange.chain;
11675
+ });
11676
+ postSwapHops = exchangeHopIdx >= 0 ? xcmFeeResult.hops.slice(exchangeHopIdx + 1) : xcmFeeResult.hops;
11677
+ _aggregateHopFees = aggregateHopFees(postSwapHops, exchange.assetTo), totalHopFee = _aggregateHopFees.totalHopFee, bridgeFee = _aggregateHopFees.bridgeFee;
11678
+ _context.n = 4;
11679
+ return buildDestInfo({
11680
+ api: api,
11681
+ origin: originChain,
11682
+ destination: destChain,
11683
+ recipient: recipientAddress,
11684
+ currency: _objectSpread2(_objectSpread2({}, currencyTo), {}, {
11685
+ amount: amountOut
11686
+ }),
11687
+ originFee: xcmFeeResult.origin.fee,
11688
+ isFeeAssetAh: false,
11689
+ destFeeDetail: xcmFeeResult.destination,
11690
+ totalHopFee: totalHopFee,
11691
+ bridgeFee: bridgeFee
11692
+ });
11693
+ case 4:
11694
+ destinationInfo = _context.v;
11695
+ return _context.a(2, {
11696
+ chain: {
11697
+ origin: originChain,
11698
+ destination: destChain,
11699
+ ecosystem: getRelayChainSymbol(originChain)
11700
+ },
11701
+ origin: _objectSpread2(_objectSpread2({}, originInfo), !origin && {
11702
+ isExchange: true
11703
+ }),
11704
+ hops: builtHops,
11705
+ destination: _objectSpread2(_objectSpread2({}, destinationInfo), !destination && {
11706
+ isExchange: true
11707
+ })
11708
+ });
11709
+ }
11710
+ }, _callee);
11711
+ }));
11712
+ return function getExecuteSwapInfo(_x, _x2) {
11713
+ return _ref.apply(this, arguments);
11714
+ };
11715
+ }();
11716
+
11717
+ var buildExchangeOriginInfo = function buildExchangeOriginInfo(exchange, sender, amount, swapFee) {
11718
+ return buildOriginInfo({
11719
+ api: exchange.api,
11720
+ origin: exchange.chain,
11721
+ sender: sender,
11722
+ currency: {
11723
+ location: exchange.assetFrom.location
11724
+ },
11725
+ originAsset: exchange.assetFrom,
11726
+ amount: amount,
11727
+ originFee: swapFee.fee,
11728
+ originFeeAsset: swapFee.asset,
11729
+ isFeeAssetAh: false
11730
+ });
11731
+ };
11732
+ var buildExchangeDestInfo = function buildExchangeDestInfo(exchange, recipient, amountOut, currencyTo) {
11733
+ return buildDestInfo({
11734
+ api: exchange.api,
11735
+ origin: exchange.chain,
11736
+ destination: exchange.chain,
11737
+ recipient: recipient,
11738
+ currency: _objectSpread2(_objectSpread2({}, currencyTo), {}, {
11739
+ amount: amountOut
11740
+ }),
11741
+ originFee: 0n,
11742
+ isFeeAssetAh: false,
11743
+ destFeeDetail: {
11744
+ fee: 0n,
11745
+ asset: exchange.assetTo,
11746
+ feeType: 'noFeeRequired'
11747
+ },
11748
+ totalHopFee: 0n
11749
+ });
11750
+ };
11751
+ var getSwapInfo = /*#__PURE__*/function () {
11752
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(initialOptions) {
11753
+ var _origin$chain, _destination$chain, _sendingInfo$hops, _receivingInfo$hops, _sendingInfo$origin, _receivingInfo$destin;
11754
+ var _yield$prepareTransfo, options, dex, api, origin, exchange, currencyTo, destination, amount, sender, evmSenderAddress, senderAddress, sendingInfo, _yield$getSwapFee, swapChain, amountOut, receivingInfo, originChain, destChain, exchangeHopEntry, hops, finalOrigin, finalDestination, _t, _t2, _t3, _t4, _t5;
11755
+ return _regenerator().w(function (_context) {
11756
+ while (1) switch (_context.p = _context.n) {
11757
+ case 0:
11758
+ validateTransferOptions(initialOptions);
11759
+ _context.n = 1;
11760
+ return prepareTransformedOptions(initialOptions, true);
11761
+ case 1:
11762
+ _yield$prepareTransfo = _context.v;
11763
+ options = _yield$prepareTransfo.options;
11764
+ dex = _yield$prepareTransfo.dex;
11765
+ if (!canUseExecuteTransfer(dex, options)) {
11766
+ _context.n = 5;
11767
+ break;
11768
+ }
11769
+ _context.p = 2;
11770
+ _context.n = 3;
11771
+ return getExecuteSwapInfo(dex, options);
11772
+ case 3:
11773
+ return _context.a(2, _context.v);
11774
+ case 4:
11775
+ _context.p = 4;
11776
+ _t = _context.v;
11777
+ if (isFilteredError(_t)) {
11778
+ _context.n = 5;
11779
+ break;
11780
+ }
11781
+ throw _t;
11782
+ case 5:
11783
+ api = options.api, origin = options.origin, exchange = options.exchange, currencyTo = options.currencyTo, destination = options.destination, amount = options.amount, sender = options.sender, evmSenderAddress = options.evmSenderAddress;
11784
+ assertCurrencyCore(currencyTo);
11785
+ senderAddress = evmSenderAddress !== null && evmSenderAddress !== void 0 ? evmSenderAddress : sender;
11786
+ if (!(origin && origin.chain !== exchange.chain)) {
11787
+ _context.n = 7;
11788
+ break;
11789
+ }
11790
+ _context.n = 6;
11791
+ return createToExchangeBuilder({
11792
+ origin: origin,
11793
+ exchange: exchange,
11794
+ sender: sender,
11795
+ evmSenderAddress: evmSenderAddress,
11796
+ amount: amount,
11797
+ api: api
11798
+ }).getTransferInfo();
11799
+ case 6:
11800
+ _t2 = _context.v;
11801
+ _context.n = 8;
11802
+ break;
11803
+ case 7:
11804
+ _t2 = undefined;
11805
+ case 8:
11806
+ sendingInfo = _t2;
11807
+ _context.n = 9;
11808
+ return getSwapFee(dex, options);
11809
+ case 9:
11810
+ _yield$getSwapFee = _context.v;
11811
+ swapChain = _yield$getSwapFee.result;
11812
+ amountOut = _yield$getSwapFee.amountOut;
11813
+ if (!(destination && destination.chain !== exchange.chain)) {
11814
+ _context.n = 11;
11815
+ break;
11816
+ }
11817
+ _context.n = 10;
11818
+ return createFromExchangeBuilder({
11819
+ exchange: exchange,
11820
+ destination: destination,
11821
+ amount: amountOut,
11822
+ sender: sender,
11823
+ api: api
11824
+ }).getTransferInfo();
11825
+ case 10:
11826
+ _t3 = _context.v;
11827
+ _context.n = 12;
11828
+ break;
11829
+ case 11:
11830
+ _t3 = undefined;
11831
+ case 12:
11832
+ receivingInfo = _t3;
11833
+ originChain = (_origin$chain = origin === null || origin === void 0 ? void 0 : origin.chain) !== null && _origin$chain !== void 0 ? _origin$chain : exchange.chain;
11834
+ destChain = (_destination$chain = destination === null || destination === void 0 ? void 0 : destination.chain) !== null && _destination$chain !== void 0 ? _destination$chain : exchange.chain;
11835
+ exchangeHopEntry = sendingInfo && receivingInfo ? {
11836
+ chain: exchange.chain,
11837
+ result: {
11838
+ asset: exchange.assetTo,
11839
+ xcmFee: {
11840
+ fee: swapChain.fee + receivingInfo.origin.xcmFee.fee,
11841
+ asset: swapChain.asset
11842
+ },
11843
+ isExchange: true
11844
+ }
11845
+ } : undefined;
11846
+ hops = [].concat(_toConsumableArray((_sendingInfo$hops = sendingInfo === null || sendingInfo === void 0 ? void 0 : sendingInfo.hops) !== null && _sendingInfo$hops !== void 0 ? _sendingInfo$hops : []), _toConsumableArray(exchangeHopEntry ? [exchangeHopEntry] : []), _toConsumableArray((_receivingInfo$hops = receivingInfo === null || receivingInfo === void 0 ? void 0 : receivingInfo.hops) !== null && _receivingInfo$hops !== void 0 ? _receivingInfo$hops : []));
11847
+ if (!((_sendingInfo$origin = sendingInfo === null || sendingInfo === void 0 ? void 0 : sendingInfo.origin) !== null && _sendingInfo$origin !== void 0)) {
11848
+ _context.n = 13;
11849
+ break;
11850
+ }
11851
+ _t4 = _sendingInfo$origin;
11852
+ _context.n = 15;
11853
+ break;
11854
+ case 13:
11855
+ _context.n = 14;
11856
+ return buildExchangeOriginInfo(exchange, senderAddress, amount, swapChain);
11857
+ case 14:
11858
+ _t4 = _context.v;
11859
+ case 15:
11860
+ finalOrigin = _t4;
11861
+ if (!((_receivingInfo$destin = receivingInfo === null || receivingInfo === void 0 ? void 0 : receivingInfo.destination) !== null && _receivingInfo$destin !== void 0)) {
11862
+ _context.n = 16;
11863
+ break;
11864
+ }
11865
+ _t5 = _receivingInfo$destin;
11866
+ _context.n = 18;
11867
+ break;
11868
+ case 16:
11869
+ _context.n = 17;
11870
+ return buildExchangeDestInfo(exchange, sender, amountOut, currencyTo);
11871
+ case 17:
11872
+ _t5 = _context.v;
11873
+ case 18:
11874
+ finalDestination = _t5;
11875
+ return _context.a(2, {
11876
+ chain: {
11877
+ origin: originChain,
11878
+ destination: destChain,
11879
+ ecosystem: getRelayChainSymbol(originChain)
11880
+ },
11881
+ origin: _objectSpread2(_objectSpread2({}, finalOrigin), !sendingInfo && {
11882
+ isExchange: true
11883
+ }),
11884
+ hops: hops,
11885
+ destination: _objectSpread2(_objectSpread2({}, finalDestination), !receivingInfo && {
11886
+ isExchange: true
11887
+ })
11888
+ });
11889
+ }
11890
+ }, _callee, null, [[2, 4]]);
11891
+ }));
11892
+ return function getSwapInfo(_x) {
11893
+ return _ref.apply(this, arguments);
11894
+ };
11895
+ }();
11896
+
10833
11897
  var SwapBuilderCore = /*#__PURE__*/function () {
10834
11898
  function SwapBuilderCore(api, options) {
10835
11899
  _classCallCheck(this, SwapBuilderCore);
@@ -10956,18 +12020,57 @@ var SwapBuilderCore = /*#__PURE__*/function () {
10956
12020
  return getXcmFees$1;
10957
12021
  }()
10958
12022
  }, {
10959
- key: "getTransferableAmount",
12023
+ key: "getOriginXcmFee",
10960
12024
  value: function () {
10961
- var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
12025
+ var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
12026
+ var _options$disableFallb2;
12027
+ var disableFallback;
10962
12028
  return _regenerator().w(function (_context2) {
10963
12029
  while (1) switch (_context2.n) {
10964
12030
  case 0:
10965
- return _context2.a(2, getTransferableAmount(_objectSpread2(_objectSpread2({}, this._options), {}, {
12031
+ disableFallback = (_options$disableFallb2 = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb2 !== void 0 ? _options$disableFallb2 : false;
12032
+ return _context2.a(2, getOriginXcmFee(_objectSpread2(_objectSpread2({}, this._options), {}, {
10966
12033
  api: this._api
10967
- })));
12034
+ }), disableFallback));
10968
12035
  }
10969
12036
  }, _callee2, this);
10970
12037
  }));
12038
+ function getOriginXcmFee$1(_x2) {
12039
+ return _getOriginXcmFee2.apply(this, arguments);
12040
+ }
12041
+ return getOriginXcmFee$1;
12042
+ }()
12043
+ }, {
12044
+ key: "getSwapInfo",
12045
+ value: function () {
12046
+ var _getSwapInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
12047
+ return _regenerator().w(function (_context3) {
12048
+ while (1) switch (_context3.n) {
12049
+ case 0:
12050
+ return _context3.a(2, getSwapInfo(_objectSpread2(_objectSpread2({}, this._options), {}, {
12051
+ api: this._api
12052
+ })));
12053
+ }
12054
+ }, _callee3, this);
12055
+ }));
12056
+ function getSwapInfo$1() {
12057
+ return _getSwapInfo2.apply(this, arguments);
12058
+ }
12059
+ return getSwapInfo$1;
12060
+ }()
12061
+ }, {
12062
+ key: "getTransferableAmount",
12063
+ value: function () {
12064
+ var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
12065
+ return _regenerator().w(function (_context4) {
12066
+ while (1) switch (_context4.n) {
12067
+ case 0:
12068
+ return _context4.a(2, getTransferableAmount(_objectSpread2(_objectSpread2({}, this._options), {}, {
12069
+ api: this._api
12070
+ })));
12071
+ }
12072
+ }, _callee4, this);
12073
+ }));
10971
12074
  function getTransferableAmount$1() {
10972
12075
  return _getTransferableAmount2.apply(this, arguments);
10973
12076
  }
@@ -10976,15 +12079,15 @@ var SwapBuilderCore = /*#__PURE__*/function () {
10976
12079
  }, {
10977
12080
  key: "getMinTransferableAmount",
10978
12081
  value: function () {
10979
- var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
10980
- return _regenerator().w(function (_context3) {
10981
- while (1) switch (_context3.n) {
12082
+ var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
12083
+ return _regenerator().w(function (_context5) {
12084
+ while (1) switch (_context5.n) {
10982
12085
  case 0:
10983
- return _context3.a(2, getMinTransferableAmount(_objectSpread2(_objectSpread2({}, this._options), {}, {
12086
+ return _context5.a(2, getMinTransferableAmount(_objectSpread2(_objectSpread2({}, this._options), {}, {
10984
12087
  api: this._api
10985
12088
  })));
10986
12089
  }
10987
- }, _callee3, this);
12090
+ }, _callee5, this);
10988
12091
  }));
10989
12092
  function getMinTransferableAmount$1() {
10990
12093
  return _getMinTransferableAmount2.apply(this, arguments);
@@ -11012,6 +12115,13 @@ var SwapBuilderCore = /*#__PURE__*/function () {
11012
12115
  api: this._api
11013
12116
  }));
11014
12117
  }
12118
+ }, {
12119
+ key: "dryRunPreview",
12120
+ value: function dryRunPreview(previewOptions) {
12121
+ return dryRunRouterPreview(_objectSpread2(_objectSpread2({}, this._options), {}, {
12122
+ api: this._api
12123
+ }), previewOptions);
12124
+ }
11015
12125
  }, {
11016
12126
  key: "getBestAmountOut",
11017
12127
  value: function getBestAmountOut$1() {