rubic-sdk 4.48.7 → 4.48.8

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.
@@ -197363,11 +197363,19 @@ class LifiCrossChainTrade extends evm_cross_chain_trade_1.EvmCrossChainTrade {
197363
197363
  ]
197364
197364
  }
197365
197365
  };
197366
- const swapResponse = await this.getResponseFromApiToTransactionRequest(step);
197367
- if (!skipAmountChangeCheck) {
197368
- evm_cross_chain_trade_1.EvmCrossChainTrade.checkAmountChange(swapResponse.transactionRequest, swapResponse.estimate.toAmountMin, web3_pure_1.Web3Pure.toWei(this.toTokenAmountMin, this.to.decimals));
197366
+ try {
197367
+ const swapResponse = await this.getResponseFromApiToTransactionRequest(step);
197368
+ if (!skipAmountChangeCheck) {
197369
+ evm_cross_chain_trade_1.EvmCrossChainTrade.checkAmountChange(swapResponse.transactionRequest, swapResponse.estimate.toAmountMin, web3_pure_1.Web3Pure.toWei(this.toTokenAmountMin, this.to.decimals));
197370
+ }
197371
+ return swapResponse.transactionRequest;
197372
+ }
197373
+ catch (err) {
197374
+ if ('statusCode' in err && 'message' in err) {
197375
+ throw new errors_1.RubicSdkError(err.message);
197376
+ }
197377
+ throw err;
197369
197378
  }
197370
- return swapResponse.transactionRequest;
197371
197379
  }
197372
197380
  async getResponseFromApiToTransactionRequest(step) {
197373
197381
  return this.httpClient.post('https://li.quest/v1/advanced/stepTransaction', {
@@ -227927,7 +227935,7 @@ class LifiTrade extends evm_on_chain_trade_1.EvmOnChainTrade {
227927
227935
  if (this.isDeflationError()) {
227928
227936
  throw new errors_1.LowSlippageDeflationaryTokenError();
227929
227937
  }
227930
- if (err instanceof updated_rates_error_1.UpdatedRatesError) {
227938
+ if (err instanceof updated_rates_error_1.UpdatedRatesError || err instanceof errors_1.RubicSdkError) {
227931
227939
  throw err;
227932
227940
  }
227933
227941
  throw new errors_1.LifiPairIsUnavailableError();
@@ -227957,25 +227965,33 @@ class LifiTrade extends evm_on_chain_trade_1.EvmOnChainTrade {
227957
227965
  ]
227958
227966
  }
227959
227967
  };
227960
- const swapResponse = await this.httpClient.post('https://li.quest/v1/advanced/stepTransaction', {
227961
- ...step
227962
- });
227963
- const { transactionRequest, estimate } = swapResponse;
227964
- const gasLimit = transactionRequest.gasLimit && parseInt(transactionRequest.gasLimit, 16).toString();
227965
- const gasPrice = transactionRequest.gasPrice && parseInt(transactionRequest.gasPrice, 16).toString();
227966
- const value = transactionRequest.value && parseInt(transactionRequest.value, 16).toString();
227967
- evm_on_chain_trade_1.EvmOnChainTrade.checkAmountChange({
227968
- data: transactionRequest.data,
227969
- value: value,
227970
- to: transactionRequest.to
227971
- }, estimate.toAmountMin, this.toTokenAmountMin.stringWeiAmount);
227972
- return {
227973
- to: transactionRequest.to,
227974
- data: transactionRequest.data,
227975
- gas: gasLimit,
227976
- gasPrice,
227977
- value
227978
- };
227968
+ try {
227969
+ const swapResponse = await this.httpClient.post('https://li.quest/v1/advanced/stepTransaction', {
227970
+ ...step
227971
+ });
227972
+ const { transactionRequest, estimate } = swapResponse;
227973
+ const gasLimit = transactionRequest.gasLimit && parseInt(transactionRequest.gasLimit, 16).toString();
227974
+ const gasPrice = transactionRequest.gasPrice && parseInt(transactionRequest.gasPrice, 16).toString();
227975
+ const value = transactionRequest.value && parseInt(transactionRequest.value, 16).toString();
227976
+ evm_on_chain_trade_1.EvmOnChainTrade.checkAmountChange({
227977
+ data: transactionRequest.data,
227978
+ value: value,
227979
+ to: transactionRequest.to
227980
+ }, estimate.toAmountMin, this.toTokenAmountMin.stringWeiAmount);
227981
+ return {
227982
+ to: transactionRequest.to,
227983
+ data: transactionRequest.data,
227984
+ gas: gasLimit,
227985
+ gasPrice,
227986
+ value
227987
+ };
227988
+ }
227989
+ catch (err) {
227990
+ if ('statusCode' in err && 'message' in err) {
227991
+ throw new errors_1.RubicSdkError(err.message);
227992
+ }
227993
+ throw err;
227994
+ }
227979
227995
  }
227980
227996
  }
227981
227997
  exports.LifiTrade = LifiTrade;