From f6763a770eed338d191727b874927a365a4c70aa Mon Sep 17 00:00:00 2001 From: BrickheadJohnny Date: Tue, 26 Nov 2024 10:09:10 +0100 Subject: [PATCH] feat(SignInDialog): generate SIWE URL on the fly --- src/components/SignInDialog.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/SignInDialog.tsx b/src/components/SignInDialog.tsx index e522099b84..89c8cfbec9 100644 --- a/src/components/SignInDialog.tsx +++ b/src/components/SignInDialog.tsx @@ -91,12 +91,14 @@ const SignInWithEthereum = () => { .then((res) => res.json()) .then((data) => z.object({ nonce: z.string() }).parse(data)); + const url = new URL(window.location.href); + const message = createSiweMessage({ address: address!, chainId: 1, - domain: new URL(env.NEXT_PUBLIC_SIWE_URL).hostname, + domain: url.hostname, nonce, - uri: env.NEXT_PUBLIC_SIWE_URL, + uri: url.origin, version: "1", });