@paraspell/sdk-core 11.7.2 → 11.8.1

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
@@ -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,48 +832,49 @@ 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) {
835
+ var computeOverridenAmount = function computeOverridenAmount(options, increaseAmount) {
836
836
  var from = options.from,
837
837
  to = options.to,
838
838
  currency = options.currency,
839
839
  api = options.api;
840
+ var amount = options.currency.amount;
840
841
  var config = api.getConfig();
841
842
  if (isConfig(config) && config.abstractDecimals) {
842
- return BYPASS_CURRENCY_AMOUNT;
843
+ return BigInt(increaseAmount) + BigInt(amount);
843
844
  } else {
844
845
  assertToIsString(to);
845
846
  var asset = findAssetInfoOrThrow(from, currency, to);
846
- return parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
847
+ return parseUnits(increaseAmount, asset.decimals) + BigInt(amount);
847
848
  }
848
849
  };
849
- var overrideTxAmount = function overrideTxAmount(options, builder) {
850
+ var overrideTxAmount = function overrideTxAmount(options, builder, amount) {
850
851
  var modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, options.currency), {}, {
851
- amount: computeOverridenAmount(options)
852
+ amount: computeOverridenAmount(options, amount)
852
853
  }));
853
854
  return modifiedBuilder['buildInternal']();
854
855
  };
855
- var createTxs = /*#__PURE__*/function () {
856
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder) {
857
- var tx, txBypass;
856
+ var createTx = /*#__PURE__*/function () {
857
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder, amount) {
858
858
  return _regenerator().w(function (_context) {
859
859
  while (1) switch (_context.n) {
860
860
  case 0:
861
+ if (!(amount === undefined)) {
862
+ _context.n = 2;
863
+ break;
864
+ }
861
865
  _context.n = 1;
862
866
  return builder['buildInternal']();
863
867
  case 1:
864
- tx = _context.v;
865
- _context.n = 2;
866
- return overrideTxAmount(options, builder);
868
+ return _context.a(2, _context.v);
867
869
  case 2:
868
- txBypass = _context.v;
869
- return _context.a(2, {
870
- tx: tx,
871
- txBypass: txBypass
872
- });
870
+ _context.n = 3;
871
+ return overrideTxAmount(options, builder, amount);
872
+ case 3:
873
+ return _context.a(2, _context.v);
873
874
  }
874
875
  }, _callee);
875
876
  }));
876
- return function createTxs(_x, _x2) {
877
+ return function createTx(_x, _x2, _x3) {
877
878
  return _ref.apply(this, arguments);
878
879
  };
879
880
  }();
@@ -1626,6 +1627,21 @@ var Unique$1 = {
1626
1627
  }
1627
1628
  ]
1628
1629
  };
1630
+ var Xode$1 = {
1631
+ name: "Xode",
1632
+ info: "xode",
1633
+ paraId: 3417,
1634
+ providers: [
1635
+ {
1636
+ name: "XodeCommunity",
1637
+ endpoint: "wss://polkadot-rpcnode.xode.net"
1638
+ },
1639
+ {
1640
+ name: "Zeeve",
1641
+ endpoint: "wss://xode-polkadot-rpc-01.zeeve.net/y0yxg038wn1fncc/rpc"
1642
+ }
1643
+ ]
1644
+ };
1629
1645
  var AssetHubKusama$1 = {
1630
1646
  name: "AssetHub",
1631
1647
  info: "KusamaAssetHub",
@@ -2586,6 +2602,7 @@ var configs = {
2586
2602
  RobonomicsPolkadot: RobonomicsPolkadot$1,
2587
2603
  PeoplePolkadot: PeoplePolkadot$1,
2588
2604
  Unique: Unique$1,
2605
+ Xode: Xode$1,
2589
2606
  AssetHubKusama: AssetHubKusama$1,
2590
2607
  BridgeHubKusama: BridgeHubKusama$1,
2591
2608
  IntegriteeKusama: IntegriteeKusama$1,
@@ -3360,7 +3377,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
3360
3377
  dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
3361
3378
  xcm: [{
3362
3379
  BuyExecution: {
3363
- fees: updateAsset(assetLocalizedToDest, amount - (feeAsset ? reserveFee : originFee + reserveFee)),
3380
+ fees: updateAsset(assetLocalizedToDest, reserveFee === 1000n ? amount / 2n : amount - (feeAsset ? reserveFee : originFee + reserveFee)),
3364
3381
  weight_limit: 'Unlimited'
3365
3382
  }
3366
3383
  }].concat(_toConsumableArray(suffixXcm))
@@ -3696,17 +3713,15 @@ var determineAddress = function determineAddress(chain, address, senderAddress)
3696
3713
  };
3697
3714
  var getReverseTxFee = /*#__PURE__*/function () {
3698
3715
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, currencyInput) {
3699
- var api, origin, destination, senderAddress, address, currency, toAddress, fromAddress, tx, rawFee;
3716
+ var api, origin, destination, senderAddress, address, toAddress, fromAddress, tx, rawFee;
3700
3717
  return _regenerator().w(function (_context) {
3701
3718
  while (1) switch (_context.n) {
3702
3719
  case 0:
3703
- api = _ref.api, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency;
3720
+ api = _ref.api, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address;
3704
3721
  toAddress = determineAddress(origin, address, senderAddress);
3705
3722
  fromAddress = determineAddress(destination, address, senderAddress);
3706
3723
  _context.n = 1;
3707
- return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
3708
- amount: currency.amount
3709
- }))['buildInternal']();
3724
+ return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(currencyInput)['buildInternal']();
3710
3725
  case 1:
3711
3726
  tx = _context.v;
3712
3727
  _context.n = 2;
@@ -4367,7 +4382,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
4367
4382
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
4368
4383
  calcPaymentInfoFee = /*#__PURE__*/function () {
4369
4384
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
4370
- var originAsset, _t;
4385
+ var originAsset, amount, _t;
4371
4386
  return _regenerator().w(function (_context) {
4372
4387
  while (1) switch (_context.p = _context.n) {
4373
4388
  case 0:
@@ -4378,6 +4393,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
4378
4393
  return _context.a(2, 0n);
4379
4394
  case 1:
4380
4395
  originAsset = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, destination) : findAssetInfoOrThrow(origin, currency, destination);
4396
+ amount = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? swapConfig.amountOut : currency.amount;
4381
4397
  if (!originAsset.location) {
4382
4398
  _context.n = 7;
4383
4399
  break;
@@ -4387,7 +4403,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
4387
4403
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4388
4404
  destination: destination
4389
4405
  }), {
4390
- location: originAsset.location
4406
+ location: originAsset.location,
4407
+ amount: amount
4391
4408
  });
4392
4409
  case 3:
4393
4410
  return _context.a(2, _context.v);
@@ -4402,7 +4419,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
4402
4419
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4403
4420
  destination: destination
4404
4421
  }), {
4405
- symbol: originAsset.symbol
4422
+ symbol: originAsset.symbol,
4423
+ amount: amount
4406
4424
  });
4407
4425
  case 5:
4408
4426
  return _context.a(2, _context.v);
@@ -4413,7 +4431,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
4413
4431
  return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
4414
4432
  destination: destination
4415
4433
  }), {
4416
- symbol: originAsset.symbol
4434
+ symbol: originAsset.symbol,
4435
+ amount: amount
4417
4436
  });
4418
4437
  case 8:
4419
4438
  return _context.a(2, _context.v);
@@ -5114,7 +5133,10 @@ function _traverseXcmHops() {
5114
5133
  _context2.n = 4;
5115
5134
  return hopApi.init(nextChain, DRY_RUN_CLIENT_TIMEOUT_MS);
5116
5135
  case 4:
5117
- isDestination = nextChain === destination;
5136
+ // true if this hop should be treated as the destination
5137
+ // - normally when nextChain === destination
5138
+ // - but if swap is required, only after (or on) the exchange hop const isDestination =
5139
+ isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
5118
5140
  isAssetHub = nextChain === assetHubChain;
5119
5141
  isBridgeHub = nextChain === bridgeHubChain;
5120
5142
  _context2.n = 5;
@@ -5426,7 +5448,7 @@ var isMultiHopSwap = function isMultiHopSwap(exchangeChain, assetFrom, assetTo)
5426
5448
 
5427
5449
  var createExchangeInstructions = /*#__PURE__*/function () {
5428
5450
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, assetFrom, assetTo) {
5429
- var chain, exchangeChain, assetInfoFrom, assetInfoTo, version, calculateMinAmountOut, _options$fees, originReserveFee, exchangeFee, nativeSymbol, needsMultiHop, nativeAsset, shouldUseMaximal, nativeAmountOut, assetNative;
5451
+ var chain, exchangeChain, assetInfoFrom, assetInfoTo, version, calculateMinAmountOut, _options$fees, originReserveFee, exchangeFee, nativeSymbol, needsMultiHop, nativeAsset, nativeAmountOut, assetNative;
5430
5452
  return _regenerator().w(function (_context) {
5431
5453
  while (1) switch (_context.n) {
5432
5454
  case 0:
@@ -5437,7 +5459,6 @@ var createExchangeInstructions = /*#__PURE__*/function () {
5437
5459
  symbol: Native(nativeSymbol)
5438
5460
  }, null);
5439
5461
  assertHasLocation(nativeAsset);
5440
- shouldUseMaximal = !chain || exchangeChain === 'Hydration' && exchangeFee === 0n;
5441
5462
  if (needsMultiHop) {
5442
5463
  _context.n = 1;
5443
5464
  break;
@@ -5446,7 +5467,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
5446
5467
  ExchangeAsset: {
5447
5468
  give: createAssetsFilter(assetFrom),
5448
5469
  want: [assetTo],
5449
- maximal: shouldUseMaximal
5470
+ maximal: false
5450
5471
  }
5451
5472
  }]);
5452
5473
  case 1:
@@ -5459,7 +5480,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
5459
5480
  ExchangeAsset: {
5460
5481
  give: createAssetsFilter(assetFrom),
5461
5482
  want: [assetNative],
5462
- maximal: shouldUseMaximal
5483
+ maximal: false
5463
5484
  }
5464
5485
  }, {
5465
5486
  ExchangeAsset: {
@@ -5477,16 +5498,15 @@ var createExchangeInstructions = /*#__PURE__*/function () {
5477
5498
  }();
5478
5499
  var createSwapExecuteXcm = /*#__PURE__*/function () {
5479
5500
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
5480
- 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, destReserveFee, recipientAddress, version, paraIdTo, assetFrom, amountOut, assetTo, assetToLocalizedToDest, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, finalXcm, fullXcm;
5481
5502
  return _regenerator().w(function (_context2) {
5482
5503
  while (1) switch (_context2.n) {
5483
5504
  case 0:
5484
- 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;
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, destReserveFee = _options$fees2.destReserveFee, recipientAddress = options.recipientAddress, version = options.version, paraIdTo = options.paraIdTo;
5485
5506
  assertHasLocation(assetInfoFrom);
5486
5507
  assertHasLocation(assetInfoTo);
5487
- assetFrom = createAsset(version, BigInt(assetInfoFrom.amount), localizeLocation(exchangeChain, assetInfoFrom.location)); // Exchange fee 0n means we are creating a dummy tx
5488
- // Set want to 1000n to prevent NoDeal
5489
- amountOut = chain && exchangeFee === 0n ? 1000n : BigInt(assetInfoTo.amount);
5508
+ assetFrom = createAsset(version, assetInfoFrom.amount, localizeLocation(exchangeChain, assetInfoFrom.location));
5509
+ amountOut = assetInfoTo.amount;
5490
5510
  assetTo = createAsset(version, amountOut, localizeLocation(exchangeChain, assetInfoTo.location));
5491
5511
  assetToLocalizedToDest = createAsset(version, amountOut, localizeLocation(destChain !== null && destChain !== void 0 ? destChain : exchangeChain, assetInfoTo.location));
5492
5512
  _prepareCommonExecute = prepareCommonExecuteXcm({
@@ -5545,9 +5565,12 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
5545
5565
  var FEE_PADDING_PERCENTAGE$1 = 20;
5546
5566
  var validateAmount = function validateAmount(amount, requiredFee) {
5547
5567
  if (amount <= requiredFee) {
5548
- throw new InvalidParameterError("Asset amount is too low, please increase the amount or use a different fee asset.");
5568
+ throw new AmountTooLowError("Asset amount is too low, please increase the amount or use a different fee asset.");
5549
5569
  }
5550
5570
  };
5571
+ var calculateTotalFees = function calculateTotalFees(chain, fees) {
5572
+ return chain ? fees.originReserveFee + fees.exchangeFee : 0n;
5573
+ };
5551
5574
  var executeDryRun = /*#__PURE__*/function () {
5552
5575
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
5553
5576
  var result;
@@ -5572,13 +5595,13 @@ var executeDryRun = /*#__PURE__*/function () {
5572
5595
  return _ref.apply(this, arguments);
5573
5596
  };
5574
5597
  }();
5575
- var findExchangeHopIndex = function findExchangeHopIndex(chain, hops, exchangeChain, destChain) {
5598
+ var findExchangeHopIndex = function findExchangeHopIndex(chain, dryRunResult, exchangeChain, destChain) {
5576
5599
  // If destChain is undefined, exchange chain is the final destination
5577
5600
  if (!destChain) {
5578
5601
  // Exchange is the final destination, so it's not in hops array
5579
5602
  return -1;
5580
5603
  }
5581
- var index = hops.findIndex(function (hop) {
5604
+ var index = dryRunResult.hops.findIndex(function (hop) {
5582
5605
  return hop.chain === exchangeChain;
5583
5606
  });
5584
5607
  // If chain is defined but no exchange hop found, it might be because
@@ -5698,7 +5721,7 @@ var createXcmAndCall = /*#__PURE__*/function () {
5698
5721
  }();
5699
5722
  var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5700
5723
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
5701
- 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;
5724
+ 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;
5702
5725
  return _regenerator().w(function (_context3) {
5703
5726
  while (1) switch (_context3.n) {
5704
5727
  case 0:
@@ -5706,7 +5729,7 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5706
5729
  _context3.n = 1;
5707
5730
  return api.init(chain !== null && chain !== void 0 ? chain : exchangeChain);
5708
5731
  case 1:
5709
- validateAmount(BigInt(assetFrom.amount), MIN_FEE);
5732
+ validateAmount(assetFrom.amount, MIN_FEE);
5710
5733
  version = getChainVersion(chain !== null && chain !== void 0 ? chain : exchangeChain);
5711
5734
  internalOptions = _objectSpread2(_objectSpread2({}, options), {}, {
5712
5735
  version: version,
@@ -5724,17 +5747,22 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5724
5747
  },
5725
5748
  swapConfig: {
5726
5749
  currencyTo: currencyTo,
5727
- exchangeChain: exchangeChain
5750
+ exchangeChain: exchangeChain,
5751
+ amountOut: assetTo.amount
5728
5752
  },
5729
5753
  useRootOrigin: true
5730
- }; // First dry run with dummy fees to extract actual fees
5754
+ };
5755
+ fees = {
5756
+ originReserveFee: MIN_FEE,
5757
+ exchangeFee: 0n,
5758
+ destReserveFee: MIN_FEE
5759
+ };
5760
+ totalFeesPre = calculateTotalFees(chain, fees);
5761
+ validateAmount(assetFrom.amount, totalFeesPre);
5762
+ // First dry run with dummy fees to extract actual fees
5731
5763
  _context3.n = 2;
5732
5764
  return createXcmAndCall(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
5733
- fees: {
5734
- originReserveFee: MIN_FEE,
5735
- exchangeFee: 0n,
5736
- destReserveFee: MIN_FEE
5737
- }
5765
+ fees: fees
5738
5766
  }));
5739
5767
  case 2:
5740
5768
  _yield$createXcmAndCa = _context3.v;
@@ -5745,35 +5773,40 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
5745
5773
  }));
5746
5774
  case 3:
5747
5775
  firstDryRunResult = _context3.v;
5748
- exchangeHopIndex = findExchangeHopIndex(chain, firstDryRunResult.hops, exchangeChain, destChain);
5776
+ if (!(firstDryRunResult.failureReason === 'NotHoldingFees')) {
5777
+ _context3.n = 4;
5778
+ break;
5779
+ }
5780
+ throw new AmountTooLowError("Asset amount is too low to cover the fees, please increase the amount.");
5781
+ case 4:
5782
+ exchangeHopIndex = findExchangeHopIndex(chain, firstDryRunResult, exchangeChain, destChain);
5749
5783
  extractedFees = extractFeesFromDryRun(chain, firstDryRunResult, exchangeHopIndex, destChain, false);
5750
5784
  if (extractedFees.exchangeFee === 0n) {
5751
5785
  // We set the exchange fee to non-zero value to prevent creating dummy tx
5752
5786
  extractedFees.exchangeFee = MIN_FEE;
5753
5787
  }
5754
- // Calculate actual amount available for swap
5755
- totalFeesInFromAsset = chain ? extractedFees.originReserveFee + extractedFees.exchangeFee : 0n;
5756
- validateAmount(BigInt(assetFrom.amount), totalFeesInFromAsset);
5788
+ totalFees = calculateTotalFees(chain, extractedFees);
5789
+ validateAmount(assetFrom.amount, totalFees);
5757
5790
  updatedAssetTo = assetTo;
5758
5791
  if (!chain) {
5759
- _context3.n = 5;
5792
+ _context3.n = 6;
5760
5793
  break;
5761
5794
  }
5762
- amountAvailableForSwap = BigInt(assetFrom.amount) - totalFeesInFromAsset;
5763
- _context3.n = 4;
5795
+ amountAvailableForSwap = assetFrom.amount - totalFees;
5796
+ _context3.n = 5;
5764
5797
  return calculateMinAmountOut(amountAvailableForSwap);
5765
- case 4:
5798
+ case 5:
5766
5799
  recalculatedMinAmountOut = _context3.v;
5767
5800
  updatedAssetTo = _objectSpread2(_objectSpread2({}, assetTo), {}, {
5768
5801
  amount: recalculatedMinAmountOut
5769
5802
  });
5770
- case 5:
5771
- _context3.n = 6;
5803
+ case 6:
5804
+ _context3.n = 7;
5772
5805
  return createXcmAndCall(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
5773
5806
  assetInfoTo: updatedAssetTo,
5774
5807
  fees: extractedFees
5775
5808
  }), firstDryRunResult.origin.success ? firstDryRunResult.origin.weight : undefined);
5776
- case 6:
5809
+ case 7:
5777
5810
  _yield$createXcmAndCa2 = _context3.v;
5778
5811
  finalCall = _yield$createXcmAndCa2.call;
5779
5812
  return _context3.a(2, api.callTxMethod(finalCall));
@@ -6070,7 +6103,7 @@ var Parachain = /*#__PURE__*/function () {
6070
6103
  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;
6071
6104
  scenario = resolveScenario(this.chain, destination);
6072
6105
  paraId = resolveParaId(paraIdTo, destination);
6073
- destChain = resolveDestChain(this.chain, paraId);
6106
+ destChain = resolveDestChain(this.chain, paraId); // TODO: Use canReceiveFrom for this condition
6074
6107
  if (!(destination === 'Polimec' && this.chain !== 'AssetHubPolkadot' && this.chain !== 'Hydration' && this.chain !== destination)) {
6075
6108
  _context.n = 1;
6076
6109
  break;
@@ -6085,6 +6118,7 @@ var Parachain = /*#__PURE__*/function () {
6085
6118
  return _context.a(2, this.transferLocal(sendOptions));
6086
6119
  case 2:
6087
6120
  this.throwIfTempDisabled(sendOptions, destChain);
6121
+ this.throwIfCantReceive(destChain);
6088
6122
  isRelayAsset = deepEqual(asset.location, RELAY_LOCATION);
6089
6123
  _context.n = 3;
6090
6124
  return api.hasMethod('PolkadotXcm', 'transfer_assets_using_type_and_then');
@@ -6143,7 +6177,7 @@ var Parachain = /*#__PURE__*/function () {
6143
6177
  }));
6144
6178
  case 7:
6145
6179
  if (!(supportsPolkadotXCM(this) || useTypeAndThen)) {
6146
- _context.n = 12;
6180
+ _context.n = 13;
6147
6181
  break;
6148
6182
  }
6149
6183
  options = {
@@ -6196,23 +6230,30 @@ var Parachain = /*#__PURE__*/function () {
6196
6230
  isExternalAssetViaAh = isExternalAsset && !isAHPOrigin && !isAHPDest && !isEthDest && !feeAsset; // External asset - Any origin to AHP - DestinationReserve - one DepositAsset instruction
6197
6231
  isExternalAssetToAh = isExternalAsset && isAHPDest && !isAHPOrigin && !isEthDest && !feeAsset;
6198
6232
  if (!(isExternalAssetViaAh || isExternalAssetToAh || useTypeAndThen)) {
6199
- _context.n = 11;
6233
+ _context.n = 12;
6234
+ break;
6235
+ }
6236
+ if (!(useTypeAndThen && supportsPolkadotXCM(this))) {
6237
+ _context.n = 10;
6200
6238
  break;
6201
6239
  }
6202
6240
  _context.n = 10;
6203
- return createTypeAndThenCall(this.chain, options);
6241
+ return this.transferPolkadotXCM(options);
6204
6242
  case 10:
6243
+ _context.n = 11;
6244
+ return createTypeAndThenCall(this.chain, options);
6245
+ case 11:
6205
6246
  call = _context.v;
6206
6247
  return _context.a(2, api.callTxMethod(call));
6207
- case 11:
6248
+ case 12:
6208
6249
  if (!supportsPolkadotXCM(this)) {
6209
- _context.n = 12;
6250
+ _context.n = 13;
6210
6251
  break;
6211
6252
  }
6212
6253
  return _context.a(2, this.transferPolkadotXCM(options));
6213
- case 12:
6214
- throw new NoXCMSupportImplementedError(this._chain);
6215
6254
  case 13:
6255
+ throw new NoXCMSupportImplementedError(this._chain);
6256
+ case 14:
6216
6257
  return _context.a(2);
6217
6258
  }
6218
6259
  }, _callee, this);
@@ -6222,6 +6263,16 @@ var Parachain = /*#__PURE__*/function () {
6222
6263
  }
6223
6264
  return transfer;
6224
6265
  }()
6266
+ }, {
6267
+ key: "throwIfCantReceive",
6268
+ value: function throwIfCantReceive(destChain) {
6269
+ if (destChain && !isRelayChain(destChain) && !isExternalChain(destChain)) {
6270
+ var dest = getChain(destChain);
6271
+ if (!dest.canReceiveFrom(this.chain)) {
6272
+ throw new IncompatibleChainsError("Receiving on ".concat(destChain, " from ").concat(this.chain, " is not yet enabled"));
6273
+ }
6274
+ }
6275
+ }
6225
6276
  }, {
6226
6277
  key: "throwIfTempDisabled",
6227
6278
  value: function throwIfTempDisabled(options, destChain) {
@@ -6244,6 +6295,12 @@ var Parachain = /*#__PURE__*/function () {
6244
6295
  value: function isReceivingTempDisabled(_options) {
6245
6296
  return false;
6246
6297
  }
6298
+ }, {
6299
+ key: "canReceiveFrom",
6300
+ value: function canReceiveFrom(_origin) {
6301
+ // Default: destination accepts from any origin
6302
+ return true;
6303
+ }
6247
6304
  }, {
6248
6305
  key: "shouldUseNativeAssetTeleport",
6249
6306
  value: function shouldUseNativeAssetTeleport(_ref) {
@@ -6594,50 +6651,11 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
6594
6651
  }
6595
6652
  return transferXTokens(input, this.getNativeAssetSymbol());
6596
6653
  }
6597
- }, {
6598
- key: "transferPolkadotXCM",
6599
- value: function () {
6600
- var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
6601
- var api, _t;
6602
- return _regenerator().w(function (_context) {
6603
- while (1) switch (_context.n) {
6604
- case 0:
6605
- api = input.api;
6606
- _t = api;
6607
- _context.n = 1;
6608
- return createTypeAndThenCall(this.chain, input);
6609
- case 1:
6610
- return _context.a(2, _t.callTxMethod.call(_t, _context.v));
6611
- }
6612
- }, _callee, this);
6613
- }));
6614
- function transferPolkadotXCM(_x) {
6615
- return _transferPolkadotXCM.apply(this, arguments);
6616
- }
6617
- return transferPolkadotXCM;
6618
- }()
6619
- }, {
6620
- key: "canUseXTokens",
6621
- value: function canUseXTokens(_ref) {
6622
- var assetInfo = _ref.assetInfo,
6623
- destination = _ref.to;
6624
- return !(assetInfo.symbol === 'DOT' && destination === 'AssetHubPolkadot');
6625
- }
6626
6654
  }, {
6627
6655
  key: "transferRelayToPara",
6628
6656
  value: function transferRelayToPara() {
6629
6657
  throw new ChainNotSupportedError();
6630
6658
  }
6631
- }, {
6632
- key: "isSendingTempDisabled",
6633
- value: function isSendingTempDisabled(_options) {
6634
- return true;
6635
- }
6636
- }, {
6637
- key: "isReceivingTempDisabled",
6638
- value: function isReceivingTempDisabled(_options) {
6639
- return true;
6640
- }
6641
6659
  }, {
6642
6660
  key: "transferLocalNonNativeAsset",
6643
6661
  value: function transferLocalNonNativeAsset(options) {
@@ -6797,10 +6815,6 @@ var AssetHubKusama = /*#__PURE__*/function (_Parachain) {
6797
6815
  if (destination === 'AssetHubPolkadot') {
6798
6816
  return getChain('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
6799
6817
  }
6800
- var isTrusted = !isTLocation(destination) && isTrustedChain(destination);
6801
- if (scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset) && !isTrusted) {
6802
- 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.');
6803
- }
6804
6818
  if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset)) {
6805
6819
  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>}.');
6806
6820
  }
@@ -7043,7 +7057,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
7043
7057
  key: "transferPolkadotXCM",
7044
7058
  value: function () {
7045
7059
  var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
7046
- var api, scenario, assetInfo, destination, feeAssetInfo, overriddenAsset, call, isNativeAsset, isNativeFeeAsset, isExternalAsset, _call, CHAINS_SUPPORT_DOT_TRANSFER, isTrusted, isDotReserveAh, method, modifiedInput, _t, _t2;
7060
+ var api, scenario, assetInfo, destination, feeAssetInfo, overriddenAsset, call, isNativeAsset, isNativeFeeAsset, isExternalAsset, _call, method, modifiedInput, _t, _t2;
7047
7061
  return _regenerator().w(function (_context3) {
7048
7062
  while (1) switch (_context3.n) {
7049
7063
  case 0:
@@ -7109,32 +7123,23 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
7109
7123
  _call = _context3.v;
7110
7124
  return _context3.a(2, api.callTxMethod(_call));
7111
7125
  case 10:
7112
- CHAINS_SUPPORT_DOT_TRANSFER = new Set(['Hydration', 'Polimec', 'Moonbeam', 'BifrostPolkadot', 'PeoplePolkadot', 'Ajuna']);
7113
- isTrusted = !isTLocation(destination) && isTrustedChain(destination);
7114
- isDotReserveAh = !isTLocation(destination) && CHAINS_SUPPORT_DOT_TRANSFER.has(destination);
7115
- if (!(scenario === 'ParaToPara' && assetInfo.symbol === this.getNativeAssetSymbol() && !isForeignAsset(assetInfo) && !isDotReserveAh && !isTrusted)) {
7116
- _context3.n = 11;
7117
- break;
7118
- }
7119
- 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.');
7120
- case 11:
7121
7126
  if (!(scenario === 'ParaToPara' && assetInfo.symbol === 'KSM' && !isForeignAsset(assetInfo))) {
7122
- _context3.n = 12;
7127
+ _context3.n = 11;
7123
7128
  break;
7124
7129
  }
7125
7130
  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>}.');
7126
- case 12:
7131
+ case 11:
7127
7132
  method = this.getMethod(scenario, destination); // Patch transfer_assets to use type_and_then transfer
7128
7133
  if (!(method === 'transfer_assets' && isSymbolMatch(assetInfo.symbol, getRelayChainSymbol(this.chain)))) {
7129
- _context3.n = 14;
7134
+ _context3.n = 13;
7130
7135
  break;
7131
7136
  }
7132
7137
  _t2 = api;
7133
- _context3.n = 13;
7138
+ _context3.n = 12;
7134
7139
  return createTypeAndThenCall(this.chain, options);
7135
- case 13:
7140
+ case 12:
7136
7141
  return _context3.a(2, _t2.callTxMethod.call(_t2, _context3.v));
7137
- case 14:
7142
+ case 13:
7138
7143
  modifiedInput = this.patchInput(options);
7139
7144
  return _context3.a(2, transferPolkadotXcm(modifiedInput, method, 'Unlimited'));
7140
7145
  }
@@ -7399,12 +7404,12 @@ var BifrostPolkadot = /*#__PURE__*/function (_Parachain) {
7399
7404
  }()
7400
7405
  }, {
7401
7406
  key: "transferPolkadotXCM",
7402
- value: function transferPolkadotXCM(input) {
7403
- var destination = input.destination;
7407
+ value: function transferPolkadotXCM(options) {
7408
+ var destination = options.destination;
7404
7409
  if (destination === 'Ethereum') {
7405
- return this.transferToEthereum(input);
7410
+ return this.transferToEthereum(options);
7406
7411
  }
7407
- return this.transferToAssetHub(input);
7412
+ return this.transferToAssetHub(options);
7408
7413
  }
7409
7414
  }, {
7410
7415
  key: "canUseXTokens",
@@ -9460,6 +9465,34 @@ var Unique = /*#__PURE__*/function (_Parachain) {
9460
9465
  }(Parachain);
9461
9466
  Unique.NATIVE_ASSET_ID = 0;
9462
9467
 
9468
+ var Xode = /*#__PURE__*/function (_Parachain) {
9469
+ function Xode() {
9470
+ _classCallCheck(this, Xode);
9471
+ return _callSuper(this, Xode, ['Xode', 'xode', 'Polkadot', Version.V4]);
9472
+ }
9473
+ _inherits(Xode, _Parachain);
9474
+ return _createClass(Xode, [{
9475
+ key: "transferPolkadotXCM",
9476
+ value: function transferPolkadotXCM(options) {
9477
+ var destChain = options.destChain,
9478
+ assetInfo = options.assetInfo,
9479
+ scenario = options.scenario;
9480
+ if (destChain !== 'AssetHubPolkadot' && scenario === 'ParaToPara') {
9481
+ throw new IncompatibleChainsError('Xode chain only supports transfers to / from AssetHubPolkadot');
9482
+ }
9483
+ assertHasLocation(assetInfo);
9484
+ return transferPolkadotXcm(_objectSpread2(_objectSpread2({}, options), {}, {
9485
+ asset: createAsset(this.version, assetInfo.amount, assetInfo.location)
9486
+ }), 'limited_reserve_transfer_assets', 'Unlimited');
9487
+ }
9488
+ }, {
9489
+ key: "canReceiveFrom",
9490
+ value: function canReceiveFrom(origin) {
9491
+ return origin === 'AssetHubPolkadot';
9492
+ }
9493
+ }]);
9494
+ }(Parachain);
9495
+
9463
9496
  var Zeitgeist = /*#__PURE__*/function (_Parachain) {
9464
9497
  function Zeitgeist() {
9465
9498
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Zeitgeist';
@@ -9519,6 +9552,7 @@ var ZeitgeistPaseo = /*#__PURE__*/function (_Zeitgeist) {
9519
9552
 
9520
9553
  var chains = function chains() {
9521
9554
  return {
9555
+ // Polkadot chains
9522
9556
  AssetHubPolkadot: new AssetHubPolkadot(),
9523
9557
  Acala: new Acala(),
9524
9558
  Ajuna: new Ajuna(),
@@ -9527,21 +9561,37 @@ var chains = function chains() {
9527
9561
  Crust: new Crust(),
9528
9562
  BifrostPolkadot: new BifrostPolkadot(),
9529
9563
  BridgeHubPolkadot: new BridgeHubPolkadot(),
9530
- BridgeHubKusama: new BridgeHubKusama(),
9531
9564
  Centrifuge: new Centrifuge(),
9532
9565
  ComposableFinance: new ComposableFinance(),
9533
9566
  Darwinia: new Darwinia(),
9534
9567
  EnergyWebX: new EnergyWebX(),
9535
9568
  Hydration: new Hydration(),
9536
- IntegriteeKusama: new IntegriteeKusama(),
9537
9569
  IntegriteePolkadot: new IntegriteePolkadot(),
9538
9570
  Interlay: new Interlay(),
9539
9571
  Heima: new Heima(),
9540
9572
  Jamton: new Jamton(),
9541
9573
  Moonbeam: new Moonbeam(),
9574
+ CoretimePolkadot: new CoretimePolkadot(),
9575
+ RobonomicsPolkadot: new RobonomicsPolkadot(),
9576
+ PeoplePolkadot: new PeoplePolkadot(),
9577
+ Manta: new Manta(),
9578
+ Nodle: new Nodle(),
9579
+ NeuroWeb: new NeuroWeb(),
9580
+ Pendulum: new Pendulum(),
9581
+ Collectives: new Collectives(),
9582
+ Phala: new Phala(),
9583
+ Subsocial: new Subsocial(),
9584
+ KiltSpiritnet: new KiltSpiritnet(),
9585
+ Curio: new Curio(),
9586
+ Mythos: new Mythos(),
9587
+ Peaq: new Peaq(),
9588
+ Polimec: new Polimec(),
9589
+ Xode: new Xode(),
9590
+ // Kusama chains
9542
9591
  AssetHubKusama: new AssetHubKusama(),
9592
+ BridgeHubKusama: new BridgeHubKusama(),
9543
9593
  CoretimeKusama: new CoretimeKusama(),
9544
- CoretimePolkadot: new CoretimePolkadot(),
9594
+ IntegriteeKusama: new IntegriteeKusama(),
9545
9595
  Encointer: new Encointer(),
9546
9596
  Altair: new Altair(),
9547
9597
  Amplitude: new Amplitude(),
@@ -9555,23 +9605,9 @@ var chains = function chains() {
9555
9605
  Laos: new Laos(),
9556
9606
  Quartz: new Quartz(),
9557
9607
  RobonomicsKusama: new RobonomicsKusama(),
9558
- RobonomicsPolkadot: new RobonomicsPolkadot(),
9559
- PeoplePolkadot: new PeoplePolkadot(),
9560
9608
  PeopleKusama: new PeopleKusama(),
9561
9609
  Shiden: new Shiden(),
9562
- Manta: new Manta(),
9563
- Nodle: new Nodle(),
9564
- NeuroWeb: new NeuroWeb(),
9565
- Pendulum: new Pendulum(),
9566
9610
  Zeitgeist: new Zeitgeist(),
9567
- Collectives: new Collectives(),
9568
- Phala: new Phala(),
9569
- Subsocial: new Subsocial(),
9570
- KiltSpiritnet: new KiltSpiritnet(),
9571
- Curio: new Curio(),
9572
- Mythos: new Mythos(),
9573
- Peaq: new Peaq(),
9574
- Polimec: new Polimec(),
9575
9611
  // Westend chains
9576
9612
  AssetHubWestend: new AssetHubWestend(),
9577
9613
  BridgeHubWestend: new BridgeHubWestend(),
@@ -9631,7 +9667,6 @@ var MAX_WEIGHT = {
9631
9667
  refTime: MAX_U64
9632
9668
  };
9633
9669
  var BYPASS_MINT_AMOUNT = '1000';
9634
- var BYPASS_CURRENCY_AMOUNT = '800';
9635
9670
 
9636
9671
  var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
9637
9672
  var assets = options.assets,
@@ -10230,6 +10265,136 @@ var wrapTxBypass = /*#__PURE__*/function () {
10230
10265
  };
10231
10266
  }();
10232
10267
 
10268
+ var getBypassResultWithRetries = /*#__PURE__*/function () {
10269
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, internalFn, initialTx) {
10270
+ var maxRetries,
10271
+ bumpStep,
10272
+ hasError,
10273
+ first,
10274
+ result,
10275
+ i,
10276
+ amount,
10277
+ bumpedTx,
10278
+ _args = arguments,
10279
+ _t,
10280
+ _t2,
10281
+ _t3;
10282
+ return _regenerator().w(function (_context) {
10283
+ while (1) switch (_context.p = _context.n) {
10284
+ case 0:
10285
+ maxRetries = _args.length > 3 && _args[3] !== undefined ? _args[3] : 5;
10286
+ bumpStep = _args.length > 4 && _args[4] !== undefined ? _args[4] : 100;
10287
+ hasError = function hasError(res) {
10288
+ return 'failureReason' in res ? !!res.failureReason : 'dryRunError' in res ? !!res.dryRunError : false;
10289
+ };
10290
+ if (!initialTx) {
10291
+ _context.n = 5;
10292
+ break;
10293
+ }
10294
+ _context.p = 1;
10295
+ _context.n = 2;
10296
+ return internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
10297
+ tx: initialTx,
10298
+ useRootOrigin: true
10299
+ }));
10300
+ case 2:
10301
+ first = _context.v;
10302
+ if (hasError(first)) {
10303
+ _context.n = 3;
10304
+ break;
10305
+ }
10306
+ return _context.a(2, first);
10307
+ case 3:
10308
+ _context.n = 5;
10309
+ break;
10310
+ case 4:
10311
+ _context.p = 4;
10312
+ _t = _context.v;
10313
+ if (_t instanceof AmountTooLowError) {
10314
+ _context.n = 5;
10315
+ break;
10316
+ }
10317
+ throw _t;
10318
+ case 5:
10319
+ result = null;
10320
+ i = 1;
10321
+ case 6:
10322
+ if (!(i <= maxRetries)) {
10323
+ _context.n = 19;
10324
+ break;
10325
+ }
10326
+ amount = (bumpStep * i).toString();
10327
+ bumpedTx = void 0;
10328
+ _context.p = 7;
10329
+ _context.n = 8;
10330
+ return options.buildTx(amount);
10331
+ case 8:
10332
+ bumpedTx = _context.v;
10333
+ _context.n = 12;
10334
+ break;
10335
+ case 9:
10336
+ _context.p = 9;
10337
+ _t2 = _context.v;
10338
+ if (!(_t2 instanceof AmountTooLowError)) {
10339
+ _context.n = 11;
10340
+ break;
10341
+ }
10342
+ if (!(i === maxRetries)) {
10343
+ _context.n = 10;
10344
+ break;
10345
+ }
10346
+ throw _t2;
10347
+ case 10:
10348
+ return _context.a(3, 18);
10349
+ case 11:
10350
+ throw _t2;
10351
+ case 12:
10352
+ _context.p = 12;
10353
+ _context.n = 13;
10354
+ return internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
10355
+ tx: bumpedTx,
10356
+ useRootOrigin: true
10357
+ }));
10358
+ case 13:
10359
+ result = _context.v;
10360
+ if (hasError(result)) {
10361
+ _context.n = 14;
10362
+ break;
10363
+ }
10364
+ return _context.a(2, result);
10365
+ case 14:
10366
+ _context.n = 18;
10367
+ break;
10368
+ case 15:
10369
+ _context.p = 15;
10370
+ _t3 = _context.v;
10371
+ if (!(_t3 instanceof AmountTooLowError)) {
10372
+ _context.n = 17;
10373
+ break;
10374
+ }
10375
+ if (!(i === maxRetries)) {
10376
+ _context.n = 16;
10377
+ break;
10378
+ }
10379
+ throw _t3;
10380
+ case 16:
10381
+ return _context.a(3, 18);
10382
+ case 17:
10383
+ throw _t3;
10384
+ case 18:
10385
+ i++;
10386
+ _context.n = 6;
10387
+ break;
10388
+ case 19:
10389
+ return _context.a(2, result);
10390
+ }
10391
+ }, _callee, null, [[12, 15], [7, 9], [1, 4]]);
10392
+ }));
10393
+ return function getBypassResultWithRetries(_x, _x2, _x3) {
10394
+ return _ref.apply(this, arguments);
10395
+ };
10396
+ }();
10397
+
10233
10398
  var getOriginXcmFeeInternal = /*#__PURE__*/function () {
10234
10399
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
10235
10400
  var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, _ref$useRootOrigin, useRootOrigin, asset, amount, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient, dryRunResult, _rawFee, _paddedFee, fee, forwardedXcms, destParaId, weight;
@@ -10330,30 +10495,48 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
10330
10495
 
10331
10496
  var getOriginXcmFee = /*#__PURE__*/function () {
10332
10497
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10333
- var _options$txs, tx, txBypass, forced, real;
10498
+ var buildTx, tx, real, forced, _forced, _t;
10334
10499
  return _regenerator().w(function (_context) {
10335
- while (1) switch (_context.n) {
10500
+ while (1) switch (_context.p = _context.n) {
10336
10501
  case 0:
10337
- _options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
10338
- _context.n = 1;
10339
- return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10340
- tx: txBypass,
10341
- useRootOrigin: true
10342
- }));
10343
- case 1:
10344
- forced = _context.v;
10502
+ buildTx = options.buildTx;
10503
+ _context.p = 1;
10345
10504
  _context.n = 2;
10505
+ return buildTx();
10506
+ case 2:
10507
+ tx = _context.v;
10508
+ _context.n = 3;
10346
10509
  return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10347
10510
  tx: tx,
10348
10511
  useRootOrigin: false
10349
10512
  }));
10350
- case 2:
10513
+ case 3:
10351
10514
  real = _context.v;
10515
+ _context.n = 4;
10516
+ return getBypassResultWithRetries(options, getOriginXcmFeeInternal, tx);
10517
+ case 4:
10518
+ forced = _context.v;
10352
10519
  return _context.a(2, _objectSpread2(_objectSpread2({}, forced), {}, {
10353
10520
  sufficient: real.sufficient
10354
10521
  }));
10522
+ case 5:
10523
+ _context.p = 5;
10524
+ _t = _context.v;
10525
+ if (_t instanceof AmountTooLowError) {
10526
+ _context.n = 6;
10527
+ break;
10528
+ }
10529
+ throw _t;
10530
+ case 6:
10531
+ _context.n = 7;
10532
+ return getBypassResultWithRetries(options, getOriginXcmFeeInternal);
10533
+ case 7:
10534
+ _forced = _context.v;
10535
+ return _context.a(2, _objectSpread2(_objectSpread2({}, _forced), {}, {
10536
+ sufficient: false
10537
+ }));
10355
10538
  }
10356
- }, _callee);
10539
+ }, _callee, null, [[1, 5]]);
10357
10540
  }));
10358
10541
  return function getOriginXcmFee(_x) {
10359
10542
  return _ref.apply(this, arguments);
@@ -10912,30 +11095,27 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10912
11095
 
10913
11096
  var getXcmFee = /*#__PURE__*/function () {
10914
11097
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10915
- var _real$assetHub, _real$bridgeHub;
10916
- var _options$txs, tx, txBypass, forced, real, api;
11098
+ var buildTx, api, _real$assetHub, _real$bridgeHub, tx, real, forced, _forced, _t;
10917
11099
  return _regenerator().w(function (_context) {
10918
- while (1) switch (_context.n) {
11100
+ while (1) switch (_context.p = _context.n) {
10919
11101
  case 0:
10920
- _options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
10921
- _context.n = 1;
10922
- return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10923
- tx: txBypass,
10924
- useRootOrigin: true
10925
- }));
10926
- case 1:
10927
- forced = _context.v;
11102
+ buildTx = options.buildTx, api = options.api;
11103
+ _context.p = 1;
10928
11104
  _context.n = 2;
11105
+ return buildTx();
11106
+ case 2:
11107
+ tx = _context.v;
11108
+ _context.n = 3;
10929
11109
  return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10930
11110
  tx: tx,
10931
11111
  useRootOrigin: false
10932
11112
  }));
10933
- case 2:
10934
- real = _context.v;
10935
- api = options.api;
10936
- _context.n = 3;
10937
- return api.disconnect();
10938
11113
  case 3:
11114
+ real = _context.v;
11115
+ _context.n = 4;
11116
+ return getBypassResultWithRetries(options, getXcmFeeInternal, tx);
11117
+ case 4:
11118
+ forced = _context.v;
10939
11119
  return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, forced), {}, {
10940
11120
  origin: _objectSpread2(_objectSpread2({}, forced.origin), {}, {
10941
11121
  sufficient: real.origin.sufficient
@@ -10952,17 +11132,62 @@ var getXcmFee = /*#__PURE__*/function () {
10952
11132
  sufficient: (_real$bridgeHub = real.bridgeHub) === null || _real$bridgeHub === void 0 ? void 0 : _real$bridgeHub.sufficient
10953
11133
  })
10954
11134
  } : {}), {}, {
10955
- hops: forced.hops.map(function (hop, index) {
10956
- var _real$hops$index;
11135
+ hops: forced.hops.map(function (hop, i) {
11136
+ var _real$hops$i;
11137
+ return _objectSpread2(_objectSpread2({}, hop), {}, {
11138
+ result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
11139
+ sufficient: (_real$hops$i = real.hops[i]) === null || _real$hops$i === void 0 || (_real$hops$i = _real$hops$i.result) === null || _real$hops$i === void 0 ? void 0 : _real$hops$i.sufficient
11140
+ })
11141
+ });
11142
+ })
11143
+ }));
11144
+ case 5:
11145
+ _context.p = 5;
11146
+ _t = _context.v;
11147
+ if (_t instanceof AmountTooLowError) {
11148
+ _context.n = 6;
11149
+ break;
11150
+ }
11151
+ throw _t;
11152
+ case 6:
11153
+ _context.n = 7;
11154
+ return getBypassResultWithRetries(options, getXcmFeeInternal);
11155
+ case 7:
11156
+ _forced = _context.v;
11157
+ return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, _forced), {}, {
11158
+ origin: _objectSpread2(_objectSpread2({}, _forced.origin), {}, {
11159
+ sufficient: false
11160
+ }),
11161
+ destination: _objectSpread2(_objectSpread2({}, _forced.destination), {}, {
11162
+ sufficient: false
11163
+ })
11164
+ }, _forced.assetHub ? {
11165
+ assetHub: _objectSpread2(_objectSpread2({}, _forced.assetHub), {}, {
11166
+ sufficient: false
11167
+ })
11168
+ } : {}), _forced.bridgeHub ? {
11169
+ bridgeHub: _objectSpread2(_objectSpread2({}, _forced.bridgeHub), {}, {
11170
+ sufficient: false
11171
+ })
11172
+ } : {}), {}, {
11173
+ hops: _forced.hops.map(function (hop) {
10957
11174
  return _objectSpread2(_objectSpread2({}, hop), {}, {
10958
11175
  result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
10959
- sufficient: (_real$hops$index = real.hops[index]) === null || _real$hops$index === void 0 ? void 0 : _real$hops$index.result.sufficient
11176
+ sufficient: false
10960
11177
  })
10961
11178
  });
10962
11179
  })
10963
11180
  }));
11181
+ case 8:
11182
+ _context.p = 8;
11183
+ _context.n = 9;
11184
+ return api.disconnect();
11185
+ case 9:
11186
+ return _context.f(8);
11187
+ case 10:
11188
+ return _context.a(2);
10964
11189
  }
10965
- }, _callee);
11190
+ }, _callee, null, [[1, 5, 8, 10]]);
10966
11191
  }));
10967
11192
  return function getXcmFee(_x) {
10968
11193
  return _ref.apply(this, arguments);
@@ -11024,9 +11249,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
11024
11249
  case 6:
11025
11250
  originFeeDetails = _context.v;
11026
11251
  currencyInput = originAsset.location ? {
11027
- location: originAsset.location
11252
+ location: originAsset.location,
11253
+ amount: amount
11028
11254
  } : {
11029
- symbol: originAsset.symbol
11255
+ symbol: originAsset.symbol,
11256
+ amount: amount
11030
11257
  };
11031
11258
  if (!(destination === 'Ethereum')) {
11032
11259
  _context.n = 7;
@@ -11406,11 +11633,11 @@ var buildHopInfo = /*#__PURE__*/function () {
11406
11633
 
11407
11634
  var getTransferInfo = /*#__PURE__*/function () {
11408
11635
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
11409
- 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;
11636
+ var api, buildTx, 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;
11410
11637
  return _regenerator().w(function (_context2) {
11411
11638
  while (1) switch (_context2.p = _context2.n) {
11412
11639
  case 0:
11413
- 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;
11640
+ api = _ref.api, buildTx = _ref.buildTx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, ahAddress = _ref.ahAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset;
11414
11641
  if (!(isChainEvm(origin) && !ahAddress)) {
11415
11642
  _context2.n = 1;
11416
11643
  break;
@@ -11464,7 +11691,7 @@ var getTransferInfo = /*#__PURE__*/function () {
11464
11691
  _context2.n = 9;
11465
11692
  return getXcmFee({
11466
11693
  api: api,
11467
- txs: txs,
11694
+ buildTx: buildTx,
11468
11695
  origin: origin,
11469
11696
  destination: destination,
11470
11697
  senderAddress: senderAddress,
@@ -11632,11 +11859,11 @@ var getTransferInfo = /*#__PURE__*/function () {
11632
11859
 
11633
11860
  var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11634
11861
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
11635
- 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;
11862
+ var api, origin, senderAddress, address, chain, destination, currency, feeAsset, buildTx, 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;
11636
11863
  return _regenerator().w(function (_context) {
11637
11864
  while (1) switch (_context.n) {
11638
11865
  case 0:
11639
- 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;
11866
+ api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, feeAsset = _ref.feeAsset, buildTx = _ref.buildTx, builder = _ref.builder;
11640
11867
  validateAddress(senderAddress, chain, false);
11641
11868
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
11642
11869
  asset = findAssetInfoOrThrow(chain, currency, null);
@@ -11669,7 +11896,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11669
11896
  api: api,
11670
11897
  origin: origin,
11671
11898
  destination: destination,
11672
- txs: txs,
11899
+ buildTx: buildTx,
11673
11900
  senderAddress: senderAddress,
11674
11901
  address: address,
11675
11902
  currency: _objectSpread2(_objectSpread2({}, currency), {}, {
@@ -11764,11 +11991,11 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
11764
11991
 
11765
11992
  var getTransferableAmountInternal = /*#__PURE__*/function () {
11766
11993
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
11767
- var api, senderAddress, chain, destination, currency, txs, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
11994
+ var api, senderAddress, chain, destination, currency, buildTx, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
11768
11995
  return _regenerator().w(function (_context) {
11769
11996
  while (1) switch (_context.n) {
11770
11997
  case 0:
11771
- api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, txs = _ref.txs, feeAsset = _ref.feeAsset;
11998
+ api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, buildTx = _ref.buildTx, feeAsset = _ref.feeAsset;
11772
11999
  validateAddress(senderAddress, chain, false);
11773
12000
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
11774
12001
  asset = findAssetInfoOrThrow(chain, currency, null);
@@ -11794,7 +12021,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
11794
12021
  _context.n = 2;
11795
12022
  return getOriginXcmFee({
11796
12023
  api: api,
11797
- txs: txs,
12024
+ buildTx: buildTx,
11798
12025
  origin: chain,
11799
12026
  destination: chain,
11800
12027
  senderAddress: senderAddress,
@@ -12180,11 +12407,11 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
12180
12407
  };
12181
12408
  var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12182
12409
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
12183
- 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;
12410
+ var api, buildTx, origin, destination, currency, address, senderAddress, feeAsset, destApi, asset, amount, destCurrency, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, tx, totalFee, method, feeToSubtract;
12184
12411
  return _regenerator().w(function (_context) {
12185
12412
  while (1) switch (_context.n) {
12186
12413
  case 0:
12187
- api = options.api, txs = options.txs, origin = options.origin, destination = options.destination, currency = options.currency, address = options.address, senderAddress = options.senderAddress, feeAsset = options.feeAsset;
12414
+ api = options.api, buildTx = options.buildTx, origin = options.origin, destination = options.destination, currency = options.currency, address = options.address, senderAddress = options.senderAddress, feeAsset = options.feeAsset;
12188
12415
  if (!(destination === 'Ethereum')) {
12189
12416
  _context.n = 1;
12190
12417
  break;
@@ -12225,11 +12452,10 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12225
12452
  });
12226
12453
  case 5:
12227
12454
  balance = _context.v;
12228
- tx = txs.tx, txBypass = txs.txBypass;
12229
12455
  _context.n = 6;
12230
- return getXcmFeeInternal({
12456
+ return getXcmFee({
12231
12457
  api: api,
12232
- tx: txBypass,
12458
+ buildTx: buildTx,
12233
12459
  origin: origin,
12234
12460
  destination: destination,
12235
12461
  senderAddress: senderAddress,
@@ -12238,8 +12464,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12238
12464
  amount: amount
12239
12465
  }),
12240
12466
  feeAsset: feeAsset,
12241
- disableFallback: false,
12242
- useRootOrigin: true
12467
+ disableFallback: false
12243
12468
  });
12244
12469
  case 6:
12245
12470
  xcmFeeResult = _context.v;
@@ -12269,6 +12494,10 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12269
12494
  }
12270
12495
  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.");
12271
12496
  case 10:
12497
+ _context.n = 11;
12498
+ return buildTx();
12499
+ case 11:
12500
+ tx = _context.v;
12272
12501
  totalFee = calculateTotalXcmFee(xcmFeeResult);
12273
12502
  method = api.getMethod(tx);
12274
12503
  if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
@@ -12832,11 +13061,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
12832
13061
  return dryRunPreview;
12833
13062
  }()
12834
13063
  }, {
12835
- key: "createTxs",
12836
- value: function createTxs$1() {
12837
- return createTxs(_objectSpread2(_objectSpread2({}, this._options), {}, {
12838
- api: this.api
12839
- }), this);
13064
+ key: "createTxFactory",
13065
+ value: function createTxFactory() {
13066
+ var _this = this;
13067
+ return function (amount) {
13068
+ return createTx(_objectSpread2(_objectSpread2({}, _this._options), {}, {
13069
+ api: _this.api
13070
+ }), _this, amount);
13071
+ };
12840
13072
  }
12841
13073
  /**
12842
13074
  * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
@@ -12848,7 +13080,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12848
13080
  value: (function () {
12849
13081
  var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
12850
13082
  var _options$disableFallb;
12851
- var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
13083
+ var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback;
12852
13084
  return _regenerator().w(function (_context7) {
12853
13085
  while (1) switch (_context7.p = _context7.n) {
12854
13086
  case 0:
@@ -12857,43 +13089,30 @@ var GeneralBuilder = /*#__PURE__*/function () {
12857
13089
  assertAddressIsString(address);
12858
13090
  disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
12859
13091
  _context7.p = 1;
12860
- _t = getXcmFee;
12861
- _t2 = this.api;
12862
13092
  _context7.n = 2;
12863
- return this.createTxs();
12864
- case 2:
12865
- _t3 = _context7.v;
12866
- _t4 = from;
12867
- _t5 = to;
12868
- _t6 = senderAddress;
12869
- _t7 = address;
12870
- _t8 = currency;
12871
- _t9 = feeAsset;
12872
- _t0 = disableFallback;
12873
- _context7.n = 3;
12874
- return _t({
12875
- api: _t2,
12876
- txs: _t3,
12877
- origin: _t4,
12878
- destination: _t5,
12879
- senderAddress: _t6,
12880
- address: _t7,
12881
- currency: _t8,
12882
- feeAsset: _t9,
12883
- disableFallback: _t0
13093
+ return getXcmFee({
13094
+ api: this.api,
13095
+ buildTx: this.createTxFactory(),
13096
+ origin: from,
13097
+ destination: to,
13098
+ senderAddress: senderAddress,
13099
+ address: address,
13100
+ currency: currency,
13101
+ feeAsset: feeAsset,
13102
+ disableFallback: disableFallback
12884
13103
  });
12885
- case 3:
13104
+ case 2:
12886
13105
  return _context7.a(2, _context7.v);
12887
- case 4:
12888
- _context7.p = 4;
12889
- _context7.n = 5;
13106
+ case 3:
13107
+ _context7.p = 3;
13108
+ _context7.n = 4;
12890
13109
  return this.api.disconnect();
13110
+ case 4:
13111
+ return _context7.f(3);
12891
13112
  case 5:
12892
- return _context7.f(4);
12893
- case 6:
12894
13113
  return _context7.a(2);
12895
13114
  }
12896
- }, _callee7, this, [[1,, 4, 6]]);
13115
+ }, _callee7, this, [[1,, 3, 5]]);
12897
13116
  }));
12898
13117
  function getXcmFee$1(_x6) {
12899
13118
  return _getXcmFee2.apply(this, arguments);
@@ -12919,16 +13138,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12919
13138
  currency,
12920
13139
  feeAsset,
12921
13140
  api,
12922
- _args8 = arguments,
12923
- _t1,
12924
- _t10,
12925
- _t11,
12926
- _t12,
12927
- _t13,
12928
- _t14,
12929
- _t15,
12930
- _t16,
12931
- _t17;
13141
+ _args8 = arguments;
12932
13142
  return _regenerator().w(function (_context8) {
12933
13143
  while (1) switch (_context8.p = _context8.n) {
12934
13144
  case 0:
@@ -12939,41 +13149,29 @@ var GeneralBuilder = /*#__PURE__*/function () {
12939
13149
  assertToIsString(to);
12940
13150
  api = this.api;
12941
13151
  _context8.p = 1;
12942
- _t1 = getOriginXcmFee;
12943
- _t10 = api;
12944
13152
  _context8.n = 2;
12945
- return this.createTxs();
12946
- case 2:
12947
- _t11 = _context8.v;
12948
- _t12 = from;
12949
- _t13 = to;
12950
- _t14 = senderAddress;
12951
- _t15 = currency;
12952
- _t16 = feeAsset;
12953
- _t17 = disableFallback;
12954
- _context8.n = 3;
12955
- return _t1({
12956
- api: _t10,
12957
- txs: _t11,
12958
- origin: _t12,
12959
- destination: _t13,
12960
- senderAddress: _t14,
12961
- currency: _t15,
12962
- feeAsset: _t16,
12963
- disableFallback: _t17
13153
+ return getOriginXcmFee({
13154
+ api: api,
13155
+ buildTx: this.createTxFactory(),
13156
+ origin: from,
13157
+ destination: to,
13158
+ senderAddress: senderAddress,
13159
+ currency: currency,
13160
+ feeAsset: feeAsset,
13161
+ disableFallback: disableFallback
12964
13162
  });
12965
- case 3:
13163
+ case 2:
12966
13164
  return _context8.a(2, _context8.v);
12967
- case 4:
12968
- _context8.p = 4;
12969
- _context8.n = 5;
13165
+ case 3:
13166
+ _context8.p = 3;
13167
+ _context8.n = 4;
12970
13168
  return this.api.disconnect();
13169
+ case 4:
13170
+ return _context8.f(3);
12971
13171
  case 5:
12972
- return _context8.f(4);
12973
- case 6:
12974
13172
  return _context8.a(2);
12975
13173
  }
12976
- }, _callee8, this, [[1,, 4, 6]]);
13174
+ }, _callee8, this, [[1,, 3, 5]]);
12977
13175
  }));
12978
13176
  function getOriginXcmFee$1() {
12979
13177
  return _getOriginXcmFee2.apply(this, arguments);
@@ -13088,32 +13286,21 @@ var GeneralBuilder = /*#__PURE__*/function () {
13088
13286
  key: "getTransferableAmount",
13089
13287
  value: (function () {
13090
13288
  var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
13091
- var _this$_options6, from, to, senderAddress, currency, feeAsset, api, _t18, _t19, _t20, _t21, _t22, _t23, _t24, _t25;
13289
+ var _this$_options6, from, to, senderAddress, currency, feeAsset, api;
13092
13290
  return _regenerator().w(function (_context1) {
13093
13291
  while (1) switch (_context1.n) {
13094
13292
  case 0:
13095
13293
  _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
13096
13294
  assertToIsString(to);
13097
13295
  api = this.api;
13098
- _t18 = getTransferableAmount;
13099
- _t19 = api;
13100
- _context1.n = 1;
13101
- return this.createTxs();
13102
- case 1:
13103
- _t20 = _context1.v;
13104
- _t21 = from;
13105
- _t22 = to;
13106
- _t23 = senderAddress;
13107
- _t24 = feeAsset;
13108
- _t25 = currency;
13109
- return _context1.a(2, _t18({
13110
- api: _t19,
13111
- txs: _t20,
13112
- origin: _t21,
13113
- destination: _t22,
13114
- senderAddress: _t23,
13115
- feeAsset: _t24,
13116
- currency: _t25
13296
+ return _context1.a(2, getTransferableAmount({
13297
+ api: api,
13298
+ buildTx: this.createTxFactory(),
13299
+ origin: from,
13300
+ destination: to,
13301
+ senderAddress: senderAddress,
13302
+ feeAsset: feeAsset,
13303
+ currency: currency
13117
13304
  }));
13118
13305
  }
13119
13306
  }, _callee1, this);
@@ -13133,7 +13320,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13133
13320
  key: "getMinTransferableAmount",
13134
13321
  value: (function () {
13135
13322
  var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13136
- var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33, _t34, _t35;
13323
+ var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api;
13137
13324
  return _regenerator().w(function (_context10) {
13138
13325
  while (1) switch (_context10.n) {
13139
13326
  case 0:
@@ -13141,29 +13328,16 @@ var GeneralBuilder = /*#__PURE__*/function () {
13141
13328
  assertToIsString(to);
13142
13329
  assertAddressIsString(address);
13143
13330
  api = this.api;
13144
- _t26 = getMinTransferableAmount;
13145
- _t27 = api;
13146
- _context10.n = 1;
13147
- return this.createTxs();
13148
- case 1:
13149
- _t28 = _context10.v;
13150
- _t29 = from;
13151
- _t30 = to;
13152
- _t31 = senderAddress;
13153
- _t32 = address;
13154
- _t33 = feeAsset;
13155
- _t34 = currency;
13156
- _t35 = this;
13157
- return _context10.a(2, _t26({
13158
- api: _t27,
13159
- txs: _t28,
13160
- origin: _t29,
13161
- destination: _t30,
13162
- senderAddress: _t31,
13163
- address: _t32,
13164
- feeAsset: _t33,
13165
- currency: _t34,
13166
- builder: _t35
13331
+ return _context10.a(2, getMinTransferableAmount({
13332
+ api: api,
13333
+ buildTx: this.createTxFactory(),
13334
+ origin: from,
13335
+ destination: to,
13336
+ senderAddress: senderAddress,
13337
+ address: address,
13338
+ feeAsset: feeAsset,
13339
+ currency: currency,
13340
+ builder: this
13167
13341
  }));
13168
13342
  }
13169
13343
  }, _callee10, this);
@@ -13183,34 +13357,22 @@ var GeneralBuilder = /*#__PURE__*/function () {
13183
13357
  key: "verifyEdOnDestination",
13184
13358
  value: (function () {
13185
13359
  var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
13186
- var _this$_options8, from, to, address, currency, senderAddress, feeAsset, _t36, _t37, _t38, _t39, _t40, _t41, _t42, _t43, _t44;
13360
+ var _this$_options8, from, to, address, currency, senderAddress, feeAsset;
13187
13361
  return _regenerator().w(function (_context11) {
13188
13362
  while (1) switch (_context11.n) {
13189
13363
  case 0:
13190
13364
  _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;
13191
13365
  assertToIsString(to);
13192
13366
  assertAddressIsString(address);
13193
- _t36 = verifyEdOnDestination;
13194
- _t37 = this.api;
13195
- _context11.n = 1;
13196
- return this.createTxs();
13197
- case 1:
13198
- _t38 = _context11.v;
13199
- _t39 = from;
13200
- _t40 = to;
13201
- _t41 = address;
13202
- _t42 = senderAddress;
13203
- _t43 = feeAsset;
13204
- _t44 = currency;
13205
- return _context11.a(2, _t36({
13206
- api: _t37,
13207
- txs: _t38,
13208
- origin: _t39,
13209
- destination: _t40,
13210
- address: _t41,
13211
- senderAddress: _t42,
13212
- feeAsset: _t43,
13213
- currency: _t44
13367
+ return _context11.a(2, verifyEdOnDestination({
13368
+ api: this.api,
13369
+ buildTx: this.createTxFactory(),
13370
+ origin: from,
13371
+ destination: to,
13372
+ address: address,
13373
+ senderAddress: senderAddress,
13374
+ feeAsset: feeAsset,
13375
+ currency: currency
13214
13376
  }));
13215
13377
  }
13216
13378
  }, _callee11, this);
@@ -13230,36 +13392,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
13230
13392
  key: "getTransferInfo",
13231
13393
  value: (function () {
13232
13394
  var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
13233
- var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, _t45, _t46, _t47, _t48, _t49, _t50, _t51, _t52, _t53, _t54;
13395
+ var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset;
13234
13396
  return _regenerator().w(function (_context12) {
13235
13397
  while (1) switch (_context12.n) {
13236
13398
  case 0:
13237
13399
  _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;
13238
13400
  assertToIsString(to);
13239
13401
  assertAddressIsString(address);
13240
- _t45 = getTransferInfo;
13241
- _t46 = this.api;
13242
- _context12.n = 1;
13243
- return this.createTxs();
13244
- case 1:
13245
- _t47 = _context12.v;
13246
- _t48 = from;
13247
- _t49 = to;
13248
- _t50 = address;
13249
- _t51 = senderAddress;
13250
- _t52 = ahAddress;
13251
- _t53 = currency;
13252
- _t54 = feeAsset;
13253
- return _context12.a(2, _t45({
13254
- api: _t46,
13255
- txs: _t47,
13256
- origin: _t48,
13257
- destination: _t49,
13258
- address: _t50,
13259
- senderAddress: _t51,
13260
- ahAddress: _t52,
13261
- currency: _t53,
13262
- feeAsset: _t54
13402
+ return _context12.a(2, getTransferInfo({
13403
+ api: this.api,
13404
+ buildTx: this.createTxFactory(),
13405
+ origin: from,
13406
+ destination: to,
13407
+ address: address,
13408
+ senderAddress: senderAddress,
13409
+ ahAddress: ahAddress,
13410
+ currency: currency,
13411
+ feeAsset: feeAsset
13263
13412
  }));
13264
13413
  }
13265
13414
  }, _callee12, this);
@@ -13302,4 +13451,4 @@ var Builder = function Builder(api) {
13302
13451
  return new GeneralBuilder(api, new BatchTransactionManager());
13303
13452
  };
13304
13453
 
13305
- 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 };
13454
+ 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, createTx, 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 };