SHYNZ / Documentation

Browser Wallet Connections

Understand injected wallet providers and the permissions that wallet requests may involve.

A browser wallet can expose an EIP-1193-compatible provider such as window.ethereum. Applications should request account access only after a user's explicit action.

Request accounts

The following browser-only snippet illustrates the flow and is not a transaction:

type EthereumProvider = {
  request(args: { method: string; params?: unknown[] }): Promise<unknown>;
};
 
const provider = (window as Window & {
  ethereum?: EthereumProvider;
}).ethereum;
 
if (!provider) {
  throw new Error('Install or open an EVM-compatible wallet.');
}
 
const accounts = await provider.request({
  method: 'eth_requestAccounts',
});
 
console.log(accounts); // public account addresses

Security considerations

Wallets can reject requests, change accounts, or switch networks. Handle rejections gracefully. Do not request a signature or token approval just to detect the connected account. See wallet safety.

On this page