Skip to content

Commit

Permalink
replace alchemy with ankr
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Sep 26, 2022
1 parent 334e9f2 commit 8f1ef07
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
File renamed without changes.
13 changes: 10 additions & 3 deletions apps/web/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
wallet,
} from '@rainbow-me/rainbowkit';
import { chain, configureChains, createClient, WagmiConfig } from 'wagmi';
import { alchemyProvider } from 'wagmi/providers/alchemy';
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
import { publicProvider } from 'wagmi/providers/public';
import { SessionProvider } from 'next-auth/react';
import {
Expand All @@ -22,8 +22,15 @@ import { Hydrate, QueryClient, QueryClientProvider } from '@tanstack/react-query
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

const { chains, provider, webSocketProvider } = configureChains(
[chain.goerli, chain.polygon, chain.optimism, chain.polygonMumbai],
[alchemyProvider({ apiKey: process.env.ALCHEMY_API_KEY }), publicProvider()]
[chain.goerli],
[
jsonRpcProvider({
rpc: (chain) => ({
http: process.env.ANKR_GOERLI_RPC_URL as string,
}),
}),
publicProvider(),
]
);

const { wallets } = getDefaultWallets({
Expand Down
23 changes: 5 additions & 18 deletions apps/web/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
/* eslint-disable turbo/no-undeclared-env-vars */
import { IncomingMessage } from 'http';
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 { SiweMessage } from 'siwe';
// import { DynamoDBAdapter } from '@next-auth/dynamodb-adapter';
// import { ddb } from 'database';
// import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';

const config = {
credentials: {
accessKeyId: process.env.NEXT_AUTH_AWS_ACCESS_KEY as string,
secretAccessKey: process.env.NEXT_AUTH_AWS_SECRET_KEY as string,
},
region: process.env.NEXT_AUTH_AWS_REGION,
};

export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
const providers = [
Expand All @@ -24,8 +12,10 @@ export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
try {
const siwe = new SiweMessage(JSON.parse(credentials?.message || '{}'));

const nextAuthUrl = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : process.env.NEXTAUTH_URL;

const nextAuthUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: process.env.NEXTAUTH_URL;
console.log({ nextAuthUrl });
if (!nextAuthUrl) {
return null;
}
Expand Down Expand Up @@ -76,10 +66,7 @@ export function getAuthOptions(req: IncomingMessage): NextAuthOptions {
// https://next-auth.js.org/configuration/providers/oauth
providers,
secret: process.env.NEXTAUTH_SECRET,
session: {
strategy: 'jwt',
},
// adapter: DynamoDBAdapter(config),
session: { strategy: 'jwt' },
};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "graph-flow",
"name": "token-flow",
"version": "0.0.1",
"description": "crypto automation",
"workspaces": [
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"env": [
"NEXTAUTH_URL",
"NEXTAUTH_SECRET",
"ANKR_GOERLI_RPC_URL",
"ANKR_GOERLI_WS_URL",
"NEXT_PUBLIC_ALCHEMY_API_KEY",
"ALCHEMY_API_KEY",
"NEXT_PUBLIC_ENABLE_TESTNETS",
"VERCEL_URL",
Expand Down

1 comment on commit 8f1ef07

@vercel
Copy link

@vercel vercel bot commented on 8f1ef07 Sep 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

token-flow – ./

token-flow-git-main-404dao.vercel.app
token-flow-404dao.vercel.app
token-flow-web-ag81.vercel.app

Please sign in to comment.