diff --git a/packages/keepkey-desktop-app/src/plugins/walletConnectToDapps/components/modal/callRequest/EIP155SendTransactionConfirmation.tsx b/packages/keepkey-desktop-app/src/plugins/walletConnectToDapps/components/modal/callRequest/EIP155SendTransactionConfirmation.tsx index c53c2f659..495f6e9b3 100644 --- a/packages/keepkey-desktop-app/src/plugins/walletConnectToDapps/components/modal/callRequest/EIP155SendTransactionConfirmation.tsx +++ b/packages/keepkey-desktop-app/src/plugins/walletConnectToDapps/components/modal/callRequest/EIP155SendTransactionConfirmation.tsx @@ -12,6 +12,8 @@ import { Card } from 'components/Card/Card' import { KeepKeyIcon } from 'components/Icons/KeepKeyIcon' import { Text } from 'components/Text' import { getChainAdapterManager } from 'context/PluginProvider/chainAdapterSingleton' +import type { EthChainData } from 'context/WalletProvider/web3byChainId' +import { web3ByChainId } from 'context/WalletProvider/web3byChainId' import { useWallet } from 'hooks/useWallet/useWallet' import { WalletConnectSignClient } from 'kkdesktop/walletconnect/utils' import { bn, bnOrZero } from 'lib/bignumber/bignumber' @@ -86,12 +88,19 @@ export const EIP155SendTransactionConfirmation = () => { const [loadingGasEstimate, setLoadingGasEstimate] = useState(true) const [loadingPriceData, setLoadingPriceData] = useState(true) const [loadingSigningInProgress, setLoadingSigningInProgress] = useState(false) + const [been10Seconds, setBeen10Seconds] = useState(false) + + const [legacyWeb3, setLegacyWeb3] = useState() + + useEffect(() => { + setTimeout(() => setBeen10Seconds(true), 10000) + }, []) const [loading, setLoading] = useState(false) useEffect(() => { setLoading( loadingAddress || - loadingGas || + (loadingGas && !been10Seconds) || loadingNonce || loadingGasEstimate || loadingPriceData || @@ -104,9 +113,10 @@ export const EIP155SendTransactionConfirmation = () => { loadingGasEstimate, loadingPriceData, loadingSigningInProgress, + been10Seconds, ]) - const { requests, removeRequest, isConnected, dapp, legacyWeb3 } = useWalletConnect() + const { requests, removeRequest, isConnected, dapp } = useWalletConnect() const toast = useToast() const currentRequest = requests[0] as SignClientTypes.EventArguments['session_request'] @@ -114,6 +124,11 @@ export const EIP155SendTransactionConfirmation = () => { const { request, chainId: chainIdString } = params const [chainId, setChainId] = useState() + useEffect(() => { + if (!chainId) return + web3ByChainId(Number(chainId)).then(setLegacyWeb3) + }, [chainId]) + useEffect(() => { ;(async () => { if (!keepKeyWallet) return