-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.ts
More file actions
83 lines (77 loc) · 2.08 KB
/
Copy pathconfig.ts
File metadata and controls
83 lines (77 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import {
createConfig,
cookieStorage,
type AlchemyAccountsUIConfig,
type CreateConfigProps,
} from "@account-kit/react";
import { alchemy, base, optimism } from "@account-kit/infra";
import { QueryClient } from "@tanstack/react-query";
import { modularAccountFactoryAddresses } from "./lib/utils/modularAccount";
import { SITE_TOPIC_LOGO } from "./context/context";
import Image from "next/image";
import React from "react";
// Define the chains we want to support
export const chains = [base, optimism];
// Default chain for initial connection
const defaultChain = base;
// Create transport
const transport = alchemy({
apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY as string,
});
// Create query client
export const queryClient = new QueryClient();
const uiConfig: AlchemyAccountsUIConfig = {
illustrationStyle: "linear",
auth: {
sections: [
[{ type: "email", emailMode: "otp" }],
[
{ type: "passkey" },
{ type: "social", authProviderId: "google", mode: "popup" },
{ type: "social", authProviderId: "facebook", mode: "popup" },
],
[
{
type: "external_wallets",
walletConnect: {
projectId: process.env.NEXT_PUBLIC_REOWN_PROJECT_ID as string,
},
},
],
],
addPasskeyOnSignup: true,
header: React.createElement(Image, {
src: SITE_TOPIC_LOGO,
alt: "Site Logo",
width: 80,
height: 80,
}),
},
supportUrl: process.env.NEXT_PUBLIC_SUPPORT_URL,
};
// Create the Account Kit config
export const config = createConfig(
{
transport,
chain: defaultChain,
chains: chains.map((chain) => ({
chain,
transport,
})),
ssr: true,
storage: cookieStorage,
enablePopupOauth: true,
accountConfig: {
type: "ModularAccountV2",
accountParams: {
mode: "default",
factoryAddresses: modularAccountFactoryAddresses,
},
gasManagerConfig: {
policyId: process.env.NEXT_PUBLIC_GAS_POLICY_ID,
sponsorUserOperations: true,
},
},
} as CreateConfigProps,
uiConfig
);