diff --git a/package.json b/package.json index 780fb5ca94c..4836b3d5b60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubic-sdk", - "version": "5.33.2", + "version": "5.33.3", "description": "Simplify dApp creation", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/common/tokens/price-token-amount.ts b/src/common/tokens/price-token-amount.ts index 7a670455ef3..ec352081396 100644 --- a/src/common/tokens/price-token-amount.ts +++ b/src/common/tokens/price-token-amount.ts @@ -147,6 +147,6 @@ export class PriceTokenAmount extends .dp(2, BigNumber.ROUND_HALF_UP) .toNumber(); - return impact > 0 ? impact : 0; + return impact; } } diff --git a/src/features/cross-chain/calculation-manager/providers/debridge-provider/chains/debridge-evm-cross-chain-trade.ts b/src/features/cross-chain/calculation-manager/providers/debridge-provider/chains/debridge-evm-cross-chain-trade.ts index d9b5dc38370..547ec3b41ca 100644 --- a/src/features/cross-chain/calculation-manager/providers/debridge-provider/chains/debridge-evm-cross-chain-trade.ts +++ b/src/features/cross-chain/calculation-manager/providers/debridge-provider/chains/debridge-evm-cross-chain-trade.ts @@ -269,8 +269,9 @@ export class DebridgeEvmCrossChainTrade extends EvmCrossChainTrade { const { tx, estimation } = await DlnApiService.fetchCrossChainSwapData(params); - - return { config: tx, amount: estimation.dstChainTokenOut.maxTheoreticalAmount }; + const toAmount = new BigNumber(estimation.dstChainTokenOut.maxTheoreticalAmount); + const receivedAmount = toAmount.gt(0) ? toAmount.toFixed() : '0'; + return { config: tx, amount: receivedAmount }; } public getTradeInfo(): TradeInfo { diff --git a/src/features/cross-chain/calculation-manager/providers/debridge-provider/debridge-cross-chain-provider.ts b/src/features/cross-chain/calculation-manager/providers/debridge-provider/debridge-cross-chain-provider.ts index 11f939d10a2..102028774aa 100644 --- a/src/features/cross-chain/calculation-manager/providers/debridge-provider/debridge-cross-chain-provider.ts +++ b/src/features/cross-chain/calculation-manager/providers/debridge-provider/debridge-cross-chain-provider.ts @@ -100,10 +100,14 @@ export class DebridgeCrossChainProvider extends CrossChainProvider { DlnEvmTransactionResponse | DlnSolanaTransactionResponse >(requestParams); + const toAmount = new BigNumber( + debridgeResponse.estimation.dstChainTokenOut.maxTheoreticalAmount + ); + const to = new PriceTokenAmount({ ...toToken.asStruct, tokenAmount: Web3Pure.fromWei( - debridgeResponse.estimation.dstChainTokenOut.maxTheoreticalAmount, + toAmount.gt(0) ? toAmount : new BigNumber(0), debridgeResponse.estimation.dstChainTokenOut.decimals ) }); diff --git a/src/features/cross-chain/calculation-manager/providers/eddy-bridge/eddy-bridge-trade.ts b/src/features/cross-chain/calculation-manager/providers/eddy-bridge/eddy-bridge-trade.ts index c76e5bb6831..90020f34a09 100644 --- a/src/features/cross-chain/calculation-manager/providers/eddy-bridge/eddy-bridge-trade.ts +++ b/src/features/cross-chain/calculation-manager/providers/eddy-bridge/eddy-bridge-trade.ts @@ -245,7 +245,7 @@ export class EddyBridgeTrade extends EvmCrossChainTrade { return { estimatedGas: this.estimatedGas, feeInfo: this.feeInfo, - priceImpact: this.priceImpact || null, + priceImpact: this.priceImpact ?? null, slippage: this.slippage * 100, routePath: this.routePath };