@steerprotocol/agentconnect-wagmi
v0.4.0
Published
Wagmi connector for the AgentConnect EIP-1193 provider.
Readme
AgentConnect Wagmi Connector
agentConnectConnector returns a Wagmi createConnector factory backed by @steerprotocol/agentconnect-provider.
import { createConfig, http } from "wagmi";
import { agentConnectConnector } from "@steerprotocol/agentconnect-wagmi";
const local = { id: 31337, name: "Local" };
export const config = createConfig({
chains: [local],
connectors: [
agentConnectConnector({
appName: "Local Dev App",
chains: [local],
url: "http://127.0.0.1:48745",
}),
],
transports: {
[local.id]: http(),
},
});The connector delegates account access, chain reads, chain switching, and transaction submission to the AgentConnect provider. It never exposes browser-side approval, rejection, signing, broadcast, key import, or MCP/admin operations. Pairing remains the approval step for account access: unpaired apps receive the provider's 4100 authorization error until the app is paired externally.
switchChain preflights against the connector's configured chains list, then calls wallet_switchEthereumChain with a hex chain id. The current daemon/provider MVP supports switching only to the daemon's active configured chain; unavailable configured chains surface the provider's 4901 error unchanged. personal_sign, eth_signTypedData_v4, and wallet_addEthereumChain remain deferred and should pass through provider unsupported-method errors if attempted through the provider.
Provider account, chain, connect, and disconnect events are re-emitted through Wagmi's connector emitter. Empty account events and provider disconnects clear connector-local authorization state without revoking the daemon pairing token, so a later connect can reuse the paired provider session.
Test Fixtures
The package tests use injected EIP-1193-compatible providers to cover connect, reconnect, disconnect, authorization, account reads, chain reads, chain switching, event bridging, local disconnect behavior, and provider error pass-through without a browser DOM harness. A Wagmi action fixture exercises connect, reconnect, disconnect, getAccount, and getChainId through a real createConfig instance. A Viem custom(provider) fixture verifies representative wallet-client reads against the same provider shape. Package-boundary tests inspect the manifest and generated dist artifacts after pnpm --filter @steerprotocol/agentconnect-wagmi build to ensure Wagmi remains a peer dependency, Viem remains test-only, React/TanStack stay out of the package, and the public declarations expose only connector types.
The package keeps wagmi as a peer dependency with the broad >=2 range while the connector surface is still stabilizing around createConnector.
License
BUSL-1.1. See LICENSE.
