Skip to main content

wallet_requestPermissions

MetaMask

Requests additional permissions from the user. Introduced by EIP-2255.

Params

(1)

1. requestPermissionsObject (required)

eth_accounts
object

Result

(PermissionsList)
array of:
id
string

Every capability document, except for the target, MUST have an associated ID.

@context
array[string]

When two people communicate with one another, the conversation takes place in a shared environment, typically called 'the context of the conversation.' This shared context allows the individuals to use shortcut terms, such as the first name of a mutual friend, to communicate more quickly without losing accuracy. A context in JSON-LD works the same way: it allows two applications to use shortcut terms to communicate more efficiently without losing accuracy.

invoker
string

Links to one or more instances of cryptographic material (such as public keys) being granted authority to use this capability.

caveats
array[object]

Every capability document MAY add restrictions on the way the capability may be used by adding to the caveat property. Capabilities inherit the restrictions from all caveat properties of their parents, and MAY add new caveats in addition to those of their parents.

type
string

Type of caveat.

value

Value of the caveat.

name
string

Name of the caveat.

Errors

CodeMessage
4001User rejected the request.

Example

Request

await window.ethereum.request({
"method": "wallet_requestPermissions",
"params": [
{
"eth_accounts": {}
}
]
});

Result

{}

Params

requestPermissionsObject

eth_accounts

Request

await window.ethereum.request({
"method": "wallet_requestPermissions",
"params": [
null
]
});