Skip to content

requestPermissions

Action for requesting permissions for a wallet.

Import

ts
import { requestPermissions } from '@wagmi/core'

Usage

ts
import { requestPermissions } from '@wagmi/core'
import { config } from './config'

const permissions = await requestPermissions(config,  {
  eth_accounts: {}
})
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Parameters

ts
import { type RequestPermissionsParameters } from '@wagmi/core'

connector

Connector | undefined

Connector to request permissions from.

ts
import { getAccount, requestPermissions } from '@wagmi/core'
import { config } from './config'

const { connector } = getAccount(config)
const permissions = await requestPermissions(config, {
  connector, 
  eth_accounts: {}
})
ts
import { http, createConfig } from '@wagmi/core'
import { mainnet, sepolia } from '@wagmi/core/chains'

export const config = createConfig({
  chains: [mainnet, sepolia],
  transports: {
    [mainnet.id]: http(),
    [sepolia.id]: http(),
  },
})

Return Type

ts
import { type RequestPermissionsReturnType } from '@wagmi/core'

WalletPermission[]

The wallet permissions.

Error

ts
import { type RequestPermissionsErrorType } from '@wagmi/core'

TanStack Query

ts
import {
  type RequestPermissionsData,
  type RequestPermissionsVariables,
  type RequestPermissionsMutate,
  type RequestPermissionsMutateAsync,
  requestPermissionsMutationOptions,
} from '@wagmi/core/query'

Viem

Released under the MIT License.