From 3fb52c6a608bf2d1b6aece1a3ff84755cdc9176b Mon Sep 17 00:00:00 2001 From: Jaume Alavedra Date: Tue, 26 Nov 2024 12:43:38 +0100 Subject: [PATCH] chore: use env var to configure --- .../components/EmbeddedSignerRecovery/AccountRecovery.tsx | 7 ++++--- examples/apps/auth-sample/src/pages/connect-wallet.tsx | 1 - examples/apps/auth-sample/src/pages/forgot-password.tsx | 4 ---- examples/apps/auth-sample/src/pages/index.tsx | 2 +- examples/apps/auth-sample/src/pages/link-wallet.tsx | 2 -- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/examples/apps/auth-sample/src/components/EmbeddedSignerRecovery/AccountRecovery.tsx b/examples/apps/auth-sample/src/components/EmbeddedSignerRecovery/AccountRecovery.tsx index be9e8239..45369b2a 100644 --- a/examples/apps/auth-sample/src/components/EmbeddedSignerRecovery/AccountRecovery.tsx +++ b/examples/apps/auth-sample/src/components/EmbeddedSignerRecovery/AccountRecovery.tsx @@ -2,7 +2,8 @@ import {useState} from 'react'; import {useOpenfort} from '../../hooks/useOpenfort'; import Loading from '../Loading'; import { Button } from '../ui/button'; -import { polygonAmoy } from 'viem/chains'; + +const chainId = Number(process.env.NEXT_PUBLIC_CHAIN_ID); const AccountRecovery: React.FC = () => { const {handleRecovery} = useOpenfort(); @@ -34,7 +35,7 @@ const AccountRecovery: React.FC = () => { ) as HTMLInputElement ).value; setLoadingPwd(true); - await handleRecovery({method: 'password', password, chainId: polygonAmoy.id}); + await handleRecovery({method: 'password', password, chainId: chainId}); setLoadingPwd(false); }} > @@ -57,7 +58,7 @@ const AccountRecovery: React.FC = () => { className="bg-white text-black p-2.5 border border-gray-200 rounded-lg w-full hover:bg-gray-100" onClick={async () => { setLoadingAut(true); - await handleRecovery({method:'automatic', chainId: polygonAmoy.id}); + await handleRecovery({method:'automatic', chainId: chainId}); setLoadingAut(false); }} > diff --git a/examples/apps/auth-sample/src/pages/connect-wallet.tsx b/examples/apps/auth-sample/src/pages/connect-wallet.tsx index 843964ef..57c3db6d 100644 --- a/examples/apps/auth-sample/src/pages/connect-wallet.tsx +++ b/examples/apps/auth-sample/src/pages/connect-wallet.tsx @@ -1,7 +1,6 @@ import Head from 'next/head'; import Link from 'next/link'; import {useEffect, useState} from 'react'; - import {AuthLayout} from '../components/Layouts/AuthLayout'; import openfort from '../utils/openfortConfig'; import {StatusType, Toast} from '../components/Toasts'; diff --git a/examples/apps/auth-sample/src/pages/forgot-password.tsx b/examples/apps/auth-sample/src/pages/forgot-password.tsx index bda26266..e2227b96 100644 --- a/examples/apps/auth-sample/src/pages/forgot-password.tsx +++ b/examples/apps/auth-sample/src/pages/forgot-password.tsx @@ -1,14 +1,10 @@ import {useState, useEffect} from 'react'; - import Head from 'next/head'; import Link from 'next/link'; import {useRouter} from 'next/router'; - import {AuthLayout} from '../components/Layouts/AuthLayout'; import {TextField} from '../components/Fields'; - import {StatusType, Toast} from '../components/Toasts'; - import openfort from '../utils/openfortConfig'; import {getURL} from '../utils/getUrl'; import {AuthPlayerResponse} from '@openfort/openfort-js'; diff --git a/examples/apps/auth-sample/src/pages/index.tsx b/examples/apps/auth-sample/src/pages/index.tsx index 2e04d97f..4139f001 100644 --- a/examples/apps/auth-sample/src/pages/index.tsx +++ b/examples/apps/auth-sample/src/pages/index.tsx @@ -24,7 +24,7 @@ import { Wallet } from 'lucide-react'; import AccountActions from '@/components/AccountActions/AccountActions'; const HomePage: NextPage = () => { - const {state, handleRecovery} = useOpenfort(); + const {state} = useOpenfort(); const [user, setUser] = useState(null); const router = useRouter(); const [message, setMessage] = useState(''); diff --git a/examples/apps/auth-sample/src/pages/link-wallet.tsx b/examples/apps/auth-sample/src/pages/link-wallet.tsx index 3610c95c..7cb159ad 100644 --- a/examples/apps/auth-sample/src/pages/link-wallet.tsx +++ b/examples/apps/auth-sample/src/pages/link-wallet.tsx @@ -1,7 +1,6 @@ import Head from 'next/head'; import Link from 'next/link'; import {useEffect, useState} from 'react'; - import {AuthLayout} from '../components/Layouts/AuthLayout'; import openfort from '../utils/openfortConfig'; import {StatusType, Toast} from '../components/Toasts'; @@ -9,7 +8,6 @@ import {AuthPlayerResponse} from '@openfort/openfort-js'; import {useRouter} from 'next/router'; import {getWalletButtons} from '../components/WalletConnectButton'; import {Chain, WalletConnector} from '../utils/constants'; -import {useAccount} from 'wagmi'; function LinkWalletPage() { const [user, setUser] = useState(null);