43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { createConfig, http } from 'wagmi';
|
|
import { mainnet, sepolia, base, arbitrum } from 'wagmi/chains';
|
|
import { createWeb3Modal } from '@web3modal/wagmi';
|
|
|
|
// 1. Get projectId at https://cloud.walletconnect.com
|
|
const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID || '';
|
|
if (!projectId) {
|
|
// eslint-disable-next-line no-console
|
|
console.warn('[Web3] Missing NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID. WalletConnect wallet list will be limited.');
|
|
}
|
|
|
|
// 2. Create wagmiConfig
|
|
const metadata = {
|
|
name: 'MortgageFi',
|
|
description: 'Decentralized Mortgage Lending Platform',
|
|
url: 'https://mortgagefi.app',
|
|
icons: ['https://mortgagefi.app/logo.png']
|
|
};
|
|
|
|
export const config = createConfig({
|
|
chains: [base, arbitrum, mainnet, sepolia],
|
|
transports: {
|
|
[base.id]: http(),
|
|
[arbitrum.id]: http(),
|
|
[mainnet.id]: http(),
|
|
[sepolia.id]: http(),
|
|
},
|
|
ssr: true,
|
|
});
|
|
|
|
// 3. Create modal
|
|
export const web3Modal = createWeb3Modal({
|
|
wagmiConfig: config,
|
|
projectId: projectId || 'missing_project_id',
|
|
enableAnalytics: true,
|
|
enableOnramp: true,
|
|
themeMode: 'light',
|
|
themeVariables: {
|
|
'--w3m-accent': '#4F46E5',
|
|
'--w3m-font-family': 'Inter, sans-serif',
|
|
},
|
|
});
|