experimental_grantAdmin
Grants an admin key to an account.
Request
type Request = {
method: 'experimental_grantAdmin',
params: [{
/** Address of the account to grant an admin on. */
address?: `0x${string}`
/** Chain ID to grant an admin on. */
chainId?: `0x${string}`
/** The admin key. */
key?: {
/** Public key. Accepts an address for `address` & `secp256k1` types. */
publicKey: `0x${string}`,
/** Key type. */
type: 'address' | 'p256' | 'secp256k1' | 'webauthn-p256',
}
}]
}
Response
type Response = {
address: `0x${string}`,
chainId: `0x${string}`,
key: {
id: `0x${string}`,
publicKey: `0x${string}`,
type: 'address' | 'p256' | 'secp256k1' | 'webauthn-p256',
}
}
Example
import { Porto } from 'porto'
import { parseEther, toHex } from 'viem'
const { provider } = Porto.create()
const permissions = await provider.request({
method: 'experimental_grantAdmin',
params: [{
key: {
publicKey: '0x0000000000000000000000000000000000000000',
type: 'address',
},
}],
})