-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlayout.tsx
More file actions
33 lines (28 loc) · 1.01 KB
/
layout.tsx
File metadata and controls
33 lines (28 loc) · 1.01 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
'use client';
import { useEffect, ReactNode } from 'react';
import { registerLazorkitWallet } from '@lazorkit/wallet';
const CONFIG = {
RPC_URL: process.env.NEXT_PUBLIC_SOLANA_RPC_URL || 'https://api.devnet.solana.com',
PORTAL_URL: process.env.NEXT_PUBLIC_LAZORKIT_PORTAL_URL || 'https://portal.lazor.sh',
PAYMASTER: {
paymasterUrl: process.env.NEXT_PUBLIC_LAZORKIT_PAYMASTER_URL || 'https://kora.devnet.lazorkit.com',
},
CLUSTER: 'devnet' as const,
};
// Module-level flag to ensure single registration across HMR
let lazorkitRegistered = false;
export default function WalletAdapterLayout({ children }: { children: ReactNode }) {
useEffect(() => {
// Register LazorKit once for all wallet adapter recipes
if (!lazorkitRegistered) {
lazorkitRegistered = true;
registerLazorkitWallet({
rpcUrl: CONFIG.RPC_URL,
portalUrl: CONFIG.PORTAL_URL,
paymasterConfig: CONFIG.PAYMASTER,
clusterSimulation: CONFIG.CLUSTER,
});
}
}, []);
return <>{children}</>;
}