diff --git a/src/components/bridge/originInfo.tsx b/src/components/bridge/originInfo.tsx index 5ed9055a..70efa7f4 100644 --- a/src/components/bridge/originInfo.tsx +++ b/src/components/bridge/originInfo.tsx @@ -21,8 +21,8 @@ const OriginInfo = ({ setTokenInputAmount, getSpecificBalance, }: OriginInfoType) => { - const { data } = useGetIqPriceQuery() - const exchangeRate = data?.response || 0.0 + const { data } = useGetIqPriceQuery('IQ') + const exchangeRate = +data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 return ( diff --git a/src/components/client/BridgePage.tsx b/src/components/client/BridgePage.tsx index 7cfd4156..99a442df 100644 --- a/src/components/client/BridgePage.tsx +++ b/src/components/client/BridgePage.tsx @@ -42,7 +42,7 @@ const BridgePage = () => { const { accountName = '' } = activeUser ?? {} const [selectedToken, setSelectedToken] = useState(TOKENS[0]) const [selectedTokenIcon, setSelectedTokenIcon] = useState() - const [tokenInputAmount, setTokenInputAmount] = useState() + const [tokenInputAmount, setTokenInputAmount] = useState('0') const [inputAddress, setInputAddress] = useState() const [inputAccount, setInputAccount] = useState( activeUser ? accountName : '', @@ -55,8 +55,8 @@ const BridgePage = () => { const { switchNetwork, isSuccess } = useSwitchNetwork() const { chain } = useNetwork() const chainId = parseInt(config.chainId) - const { data } = useGetIqPriceQuery() - const exchangeRate = data?.response || 0.0 + const { data } = useGetIqPriceQuery('IQ') + const exchangeRate = data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 const inputRef = useRef(null) const { iqBalanceOnEth, diff --git a/src/components/client/StakePage.tsx b/src/components/client/StakePage.tsx index 7dc44aae..e95569b7 100644 --- a/src/components/client/StakePage.tsx +++ b/src/components/client/StakePage.tsx @@ -53,8 +53,8 @@ const StakePage = () => { const { chain } = useNetwork() const chainId = parseInt(config.chainId) const { switchNetwork, isSuccess } = useSwitchNetwork() - const { data: iqData } = useGetIqPriceQuery() - const exchangeRate = iqData?.response || 0.0 + const { data: iqData } = useGetIqPriceQuery('IQ') + const exchangeRate = iqData?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 const resetValues = () => { setIsProcessingUnlock(false) setTrxHash(undefined) diff --git a/src/components/dashboard/IQButton.tsx b/src/components/dashboard/IQButton.tsx index 2227e990..801cbe89 100644 --- a/src/components/dashboard/IQButton.tsx +++ b/src/components/dashboard/IQButton.tsx @@ -7,8 +7,9 @@ import { useGetIqPriceQuery } from '@/services/iqPrice' export const IQButton = (props: ButtonProps) => { const SIG_FIGS = 4 - const { data, isLoading, error } = useGetIqPriceQuery() - const iqPrice = data?.response + const { data, isLoading, error } = useGetIqPriceQuery('IQ') + + const iqPrice = data?.response?.data?.IQ[0]?.quote?.USD?.price || 0.0 return ( <>