wagmi v2 (custom connector)
wagmi expects connectors. WallCard is not injected, so wrap the provider with the custom connector.
import { createConfig, http } from "wagmi";
import { mainnet } from "wagmi/chains";
import { custom } from "wagmi/connectors";
import { wallcard } from "./wallcard-provider";
export const wagmiConfig = createConfig({
chains: [mainnet],
connectors: [custom(wallcard as import("viem").EIP1193Provider)],
transports: { [mainnet.id]: http() },
});After connect, use wagmi hooks as usual. Account reads and writes go through WallCard request().
ethers v6
import { BrowserProvider, Contract } from "ethers";
const provider = new BrowserProvider(wallcard as import("ethers").Eip1193Provider);
const signer = await provider.getSigner();
const tx = await signer.sendTransaction({ to, value });viem direct (optional)
If you use viem without wagmi, create a wallet client from the same EIP-1193 provider object. The provider must implement request() with the methods listed in Signing methods.
Existing dApps
Apps built for MetaMask often only need to swap the provider source: replace window.ethereum with your WallCard provider instance when the user chooses WallCard as their wallet. No change to contract ABIs, wagmi config shape, or transaction builders is required beyond connector setup.