Skip to content

Commit

Permalink
finish pepe
Browse files Browse the repository at this point in the history
  • Loading branch information
haunv3 committed Sep 25, 2024
1 parent d1e09df commit af78e99
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions src/hooks/useTokenFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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],
Expand All @@ -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]);

Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit af78e99

Please sign in to comment.