Skip to main content
MetaMask

wallet_requestPermissions

Summary: Requests additional permissions.

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

Parameters

requestPermissionsObject object

PermissionObject

permission object

The requested permission.

Returns

PermissionsList array

PermissionsList

Permission object

Permission

id string

The permission ID.

@context array

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.

string

invoker string

A URI of the dapp being granted this permission.

caveats array

A capability document modifies the caveat property to specify usage restrictions. Capabilities inherit restrictions from the caveat properties of their parent documents and can add new caveats in addition to those inherited from their parents.

Caveat object

Caveat

type string

Type of caveat.

value

Value of the caveat.

name string

Name of the caveat.

Errors

Code
Message
4001
User rejected the request.
Customize request
Parameter
Value
{}
object
{ "eth_accounts": {} }
object
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "wallet_requestPermissions",
"params": [
{
eth_accounts: {}
}
],
});
Example response
{
"eth_accounts": {}
}