Skip to content

Commit

Permalink
fix- local signer storage
Browse files Browse the repository at this point in the history
  • Loading branch information
KannuSingh committed Sep 3, 2024
1 parent 4320a74 commit 493b59f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/laboratory/src/context/LocalEcdsaKeyContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createContext, useContext, useEffect, useState } from 'react'
import { getLocalStorageItem, LOCAL_SIGNER_KEY } from '../utils/LocalStorage'
import { generatePrivateKey, privateKeyToAccount, type PrivateKeyAccount } from 'viem/accounts'
import { useChakraToast } from '../components/Toast'
import { useLocalStorageState } from '../hooks/useLocalStorageState'

type LocalEcdsaKeyContextType = {
privateKey: string | undefined
Expand All @@ -24,7 +25,10 @@ export function LocalEcdsaKeyProvider({ children }: LocalEcdsaKeyProviderProps)
if (!projectId) {
throw new Error('NEXT_PUBLIC_PROJECT_ID is not set')
}
const [privateKey, setPrivateKey] = useState<string | undefined>(undefined)
const [privateKey, setPrivateKey] = useLocalStorageState<string | undefined>(
LOCAL_SIGNER_KEY,
undefined
)

const [signer, setSigner] = useState<PrivateKeyAccount | undefined>()

Expand Down

0 comments on commit 493b59f

Please sign in to comment.