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