diff --git a/src/components/post-form/post-form.tsx b/src/components/post-form/post-form.tsx index 48970b6e..a7206323 100644 --- a/src/components/post-form/post-form.tsx +++ b/src/components/post-form/post-form.tsx @@ -200,7 +200,6 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid: hasCalledAnonAddressRef.current = true; const existingSigner = getExistingSigner(address); if (existingSigner) { - console.log('onPublishReply - existingSigner:', existingSigner); setPublishReplyOptions({ signer: existingSigner, author: { diff --git a/src/hooks/use-anon-mode.ts b/src/hooks/use-anon-mode.ts index f838436b..e932ded5 100644 --- a/src/hooks/use-anon-mode.ts +++ b/src/hooks/use-anon-mode.ts @@ -21,9 +21,9 @@ const useAnonMode = (postCid?: string) => { const signer = await account?.plebbit.createSigner(); if (signer) { if (postCid) { - setThreadSigner(postCid, { privateKey: signer.privateKey, address: signer.address }); + setThreadSigner(postCid, signer); } else { - setAddressSigner({ privateKey: signer.privateKey, address: signer.address }); + setAddressSigner(signer); } } return signer; diff --git a/src/stores/use-anon-mode-store.ts b/src/stores/use-anon-mode-store.ts index eb7e5ea0..c64b1a3d 100644 --- a/src/stores/use-anon-mode-store.ts +++ b/src/stores/use-anon-mode-store.ts @@ -3,13 +3,13 @@ import localForageLru from '@plebbit/plebbit-react-hooks/dist/lib/localforage-lr interface AnonModeState { anonMode: boolean; - threadSigners: { [key: string]: { privateKey: string; address: string } }; - addressSigners: { [address: string]: { privateKey: string; address: string } }; + threadSigners: { [key: string]: any }; + addressSigners: { [address: string]: any }; setAnonMode: (mode: boolean) => void; - setThreadSigner: (postCid: string, signer: { privateKey: string; address: string }) => void; - getThreadSigner: (postCid: string) => { privateKey: string; address: string } | undefined; - setAddressSigner: (signer: { privateKey: string; address: string }) => void; - getAddressSigner: (address: string) => { privateKey: string; address: string } | undefined; + setThreadSigner: (postCid: string, signer: any) => void; + getThreadSigner: (postCid: string) => any | undefined; + setAddressSigner: (signer: any) => void; + getAddressSigner: (address: string) => any | undefined; } const anonModeStore = localForageLru.createInstance({ @@ -22,14 +22,14 @@ const useAnonModeStore = create((set, get) => ({ threadSigners: {}, addressSigners: {}, setAnonMode: (mode: boolean) => set({ anonMode: mode }), - setThreadSigner: (postCid: string, signer: { privateKey: string; address: string }) => { + setThreadSigner: (postCid: string, signer: any) => { set((state) => ({ threadSigners: { ...state.threadSigners, [postCid]: signer }, })); anonModeStore.setItem(postCid, signer); }, getThreadSigner: (postCid: string) => get().threadSigners[postCid], - setAddressSigner: (signer: { privateKey: string; address: string }) => { + setAddressSigner: (signer: any) => { set((state) => ({ addressSigners: { ...state.addressSigners, [signer.address]: signer }, })); @@ -39,9 +39,9 @@ const useAnonModeStore = create((set, get) => ({ })); const initializeAnonModeStore = async () => { - const entries: [string, { privateKey: string; address: string }][] = await anonModeStore.entries(); - const threadSigners: { [key: string]: { privateKey: string; address: string } } = {}; - const addressSigners: { [key: string]: { privateKey: string; address: string } } = {}; + const entries: [string, any][] = await anonModeStore.entries(); + const threadSigners: { [key: string]: any } = {}; + const addressSigners: { [key: string]: any } = {}; entries.forEach(([key, value]) => { if (value.address) { addressSigners[value.address] = value;