mirror of
https://github.com/luxfhe/example-smart-wallet.git
synced 2026-10-30 18:13:16 +00:00
31 lines
971 B
TypeScript
31 lines
971 B
TypeScript
import { wagmiConnectors } from "./wagmiConnectors";
|
|
import { Chain, createClient, http } from "viem";
|
|
import { hardhat, mainnet } from "viem/chains";
|
|
import { createConfig } from "wagmi";
|
|
import scaffoldConfig from "~~/scaffold.config";
|
|
import { getAlchemyHttpUrl } from "~~/utils/scaffold-eth";
|
|
|
|
const { targetNetworks } = scaffoldConfig;
|
|
|
|
// We always want to have mainnet enabled (ENS resolution, ETH price, etc). But only once.
|
|
export const enabledChains = targetNetworks.find((network: Chain) => network.id === 1)
|
|
? targetNetworks
|
|
: ([...targetNetworks, mainnet] as const);
|
|
|
|
export const wagmiConfig = createConfig({
|
|
chains: enabledChains,
|
|
connectors: wagmiConnectors,
|
|
ssr: true,
|
|
client({ chain }) {
|
|
return createClient({
|
|
chain,
|
|
transport: http(getAlchemyHttpUrl(chain.id)),
|
|
...(chain.id !== (hardhat as Chain).id
|
|
? {
|
|
pollingInterval: scaffoldConfig.pollingInterval,
|
|
}
|
|
: {}),
|
|
});
|
|
},
|
|
});
|