Skip to content

Commit

Permalink
fix: replaced wagmiConfig with shared config
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSinclair committed May 31, 2024
1 parent ef2c596 commit 5e0307f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { NextApiRequest, NextApiResponse } from 'next';
import NextAuth, { NextAuthOptions } from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
import { getCsrfToken } from 'next-auth/react';
import { wagmiConfig } from '../../_app';
import { ByteArray, Hex, Signature, publicActions } from 'viem';
import { parseSiweMessage } from 'viem/siwe';

import { config } from '../../../wagmi';

export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
const providers = [
CredentialsProvider({
Expand Down Expand Up @@ -44,7 +45,7 @@ export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
return null;
}

const publicClient = wagmiConfig.getClient().extend(publicActions);
const publicClient = config.getClient().extend(publicActions);

const valid = await publicClient.verifyMessage({
address,
Expand Down
9 changes: 6 additions & 3 deletions packages/example/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import Head from 'next/head';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { WagmiProvider, useDisconnect } from 'wagmi';
import {
AvatarComponent,
DisclaimerComponent,
Expand All @@ -19,7 +17,12 @@ import {
lightTheme,
midnightTheme,
} from '@rainbow-me/rainbowkit';
import { RainbowKitSiweNextAuthProvider } from '@rainbow-me/rainbowkit-siwe-next-auth';
import {
GetSiweMessageOptions,
RainbowKitSiweNextAuthProvider,
} from '@rainbow-me/rainbowkit-siwe-next-auth';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { WagmiProvider, useDisconnect } from 'wagmi';

import { AppContextProps } from '../lib/AppContextProps';
import { config } from '../wagmi';
Expand Down
5 changes: 3 additions & 2 deletions packages/example/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import CredentialsProvider from 'next-auth/providers/credentials';
import { getCsrfToken } from 'next-auth/react';
import { ByteArray, Hex, Signature, publicActions } from 'viem';
import { parseSiweMessage } from 'viem/siwe';
import { wagmiConfig } from '../../_app';

import { config } from '../../../wagmi';

export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
const providers = [
Expand Down Expand Up @@ -44,7 +45,7 @@ export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
return null;
}

const publicClient = wagmiConfig.getClient().extend(publicActions);
const publicClient = config.getClient().extend(publicActions);

const valid = await publicClient.verifyMessage({
address,
Expand Down

0 comments on commit 5e0307f

Please sign in to comment.