Skip to Content
dApps

JSON-RPC Reference

Reference for common Ethereum JSON-RPC and wallet methods used with OneKey.

All methods are called via window.$onekey.ethereum.request({ method, params }).


Account Methods

MethodDescription
eth_requestAccountsRequest user’s accounts (triggers connection popup)
eth_accountsGet connected accounts (no popup)
wallet_requestPermissionsRequest specific permissions
wallet_getPermissionsGet current permissions

Transaction Methods

MethodDescription
eth_sendTransactionSend a transaction
eth_callExecute a call without creating a transaction
eth_estimateGasEstimate gas for a transaction
eth_getTransactionByHashGet transaction by hash
eth_getTransactionReceiptGet transaction receipt

Signing Methods

MethodDescription
personal_signSign a message (EIP-191)
eth_signTypedData_v4Sign typed data (EIP-712)

Network Methods

MethodDescription
eth_chainIdGet current chain ID
wallet_switchEthereumChainSwitch to a different chain
wallet_addEthereumChainAdd a new chain
wallet_watchAssetAdd a token to wallet

Standard Ethereum Methods

Additional Ethereum JSON-RPC methods depend on the connected network and wallet implementation. See the Ethereum JSON-RPC specification  for the complete list.

Common methods include:

  • eth_blockNumber - Get current block number
  • eth_getBalance - Get account balance
  • eth_getCode - Get contract code
  • eth_getLogs - Get event logs
Last updated on