← Lan Wallet documentation

Local EIP-1193 bridge

The Rust process binds only to 127.0.0.1 (default ws://127.0.0.1:21337/ws). Clients must supply the random/operator-provided token as the token query parameter or a bearer header. Browser origins can be restricted with repeatable/comma-delimited --allowed-origin values.

At startup the bridge resolves the configured RPC chain ID and fixes that as the active chain context. It does not switch RPCs at a dapp's request.

Supported methods

Wallet methods:

Read-only RPC forwarding allowlist:

Everything else returns -32601; malformed parameters return -32602; unauthorized account operations return 4100; unsupported chains return 4901; user rejection returns 4001. Upstream RPC failures preserve their JSON-RPC code/message when possible.

Approval and security model

Signatures and transactions always take the serialized prompt lock and require an interactive CLI confirmation defaulting to No. --auto-approve applies only to the account-access prompt and cannot bypass a signature or transaction prompt. The TypeScript bridge exposes only EIP-1193 requests; no method returns key material or accepts a raw digest for signing.

For the demo, use an explicit browser origin:

cargo run -- --serve --wallet 0xYourAccount \
  --rpc-url https://your-sepolia-rpc.example \
  --allowed-origin http://127.0.0.1:5173

The token travels in the WebSocket URL because browser WebSocket APIs cannot set an authorization header. Treat it as an ephemeral local capability: do not reuse it, paste it into dapps, or expose browser history/debug output.