Skip to Content
dApps
On this page

wallet_requestPermissions

Requests permissions for the dApp to access specific methods. This is part of the EIP-2255 wallet permissions system.


Parameters

Array containing a permission request object:

FieldTypeDescription
eth_accountsobjectRequest access to user accounts

Returns

Array of permission objects:

FieldTypeDescription
parentCapabilitystringThe permission name
datenumberTimestamp when granted
caveatsarrayRestrictions on the permission

Example

const permissions = await window.$onekey.ethereum.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] }) console.log('Granted permissions:', permissions) // [{ parentCapability: 'eth_accounts', date: 1234567890, caveats: [...] }]

Check Specific Permission

const permissions = await window.$onekey.ethereum.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] }) const hasAccountsPermission = permissions.some( p => p.parentCapability === 'eth_accounts' ) console.log('Has accounts permission:', hasAccountsPermission)

Errors

CodeMessageDescription
4001User rejected the requestUser denied the permission request
-32602Invalid paramsInvalid permission request

Notes

  • Currently only eth_accounts permission is supported
  • Calling this method triggers the connection prompt if not already connected
  • Permissions persist until revoked by the user
  • Specified by EIP-2255 

Handle unsupported-method errors in the target wallet version. Account permission is distinct from RPC connectivity and does not pre-approve signatures or transactions. For basic connection, use eth_requestAccounts.

Last updated on