28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { createConfig, http } from 'wagmi';
|
|
import { mainnet, sepolia, base, arbitrum } from 'wagmi/chains';
|
|
|
|
// Create wagmiConfig
|
|
const metadata = {
|
|
name: 'MortgageFi',
|
|
description: 'Decentralized Mortgage Lending Platform',
|
|
url: 'https://mortgagefi.app',
|
|
icons: ['https://mortgagefi.app/logo.png']
|
|
};
|
|
|
|
// Prefer custom RPCs to avoid public-provider rate limits (429)
|
|
const baseRpc = process.env.NEXT_PUBLIC_RPC_BASE;
|
|
const arbitrumRpc = process.env.NEXT_PUBLIC_RPC_ARBITRUM;
|
|
const enableMainnet = process.env.NEXT_PUBLIC_ENABLE_MAINNET === 'true';
|
|
|
|
export const config = createConfig({
|
|
chains: [base, arbitrum, ...(enableMainnet ? [mainnet] : []), sepolia],
|
|
transports: {
|
|
[base.id]: baseRpc ? http(baseRpc, { batch: true, retryCount: 2, retryDelay: 250 }) : http(undefined, { batch: true, retryCount: 2, retryDelay: 250 }),
|
|
[arbitrum.id]: arbitrumRpc ? http(arbitrumRpc, { batch: true, retryCount: 2, retryDelay: 250 }) : http(undefined, { batch: true, retryCount: 2, retryDelay: 250 }),
|
|
[mainnet.id]: http(),
|
|
[sepolia.id]: http(),
|
|
},
|
|
ssr: true,
|
|
});
|
|
|