src/components/Providers.tsx

Every source

src/components/Providers.tsx
'use client'

import { type SynqSessionInfo, SynqProvider } from '@synqauth/react'
import { siwsPlugin } from '@synqauth/plugin-siws'
import { SynqWalletProvider } from '@synqauth/solana/react'
import type { ReactNode } from 'react'

import { TestWallet } from './TestWallet'

// Synq's provider with the SIWS plugin's browser half, and the wallet layer
// (AERO-2694), which keeps the connected wallet apart from who is signed in
// and lets <AccountPanel> sign in with a wallet in place. Plugins hold
// functions, which a server component can't pass, so the layout renders this
// client component with the server's session.
const siws = siwsPlugin()
export const PLUGINS = [siws]

export function Providers({
  session,
  children,
}: {
  session: SynqSessionInfo
  children: ReactNode
}) {
  return (
    <SynqProvider initialSession={session} plugins={PLUGINS}>
      <TestWallet />
      <SynqWalletProvider>{children}</SynqWalletProvider>
    </SynqProvider>
  )
}

export { siws }