Skip to content

Commit

Permalink
Update inch version (5.11.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
axtezy authored Apr 1, 2024
2 parents 765cd03 + 0a7c489 commit 037d34c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rubic-sdk",
"version": "5.11.0",
"version": "5.11.1",
"description": "Simplify dApp creation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface OneinchQuoteResponse {
fromToken: object;
toToken: object;
toAmount: string;
dstAmount: string;
fromTokenAmount: string;
protocols: [{ fromTokenAddress: string; toTokenAddress: string }[][]];
gas: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface OneinchSwapResponse {
gasPrice: string;
gas: number;
};
toAmount: string;
dstAmount: string;
error?: number;
protocols: [{ fromTokenAddress: string; toTokenAddress: string }[][]];
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,20 @@ export abstract class OneinchAbstractProvider extends EvmOnChainProvider {
);

estimatedGas = new BigNumber(oneInchTrade.tx.gas);
toTokenAmount = oneInchTrade.toAmount;
toTokenAmount = oneInchTrade.dstAmount;
data = oneInchTrade.tx.data;
} catch (_err) {
oneInchTrade = await oneInchHttpGetRequest<OneinchQuoteResponse>(
'quote',
this.blockchain,
quoteTradeParams
);
if (oneInchTrade.hasOwnProperty('errors') || !oneInchTrade.toAmount) {
if (oneInchTrade.hasOwnProperty('errors') || !oneInchTrade.dstAmount) {
throw new RubicSdkError('1inch quote error');
}

estimatedGas = new BigNumber(oneInchTrade.gas);
toTokenAmount = oneInchTrade.toAmount;
toTokenAmount = oneInchTrade.dstAmount;
}

if (oneInchTrade?.protocols?.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ export class OneinchTrade extends EvmOnChainTrade {
}
};

const { tx, toAmount } = await this.getResponseFromApiToTransactionRequest(swapRequest);
const { tx, dstAmount } = await this.getResponseFromApiToTransactionRequest(swapRequest);

this.checkAmountChange(
{
data: tx.data,
value: tx.value,
to: tx.to
},
toAmount,
dstAmount,
this.to.stringWeiAmount
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function oneInchHttpGetRequest<T>(
options?: {}
): Promise<T> {
return Injector.httpClient.get(
`https://x-api.rubic.exchange/api/swap/v5.2/${blockchainId[blockchain]}/${path}`,
`https://x-api.rubic.exchange/api/swap/v6.0/${blockchainId[blockchain]}/${path}`,
{
...options,
headers: { apikey: 'sndfje3u4b3fnNSDNFUSDNVSunw345842hrnfd3b4nt4' }
Expand Down

0 comments on commit 037d34c

Please sign in to comment.