Skip to content

Commit

Permalink
🐛 Signature error
Browse files Browse the repository at this point in the history
  • Loading branch information
mhetreayush committed Jun 7, 2024
1 parent 3ee4063 commit 96bddbf
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ function App() {
const walletClient = useWalletClient();
const chainId = useChainId();
const { signMessage: wagmiSignMessage, data: signature } = useSignMessage();
const [localSignature, setLocalSignature] = React.useState("");
const [isVerifyingAddress, setIsVerifyingAddress] =
React.useState<boolean>(false);
const [activeStepNumber, setActiveStepNumber] = React.useState<number>(1);
Expand All @@ -133,6 +134,15 @@ function App() {
intervalMs: 1000,
});

React.useEffect(() => {
console.log("Inside useeffect", { signature });
if (typeof signature === "string") {
setLocalSignature(signature);
}
}, [signature]);
React.useEffect(() => {
console.log("Inside useeffect", { localSignature });
}, [localSignature]);
const onWalletConnectSuccess = () => {
setActiveStepNumber(2);
};
Expand Down Expand Up @@ -173,15 +183,18 @@ function App() {
message: signMessage,
});

console.log("Before const message", { localSignature });
const message = new SiweMessage(signMessage);
console.log("Before const session", { localSignature });
const session = {
message,
raw: signMessage,
signature,
signature: localSignature,
};
onVerifyAddressSuccess();

setTimeout(() => {
console.log("Inside timeout", { localSignature, session });
Cookies.set("siwe", JSON.stringify(session), {
expires: expirationTime,
});
Expand Down

0 comments on commit 96bddbf

Please sign in to comment.