Skip to main content
Voltaire implements standard wallet RPC methods defined in EIP-3326 (wallet_switchEthereumChain, wallet_addEthereumChain) and EIP-747 (wallet_watchAsset) for seamless wallet integration.

Chain Management

wallet_switchEthereumChain

Request wallet to switch to a different Ethereum chain.
Parameters:
  • chainId (string): Hex-encoded chain ID (e.g., “0x1” for mainnet)
Returns: null on success Errors:
  • 4001: User rejected the request
  • 4902: Unrecognized chain ID (chain not added to wallet)

wallet_addEthereumChain

Request wallet to add a new Ethereum chain.
Parameters:
  • chainId (string): Hex-encoded chain ID
  • chainName (string): Human-readable chain name
  • nativeCurrency (object): Native currency info
    • name (string): Currency name
    • symbol (string): Currency symbol
    • decimals (number): Currency decimals (typically 18)
  • rpcUrls (string[]): RPC endpoint URLs
  • blockExplorerUrls (string[], optional): Block explorer URLs
  • iconUrls (string[], optional): Chain icon URLs
Returns: null on success Errors:
  • 4001: User rejected the request
  • 4902: Chain already exists

Asset Management

wallet_watchAsset

Request wallet to track a token (typically ERC-20).
Parameters:
  • type (string): Asset type (typically “ERC20”)
  • options (object): Asset details
    • address (string): Token contract address
    • symbol (string): Token symbol
    • decimals (number): Token decimals
    • image (string, optional): Token icon URL
Returns: boolean - true if token was added, false if rejected Errors:
  • 4001: User rejected the request

Permissions

wallet_requestPermissions

Request specific permissions from the wallet.
Parameters:
  • Object with permission names as keys (e.g., eth_accounts)
Returns: Array of granted permission objects Errors:
  • 4001: User rejected the request

wallet_getPermissions

Get currently granted permissions.
Returns: Array of permission objects

wallet_revokePermissions

Revoke specific permissions.
Parameters:
  • Object with permission names to revoke as keys
Returns: null on success

Error Handling

Standard wallet error codes:
Error helper functions:

Usage with Providers

References