From af78e99254a2afd60414e50249eb3568d9493a1a Mon Sep 17 00:00:00 2001 From: Hau Nguyen Van Date: Wed, 25 Sep 2024 14:49:51 +0700 Subject: [PATCH] finish pepe --- package.json | 2 +- src/hooks/useTokenFee.ts | 11 +++++++++-- yarn.lock | 14 +++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 1e3c35f07..6f958b9c1 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "1.0.51-beta.3", - "@oraichain/oraidex-universal-swap": "1.1.6", + "@oraichain/oraidex-universal-swap": "1.1.8", "@reduxjs/toolkit": "^1.9.3", "@sentry/react": "^7.47.0", "@tanstack/react-query": "^4.32.6", diff --git a/src/hooks/useTokenFee.ts b/src/hooks/useTokenFee.ts index 089db123d..dcfbbda75 100644 --- a/src/hooks/useTokenFee.ts +++ b/src/hooks/useTokenFee.ts @@ -7,7 +7,10 @@ import { toAmount, BigDecimal, ORAI_BRIDGE_EVM_ETH_DENOM_PREFIX, - ORAI_BRIDGE_EVM_DENOM_PREFIX + ORAI_BRIDGE_EVM_DENOM_PREFIX, + PEPE_ORAICHAIN_EXT_DENOM, + PEPE_BSC_CONTRACT, + PEPE_ETH_CONTRACT } from '@oraichain/oraidex-common'; import { OraiswapRouterQueryClient } from '@oraichain/oraidex-contracts-sdk'; import { handleSimulateSwap, isEvmNetworkNativeSwapSupported } from '@oraichain/oraidex-universal-swap'; @@ -59,6 +62,9 @@ export const useRelayerFeeToken = (originalFromToken: TokenItemType, originalToT const [relayerFeeInOrai, setRelayerFeeInOrai] = useState(0); const [relayerFee, setRelayerFeeAmount] = useState(0); const feeConfig = useSelector((state: RootState) => state.token.feeConfigs); + const isFromPepeToken = + originalFromToken.contractAddress && + [PEPE_BSC_CONTRACT, PEPE_ETH_CONTRACT].includes(originalFromToken.contractAddress); const { data: relayerFeeAmount } = useQuery( ['simulate-relayer-data', originalFromToken, originalToToken, relayerFeeInOrai], @@ -77,12 +83,13 @@ export const useRelayerFeeToken = (originalFromToken: TokenItemType, originalToT }); }, { - enabled: !!originalFromToken && !!originalToToken && relayerFeeInOrai > 0 + enabled: !!originalFromToken && !!originalToToken && relayerFeeInOrai > 0 && !isFromPepeToken } ); // get relayer fee in token, by simulate orai vs to token. useEffect(() => { + if (isFromPepeToken) return setRelayerFeeAmount(0); if (relayerFeeAmount) setRelayerFeeAmount(new BigDecimal(relayerFeeAmount?.displayAmount || 0).toNumber()); }, [relayerFeeAmount]); diff --git a/yarn.lock b/yarn.lock index eef760a52..16978688b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4375,9 +4375,9 @@ react-use-websocket "^4.5.0" "@oraichain/oraidex-common@^1.0.91", "@oraichain/oraidex-common@^1.1.6": - version "1.1.17" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.17.tgz#60e038c8c16a52706f3af2704010980638de1b81" - integrity sha512-mYamNz3I87SjYUrU5k/o6ZnZzvH8WaKVRAX02l9+DLwNYOFGC+0QpRzud3VFGJlMeQrBzTuv3TPLEUQZRS9Muw== + version "1.1.18" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-1.1.18.tgz#ef06939daabd7adf5023dd52ab39e040f64ca7d1" + integrity sha512-igH4pFjEB7q8bPEAJXhYa372kU05ZzxOe6C/vntegu0DUjGCJUmKE6ikCG2svs2VytkmEv2D9env70AFGXePEw== dependencies: "@cosmjs/amino" "0.31.3" "@cosmjs/cosmwasm-stargate" "0.31.3" @@ -4421,10 +4421,10 @@ resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365" integrity sha512-/nYztdxEX5LQM4DMJQmi9HvZrBVoY3nLAmYqSKZGZ0U1h1SxU7O/o22R3/pQwB+sAJdcibaI8ygC0ov7jC8paA== -"@oraichain/oraidex-universal-swap@1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.6.tgz#6dcef12170cdca5bd287434c4a3c3460351d0c30" - integrity sha512-sBKJ/CYpWvTRP8vQAbEx/4eDiPt/Mci7PfTIkunshMlH3CmZPk2NAxpLRF6bz+ntS01IZWuEDr4HJK5lNiwK6A== +"@oraichain/oraidex-universal-swap@1.1.8": + version "1.1.8" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.8.tgz#cf3949a95bcc05a0af279d509eec5df1e4d7853e" + integrity sha512-FZroWYzhAfh1QKcNjNgR8d/F54gaWf2mbmYINrrZ+kkuijtfvZ7nA38yu5VnAW3ZuJ0VfNINok1RD1rbgBKThQ== dependencies: "@oraichain/common" "^1.0.3" "@oraichain/oraidex-common" "^1.0.91"