diff --git a/apps/kyberswap-interface/.env.production b/apps/kyberswap-interface/.env.production index 420c1fe2c9..9656ea5c48 100644 --- a/apps/kyberswap-interface/.env.production +++ b/apps/kyberswap-interface/.env.production @@ -1,5 +1,4 @@ -VITE_AGGREGATOR_API=https://aggregator-api.kyberswap.com -# VITE_AGGREGATOR_API=https://pre-router-api.kyberengineering.io +VITE_AGGREGATOR_API=https://pre-router-api.kyberengineering.io VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com VITE_SERVICE_WORKER=false @@ -18,13 +17,13 @@ VITE_TELEGRAM_BOT_URL=https://t.me/KyberSwapNotifierBot VITE_TRANSAK_URL=https://global.transak.com VITE_TRANSAK_API_KEY=48949c0b-2d20-4e3a-a311-51ca91ae8c0d -VITE_KS_SETTING_API=https://ks-setting.kyberswap.com/api +VITE_KS_SETTING_API=https://pre-ks-setting.kyberengineering.io/api VITE_COMMON_SERVICE_API=https://common-service.kyberswap.com/api VITE_BLACKJACK_API=https://blackjack.kyberswap.com/api VITE_GTM_ID=GTM-TRQCJ8F -VITE_LIMIT_ORDER_API=https://limit-order.kyberswap.com +VITE_LIMIT_ORDER_API=https://pre-limit-order.kyberengineering.io # Kyber DAO Apis VITE_KYBER_DAO_STATS_API=https://dao-stats.kyberswap.com @@ -36,14 +35,14 @@ VITE_KYBER_AI_REFERRAL_ID=1 VITE_KYBER_AI_TOPIC_ID=9,11 VITE_PRICE_ALERT_TOPIC_ID=8 VITE_ELASTIC_POOL_TOPIC_ID=7 -VITE_BFF_API=https://bff.kyberswap.com/api +VITE_BFF_API=https://pre-kyberswap-bff.kyberengineering.io/api VITE_BUCKET_NAME=ks-setting-1d682dca VITE_WALLETCONNECT_PROJECT_ID=b5b37945209ea323811f1032e84eaeb5 VITE_CAMPAIGN_URL=https://arbitrum-stip.kyberswap.com/api VITE_REFERRAL_URL=https://referral.kyberswap.com/api -VITE_TOKEN_API_URL=https://token-api.kyberswap.com/api +VITE_TOKEN_API_URL=https://pre-token-api.kyberengineering.io/api VITE_ZAP_API_URL=https://zap-api.kyberswap.com # VITE_ZAP_API_URL=https://pre-zap-api.kyberengineering.io VITE_ZAP_EARN_URL=https://earn-service.kyberswap.com/api diff --git a/apps/kyberswap-interface/src/components/SwapForm/hooks/useBuildRoute.tsx b/apps/kyberswap-interface/src/components/SwapForm/hooks/useBuildRoute.tsx index 58d8b03a9a..30d579f673 100644 --- a/apps/kyberswap-interface/src/components/SwapForm/hooks/useBuildRoute.tsx +++ b/apps/kyberswap-interface/src/components/SwapForm/hooks/useBuildRoute.tsx @@ -62,10 +62,26 @@ const useBuildRoute = (args: Args) => { const refCode = getCookieValue('refCode') + const rawAmountInUsd = routeSummary.rawAmountInUsd + const rawAmountOutUsd = routeSummary.rawAmountOutUsd + + if (!rawAmountInUsd || !rawAmountOutUsd) { + console.warn('[useBuildRoute] Missing USD values before build route', { + amountInUsd: routeSummary.amountInUsd, + amountOutUsd: routeSummary.amountOutUsd, + rawAmountInUsd, + rawAmountOutUsd, + tokenIn: routeSummary.tokenIn, + tokenOut: routeSummary.tokenOut, + amountIn: routeSummary.amountIn, + amountOut: routeSummary.amountOut, + }) + } + const rawRouteSummary = { ...routeSummary, - amountInUsd: routeSummary.rawAmountInUsd as string, - amountOutUsd: routeSummary.rawAmountOutUsd as string, + amountInUsd: rawAmountInUsd as string, + amountOutUsd: rawAmountOutUsd as string, } delete rawRouteSummary.rawAmountInUsd @@ -95,7 +111,7 @@ const useBuildRoute = (args: Args) => { recipient: to || account, source: clientId || 'kyberswap', skipSimulateTx: false, - enableGasEstimation: true, + enableGasEstimation: false, permit, referral: refCode, // for calculating price impact only diff --git a/apps/kyberswap-interface/src/components/swapv2/LimitOrder/LimitOrderForm.tsx b/apps/kyberswap-interface/src/components/swapv2/LimitOrder/LimitOrderForm.tsx index ecc5919487..399fd7e3ce 100644 --- a/apps/kyberswap-interface/src/components/swapv2/LimitOrder/LimitOrderForm.tsx +++ b/apps/kyberswap-interface/src/components/swapv2/LimitOrder/LimitOrderForm.tsx @@ -752,6 +752,9 @@ const LimitOrderForm = forwardRef(function LimitOrd inputAmount, outputAmount, expiredAt, + + // FIXME: Hardcode for Zohar + allowedSenders: ['0xB2A2648Dc6962016501EeDbB47C32a50aB777B7A'], nativeOutput: currencyOut?.isNative || false, }) if (order_id) { diff --git a/apps/kyberswap-interface/src/components/swapv2/LimitOrder/helpers.ts b/apps/kyberswap-interface/src/components/swapv2/LimitOrder/helpers.ts index 6209352809..d5b5ff0803 100644 --- a/apps/kyberswap-interface/src/components/swapv2/LimitOrder/helpers.ts +++ b/apps/kyberswap-interface/src/components/swapv2/LimitOrder/helpers.ts @@ -149,6 +149,7 @@ export const getPayloadCreateOrder = (params: CreateOrderParam) => { makingAmount: parseInputAmount?.quotient?.toString(), takingAmount: tryParseAmount(outputAmount, currencyOut)?.quotient?.toString(), expiredAt: Math.floor(expiredAt / 1000), + allowedSenders: params.allowedSenders, nativeOutput: currencyOut?.isNative || false, ...(referral ? { referral } : {}), } diff --git a/apps/kyberswap-interface/src/components/swapv2/LimitOrder/type.ts b/apps/kyberswap-interface/src/components/swapv2/LimitOrder/type.ts index 0b287ea257..de336e3226 100644 --- a/apps/kyberswap-interface/src/components/swapv2/LimitOrder/type.ts +++ b/apps/kyberswap-interface/src/components/swapv2/LimitOrder/type.ts @@ -138,5 +138,6 @@ export type CreateOrderParam = { orderId?: number signature?: string salt?: string + allowedSenders?: string[] referral?: string } diff --git a/apps/kyberswap-interface/src/hooks/useChainsConfig.ts b/apps/kyberswap-interface/src/hooks/useChainsConfig.ts index 57a87714c7..2c34bf0357 100644 --- a/apps/kyberswap-interface/src/hooks/useChainsConfig.ts +++ b/apps/kyberswap-interface/src/hooks/useChainsConfig.ts @@ -1,10 +1,11 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { useMemo } from 'react' -import { useGetChainsConfigurationQuery } from 'services/ksSetting' +// import { useGetChainsConfigurationQuery } from 'services/ksSetting' import { MAINNET_NETWORKS, NETWORKS_INFO as NETWORKS_INFO_HARDCODE } from 'constants/networks' import { NetworkInfo } from 'constants/networks/type' -import { useKyberswapGlobalConfig } from 'hooks/useKyberSwapConfig' + +// import { useKyberswapGlobalConfig } from 'hooks/useKyberSwapConfig' export enum ChainState { NEW = 'new', @@ -26,15 +27,14 @@ export const NETWORKS_INFO = new Proxy(NETWORKS_INFO_HARDCODE, { const defaultData = MAINNET_NETWORKS.map(chainId => NETWORKS_INFO_HARDCODE[chainId]) export default function useChainsConfig() { - const { data } = useGetChainsConfigurationQuery() - const globalConfig = useKyberswapGlobalConfig() + // const { data } = useGetChainsConfigurationQuery() + // const globalConfig = useKyberswapGlobalConfig() return useMemo(() => { - const hasBeConfig = !!data - // const chains: NetworkInfo[] = (data || defaultData).map(chain => { + // const hasConfig = !!data const chains: NetworkInfo[] = defaultData.map(chain => { const chainId = +chain.chainId as ChainId - const chainState = hasBeConfig ? globalConfig?.chainStates?.[chainId] : ChainState.ACTIVE + const chainState = ChainState.ACTIVE const info = { ...NETWORKS_INFO_HARDCODE[chainId], ...chain, // BE config @@ -52,5 +52,5 @@ export default function useChainsConfig() { ), allChains: chains, } - }, [data, globalConfig]) + }, []) } diff --git a/apps/kyberswap-interface/src/services/route/index.ts b/apps/kyberswap-interface/src/services/route/index.ts index cb5a835afd..0dc0b1f468 100644 --- a/apps/kyberswap-interface/src/services/route/index.ts +++ b/apps/kyberswap-interface/src/services/route/index.ts @@ -30,7 +30,7 @@ const routeApi = createApi({ const { chainId, tokenInDecimals, tokenOutDecimals, ...rest } = params return { url, - params: rest, + params: { ...rest, enableAlphaFee: true }, authentication, headers: { 'x-client-id': clientId || 'kyberswap', @@ -92,6 +92,19 @@ const routeApi = createApi({ const tokenInBalance = CurrencyAmount.fromRawAmount(currencyIn, amountIn).toExact() const tokenOutBalance = CurrencyAmount.fromRawAmount(currencyOut, amountOut).toExact() + if (!tokenInMidPrice || !tokenOutMidPrice) { + console.warn('[getRoute] Mid-price missing', { + tokenIn, + tokenOut, + wrappedTokenIn, + wrappedTokenOut, + tokenInPrices, + tokenOutPrices, + rawAmountInUsd: routeSummary.amountInUsd, + rawAmountOutUsd: routeSummary.amountOutUsd, + }) + } + return { ...baseResponse, data: {