EIPs

EIP-1102 — Opt-in account exposure

eips.ethereum.org/EIPS/eip-1102

A wallet does not expose its accounts until the dapp explicitly requests them. eth_requestAccounts is that request. The wallet opens a connection prompt, the user picks which account(s) to expose, and the wallet returns them.

import { eth_requestAccounts } from "@ethernauta/eip/1102";
import type { Provider } from "@ethernauta/eip/1193";
import { create_provider, encode_chain_id } from "@ethernauta/transport";
import { eip155_1 } from "@ethernauta/chain/eip155-1";

const CHAIN_ID = encode_chain_id({ namespace: "eip155", reference: eip155_1.chainId });
declare const provider: Provider; // see /eips/6963 for discovery
const { signer } = create_provider(provider);

const accounts = await eth_requestAccounts()(
  signer({ chain_id: CHAIN_ID }),
);
// → Address[]
void accounts;

Surface

ExportTypePurpose
eth_requestAccountsSignable<Addresses>Trigger account exposure flow.

Difference from eth_accounts

  • eth_accounts — wallet-state, cached, returns whatever’s currently exposed (possibly empty). No popup.
  • eth_requestAccounts — signable, opens a popup if nothing is exposed yet, returns the new exposure.

Dapps typically call eth_accounts first (silent), and fall back to eth_requestAccounts (interactive) only when nothing is exposed yet:

import type { Provider } from "@ethernauta/eip/1193";
import { eth_requestAccounts } from "@ethernauta/eip/1102";
import { eth_acounts } from "@ethernauta/eth";
import { create_provider } from "@ethernauta/transport";

declare const injected: Provider;
const adapter = create_provider(injected);

let accounts = await eth_acounts()(adapter.reader({ chain_id: "eip155:1" }));
if (accounts.length === 0) {
  accounts = await eth_requestAccounts()(adapter.signer({ chain_id: "eip155:1" }));
}
void accounts;

What the wallet does

The Ethernauta wallet’s connect view runs on first request. The user picks accounts from their stored vault, the picks get persisted as an EIP-2255 permission, and subsequent eth_accounts calls return immediately from cache.

See also