@paraspell/sdk-core 11.6.0 → 11.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -726,6 +726,11 @@ var assertAddressIsString = function assertAddressIsString(address) {
726
726
  throw new InvalidParameterError('Location address is not supported for this transfer type.');
727
727
  }
728
728
  };
729
+ var assertSenderAddress = function assertSenderAddress(address) {
730
+ if (!address) {
731
+ throw new InvalidParameterError('Sender address parameter is required for this transfer.');
732
+ }
733
+ };
729
734
  var assertHasLocation = function assertHasLocation(asset) {
730
735
  if (!asset.location) {
731
736
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is missing location"));
@@ -823,7 +828,7 @@ var sortAssets = function sortAssets(assets$1) {
823
828
  var isConfig = function isConfig(value) {
824
829
  return _typeof(value) === 'object' && value !== null && !Array.isArray(value) && (
825
830
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
826
- Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value);
831
+ Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value || 'xcmFormatCheck' in value);
827
832
  };
828
833
 
829
834
  /**
@@ -3552,12 +3557,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
3552
3557
  while (1) switch (_context.n) {
3553
3558
  case 0:
3554
3559
  api = options.api, senderAddress = options.senderAddress, paraIdTo = options.paraIdTo, assetInfo = options.assetInfo, currency = options.currency, feeCurrency = options.feeCurrency, address = options.address, feeAssetInfo = options.feeAssetInfo, version = options.version;
3555
- if (senderAddress) {
3556
- _context.n = 1;
3557
- break;
3558
- }
3559
- throw new InvalidParameterError('Please provide senderAddress');
3560
- case 1:
3560
+ assertSenderAddress(senderAddress);
3561
3561
  assertAddressIsString(address);
3562
3562
  checkAmount = function checkAmount(fee) {
3563
3563
  if (assetInfo.amount <= fee) {
@@ -3588,7 +3588,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
3588
3588
  reserveFee: MIN_FEE
3589
3589
  }
3590
3590
  })), MAX_WEIGHT);
3591
- _context.n = 2;
3591
+ _context.n = 1;
3592
3592
  return dryRunInternal({
3593
3593
  api: api,
3594
3594
  tx: api.callTxMethod(call),
@@ -3600,14 +3600,14 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
3600
3600
  feeAsset: feeCurrency,
3601
3601
  useRootOrigin: true
3602
3602
  });
3603
- case 2:
3603
+ case 1:
3604
3604
  dryRunResult = _context.v;
3605
3605
  if (dryRunResult.origin.success) {
3606
- _context.n = 3;
3606
+ _context.n = 2;
3607
3607
  break;
3608
3608
  }
3609
3609
  throw new DryRunFailedError(dryRunResult.failureReason);
3610
- case 3:
3610
+ case 2:
3611
3611
  originFeeEstimate = dryRunResult.origin.fee;
3612
3612
  originFee = padFeeBy(originFeeEstimate, FEE_PADDING_PERCENTAGE$2);
3613
3613
  reserveFeeEstimate = getReserveFeeFromHops(dryRunResult.hops);
@@ -3619,9 +3619,9 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
3619
3619
  reserveFee: reserveFee
3620
3620
  }
3621
3621
  }));
3622
- _context.n = 4;
3622
+ _context.n = 3;
3623
3623
  return api.getXcmWeight(xcm);
3624
- case 4:
3624
+ case 3:
3625
3625
  weight = _context.v;
3626
3626
  return _context.a(2, createExecuteCall(chain, xcm, weight));
3627
3627
  }
@@ -3659,7 +3659,7 @@ var getReverseTxFee = /*#__PURE__*/function () {
3659
3659
  _context.n = 1;
3660
3660
  return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
3661
3661
  amount: currency.amount
3662
- })).build();
3662
+ }))['buildInternal']();
3663
3663
  case 1:
3664
3664
  tx = _context.v;
3665
3665
  _context.n = 2;
@@ -4152,7 +4152,7 @@ var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
4152
4152
  return api.init(origin);
4153
4153
  case 1:
4154
4154
  _context.n = 2;
4155
- return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress).build();
4155
+ return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)['buildInternal']();
4156
4156
  case 2:
4157
4157
  tx = _context.v;
4158
4158
  _context.n = 3;
@@ -4312,11 +4312,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
4312
4312
  };
4313
4313
  var getDestXcmFee = /*#__PURE__*/function () {
4314
4314
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
4315
- var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
4315
+ var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, swapConfig, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
4316
4316
  return _regenerator().w(function (_context2) {
4317
4317
  while (1) switch (_context2.n) {
4318
4318
  case 0:
4319
- api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, tx = options.tx, disableFallback = options.disableFallback;
4319
+ api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, tx = options.tx, disableFallback = options.disableFallback, swapConfig = options.swapConfig;
4320
4320
  resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
4321
4321
  calcPaymentInfoFee = /*#__PURE__*/function () {
4322
4322
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
@@ -4330,7 +4330,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
4330
4330
  }
4331
4331
  return _context.a(2, 0n);
4332
4332
  case 1:
4333
- originAsset = assets.findAssetInfoOrThrow(origin, currency, destination);
4333
+ originAsset = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? assets.findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, destination) : assets.findAssetInfoOrThrow(origin, currency, destination);
4334
4334
  if (!originAsset.location) {
4335
4335
  _context.n = 7;
4336
4336
  break;
@@ -4694,9 +4694,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
4694
4694
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is not a foreign asset"));
4695
4695
  }
4696
4696
  assertHasLocation(asset);
4697
- if (!senderAddress) {
4698
- throw new InvalidParameterError("Please provide senderAddress");
4699
- }
4697
+ assertSenderAddress(senderAddress);
4700
4698
  if (assets.isChainEvm(origin) && !ahAddress) {
4701
4699
  throw new InvalidParameterError("Please provide ahAddress");
4702
4700
  }
@@ -4966,18 +4964,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
4966
4964
  }
4967
4965
  });
4968
4966
  senderAddress = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
4969
- if (senderAddress) {
4970
- _context.n = 8;
4971
- break;
4972
- }
4973
- throw new InvalidParameterError('Unable to get sender address');
4967
+ assertSenderAddress(senderAddress);
4968
+ _context.n = 8;
4969
+ return api.init(from, TX_CLIENT_TIMEOUT_MS);
4974
4970
  case 8:
4975
4971
  _context.n = 9;
4976
- return api.init(from, TX_CLIENT_TIMEOUT_MS);
4977
- case 9:
4978
- _context.n = 10;
4979
4972
  return generateMessageId(api, senderAddress, getParaId(from), ethAsset.assetId, address, amount);
4980
- case 10:
4973
+ case 9:
4981
4974
  messageId = _context.v;
4982
4975
  customXcm = createCustomXcmOnDest({
4983
4976
  api: api,
@@ -4989,17 +4982,17 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
4989
4982
  }),
4990
4983
  version: sdkCommon.Version.V4
4991
4984
  }, from, messageId);
4992
- _context.n = 11;
4985
+ _context.n = 10;
4993
4986
  return api.objectToHex(customXcm, 'XcmVersionedXcm');
4994
- case 11:
4987
+ case 10:
4995
4988
  customXcmOnDest = _context.v;
4996
- _context.n = 12;
4989
+ _context.n = 11;
4997
4990
  return api.createApiForChain('AssetHubPolkadot');
4998
- case 12:
4991
+ case 11:
4999
4992
  assetHubApi = _context.v;
5000
- _context.n = 13;
4993
+ _context.n = 12;
5001
4994
  return getParaEthTransferFees(assetHubApi);
5002
- case 13:
4995
+ case 12:
5003
4996
  _yield$getParaEthTran = _context.v;
5004
4997
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
5005
4998
  bridgeFee = _yield$getParaEthTran2[0];
@@ -5014,7 +5007,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5014
5007
  throw new InvalidParameterError('Input must be a valid number');
5015
5008
  }() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
5016
5009
  }; // Execute the custom XCM message with the precompile
5017
- _context.n = 14;
5010
+ _context.n = 13;
5018
5011
  return createTx('transferAssetsUsingTypeAndThenAddress', [
5019
5012
  // This represents (1,X1(Parachain(1000)))
5020
5013
  [1, ['0x00' + numberToHex32(getParaId('AssetHubPolkadot')).slice(2)]],
@@ -5026,7 +5019,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
5026
5019
  0,
5027
5020
  // The TransferType corresponding to fee asset
5028
5021
  2, customXcmOnDest]);
5029
- case 14:
5022
+ case 13:
5030
5023
  tx = _context.v;
5031
5024
  return _context.a(2, tx);
5032
5025
  }
@@ -5765,13 +5758,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5765
5758
  }
5766
5759
  throw new InvalidParameterError('Location address is not supported for this scenario');
5767
5760
  case 2:
5768
- if (senderAddress) {
5769
- _context.n = 3;
5770
- break;
5771
- }
5772
- throw new InvalidParameterError("Please provide senderAddress");
5773
- case 3:
5774
- _context.n = 4;
5761
+ assertSenderAddress(senderAddress);
5762
+ _context.n = 3;
5775
5763
  return dryRunInternal({
5776
5764
  api: api,
5777
5765
  tx: defaultTx,
@@ -5781,19 +5769,19 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5781
5769
  address: address,
5782
5770
  currency: currency
5783
5771
  });
5784
- case 4:
5772
+ case 3:
5785
5773
  dryRunResult = _context.v;
5786
5774
  if (!((_dryRunResult$destina = dryRunResult.destination) !== null && _dryRunResult$destina !== void 0 && _dryRunResult$destina.success)) {
5787
- _context.n = 5;
5775
+ _context.n = 4;
5788
5776
  break;
5789
5777
  }
5790
5778
  return _context.a(2, defaultTx);
5791
- case 5:
5779
+ case 4:
5792
5780
  // If the default tx dry run failed, we need to create execute transaction
5793
5781
  dummyTx = createExecuteExchangeXcm(input, origin, MAX_WEIGHT,
5794
5782
  // Enter dummy fee values just to get the dry run to pass
5795
5783
  asset.amount, asset.amount / 2n);
5796
- _context.n = 6;
5784
+ _context.n = 5;
5797
5785
  return getXcmFee({
5798
5786
  api: api,
5799
5787
  tx: dummyTx,
@@ -5804,7 +5792,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
5804
5792
  currency: currency,
5805
5793
  disableFallback: false
5806
5794
  });
5807
- case 6:
5795
+ case 5:
5808
5796
  feeResult = _context.v;
5809
5797
  originExecutionFee = padFeeBy(feeResult.origin.fee, 20); // Pad by 20%
5810
5798
  destinationExecutionFee = padFeeBy(
@@ -6396,20 +6384,15 @@ var Parachain = /*#__PURE__*/function () {
6396
6384
  case 2:
6397
6385
  assertHasLocation(asset);
6398
6386
  assertAddressIsString(address);
6399
- if (!(senderAddress === undefined)) {
6400
- _context3.n = 3;
6401
- break;
6402
- }
6403
- throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
6404
- case 3:
6387
+ assertSenderAddress(senderAddress);
6405
6388
  ethAsset = createAsset(version, asset.amount, asset.location);
6406
- _context3.n = 4;
6389
+ _context3.n = 3;
6407
6390
  return api.createApiForChain('AssetHubPolkadot');
6408
- case 4:
6391
+ case 3:
6409
6392
  ahApi = _context3.v;
6410
- _context3.n = 5;
6393
+ _context3.n = 4;
6411
6394
  return getParaEthTransferFees(ahApi);
6412
- case 5:
6395
+ case 4:
6413
6396
  _yield$getParaEthTran = _context3.v;
6414
6397
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
6415
6398
  bridgeFee = _yield$getParaEthTran2[0];
@@ -6418,13 +6401,13 @@ var Parachain = /*#__PURE__*/function () {
6418
6401
  fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
6419
6402
  ethAssetInfo = assets.findAssetInfoByLoc(assets.getOtherAssets('Ethereum'), asset.location);
6420
6403
  if (ethAssetInfo) {
6421
- _context3.n = 6;
6404
+ _context3.n = 5;
6422
6405
  break;
6423
6406
  }
6424
6407
  throw new assets.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt)));
6425
- case 6:
6408
+ case 5:
6426
6409
  if (!useOnlyDepositInstruction) {
6427
- _context3.n = 7;
6410
+ _context3.n = 6;
6428
6411
  break;
6429
6412
  }
6430
6413
  customXcmOnDest = addXcmVersionHeader([{
@@ -6441,16 +6424,16 @@ var Parachain = /*#__PURE__*/function () {
6441
6424
  })
6442
6425
  }
6443
6426
  }], version);
6444
- _context3.n = 9;
6427
+ _context3.n = 8;
6445
6428
  break;
6446
- case 7:
6429
+ case 6:
6447
6430
  assertHasId(ethAssetInfo);
6448
- _context3.n = 8;
6431
+ _context3.n = 7;
6449
6432
  return generateMessageId(api, senderAddress, getParaId(this.chain), ethAssetInfo.assetId, address, asset.amount);
6450
- case 8:
6433
+ case 7:
6451
6434
  messageId = _context3.v;
6452
6435
  customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId);
6453
- case 9:
6436
+ case 8:
6454
6437
  call = {
6455
6438
  module: 'PolkadotXcm',
6456
6439
  method: 'transfer_assets_using_type_and_then',
@@ -6863,23 +6846,18 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
6863
6846
  }
6864
6847
  throw new BridgeHaltedError();
6865
6848
  case 2:
6866
- if (!(senderAddress === undefined)) {
6867
- _context.n = 3;
6868
- break;
6869
- }
6870
- throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
6871
- case 3:
6849
+ assertSenderAddress(senderAddress);
6872
6850
  if (!sdkCommon.isTLocation(address)) {
6873
- _context.n = 4;
6851
+ _context.n = 3;
6874
6852
  break;
6875
6853
  }
6876
6854
  throw new InvalidParameterError('Location address is not supported for Ethereum transfers');
6877
- case 4:
6855
+ case 3:
6878
6856
  assertIsForeign(asset);
6879
6857
  assertHasLocation(asset);
6880
- _context.n = 5;
6858
+ _context.n = 4;
6881
6859
  return generateMessageId(api, senderAddress, getParaId(this.chain), JSON.stringify(asset.location), address, asset.amount);
6882
- case 5:
6860
+ case 4:
6883
6861
  messageId = _context.v;
6884
6862
  location = asset.symbol === this.getNativeAssetSymbol() ? DOT_LOCATION : asset.location;
6885
6863
  call = {
@@ -8825,43 +8803,38 @@ var createTypeAndThenTransfer = /*#__PURE__*/function () {
8825
8803
  api = options.api, asset = options.assetInfo, senderAddress = options.senderAddress, address = options.address, destination = options.destination;
8826
8804
  assertHasLocation(asset);
8827
8805
  assertAddressIsString(address);
8828
- if (senderAddress) {
8829
- _context.n = 1;
8830
- break;
8831
- }
8832
- throw new assets.InvalidCurrencyError("Sender address is required for Mythos transfer");
8833
- case 1:
8806
+ assertSenderAddress(senderAddress);
8834
8807
  if (!(!assets.isForeignAsset(asset) || !asset.assetId)) {
8835
- _context.n = 2;
8808
+ _context.n = 1;
8836
8809
  break;
8837
8810
  }
8838
8811
  throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is not a foreign asset"));
8839
- case 2:
8840
- _context.n = 3;
8812
+ case 1:
8813
+ _context.n = 2;
8841
8814
  return generateMessageId(api, senderAddress, getParaId(chain), asset.assetId, address, asset.amount);
8842
- case 3:
8815
+ case 2:
8843
8816
  messageId = _context.v;
8844
8817
  ahApi = api.clone();
8845
- _context.n = 4;
8818
+ _context.n = 3;
8846
8819
  return ahApi.init('AssetHubPolkadot');
8847
- case 4:
8848
- _context.n = 5;
8820
+ case 3:
8821
+ _context.n = 4;
8849
8822
  return getParaEthTransferFees(ahApi);
8850
- case 5:
8823
+ case 4:
8851
8824
  _yield$getParaEthTran = _context.v;
8852
8825
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
8853
8826
  bridgeFee = _yield$getParaEthTran2[0];
8854
8827
  ahExecutionFee = _yield$getParaEthTran2[1];
8855
- _context.n = 6;
8828
+ _context.n = 5;
8856
8829
  return ahApi.quoteAhPrice(DOT_LOCATION, assets.getNativeAssets(chain)[0].location, bridgeFee + ahExecutionFee);
8857
- case 6:
8830
+ case 5:
8858
8831
  feeConverted = _context.v;
8859
8832
  if (feeConverted) {
8860
- _context.n = 7;
8833
+ _context.n = 6;
8861
8834
  break;
8862
8835
  }
8863
8836
  throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
8864
- case 7:
8837
+ case 6:
8865
8838
  nativeMythAmount = padFeeBy(feeConverted, 10);
8866
8839
  return _context.a(2, {
8867
8840
  module: 'PolkadotXcm',
@@ -9609,6 +9582,8 @@ var MAX_WEIGHT = {
9609
9582
  proofSize: MAX_U64,
9610
9583
  refTime: MAX_U64
9611
9584
  };
9585
+ var BYPASS_MINT_AMOUNT = '1000';
9586
+ var BYPASS_CURRENCY_AMOUNT = '800';
9612
9587
 
9613
9588
  var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
9614
9589
  var assets = options.assets,
@@ -9990,7 +9965,6 @@ var getPalletInstance = function getPalletInstance(type) {
9990
9965
  return new HandlerClass();
9991
9966
  };
9992
9967
 
9993
- var MINT_AMOUNT = 1000n; // Mint 1000 units of asset
9994
9968
  var getCurrencySelection = function getCurrencySelection(asset) {
9995
9969
  if (asset.location) return {
9996
9970
  location: asset.location
@@ -10023,7 +9997,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
10023
9997
  return palletInstance.mint(address, asset, balance, chain, api);
10024
9998
  };
10025
9999
  var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountHuman, balance, address, api) {
10026
- var amount = viem.parseUnits(amountHuman.toString(), asset.decimals);
10000
+ var amount = viem.parseUnits(amountHuman, asset.decimals);
10027
10001
  return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
10028
10002
  amount: amount
10029
10003
  }), balance, address, api);
@@ -10031,7 +10005,7 @@ var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountH
10031
10005
  var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
10032
10006
  var asset = assets.findAssetInfo(chain, currency, null);
10033
10007
  if (!asset) return null;
10034
- var amount = viem.parseUnits(amountHuman.toString(), asset.decimals);
10008
+ var amount = viem.parseUnits(amountHuman, asset.decimals);
10035
10009
  return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
10036
10010
  amount: amount
10037
10011
  }), balance, address, api);
@@ -10072,7 +10046,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
10072
10046
  });
10073
10047
  return preminted.some(function (a) {
10074
10048
  return assets.isAssetXcEqual(a, sent);
10075
- }) ? viem.parseUnits(MINT_AMOUNT.toString(), sent.decimals) : 0n;
10049
+ }) ? viem.parseUnits(BYPASS_MINT_AMOUNT, sent.decimals) : 0n;
10076
10050
  };
10077
10051
  var wrapTxBypass = /*#__PURE__*/function () {
10078
10052
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dryRunOptions) {
@@ -10128,7 +10102,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
10128
10102
  break;
10129
10103
  }
10130
10104
  _context.n = 1;
10131
- return createRequiredMintTxs(chain, assets.findNativeAssetInfoOrThrow(chain), MINT_AMOUNT, 0n, address, api);
10105
+ return createRequiredMintTxs(chain, assets.findNativeAssetInfoOrThrow(chain), BYPASS_MINT_AMOUNT, 0n, address, api);
10132
10106
  case 1:
10133
10107
  _t = _context.v;
10134
10108
  _context.n = 3;
@@ -10142,7 +10116,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
10142
10116
  break;
10143
10117
  }
10144
10118
  _context.n = 4;
10145
- return createOptionalMintTxs(chain, relayCurrency, MINT_AMOUNT, 0n, address, api);
10119
+ return createOptionalMintTxs(chain, relayCurrency, BYPASS_MINT_AMOUNT, 0n, address, api);
10146
10120
  case 4:
10147
10121
  _t2 = _context.v;
10148
10122
  _context.n = 6;
@@ -10155,7 +10129,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
10155
10129
  _context.n = 8;
10156
10130
  break;
10157
10131
  }
10158
- amount = viem.parseUnits(MINT_AMOUNT.toString(), feeAsset.decimals);
10132
+ amount = viem.parseUnits(BYPASS_MINT_AMOUNT, feeAsset.decimals);
10159
10133
  _context.n = 7;
10160
10134
  return createMintTxs(chain, _objectSpread2(_objectSpread2({}, feeAsset), {}, {
10161
10135
  amount: amount
@@ -10174,7 +10148,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
10174
10148
  balance = _context.v;
10175
10149
  bonus = mintBonusForSent(chain, asset, feeAsset, !!mintFeeAssets);
10176
10150
  if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
10177
- mintAmount = viem.parseUnits(MINT_AMOUNT.toString(), asset.decimals) + asset.amount;
10151
+ mintAmount = viem.parseUnits(BYPASS_MINT_AMOUNT, asset.decimals) + asset.amount;
10178
10152
  } else {
10179
10153
  missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, asset.amount)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
10180
10154
  total = missing + bonus;
@@ -10615,7 +10589,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
10615
10589
  tx: tx,
10616
10590
  originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
10617
10591
  senderAddress: senderAddress,
10618
- disableFallback: disableFallback
10592
+ disableFallback: disableFallback,
10593
+ swapConfig: swapConfig
10619
10594
  });
10620
10595
  case 4:
10621
10596
  destFeeRes = _context2.v;
@@ -11663,7 +11638,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11663
11638
  _t = dryRunInternal;
11664
11639
  _t2 = api;
11665
11640
  _context.n = 4;
11666
- return modifiedBuilder.build();
11641
+ return modifiedBuilder['buildInternal']();
11667
11642
  case 4:
11668
11643
  _t3 = _context.v;
11669
11644
  _t4 = chain;
@@ -11691,7 +11666,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11691
11666
  _context.n = 6;
11692
11667
  break;
11693
11668
  }
11694
- throw new DryRunFailedError('Not enough balance for XCM');
11669
+ return _context.a(2, 0n);
11695
11670
  case 6:
11696
11671
  return _context.a(2, minAmount);
11697
11672
  }
@@ -11850,7 +11825,7 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(_ref, isDotAsset, custo
11850
11825
  };
11851
11826
 
11852
11827
  var FEE_PADDING_PERCENTAGE = 20;
11853
- var FEE_PADDING_HYDRATION = 150;
11828
+ var FEE_PADDING_HYDRATION = 500;
11854
11829
  var computeInstructionFee = /*#__PURE__*/function () {
11855
11830
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, version, xcm) {
11856
11831
  var chain, api, _t;
@@ -12649,60 +12624,156 @@ var GeneralBuilder = /*#__PURE__*/function () {
12649
12624
  return _buildBatch.apply(this, arguments);
12650
12625
  }
12651
12626
  return buildBatch;
12652
- }()
12627
+ }())
12628
+ }, {
12629
+ key: "buildInternal",
12630
+ value: function buildInternal() {
12631
+ return this.buildCommon(true);
12632
+ }
12653
12633
  /**
12654
12634
  * Builds and returns the transfer extrinsic.
12655
12635
  *
12656
12636
  * @returns A Promise that resolves to the transfer extrinsic.
12657
12637
  */
12658
- )
12659
12638
  }, {
12660
12639
  key: "build",
12661
12640
  value: (function () {
12662
12641
  var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
12663
- var _this$_options, from, to;
12664
12642
  return _regenerator().w(function (_context2) {
12665
12643
  while (1) switch (_context2.n) {
12666
12644
  case 0:
12645
+ return _context2.a(2, this.buildCommon());
12646
+ }
12647
+ }, _callee2, this);
12648
+ }));
12649
+ function build() {
12650
+ return _build.apply(this, arguments);
12651
+ }
12652
+ return build;
12653
+ }())
12654
+ }, {
12655
+ key: "buildCommon",
12656
+ value: function () {
12657
+ var _buildCommon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
12658
+ var isCalledInternally,
12659
+ _this$_options,
12660
+ from,
12661
+ to,
12662
+ tx,
12663
+ _args3 = arguments;
12664
+ return _regenerator().w(function (_context3) {
12665
+ while (1) switch (_context3.n) {
12666
+ case 0:
12667
+ isCalledInternally = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
12667
12668
  if (this.batchManager.isEmpty()) {
12668
- _context2.n = 1;
12669
+ _context3.n = 1;
12669
12670
  break;
12670
12671
  }
12671
12672
  throw new InvalidParameterError('Transaction manager contains batched items. Use buildBatch() to process them.');
12672
12673
  case 1:
12673
12674
  _this$_options = this._options, from = _this$_options.from, to = _this$_options.to;
12674
12675
  if (!(!sdkCommon.isTLocation(to) && sdkCommon.isRelayChain(from) && sdkCommon.isRelayChain(to) && from !== to)) {
12675
- _context2.n = 2;
12676
+ _context3.n = 2;
12676
12677
  break;
12677
12678
  }
12678
12679
  throw new InvalidParameterError('Transfers between relay chains are not yet supported.');
12679
12680
  case 2:
12680
- return _context2.a(2, send(_objectSpread2({
12681
+ _context3.n = 3;
12682
+ return send(_objectSpread2({
12681
12683
  api: this.api
12682
- }, this._options)));
12684
+ }, this._options));
12685
+ case 3:
12686
+ tx = _context3.v;
12687
+ _context3.n = 4;
12688
+ return this.maybePerformXcmFormatCheck(tx, this._options, isCalledInternally);
12689
+ case 4:
12690
+ return _context3.a(2, tx);
12683
12691
  }
12684
- }, _callee2, this);
12692
+ }, _callee3, this);
12685
12693
  }));
12686
- function build() {
12687
- return _build.apply(this, arguments);
12694
+ function buildCommon() {
12695
+ return _buildCommon.apply(this, arguments);
12688
12696
  }
12689
- return build;
12690
- }())
12697
+ return buildCommon;
12698
+ }()
12699
+ }, {
12700
+ key: "maybePerformXcmFormatCheck",
12701
+ value: function () {
12702
+ var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(tx, options, isCalledInternally) {
12703
+ var senderAddress, config, dryRunResult;
12704
+ return _regenerator().w(function (_context4) {
12705
+ while (1) switch (_context4.n) {
12706
+ case 0:
12707
+ senderAddress = options.senderAddress;
12708
+ config = this.api.getConfig();
12709
+ if (!(isConfig(config) && config.xcmFormatCheck && !isCalledInternally)) {
12710
+ _context4.n = 2;
12711
+ break;
12712
+ }
12713
+ assertSenderAddress(senderAddress);
12714
+ _context4.n = 1;
12715
+ return buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
12716
+ senderAddress: senderAddress
12717
+ }), {
12718
+ sentAssetMintMode: 'bypass'
12719
+ });
12720
+ case 1:
12721
+ dryRunResult = _context4.v;
12722
+ if (!dryRunResult.failureReason) {
12723
+ _context4.n = 2;
12724
+ break;
12725
+ }
12726
+ throw new DryRunFailedError(dryRunResult.failureReason, dryRunResult.failureChain);
12727
+ case 2:
12728
+ return _context4.a(2);
12729
+ }
12730
+ }, _callee4, this);
12731
+ }));
12732
+ function maybePerformXcmFormatCheck(_x2, _x3, _x4) {
12733
+ return _maybePerformXcmFormatCheck.apply(this, arguments);
12734
+ }
12735
+ return maybePerformXcmFormatCheck;
12736
+ }()
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
+ }
12691
12762
  }, {
12692
12763
  key: "dryRun",
12693
12764
  value: function () {
12694
- var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
12765
+ var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
12695
12766
  var tx;
12696
- return _regenerator().w(function (_context3) {
12697
- while (1) switch (_context3.n) {
12767
+ return _regenerator().w(function (_context5) {
12768
+ while (1) switch (_context5.n) {
12698
12769
  case 0:
12699
- _context3.n = 1;
12700
- return this.build();
12770
+ _context5.n = 1;
12771
+ return this.buildInternal();
12701
12772
  case 1:
12702
- tx = _context3.v;
12703
- return _context3.a(2, buildDryRun(this.api, tx, this._options));
12773
+ tx = _context5.v;
12774
+ return _context5.a(2, buildDryRun(this.api, tx, this._options));
12704
12775
  }
12705
- }, _callee3, this);
12776
+ }, _callee5, this);
12706
12777
  }));
12707
12778
  function dryRun() {
12708
12779
  return _dryRun.apply(this, arguments);
@@ -12712,23 +12783,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
12712
12783
  }, {
12713
12784
  key: "dryRunPreview",
12714
12785
  value: function () {
12715
- var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
12786
+ var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(options) {
12716
12787
  var tx;
12717
- return _regenerator().w(function (_context4) {
12718
- while (1) switch (_context4.n) {
12788
+ return _regenerator().w(function (_context6) {
12789
+ while (1) switch (_context6.n) {
12719
12790
  case 0:
12720
- _context4.n = 1;
12721
- return this.build();
12791
+ _context6.n = 1;
12792
+ return this.buildInternal();
12722
12793
  case 1:
12723
- tx = _context4.v;
12724
- return _context4.a(2, buildDryRun(this.api, tx, this._options, {
12794
+ tx = _context6.v;
12795
+ return _context6.a(2, buildDryRun(this.api, tx, this._options, {
12725
12796
  sentAssetMintMode: 'preview',
12726
12797
  mintFeeAssets: options === null || options === void 0 ? void 0 : options.mintFeeAssets
12727
12798
  }));
12728
12799
  }
12729
- }, _callee4, this);
12800
+ }, _callee6, this);
12730
12801
  }));
12731
- function dryRunPreview(_x2) {
12802
+ function dryRunPreview(_x5) {
12732
12803
  return _dryRunPreview.apply(this, arguments);
12733
12804
  }
12734
12805
  return dryRunPreview;
@@ -12741,22 +12812,22 @@ var GeneralBuilder = /*#__PURE__*/function () {
12741
12812
  }, {
12742
12813
  key: "getXcmFee",
12743
12814
  value: (function () {
12744
- var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(options) {
12815
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
12745
12816
  var _options$disableFallb;
12746
- var _this$_options2, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
12747
- return _regenerator().w(function (_context5) {
12748
- while (1) switch (_context5.p = _context5.n) {
12817
+ var _this$_options3, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
12818
+ return _regenerator().w(function (_context7) {
12819
+ while (1) switch (_context7.p = _context7.n) {
12749
12820
  case 0:
12750
- _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;
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;
12751
12822
  assertToIsString(to);
12752
12823
  assertAddressIsString(address);
12753
- _context5.n = 1;
12754
- return this.build();
12824
+ _context7.n = 1;
12825
+ return this.overrideTxAmount();
12755
12826
  case 1:
12756
- tx = _context5.v;
12827
+ tx = _context7.v;
12757
12828
  disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
12758
- _context5.p = 2;
12759
- _context5.n = 3;
12829
+ _context7.p = 2;
12830
+ _context7.n = 3;
12760
12831
  return getXcmFee({
12761
12832
  api: this.api,
12762
12833
  tx: tx,
@@ -12769,19 +12840,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
12769
12840
  disableFallback: disableFallback
12770
12841
  });
12771
12842
  case 3:
12772
- return _context5.a(2, _context5.v);
12843
+ return _context7.a(2, _context7.v);
12773
12844
  case 4:
12774
- _context5.p = 4;
12775
- _context5.n = 5;
12845
+ _context7.p = 4;
12846
+ _context7.n = 5;
12776
12847
  return this.api.disconnect();
12777
12848
  case 5:
12778
- return _context5.f(4);
12849
+ return _context7.f(4);
12779
12850
  case 6:
12780
- return _context5.a(2);
12851
+ return _context7.a(2);
12781
12852
  }
12782
- }, _callee5, this, [[2,, 4, 6]]);
12853
+ }, _callee7, this, [[2,, 4, 6]]);
12783
12854
  }));
12784
- function getXcmFee$1(_x3) {
12855
+ function getXcmFee$1(_x6) {
12785
12856
  return _getXcmFee2.apply(this, arguments);
12786
12857
  }
12787
12858
  return getXcmFee$1;
@@ -12795,31 +12866,31 @@ var GeneralBuilder = /*#__PURE__*/function () {
12795
12866
  }, {
12796
12867
  key: "getOriginXcmFee",
12797
12868
  value: (function () {
12798
- var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
12869
+ var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
12799
12870
  var _ref,
12800
12871
  disableFallback,
12801
- _this$_options3,
12872
+ _this$_options4,
12802
12873
  from,
12803
12874
  to,
12804
12875
  senderAddress,
12805
12876
  currency,
12806
12877
  feeAsset,
12807
12878
  tx,
12808
- _args6 = arguments;
12809
- return _regenerator().w(function (_context6) {
12810
- while (1) switch (_context6.p = _context6.n) {
12879
+ _args8 = arguments;
12880
+ return _regenerator().w(function (_context8) {
12881
+ while (1) switch (_context8.p = _context8.n) {
12811
12882
  case 0:
12812
- _ref = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {
12883
+ _ref = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {
12813
12884
  disableFallback: false
12814
12885
  }, disableFallback = _ref.disableFallback;
12815
- _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, senderAddress = _this$_options3.senderAddress, currency = _this$_options3.currency, feeAsset = _this$_options3.feeAsset;
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;
12816
12887
  assertToIsString(to);
12817
- _context6.n = 1;
12818
- return this.build();
12888
+ _context8.n = 1;
12889
+ return this.overrideTxAmount();
12819
12890
  case 1:
12820
- tx = _context6.v;
12821
- _context6.p = 2;
12822
- _context6.n = 3;
12891
+ tx = _context8.v;
12892
+ _context8.p = 2;
12893
+ _context8.n = 3;
12823
12894
  return getOriginXcmFee({
12824
12895
  api: this.api,
12825
12896
  tx: tx,
@@ -12831,17 +12902,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
12831
12902
  disableFallback: disableFallback
12832
12903
  });
12833
12904
  case 3:
12834
- return _context6.a(2, _context6.v);
12905
+ return _context8.a(2, _context8.v);
12835
12906
  case 4:
12836
- _context6.p = 4;
12837
- _context6.n = 5;
12907
+ _context8.p = 4;
12908
+ _context8.n = 5;
12838
12909
  return this.api.disconnect();
12839
12910
  case 5:
12840
- return _context6.f(4);
12911
+ return _context8.f(4);
12841
12912
  case 6:
12842
- return _context6.a(2);
12913
+ return _context8.a(2);
12843
12914
  }
12844
- }, _callee6, this, [[2,, 4, 6]]);
12915
+ }, _callee8, this, [[2,, 4, 6]]);
12845
12916
  }));
12846
12917
  function getOriginXcmFee$1() {
12847
12918
  return _getOriginXcmFee2.apply(this, arguments);
@@ -12857,20 +12928,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
12857
12928
  }, {
12858
12929
  key: "getXcmFeeEstimate",
12859
12930
  value: (function () {
12860
- var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
12861
- var _this$_options4, from, to, address, senderAddress, currency, tx;
12862
- return _regenerator().w(function (_context7) {
12863
- while (1) switch (_context7.p = _context7.n) {
12931
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
12932
+ var _this$_options5, from, to, address, senderAddress, currency, tx;
12933
+ return _regenerator().w(function (_context9) {
12934
+ while (1) switch (_context9.p = _context9.n) {
12864
12935
  case 0:
12865
- _this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, address = _this$_options4.address, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency;
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;
12866
12937
  assertToIsString(to);
12867
12938
  assertAddressIsString(address);
12868
- _context7.n = 1;
12869
- return this.build();
12939
+ _context9.n = 1;
12940
+ return this.buildInternal();
12870
12941
  case 1:
12871
- tx = _context7.v;
12872
- _context7.p = 2;
12873
- _context7.n = 3;
12942
+ tx = _context9.v;
12943
+ _context9.p = 2;
12944
+ _context9.n = 3;
12874
12945
  return getXcmFeeEstimate({
12875
12946
  api: this.api,
12876
12947
  tx: tx,
@@ -12881,17 +12952,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
12881
12952
  currency: currency
12882
12953
  });
12883
12954
  case 3:
12884
- return _context7.a(2, _context7.v);
12955
+ return _context9.a(2, _context9.v);
12885
12956
  case 4:
12886
- _context7.p = 4;
12887
- _context7.n = 5;
12957
+ _context9.p = 4;
12958
+ _context9.n = 5;
12888
12959
  return this.api.disconnect();
12889
12960
  case 5:
12890
- return _context7.f(4);
12961
+ return _context9.f(4);
12891
12962
  case 6:
12892
- return _context7.a(2);
12963
+ return _context9.a(2);
12893
12964
  }
12894
- }, _callee7, this, [[2,, 4, 6]]);
12965
+ }, _callee9, this, [[2,, 4, 6]]);
12895
12966
  }));
12896
12967
  function getXcmFeeEstimate$1() {
12897
12968
  return _getXcmFeeEstimate2.apply(this, arguments);
@@ -12907,19 +12978,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
12907
12978
  }, {
12908
12979
  key: "getOriginXcmFeeEstimate",
12909
12980
  value: (function () {
12910
- var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
12911
- var _this$_options5, from, to, senderAddress, currency, tx;
12912
- return _regenerator().w(function (_context8) {
12913
- while (1) switch (_context8.p = _context8.n) {
12981
+ var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
12982
+ var _this$_options6, from, to, senderAddress, currency, tx;
12983
+ return _regenerator().w(function (_context0) {
12984
+ while (1) switch (_context0.p = _context0.n) {
12914
12985
  case 0:
12915
- _this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
12986
+ _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency;
12916
12987
  assertToIsString(to);
12917
- _context8.n = 1;
12918
- return this.build();
12988
+ _context0.n = 1;
12989
+ return this.buildInternal();
12919
12990
  case 1:
12920
- tx = _context8.v;
12921
- _context8.p = 2;
12922
- _context8.n = 3;
12991
+ tx = _context0.v;
12992
+ _context0.p = 2;
12993
+ _context0.n = 3;
12923
12994
  return getOriginXcmFeeEstimate({
12924
12995
  api: this.api,
12925
12996
  tx: tx,
@@ -12929,17 +13000,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
12929
13000
  senderAddress: senderAddress
12930
13001
  });
12931
13002
  case 3:
12932
- return _context8.a(2, _context8.v);
13003
+ return _context0.a(2, _context0.v);
12933
13004
  case 4:
12934
- _context8.p = 4;
12935
- _context8.n = 5;
13005
+ _context0.p = 4;
13006
+ _context0.n = 5;
12936
13007
  return this.api.disconnect();
12937
13008
  case 5:
12938
- return _context8.f(4);
13009
+ return _context0.f(4);
12939
13010
  case 6:
12940
- return _context8.a(2);
13011
+ return _context0.a(2);
12941
13012
  }
12942
- }, _callee8, this, [[2,, 4, 6]]);
13013
+ }, _callee0, this, [[2,, 4, 6]]);
12943
13014
  }));
12944
13015
  function getOriginXcmFeeEstimate$1() {
12945
13016
  return _getOriginXcmFeeEstimate2.apply(this, arguments);
@@ -12955,18 +13026,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
12955
13026
  }, {
12956
13027
  key: "getTransferableAmount",
12957
13028
  value: (function () {
12958
- var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
12959
- var _this$_options6, from, to, senderAddress, currency, feeAsset, tx;
12960
- return _regenerator().w(function (_context9) {
12961
- while (1) switch (_context9.n) {
13029
+ var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
13030
+ var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
13031
+ return _regenerator().w(function (_context1) {
13032
+ while (1) switch (_context1.n) {
12962
13033
  case 0:
12963
- _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
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;
12964
13035
  assertToIsString(to);
12965
- _context9.n = 1;
12966
- return this.build();
13036
+ _context1.n = 1;
13037
+ return this.overrideTxAmount();
12967
13038
  case 1:
12968
- tx = _context9.v;
12969
- return _context9.a(2, getTransferableAmount({
13039
+ tx = _context1.v;
13040
+ return _context1.a(2, getTransferableAmount({
12970
13041
  api: this.api,
12971
13042
  tx: tx,
12972
13043
  origin: from,
@@ -12976,7 +13047,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12976
13047
  currency: currency
12977
13048
  }));
12978
13049
  }
12979
- }, _callee9, this);
13050
+ }, _callee1, this);
12980
13051
  }));
12981
13052
  function getTransferableAmount$1() {
12982
13053
  return _getTransferableAmount2.apply(this, arguments);
@@ -12992,19 +13063,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
12992
13063
  }, {
12993
13064
  key: "getMinTransferableAmount",
12994
13065
  value: (function () {
12995
- var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
12996
- var _this$_options7, from, to, senderAddress, address, currency, feeAsset, tx;
12997
- return _regenerator().w(function (_context0) {
12998
- while (1) switch (_context0.n) {
13066
+ var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13067
+ var _this$_options8, from, to, senderAddress, address, currency, feeAsset, tx;
13068
+ return _regenerator().w(function (_context10) {
13069
+ while (1) switch (_context10.n) {
12999
13070
  case 0:
13000
- _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;
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;
13001
13072
  assertToIsString(to);
13002
13073
  assertAddressIsString(address);
13003
- _context0.n = 1;
13004
- return this.build();
13074
+ _context10.n = 1;
13075
+ return this.overrideTxAmount();
13005
13076
  case 1:
13006
- tx = _context0.v;
13007
- return _context0.a(2, getMinTransferableAmount({
13077
+ tx = _context10.v;
13078
+ return _context10.a(2, getMinTransferableAmount({
13008
13079
  api: this.api,
13009
13080
  tx: tx,
13010
13081
  origin: from,
@@ -13016,7 +13087,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13016
13087
  builder: this
13017
13088
  }));
13018
13089
  }
13019
- }, _callee0, this);
13090
+ }, _callee10, this);
13020
13091
  }));
13021
13092
  function getMinTransferableAmount$1() {
13022
13093
  return _getMinTransferableAmount2.apply(this, arguments);
@@ -13032,19 +13103,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
13032
13103
  }, {
13033
13104
  key: "verifyEdOnDestination",
13034
13105
  value: (function () {
13035
- var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
13036
- var _this$_options8, from, to, address, currency, senderAddress, feeAsset, tx;
13037
- return _regenerator().w(function (_context1) {
13038
- while (1) switch (_context1.n) {
13106
+ var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
13107
+ var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
13108
+ return _regenerator().w(function (_context11) {
13109
+ while (1) switch (_context11.n) {
13039
13110
  case 0:
13040
- _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;
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;
13041
13112
  assertToIsString(to);
13042
13113
  assertAddressIsString(address);
13043
- _context1.n = 1;
13044
- return this.build();
13114
+ _context11.n = 1;
13115
+ return this.overrideTxAmount();
13045
13116
  case 1:
13046
- tx = _context1.v;
13047
- return _context1.a(2, verifyEdOnDestination({
13117
+ tx = _context11.v;
13118
+ return _context11.a(2, verifyEdOnDestination({
13048
13119
  api: this.api,
13049
13120
  tx: tx,
13050
13121
  origin: from,
@@ -13055,7 +13126,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13055
13126
  currency: currency
13056
13127
  }));
13057
13128
  }
13058
- }, _callee1, this);
13129
+ }, _callee11, this);
13059
13130
  }));
13060
13131
  function verifyEdOnDestination$1() {
13061
13132
  return _verifyEdOnDestination2.apply(this, arguments);
@@ -13071,19 +13142,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
13071
13142
  }, {
13072
13143
  key: "getTransferInfo",
13073
13144
  value: (function () {
13074
- var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13075
- var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
13076
- return _regenerator().w(function (_context10) {
13077
- while (1) switch (_context10.n) {
13145
+ var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
13146
+ var _this$_options0, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
13147
+ return _regenerator().w(function (_context12) {
13148
+ while (1) switch (_context12.n) {
13078
13149
  case 0:
13079
- _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;
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;
13080
13151
  assertToIsString(to);
13081
13152
  assertAddressIsString(address);
13082
- _context10.n = 1;
13083
- return this.build();
13153
+ _context12.n = 1;
13154
+ return this.overrideTxAmount();
13084
13155
  case 1:
13085
- tx = _context10.v;
13086
- return _context10.a(2, getTransferInfo({
13156
+ tx = _context12.v;
13157
+ return _context12.a(2, getTransferInfo({
13087
13158
  api: this.api,
13088
13159
  tx: tx,
13089
13160
  origin: from,
@@ -13095,7 +13166,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13095
13166
  feeAsset: feeAsset
13096
13167
  }));
13097
13168
  }
13098
- }, _callee10, this);
13169
+ }, _callee12, this);
13099
13170
  }));
13100
13171
  function getTransferInfo$1() {
13101
13172
  return _getTransferInfo2.apply(this, arguments);
@@ -13163,6 +13234,7 @@ exports.assertAddressIsString = assertAddressIsString;
13163
13234
  exports.assertHasId = assertHasId;
13164
13235
  exports.assertHasLocation = assertHasLocation;
13165
13236
  exports.assertIsForeign = assertIsForeign;
13237
+ exports.assertSenderAddress = assertSenderAddress;
13166
13238
  exports.assertToIsString = assertToIsString;
13167
13239
  exports.blake2b256 = blake2b256;
13168
13240
  exports.blake2b512 = blake2b512;