forked from Particle-Network/zircuit-aa-connect
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconnectkit.tsx
84 lines (77 loc) · 2.39 KB
/
connectkit.tsx
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
84
"use client";
import React from "react";
import { ConnectKitProvider, createConfig } from "@particle-network/connectkit";
import { authWalletConnectors } from "@particle-network/connectkit/auth";
// embedded wallet start
import { EntryPosition, wallet } from "@particle-network/connectkit/wallet";
// embedded wallet end
// aa start
import { aa } from "@particle-network/connectkit/aa";
// aa end
// evm start
import { scroll, scrollSepolia } from "@particle-network/connectkit/chains";
import {
evmWalletConnectors,
passkeySmartWallet,
} from "@particle-network/connectkit/evm";
// evm end
const projectId = process.env.NEXT_PUBLIC_PROJECT_ID as string;
const clientKey = process.env.NEXT_PUBLIC_CLIENT_KEY as string;
const appId = process.env.NEXT_PUBLIC_APP_ID as string;
const walletConnectProjectId = process.env
.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID as string;
if (!projectId || !clientKey || !appId) {
throw new Error("Please configure the Particle project in .env first!");
}
const config = createConfig({
projectId,
clientKey,
appId,
appearance: {
recommendedWallets: [
{ walletId: "metaMask", label: "Recommended" },
{ walletId: "coinbaseWallet", label: "Popular" },
],
language: "en-US",
connectorsOrder: ["passkey", "social", "wallet"],
},
walletConnectors: [
authWalletConnectors(),
// evm start
evmWalletConnectors({
// TODO: replace it with your app metadata.
metadata: {
name: "Connectkit Demo",
icon:
typeof window !== "undefined"
? `${window.location.origin}/favicon.ico`
: "",
description: "Particle Connectkit Next.js Scaffold.",
url: typeof window !== "undefined" ? window.location.origin : "",
},
connectorFns: [passkeySmartWallet()],
multiInjectedProviderDiscovery: true,
walletConnectProjectId: walletConnectProjectId,
}),
// evm end
],
plugins: [
// embedded wallet start
wallet({
visible: true,
entryPosition: EntryPosition.BR,
}),
// embedded wallet end
// aa config start
aa({
name: "BICONOMY",
version: "2.0.0",
}),
// aa config end
],
chains: [scroll, scrollSepolia],
});
// Wrap your application with this component.
export const ParticleConnectkit = ({ children }: React.PropsWithChildren) => {
return <ConnectKitProvider config={config}>{children}</ConnectKitProvider>;
};