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