getCapabilities
Extract capabilities (grouped by chain ID) that a connected wallet supports (e.g. paymasters, session keys, etc).
Usage
// @filename: config.ts
import 'viem/window'
import { createWalletClient, custom } from 'viem'
// Retrieve Account from an EIP-1193 Provider.
const [account] = await window.ethereum!.request({
method: 'eth_requestAccounts'
})
export const walletClient = createWalletClient({
account,
transport: custom(window.ethereum!)
})
// @filename: example.ts
// ---cut---
import { account, walletClient } from './config'
const capabilities = await walletClient.getCapabilities({
account,
})
}
},
},
status: 'supported',
atomic: {
84532: {
},
},
supported: true,
paymasterService: {
},
status: 'supported',
atomic: {
8453: {
{
Account Hoisting
If you do not wish to pass an account to every getCapabilities, you can also hoist the Account on the Wallet Client (see config.ts).
import { } from './config'
const = await .()Returns
WalletCapabilities
Capabilities of the wallet.
Parameters
account
- Type:
Address
The account to get capabilities for.
example.ts
const = await .({
: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
})chainId
- Type:
number
The chain ID to get capabilities for.
example.ts
const = await .({
: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
: 8453,
})