Skip to main content

web3-types

Index

Classes

Enumerations

Interfaces

Type Aliases

Variables

Type Aliases

AbiBaseFragment

AbiBaseFragment: { type: string | FragmentTypes }

Type declaration

  • readonlytype: string | FragmentTypes

AbiConstructorFragment

AbiConstructorFragment: AbiBaseFragment & { inputs?: ReadonlyArray<AbiParameter>; stateMutability: string | nonpayable | payable; type: string | constructor }

AbiErrorFragment

AbiErrorFragment: AbiBaseFragment & { inputs?: ReadonlyArray<AbiParameter>; name: string; type: string | error }

AbiEventFragment

AbiEventFragment: AbiBaseFragment & { anonymous?: boolean; inputs?: ReadonlyArray<AbiParameter>; name: string; type: string | event }

AbiFallbackFragment

AbiFallbackFragment: AbiBaseFragment & { constant?: boolean; inputs: never; name: never; outputs: never; payable?: boolean; stateMutability: string | nonpayable | payable | pure | view; type: string | fallback }

AbiFragment

AbiFunctionFragment

AbiFunctionFragment: AbiBaseFragment & { constant?: boolean; inputs?: ReadonlyArray<AbiParameter>; name: string; outputs?: ReadonlyArray<AbiParameter>; payable?: boolean; stateMutability?: string | nonpayable | payable | pure | view; type: string | function }

AbiInput

AbiInput: string | AbiParameter | { components?: Components; index?: boolean; internalType?: string; name: string; type: string } | {}

AbiItem

AbiItem: AbiFragment

AbiParameter

AbiParameter: { arrayChildren?: ReadonlyArray<AbiParameter>; arrayLength?: number; baseType?: string; components?: ReadonlyArray<AbiParameter>; indexed?: boolean; internalType?: string; name: string; type: string }

Type declaration

  • optionalreadonlyarrayChildren?: ReadonlyArray<AbiParameter>
  • optionalreadonlyarrayLength?: number
  • optionalreadonlybaseType?: string
  • optionalreadonlycomponents?: ReadonlyArray<AbiParameter>
  • optionalreadonlyindexed?: boolean
  • optionalreadonlyinternalType?: string
  • readonlyname: string
  • readonlytype: string

AccessList

AccessList: AccessListEntry[]

AccessListResult

AccessListResult: { accessList?: AccessList; gasUsed?: Numbers }

Type declaration

Address

Address: HexString

ArrayToIndexObject

ArrayToIndexObject<T>: { [ K in IndexKeysForArray<T> ]: T[K] }

Type parameters

  • T: ReadonlyArray<unknown>

Block

BlockAPI

BlockNumberOrTag

BlockNumberOrTag: Numbers | BlockTag

BlockTag

BlockTag: `${BlockTags}`

ByteTypes

ByteTypes: { BYTES_HEX: HexString; BYTES_UINT8ARRAY: Uint8Array }

Type declaration

  • BYTES_HEX: HexString
  • BYTES_UINT8ARRAY: Uint8Array

Bytes

Bytes: Uint8Array | HexString

Cipher

Cipher: aes-128-ctr | aes-128-cbc | aes-256-cbc

CipherOptions

CipherOptions: { c?: number; dklen?: number; iv?: Uint8Array | string; kdf?: scrypt | pbkdf2; n?: number; p?: number; r?: number; salt?: Uint8Array | string }

Type declaration

  • optionalc?: number
  • optionaldklen?: number
  • optionaliv?: Uint8Array | string
  • optionalkdf?: scrypt | pbkdf2
  • optionaln?: number
  • optionalp?: number
  • optionalr?: number
  • optionalsalt?: Uint8Array | string

Components

Components: { components?: Components[]; indexed?: boolean; name: string; type: string }

Type declaration

  • optionalcomponents?: Components[]
  • optionalindexed?: boolean
  • name: string
  • type: string

ConnectionEvent

ConnectionEvent: { code: number; reason: string; wasClean?: boolean }

Type declaration

  • code: number
  • reason: string
  • optionalwasClean?: boolean

ContractAbi

ContractAbi: ReadonlyArray<AbiFragment> | ReadonlyArray<AbiItem>

ContractAbiWithSignature

ContractAbiWithSignature: ReadonlyArray<AbiFragment & { signature: HexString }>

ContractConstructor

ContractConstructor<Abis>: { [ Abi in FilterAbis<Abis, AbiConstructorFragment & { type: constructor }> as constructor ]: { Abi: Abi; Inputs: ContractMethodInputParameters<Abi[inputs]> } }[constructor]

Type parameters

ContractConstructorArgs

ContractConstructorArgs<Abis>: FilterAbis<Abis, AbiConstructorFragment & { type: constructor }> extends never ? any : { [ Abi in FilterAbis<Abis, AbiConstructorFragment & { type: constructor }> as constructor ]: ContractMethodInputParameters<Abi[inputs]> }[constructor]

Type parameters

ContractEvent

ContractEvent<Abi>: { Abi: Abi; Inputs: ContractMethodInputParameters<Abi[inputs]> }

Type parameters

Type declaration

ContractEvents

ContractEvents<Abis>: { [ Abi in FilterAbis<Abis, AbiEventFragment & { type: event }> as Abi[name] ]: ContractEvent<Abi> }

Type parameters

ContractMethod

ContractMethod<Abi>: { Abi: Abi; Inputs: ContractMethodInputParameters<Abi[inputs]>; Outputs: ContractMethodOutputParameters<Abi[outputs]> }

Type parameters

Type declaration

ContractMethodInputParameters

ContractMethodInputParameters<Params>: Params extends readonly [] ? [] : Params extends readonly [infer H, ...infer R] ? H extends AbiParameter ? [MatchPrimitiveType<H[type], H[components]>, ...ContractMethodInputParameters<R>] : ContractMethodInputParameters<R> : Params extends undefined | unknown ? [] : Params

Type parameters

  • Params: ReadonlyArray<unknown> | undefined

ContractMethodOutputParameters

ContractMethodOutputParameters<Params>: Params extends readonly [] ? void : Params extends readonly [infer H, ...infer R] ? R extends readonly [] ? H extends AbiParameter ? MatchPrimitiveType<H[type], H[components]> : [] : ArrToObjectWithFunctions<[...ContractMethodOutputParametersRecursiveArray<Params>]> & ContractMethodOutputParametersRecursiveRecord<Params> : []

Type parameters

  • Params: ReadonlyArray<unknown> | undefined

ContractMethods

ContractMethods<Abis>: { [ Abi in FilterAbis<Abis, AbiFunctionFragment & { type: function }> as Abi[name] ]: ContractMethod<Abi> }

Type parameters

ConvertToNumber

ConvertToNumber<T, Range>: Range extends unknown ? `${Range}` extends T ? Range : never : never

Type parameters

  • T: string
  • Range: number = _SolidityIndexRange

DataFormat

DataFormat: { bytes: FMT_BYTES; number: FMT_NUMBER }

Type declaration

Eip1193Compatible

Eip1193Compatible<API>: Omit<Omit<Web3BaseProvider, request>, asEIP1193Provider> & { request: any }

Type parameters

Eip1193EventName

Eip1193EventName: connect | disconnect | message | chainChanged | accountsChanged

EncodingTypes

EncodingTypes: Numbers | boolean | Numbers[] | boolean[]

EthExecutionAPI

EthExecutionAPI: { eth_accounts: () => Address[]; eth_blockNumber: () => Uint; eth_call: (transaction: TransactionCallAPI, blockNumber: BlockNumberOrTag) => HexStringBytes; eth_clearSubscriptions: (keepSyncing?: boolean) => void; eth_coinbase: () => Address; eth_compileLLL: (code: string) => HexStringBytes; eth_compileSerpent: (code: string) => HexStringBytes; eth_compileSolidity: (code: string) => CompileResultAPI; eth_estimateGas: (transaction: Partial<TransactionWithSenderAPI>, blockNumber: BlockNumberOrTag) => Uint; eth_feeHistory: (blockCount: Uint, newestBlock: BlockNumberOrTag, rewardPercentiles: number[]) => FeeHistoryResultAPI; eth_gasPrice: () => Uint; eth_getBalance: (address: Address, blockNumber: BlockNumberOrTag) => Uint; eth_getBlockByHash: (blockHash: HexString32Bytes, hydrated: boolean) => BlockAPI; eth_getBlockByNumber: (blockNumber: BlockNumberOrTag, hydrated: boolean) => BlockAPI; eth_getBlockTransactionCountByHash: (blockHash: HexString32Bytes) => Uint; eth_getBlockTransactionCountByNumber: (blockNumber: BlockNumberOrTag) => Uint; eth_getCode: (address: Address, blockNumber: BlockNumberOrTag) => HexStringBytes; eth_getCompilers: () => string[]; eth_getFilterChanges: (filterIdentifier: Uint) => FilterResultsAPI; eth_getFilterLogs: (filterIdentifier: Uint) => FilterResultsAPI; eth_getLogs: (filter: Filter) => FilterResultsAPI; eth_getStorageAt: (address: Address, storageSlot: Uint256, blockNumber: BlockNumberOrTag) => HexStringBytes; eth_getTransactionByBlockHashAndIndex: (blockHash: HexString32Bytes, transactionIndex: Uint) => TransactionInfoAPI | undefined; eth_getTransactionByBlockNumberAndIndex: (blockNumber: BlockNumberOrTag, transactionIndex: Uint) => TransactionInfoAPI | undefined; eth_getTransactionByHash: (transactionHash: HexString32Bytes) => TransactionInfoAPI | undefined; eth_getTransactionCount: (address: Address, blockNumber: BlockNumberOrTag) => Uint; eth_getTransactionReceipt: (transactionHash: HexString32Bytes) => TransactionReceiptAPI | undefined; eth_getUncleByBlockHashAndIndex: (blockHash: HexString32Bytes, uncleIndex: Uint) => BlockAPI; eth_getUncleByBlockNumberAndIndex: (blockNumber: BlockNumberOrTag, uncleIndex: Uint) => BlockAPI; eth_getUncleCountByBlockHash: (blockHash: HexString32Bytes) => Uint; eth_getUncleCountByBlockNumber: (blockNumber: BlockNumberOrTag) => Uint; eth_getWork: () => [HexString32Bytes, HexString32Bytes, HexString32Bytes]; eth_hashrate: () => Uint; eth_maxPriorityFeePerGas: () => Uint; eth_mining: () => boolean; eth_newBlockFilter: () => Uint; eth_newFilter: (filter: Filter) => Uint; eth_newPendingTransactionFilter: () => Uint; eth_protocolVersion: () => string; eth_sendRawTransaction: (transaction: HexStringBytes) => HexString32Bytes; eth_sendTransaction: (transaction: TransactionWithSenderAPI | Partial<TransactionWithSenderAPI>) => HexString32Bytes; eth_sign: (address: Address, message: HexStringBytes) => HexString256Bytes; eth_signTransaction: (transaction: TransactionWithSenderAPI | Partial<TransactionWithSenderAPI>) => HexStringBytes | SignedTransactionInfoAPI; eth_submitHashrate: (hashRate: HexString32Bytes, id: HexString32Bytes) => boolean; eth_submitWork: (nonce: HexString8Bytes, hash: HexString32Bytes, digest: HexString32Bytes) => boolean; eth_subscribe: (...params: [newHeads] | [newPendingTransactions] | [syncing] | [logs, { address?: HexString; topics?: HexString[] }]) => HexString; eth_syncing: () => SyncingStatusAPI; eth_uninstallFilter: (filterIdentifier: Uint) => boolean; eth_unsubscribe: (subscriptionId: HexString) => HexString }

Type declaration

EthPersonalAPI

EthPersonalAPI: { personal_ecRecover: (signedData: HexString, signature: HexString) => Address; personal_importRawKey: (keyData: HexString, passphrase: string) => HexString; personal_listAccounts: () => Address[]; personal_lockAccount: (address: Address) => boolean; personal_newAccount: (password: string) => Address; personal_sendTransaction: (tx: Transaction, passphrase: string) => HexString; personal_sign: (data: HexString, address: Address, passphrase: string) => HexString; personal_signTransaction: (tx: Transaction, passphrase: string) => HexString; personal_unlockAccount: (address: Address, password: string, unlockDuration: number) => boolean }

Type declaration

FeeHistory

FeeHistory: FeeHistoryBase<Numbers>

FeeHistoryResultAPI

FeeHistoryResultAPI: FeeHistoryBase<Uint>

FilterAbis

FilterAbis<Abis, Filter, Abi>: Abi extends Filter ? Abi : never

Type parameters

FilterResultsAPI

FilterResultsAPI: HexString32Bytes[] | LogAPI[]

FixedSizeArray

FixedSizeArray<T, N>: GrowToSize<T, [], N>

Type parameters

  • T
  • N: number

FormatType

FormatType<T, F>: number extends Extract<T, Numbers> ? NumberTypes[F[number]] | Exclude<T, Numbers> : Uint8Array extends Extract<T, Bytes> ? ByteTypes[F[bytes]] | Exclude<T, Bytes> : T extends object | undefined ? { [ P in keyof T ]: FormatType<T[P], F> } : T

Type parameters

GrowToSize

GrowToSize<T, A, N>: { 0: A; 1: GrowToSize<T, _Grow<T, A>, N> }[A[length] extends N ? 0 : 1]

Type parameters

  • T
  • A: T[]
  • N: number

Hardfork

Hardfork: `${HardforksOrdered}`

HexString

HexString: string

HexString16Bytes

HexString16Bytes: HexString

HexString256Bytes

HexString256Bytes: HexString

HexString32Bytes

HexString32Bytes: HexString

HexString8Bytes

HexString8Bytes: HexString

HexStringBytes

HexStringBytes: HexString

HexStringSingleByte

HexStringSingleByte: HexString

IndexKeysForArray

IndexKeysForArray<A>: Exclude<keyof A, keyof []>

Type parameters

  • A: readonly unknown[]

JsonEventInterface

JsonEventInterface: { anonymous: boolean; indexed: boolean; inputs: Components[]; name: string; type: event }

Type declaration

  • anonymous: boolean
  • indexed: boolean
  • inputs: Components[]
  • name: string
  • type: event

JsonFunctionInterface

JsonFunctionInterface: { inputs: Components[]; name: string; outputs?: AbiInput[]; stateMutability?: string; type: function }

Type declaration

  • inputs: Components[]
  • name: string
  • optionaloutputs?: AbiInput[]
  • optionalstateMutability?: string
  • type: function

JsonRpcBatchRequest

JsonRpcBatchRequest: JsonRpcRequest[]

JsonRpcBatchResponse

JsonRpcBatchResponse<Result, Error>: (JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result>)[]

Type parameters

JsonRpcId

JsonRpcId: string | number | undefined

JsonRpcIdentifier

JsonRpcIdentifier: string & (2.0 | 1.0)

JsonRpcPayload

JsonRpcPayload<Param>: JsonRpcRequest<Param> | JsonRpcBatchRequest

Type parameters

  • Param = unknown[]

JsonRpcResponse

JsonRpcResponse<Result, Error>: JsonRpcResponseWithError<Error> | JsonRpcResponseWithResult<Result> | Result[]

Type parameters

JsonRpcResult

JsonRpcResult: string | number | boolean | Record<string, unknown>

KeyStore

KeyStore: { address: string; crypto: { cipher: Cipher; cipherparams: { iv: string }; ciphertext: string; kdf: pbkdf2 | scrypt; kdfparams: ScryptParams | PBKDF2SHA256Params; mac: HexString }; id: string; version: 3 }

Type declaration

LogAPI

MatchPrimitiveType

MatchPrimitiveType<Type, TypeComponents>: PrimitiveAddressType<Type> | PrimitiveStringType<Type> | PrimitiveBooleanType<Type> | PrimitiveIntegerType<Type> | PrimitiveBytesType<Type> | PrimitiveTupleType<Type, TypeComponents> | never

Type parameters

  • Type: string
  • TypeComponents: ReadonlyArray<AbiParameter> | undefined | unknown

Mutable

Mutable<T>: { -readonly [ P in keyof T ]: T[P] }

Type parameters

  • T

NumberTypes

NumberTypes: { NUMBER_BIGINT: bigint; NUMBER_HEX: HexString; NUMBER_NUMBER: number; NUMBER_STR: string }

Type declaration

  • NUMBER_BIGINT: bigint
  • NUMBER_HEX: HexString
  • NUMBER_NUMBER: number
  • NUMBER_STR: string

Numbers

Numbers: number | bigint | string | HexString

Optional

Optional<T, K>: Pick<Partial<T>, K> & Omit<T, K>

Type parameters

  • T
  • K: keyof T

PBKDF2SHA256Params

PBKDF2SHA256Params: { c: number; dklen: number; prf: hmac-sha256; salt: Uint8Array | string }

Type declaration

  • c: number
  • dklen: number
  • prf: hmac-sha256
  • salt: Uint8Array | string

PopulatedUnsignedTransaction

PrimitiveAddressType

PrimitiveAddressType<Type>: Type extends `address[${infer Size}]` ? _TypedArray<Address, Size> : Type extends address ? Address : never

Type parameters

  • Type: string

PrimitiveBooleanType

PrimitiveBooleanType<Type>: Type extends `bool[${infer Size}]` ? _TypedArray<boolean, Size> : Type extends bool ? boolean : never

Type parameters

  • Type: string

PrimitiveBytesType

PrimitiveBytesType<Type>: Type extends `bytes${string}[${infer Size}]` ? _TypedArray<Bytes, Size> : Type extends bytes | `bytes${string}` ? Bytes : never

Type parameters

  • Type: string

PrimitiveIntegerType

PrimitiveIntegerType<Type>: Type extends `uint${string}[${infer Size}]` | `int${string}[${infer Size}]` ? _TypedArray<Numbers, Size> : Type extends uint | int | `int${string}` | `uint${string}` ? Numbers : never

Type parameters

  • Type: string

PrimitiveStringType

PrimitiveStringType<Type>: Type extends `string${string}[${infer Size}]` ? _TypedArray<string, Size> : Type extends string | `string${string}` ? string : never

Type parameters

  • Type: string

PrimitiveTupleType

PrimitiveTupleType<Type, TypeComponents>: TypeComponents extends ReadonlyArray<AbiParameter> ? Type extends tuple ? { [ Param in TypeComponents[number] as Param[name] ]: MatchPrimitiveType<Param[type], Param[components]> } : Type extends `tuple[${infer Size}]` ? _TypedArray<{ [ Param in TypeComponents[number] as Param[name] ]: MatchPrimitiveType<Param[type], Param[components]> }, Size> : never : never

Type parameters

  • Type: string
  • TypeComponents: ReadonlyArray<AbiParameter> | undefined | unknown = []

ProviderAccounts

ProviderAccounts: string[]

ProviderChainId

ProviderChainId: string

Receipt

Receipt: Record<string, unknown>

ScryptParams

ScryptParams: { dklen: number; n: number; p: number; r: number; salt: Uint8Array | string }

Type declaration

  • dklen: number
  • n: number
  • p: number
  • r: number
  • salt: Uint8Array | string

Sha3Input

Sha3Input: TypedObject | TypedObjectAbbreviated | Numbers | boolean | object

SupportedProviders

Type parameters

SyncingStatusAPI

SyncingStatusAPI: { currentBlock: Uint; highestBlock: Uint; startingBlock: Uint } | boolean

Topic

TransactionHash

TransactionHash: HexString

TransactionInfoAPI

TransactionInfoAPI: TransactionSignedAPI & { blockHash?: HexString32Bytes; blockNumber?: Uint; from: Address; hash: HexString32Bytes; transactionIndex?: Uint }

TransactionOutput

TransactionOutput: { blockNumber?: Numbers; from?: HexString; gas?: Numbers; gasLimit?: string; input: string; nonce: Numbers; to?: HexString; transactionIndex?: Numbers; value: Numbers } & ({ gasPrice?: never; maxFeePerGas: Numbers; maxPriorityFeePerGas: Numbers } | { gasPrice: Numbers; maxFeePerGas?: never; maxPriorityFeePerGas?: never })

TransactionReceipt

TransactionReceipt: TransactionReceiptBase<Numbers, Bytes, Bytes, Log>

TransactionReceiptAPI

TransactionSignedAPI

TransactionUnsignedAPI

TransactionWithSenderAPI

TransactionWithSenderAPI: TransactionUnsignedAPI & { from: Address }

TypedObject

TypedObject: { type: string; value: EncodingTypes }

Type declaration

TypedObjectAbbreviated

TypedObjectAbbreviated: { t: string; v: EncodingTypes }

Type declaration

Uint

Uint: HexString

Uint256

Uint256: HexString

Uncles

ValidChains

ValidChains: goerli | kovan | mainnet | rinkeby | ropsten | sepolia

ValueTypes

ValueTypes: address | bool | string | int256 | uint256 | bytes | bigint

Web3APIMethod

Web3APIMethod<T>: string & keyof Exclude<T, unknown>

Type parameters

Web3APIParams

Web3APIParams<API, Method>: API extends Exclude<Web3APISpec, unknown> ? Parameters<API[Method]> : unknown

Type parameters

Web3APIReturnType

Web3APIReturnType<API, Method>: API extends Record<string, (...params: any) => any> ? ReturnType<API[Method]> : any

Type parameters

Web3APISpec

Web3APISpec: Record<string, (...params: any) => any> | unknown

Web3BaseProviderConstructor

Web3BaseProviderConstructor: new <API>(url: string, net?: Socket) => Web3BaseProvider<API>

Type declaration

Web3Eip1193ProviderEventCallback

Web3Eip1193ProviderEventCallback<T>: (data: T) => void

Type parameters

  • T

Type declaration

    • (data: T): void
    • Parameters

      • data: T

      Returns void

Web3EthExecutionAPI

Web3EthExecutionAPI: EthExecutionAPI & { eth_chainId: () => Uint; eth_getProof: (address: Address, storageKeys: HexString32Bytes[], blockNumber: BlockNumberOrTag) => AccountObject; eth_pendingTransactions: () => TransactionInfo[]; eth_requestAccounts: () => Address[]; eth_signTypedData: (address: Address, typedData: Eip712TypedData, useLegacy: true) => HexString256Bytes; eth_signTypedData_v4: (address: Address, typedData: Eip712TypedData, useLegacy: false | undefined) => HexString256Bytes; web3_clientVersion: () => string }

Web3NetAPI

Web3NetAPI: { net_listening: () => boolean; net_peerCount: () => HexString; net_version: () => string }

Type declaration

  • net_listening: () => boolean
      • (): boolean
      • Returns boolean

  • net_peerCount: () => HexString
  • net_version: () => string
      • (): string
      • Returns string

Web3ProviderEventCallback

Web3ProviderEventCallback<T>: (error: Error | ProviderRpcError | undefined, result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void

Type parameters

Type declaration

Web3ProviderMessageEventCallback

Web3ProviderMessageEventCallback<T>: (result?: JsonRpcSubscriptionResult | JsonRpcNotification<T>) => void

Type parameters

Type declaration

Web3ProviderRequestCallback

Web3ProviderRequestCallback<ResultType>: (err?: Error | Web3Error | null | JsonRpcResponseWithError<Error>, response?: JsonRpcResponseWithResult<ResultType>) => void

Type parameters

  • ResultType = unknown

Type declaration

Web3ProviderStatus

Web3ProviderStatus: connecting | connected | disconnected

Web3ValidationErrorObject

Web3ValidationErrorObject<K, P, S>: { data?: unknown; instancePath: string; keyword: K; message?: string; params: P; propertyName?: string; schema?: S; schemaPath: string }

Type parameters

  • K: string = string
  • P = Record<string, any>
  • S = unknown

Type declaration

  • optionaldata?: unknown
  • instancePath: string
  • keyword: K
  • optionalmessage?: string
  • params: P
  • optionalpropertyName?: string
  • optionalschema?: S
  • schemaPath: string

Variables

constDEFAULT_RETURN_FORMAT

DEFAULT_RETURN_FORMAT: { bytes: HEX; number: BIGINT } = ...

Type declaration

  • readonlybytes: HEX
  • readonlynumber: BIGINT

constETH_DATA_FORMAT

ETH_DATA_FORMAT: { bytes: HEX; number: HEX } = ...

Type declaration

  • readonlybytes: HEX
  • readonlynumber: HEX

constTypedArray

TypedArray: any = ...