Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/Authorization

primitives/Authorization

Classes

InvalidAddressError

Defined in: src/primitives/Authorization/errors.js:35 Authorization address cannot be zero address

Throws

Extends

Constructors

Constructor
new InvalidAddressError(address, options?): InvalidAddressError
Defined in: src/primitives/Authorization/errors.js:41
Parameters
address
Uint8Array<ArrayBufferLike>
options?
cause?
Error
Returns
InvalidAddressError
Overrides
InvalidFormatError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
InvalidFormatError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
InvalidFormatError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
InvalidFormatError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
InvalidFormatError.docsPath
expected
expected: string
Defined in: src/primitives/errors/ValidationError.ts:19
Inherited from
InvalidFormatError.expected
name
name: string
Defined in: src/primitives/Authorization/errors.js:49
Inherited from
InvalidFormatError.name
value
value: unknown
Defined in: src/primitives/errors/ValidationError.ts:18
Inherited from
InvalidFormatError.value

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
InvalidFormatError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
InvalidFormatError.toJSON

InvalidChainIdError

Defined in: src/primitives/Authorization/errors.js:12 Authorization chain ID must be non-zero

Throws

Extends

Constructors

Constructor
new InvalidChainIdError(chainId, options?): InvalidChainIdError
Defined in: src/primitives/Authorization/errors.js:18
Parameters
chainId
bigint
options?
cause?
Error
Returns
InvalidChainIdError
Overrides
InvalidFormatError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
InvalidFormatError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
InvalidFormatError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
InvalidFormatError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
InvalidFormatError.docsPath
expected
expected: string
Defined in: src/primitives/errors/ValidationError.ts:19
Inherited from
InvalidFormatError.expected
name
name: string
Defined in: src/primitives/Authorization/errors.js:26
Inherited from
InvalidFormatError.name
value
value: unknown
Defined in: src/primitives/errors/ValidationError.ts:18
Inherited from
InvalidFormatError.value

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
InvalidFormatError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
InvalidFormatError.toJSON

InvalidSignatureComponentError

Defined in: src/primitives/Authorization/errors.js:81 Authorization signature component cannot be zero

Throws

Extends

Constructors

Constructor
new InvalidSignatureComponentError(component, value, options?): InvalidSignatureComponentError
Defined in: src/primitives/Authorization/errors.js:88
Parameters
component
string ‘r’ or ‘s’
value
bigint
options?
cause?
Error
Returns
InvalidSignatureComponentError
Overrides
InvalidSignatureError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
InvalidSignatureError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
InvalidSignatureError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
InvalidSignatureError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
InvalidSignatureError.docsPath
name
name: string
Defined in: src/primitives/Authorization/errors.js:95
Inherited from
InvalidSignatureError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
InvalidSignatureError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
InvalidSignatureError.toJSON

InvalidSignatureRangeError

Defined in: src/primitives/Authorization/errors.js:104 Authorization signature r must be less than curve order

Throws

Extends

Constructors

Constructor
new InvalidSignatureRangeError(value, max, options?): InvalidSignatureRangeError
Defined in: src/primitives/Authorization/errors.js:111
Parameters
value
bigint
max
bigint
options?
cause?
Error
Returns
InvalidSignatureRangeError
Overrides
InvalidRangeError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
InvalidRangeError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
InvalidRangeError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
InvalidRangeError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
InvalidRangeError.docsPath
expected
expected: string
Defined in: src/primitives/errors/ValidationError.ts:19
Inherited from
InvalidRangeError.expected
name
name: string
Defined in: src/primitives/Authorization/errors.js:119
Inherited from
InvalidRangeError.name
value
value: unknown
Defined in: src/primitives/errors/ValidationError.ts:18
Inherited from
InvalidRangeError.value

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
InvalidRangeError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
InvalidRangeError.toJSON

InvalidYParityError

Defined in: src/primitives/Authorization/errors.js:58 Authorization yParity must be 0 or 1

Throws

Extends

Constructors

Constructor
new InvalidYParityError(yParity, options?): InvalidYParityError
Defined in: src/primitives/Authorization/errors.js:64
Parameters
yParity
number
options?
cause?
Error
Returns
InvalidYParityError
Overrides
InvalidRangeError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
InvalidRangeError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
InvalidRangeError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
InvalidRangeError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
InvalidRangeError.docsPath
expected
expected: string
Defined in: src/primitives/errors/ValidationError.ts:19
Inherited from
InvalidRangeError.expected
name
name: string
Defined in: src/primitives/Authorization/errors.js:72
Inherited from
InvalidRangeError.name
value
value: unknown
Defined in: src/primitives/errors/ValidationError.ts:18
Inherited from
InvalidRangeError.value

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
InvalidRangeError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
InvalidRangeError.toJSON

MalleableSignatureError

Defined in: src/primitives/Authorization/errors.js:128 Authorization signature s too high (malleable signature)

Throws

Extends

Constructors

Constructor
new MalleableSignatureError(s, max, options?): MalleableSignatureError
Defined in: src/primitives/Authorization/errors.js:135
Parameters
s
bigint
max
bigint
options?
cause?
Error
Returns
MalleableSignatureError
Overrides
InvalidSignatureError.constructor

Properties

cause?
optional cause: Error
Defined in: src/primitives/errors/AbstractError.ts:56 Root cause of this error (for error chaining)
Inherited from
InvalidSignatureError.cause
code
code: string
Defined in: src/primitives/errors/AbstractError.ts:39 Machine-readable error code for programmatic handling
Example
'INVALID_FORMAT', 'INVALID_LENGTH'
Inherited from
InvalidSignatureError.code
context?
optional context: Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:45 Additional context metadata for debugging
Example
{ value: '0x123', expected: '20 bytes' }
Inherited from
InvalidSignatureError.context
docsPath?
optional docsPath: string
Defined in: src/primitives/errors/AbstractError.ts:51 Path to documentation for this error
Example
'/primitives/address/from-hex#error-handling'
Inherited from
InvalidSignatureError.docsPath
name
name: string
Defined in: src/primitives/Authorization/errors.js:142
Inherited from
InvalidSignatureError.name

Methods

getErrorChain()
getErrorChain(): string
Defined in: src/primitives/errors/AbstractError.ts:94 Get full error chain as string for logging
Returns
string
Inherited from
InvalidSignatureError.getErrorChain
toJSON()
toJSON(): Record<string, unknown>
Defined in: src/primitives/errors/AbstractError.ts:110 Serialize error to JSON for logging/telemetry
Returns
Record<string, unknown>
Inherited from
InvalidSignatureError.toJSON

Interfaces

DelegationDesignation

Defined in: src/primitives/Authorization/types.js:20

Properties

authority
authority: AddressType
Defined in: src/primitives/Authorization/types.js:21 Authority (signer) address
delegatedAddress
delegatedAddress: AddressType
Defined in: src/primitives/Authorization/types.js:22 Delegated code address

Unsigned

Defined in: src/primitives/Authorization/types.js:11

Properties

address
address: AddressType
Defined in: src/primitives/Authorization/types.js:13 Address to delegate code execution to
chainId
chainId: bigint
Defined in: src/primitives/Authorization/types.js:12 Chain ID where authorization is valid
nonce
nonce: bigint
Defined in: src/primitives/Authorization/types.js:14 Nonce of the authorizing account

Type Aliases

AuthorizationType

AuthorizationType = object
Defined in: src/primitives/Authorization/AuthorizationType.ts:7 EIP-7702 Authorization branded type Allows EOA to delegate code execution to another address

Properties

address
address: AddressType
Defined in: src/primitives/Authorization/AuthorizationType.ts:11 Address to delegate code execution to
chainId
chainId: bigint
Defined in: src/primitives/Authorization/AuthorizationType.ts:9 Chain ID where authorization is valid
nonce
nonce: bigint
Defined in: src/primitives/Authorization/AuthorizationType.ts:13 Nonce of the authorizing account
r
r: Uint8Array
Defined in: src/primitives/Authorization/AuthorizationType.ts:17 Signature r value (32 bytes)
s
s: Uint8Array
Defined in: src/primitives/Authorization/AuthorizationType.ts:19 Signature s value (32 bytes)
yParity
yParity: number
Defined in: src/primitives/Authorization/AuthorizationType.ts:15 Signature Y parity (0 or 1)

BrandedAuthorization

BrandedAuthorization = AuthorizationType
Defined in: src/primitives/Authorization/AuthorizationType.ts:25

Deprecated

Use AuthorizationType instead

Variables

Authorization

const Authorization: object
Defined in: src/primitives/Authorization/index.ts:163

Type Declaration

calculateGasCost()
calculateGasCost: (authList, emptyAccounts) => bigint
Parameters
authList
AuthorizationType[]
emptyAccounts
number
Returns
bigint
equals()
equals: (a, b) => boolean
Parameters
a
AddressType
b
AddressType
Returns
boolean
equalsAuth()
equalsAuth: (auth1, auth2) => boolean
Parameters
auth1
AuthorizationType
auth2
AuthorizationType
Returns
boolean
format()
format: (auth) => string
Parameters
auth
AuthorizationType | { address: AddressType; chainId: bigint; nonce: bigint; }
Returns
string
getGasCost()
getGasCost: (auth, isEmpty) => bigint
Parameters
auth
AuthorizationType
isEmpty
boolean
Returns
bigint
hash
hash: HashFn
Hash()
Hash: (deps) => HashFn
Parameters
deps
keccak256
(data) => Uint8Array
rlpEncode
(data) => Uint8Array
Returns
HashFn
isItem()
isItem: (value) => boolean
Parameters
value
unknown
Returns
boolean
isUnsigned()
isUnsigned: (value) => boolean
Parameters
value
unknown
Returns
boolean
MAGIC_BYTE
MAGIC_BYTE: number
EIP-7702 magic byte for signing hash
PER_AUTH_BASE_COST
PER_AUTH_BASE_COST: bigint
Base gas cost per authorization
PER_EMPTY_ACCOUNT_COST
PER_EMPTY_ACCOUNT_COST: bigint
Gas cost per empty account authorization
process()
process: (auth) => object
Parameters
auth
AuthorizationType
Returns
object
authority
authority: AddressType
delegatedAddress
delegatedAddress: AddressType
processAll()
processAll: (authList) => object[]
Parameters
authList
AuthorizationType[]
Returns
object[]
SECP256K1_HALF_N
SECP256K1_HALF_N: bigint
secp256k1 curve order N / 2 (for malleability check)
SECP256K1_N
SECP256K1_N: bigint
secp256k1 curve order N
sign
sign: SignFn
Sign()
Sign: (deps) => SignFn
Parameters
deps
addressFromPublicKey
(x, y) => AddressType
keccak256
(data) => Uint8Array
recoverPublicKey
(signature, messageHash) => Uint8Array
rlpEncode
(data) => Uint8Array
sign
(messageHash, privateKey) => object
Returns
SignFn
validate()
validate: (auth) => void
Parameters
auth
AuthorizationType
Returns
void
verify
verify: VerifyFn
Verify()
Verify: (deps) => VerifyFn
Parameters
deps
addressFromPublicKey
(x, y) => AddressType
keccak256
(data) => Uint8Array
recoverPublicKey
(signature, messageHash) => Uint8Array
rlpEncode
(data) => Uint8Array
Returns
VerifyFn

calculateGasCost()

const calculateGasCost: (authList, emptyAccounts) => bigint = calculateGasCostImpl
Defined in: src/primitives/Authorization/index.ts:97

Parameters

authList
AuthorizationType[]
emptyAccounts
number

Returns

bigint

equals()

const equals: (a, b) => boolean = equalsImpl
Defined in: src/primitives/Authorization/index.ts:102

Parameters

a
AddressType
b
AddressType

Returns

boolean

equalsAuth()

const equalsAuth: (auth1, auth2) => boolean = equalsAuthImpl
Defined in: src/primitives/Authorization/index.ts:104

Parameters

auth1
AuthorizationType
auth2
AuthorizationType

Returns

boolean

format()

const format: (auth) => string = formatImpl
Defined in: src/primitives/Authorization/index.ts:109

Parameters

auth
AuthorizationType | { address: AddressType; chainId: bigint; nonce: bigint; }

Returns

string

getGasCost()

const getGasCost: (auth, isEmpty) => bigint = getGasCostImpl
Defined in: src/primitives/Authorization/index.ts:115

Parameters

auth
AuthorizationType
isEmpty
boolean

Returns

bigint

hash

const hash: HashFn
Defined in: src/primitives/Authorization/index.ts:135

Hash()

const Hash: (deps) => HashFn
Defined in: src/primitives/Authorization/index.ts:43

Parameters

deps
keccak256
(data) => Uint8Array
rlpEncode
(data) => Uint8Array

Returns

HashFn

isItem()

const isItem: (value) => boolean = isItemImpl
Defined in: src/primitives/Authorization/index.ts:118

Parameters

value
unknown

Returns

boolean

isUnsigned()

const isUnsigned: (value) => boolean = isUnsignedImpl
Defined in: src/primitives/Authorization/index.ts:120

Parameters

value
unknown

Returns

boolean

MAGIC_BYTE

const MAGIC_BYTE: 5 = 0x05
Defined in: src/primitives/Authorization/constants.js:8 EIP-7702 magic byte for signing hash

PER_AUTH_BASE_COST

const PER_AUTH_BASE_COST: 12500n = 12500n
Defined in: src/primitives/Authorization/constants.js:18 Base gas cost per authorization

PER_EMPTY_ACCOUNT_COST

const PER_EMPTY_ACCOUNT_COST: 25000n = 25000n
Defined in: src/primitives/Authorization/constants.js:13 Gas cost per empty account authorization

process()

const process: (auth) => object = processImpl
Defined in: src/primitives/Authorization/index.ts:122

Parameters

auth
AuthorizationType

Returns

object
authority
authority: AddressType
delegatedAddress
delegatedAddress: AddressType

processAll()

const processAll: (authList) => object[] = processAllImpl
Defined in: src/primitives/Authorization/index.ts:127

Parameters

authList
AuthorizationType[]

Returns

object[]

SECP256K1_HALF_N

const SECP256K1_HALF_N: bigint
Defined in: src/primitives/Authorization/constants.js:29 secp256k1 curve order N / 2 (for malleability check)

SECP256K1_N

const SECP256K1_N: 115792089237316195423570985008687907852837564279074904382605163141518161494337n = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n
Defined in: src/primitives/Authorization/constants.js:23 secp256k1 curve order N

sign

const sign: SignFn
Defined in: src/primitives/Authorization/index.ts:148

Sign()

const Sign: (deps) => SignFn
Defined in: src/primitives/Authorization/index.ts:49

Parameters

deps
addressFromPublicKey
(x, y) => AddressType
keccak256
(data) => Uint8Array
recoverPublicKey
(signature, messageHash) => Uint8Array
rlpEncode
(data) => Uint8Array
sign
(messageHash, privateKey) => object

Returns

SignFn

validate()

const validate: (auth) => void = validateImpl
Defined in: src/primitives/Authorization/index.ts:132

Parameters

auth
AuthorizationType

Returns

void

verify

const verify: VerifyFn
Defined in: src/primitives/Authorization/index.ts:140

Verify()

const Verify: (deps) => VerifyFn
Defined in: src/primitives/Authorization/index.ts:64

Parameters

deps
addressFromPublicKey
(x, y) => AddressType
keccak256
(data) => Uint8Array
recoverPublicKey
(signature, messageHash) => Uint8Array
rlpEncode
(data) => Uint8Array

Returns

VerifyFn

Functions

authorityWasm()

authorityWasm(auth): AddressType
Defined in: src/primitives/Authorization/Authorization.wasm.ts:56 Recover authority (signer) from authorization

Parameters

auth
AuthorizationType Authorization to recover from

Returns

AddressType Recovered authority address

gasCostWasm()

gasCostWasm(authCount, emptyAccounts): bigint
Defined in: src/primitives/Authorization/Authorization.wasm.ts:73 Calculate gas cost for authorization list

Parameters

authCount
number Number of authorizations
emptyAccounts
number Number of empty accounts

Returns

bigint Gas cost as bigint

signingHashWasm()

signingHashWasm(chainId, address, nonce): HashType
Defined in: src/primitives/Authorization/Authorization.wasm.ts:43 Calculate signing hash for authorization

Parameters

chainId
bigint Chain ID
address
AddressType Target address
nonce
bigint Nonce

Returns

HashType Signing hash

validateWasm()

validateWasm(auth): void
Defined in: src/primitives/Authorization/Authorization.wasm.ts:25 Validate authorization structure

Parameters

auth
AuthorizationType Authorization to validate

Returns

void

Throws

Error if authorization is invalid