import type { Address } from 'abitype' import type { Hex, Signature } from './misc.js' import type { ExactPartial, OneOf } from './utils.js' export type Authorization = { /** Address of the contract to delegate to. */ address: Address /** Chain ID. */ chainId: uint32 /** Nonce of the EOA to delegate to. */ nonce: uint32 } & (signed extends true ? Signature : ExactPartial>) export type AuthorizationList< uint32 = number, signed extends boolean = false, > = readonly Authorization[] export type AuthorizationRequest = OneOf< | { /** Address of the contract to delegate to. */ address: Address } | { /** * Address of the contract to delegate to. * @alias `address` */ contractAddress: Address } > & { /** Chain ID. */ chainId: uint32 /** Nonce of the EOA to delegate to. */ nonce: uint32 } export type SignedAuthorization = Authorization export type SignedAuthorizationList = readonly SignedAuthorization[] export type SerializedAuthorization = readonly [ chainId: Hex, address: Hex, nonce: Hex, yParity: Hex, r: Hex, s: Hex, ] export type SerializedAuthorizationList = readonly SerializedAuthorization[]