ContractErrorCodes

Contract-level error codes from the OpenZeppelin smart account, WebAuthn verifier, and policy contracts.

The named constants below cover the smart account contract's own error enum — the codes a caller is most likely to branch on. decode resolves any known code (smart account, WebAuthn, or a policy contract) into its contract and variant name. A failed transaction surfaces the raw Error(Contract, #NNNN) message inside the thrown exception; extract the code and pass it to decode, or match it against a constant.

Properties

Link copied to clipboard

The number of context rule IDs in the auth payload does not match the expected count.

Link copied to clipboard
const val CONTEXT_RULE_NOT_FOUND: Int = 3000

The referenced context rule does not exist on the account.

Link copied to clipboard
const val DUPLICATE_POLICY: Int = 3009

The policy is already installed on the context rule.

Link copied to clipboard
const val DUPLICATE_SIGNER: Int = 3007

The signer is already present on the context rule.

Link copied to clipboard

An external signer's verifier contract rejected the signature.

Link copied to clipboard
const val KEY_DATA_TOO_LARGE: Int = 3013

The key_data field on a signer exceeds the maximum allowed size.

Link copied to clipboard
const val MATH_OVERFLOW: Int = 3012

Integer arithmetic overflow occurred in the contract.

Link copied to clipboard
const val NAME_TOO_LONG: Int = 3015

A name field (e.g. context rule name) exceeds the maximum allowed length.

Link copied to clipboard
const val NO_SIGNERS_AND_POLICIES: Int = 3004

A context rule must have at least one signer or one policy.

Link copied to clipboard
const val PAST_VALID_UNTIL: Int = 3005

The context rule's valid_until ledger has already passed.

Link copied to clipboard
const val POLICY_NOT_FOUND: Int = 3008

The referenced policy is not installed on the context rule.

Link copied to clipboard
const val SIGNER_NOT_FOUND: Int = 3006

The referenced signer is not present on the context rule.

Link copied to clipboard
const val TOO_MANY_POLICIES: Int = 3011

The context rule exceeds the maximum number of policies.

Link copied to clipboard
const val TOO_MANY_SIGNERS: Int = 3010

The context rule exceeds the maximum number of signers.

Link copied to clipboard
const val UNAUTHORIZED_SIGNER: Int = 3016

The signer is not authorized to sign the given context rule.

Link copied to clipboard
const val UNVALIDATED_CONTEXT: Int = 3002

The invocation context could not be validated against the account's context rules.

Functions

Link copied to clipboard

Decodes a raw contract error code into the OZ contract and variant name that defined it, or null if code is not a known OZ smart-account contract error.

Link copied to clipboard

Extracts and decodes the first known contract error code from an error message.