@paraspell/sdk-core 11.9.0 → 11.9.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.mjs CHANGED
@@ -2712,7 +2712,7 @@ var createChainClient = /*#__PURE__*/function () {
2712
2712
  while (1) switch (_context.n) {
2713
2713
  case 0:
2714
2714
  wsUrl = getChainProviders(chain);
2715
- return _context.a(2, api.createApiInstance(wsUrl));
2715
+ return _context.a(2, api.createApiInstance(wsUrl, chain));
2716
2716
  }
2717
2717
  }, _callee);
2718
2718
  }));
@@ -12889,6 +12889,7 @@ var createCustomXcm = function createCustomXcm(_ref, isDotAsset) {
12889
12889
  refundFee = fees.refundFee,
12890
12890
  destFee = fees.destFee;
12891
12891
  var feeAssetLocation = !isDotAsset ? RELAY_LOCATION : assetInfo.location;
12892
+ var feeLocLocalized = localizeLocation(dest.chain, feeAssetLocation);
12892
12893
  var asset = createAsset(version, assetInfo.amount, localizeLocation(dest.chain, assetInfo.location));
12893
12894
  var depositInstruction = {
12894
12895
  DepositAsset: {
@@ -12920,7 +12921,7 @@ var createCustomXcm = function createCustomXcm(_ref, isDotAsset) {
12920
12921
  };
12921
12922
  var buyExecution = {
12922
12923
  BuyExecution: {
12923
- fees: createAsset(version, buyExecutionAmount, feeAssetLocation),
12924
+ fees: createAsset(version, buyExecutionAmount, feeLocLocalized),
12924
12925
  weight_limit: 'Unlimited'
12925
12926
  }
12926
12927
  };
@@ -13777,6 +13778,34 @@ var GeneralBuilder = /*#__PURE__*/function () {
13777
13778
  value: function buildInternal() {
13778
13779
  return this.buildCommon(true);
13779
13780
  }
13781
+ }, {
13782
+ key: "prepareNormalizedOptions",
13783
+ value: function () {
13784
+ var _prepareNormalizedOptions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
13785
+ var builder, buildTx, normalizedOptions;
13786
+ return _regenerator().w(function (_context2) {
13787
+ while (1) switch (_context2.n) {
13788
+ case 0:
13789
+ builder = this.currency(_objectSpread2(_objectSpread2({}, options.currency), {}, {
13790
+ amount: MIN_AMOUNT.toString()
13791
+ }));
13792
+ buildTx = builder.createTxFactory();
13793
+ _context2.n = 1;
13794
+ return normalizeAmountAll(this.api, buildTx, options);
13795
+ case 1:
13796
+ normalizedOptions = _context2.v;
13797
+ return _context2.a(2, {
13798
+ normalizedOptions: normalizedOptions,
13799
+ buildTx: buildTx
13800
+ });
13801
+ }
13802
+ }, _callee2, this);
13803
+ }));
13804
+ function prepareNormalizedOptions(_x2) {
13805
+ return _prepareNormalizedOptions.apply(this, arguments);
13806
+ }
13807
+ return prepareNormalizedOptions;
13808
+ }()
13780
13809
  /**
13781
13810
  * Builds and returns the transfer extrinsic.
13782
13811
  *
@@ -13785,19 +13814,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
13785
13814
  }, {
13786
13815
  key: "build",
13787
13816
  value: (function () {
13788
- var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
13817
+ var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
13789
13818
  var _yield$this$buildComm, tx;
13790
- return _regenerator().w(function (_context2) {
13791
- while (1) switch (_context2.n) {
13819
+ return _regenerator().w(function (_context3) {
13820
+ while (1) switch (_context3.n) {
13792
13821
  case 0:
13793
- _context2.n = 1;
13822
+ _context3.n = 1;
13794
13823
  return this.buildCommon();
13795
13824
  case 1:
13796
- _yield$this$buildComm = _context2.v;
13825
+ _yield$this$buildComm = _context3.v;
13797
13826
  tx = _yield$this$buildComm.tx;
13798
- return _context2.a(2, tx);
13827
+ return _context3.a(2, tx);
13799
13828
  }
13800
- }, _callee2, this);
13829
+ }, _callee3, this);
13801
13830
  }));
13802
13831
  function build() {
13803
13832
  return _build.apply(this, arguments);
@@ -13807,54 +13836,50 @@ var GeneralBuilder = /*#__PURE__*/function () {
13807
13836
  }, {
13808
13837
  key: "buildCommon",
13809
13838
  value: function () {
13810
- var _buildCommon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
13839
+ var _buildCommon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
13811
13840
  var isCalledInternally,
13812
13841
  _this$_options,
13813
13842
  from,
13814
13843
  to,
13815
- builder,
13816
- createTx,
13844
+ _yield$this$prepareNo,
13817
13845
  normalizedOptions,
13818
13846
  tx,
13819
- _args3 = arguments;
13820
- return _regenerator().w(function (_context3) {
13821
- while (1) switch (_context3.n) {
13847
+ _args4 = arguments;
13848
+ return _regenerator().w(function (_context4) {
13849
+ while (1) switch (_context4.n) {
13822
13850
  case 0:
13823
- isCalledInternally = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
13851
+ isCalledInternally = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : false;
13824
13852
  if (!(!this.batchManager.isEmpty() && !isCalledInternally)) {
13825
- _context3.n = 1;
13853
+ _context4.n = 1;
13826
13854
  break;
13827
13855
  }
13828
13856
  throw new InvalidParameterError('Transaction manager contains batched items. Use buildBatch() to process them.');
13829
13857
  case 1:
13830
13858
  _this$_options = this._options, from = _this$_options.from, to = _this$_options.to;
13831
13859
  if (!(!isTLocation(to) && isRelayChain(from) && isRelayChain(to) && from !== to)) {
13832
- _context3.n = 2;
13860
+ _context4.n = 2;
13833
13861
  break;
13834
13862
  }
13835
13863
  throw new InvalidParameterError('Transfers between relay chains are not yet supported.');
13836
13864
  case 2:
13837
- builder = this.currency(_objectSpread2(_objectSpread2({}, this._options.currency), {}, {
13838
- amount: MIN_AMOUNT.toString()
13839
- }));
13840
- createTx = builder.createTxFactory();
13841
- _context3.n = 3;
13842
- return normalizeAmountAll(this.api, createTx, this._options);
13865
+ _context4.n = 3;
13866
+ return this.prepareNormalizedOptions(this._options);
13843
13867
  case 3:
13844
- normalizedOptions = _context3.v;
13845
- _context3.n = 4;
13868
+ _yield$this$prepareNo = _context4.v;
13869
+ normalizedOptions = _yield$this$prepareNo.normalizedOptions;
13870
+ _context4.n = 4;
13846
13871
  return send(normalizedOptions);
13847
13872
  case 4:
13848
- tx = _context3.v;
13849
- _context3.n = 5;
13873
+ tx = _context4.v;
13874
+ _context4.n = 5;
13850
13875
  return this.maybePerformXcmFormatCheck(tx, normalizedOptions, isCalledInternally);
13851
13876
  case 5:
13852
- return _context3.a(2, {
13877
+ return _context4.a(2, {
13853
13878
  tx: tx,
13854
13879
  options: normalizedOptions
13855
13880
  });
13856
13881
  }
13857
- }, _callee3, this);
13882
+ }, _callee4, this);
13858
13883
  }));
13859
13884
  function buildCommon() {
13860
13885
  return _buildCommon.apply(this, arguments);
@@ -13864,37 +13889,37 @@ var GeneralBuilder = /*#__PURE__*/function () {
13864
13889
  }, {
13865
13890
  key: "maybePerformXcmFormatCheck",
13866
13891
  value: function () {
13867
- var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(tx, options, isCalledInternally) {
13892
+ var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(tx, options, isCalledInternally) {
13868
13893
  var senderAddress, config, dryRunResult;
13869
- return _regenerator().w(function (_context4) {
13870
- while (1) switch (_context4.n) {
13894
+ return _regenerator().w(function (_context5) {
13895
+ while (1) switch (_context5.n) {
13871
13896
  case 0:
13872
13897
  senderAddress = options.senderAddress;
13873
13898
  config = this.api.getConfig();
13874
13899
  if (!(isConfig(config) && config.xcmFormatCheck && !isCalledInternally)) {
13875
- _context4.n = 2;
13900
+ _context5.n = 2;
13876
13901
  break;
13877
13902
  }
13878
13903
  assertSenderAddress(senderAddress);
13879
- _context4.n = 1;
13904
+ _context5.n = 1;
13880
13905
  return buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
13881
13906
  senderAddress: senderAddress
13882
13907
  }), {
13883
13908
  sentAssetMintMode: 'bypass'
13884
13909
  });
13885
13910
  case 1:
13886
- dryRunResult = _context4.v;
13911
+ dryRunResult = _context5.v;
13887
13912
  if (!dryRunResult.failureReason) {
13888
- _context4.n = 2;
13913
+ _context5.n = 2;
13889
13914
  break;
13890
13915
  }
13891
13916
  throw new DryRunFailedError(dryRunResult.failureReason, dryRunResult.failureChain);
13892
13917
  case 2:
13893
- return _context4.a(2);
13918
+ return _context5.a(2);
13894
13919
  }
13895
- }, _callee4, this);
13920
+ }, _callee5, this);
13896
13921
  }));
13897
- function maybePerformXcmFormatCheck(_x2, _x3, _x4) {
13922
+ function maybePerformXcmFormatCheck(_x3, _x4, _x5) {
13898
13923
  return _maybePerformXcmFormatCheck.apply(this, arguments);
13899
13924
  }
13900
13925
  return maybePerformXcmFormatCheck;
@@ -13902,20 +13927,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
13902
13927
  }, {
13903
13928
  key: "dryRun",
13904
13929
  value: function () {
13905
- var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
13930
+ var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
13906
13931
  var _yield$this$buildInte, tx, options;
13907
- return _regenerator().w(function (_context5) {
13908
- while (1) switch (_context5.n) {
13932
+ return _regenerator().w(function (_context6) {
13933
+ while (1) switch (_context6.n) {
13909
13934
  case 0:
13910
- _context5.n = 1;
13935
+ _context6.n = 1;
13911
13936
  return this.buildInternal();
13912
13937
  case 1:
13913
- _yield$this$buildInte = _context5.v;
13938
+ _yield$this$buildInte = _context6.v;
13914
13939
  tx = _yield$this$buildInte.tx;
13915
13940
  options = _yield$this$buildInte.options;
13916
- return _context5.a(2, buildDryRun(this.api, tx, options));
13941
+ return _context6.a(2, buildDryRun(this.api, tx, options));
13917
13942
  }
13918
- }, _callee5, this);
13943
+ }, _callee6, this);
13919
13944
  }));
13920
13945
  function dryRun() {
13921
13946
  return _dryRun.apply(this, arguments);
@@ -13925,25 +13950,25 @@ var GeneralBuilder = /*#__PURE__*/function () {
13925
13950
  }, {
13926
13951
  key: "dryRunPreview",
13927
13952
  value: function () {
13928
- var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(dryRunOptions) {
13953
+ var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(dryRunOptions) {
13929
13954
  var _yield$this$buildInte2, tx, options;
13930
- return _regenerator().w(function (_context6) {
13931
- while (1) switch (_context6.n) {
13955
+ return _regenerator().w(function (_context7) {
13956
+ while (1) switch (_context7.n) {
13932
13957
  case 0:
13933
- _context6.n = 1;
13958
+ _context7.n = 1;
13934
13959
  return this.buildInternal();
13935
13960
  case 1:
13936
- _yield$this$buildInte2 = _context6.v;
13961
+ _yield$this$buildInte2 = _context7.v;
13937
13962
  tx = _yield$this$buildInte2.tx;
13938
13963
  options = _yield$this$buildInte2.options;
13939
- return _context6.a(2, buildDryRun(this.api, tx, options, {
13964
+ return _context7.a(2, buildDryRun(this.api, tx, options, {
13940
13965
  sentAssetMintMode: 'preview',
13941
13966
  mintFeeAssets: dryRunOptions === null || dryRunOptions === void 0 ? void 0 : dryRunOptions.mintFeeAssets
13942
13967
  }));
13943
13968
  }
13944
- }, _callee6, this);
13969
+ }, _callee7, this);
13945
13970
  }));
13946
- function dryRunPreview(_x5) {
13971
+ function dryRunPreview(_x6) {
13947
13972
  return _dryRunPreview.apply(this, arguments);
13948
13973
  }
13949
13974
  return dryRunPreview;
@@ -13966,21 +13991,27 @@ var GeneralBuilder = /*#__PURE__*/function () {
13966
13991
  }, {
13967
13992
  key: "getXcmFee",
13968
13993
  value: (function () {
13969
- var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
13994
+ var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(options) {
13970
13995
  var _options$disableFallb;
13971
- var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback;
13972
- return _regenerator().w(function (_context7) {
13973
- while (1) switch (_context7.p = _context7.n) {
13996
+ var disableFallback, _yield$this$prepareNo2, normalizedOptions, buildTx, api, from, to, senderAddress, address, currency, feeAsset;
13997
+ return _regenerator().w(function (_context8) {
13998
+ while (1) switch (_context8.p = _context8.n) {
13974
13999
  case 0:
13975
- _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;
14000
+ disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
14001
+ _context8.n = 1;
14002
+ return this.prepareNormalizedOptions(this._options);
14003
+ case 1:
14004
+ _yield$this$prepareNo2 = _context8.v;
14005
+ normalizedOptions = _yield$this$prepareNo2.normalizedOptions;
14006
+ buildTx = _yield$this$prepareNo2.buildTx;
14007
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, address = normalizedOptions.address, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset;
13976
14008
  assertToIsString(to);
13977
14009
  assertAddressIsString(address);
13978
- disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
13979
- _context7.p = 1;
13980
- _context7.n = 2;
14010
+ _context8.p = 2;
14011
+ _context8.n = 3;
13981
14012
  return getXcmFee({
13982
- api: this.api,
13983
- buildTx: this.createTxFactory(),
14013
+ api: api,
14014
+ buildTx: buildTx,
13984
14015
  origin: from,
13985
14016
  destination: to,
13986
14017
  senderAddress: senderAddress,
@@ -13989,20 +14020,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
13989
14020
  feeAsset: feeAsset,
13990
14021
  disableFallback: disableFallback
13991
14022
  });
13992
- case 2:
13993
- return _context7.a(2, _context7.v);
13994
14023
  case 3:
13995
- _context7.p = 3;
13996
- _context7.n = 4;
13997
- return this.api.disconnect();
14024
+ return _context8.a(2, _context8.v);
13998
14025
  case 4:
13999
- return _context7.f(3);
14026
+ _context8.p = 4;
14027
+ _context8.n = 5;
14028
+ return this.api.disconnect();
14000
14029
  case 5:
14001
- return _context7.a(2);
14030
+ return _context8.f(4);
14031
+ case 6:
14032
+ return _context8.a(2);
14002
14033
  }
14003
- }, _callee7, this, [[1,, 3, 5]]);
14034
+ }, _callee8, this, [[2,, 4, 6]]);
14004
14035
  }));
14005
- function getXcmFee$1(_x6) {
14036
+ function getXcmFee$1(_x7) {
14006
14037
  return _getXcmFee2.apply(this, arguments);
14007
14038
  }
14008
14039
  return getXcmFee$1;
@@ -14016,31 +14047,38 @@ var GeneralBuilder = /*#__PURE__*/function () {
14016
14047
  }, {
14017
14048
  key: "getOriginXcmFee",
14018
14049
  value: (function () {
14019
- var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
14050
+ var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
14020
14051
  var _ref,
14021
14052
  disableFallback,
14022
- _this$_options3,
14053
+ _yield$this$prepareNo3,
14054
+ normalizedOptions,
14055
+ buildTx,
14056
+ api,
14023
14057
  from,
14024
14058
  to,
14025
14059
  senderAddress,
14026
14060
  currency,
14027
14061
  feeAsset,
14028
- api,
14029
- _args8 = arguments;
14030
- return _regenerator().w(function (_context8) {
14031
- while (1) switch (_context8.p = _context8.n) {
14062
+ _args9 = arguments;
14063
+ return _regenerator().w(function (_context9) {
14064
+ while (1) switch (_context9.p = _context9.n) {
14032
14065
  case 0:
14033
- _ref = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {
14066
+ _ref = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {
14034
14067
  disableFallback: false
14035
14068
  }, disableFallback = _ref.disableFallback;
14036
- _this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, senderAddress = _this$_options3.senderAddress, currency = _this$_options3.currency, feeAsset = _this$_options3.feeAsset;
14069
+ _context9.n = 1;
14070
+ return this.prepareNormalizedOptions(this._options);
14071
+ case 1:
14072
+ _yield$this$prepareNo3 = _context9.v;
14073
+ normalizedOptions = _yield$this$prepareNo3.normalizedOptions;
14074
+ buildTx = _yield$this$prepareNo3.buildTx;
14075
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset;
14037
14076
  assertToIsString(to);
14038
- api = this.api;
14039
- _context8.p = 1;
14040
- _context8.n = 2;
14077
+ _context9.p = 2;
14078
+ _context9.n = 3;
14041
14079
  return getOriginXcmFee({
14042
14080
  api: api,
14043
- buildTx: this.createTxFactory(),
14081
+ buildTx: buildTx,
14044
14082
  origin: from,
14045
14083
  destination: to,
14046
14084
  senderAddress: senderAddress,
@@ -14048,18 +14086,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
14048
14086
  feeAsset: feeAsset,
14049
14087
  disableFallback: disableFallback
14050
14088
  });
14051
- case 2:
14052
- return _context8.a(2, _context8.v);
14053
14089
  case 3:
14054
- _context8.p = 3;
14055
- _context8.n = 4;
14056
- return this.api.disconnect();
14090
+ return _context9.a(2, _context9.v);
14057
14091
  case 4:
14058
- return _context8.f(3);
14092
+ _context9.p = 4;
14093
+ _context9.n = 5;
14094
+ return this.api.disconnect();
14059
14095
  case 5:
14060
- return _context8.a(2);
14096
+ return _context9.f(4);
14097
+ case 6:
14098
+ return _context9.a(2);
14061
14099
  }
14062
- }, _callee8, this, [[1,, 3, 5]]);
14100
+ }, _callee9, this, [[2,, 4, 6]]);
14063
14101
  }));
14064
14102
  function getOriginXcmFee$1() {
14065
14103
  return _getOriginXcmFee2.apply(this, arguments);
@@ -14075,23 +14113,28 @@ var GeneralBuilder = /*#__PURE__*/function () {
14075
14113
  }, {
14076
14114
  key: "getXcmFeeEstimate",
14077
14115
  value: (function () {
14078
- var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
14079
- var _this$_options4, from, to, address, senderAddress, currency, _yield$this$buildInte3, tx;
14080
- return _regenerator().w(function (_context9) {
14081
- while (1) switch (_context9.p = _context9.n) {
14116
+ var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
14117
+ var _yield$this$prepareNo4, normalizedOptions, buildTx, api, from, to, address, senderAddress, currency, tx;
14118
+ return _regenerator().w(function (_context0) {
14119
+ while (1) switch (_context0.p = _context0.n) {
14082
14120
  case 0:
14083
- _this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, address = _this$_options4.address, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency;
14121
+ _context0.n = 1;
14122
+ return this.prepareNormalizedOptions(this._options);
14123
+ case 1:
14124
+ _yield$this$prepareNo4 = _context0.v;
14125
+ normalizedOptions = _yield$this$prepareNo4.normalizedOptions;
14126
+ buildTx = _yield$this$prepareNo4.buildTx;
14127
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, address = normalizedOptions.address, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency;
14084
14128
  assertToIsString(to);
14085
14129
  assertAddressIsString(address);
14086
- _context9.n = 1;
14087
- return this.buildInternal();
14088
- case 1:
14089
- _yield$this$buildInte3 = _context9.v;
14090
- tx = _yield$this$buildInte3.tx;
14091
- _context9.p = 2;
14092
- _context9.n = 3;
14130
+ _context0.n = 2;
14131
+ return buildTx();
14132
+ case 2:
14133
+ tx = _context0.v;
14134
+ _context0.p = 3;
14135
+ _context0.n = 4;
14093
14136
  return getXcmFeeEstimate({
14094
- api: this.api,
14137
+ api: api,
14095
14138
  tx: tx,
14096
14139
  origin: from,
14097
14140
  destination: to,
@@ -14099,18 +14142,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
14099
14142
  senderAddress: senderAddress,
14100
14143
  currency: currency
14101
14144
  });
14102
- case 3:
14103
- return _context9.a(2, _context9.v);
14104
14145
  case 4:
14105
- _context9.p = 4;
14106
- _context9.n = 5;
14107
- return this.api.disconnect();
14146
+ return _context0.a(2, _context0.v);
14108
14147
  case 5:
14109
- return _context9.f(4);
14148
+ _context0.p = 5;
14149
+ _context0.n = 6;
14150
+ return this.api.disconnect();
14110
14151
  case 6:
14111
- return _context9.a(2);
14152
+ return _context0.f(5);
14153
+ case 7:
14154
+ return _context0.a(2);
14112
14155
  }
14113
- }, _callee9, this, [[2,, 4, 6]]);
14156
+ }, _callee0, this, [[3,, 5, 7]]);
14114
14157
  }));
14115
14158
  function getXcmFeeEstimate$1() {
14116
14159
  return _getXcmFeeEstimate2.apply(this, arguments);
@@ -14126,40 +14169,45 @@ var GeneralBuilder = /*#__PURE__*/function () {
14126
14169
  }, {
14127
14170
  key: "getOriginXcmFeeEstimate",
14128
14171
  value: (function () {
14129
- var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
14130
- var _this$_options5, from, to, senderAddress, currency, _yield$this$buildInte4, tx;
14131
- return _regenerator().w(function (_context0) {
14132
- while (1) switch (_context0.p = _context0.n) {
14172
+ var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
14173
+ var _yield$this$prepareNo5, normalizedOptions, buildTx, api, from, to, senderAddress, currency, tx;
14174
+ return _regenerator().w(function (_context1) {
14175
+ while (1) switch (_context1.p = _context1.n) {
14133
14176
  case 0:
14134
- _this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
14135
- assertToIsString(to);
14136
- _context0.n = 1;
14137
- return this.buildInternal();
14177
+ _context1.n = 1;
14178
+ return this.prepareNormalizedOptions(this._options);
14138
14179
  case 1:
14139
- _yield$this$buildInte4 = _context0.v;
14140
- tx = _yield$this$buildInte4.tx;
14141
- _context0.p = 2;
14142
- _context0.n = 3;
14180
+ _yield$this$prepareNo5 = _context1.v;
14181
+ normalizedOptions = _yield$this$prepareNo5.normalizedOptions;
14182
+ buildTx = _yield$this$prepareNo5.buildTx;
14183
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency;
14184
+ assertToIsString(to);
14185
+ _context1.n = 2;
14186
+ return buildTx();
14187
+ case 2:
14188
+ tx = _context1.v;
14189
+ _context1.p = 3;
14190
+ _context1.n = 4;
14143
14191
  return getOriginXcmFeeEstimate({
14144
- api: this.api,
14192
+ api: api,
14145
14193
  tx: tx,
14146
14194
  origin: from,
14147
14195
  destination: to,
14148
14196
  currency: currency,
14149
14197
  senderAddress: senderAddress
14150
14198
  });
14151
- case 3:
14152
- return _context0.a(2, _context0.v);
14153
14199
  case 4:
14154
- _context0.p = 4;
14155
- _context0.n = 5;
14156
- return this.api.disconnect();
14200
+ return _context1.a(2, _context1.v);
14157
14201
  case 5:
14158
- return _context0.f(4);
14202
+ _context1.p = 5;
14203
+ _context1.n = 6;
14204
+ return this.api.disconnect();
14159
14205
  case 6:
14160
- return _context0.a(2);
14206
+ return _context1.f(5);
14207
+ case 7:
14208
+ return _context1.a(2);
14161
14209
  }
14162
- }, _callee0, this, [[2,, 4, 6]]);
14210
+ }, _callee1, this, [[3,, 5, 7]]);
14163
14211
  }));
14164
14212
  function getOriginXcmFeeEstimate$1() {
14165
14213
  return _getOriginXcmFeeEstimate2.apply(this, arguments);
@@ -14175,17 +14223,22 @@ var GeneralBuilder = /*#__PURE__*/function () {
14175
14223
  }, {
14176
14224
  key: "getTransferableAmount",
14177
14225
  value: (function () {
14178
- var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
14179
- var _this$_options6, from, to, senderAddress, currency, feeAsset, api;
14180
- return _regenerator().w(function (_context1) {
14181
- while (1) switch (_context1.n) {
14226
+ var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
14227
+ var _yield$this$prepareNo6, normalizedOptions, buildTx, api, from, to, senderAddress, currency, feeAsset;
14228
+ return _regenerator().w(function (_context10) {
14229
+ while (1) switch (_context10.n) {
14182
14230
  case 0:
14183
- _this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
14231
+ _context10.n = 1;
14232
+ return this.prepareNormalizedOptions(this._options);
14233
+ case 1:
14234
+ _yield$this$prepareNo6 = _context10.v;
14235
+ normalizedOptions = _yield$this$prepareNo6.normalizedOptions;
14236
+ buildTx = _yield$this$prepareNo6.buildTx;
14237
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset;
14184
14238
  assertToIsString(to);
14185
- api = this.api;
14186
- return _context1.a(2, getTransferableAmount({
14239
+ return _context10.a(2, getTransferableAmount({
14187
14240
  api: api,
14188
- buildTx: this.createTxFactory(),
14241
+ buildTx: buildTx,
14189
14242
  origin: from,
14190
14243
  destination: to,
14191
14244
  senderAddress: senderAddress,
@@ -14193,7 +14246,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
14193
14246
  currency: currency
14194
14247
  }));
14195
14248
  }
14196
- }, _callee1, this);
14249
+ }, _callee10, this);
14197
14250
  }));
14198
14251
  function getTransferableAmount$1() {
14199
14252
  return _getTransferableAmount2.apply(this, arguments);
@@ -14209,18 +14262,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
14209
14262
  }, {
14210
14263
  key: "getMinTransferableAmount",
14211
14264
  value: (function () {
14212
- var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
14213
- var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api;
14214
- return _regenerator().w(function (_context10) {
14215
- while (1) switch (_context10.n) {
14265
+ var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
14266
+ var _yield$this$prepareNo7, normalizedOptions, buildTx, api, from, to, senderAddress, address, currency, feeAsset;
14267
+ return _regenerator().w(function (_context11) {
14268
+ while (1) switch (_context11.n) {
14216
14269
  case 0:
14217
- _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;
14270
+ _context11.n = 1;
14271
+ return this.prepareNormalizedOptions(this._options);
14272
+ case 1:
14273
+ _yield$this$prepareNo7 = _context11.v;
14274
+ normalizedOptions = _yield$this$prepareNo7.normalizedOptions;
14275
+ buildTx = _yield$this$prepareNo7.buildTx;
14276
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, address = normalizedOptions.address, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset;
14218
14277
  assertToIsString(to);
14219
14278
  assertAddressIsString(address);
14220
- api = this.api;
14221
- return _context10.a(2, getMinTransferableAmount({
14279
+ return _context11.a(2, getMinTransferableAmount({
14222
14280
  api: api,
14223
- buildTx: this.createTxFactory(),
14281
+ buildTx: buildTx,
14224
14282
  origin: from,
14225
14283
  destination: to,
14226
14284
  senderAddress: senderAddress,
@@ -14230,7 +14288,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
14230
14288
  builder: this
14231
14289
  }));
14232
14290
  }
14233
- }, _callee10, this);
14291
+ }, _callee11, this);
14234
14292
  }));
14235
14293
  function getMinTransferableAmount$1() {
14236
14294
  return _getMinTransferableAmount2.apply(this, arguments);
@@ -14246,17 +14304,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
14246
14304
  }, {
14247
14305
  key: "verifyEdOnDestination",
14248
14306
  value: (function () {
14249
- var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
14250
- var _this$_options8, from, to, address, currency, senderAddress, feeAsset;
14251
- return _regenerator().w(function (_context11) {
14252
- while (1) switch (_context11.n) {
14307
+ var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
14308
+ var _yield$this$prepareNo8, normalizedOptions, buildTx, api, from, to, address, currency, senderAddress, feeAsset;
14309
+ return _regenerator().w(function (_context12) {
14310
+ while (1) switch (_context12.n) {
14253
14311
  case 0:
14254
- _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;
14312
+ _context12.n = 1;
14313
+ return this.prepareNormalizedOptions(this._options);
14314
+ case 1:
14315
+ _yield$this$prepareNo8 = _context12.v;
14316
+ normalizedOptions = _yield$this$prepareNo8.normalizedOptions;
14317
+ buildTx = _yield$this$prepareNo8.buildTx;
14318
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, address = normalizedOptions.address, currency = normalizedOptions.currency, senderAddress = normalizedOptions.senderAddress, feeAsset = normalizedOptions.feeAsset;
14255
14319
  assertToIsString(to);
14256
14320
  assertAddressIsString(address);
14257
- return _context11.a(2, verifyEdOnDestination({
14258
- api: this.api,
14259
- buildTx: this.createTxFactory(),
14321
+ return _context12.a(2, verifyEdOnDestination({
14322
+ api: api,
14323
+ buildTx: buildTx,
14260
14324
  origin: from,
14261
14325
  destination: to,
14262
14326
  address: address,
@@ -14265,7 +14329,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
14265
14329
  currency: currency
14266
14330
  }));
14267
14331
  }
14268
- }, _callee11, this);
14332
+ }, _callee12, this);
14269
14333
  }));
14270
14334
  function verifyEdOnDestination$1() {
14271
14335
  return _verifyEdOnDestination2.apply(this, arguments);
@@ -14281,17 +14345,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
14281
14345
  }, {
14282
14346
  key: "getTransferInfo",
14283
14347
  value: (function () {
14284
- var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
14285
- var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset;
14286
- return _regenerator().w(function (_context12) {
14287
- while (1) switch (_context12.n) {
14348
+ var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
14349
+ var _yield$this$prepareNo9, normalizedOptions, buildTx, api, from, to, address, currency, ahAddress, senderAddress, feeAsset;
14350
+ return _regenerator().w(function (_context13) {
14351
+ while (1) switch (_context13.n) {
14288
14352
  case 0:
14289
- _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;
14353
+ _context13.n = 1;
14354
+ return this.prepareNormalizedOptions(this._options);
14355
+ case 1:
14356
+ _yield$this$prepareNo9 = _context13.v;
14357
+ normalizedOptions = _yield$this$prepareNo9.normalizedOptions;
14358
+ buildTx = _yield$this$prepareNo9.buildTx;
14359
+ api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, address = normalizedOptions.address, currency = normalizedOptions.currency, ahAddress = normalizedOptions.ahAddress, senderAddress = normalizedOptions.senderAddress, feeAsset = normalizedOptions.feeAsset;
14290
14360
  assertToIsString(to);
14291
14361
  assertAddressIsString(address);
14292
- return _context12.a(2, getTransferInfo({
14293
- api: this.api,
14294
- buildTx: this.createTxFactory(),
14362
+ return _context13.a(2, getTransferInfo({
14363
+ api: api,
14364
+ buildTx: buildTx,
14295
14365
  origin: from,
14296
14366
  destination: to,
14297
14367
  address: address,
@@ -14301,7 +14371,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
14301
14371
  feeAsset: feeAsset
14302
14372
  }));
14303
14373
  }
14304
- }, _callee12, this);
14374
+ }, _callee13, this);
14305
14375
  }));
14306
14376
  function getTransferInfo$1() {
14307
14377
  return _getTransferInfo2.apply(this, arguments);