Skip to content

Commit e08233b

Browse files
authored
Merge pull request QuickSwap#1768 from jirokobadev/hotfix/remove-wallchain
remove wallchain api calls
2 parents 7d243d6 + a1be0d1 commit e08233b

5 files changed

Lines changed: 3 additions & 245 deletions

File tree

src/components/Swap/SwapBestTrade.tsx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ import { useAllTokens, useCurrency } from 'hooks/Tokens';
8181
import TokenWarningModal from 'components/v3/TokenWarningModal';
8282
import useParsedQueryString from 'hooks/useParsedQueryString';
8383
import useSwapRedirects from 'hooks/useSwapRedirect';
84-
import callWallchainAPI from 'utils/wallchainService';
8584
import ParaswapABI from 'constants/abis/ParaSwap_ABI.json';
8685
import { ONE } from 'v3lib/utils';
8786
import { NATIVE_CONVERTER, SWAP_ROUTER_ADDRESS } from 'constants/v3/addresses';
@@ -1187,31 +1186,7 @@ const SwapBestTrade: React.FC<{
11871186
userAddress: account,
11881187
partner: 'quickswapv3',
11891188
});
1190-
1191-
if (txParams.data) {
1192-
const paraswapContract = getContract(
1193-
optimalRate.contractAddress,
1194-
ParaswapABI,
1195-
library,
1196-
account,
1197-
);
1198-
const response = await callWallchainAPI(
1199-
optimalRate.contractMethod,
1200-
txParams.data,
1201-
txParams.value,
1202-
chainId,
1203-
account,
1204-
paraswapContract,
1205-
SmartRouter.PARASWAP,
1206-
RouterTypes.SMART,
1207-
onBestRoute,
1208-
onSetSwapDelay,
1209-
50,
1210-
);
1211-
setBonusRouteFound(response ? response.pathFound : false);
1212-
} else {
1213-
setBonusRouteFound(false);
1214-
}
1189+
setBonusRouteFound(false);
12151190
setBonusRouteLoading(false);
12161191
} catch (e) {
12171192
setBonusRouteFound(false);

src/constants/index.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,6 @@ export enum SmartRouter {
159159
QUICKSWAP = 'QUICKSWAP',
160160
}
161161

162-
export const WALLCHAIN_PARAMS: {
163-
[chainId in ChainId]?: {
164-
[SmartRouter.PARASWAP]: { apiURL: string; apiKey: string };
165-
[SmartRouter.QUICKSWAP]: { apiURL: string; apiKey: string };
166-
};
167-
} = {
168-
[ChainId.MATIC]: {
169-
[SmartRouter.PARASWAP]: {
170-
apiURL: 'https://matic.wallchains.com/upgrade_txn/',
171-
apiKey: '91b92acd-e8fd-49c3-80fd-db2bc58bb8cf',
172-
},
173-
[SmartRouter.QUICKSWAP]: {
174-
apiURL: 'https://matic.wallchains.com/upgrade_txn/',
175-
apiKey: '50eaf751-196d-4fe0-9506-b983f7c83735',
176-
},
177-
},
178-
};
179-
180162
export const BONUS_CUTOFF_AMOUNT: { [chainId in ChainId]?: number } = {
181163
[ChainId.MUMBAI]: 0,
182164
[ChainId.MATIC]: 0,

src/hooks/useFindBestRoute.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
useBonusRouterManager,
1010
useUserSlippageTolerance,
1111
} from 'state/user/hooks';
12-
import callWallchainAPI from 'utils/wallchainService';
1312
import { useCurrency } from './Tokens';
1413
import { useTradeExactIn, useTradeExactOut } from './Trades';
1514
import { useActiveWeb3React } from 'hooks';
@@ -82,30 +81,7 @@ const useFindBestRoute = () => {
8281
onSetSwapDelay(SwapDelay.SWAP_REFRESH);
8382
return { v2Trade, bestTradeExactIn, bestTradeExactOut };
8483
}
85-
if (
86-
account &&
87-
chainId &&
88-
swapCalls[0] &&
89-
parsedQuery &&
90-
parsedQuery.swapIndex === '1'
91-
) {
92-
const {
93-
contract,
94-
parameters: { methodName, args, value },
95-
} = swapCalls[0];
96-
callWallchainAPI(
97-
methodName,
98-
args,
99-
value,
100-
chainId,
101-
account,
102-
contract,
103-
currentSmartRouter,
104-
currentRouterType,
105-
onBestRoute,
106-
onSetSwapDelay,
107-
);
108-
}
84+
10985
return { v2Trade, bestTradeExactIn, bestTradeExactOut };
11086
};
11187

src/hooks/useParaswapCallback.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { OptimalRate, SwapSide } from 'paraswap-core';
2020
import { useParaswap } from './useParaswap';
2121
import ParaswapABI from 'constants/abis/ParaSwap_ABI.json';
2222
import { useContract } from './useContract';
23-
import callWallchainAPI from 'utils/wallchainService';
2423
import { useSwapActionHandlers } from 'state/swap/hooks';
2524
import { BigNumber } from 'ethers';
2625
import { TransactionType } from 'models/enums';
@@ -159,36 +158,7 @@ export function useParaswapCallback(
159158
);
160159
}
161160

162-
let isBonusRoute = false;
163-
if (txParams && txParams.data && paraswapContract) {
164-
const response = await callWallchainAPI(
165-
priceRoute.contractMethod,
166-
txParams.data,
167-
txParams.value,
168-
chainId,
169-
account,
170-
paraswapContract,
171-
SmartRouter.PARASWAP,
172-
RouterTypes.SMART,
173-
onBestRoute,
174-
onSetSwapDelay,
175-
100,
176-
);
177-
178-
const swapRouterAddress = chainId
179-
? SWAP_ROUTER_ADDRESS[chainId]
180-
: undefined;
181-
if (
182-
response &&
183-
response.pathFound &&
184-
response.transactionArgs.data &&
185-
swapRouterAddress
186-
) {
187-
txParams.to = swapRouterAddress;
188-
txParams.data = response.transactionArgs.data;
189-
isBonusRoute = true;
190-
}
191-
}
161+
const isBonusRoute = false;
192162

193163
const signer = getSigner(library, account);
194164
const ethersTxParams = convertToEthersTransaction(

src/utils/wallchainService.ts

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)