@paraspell/sdk-core 11.6.1 → 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;
@@ -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',
@@ -11665,7 +11638,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
11665
11638
  _t = dryRunInternal;
11666
11639
  _t2 = api;
11667
11640
  _context.n = 4;
11668
- return modifiedBuilder.build();
11641
+ return modifiedBuilder['buildInternal']();
11669
11642
  case 4:
11670
11643
  _t3 = _context.v;
11671
11644
  _t4 = chain;
@@ -11852,7 +11825,7 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(_ref, isDotAsset, custo
11852
11825
  };
11853
11826
 
11854
11827
  var FEE_PADDING_PERCENTAGE = 20;
11855
- var FEE_PADDING_HYDRATION = 150;
11828
+ var FEE_PADDING_HYDRATION = 500;
11856
11829
  var computeInstructionFee = /*#__PURE__*/function () {
11857
11830
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, version, xcm) {
11858
11831
  var chain, api, _t;
@@ -12651,45 +12624,116 @@ var GeneralBuilder = /*#__PURE__*/function () {
12651
12624
  return _buildBatch.apply(this, arguments);
12652
12625
  }
12653
12626
  return buildBatch;
12654
- }()
12627
+ }())
12628
+ }, {
12629
+ key: "buildInternal",
12630
+ value: function buildInternal() {
12631
+ return this.buildCommon(true);
12632
+ }
12655
12633
  /**
12656
12634
  * Builds and returns the transfer extrinsic.
12657
12635
  *
12658
12636
  * @returns A Promise that resolves to the transfer extrinsic.
12659
12637
  */
12660
- )
12661
12638
  }, {
12662
12639
  key: "build",
12663
12640
  value: (function () {
12664
12641
  var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
12665
- var _this$_options, from, to;
12666
12642
  return _regenerator().w(function (_context2) {
12667
12643
  while (1) switch (_context2.n) {
12668
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;
12669
12668
  if (this.batchManager.isEmpty()) {
12670
- _context2.n = 1;
12669
+ _context3.n = 1;
12671
12670
  break;
12672
12671
  }
12673
12672
  throw new InvalidParameterError('Transaction manager contains batched items. Use buildBatch() to process them.');
12674
12673
  case 1:
12675
12674
  _this$_options = this._options, from = _this$_options.from, to = _this$_options.to;
12676
12675
  if (!(!sdkCommon.isTLocation(to) && sdkCommon.isRelayChain(from) && sdkCommon.isRelayChain(to) && from !== to)) {
12677
- _context2.n = 2;
12676
+ _context3.n = 2;
12678
12677
  break;
12679
12678
  }
12680
12679
  throw new InvalidParameterError('Transfers between relay chains are not yet supported.');
12681
12680
  case 2:
12682
- return _context2.a(2, send(_objectSpread2({
12681
+ _context3.n = 3;
12682
+ return send(_objectSpread2({
12683
12683
  api: this.api
12684
- }, 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);
12685
12691
  }
12686
- }, _callee2, this);
12692
+ }, _callee3, this);
12687
12693
  }));
12688
- function build() {
12689
- return _build.apply(this, arguments);
12694
+ function buildCommon() {
12695
+ return _buildCommon.apply(this, arguments);
12690
12696
  }
12691
- return build;
12692
- }())
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
+ }()
12693
12737
  }, {
12694
12738
  key: "computeOverridenAmount",
12695
12739
  value: function computeOverridenAmount() {
@@ -12713,23 +12757,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
12713
12757
  var modifiedBuilder = this.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
12714
12758
  amount: this.computeOverridenAmount()
12715
12759
  }));
12716
- return modifiedBuilder.build();
12760
+ return modifiedBuilder.buildInternal();
12717
12761
  }
12718
12762
  }, {
12719
12763
  key: "dryRun",
12720
12764
  value: function () {
12721
- var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
12765
+ var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
12722
12766
  var tx;
12723
- return _regenerator().w(function (_context3) {
12724
- while (1) switch (_context3.n) {
12767
+ return _regenerator().w(function (_context5) {
12768
+ while (1) switch (_context5.n) {
12725
12769
  case 0:
12726
- _context3.n = 1;
12727
- return this.build();
12770
+ _context5.n = 1;
12771
+ return this.buildInternal();
12728
12772
  case 1:
12729
- tx = _context3.v;
12730
- 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));
12731
12775
  }
12732
- }, _callee3, this);
12776
+ }, _callee5, this);
12733
12777
  }));
12734
12778
  function dryRun() {
12735
12779
  return _dryRun.apply(this, arguments);
@@ -12739,23 +12783,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
12739
12783
  }, {
12740
12784
  key: "dryRunPreview",
12741
12785
  value: function () {
12742
- var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
12786
+ var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(options) {
12743
12787
  var tx;
12744
- return _regenerator().w(function (_context4) {
12745
- while (1) switch (_context4.n) {
12788
+ return _regenerator().w(function (_context6) {
12789
+ while (1) switch (_context6.n) {
12746
12790
  case 0:
12747
- _context4.n = 1;
12748
- return this.build();
12791
+ _context6.n = 1;
12792
+ return this.buildInternal();
12749
12793
  case 1:
12750
- tx = _context4.v;
12751
- 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, {
12752
12796
  sentAssetMintMode: 'preview',
12753
12797
  mintFeeAssets: options === null || options === void 0 ? void 0 : options.mintFeeAssets
12754
12798
  }));
12755
12799
  }
12756
- }, _callee4, this);
12800
+ }, _callee6, this);
12757
12801
  }));
12758
- function dryRunPreview(_x2) {
12802
+ function dryRunPreview(_x5) {
12759
12803
  return _dryRunPreview.apply(this, arguments);
12760
12804
  }
12761
12805
  return dryRunPreview;
@@ -12768,22 +12812,22 @@ var GeneralBuilder = /*#__PURE__*/function () {
12768
12812
  }, {
12769
12813
  key: "getXcmFee",
12770
12814
  value: (function () {
12771
- var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(options) {
12815
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
12772
12816
  var _options$disableFallb;
12773
12817
  var _this$_options3, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
12774
- return _regenerator().w(function (_context5) {
12775
- while (1) switch (_context5.p = _context5.n) {
12818
+ return _regenerator().w(function (_context7) {
12819
+ while (1) switch (_context7.p = _context7.n) {
12776
12820
  case 0:
12777
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;
12778
12822
  assertToIsString(to);
12779
12823
  assertAddressIsString(address);
12780
- _context5.n = 1;
12824
+ _context7.n = 1;
12781
12825
  return this.overrideTxAmount();
12782
12826
  case 1:
12783
- tx = _context5.v;
12827
+ tx = _context7.v;
12784
12828
  disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
12785
- _context5.p = 2;
12786
- _context5.n = 3;
12829
+ _context7.p = 2;
12830
+ _context7.n = 3;
12787
12831
  return getXcmFee({
12788
12832
  api: this.api,
12789
12833
  tx: tx,
@@ -12796,19 +12840,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
12796
12840
  disableFallback: disableFallback
12797
12841
  });
12798
12842
  case 3:
12799
- return _context5.a(2, _context5.v);
12843
+ return _context7.a(2, _context7.v);
12800
12844
  case 4:
12801
- _context5.p = 4;
12802
- _context5.n = 5;
12845
+ _context7.p = 4;
12846
+ _context7.n = 5;
12803
12847
  return this.api.disconnect();
12804
12848
  case 5:
12805
- return _context5.f(4);
12849
+ return _context7.f(4);
12806
12850
  case 6:
12807
- return _context5.a(2);
12851
+ return _context7.a(2);
12808
12852
  }
12809
- }, _callee5, this, [[2,, 4, 6]]);
12853
+ }, _callee7, this, [[2,, 4, 6]]);
12810
12854
  }));
12811
- function getXcmFee$1(_x3) {
12855
+ function getXcmFee$1(_x6) {
12812
12856
  return _getXcmFee2.apply(this, arguments);
12813
12857
  }
12814
12858
  return getXcmFee$1;
@@ -12822,7 +12866,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
12822
12866
  }, {
12823
12867
  key: "getOriginXcmFee",
12824
12868
  value: (function () {
12825
- var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
12869
+ var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
12826
12870
  var _ref,
12827
12871
  disableFallback,
12828
12872
  _this$_options4,
@@ -12832,21 +12876,21 @@ var GeneralBuilder = /*#__PURE__*/function () {
12832
12876
  currency,
12833
12877
  feeAsset,
12834
12878
  tx,
12835
- _args6 = arguments;
12836
- return _regenerator().w(function (_context6) {
12837
- while (1) switch (_context6.p = _context6.n) {
12879
+ _args8 = arguments;
12880
+ return _regenerator().w(function (_context8) {
12881
+ while (1) switch (_context8.p = _context8.n) {
12838
12882
  case 0:
12839
- _ref = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {
12883
+ _ref = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {
12840
12884
  disableFallback: false
12841
12885
  }, disableFallback = _ref.disableFallback;
12842
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;
12843
12887
  assertToIsString(to);
12844
- _context6.n = 1;
12888
+ _context8.n = 1;
12845
12889
  return this.overrideTxAmount();
12846
12890
  case 1:
12847
- tx = _context6.v;
12848
- _context6.p = 2;
12849
- _context6.n = 3;
12891
+ tx = _context8.v;
12892
+ _context8.p = 2;
12893
+ _context8.n = 3;
12850
12894
  return getOriginXcmFee({
12851
12895
  api: this.api,
12852
12896
  tx: tx,
@@ -12858,17 +12902,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
12858
12902
  disableFallback: disableFallback
12859
12903
  });
12860
12904
  case 3:
12861
- return _context6.a(2, _context6.v);
12905
+ return _context8.a(2, _context8.v);
12862
12906
  case 4:
12863
- _context6.p = 4;
12864
- _context6.n = 5;
12907
+ _context8.p = 4;
12908
+ _context8.n = 5;
12865
12909
  return this.api.disconnect();
12866
12910
  case 5:
12867
- return _context6.f(4);
12911
+ return _context8.f(4);
12868
12912
  case 6:
12869
- return _context6.a(2);
12913
+ return _context8.a(2);
12870
12914
  }
12871
- }, _callee6, this, [[2,, 4, 6]]);
12915
+ }, _callee8, this, [[2,, 4, 6]]);
12872
12916
  }));
12873
12917
  function getOriginXcmFee$1() {
12874
12918
  return _getOriginXcmFee2.apply(this, arguments);
@@ -12884,20 +12928,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
12884
12928
  }, {
12885
12929
  key: "getXcmFeeEstimate",
12886
12930
  value: (function () {
12887
- var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
12931
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
12888
12932
  var _this$_options5, from, to, address, senderAddress, currency, tx;
12889
- return _regenerator().w(function (_context7) {
12890
- while (1) switch (_context7.p = _context7.n) {
12933
+ return _regenerator().w(function (_context9) {
12934
+ while (1) switch (_context9.p = _context9.n) {
12891
12935
  case 0:
12892
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;
12893
12937
  assertToIsString(to);
12894
12938
  assertAddressIsString(address);
12895
- _context7.n = 1;
12896
- return this.build();
12939
+ _context9.n = 1;
12940
+ return this.buildInternal();
12897
12941
  case 1:
12898
- tx = _context7.v;
12899
- _context7.p = 2;
12900
- _context7.n = 3;
12942
+ tx = _context9.v;
12943
+ _context9.p = 2;
12944
+ _context9.n = 3;
12901
12945
  return getXcmFeeEstimate({
12902
12946
  api: this.api,
12903
12947
  tx: tx,
@@ -12908,17 +12952,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
12908
12952
  currency: currency
12909
12953
  });
12910
12954
  case 3:
12911
- return _context7.a(2, _context7.v);
12955
+ return _context9.a(2, _context9.v);
12912
12956
  case 4:
12913
- _context7.p = 4;
12914
- _context7.n = 5;
12957
+ _context9.p = 4;
12958
+ _context9.n = 5;
12915
12959
  return this.api.disconnect();
12916
12960
  case 5:
12917
- return _context7.f(4);
12961
+ return _context9.f(4);
12918
12962
  case 6:
12919
- return _context7.a(2);
12963
+ return _context9.a(2);
12920
12964
  }
12921
- }, _callee7, this, [[2,, 4, 6]]);
12965
+ }, _callee9, this, [[2,, 4, 6]]);
12922
12966
  }));
12923
12967
  function getXcmFeeEstimate$1() {
12924
12968
  return _getXcmFeeEstimate2.apply(this, arguments);
@@ -12934,19 +12978,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
12934
12978
  }, {
12935
12979
  key: "getOriginXcmFeeEstimate",
12936
12980
  value: (function () {
12937
- var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
12981
+ var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
12938
12982
  var _this$_options6, from, to, senderAddress, currency, tx;
12939
- return _regenerator().w(function (_context8) {
12940
- while (1) switch (_context8.p = _context8.n) {
12983
+ return _regenerator().w(function (_context0) {
12984
+ while (1) switch (_context0.p = _context0.n) {
12941
12985
  case 0:
12942
12986
  _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency;
12943
12987
  assertToIsString(to);
12944
- _context8.n = 1;
12945
- return this.build();
12988
+ _context0.n = 1;
12989
+ return this.buildInternal();
12946
12990
  case 1:
12947
- tx = _context8.v;
12948
- _context8.p = 2;
12949
- _context8.n = 3;
12991
+ tx = _context0.v;
12992
+ _context0.p = 2;
12993
+ _context0.n = 3;
12950
12994
  return getOriginXcmFeeEstimate({
12951
12995
  api: this.api,
12952
12996
  tx: tx,
@@ -12956,17 +13000,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
12956
13000
  senderAddress: senderAddress
12957
13001
  });
12958
13002
  case 3:
12959
- return _context8.a(2, _context8.v);
13003
+ return _context0.a(2, _context0.v);
12960
13004
  case 4:
12961
- _context8.p = 4;
12962
- _context8.n = 5;
13005
+ _context0.p = 4;
13006
+ _context0.n = 5;
12963
13007
  return this.api.disconnect();
12964
13008
  case 5:
12965
- return _context8.f(4);
13009
+ return _context0.f(4);
12966
13010
  case 6:
12967
- return _context8.a(2);
13011
+ return _context0.a(2);
12968
13012
  }
12969
- }, _callee8, this, [[2,, 4, 6]]);
13013
+ }, _callee0, this, [[2,, 4, 6]]);
12970
13014
  }));
12971
13015
  function getOriginXcmFeeEstimate$1() {
12972
13016
  return _getOriginXcmFeeEstimate2.apply(this, arguments);
@@ -12982,18 +13026,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
12982
13026
  }, {
12983
13027
  key: "getTransferableAmount",
12984
13028
  value: (function () {
12985
- var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
13029
+ var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
12986
13030
  var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
12987
- return _regenerator().w(function (_context9) {
12988
- while (1) switch (_context9.n) {
13031
+ return _regenerator().w(function (_context1) {
13032
+ while (1) switch (_context1.n) {
12989
13033
  case 0:
12990
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;
12991
13035
  assertToIsString(to);
12992
- _context9.n = 1;
13036
+ _context1.n = 1;
12993
13037
  return this.overrideTxAmount();
12994
13038
  case 1:
12995
- tx = _context9.v;
12996
- return _context9.a(2, getTransferableAmount({
13039
+ tx = _context1.v;
13040
+ return _context1.a(2, getTransferableAmount({
12997
13041
  api: this.api,
12998
13042
  tx: tx,
12999
13043
  origin: from,
@@ -13003,7 +13047,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13003
13047
  currency: currency
13004
13048
  }));
13005
13049
  }
13006
- }, _callee9, this);
13050
+ }, _callee1, this);
13007
13051
  }));
13008
13052
  function getTransferableAmount$1() {
13009
13053
  return _getTransferableAmount2.apply(this, arguments);
@@ -13019,19 +13063,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
13019
13063
  }, {
13020
13064
  key: "getMinTransferableAmount",
13021
13065
  value: (function () {
13022
- var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
13066
+ var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13023
13067
  var _this$_options8, from, to, senderAddress, address, currency, feeAsset, tx;
13024
- return _regenerator().w(function (_context0) {
13025
- while (1) switch (_context0.n) {
13068
+ return _regenerator().w(function (_context10) {
13069
+ while (1) switch (_context10.n) {
13026
13070
  case 0:
13027
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;
13028
13072
  assertToIsString(to);
13029
13073
  assertAddressIsString(address);
13030
- _context0.n = 1;
13074
+ _context10.n = 1;
13031
13075
  return this.overrideTxAmount();
13032
13076
  case 1:
13033
- tx = _context0.v;
13034
- return _context0.a(2, getMinTransferableAmount({
13077
+ tx = _context10.v;
13078
+ return _context10.a(2, getMinTransferableAmount({
13035
13079
  api: this.api,
13036
13080
  tx: tx,
13037
13081
  origin: from,
@@ -13043,7 +13087,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13043
13087
  builder: this
13044
13088
  }));
13045
13089
  }
13046
- }, _callee0, this);
13090
+ }, _callee10, this);
13047
13091
  }));
13048
13092
  function getMinTransferableAmount$1() {
13049
13093
  return _getMinTransferableAmount2.apply(this, arguments);
@@ -13059,19 +13103,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
13059
13103
  }, {
13060
13104
  key: "verifyEdOnDestination",
13061
13105
  value: (function () {
13062
- var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
13106
+ var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
13063
13107
  var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
13064
- return _regenerator().w(function (_context1) {
13065
- while (1) switch (_context1.n) {
13108
+ return _regenerator().w(function (_context11) {
13109
+ while (1) switch (_context11.n) {
13066
13110
  case 0:
13067
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;
13068
13112
  assertToIsString(to);
13069
13113
  assertAddressIsString(address);
13070
- _context1.n = 1;
13114
+ _context11.n = 1;
13071
13115
  return this.overrideTxAmount();
13072
13116
  case 1:
13073
- tx = _context1.v;
13074
- return _context1.a(2, verifyEdOnDestination({
13117
+ tx = _context11.v;
13118
+ return _context11.a(2, verifyEdOnDestination({
13075
13119
  api: this.api,
13076
13120
  tx: tx,
13077
13121
  origin: from,
@@ -13082,7 +13126,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13082
13126
  currency: currency
13083
13127
  }));
13084
13128
  }
13085
- }, _callee1, this);
13129
+ }, _callee11, this);
13086
13130
  }));
13087
13131
  function verifyEdOnDestination$1() {
13088
13132
  return _verifyEdOnDestination2.apply(this, arguments);
@@ -13098,19 +13142,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
13098
13142
  }, {
13099
13143
  key: "getTransferInfo",
13100
13144
  value: (function () {
13101
- var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
13145
+ var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
13102
13146
  var _this$_options0, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
13103
- return _regenerator().w(function (_context10) {
13104
- while (1) switch (_context10.n) {
13147
+ return _regenerator().w(function (_context12) {
13148
+ while (1) switch (_context12.n) {
13105
13149
  case 0:
13106
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;
13107
13151
  assertToIsString(to);
13108
13152
  assertAddressIsString(address);
13109
- _context10.n = 1;
13153
+ _context12.n = 1;
13110
13154
  return this.overrideTxAmount();
13111
13155
  case 1:
13112
- tx = _context10.v;
13113
- return _context10.a(2, getTransferInfo({
13156
+ tx = _context12.v;
13157
+ return _context12.a(2, getTransferInfo({
13114
13158
  api: this.api,
13115
13159
  tx: tx,
13116
13160
  origin: from,
@@ -13122,7 +13166,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
13122
13166
  feeAsset: feeAsset
13123
13167
  }));
13124
13168
  }
13125
- }, _callee10, this);
13169
+ }, _callee12, this);
13126
13170
  }));
13127
13171
  function getTransferInfo$1() {
13128
13172
  return _getTransferInfo2.apply(this, arguments);
@@ -13190,6 +13234,7 @@ exports.assertAddressIsString = assertAddressIsString;
13190
13234
  exports.assertHasId = assertHasId;
13191
13235
  exports.assertHasLocation = assertHasLocation;
13192
13236
  exports.assertIsForeign = assertIsForeign;
13237
+ exports.assertSenderAddress = assertSenderAddress;
13193
13238
  exports.assertToIsString = assertToIsString;
13194
13239
  exports.blake2b256 = blake2b256;
13195
13240
  exports.blake2b512 = blake2b512;