Check Burned Access Key Witness
accessKey.isWitnessBurned
Checks whether a key-authorization witness has been burned for an account.
Usage
import { } from './viem.config'
const = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
})
.('Is burned:', )
Is burned: falseimport { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Validate a Stored Authorization Before Submitting
Check the witness before attaching a stored authorization from accessKey.signAuthorization to a transaction, since a burned witness makes it revert.
import { } from './viem.config'
// Witness bound into a signed authorization held in your database.
const =
'0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658'
const = await ..({
: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', // authorizing account
,
})
if ()
throw new ('authorization cancelled: request a new one')
// Safe to attach the stored authorization via `keyAuthorization`.import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = booleanWhether the witness has been burned.
Parameters
account
- Type:
Account | Address - Default:
client.account
Account (or address) to check the witness on.
witness
- Type:
Hex
The 32-byte witness to check.
blockNumber (optional)
- Type:
bigint
Block number to read the state from.
blockOverrides (optional)
- Type:
BlockOverrides
Block overrides to apply to the state.
blockTag (optional)
- Type:
BlockTag
Block tag to read the state from.
stateOverride (optional)
- Type:
StateOverride
State override to apply.