Skip to content

Commit 1d68c72

Browse files
committed
chore: remove SIWE statement
1 parent 2008ca6 commit 1d68c72

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

app/config/index.tsx

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
1+
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
22
import {
33
type SIWECreateMessageArgs,
44
type SIWESession,
55
type SIWEVerifyMessageArgs,
66
createSIWEConfig,
77
formatMessage,
8-
} from "@reown/appkit-siwe";
8+
} from '@reown/appkit-siwe';
99
import {
10-
AppKitNetwork,
10+
type AppKitNetwork,
1111
arbitrum,
1212
base,
1313
mainnet,
1414
optimism,
15-
} from "@reown/appkit/networks";
16-
import { getCsrfToken, getSession, signIn, signOut } from "next-auth/react";
17-
import { getAddress } from "viem";
15+
} from '@reown/appkit/networks';
16+
import { getCsrfToken, getSession, signIn, signOut } from 'next-auth/react';
17+
import { getAddress } from 'viem';
1818

1919
export const projectId = process.env.NEXT_PUBLIC_PROJECT_ID;
20-
if (!projectId) throw new Error("Project ID is not defined");
20+
if (!projectId) throw new Error('Project ID is not defined');
2121

2222
export const metadata = {
23-
name: "Pattern",
24-
description: "Pattern is a decentralized agentic RAG network",
25-
url: "https://pattern.global/",
26-
icons: ["https://avatars.githubusercontent.com/u/112399339"],
23+
name: 'Pattern',
24+
description: 'Pattern is a decentralized agentic RAG network',
25+
url: 'https://pattern.global/',
26+
icons: ['https://avatars.githubusercontent.com/u/112399339'],
2727
};
2828

2929
export const chains: [AppKitNetwork, ...AppKitNetwork[]] = [
@@ -41,11 +41,11 @@ export const wagmiAdapter = new WagmiAdapter({
4141

4242
const normalizeAddress = (address: string): string => {
4343
try {
44-
const splitAddress = address.split(":");
44+
const splitAddress = address.split(':');
4545
const extractedAddress = splitAddress[splitAddress.length - 1];
4646
const checksumAddress = getAddress(extractedAddress);
4747
splitAddress[splitAddress.length - 1] = checksumAddress;
48-
const normalizedAddress = splitAddress.join(":");
48+
const normalizedAddress = splitAddress.join(':');
4949

5050
return normalizedAddress;
5151
} catch (error) {
@@ -55,17 +55,16 @@ const normalizeAddress = (address: string): string => {
5555

5656
export const siweConfig = createSIWEConfig({
5757
getMessageParams: async () => ({
58-
domain: typeof window !== "undefined" ? window.location.host : "",
59-
uri: typeof window !== "undefined" ? window.location.origin : "",
60-
chains: chains.map((chain: AppKitNetwork) => parseInt(chain.id.toString())),
61-
statement: "Please sign with your account",
58+
domain: typeof window !== 'undefined' ? window.location.host : '',
59+
uri: typeof window !== 'undefined' ? window.location.origin : '',
60+
chains: chains.map((chain: AppKitNetwork) => Number.parseInt(chain.id.toString())),
6261
}),
6362
createMessage: ({ address, ...args }: SIWECreateMessageArgs) =>
6463
formatMessage(args, normalizeAddress(address)),
6564
getNonce: async () => {
6665
const nonce = await getCsrfToken();
6766
if (!nonce) {
68-
throw new Error("Failed to get nonce!");
67+
throw new Error('Failed to get nonce!');
6968
}
7069

7170
return nonce;
@@ -78,8 +77,8 @@ export const siweConfig = createSIWEConfig({
7877

7978
// Validate address and chainId types
8079
if (
81-
typeof session.address !== "string" ||
82-
typeof session.chainId !== "number"
80+
typeof session.address !== 'string' ||
81+
typeof session.chainId !== 'number'
8382
) {
8483
return null;
8584
}
@@ -91,11 +90,11 @@ export const siweConfig = createSIWEConfig({
9190
},
9291
verifyMessage: async ({ message, signature }: SIWEVerifyMessageArgs) => {
9392
try {
94-
const success = await signIn("credentials", {
93+
const success = await signIn('credentials', {
9594
message,
9695
redirect: false,
9796
signature,
98-
callbackUrl: "/protected",
97+
callbackUrl: '/protected',
9998
});
10099

101100
return Boolean(success?.ok);

0 commit comments

Comments
 (0)