@paraspell/sdk-core 11.7.0 → 11.7.2

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
@@ -831,6 +831,52 @@ var isConfig = function isConfig(value) {
831
831
  Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value || 'xcmFormatCheck' in value);
832
832
  };
833
833
 
834
+ var computeOverridenAmount = function computeOverridenAmount(options) {
835
+ var from = options.from,
836
+ to = options.to,
837
+ currency = options.currency,
838
+ api = options.api;
839
+ var config = api.getConfig();
840
+ if (isConfig(config) && config.abstractDecimals) {
841
+ return BYPASS_CURRENCY_AMOUNT;
842
+ } else {
843
+ assertToIsString(to);
844
+ var asset = assets.findAssetInfoOrThrow(from, currency, to);
845
+ return viem.parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
846
+ }
847
+ };
848
+ var overrideTxAmount = function overrideTxAmount(options, builder) {
849
+ var modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, options.currency), {}, {
850
+ amount: computeOverridenAmount(options)
851
+ }));
852
+ return modifiedBuilder['buildInternal']();
853
+ };
854
+ var createTxs = /*#__PURE__*/function () {
855
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder) {
856
+ var tx, txBypass;
857
+ return _regenerator().w(function (_context) {
858
+ while (1) switch (_context.n) {
859
+ case 0:
860
+ _context.n = 1;
861
+ return builder['buildInternal']();
862
+ case 1:
863
+ tx = _context.v;
864
+ _context.n = 2;
865
+ return overrideTxAmount(options, builder);
866
+ case 2:
867
+ txBypass = _context.v;
868
+ return _context.a(2, {
869
+ tx: tx,
870
+ txBypass: txBypass
871
+ });
872
+ }
873
+ }, _callee);
874
+ }));
875
+ return function createTxs(_x, _x2) {
876
+ return _ref.apply(this, arguments);
877
+ };
878
+ }();
879
+
834
880
  /**
835
881
  * Retrieves the chain instance for a given chain.
836
882
  *
@@ -5782,7 +5828,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5782
5828
  // Enter dummy fee values just to get the dry run to pass
5783
5829
  asset.amount, asset.amount / 2n);
5784
5830
  _context.n = 5;
5785
- return getXcmFee({
5831
+ return getXcmFeeInternal({
5786
5832
  api: api,
5787
5833
  tx: dummyTx,
5788
5834
  origin: origin,
@@ -5790,7 +5836,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5790
5836
  senderAddress: senderAddress,
5791
5837
  address: address,
5792
5838
  currency: currency,
5793
- disableFallback: false
5839
+ disableFallback: false,
5840
+ useRootOrigin: true
5794
5841
  });
5795
5842
  case 5:
5796
5843
  feeResult = _context.v;
@@ -10282,18 +10329,21 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
10282
10329
 
10283
10330
  var getOriginXcmFee = /*#__PURE__*/function () {
10284
10331
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10285
- var forced, real;
10332
+ var _options$txs, tx, txBypass, forced, real;
10286
10333
  return _regenerator().w(function (_context) {
10287
10334
  while (1) switch (_context.n) {
10288
10335
  case 0:
10336
+ _options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
10289
10337
  _context.n = 1;
10290
10338
  return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10339
+ tx: txBypass,
10291
10340
  useRootOrigin: true
10292
10341
  }));
10293
10342
  case 1:
10294
10343
  forced = _context.v;
10295
10344
  _context.n = 2;
10296
10345
  return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10346
+ tx: tx,
10297
10347
  useRootOrigin: false
10298
10348
  }));
10299
10349
  case 2:
@@ -10532,12 +10582,12 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
10532
10582
  return {};
10533
10583
  };
10534
10584
  var getXcmFeeInternal = /*#__PURE__*/function () {
10535
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref, useRootOrigin) {
10536
- var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, asset, amount, _yield$getOriginXcmFe, originFee, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason;
10585
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
10586
+ var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFee, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason;
10537
10587
  return _regenerator().w(function (_context2) {
10538
10588
  while (1) switch (_context2.p = _context2.n) {
10539
10589
  case 0:
10540
- api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig;
10590
+ api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig, useRootOrigin = _ref.useRootOrigin;
10541
10591
  asset = assets.findAssetInfoOrThrow(origin, currency, destination);
10542
10592
  amount = abstractDecimals(currency.amount, asset.decimals, api);
10543
10593
  _context2.n = 1;
@@ -10681,7 +10731,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10681
10731
  }
10682
10732
  }, _callee);
10683
10733
  }));
10684
- return function processHop(_x3) {
10734
+ return function processHop(_x2) {
10685
10735
  return _ref3.apply(this, arguments);
10686
10736
  };
10687
10737
  }();
@@ -10854,7 +10904,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10854
10904
  }
10855
10905
  }, _callee2, null, [[2,, 5, 7]]);
10856
10906
  }));
10857
- return function getXcmFeeInternal(_x, _x2) {
10907
+ return function getXcmFeeInternal(_x) {
10858
10908
  return _ref2.apply(this, arguments);
10859
10909
  };
10860
10910
  }();
@@ -10862,16 +10912,23 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10862
10912
  var getXcmFee = /*#__PURE__*/function () {
10863
10913
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
10864
10914
  var _real$assetHub, _real$bridgeHub;
10865
- var forced, real, api;
10915
+ var _options$txs, tx, txBypass, forced, real, api;
10866
10916
  return _regenerator().w(function (_context) {
10867
10917
  while (1) switch (_context.n) {
10868
10918
  case 0:
10919
+ _options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
10869
10920
  _context.n = 1;
10870
- return getXcmFeeInternal(options, true);
10921
+ return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10922
+ tx: txBypass,
10923
+ useRootOrigin: true
10924
+ }));
10871
10925
  case 1:
10872
10926
  forced = _context.v;
10873
10927
  _context.n = 2;
10874
- return getXcmFeeInternal(options, false);
10928
+ return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
10929
+ tx: tx,
10930
+ useRootOrigin: false
10931
+ }));
10875
10932
  case 2:
10876
10933
  real = _context.v;
10877
10934
  api = options.api;
@@ -11348,11 +11405,11 @@ var buildHopInfo = /*#__PURE__*/function () {
11348
11405
 
11349
11406
  var getTransferInfo = /*#__PURE__*/function () {
11350
11407
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
11351
- var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
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;
11352
11409
  return _regenerator().w(function (_context2) {
11353
11410
  while (1) switch (_context2.p = _context2.n) {
11354
11411
  case 0:
11355
- api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, ahAddress = _ref.ahAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset;
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;
11356
11413
  if (!(assets.isChainEvm(origin) && !ahAddress)) {
11357
11414
  _context2.n = 1;
11358
11415
  break;
@@ -11406,7 +11463,7 @@ var getTransferInfo = /*#__PURE__*/function () {
11406
11463
  _context2.n = 9;
11407
11464
  return getXcmFee({
11408
11465
  api: api,
11409
- tx: tx,
11466
+ txs: txs,
11410
11467
  origin: origin,
11411
11468
  destination: destination,
11412
11469
  senderAddress: senderAddress,
@@ -11574,11 +11631,11 @@ var getTransferInfo = /*#__PURE__*/function () {
11574
11631
 
11575
11632
  var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11576
11633
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
11577
- var api, origin, senderAddress, address, chain, destination, currency, tx, feeAsset, builder, resolvedFeeAsset, asset, destAsset, destCurrency, destApi, destBalance, destEd, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, amount, result, originFee, hopFeeTotal, destinationFee, edComponent, minAmount, modifiedBuilder, dryRunResult, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
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;
11578
11635
  return _regenerator().w(function (_context) {
11579
11636
  while (1) switch (_context.n) {
11580
11637
  case 0:
11581
- api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, tx = _ref.tx, feeAsset = _ref.feeAsset, builder = _ref.builder;
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;
11582
11639
  validateAddress(senderAddress, chain, false);
11583
11640
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
11584
11641
  asset = assets.findAssetInfoOrThrow(chain, currency, null);
@@ -11607,11 +11664,11 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11607
11664
  paysOriginInSendingAsset = !resolvedFeeAsset && isNativeAsset || resolvedFeeAsset && assets.isAssetEqual(resolvedFeeAsset, asset);
11608
11665
  amount = abstractDecimals(currency.amount, asset.decimals, api);
11609
11666
  _context.n = 3;
11610
- return getXcmFeeInternal({
11667
+ return getXcmFee({
11611
11668
  api: api,
11612
11669
  origin: origin,
11613
11670
  destination: destination,
11614
- tx: tx,
11671
+ txs: txs,
11615
11672
  senderAddress: senderAddress,
11616
11673
  address: address,
11617
11674
  currency: _objectSpread2(_objectSpread2({}, currency), {}, {
@@ -11619,9 +11676,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11619
11676
  }),
11620
11677
  feeAsset: feeAsset,
11621
11678
  disableFallback: false
11622
- },
11623
- // Use dryRun bypass
11624
- true);
11679
+ });
11625
11680
  case 3:
11626
11681
  result = _context.v;
11627
11682
  originFee = result.origin && paysOriginInSendingAsset && assets.isAssetEqual(result.origin.asset, asset) ? result.origin.fee : 0n;
@@ -11708,11 +11763,11 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
11708
11763
 
11709
11764
  var getTransferableAmountInternal = /*#__PURE__*/function () {
11710
11765
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
11711
- var api, senderAddress, chain, destination, currency, tx, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
11766
+ var api, senderAddress, chain, destination, currency, txs, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
11712
11767
  return _regenerator().w(function (_context) {
11713
11768
  while (1) switch (_context.n) {
11714
11769
  case 0:
11715
- api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, tx = _ref.tx, feeAsset = _ref.feeAsset;
11770
+ api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, txs = _ref.txs, feeAsset = _ref.feeAsset;
11716
11771
  validateAddress(senderAddress, chain, false);
11717
11772
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
11718
11773
  asset = assets.findAssetInfoOrThrow(chain, currency, null);
@@ -11738,7 +11793,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
11738
11793
  _context.n = 2;
11739
11794
  return getOriginXcmFee({
11740
11795
  api: api,
11741
- tx: tx,
11796
+ txs: txs,
11742
11797
  origin: chain,
11743
11798
  destination: chain,
11744
11799
  senderAddress: senderAddress,
@@ -12123,12 +12178,12 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
12123
12178
  return totalFee;
12124
12179
  };
12125
12180
  var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12126
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
12127
- var api, tx, origin, destination, address, senderAddress, feeAsset, currency, destApi, asset, amount, destCurrency, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
12181
+ 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;
12128
12183
  return _regenerator().w(function (_context) {
12129
12184
  while (1) switch (_context.n) {
12130
12185
  case 0:
12131
- api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, address = _ref.address, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset, currency = _ref.currency;
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;
12132
12187
  if (!(destination === 'Ethereum')) {
12133
12188
  _context.n = 1;
12134
12189
  break;
@@ -12169,10 +12224,11 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12169
12224
  });
12170
12225
  case 5:
12171
12226
  balance = _context.v;
12227
+ tx = txs.tx, txBypass = txs.txBypass;
12172
12228
  _context.n = 6;
12173
- return getXcmFee({
12229
+ return getXcmFeeInternal({
12174
12230
  api: api,
12175
- tx: tx,
12231
+ tx: txBypass,
12176
12232
  origin: origin,
12177
12233
  destination: destination,
12178
12234
  senderAddress: senderAddress,
@@ -12181,42 +12237,37 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12181
12237
  amount: amount
12182
12238
  }),
12183
12239
  feeAsset: feeAsset,
12184
- disableFallback: false
12240
+ disableFallback: false,
12241
+ useRootOrigin: true
12185
12242
  });
12186
12243
  case 6:
12187
12244
  xcmFeeResult = _context.v;
12188
12245
  dryRunError = xcmFeeResult.origin.dryRunError, assetHubFeeResult = xcmFeeResult.assetHub, bridgeHubFeeResult = xcmFeeResult.bridgeHub, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeCurrency = _xcmFeeResult$destina.currency, destDryRunError = _xcmFeeResult$destina.dryRunError;
12189
- if (!(destFee === undefined)) {
12190
- _context.n = 7;
12191
- break;
12192
- }
12193
- throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency, sdkCommon.replaceBigInt), " on chain ").concat(destination, "."));
12194
- case 7:
12195
12246
  if (!dryRunError) {
12196
- _context.n = 8;
12247
+ _context.n = 7;
12197
12248
  break;
12198
12249
  }
12199
12250
  throw new DryRunFailedError(dryRunError, 'origin');
12200
- case 8:
12251
+ case 7:
12201
12252
  hopDryRunError = (assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.dryRunError) || (bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.dryRunError);
12202
12253
  if (!hopDryRunError) {
12203
- _context.n = 9;
12254
+ _context.n = 8;
12204
12255
  break;
12205
12256
  }
12206
12257
  throw new DryRunFailedError(hopDryRunError, assetHubFeeResult !== null && assetHubFeeResult !== void 0 && assetHubFeeResult.dryRunError ? 'assetHub' : 'bridgeHub');
12207
- case 9:
12258
+ case 8:
12208
12259
  if (!destDryRunError) {
12209
- _context.n = 10;
12260
+ _context.n = 9;
12210
12261
  break;
12211
12262
  }
12212
12263
  throw new UnableToComputeError("Unable to compute fee for the destination asset. Destination dry run error: ".concat(destDryRunError));
12213
- case 10:
12264
+ case 9:
12214
12265
  if (!(assets.normalizeSymbol(asset.symbol) !== assets.normalizeSymbol(destFeeCurrency))) {
12215
- _context.n = 11;
12266
+ _context.n = 10;
12216
12267
  break;
12217
12268
  }
12218
12269
  throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
12219
- case 11:
12270
+ case 10:
12220
12271
  totalFee = calculateTotalXcmFee(xcmFeeResult);
12221
12272
  method = api.getMethod(tx);
12222
12273
  if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
@@ -12229,7 +12280,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
12229
12280
  }, _callee);
12230
12281
  }));
12231
12282
  return function verifyEdOnDestinationInternal(_x) {
12232
- return _ref2.apply(this, arguments);
12283
+ return _ref.apply(this, arguments);
12233
12284
  };
12234
12285
  }();
12235
12286
 
@@ -12734,31 +12785,6 @@ var GeneralBuilder = /*#__PURE__*/function () {
12734
12785
  }
12735
12786
  return maybePerformXcmFormatCheck;
12736
12787
  }()
12737
- }, {
12738
- key: "computeOverridenAmount",
12739
- value: function computeOverridenAmount() {
12740
- var _this$_options2 = this._options,
12741
- from = _this$_options2.from,
12742
- to = _this$_options2.to,
12743
- currency = _this$_options2.currency;
12744
- var config = this.api.getConfig();
12745
- if (isConfig(config) && config.abstractDecimals) {
12746
- return BYPASS_CURRENCY_AMOUNT;
12747
- } else {
12748
- assertToIsString(to);
12749
- var asset = assets.findAssetInfoOrThrow(from, currency, to);
12750
- return viem.parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
12751
- }
12752
- }
12753
- }, {
12754
- key: "overrideTxAmount",
12755
- value: function overrideTxAmount() {
12756
- var currency = this._options.currency;
12757
- var modifiedBuilder = this.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
12758
- amount: this.computeOverridenAmount()
12759
- }));
12760
- return modifiedBuilder.buildInternal();
12761
- }
12762
12788
  }, {
12763
12789
  key: "dryRun",
12764
12790
  value: function () {
@@ -12804,6 +12830,13 @@ var GeneralBuilder = /*#__PURE__*/function () {
12804
12830
  }
12805
12831
  return dryRunPreview;
12806
12832
  }()
12833
+ }, {
12834
+ key: "createTxs",
12835
+ value: function createTxs$1() {
12836
+ return createTxs(_objectSpread2(_objectSpread2({}, this._options), {}, {
12837
+ api: this.api
12838
+ }), this);
12839
+ }
12807
12840
  /**
12808
12841
  * Returns the XCM fee for the transfer using dryRun or paymentInfo function.
12809
12842
  *
@@ -12814,30 +12847,39 @@ var GeneralBuilder = /*#__PURE__*/function () {
12814
12847
  value: (function () {
12815
12848
  var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
12816
12849
  var _options$disableFallb;
12817
- var _this$_options3, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
12850
+ var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
12818
12851
  return _regenerator().w(function (_context7) {
12819
12852
  while (1) switch (_context7.p = _context7.n) {
12820
12853
  case 0:
12821
- _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress, feeAsset = _this$_options3.feeAsset, currency = _this$_options3.currency;
12854
+ _this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress, feeAsset = _this$_options2.feeAsset, currency = _this$_options2.currency;
12822
12855
  assertToIsString(to);
12823
12856
  assertAddressIsString(address);
12824
- _context7.n = 1;
12825
- return this.overrideTxAmount();
12826
- case 1:
12827
- tx = _context7.v;
12828
12857
  disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
12829
- _context7.p = 2;
12858
+ _context7.p = 1;
12859
+ _t = getXcmFee;
12860
+ _t2 = this.api;
12861
+ _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;
12830
12872
  _context7.n = 3;
12831
- return getXcmFee({
12832
- api: this.api,
12833
- tx: tx,
12834
- origin: from,
12835
- destination: to,
12836
- senderAddress: senderAddress,
12837
- address: address,
12838
- currency: currency,
12839
- feeAsset: feeAsset,
12840
- disableFallback: disableFallback
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
12841
12883
  });
12842
12884
  case 3:
12843
12885
  return _context7.a(2, _context7.v);
@@ -12850,7 +12892,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12850
12892
  case 6:
12851
12893
  return _context7.a(2);
12852
12894
  }
12853
- }, _callee7, this, [[2,, 4, 6]]);
12895
+ }, _callee7, this, [[1,, 4, 6]]);
12854
12896
  }));
12855
12897
  function getXcmFee$1(_x6) {
12856
12898
  return _getXcmFee2.apply(this, arguments);
@@ -12869,37 +12911,55 @@ var GeneralBuilder = /*#__PURE__*/function () {
12869
12911
  var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
12870
12912
  var _ref,
12871
12913
  disableFallback,
12872
- _this$_options4,
12914
+ _this$_options3,
12873
12915
  from,
12874
12916
  to,
12875
12917
  senderAddress,
12876
12918
  currency,
12877
12919
  feeAsset,
12878
- tx,
12879
- _args8 = arguments;
12920
+ api,
12921
+ _args8 = arguments,
12922
+ _t1,
12923
+ _t10,
12924
+ _t11,
12925
+ _t12,
12926
+ _t13,
12927
+ _t14,
12928
+ _t15,
12929
+ _t16,
12930
+ _t17;
12880
12931
  return _regenerator().w(function (_context8) {
12881
12932
  while (1) switch (_context8.p = _context8.n) {
12882
12933
  case 0:
12883
12934
  _ref = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {
12884
12935
  disableFallback: false
12885
12936
  }, disableFallback = _ref.disableFallback;
12886
- _this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency, feeAsset = _this$_options4.feeAsset;
12937
+ _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, senderAddress = _this$_options3.senderAddress, currency = _this$_options3.currency, feeAsset = _this$_options3.feeAsset;
12887
12938
  assertToIsString(to);
12888
- _context8.n = 1;
12889
- return this.overrideTxAmount();
12890
- case 1:
12891
- tx = _context8.v;
12892
- _context8.p = 2;
12939
+ api = this.api;
12940
+ _context8.p = 1;
12941
+ _t1 = getOriginXcmFee;
12942
+ _t10 = api;
12943
+ _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;
12893
12953
  _context8.n = 3;
12894
- return getOriginXcmFee({
12895
- api: this.api,
12896
- tx: tx,
12897
- origin: from,
12898
- destination: to,
12899
- senderAddress: senderAddress,
12900
- currency: currency,
12901
- feeAsset: feeAsset,
12902
- disableFallback: disableFallback
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
12903
12963
  });
12904
12964
  case 3:
12905
12965
  return _context8.a(2, _context8.v);
@@ -12912,7 +12972,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12912
12972
  case 6:
12913
12973
  return _context8.a(2);
12914
12974
  }
12915
- }, _callee8, this, [[2,, 4, 6]]);
12975
+ }, _callee8, this, [[1,, 4, 6]]);
12916
12976
  }));
12917
12977
  function getOriginXcmFee$1() {
12918
12978
  return _getOriginXcmFee2.apply(this, arguments);
@@ -12929,11 +12989,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
12929
12989
  key: "getXcmFeeEstimate",
12930
12990
  value: (function () {
12931
12991
  var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
12932
- var _this$_options5, from, to, address, senderAddress, currency, tx;
12992
+ var _this$_options4, from, to, address, senderAddress, currency, tx;
12933
12993
  return _regenerator().w(function (_context9) {
12934
12994
  while (1) switch (_context9.p = _context9.n) {
12935
12995
  case 0:
12936
- _this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, address = _this$_options5.address, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
12996
+ _this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, address = _this$_options4.address, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency;
12937
12997
  assertToIsString(to);
12938
12998
  assertAddressIsString(address);
12939
12999
  _context9.n = 1;
@@ -12979,11 +13039,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
12979
13039
  key: "getOriginXcmFeeEstimate",
12980
13040
  value: (function () {
12981
13041
  var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
12982
- var _this$_options6, from, to, senderAddress, currency, tx;
13042
+ var _this$_options5, from, to, senderAddress, currency, tx;
12983
13043
  return _regenerator().w(function (_context0) {
12984
13044
  while (1) switch (_context0.p = _context0.n) {
12985
13045
  case 0:
12986
- _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency;
13046
+ _this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
12987
13047
  assertToIsString(to);
12988
13048
  _context0.n = 1;
12989
13049
  return this.buildInternal();
@@ -13027,24 +13087,32 @@ var GeneralBuilder = /*#__PURE__*/function () {
13027
13087
  key: "getTransferableAmount",
13028
13088
  value: (function () {
13029
13089
  var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
13030
- var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
13090
+ var _this$_options6, from, to, senderAddress, currency, feeAsset, api, _t18, _t19, _t20, _t21, _t22, _t23, _t24, _t25;
13031
13091
  return _regenerator().w(function (_context1) {
13032
13092
  while (1) switch (_context1.n) {
13033
13093
  case 0:
13034
- _this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
13094
+ _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
13035
13095
  assertToIsString(to);
13096
+ api = this.api;
13097
+ _t18 = getTransferableAmount;
13098
+ _t19 = api;
13036
13099
  _context1.n = 1;
13037
- return this.overrideTxAmount();
13100
+ return this.createTxs();
13038
13101
  case 1:
13039
- tx = _context1.v;
13040
- return _context1.a(2, getTransferableAmount({
13041
- api: this.api,
13042
- tx: tx,
13043
- origin: from,
13044
- destination: to,
13045
- senderAddress: senderAddress,
13046
- feeAsset: feeAsset,
13047
- currency: currency
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
13048
13116
  }));
13049
13117
  }
13050
13118
  }, _callee1, this);
@@ -13064,27 +13132,37 @@ var GeneralBuilder = /*#__PURE__*/function () {
13064
13132
  key: "getMinTransferableAmount",
13065
13133
  value: (function () {
13066
13134
  var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13067
- var _this$_options8, from, to, senderAddress, address, currency, feeAsset, tx;
13135
+ var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33, _t34, _t35;
13068
13136
  return _regenerator().w(function (_context10) {
13069
13137
  while (1) switch (_context10.n) {
13070
13138
  case 0:
13071
- _this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, senderAddress = _this$_options8.senderAddress, address = _this$_options8.address, currency = _this$_options8.currency, feeAsset = _this$_options8.feeAsset;
13139
+ _this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, address = _this$_options7.address, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
13072
13140
  assertToIsString(to);
13073
13141
  assertAddressIsString(address);
13142
+ api = this.api;
13143
+ _t26 = getMinTransferableAmount;
13144
+ _t27 = api;
13074
13145
  _context10.n = 1;
13075
- return this.overrideTxAmount();
13146
+ return this.createTxs();
13076
13147
  case 1:
13077
- tx = _context10.v;
13078
- return _context10.a(2, getMinTransferableAmount({
13079
- api: this.api,
13080
- tx: tx,
13081
- origin: from,
13082
- destination: to,
13083
- senderAddress: senderAddress,
13084
- address: address,
13085
- feeAsset: feeAsset,
13086
- currency: currency,
13087
- builder: this
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
13088
13166
  }));
13089
13167
  }
13090
13168
  }, _callee10, this);
@@ -13104,26 +13182,34 @@ var GeneralBuilder = /*#__PURE__*/function () {
13104
13182
  key: "verifyEdOnDestination",
13105
13183
  value: (function () {
13106
13184
  var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
13107
- var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
13185
+ var _this$_options8, from, to, address, currency, senderAddress, feeAsset, _t36, _t37, _t38, _t39, _t40, _t41, _t42, _t43, _t44;
13108
13186
  return _regenerator().w(function (_context11) {
13109
13187
  while (1) switch (_context11.n) {
13110
13188
  case 0:
13111
- _this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
13189
+ _this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, address = _this$_options8.address, currency = _this$_options8.currency, senderAddress = _this$_options8.senderAddress, feeAsset = _this$_options8.feeAsset;
13112
13190
  assertToIsString(to);
13113
13191
  assertAddressIsString(address);
13192
+ _t36 = verifyEdOnDestination;
13193
+ _t37 = this.api;
13114
13194
  _context11.n = 1;
13115
- return this.overrideTxAmount();
13195
+ return this.createTxs();
13116
13196
  case 1:
13117
- tx = _context11.v;
13118
- return _context11.a(2, verifyEdOnDestination({
13119
- api: this.api,
13120
- tx: tx,
13121
- origin: from,
13122
- destination: to,
13123
- address: address,
13124
- senderAddress: senderAddress,
13125
- feeAsset: feeAsset,
13126
- currency: currency
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
13127
13213
  }));
13128
13214
  }
13129
13215
  }, _callee11, this);
@@ -13143,27 +13229,36 @@ var GeneralBuilder = /*#__PURE__*/function () {
13143
13229
  key: "getTransferInfo",
13144
13230
  value: (function () {
13145
13231
  var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
13146
- var _this$_options0, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
13232
+ var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, _t45, _t46, _t47, _t48, _t49, _t50, _t51, _t52, _t53, _t54;
13147
13233
  return _regenerator().w(function (_context12) {
13148
13234
  while (1) switch (_context12.n) {
13149
13235
  case 0:
13150
- _this$_options0 = this._options, from = _this$_options0.from, to = _this$_options0.to, address = _this$_options0.address, currency = _this$_options0.currency, ahAddress = _this$_options0.ahAddress, senderAddress = _this$_options0.senderAddress, feeAsset = _this$_options0.feeAsset;
13236
+ _this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, ahAddress = _this$_options9.ahAddress, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
13151
13237
  assertToIsString(to);
13152
13238
  assertAddressIsString(address);
13239
+ _t45 = getTransferInfo;
13240
+ _t46 = this.api;
13153
13241
  _context12.n = 1;
13154
- return this.overrideTxAmount();
13242
+ return this.createTxs();
13155
13243
  case 1:
13156
- tx = _context12.v;
13157
- return _context12.a(2, getTransferInfo({
13158
- api: this.api,
13159
- tx: tx,
13160
- origin: from,
13161
- destination: to,
13162
- address: address,
13163
- senderAddress: senderAddress,
13164
- ahAddress: ahAddress,
13165
- currency: currency,
13166
- feeAsset: feeAsset
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
13167
13262
  }));
13168
13263
  }
13169
13264
  }, _callee12, this);
@@ -13242,6 +13337,7 @@ exports.calcPreviewMintAmount = calcPreviewMintAmount;
13242
13337
  exports.claimAssets = claimAssets;
13243
13338
  exports.computeFeeFromDryRun = computeFeeFromDryRun;
13244
13339
  exports.computeFeeFromDryRunPjs = computeFeeFromDryRunPjs;
13340
+ exports.computeOverridenAmount = computeOverridenAmount;
13245
13341
  exports.convertSs58 = convertSs58;
13246
13342
  exports.createAsset = createAsset;
13247
13343
  exports.createAssetsFilter = createAssetsFilter;
@@ -13252,6 +13348,7 @@ exports.createChainClient = createChainClient;
13252
13348
  exports.createDirectExecuteXcm = createDirectExecuteXcm;
13253
13349
  exports.createExecuteCall = createExecuteCall;
13254
13350
  exports.createExecuteExchangeXcm = createExecuteExchangeXcm;
13351
+ exports.createTxs = createTxs;
13255
13352
  exports.createTypeAndThenCall = createTypeAndThenCall;
13256
13353
  exports.createVersionedAssets = createVersionedAssets;
13257
13354
  exports.createX1Payload = createX1Payload;
@@ -13290,6 +13387,7 @@ exports.getTransferableAmount = getTransferableAmount;
13290
13387
  exports.getTransferableAmountInternal = getTransferableAmountInternal;
13291
13388
  exports.getXcmFee = getXcmFee;
13292
13389
  exports.getXcmFeeEstimate = getXcmFeeEstimate;
13390
+ exports.getXcmFeeInternal = getXcmFeeInternal;
13293
13391
  exports.handleExecuteTransfer = handleExecuteTransfer;
13294
13392
  exports.handleSwapExecuteTransfer = handleSwapExecuteTransfer;
13295
13393
  exports.handleToAhTeleport = handleToAhTeleport;
@@ -13297,6 +13395,7 @@ exports.isConfig = isConfig;
13297
13395
  exports.localizeLocation = localizeLocation;
13298
13396
  exports.maybeOverrideAsset = maybeOverrideAsset;
13299
13397
  exports.maybeOverrideAssets = maybeOverrideAssets;
13398
+ exports.overrideTxAmount = overrideTxAmount;
13300
13399
  exports.padFee = padFee;
13301
13400
  exports.padFeeBy = padFeeBy;
13302
13401
  exports.resolveDestChain = resolveDestChain;