accessKey.saveAuthorization
Saves a signed key authorization to a relay running the Key Authorization plugin. The relay attaches it to the access key's next transaction until the key is active onchain.
accessKey.signAuthorization already saves authorizations it signs
through a relay. Use this action for authorizations signed elsewhere, such as on another device or with
account.signKeyAuthorization.
Usage
import { , } from 'viem/tempo'
import { } from './viem.config'
const = .('0x...')
const = .(.(), {
: ,
})
const = await .(, {
: ..,
: .(.() / 1000) + 86_400,
})
await ..({ })import { , , , , } from 'viem/tempo'
export const = .({
: ((), {
: [.({ : .() })],
}),
})Standalone Action
Call Actions.accessKey.saveAuthorization directly by passing the Client as the first argument.
import { } from 'viem/tempo'
import type { } from 'ox/tempo'
import { } from './viem.config'
declare const : .
await ..(, { })Return Value
void
Resolves once the relay has stored the authorization, or has skipped it because the key is already active onchain.
Parameters
keyAuthorization
- Type:
KeyAuthorization.Signed
The signed key authorization to save. It must be signed by the account itself (a root key or an owner quorum), unexpired, and for the relay's chain. A pending authorization for the same key is only replaced when the new one expires later.
Errors
| Error | Description |
|---|---|
MethodNotFoundRpcError | The relay does not run the Key Authorization plugin. |
InvalidParamsRpcError | The authorization is unsigned, expired, signed by another account, below quorum, for another chain, burned, or older than the pending authorization. |