Skip to content

Commit

Permalink
fix eip155 sending (#646)
Browse files Browse the repository at this point in the history
* fix kk rest

* fix kk rest

* fix wc v2

* fix eip155 sending
  • Loading branch information
amitojsingh366 authored Jun 16, 2023
1 parent aa5c26f commit d36c6cf
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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<EthChainData>()

useEffect(() => {
setTimeout(() => setBeen10Seconds(true), 10000)
}, [])

const [loading, setLoading] = useState(false)
useEffect(() => {
setLoading(
loadingAddress ||
loadingGas ||
(loadingGas && !been10Seconds) ||
loadingNonce ||
loadingGasEstimate ||
loadingPriceData ||
Expand All @@ -104,16 +113,22 @@ 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']
const { topic, params, id } = currentRequest
const { request, chainId: chainIdString } = params
const [chainId, setChainId] = useState<number>()

useEffect(() => {
if (!chainId) return
web3ByChainId(Number(chainId)).then(setLegacyWeb3)
}, [chainId])

useEffect(() => {
;(async () => {
if (!keepKeyWallet) return
Expand Down

0 comments on commit d36c6cf

Please sign in to comment.