@paraspell/sdk-core 11.7.0 → 11.8.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.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { blake2b } from '@noble/hashes/blake2';
2
- import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findAssetInfo, isTAsset, findAssetInfoOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, findNativeAssetInfoOrThrow, Native, hasXcmPaymentApiSupport, getRelayChainSymbol, getNativeAssets, findNativeAssetInfo, isAssetXcEqual, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
2
+ import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findAssetInfo, isTAsset, getExistentialDeposit, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, findNativeAssetInfoOrThrow, Native, hasXcmPaymentApiSupport, getRelayChainSymbol, getNativeAssets, findNativeAssetInfo, isAssetXcEqual, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
3
3
  export * from '@paraspell/assets';
4
4
  import { base58 } from '@scure/base';
5
5
  import { isAddress, parseUnits, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
@@ -506,7 +506,7 @@ var IncompatibleChainsError = /*#__PURE__*/function (_Error) {
506
506
  var _this;
507
507
  _classCallCheck(this, IncompatibleChainsError);
508
508
  _this = _callSuper(this, IncompatibleChainsError, [message !== null && message !== void 0 ? message : 'Transactions between chains on different relaychains are not yet possible.']);
509
- _this.name = 'IncompatibleChainsError';
509
+ _this.name = 'IncompatibleChains';
510
510
  return _this;
511
511
  }
512
512
  _inherits(IncompatibleChainsError, _Error);
@@ -832,6 +832,52 @@ var isConfig = function isConfig(value) {
832
832
  Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value || 'xcmFormatCheck' in value);
833
833
  };
834
834
 
835
+ var computeOverridenAmount = function computeOverridenAmount(options) {
836
+ var from = options.from,
837
+ to = options.to,
838
+ currency = options.currency,
839
+ api = options.api;
840
+ var config = api.getConfig();
841
+ if (isConfig(config) && config.abstractDecimals) {
842
+ return BYPASS_CURRENCY_AMOUNT;
843
+ } else {
844
+ assertToIsString(to);
845
+ var asset = findAssetInfoOrThrow(from, currency, to);
846
+ return parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
847
+ }
848
+ };
849
+ var overrideTxAmount = function overrideTxAmount(options, builder) {
850
+ var modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, options.currency), {}, {
851
+ amount: computeOverridenAmount(options)
852
+ }));
853
+ return modifiedBuilder['buildInternal']();
854
+ };
855
+ var createTxs = /*#__PURE__*/function () {
856
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder) {
857
+ var tx, txBypass;
858
+ return _regenerator().w(function (_context) {
859
+ while (1) switch (_context.n) {
860
+ case 0:
861
+ _context.n = 1;
862
+ return builder['buildInternal']();
863
+ case 1:
864
+ tx = _context.v;
865
+ _context.n = 2;
866
+ return overrideTxAmount(options, builder);
867
+ case 2:
868
+ txBypass = _context.v;
869
+ return _context.a(2, {
870
+ tx: tx,
871
+ txBypass: txBypass
872
+ });
873
+ }
874
+ }, _callee);
875
+ }));
876
+ return function createTxs(_x, _x2) {
877
+ return _ref.apply(this, arguments);
878
+ };
879
+ }();
880
+
835
881
  /**
836
882
  * Retrieves the chain instance for a given chain.
837
883
  *
@@ -1580,6 +1626,21 @@ var Unique$1 = {
1580
1626
  }
1581
1627
  ]
1582
1628
  };
1629
+ var Xode$1 = {
1630
+ name: "Xode",
1631
+ info: "xode",
1632
+ paraId: 3417,
1633
+ providers: [
1634
+ {
1635
+ name: "XodeCommunity",
1636
+ endpoint: "wss://polkadot-rpcnode.xode.net"
1637
+ },
1638
+ {
1639
+ name: "Zeeve",
1640
+ endpoint: "wss://xode-polkadot-rpc-01.zeeve.net/y0yxg038wn1fncc/rpc"
1641
+ }
1642
+ ]
1643
+ };
1583
1644
  var AssetHubKusama$1 = {
1584
1645
  name: "AssetHub",
1585
1646
  info: "KusamaAssetHub",
@@ -2540,6 +2601,7 @@ var configs = {
2540
2601
  RobonomicsPolkadot: RobonomicsPolkadot$1,
2541
2602
  PeoplePolkadot: PeoplePolkadot$1,
2542
2603
  Unique: Unique$1,
2604
+ Xode: Xode$1,
2543
2605
  AssetHubKusama: AssetHubKusama$1,
2544
2606
  BridgeHubKusama: BridgeHubKusama$1,
2545
2607
  IntegriteeKusama: IntegriteeKusama$1,
@@ -2658,7 +2720,7 @@ var getLocationTokenId = function getLocationTokenId(location, chain) {
2658
2720
  return null;
2659
2721
  };
2660
2722
 
2661
- var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, chain, executionFee) {
2723
+ var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, chain, _executionFee) {
2662
2724
  var isFeeAsset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
2663
2725
  // Extract delivery fees from emitted events
2664
2726
  var deliveryFees = [];
@@ -2710,7 +2772,7 @@ var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, chain, executio
2710
2772
  }).reduce(function (acc, df) {
2711
2773
  return acc + df.plancks;
2712
2774
  }, 0n);
2713
- return totalDeliveryFees + executionFee;
2775
+ return totalDeliveryFees;
2714
2776
  }
2715
2777
  };
2716
2778
 
@@ -3650,17 +3712,15 @@ var determineAddress = function determineAddress(chain, address, senderAddress)
3650
3712
  };
3651
3713
  var getReverseTxFee = /*#__PURE__*/function () {
3652
3714
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, currencyInput) {
3653
- var api, origin, destination, senderAddress, address, currency, toAddress, fromAddress, tx, rawFee;
3715
+ var api, origin, destination, senderAddress, address, toAddress, fromAddress, tx, rawFee;
3654
3716
  return _regenerator().w(function (_context) {
3655
3717
  while (1) switch (_context.n) {
3656
3718
  case 0:
3657
- api = _ref.api, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency;
3719
+ api = _ref.api, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address;
3658
3720
  toAddress = determineAddress(origin, address, senderAddress);
3659
3721
  fromAddress = determineAddress(destination, address, senderAddress);
3660
3722
  _context.n = 1;
3661
- return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
3662
- amount: currency.amount
3663
- }))['buildInternal']();
3723
+ return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(currencyInput)['buildInternal']();
3664
3724
  case 1:
3665
3725
  tx = _context.v;
3666
3726
  _context.n = 2;
@@ -4321,7 +4381,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
4321
4381
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
4322
4382
  calcPaymentInfoFee = /*#__PURE__*/function () {
4323
4383
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
4324
- var originAsset, _t;
4384
+ var originAsset, amount, _t;
4325
4385
  return _regenerator().w(function (_context) {
4326
4386
  while (1) switch (_context.p = _context.n) {
4327
4387
  case 0:
@@ -4332,6 +4392,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
4332
4392
  return _context.a(2, 0n);
4333
4393
  case 1:
4334
4394
  originAsset = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, destination) : findAssetInfoOrThrow(origin, currency, destination);
4395
+ amount = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? swapConfig.amountOut : currency.amount;
4335
4396
  if (!originAsset.location) {
4336
4397
  _context.n = 7;
4337
4398
  break;
@@ -4341,7 +4402,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
4341
4402
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4342
4403
  destination: destination
4343
4404
  }), {
4344
- location: originAsset.location
4405
+ location: originAsset.location,
4406
+ amount: amount
4345
4407
  });
4346
4408
  case 3:
4347
4409
  return _context.a(2, _context.v);
@@ -4356,7 +4418,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
4356
4418
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4357
4419
  destination: destination
4358
4420
  }), {
4359
- symbol: originAsset.symbol
4421
+ symbol: originAsset.symbol,
4422
+ amount: amount
4360
4423
  });
4361
4424
  case 5:
4362
4425
  return _context.a(2, _context.v);
@@ -4367,7 +4430,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
4367
4430
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4368
4431
  destination: destination
4369
4432
  }), {
4370
- symbol: originAsset.symbol
4433
+ symbol: originAsset.symbol,
4434
+ amount: amount
4371
4435
  });
4372
4436
  case 8:
4373
4437
  return _context.a(2, _context.v);
@@ -5068,7 +5132,10 @@ function _traverseXcmHops() {
5068
5132
  _context2.n = 4;
5069
5133
  return hopApi.init(nextChain, DRY_RUN_CLIENT_TIMEOUT_MS);
5070
5134
  case 4:
5071
- isDestination = nextChain === destination;
5135
+ // true if this hop should be treated as the destination
5136
+ // - normally when nextChain === destination
5137
+ // - but if swap is required, only after (or on) the exchange hop const isDestination =
5138
+ isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
5072
5139
  isAssetHub = nextChain === assetHubChain;
5073
5140
  isBridgeHub = nextChain === bridgeHubChain;
5074
5141
  _context2.n = 5;
@@ -5431,16 +5498,17 @@ var createExchangeInstructions = /*#__PURE__*/function () {
5431
5498
  }();
5432
5499
  var createSwapExecuteXcm = /*#__PURE__*/function () {
5433
5500
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
5434
- var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, _options$fees2, originReserveFee, exchangeFee, destReserveFee, recipientAddress, version, paraIdTo, assetFrom, amountOut, assetTo, assetToLocalizedToDest, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, finalXcm, fullXcm;
5501
+ var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, _options$fees2, originReserveFee, exchangeFee, destReserveFee, recipientAddress, version, paraIdTo, assetFrom, MIN_FEE, amountOut, assetTo, assetToLocalizedToDest, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, finalXcm, fullXcm;
5435
5502
  return _regenerator().w(function (_context2) {
5436
5503
  while (1) switch (_context2.n) {
5437
5504
  case 0:
5438
5505
  api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, _options$fees2 = options.fees, originReserveFee = _options$fees2.originReserveFee, exchangeFee = _options$fees2.exchangeFee, destReserveFee = _options$fees2.destReserveFee, recipientAddress = options.recipientAddress, version = options.version, paraIdTo = options.paraIdTo;
5439
5506
  assertHasLocation(assetInfoFrom);
5440
5507
  assertHasLocation(assetInfoTo);
5441
- assetFrom = createAsset(version, BigInt(assetInfoFrom.amount), localizeLocation(exchangeChain, assetInfoFrom.location)); // Exchange fee 0n means we are creating a dummy tx
5508
+ assetFrom = createAsset(version, assetInfoFrom.amount, localizeLocation(exchangeChain, assetInfoFrom.location));
5509
+ MIN_FEE = 1000n; // Exchange fee 0n means we are creating a dummy tx
5442
5510
  // Set want to 1000n to prevent NoDeal
5443
- amountOut = chain && exchangeFee === 0n ? 1000n : BigInt(assetInfoTo.amount);
5511
+ amountOut = chain && exchangeFee === 0n ? MIN_FEE : assetInfoTo.amount;
5444
5512
  assetTo = createAsset(version, amountOut, localizeLocation(exchangeChain, assetInfoTo.location));
5445
5513
  assetToLocalizedToDest = createAsset(version, amountOut, localizeLocation(destChain !== null && destChain !== void 0 ? destChain : exchangeChain, assetInfoTo.location));
5446
5514
  _prepareCommonExecute = prepareCommonExecuteXcm({
@@ -5460,6 +5528,12 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
5460
5528
  return createExchangeInstructions(options, assetFrom, assetTo);
5461
5529
  case 1:
5462
5530
  exchangeInstructions = _context2.v;
5531
+ if (!(assetInfoTo.amount < MIN_FEE)) {
5532
+ _context2.n = 2;
5533
+ break;
5534
+ }
5535
+ throw new AmountTooLowError('Amount to receive after swap is too low, Increase Currency From amount.');
5536
+ case 2:
5463
5537
  exchangeToDestXcm = destChain ? createBaseExecuteXcm({
5464
5538
  chain: exchangeChain,
5465
5539
  destChain: destChain,
@@ -5499,9 +5573,12 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
5499
5573
  var FEE_PADDING_PERCENTAGE$1 = 20;
5500
5574
  var validateAmount = function validateAmount(amount, requiredFee) {
5501
5575
  if (amount <= requiredFee) {
5502
- throw new InvalidParameterError("Asset amount is too low, please increase the amount or use a different fee asset.");
5576
+ throw new AmountTooLowError("Asset amount is too low, please increase the amount or use a different fee asset.");
5503
5577
  }
5504
5578
  };
5579
+ var calculateTotalFees = function calculateTotalFees(chain, fees) {
5580
+ return chain ? fees.originReserveFee + fees.exchangeFee : 0n;
5581
+ };
5505
5582
  var executeDryRun = /*#__PURE__*/function () {
5506
5583
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
5507
5584
  var result;
@@ -5526,13 +5603,13 @@ var executeDryRun = /*#__PURE__*/function () {
5526
5603
  return _ref.apply(this, arguments);
5527
5604
  };
5528
5605
  }();
5529
- var findExchangeHopIndex = function findExchangeHopIndex(chain, hops, exchangeChain, destChain) {
5606
+ var findExchangeHopIndex = function findExchangeHopIndex(chain, dryRunResult, exchangeChain, destChain) {
5530
5607
  // If destChain is undefined, exchange chain is the final destination
5531
5608
  if (!destChain) {
5532
5609
  // Exchange is the final destination, so it's not in hops array
5533
5610
  return -1;
5534
5611
  }
5535
- var index = hops.findIndex(function (hop) {
5612
+ var index = dryRunResult.hops.findIndex(function (hop) {
5536
5613
  return hop.chain === exchangeChain;
5537
5614
  });
5538
5615
  // If chain is defined but no exchange hop found, it might be because
@@ -5652,7 +5729,7 @@ var createXcmAndCall = /*#__PURE__*/function () {
5652
5729
  }();
5653
5730
  var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5654
5731
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
5655
- var api, chain, exchangeChain, destChain, assetFrom, assetTo, currencyTo, senderAddress, recipientAddress, calculateMinAmountOut, version, internalOptions, dryRunParams, _yield$createXcmAndCa, initialCall, firstDryRunResult, exchangeHopIndex, extractedFees, totalFeesInFromAsset, updatedAssetTo, amountAvailableForSwap, recalculatedMinAmountOut, _yield$createXcmAndCa2, finalCall;
5732
+ var api, chain, exchangeChain, destChain, assetFrom, assetTo, currencyTo, senderAddress, recipientAddress, calculateMinAmountOut, version, internalOptions, dryRunParams, fees, totalFeesPre, _yield$createXcmAndCa, initialCall, firstDryRunResult, exchangeHopIndex, extractedFees, totalFees, updatedAssetTo, amountAvailableForSwap, recalculatedMinAmountOut, _yield$createXcmAndCa2, finalCall;
5656
5733
  return _regenerator().w(function (_context3) {
5657
5734
  while (1) switch (_context3.n) {
5658
5735
  case 0:
@@ -5660,7 +5737,7 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5660
5737
  _context3.n = 1;
5661
5738
  return api.init(chain !== null && chain !== void 0 ? chain : exchangeChain);
5662
5739
  case 1:
5663
- validateAmount(BigInt(assetFrom.amount), MIN_FEE);
5740
+ validateAmount(assetFrom.amount, MIN_FEE);
5664
5741
  version = getChainVersion(chain !== null && chain !== void 0 ? chain : exchangeChain);
5665
5742
  internalOptions = _objectSpread2(_objectSpread2({}, options), {}, {
5666
5743
  version: version,
@@ -5678,17 +5755,22 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5678
5755
  },
5679
5756
  swapConfig: {
5680
5757
  currencyTo: currencyTo,
5681
- exchangeChain: exchangeChain
5758
+ exchangeChain: exchangeChain,
5759
+ amountOut: assetTo.amount
5682
5760
  },
5683
5761
  useRootOrigin: true
5684
- }; // First dry run with dummy fees to extract actual fees
5762
+ };
5763
+ fees = {
5764
+ originReserveFee: MIN_FEE,
5765
+ exchangeFee: 0n,
5766
+ destReserveFee: MIN_FEE
5767
+ };
5768
+ totalFeesPre = calculateTotalFees(chain, fees);
5769
+ validateAmount(assetFrom.amount, totalFeesPre);
5770
+ // First dry run with dummy fees to extract actual fees
5685
5771
  _context3.n = 2;
5686
5772
  return createXcmAndCall(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
5687
- fees: {
5688
- originReserveFee: MIN_FEE,
5689
- exchangeFee: 0n,
5690
- destReserveFee: MIN_FEE
5691
- }
5773
+ fees: fees
5692
5774
  }));
5693
5775
  case 2:
5694
5776
  _yield$createXcmAndCa = _context3.v;
@@ -5699,35 +5781,40 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5699
5781
  }));
5700
5782
  case 3:
5701
5783
  firstDryRunResult = _context3.v;
5702
- exchangeHopIndex = findExchangeHopIndex(chain, firstDryRunResult.hops, exchangeChain, destChain);
5784
+ if (!(firstDryRunResult.failureReason === 'NotHoldingFees')) {
5785
+ _context3.n = 4;
5786
+ break;
5787
+ }
5788
+ throw new AmountTooLowError("Asset amount is too low to cover the fees, please increase the amount.");
5789
+ case 4:
5790
+ exchangeHopIndex = findExchangeHopIndex(chain, firstDryRunResult, exchangeChain, destChain);
5703
5791
  extractedFees = extractFeesFromDryRun(chain, firstDryRunResult, exchangeHopIndex, destChain, false);
5704
5792
  if (extractedFees.exchangeFee === 0n) {
5705
5793
  // We set the exchange fee to non-zero value to prevent creating dummy tx
5706
5794
  extractedFees.exchangeFee = MIN_FEE;
5707
5795
  }
5708
- // Calculate actual amount available for swap
5709
- totalFeesInFromAsset = chain ? extractedFees.originReserveFee + extractedFees.exchangeFee : 0n;
5710
- validateAmount(BigInt(assetFrom.amount), totalFeesInFromAsset);
5796
+ totalFees = calculateTotalFees(chain, extractedFees);
5797
+ validateAmount(assetFrom.amount, totalFees);
5711
5798
  updatedAssetTo = assetTo;
5712
5799
  if (!chain) {
5713
- _context3.n = 5;
5800
+ _context3.n = 6;
5714
5801
  break;
5715
5802
  }
5716
- amountAvailableForSwap = BigInt(assetFrom.amount) - totalFeesInFromAsset;
5717
- _context3.n = 4;
5803
+ amountAvailableForSwap = assetFrom.amount - totalFees;
5804
+ _context3.n = 5;
5718
5805
  return calculateMinAmountOut(amountAvailableForSwap);
5719
- case 4:
5806
+ case 5:
5720
5807
  recalculatedMinAmountOut = _context3.v;
5721
5808
  updatedAssetTo = _objectSpread2(_objectSpread2({}, assetTo), {}, {
5722
5809
  amount: recalculatedMinAmountOut
5723
5810
  });
5724
- case 5:
5725
- _context3.n = 6;
5811
+ case 6:
5812
+ _context3.n = 7;
5726
5813
  return createXcmAndCall(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
5727
5814
  assetInfoTo: updatedAssetTo,
5728
5815
  fees: extractedFees
5729
5816
  }), firstDryRunResult.origin.success ? firstDryRunResult.origin.weight : undefined);
5730
- case 6:
5817
+ case 7:
5731
5818
  _yield$createXcmAndCa2 = _context3.v;
5732
5819
  finalCall = _yield$createXcmAndCa2.call;
5733
5820
  return _context3.a(2, api.callTxMethod(finalCall));
@@ -5783,7 +5870,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5783
5870
  // Enter dummy fee values just to get the dry run to pass
5784
5871
  asset.amount, asset.amount / 2n);
5785
5872
  _context.n = 5;
5786
- return getXcmFee({
5873
+ return getXcmFeeInternal({
5787
5874
  api: api,
5788
5875
  tx: dummyTx,
5789
5876
  origin: origin,
@@ -5791,7 +5878,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5791
5878
  senderAddress: senderAddress,
5792
5879
  address: address,
5793
5880
  currency: currency,
5794
- disableFallback: false
5881
+ disableFallback: false,
5882
+ useRootOrigin: true
5795
5883
  });
5796
5884
  case 5:
5797
5885
  feeResult = _context.v;
@@ -6023,7 +6111,7 @@ var Parachain = /*#__PURE__*/function () {
6023
6111
  api = sendOptions.api, asset = sendOptions.assetInfo, currency = sendOptions.currency, feeAsset = sendOptions.feeAsset, feeCurrency = sendOptions.feeCurrency, address = sendOptions.address, destination = sendOptions.to, paraIdTo = sendOptions.paraIdTo, overriddenAsset = sendOptions.overriddenAsset, version = sendOptions.version, senderAddress = sendOptions.senderAddress, ahAddress = sendOptions.ahAddress, pallet = sendOptions.pallet, method = sendOptions.method;
6024
6112
  scenario = resolveScenario(this.chain, destination);
6025
6113
  paraId = resolveParaId(paraIdTo, destination);
6026
- destChain = resolveDestChain(this.chain, paraId);
6114
+ destChain = resolveDestChain(this.chain, paraId); // TODO: Use canReceiveFrom for this condition
6027
6115
  if (!(destination === 'Polimec' && this.chain !== 'AssetHubPolkadot' && this.chain !== 'Hydration' && this.chain !== destination)) {
6028
6116
  _context.n = 1;
6029
6117
  break;
@@ -6038,6 +6126,7 @@ var Parachain = /*#__PURE__*/function () {
6038
6126
  return _context.a(2, this.transferLocal(sendOptions));
6039
6127
  case 2:
6040
6128
  this.throwIfTempDisabled(sendOptions, destChain);
6129
+ this.throwIfCantReceive(destChain);
6041
6130
  isRelayAsset = deepEqual(asset.location, RELAY_LOCATION);
6042
6131
  _context.n = 3;
6043
6132
  return api.hasMethod('PolkadotXcm', 'transfer_assets_using_type_and_then');
@@ -6096,7 +6185,7 @@ var Parachain = /*#__PURE__*/function () {
6096
6185
  }));
6097
6186
  case 7:
6098
6187
  if (!(supportsPolkadotXCM(this) || useTypeAndThen)) {
6099
- _context.n = 12;
6188
+ _context.n = 13;
6100
6189
  break;
6101
6190
  }
6102
6191
  options = {
@@ -6149,23 +6238,30 @@ var Parachain = /*#__PURE__*/function () {
6149
6238
  isExternalAssetViaAh = isExternalAsset && !isAHPOrigin && !isAHPDest && !isEthDest && !feeAsset; // External asset - Any origin to AHP - DestinationReserve - one DepositAsset instruction
6150
6239
  isExternalAssetToAh = isExternalAsset && isAHPDest && !isAHPOrigin && !isEthDest && !feeAsset;
6151
6240
  if (!(isExternalAssetViaAh || isExternalAssetToAh || useTypeAndThen)) {
6152
- _context.n = 11;
6241
+ _context.n = 12;
6242
+ break;
6243
+ }
6244
+ if (!(useTypeAndThen && supportsPolkadotXCM(this))) {
6245
+ _context.n = 10;
6153
6246
  break;
6154
6247
  }
6155
6248
  _context.n = 10;
6156
- return createTypeAndThenCall(this.chain, options);
6249
+ return this.transferPolkadotXCM(options);
6157
6250
  case 10:
6251
+ _context.n = 11;
6252
+ return createTypeAndThenCall(this.chain, options);
6253
+ case 11:
6158
6254
  call = _context.v;
6159
6255
  return _context.a(2, api.callTxMethod(call));
6160
- case 11:
6256
+ case 12:
6161
6257
  if (!supportsPolkadotXCM(this)) {
6162
- _context.n = 12;
6258
+ _context.n = 13;
6163
6259
  break;
6164
6260
  }
6165
6261
  return _context.a(2, this.transferPolkadotXCM(options));
6166
- case 12:
6167
- throw new NoXCMSupportImplementedError(this._chain);
6168
6262
  case 13:
6263
+ throw new NoXCMSupportImplementedError(this._chain);
6264
+ case 14:
6169
6265
  return _context.a(2);
6170
6266
  }
6171
6267
  }, _callee, this);
@@ -6175,6 +6271,16 @@ var Parachain = /*#__PURE__*/function () {
6175
6271
  }
6176
6272
  return transfer;
6177
6273
  }()
6274
+ }, {
6275
+ key: "throwIfCantReceive",
6276
+ value: function throwIfCantReceive(destChain) {
6277
+ if (destChain && !isRelayChain(destChain) && !isExternalChain(destChain)) {
6278
+ var dest = getChain(destChain);
6279
+ if (!dest.canReceiveFrom(this.chain)) {
6280
+ throw new IncompatibleChainsError("Receiving on ".concat(destChain, " from ").concat(this.chain, " is not yet enabled"));
6281
+ }
6282
+ }
6283
+ }
6178
6284
  }, {
6179
6285
  key: "throwIfTempDisabled",
6180
6286
  value: function throwIfTempDisabled(options, destChain) {
@@ -6197,6 +6303,12 @@ var Parachain = /*#__PURE__*/function () {
6197
6303
  value: function isReceivingTempDisabled(_options) {
6198
6304
  return false;
6199
6305
  }
6306
+ }, {
6307
+ key: "canReceiveFrom",
6308
+ value: function canReceiveFrom(_origin) {
6309
+ // Default: destination accepts from any origin
6310
+ return true;
6311
+ }
6200
6312
  }, {
6201
6313
  key: "shouldUseNativeAssetTeleport",
6202
6314
  value: function shouldUseNativeAssetTeleport(_ref) {
@@ -6547,50 +6659,11 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
6547
6659
  }
6548
6660
  return transferXTokens(input, this.getNativeAssetSymbol());
6549
6661
  }
6550
- }, {
6551
- key: "transferPolkadotXCM",
6552
- value: function () {
6553
- var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
6554
- var api, _t;
6555
- return _regenerator().w(function (_context) {
6556
- while (1) switch (_context.n) {
6557
- case 0:
6558
- api = input.api;
6559
- _t = api;
6560
- _context.n = 1;
6561
- return createTypeAndThenCall(this.chain, input);
6562
- case 1:
6563
- return _context.a(2, _t.callTxMethod.call(_t, _context.v));
6564
- }
6565
- }, _callee, this);
6566
- }));
6567
- function transferPolkadotXCM(_x) {
6568
- return _transferPolkadotXCM.apply(this, arguments);
6569
- }
6570
- return transferPolkadotXCM;
6571
- }()
6572
- }, {
6573
- key: "canUseXTokens",
6574
- value: function canUseXTokens(_ref) {
6575
- var assetInfo = _ref.assetInfo,
6576
- destination = _ref.to;
6577
- return !(assetInfo.symbol === 'DOT' && destination === 'AssetHubPolkadot');
6578
- }
6579
6662
  }, {
6580
6663
  key: "transferRelayToPara",
6581
6664
  value: function transferRelayToPara() {
6582
6665
  throw new ChainNotSupportedError();
6583
6666
  }
6584
- }, {
6585
- key: "isSendingTempDisabled",
6586
- value: function isSendingTempDisabled(_options) {
6587
- return true;
6588
- }
6589
- }, {
6590
- key: "isReceivingTempDisabled",
6591
- value: function isReceivingTempDisabled(_options) {
6592
- return true;
6593
- }
6594
6667
  }, {
6595
6668
  key: "transferLocalNonNativeAsset",
6596
6669
  value: function transferLocalNonNativeAsset(options) {
@@ -6750,10 +6823,6 @@ var AssetHubKusama = /*#__PURE__*/function (_Parachain) {
6750
6823
  if (destination === 'AssetHubPolkadot') {
6751
6824
  return getChain('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
6752
6825
  }
6753
- var isTrusted = !isTLocation(destination) && isTrustedChain(destination);
6754
- if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset) && !isTrusted) {
6755
- throw new ScenarioNotSupportedError(this.chain, scenario, 'Para to Para scenarios for KSM transfer from AssetHub are not supported, you have to transfer KSM to Relay chain and transfer to destination chain from Relay chain.');
6756
- }
6757
6826
  if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset)) {
6758
6827
  throw new ScenarioNotSupportedError(this.chain, scenario, 'Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
6759
6828
  }
@@ -6996,7 +7065,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
6996
7065
  key: "transferPolkadotXCM",
6997
7066
  value: function () {
6998
7067
  var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
6999
- var api, scenario, assetInfo, destination, feeAssetInfo, overriddenAsset, call, isNativeAsset, isNativeFeeAsset, isExternalAsset, _call, CHAINS_SUPPORT_DOT_TRANSFER, isTrusted, isDotReserveAh, method, modifiedInput, _t, _t2;
7068
+ var api, scenario, assetInfo, destination, feeAssetInfo, overriddenAsset, call, isNativeAsset, isNativeFeeAsset, isExternalAsset, _call, method, modifiedInput, _t, _t2;
7000
7069
  return _regenerator().w(function (_context3) {
7001
7070
  while (1) switch (_context3.n) {
7002
7071
  case 0:
@@ -7062,32 +7131,23 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
7062
7131
  _call = _context3.v;
7063
7132
  return _context3.a(2, api.callTxMethod(_call));
7064
7133
  case 10:
7065
- CHAINS_SUPPORT_DOT_TRANSFER = new Set(['Hydration', 'Polimec', 'Moonbeam', 'BifrostPolkadot', 'PeoplePolkadot', 'Ajuna']);
7066
- isTrusted = !isTLocation(destination) && isTrustedChain(destination);
7067
- isDotReserveAh = !isTLocation(destination) && CHAINS_SUPPORT_DOT_TRANSFER.has(destination);
7068
- if (!(scenario === 'ParaToPara' && assetInfo.symbol === this.getNativeAssetSymbol() && !isForeignAsset(assetInfo) && !isDotReserveAh && !isTrusted)) {
7069
- _context3.n = 11;
7070
- break;
7071
- }
7072
- throw new ScenarioNotSupportedError(this.chain, scenario, 'Some Parachains do not have a reserve for DOT on AssetHub. This can also include multihop transfers that have AssetHub as a hop chain and the call contains DOT. Chains that do not have a DOT reserve on AssetHub are not allowed to transfer DOT to it or through it because this transfer will result in asset loss.');
7073
- case 11:
7074
7134
  if (!(scenario === 'ParaToPara' && assetInfo.symbol === 'KSM' && !isForeignAsset(assetInfo))) {
7075
- _context3.n = 12;
7135
+ _context3.n = 11;
7076
7136
  break;
7077
7137
  }
7078
7138
  throw new ScenarioNotSupportedError(this.chain, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
7079
- case 12:
7139
+ case 11:
7080
7140
  method = this.getMethod(scenario, destination); // Patch transfer_assets to use type_and_then transfer
7081
7141
  if (!(method === 'transfer_assets' && isSymbolMatch(assetInfo.symbol, getRelayChainSymbol(this.chain)))) {
7082
- _context3.n = 14;
7142
+ _context3.n = 13;
7083
7143
  break;
7084
7144
  }
7085
7145
  _t2 = api;
7086
- _context3.n = 13;
7146
+ _context3.n = 12;
7087
7147
  return createTypeAndThenCall(this.chain, options);
7088
- case 13:
7148
+ case 12:
7089
7149
  return _context3.a(2, _t2.callTxMethod.call(_t2, _context3.v));
7090
- case 14:
7150
+ case 13:
7091
7151
  modifiedInput = this.patchInput(options);
7092
7152
  return _context3.a(2, transferPolkadotXcm(modifiedInput, method, 'Unlimited'));
7093
7153
  }
@@ -7352,12 +7412,12 @@ var BifrostPolkadot = /*#__PURE__*/function (_Parachain) {
7352
7412
  }()
7353
7413
  }, {
7354
7414
  key: "transferPolkadotXCM",
7355
- value: function transferPolkadotXCM(input) {
7356
- var destination = input.destination;
7415
+ value: function transferPolkadotXCM(options) {
7416
+ var destination = options.destination;
7357
7417
  if (destination === 'Ethereum') {
7358
- return this.transferToEthereum(input);
7418
+ return this.transferToEthereum(options);
7359
7419
  }
7360
- return this.transferToAssetHub(input);
7420
+ return this.transferToAssetHub(options);
7361
7421
  }
7362
7422
  }, {
7363
7423
  key: "canUseXTokens",
@@ -9413,6 +9473,34 @@ var Unique = /*#__PURE__*/function (_Parachain) {
9413
9473
  }(Parachain);
9414
9474
  Unique.NATIVE_ASSET_ID = 0;
9415
9475
 
9476
+ var Xode = /*#__PURE__*/function (_Parachain) {
9477
+ function Xode() {
9478
+ _classCallCheck(this, Xode);
9479
+ return _callSuper(this, Xode, ['Xode', 'xode', 'Polkadot', Version.V4]);
9480
+ }
9481
+ _inherits(Xode, _Parachain);
9482
+ return _createClass(Xode, [{
9483
+ key: "transferPolkadotXCM",
9484
+ value: function transferPolkadotXCM(options) {
9485
+ var destChain = options.destChain,
9486
+ assetInfo = options.assetInfo,
9487
+ scenario = options.scenario;
9488
+ if (destChain !== 'AssetHubPolkadot' && scenario === 'ParaToPara') {
9489
+ throw new IncompatibleChainsError('Xode chain only supports transfers to / from AssetHubPolkadot');
9490
+ }
9491
+ assertHasLocation(assetInfo);
9492
+ return transferPolkadotXcm(_objectSpread2(_objectSpread2({}, options), {}, {
9493
+ asset: createAsset(this.version, assetInfo.amount, assetInfo.location)
9494
+ }), 'limited_reserve_transfer_assets', 'Unlimited');
9495
+ }
9496
+ }, {
9497
+ key: "canReceiveFrom",
9498
+ value: function canReceiveFrom(origin) {
9499
+ return origin === 'AssetHubPolkadot';
9500
+ }
9501
+ }]);
9502
+ }(Parachain);
9503
+
9416
9504
  var Zeitgeist = /*#__PURE__*/function (_Parachain) {
9417
9505
  function Zeitgeist() {
9418
9506
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Zeitgeist';
@@ -9472,6 +9560,7 @@ var ZeitgeistPaseo = /*#__PURE__*/function (_Zeitgeist) {
9472
9560
 
9473
9561
  var chains = function chains() {
9474
9562
  return {
9563
+ // Polkadot chains
9475
9564
  AssetHubPolkadot: new AssetHubPolkadot(),
9476
9565
  Acala: new Acala(),
9477
9566
  Ajuna: new Ajuna(),
@@ -9480,21 +9569,37 @@ var chains = function chains() {
9480
9569
  Crust: new Crust(),
9481
9570
  BifrostPolkadot: new BifrostPolkadot(),
9482
9571
  BridgeHubPolkadot: new BridgeHubPolkadot(),
9483
- BridgeHubKusama: new BridgeHubKusama(),
9484
9572
  Centrifuge: new Centrifuge(),
9485
9573
  ComposableFinance: new ComposableFinance(),
9486
9574
  Darwinia: new Darwinia(),
9487
9575
  EnergyWebX: new EnergyWebX(),
9488
9576
  Hydration: new Hydration(),
9489
- IntegriteeKusama: new IntegriteeKusama(),
9490
9577
  IntegriteePolkadot: new IntegriteePolkadot(),
9491
9578
  Interlay: new Interlay(),
9492
9579
  Heima: new Heima(),
9493
9580
  Jamton: new Jamton(),
9494
9581
  Moonbeam: new Moonbeam(),
9582
+ CoretimePolkadot: new CoretimePolkadot(),
9583
+ RobonomicsPolkadot: new RobonomicsPolkadot(),
9584
+ PeoplePolkadot: new PeoplePolkadot(),
9585
+ Manta: new Manta(),
9586
+ Nodle: new Nodle(),
9587
+ NeuroWeb: new NeuroWeb(),
9588
+ Pendulum: new Pendulum(),
9589
+ Collectives: new Collectives(),
9590
+ Phala: new Phala(),
9591
+ Subsocial: new Subsocial(),
9592
+ KiltSpiritnet: new KiltSpiritnet(),
9593
+ Curio: new Curio(),
9594
+ Mythos: new Mythos(),
9595
+ Peaq: new Peaq(),
9596
+ Polimec: new Polimec(),
9597
+ Xode: new Xode(),
9598
+ // Kusama chains
9495
9599
  AssetHubKusama: new AssetHubKusama(),
9600
+ BridgeHubKusama: new BridgeHubKusama(),
9496
9601
  CoretimeKusama: new CoretimeKusama(),
9497
- CoretimePolkadot: new CoretimePolkadot(),
9602
+ IntegriteeKusama: new IntegriteeKusama(),
9498
9603
  Encointer: new Encointer(),
9499
9604
  Altair: new Altair(),
9500
9605
  Amplitude: new Amplitude(),
@@ -9508,23 +9613,9 @@ var chains = function chains() {
9508
9613
  Laos: new Laos(),
9509
9614
  Quartz: new Quartz(),
9510
9615
  RobonomicsKusama: new RobonomicsKusama(),
9511
- RobonomicsPolkadot: new RobonomicsPolkadot(),
9512
- PeoplePolkadot: new PeoplePolkadot(),
9513
9616
  PeopleKusama: new PeopleKusama(),
9514
9617
  Shiden: new Shiden(),
9515
- Manta: new Manta(),
9516
- Nodle: new Nodle(),
9517
- NeuroWeb: new NeuroWeb(),
9518
- Pendulum: new Pendulum(),
9519
9618
  Zeitgeist: new Zeitgeist(),
9520
- Collectives: new Collectives(),
9521
- Phala: new Phala(),
9522
- Subsocial: new Subsocial(),
9523
- KiltSpiritnet: new KiltSpiritnet(),
9524
- Curio: new Curio(),
9525
- Mythos: new Mythos(),
9526
- Peaq: new Peaq(),
9527
- Polimec: new Polimec(),
9528
9619
  // Westend chains
9529
9620
  AssetHubWestend: new AssetHubWestend(),
9530
9621
  BridgeHubWestend: new BridgeHubWestend(),
@@ -10283,18 +10374,21 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
10283
10374
 
10284
10375
  var getOriginXcmFee = /*#__PURE__*/function () {
10285
10376
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10286
- var forced, real;
10377
+ var _options$txs, tx, txBypass, forced, real;
10287
10378
  return _regenerator().w(function (_context) {
10288
10379
  while (1) switch (_context.n) {
10289
10380
  case 0:
10381
+ _options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
10290
10382
  _context.n = 1;
10291
10383
  return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10384
+ tx: txBypass,
10292
10385
  useRootOrigin: true
10293
10386
  }));
10294
10387
  case 1:
10295
10388
  forced = _context.v;
10296
10389
  _context.n = 2;
10297
10390
  return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10391
+ tx: tx,
10298
10392
  useRootOrigin: false
10299
10393
  }));
10300
10394
  case 2:
@@ -10533,12 +10627,12 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
10533
10627
  return {};
10534
10628
  };
10535
10629
  var getXcmFeeInternal = /*#__PURE__*/function () {
10536
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref, useRootOrigin) {
10537
- var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, asset, amount, _yield$getOriginXcmFe, originFee, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason;
10630
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
10631
+ var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFee, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason;
10538
10632
  return _regenerator().w(function (_context2) {
10539
10633
  while (1) switch (_context2.p = _context2.n) {
10540
10634
  case 0:
10541
- api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig;
10635
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig, useRootOrigin = _ref.useRootOrigin;
10542
10636
  asset = findAssetInfoOrThrow(origin, currency, destination);
10543
10637
  amount = abstractDecimals(currency.amount, asset.decimals, api);
10544
10638
  _context2.n = 1;
@@ -10682,7 +10776,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10682
10776
  }
10683
10777
  }, _callee);
10684
10778
  }));
10685
- return function processHop(_x3) {
10779
+ return function processHop(_x2) {
10686
10780
  return _ref3.apply(this, arguments);
10687
10781
  };
10688
10782
  }();
@@ -10855,7 +10949,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10855
10949
  }
10856
10950
  }, _callee2, null, [[2,, 5, 7]]);
10857
10951
  }));
10858
- return function getXcmFeeInternal(_x, _x2) {
10952
+ return function getXcmFeeInternal(_x) {
10859
10953
  return _ref2.apply(this, arguments);
10860
10954
  };
10861
10955
  }();
@@ -10863,16 +10957,23 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10863
10957
  var getXcmFee = /*#__PURE__*/function () {
10864
10958
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10865
10959
  var _real$assetHub, _real$bridgeHub;
10866
- var forced, real, api;
10960
+ var _options$txs, tx, txBypass, forced, real, api;
10867
10961
  return _regenerator().w(function (_context) {
10868
10962
  while (1) switch (_context.n) {
10869
10963
  case 0:
10964
+ _options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
10870
10965
  _context.n = 1;
10871
- return getXcmFeeInternal(options, true);
10966
+ return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10967
+ tx: txBypass,
10968
+ useRootOrigin: true
10969
+ }));
10872
10970
  case 1:
10873
10971
  forced = _context.v;
10874
10972
  _context.n = 2;
10875
- return getXcmFeeInternal(options, false);
10973
+ return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10974
+ tx: tx,
10975
+ useRootOrigin: false
10976
+ }));
10876
10977
  case 2:
10877
10978
  real = _context.v;
10878
10979
  api = options.api;
@@ -10967,9 +11068,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
10967
11068
  case 6:
10968
11069
  originFeeDetails = _context.v;
10969
11070
  currencyInput = originAsset.location ? {
10970
- location: originAsset.location
11071
+ location: originAsset.location,
11072
+ amount: amount
10971
11073
  } : {
10972
- symbol: originAsset.symbol
11074
+ symbol: originAsset.symbol,
11075
+ amount: amount
10973
11076
  };
10974
11077
  if (!(destination === 'Ethereum')) {
10975
11078
  _context.n = 7;
@@ -11349,11 +11452,11 @@ var buildHopInfo = /*#__PURE__*/function () {
11349
11452
 
11350
11453
  var getTransferInfo = /*#__PURE__*/function () {
11351
11454
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
11352
- var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
11455
+ var api, txs, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
11353
11456
  return _regenerator().w(function (_context2) {
11354
11457
  while (1) switch (_context2.p = _context2.n) {
11355
11458
  case 0:
11356
- api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, ahAddress = _ref.ahAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset;
11459
+ api = _ref.api, txs = _ref.txs, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, ahAddress = _ref.ahAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset;
11357
11460
  if (!(isChainEvm(origin) && !ahAddress)) {
11358
11461
  _context2.n = 1;
11359
11462
  break;
@@ -11407,7 +11510,7 @@ var getTransferInfo = /*#__PURE__*/function () {
11407
11510
  _context2.n = 9;
11408
11511
  return getXcmFee({
11409
11512
  api: api,
11410
- tx: tx,
11513
+ txs: txs,
11411
11514
  origin: origin,
11412
11515
  destination: destination,
11413
11516
  senderAddress: senderAddress,
@@ -11575,11 +11678,11 @@ var getTransferInfo = /*#__PURE__*/function () {
11575
11678
 
11576
11679
  var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11577
11680
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
11578
- var api, origin, senderAddress, address, chain, destination, currency, tx, feeAsset, builder, resolvedFeeAsset, asset, destAsset, destCurrency, destApi, destBalance, destEd, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, amount, result, originFee, hopFeeTotal, destinationFee, edComponent, minAmount, modifiedBuilder, dryRunResult, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
11681
+ var api, origin, senderAddress, address, chain, destination, currency, feeAsset, txs, builder, resolvedFeeAsset, asset, destAsset, destCurrency, destApi, destBalance, destEd, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, amount, result, originFee, hopFeeTotal, destinationFee, edComponent, minAmount, modifiedBuilder, dryRunResult, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
11579
11682
  return _regenerator().w(function (_context) {
11580
11683
  while (1) switch (_context.n) {
11581
11684
  case 0:
11582
- api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, tx = _ref.tx, feeAsset = _ref.feeAsset, builder = _ref.builder;
11685
+ api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, feeAsset = _ref.feeAsset, txs = _ref.txs, builder = _ref.builder;
11583
11686
  validateAddress(senderAddress, chain, false);
11584
11687
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
11585
11688
  asset = findAssetInfoOrThrow(chain, currency, null);
@@ -11608,11 +11711,11 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11608
11711
  paysOriginInSendingAsset = !resolvedFeeAsset && isNativeAsset || resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, asset);
11609
11712
  amount = abstractDecimals(currency.amount, asset.decimals, api);
11610
11713
  _context.n = 3;
11611
- return getXcmFeeInternal({
11714
+ return getXcmFee({
11612
11715
  api: api,
11613
11716
  origin: origin,
11614
11717
  destination: destination,
11615
- tx: tx,
11718
+ txs: txs,
11616
11719
  senderAddress: senderAddress,
11617
11720
  address: address,
11618
11721
  currency: _objectSpread2(_objectSpread2({}, currency), {}, {
@@ -11620,9 +11723,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11620
11723
  }),
11621
11724
  feeAsset: feeAsset,
11622
11725
  disableFallback: false
11623
- },
11624
- // Use dryRun bypass
11625
- true);
11726
+ });
11626
11727
  case 3:
11627
11728
  result = _context.v;
11628
11729
  originFee = result.origin && paysOriginInSendingAsset && isAssetEqual(result.origin.asset, asset) ? result.origin.fee : 0n;
@@ -11709,11 +11810,11 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
11709
11810
 
11710
11811
  var getTransferableAmountInternal = /*#__PURE__*/function () {
11711
11812
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
11712
- var api, senderAddress, chain, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
11813
+ var api, senderAddress, chain, destination, currency, txs, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
11713
11814
  return _regenerator().w(function (_context) {
11714
11815
  while (1) switch (_context.n) {
11715
11816
  case 0:
11716
- api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, tx = _ref.tx, feeAsset = _ref.feeAsset;
11817
+ api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, txs = _ref.txs, feeAsset = _ref.feeAsset;
11717
11818
  validateAddress(senderAddress, chain, false);
11718
11819
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
11719
11820
  asset = findAssetInfoOrThrow(chain, currency, null);
@@ -11739,7 +11840,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
11739
11840
  _context.n = 2;
11740
11841
  return getOriginXcmFee({
11741
11842
  api: api,
11742
- tx: tx,
11843
+ txs: txs,
11743
11844
  origin: chain,
11744
11845
  destination: chain,
11745
11846
  senderAddress: senderAddress,
@@ -12124,12 +12225,12 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
12124
12225
  return totalFee;
12125
12226
  };
12126
12227
  var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12127
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
12128
- var api, tx, origin, destination, address, senderAddress, feeAsset, currency, destApi, asset, amount, destCurrency, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
12228
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
12229
+ var api, txs, origin, destination, currency, address, senderAddress, feeAsset, destApi, asset, amount, destCurrency, ed, balance, tx, txBypass, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
12129
12230
  return _regenerator().w(function (_context) {
12130
12231
  while (1) switch (_context.n) {
12131
12232
  case 0:
12132
- api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset, currency = _ref.currency;
12233
+ api = options.api, txs = options.txs, origin = options.origin, destination = options.destination, currency = options.currency, address = options.address, senderAddress = options.senderAddress, feeAsset = options.feeAsset;
12133
12234
  if (!(destination === 'Ethereum')) {
12134
12235
  _context.n = 1;
12135
12236
  break;
@@ -12170,10 +12271,11 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12170
12271
  });
12171
12272
  case 5:
12172
12273
  balance = _context.v;
12274
+ tx = txs.tx, txBypass = txs.txBypass;
12173
12275
  _context.n = 6;
12174
- return getXcmFee({
12276
+ return getXcmFeeInternal({
12175
12277
  api: api,
12176
- tx: tx,
12278
+ tx: txBypass,
12177
12279
  origin: origin,
12178
12280
  destination: destination,
12179
12281
  senderAddress: senderAddress,
@@ -12182,42 +12284,37 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12182
12284
  amount: amount
12183
12285
  }),
12184
12286
  feeAsset: feeAsset,
12185
- disableFallback: false
12287
+ disableFallback: false,
12288
+ useRootOrigin: true
12186
12289
  });
12187
12290
  case 6:
12188
12291
  xcmFeeResult = _context.v;
12189
12292
  dryRunError = xcmFeeResult.origin.dryRunError, assetHubFeeResult = xcmFeeResult.assetHub, bridgeHubFeeResult = xcmFeeResult.bridgeHub, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeCurrency = _xcmFeeResult$destina.currency, destDryRunError = _xcmFeeResult$destina.dryRunError;
12190
- if (!(destFee === undefined)) {
12191
- _context.n = 7;
12192
- break;
12193
- }
12194
- throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency, replaceBigInt), " on chain ").concat(destination, "."));
12195
- case 7:
12196
12293
  if (!dryRunError) {
12197
- _context.n = 8;
12294
+ _context.n = 7;
12198
12295
  break;
12199
12296
  }
12200
12297
  throw new DryRunFailedError(dryRunError, 'origin');
12201
- case 8:
12298
+ case 7:
12202
12299
  hopDryRunError = (assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.dryRunError) || (bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.dryRunError);
12203
12300
  if (!hopDryRunError) {
12204
- _context.n = 9;
12301
+ _context.n = 8;
12205
12302
  break;
12206
12303
  }
12207
12304
  throw new DryRunFailedError(hopDryRunError, assetHubFeeResult !== null && assetHubFeeResult !== void 0 && assetHubFeeResult.dryRunError ? 'assetHub' : 'bridgeHub');
12208
- case 9:
12305
+ case 8:
12209
12306
  if (!destDryRunError) {
12210
- _context.n = 10;
12307
+ _context.n = 9;
12211
12308
  break;
12212
12309
  }
12213
12310
  throw new UnableToComputeError("Unable to compute fee for the destination asset. Destination dry run error: ".concat(destDryRunError));
12214
- case 10:
12311
+ case 9:
12215
12312
  if (!(normalizeSymbol(asset.symbol) !== normalizeSymbol(destFeeCurrency))) {
12216
- _context.n = 11;
12313
+ _context.n = 10;
12217
12314
  break;
12218
12315
  }
12219
12316
  throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
12220
- case 11:
12317
+ case 10:
12221
12318
  totalFee = calculateTotalXcmFee(xcmFeeResult);
12222
12319
  method = api.getMethod(tx);
12223
12320
  if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
@@ -12230,7 +12327,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12230
12327
  }, _callee);
12231
12328
  }));
12232
12329
  return function verifyEdOnDestinationInternal(_x) {
12233
- return _ref2.apply(this, arguments);
12330
+ return _ref.apply(this, arguments);
12234
12331
  };
12235
12332
  }();
12236
12333
 
@@ -12735,31 +12832,6 @@ var GeneralBuilder = /*#__PURE__*/function () {
12735
12832
  }
12736
12833
  return maybePerformXcmFormatCheck;
12737
12834
  }()
12738
- }, {
12739
- key: "computeOverridenAmount",
12740
- value: function computeOverridenAmount() {
12741
- var _this$_options2 = this._options,
12742
- from = _this$_options2.from,
12743
- to = _this$_options2.to,
12744
- currency = _this$_options2.currency;
12745
- var config = this.api.getConfig();
12746
- if (isConfig(config) && config.abstractDecimals) {
12747
- return BYPASS_CURRENCY_AMOUNT;
12748
- } else {
12749
- assertToIsString(to);
12750
- var asset = findAssetInfoOrThrow(from, currency, to);
12751
- return parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
12752
- }
12753
- }
12754
- }, {
12755
- key: "overrideTxAmount",
12756
- value: function overrideTxAmount() {
12757
- var currency = this._options.currency;
12758
- var modifiedBuilder = this.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
12759
- amount: this.computeOverridenAmount()
12760
- }));
12761
- return modifiedBuilder.buildInternal();
12762
- }
12763
12835
  }, {
12764
12836
  key: "dryRun",
12765
12837
  value: function () {
@@ -12805,6 +12877,13 @@ var GeneralBuilder = /*#__PURE__*/function () {
12805
12877
  }
12806
12878
  return dryRunPreview;
12807
12879
  }()
12880
+ }, {
12881
+ key: "createTxs",
12882
+ value: function createTxs$1() {
12883
+ return createTxs(_objectSpread2(_objectSpread2({}, this._options), {}, {
12884
+ api: this.api
12885
+ }), this);
12886
+ }
12808
12887
  /**
12809
12888
  * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
12810
12889
  *
@@ -12815,30 +12894,39 @@ var GeneralBuilder = /*#__PURE__*/function () {
12815
12894
  value: (function () {
12816
12895
  var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
12817
12896
  var _options$disableFallb;
12818
- var _this$_options3, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
12897
+ var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
12819
12898
  return _regenerator().w(function (_context7) {
12820
12899
  while (1) switch (_context7.p = _context7.n) {
12821
12900
  case 0:
12822
- _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress, feeAsset = _this$_options3.feeAsset, currency = _this$_options3.currency;
12901
+ _this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress, feeAsset = _this$_options2.feeAsset, currency = _this$_options2.currency;
12823
12902
  assertToIsString(to);
12824
12903
  assertAddressIsString(address);
12825
- _context7.n = 1;
12826
- return this.overrideTxAmount();
12827
- case 1:
12828
- tx = _context7.v;
12829
12904
  disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
12830
- _context7.p = 2;
12905
+ _context7.p = 1;
12906
+ _t = getXcmFee;
12907
+ _t2 = this.api;
12908
+ _context7.n = 2;
12909
+ return this.createTxs();
12910
+ case 2:
12911
+ _t3 = _context7.v;
12912
+ _t4 = from;
12913
+ _t5 = to;
12914
+ _t6 = senderAddress;
12915
+ _t7 = address;
12916
+ _t8 = currency;
12917
+ _t9 = feeAsset;
12918
+ _t0 = disableFallback;
12831
12919
  _context7.n = 3;
12832
- return getXcmFee({
12833
- api: this.api,
12834
- tx: tx,
12835
- origin: from,
12836
- destination: to,
12837
- senderAddress: senderAddress,
12838
- address: address,
12839
- currency: currency,
12840
- feeAsset: feeAsset,
12841
- disableFallback: disableFallback
12920
+ return _t({
12921
+ api: _t2,
12922
+ txs: _t3,
12923
+ origin: _t4,
12924
+ destination: _t5,
12925
+ senderAddress: _t6,
12926
+ address: _t7,
12927
+ currency: _t8,
12928
+ feeAsset: _t9,
12929
+ disableFallback: _t0
12842
12930
  });
12843
12931
  case 3:
12844
12932
  return _context7.a(2, _context7.v);
@@ -12851,7 +12939,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12851
12939
  case 6:
12852
12940
  return _context7.a(2);
12853
12941
  }
12854
- }, _callee7, this, [[2,, 4, 6]]);
12942
+ }, _callee7, this, [[1,, 4, 6]]);
12855
12943
  }));
12856
12944
  function getXcmFee$1(_x6) {
12857
12945
  return _getXcmFee2.apply(this, arguments);
@@ -12870,37 +12958,55 @@ var GeneralBuilder = /*#__PURE__*/function () {
12870
12958
  var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
12871
12959
  var _ref,
12872
12960
  disableFallback,
12873
- _this$_options4,
12961
+ _this$_options3,
12874
12962
  from,
12875
12963
  to,
12876
12964
  senderAddress,
12877
12965
  currency,
12878
12966
  feeAsset,
12879
- tx,
12880
- _args8 = arguments;
12967
+ api,
12968
+ _args8 = arguments,
12969
+ _t1,
12970
+ _t10,
12971
+ _t11,
12972
+ _t12,
12973
+ _t13,
12974
+ _t14,
12975
+ _t15,
12976
+ _t16,
12977
+ _t17;
12881
12978
  return _regenerator().w(function (_context8) {
12882
12979
  while (1) switch (_context8.p = _context8.n) {
12883
12980
  case 0:
12884
12981
  _ref = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {
12885
12982
  disableFallback: false
12886
12983
  }, disableFallback = _ref.disableFallback;
12887
- _this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency, feeAsset = _this$_options4.feeAsset;
12984
+ _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, senderAddress = _this$_options3.senderAddress, currency = _this$_options3.currency, feeAsset = _this$_options3.feeAsset;
12888
12985
  assertToIsString(to);
12889
- _context8.n = 1;
12890
- return this.overrideTxAmount();
12891
- case 1:
12892
- tx = _context8.v;
12893
- _context8.p = 2;
12986
+ api = this.api;
12987
+ _context8.p = 1;
12988
+ _t1 = getOriginXcmFee;
12989
+ _t10 = api;
12990
+ _context8.n = 2;
12991
+ return this.createTxs();
12992
+ case 2:
12993
+ _t11 = _context8.v;
12994
+ _t12 = from;
12995
+ _t13 = to;
12996
+ _t14 = senderAddress;
12997
+ _t15 = currency;
12998
+ _t16 = feeAsset;
12999
+ _t17 = disableFallback;
12894
13000
  _context8.n = 3;
12895
- return getOriginXcmFee({
12896
- api: this.api,
12897
- tx: tx,
12898
- origin: from,
12899
- destination: to,
12900
- senderAddress: senderAddress,
12901
- currency: currency,
12902
- feeAsset: feeAsset,
12903
- disableFallback: disableFallback
13001
+ return _t1({
13002
+ api: _t10,
13003
+ txs: _t11,
13004
+ origin: _t12,
13005
+ destination: _t13,
13006
+ senderAddress: _t14,
13007
+ currency: _t15,
13008
+ feeAsset: _t16,
13009
+ disableFallback: _t17
12904
13010
  });
12905
13011
  case 3:
12906
13012
  return _context8.a(2, _context8.v);
@@ -12913,7 +13019,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12913
13019
  case 6:
12914
13020
  return _context8.a(2);
12915
13021
  }
12916
- }, _callee8, this, [[2,, 4, 6]]);
13022
+ }, _callee8, this, [[1,, 4, 6]]);
12917
13023
  }));
12918
13024
  function getOriginXcmFee$1() {
12919
13025
  return _getOriginXcmFee2.apply(this, arguments);
@@ -12930,11 +13036,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
12930
13036
  key: "getXcmFeeEstimate",
12931
13037
  value: (function () {
12932
13038
  var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
12933
- var _this$_options5, from, to, address, senderAddress, currency, tx;
13039
+ var _this$_options4, from, to, address, senderAddress, currency, tx;
12934
13040
  return _regenerator().w(function (_context9) {
12935
13041
  while (1) switch (_context9.p = _context9.n) {
12936
13042
  case 0:
12937
- _this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, address = _this$_options5.address, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
13043
+ _this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, address = _this$_options4.address, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency;
12938
13044
  assertToIsString(to);
12939
13045
  assertAddressIsString(address);
12940
13046
  _context9.n = 1;
@@ -12980,11 +13086,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
12980
13086
  key: "getOriginXcmFeeEstimate",
12981
13087
  value: (function () {
12982
13088
  var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
12983
- var _this$_options6, from, to, senderAddress, currency, tx;
13089
+ var _this$_options5, from, to, senderAddress, currency, tx;
12984
13090
  return _regenerator().w(function (_context0) {
12985
13091
  while (1) switch (_context0.p = _context0.n) {
12986
13092
  case 0:
12987
- _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency;
13093
+ _this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
12988
13094
  assertToIsString(to);
12989
13095
  _context0.n = 1;
12990
13096
  return this.buildInternal();
@@ -13028,24 +13134,32 @@ var GeneralBuilder = /*#__PURE__*/function () {
13028
13134
  key: "getTransferableAmount",
13029
13135
  value: (function () {
13030
13136
  var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
13031
- var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
13137
+ var _this$_options6, from, to, senderAddress, currency, feeAsset, api, _t18, _t19, _t20, _t21, _t22, _t23, _t24, _t25;
13032
13138
  return _regenerator().w(function (_context1) {
13033
13139
  while (1) switch (_context1.n) {
13034
13140
  case 0:
13035
- _this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
13141
+ _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
13036
13142
  assertToIsString(to);
13143
+ api = this.api;
13144
+ _t18 = getTransferableAmount;
13145
+ _t19 = api;
13037
13146
  _context1.n = 1;
13038
- return this.overrideTxAmount();
13147
+ return this.createTxs();
13039
13148
  case 1:
13040
- tx = _context1.v;
13041
- return _context1.a(2, getTransferableAmount({
13042
- api: this.api,
13043
- tx: tx,
13044
- origin: from,
13045
- destination: to,
13046
- senderAddress: senderAddress,
13047
- feeAsset: feeAsset,
13048
- currency: currency
13149
+ _t20 = _context1.v;
13150
+ _t21 = from;
13151
+ _t22 = to;
13152
+ _t23 = senderAddress;
13153
+ _t24 = feeAsset;
13154
+ _t25 = currency;
13155
+ return _context1.a(2, _t18({
13156
+ api: _t19,
13157
+ txs: _t20,
13158
+ origin: _t21,
13159
+ destination: _t22,
13160
+ senderAddress: _t23,
13161
+ feeAsset: _t24,
13162
+ currency: _t25
13049
13163
  }));
13050
13164
  }
13051
13165
  }, _callee1, this);
@@ -13065,27 +13179,37 @@ var GeneralBuilder = /*#__PURE__*/function () {
13065
13179
  key: "getMinTransferableAmount",
13066
13180
  value: (function () {
13067
13181
  var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13068
- var _this$_options8, from, to, senderAddress, address, currency, feeAsset, tx;
13182
+ var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33, _t34, _t35;
13069
13183
  return _regenerator().w(function (_context10) {
13070
13184
  while (1) switch (_context10.n) {
13071
13185
  case 0:
13072
- _this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, senderAddress = _this$_options8.senderAddress, address = _this$_options8.address, currency = _this$_options8.currency, feeAsset = _this$_options8.feeAsset;
13186
+ _this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, address = _this$_options7.address, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
13073
13187
  assertToIsString(to);
13074
13188
  assertAddressIsString(address);
13189
+ api = this.api;
13190
+ _t26 = getMinTransferableAmount;
13191
+ _t27 = api;
13075
13192
  _context10.n = 1;
13076
- return this.overrideTxAmount();
13193
+ return this.createTxs();
13077
13194
  case 1:
13078
- tx = _context10.v;
13079
- return _context10.a(2, getMinTransferableAmount({
13080
- api: this.api,
13081
- tx: tx,
13082
- origin: from,
13083
- destination: to,
13084
- senderAddress: senderAddress,
13085
- address: address,
13086
- feeAsset: feeAsset,
13087
- currency: currency,
13088
- builder: this
13195
+ _t28 = _context10.v;
13196
+ _t29 = from;
13197
+ _t30 = to;
13198
+ _t31 = senderAddress;
13199
+ _t32 = address;
13200
+ _t33 = feeAsset;
13201
+ _t34 = currency;
13202
+ _t35 = this;
13203
+ return _context10.a(2, _t26({
13204
+ api: _t27,
13205
+ txs: _t28,
13206
+ origin: _t29,
13207
+ destination: _t30,
13208
+ senderAddress: _t31,
13209
+ address: _t32,
13210
+ feeAsset: _t33,
13211
+ currency: _t34,
13212
+ builder: _t35
13089
13213
  }));
13090
13214
  }
13091
13215
  }, _callee10, this);
@@ -13105,26 +13229,34 @@ var GeneralBuilder = /*#__PURE__*/function () {
13105
13229
  key: "verifyEdOnDestination",
13106
13230
  value: (function () {
13107
13231
  var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
13108
- var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
13232
+ var _this$_options8, from, to, address, currency, senderAddress, feeAsset, _t36, _t37, _t38, _t39, _t40, _t41, _t42, _t43, _t44;
13109
13233
  return _regenerator().w(function (_context11) {
13110
13234
  while (1) switch (_context11.n) {
13111
13235
  case 0:
13112
- _this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
13236
+ _this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, address = _this$_options8.address, currency = _this$_options8.currency, senderAddress = _this$_options8.senderAddress, feeAsset = _this$_options8.feeAsset;
13113
13237
  assertToIsString(to);
13114
13238
  assertAddressIsString(address);
13239
+ _t36 = verifyEdOnDestination;
13240
+ _t37 = this.api;
13115
13241
  _context11.n = 1;
13116
- return this.overrideTxAmount();
13242
+ return this.createTxs();
13117
13243
  case 1:
13118
- tx = _context11.v;
13119
- return _context11.a(2, verifyEdOnDestination({
13120
- api: this.api,
13121
- tx: tx,
13122
- origin: from,
13123
- destination: to,
13124
- address: address,
13125
- senderAddress: senderAddress,
13126
- feeAsset: feeAsset,
13127
- currency: currency
13244
+ _t38 = _context11.v;
13245
+ _t39 = from;
13246
+ _t40 = to;
13247
+ _t41 = address;
13248
+ _t42 = senderAddress;
13249
+ _t43 = feeAsset;
13250
+ _t44 = currency;
13251
+ return _context11.a(2, _t36({
13252
+ api: _t37,
13253
+ txs: _t38,
13254
+ origin: _t39,
13255
+ destination: _t40,
13256
+ address: _t41,
13257
+ senderAddress: _t42,
13258
+ feeAsset: _t43,
13259
+ currency: _t44
13128
13260
  }));
13129
13261
  }
13130
13262
  }, _callee11, this);
@@ -13144,27 +13276,36 @@ var GeneralBuilder = /*#__PURE__*/function () {
13144
13276
  key: "getTransferInfo",
13145
13277
  value: (function () {
13146
13278
  var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
13147
- var _this$_options0, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
13279
+ var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, _t45, _t46, _t47, _t48, _t49, _t50, _t51, _t52, _t53, _t54;
13148
13280
  return _regenerator().w(function (_context12) {
13149
13281
  while (1) switch (_context12.n) {
13150
13282
  case 0:
13151
- _this$_options0 = this._options, from = _this$_options0.from, to = _this$_options0.to, address = _this$_options0.address, currency = _this$_options0.currency, ahAddress = _this$_options0.ahAddress, senderAddress = _this$_options0.senderAddress, feeAsset = _this$_options0.feeAsset;
13283
+ _this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, ahAddress = _this$_options9.ahAddress, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
13152
13284
  assertToIsString(to);
13153
13285
  assertAddressIsString(address);
13286
+ _t45 = getTransferInfo;
13287
+ _t46 = this.api;
13154
13288
  _context12.n = 1;
13155
- return this.overrideTxAmount();
13289
+ return this.createTxs();
13156
13290
  case 1:
13157
- tx = _context12.v;
13158
- return _context12.a(2, getTransferInfo({
13159
- api: this.api,
13160
- tx: tx,
13161
- origin: from,
13162
- destination: to,
13163
- address: address,
13164
- senderAddress: senderAddress,
13165
- ahAddress: ahAddress,
13166
- currency: currency,
13167
- feeAsset: feeAsset
13291
+ _t47 = _context12.v;
13292
+ _t48 = from;
13293
+ _t49 = to;
13294
+ _t50 = address;
13295
+ _t51 = senderAddress;
13296
+ _t52 = ahAddress;
13297
+ _t53 = currency;
13298
+ _t54 = feeAsset;
13299
+ return _context12.a(2, _t45({
13300
+ api: _t46,
13301
+ txs: _t47,
13302
+ origin: _t48,
13303
+ destination: _t49,
13304
+ address: _t50,
13305
+ senderAddress: _t51,
13306
+ ahAddress: _t52,
13307
+ currency: _t53,
13308
+ feeAsset: _t54
13168
13309
  }));
13169
13310
  }
13170
13311
  }, _callee12, this);
@@ -13207,4 +13348,4 @@ var Builder = function Builder(api) {
13207
13348
  return new GeneralBuilder(api, new BatchTransactionManager());
13208
13349
  };
13209
13350
 
13210
- export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
13351
+ export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTxs, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };