getPermissions
Action getting the connected wallet's current permissions.
Import
ts
import { getPermissions } from '@wagmi/core'
Usage
ts
import { getPermissions } from '@wagmi/core'
import { config } from './config'
const permissions = await getPermissions(config)
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 GetPermissionsParameters } from '@wagmi/core'
chainId
config['chains'][number]['id'] | undefined
The ID of chain to get the wallet's permissions for.
ts
import { getPermissions } from '@wagmi/core'
import { config } from './config'
import { optimism } from '@wagmi/core/chains'
const permissions = await getPermissions(config, {
chainId: optimism.id,
})
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(),
},
})
connector
Connector | undefined
Connector to get permissions for.
ts
import { getPermissions } from '@wagmi/core'
import { config } from './config'
import { optimism } from '@wagmi/core/chains'
const { connector } = getAccount(config)
const permissions = await getPermissions(config, {
connector,
})
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 GetPermissionsReturnType } from '@wagmi/core'
The wallet permissions.
Error
ts
import { type GetPermissionsErrorType } from '@wagmi/core'
TanStack Query
ts
import {
type getPermissionsData,
type getPermissionsOptions,
type getPermissionsQueryFnData,
type getPermissionsQueryKey,
getPermissionsQueryKey,
getPermissionsQueryOptions,
} from '@wagmi/core/query'