Skip to main content

eth

Index

References

Namespaces

Classes

Interfaces

Type Aliases

Variables

Functions

References

Web3Eth

Re-exports Web3Eth

decodeEventABI

Re-exports decodeEventABI

Namespaces

abi

abi:

decodeContractErrorData

decodeFunctionCall

  • Decodes a function call data using its JSON interface object. The JSON interface spec documentation https://docs.soliditylang.org/en/latest/abi-spec.html#json

    @example
    const data =
    '0xa413686200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010416e6f74686572204772656574696e6700000000000000000000000000000000';
    const params = decodeFunctionCall(
    {
    inputs: [
    { internalType: 'string', name: '_greeting', type: 'string' },
    { internalType: 'string', name: '_second_greeting', type: 'string' },
    ],
    name: 'setGreeting',
    outputs: [
    { internalType: 'bool', name: '', type: 'bool' },
    { internalType: 'string', name: '', type: 'string' },
    ],
    stateMutability: 'nonpayable',
    type: 'function',
    },
    data,
    );

    console.log(params);
    > {
    > '0': 'Hello',
    > '1': 'Another Greeting',
    > __length__: 2,
    > __method__: 'setGreeting(string,string)',
    > _greeting: 'Hello',
    > _second_greeting: 'Another Greeting',
    > }

    Parameters

    • functionsAbi: AbiFunctionFragment | AbiConstructorFragment

      The JSON interface object of the function.

    • data: string

      The data to decode

    • optionalmethodSignatureProvided: boolean

      (Optional) if false do not remove the first 4 bytes that would rather contain the function signature.

    Returns DecodedParams & { __method__: string }

    • The data decoded according to the passed ABI.

decodeFunctionReturn

  • Decodes a function call data using its JSON interface object. The JSON interface spec documentation https://docs.soliditylang.org/en/latest/abi-spec.html#json

    @example
    // decode a multi-value data of a method
    const data =
    '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
    const decodedResult = decodeFunctionReturn(
    {
    inputs: [
    { internalType: 'string', name: '_greeting', type: 'string' }
    ],
    name: 'setGreeting',
    outputs: [
    { internalType: 'string', name: '', type: 'string' },
    { internalType: 'bool', name: '', type: 'bool' },
    ],
    stateMutability: 'nonpayable',
    type: 'function',
    },
    data,
    );

    console.log(decodedResult);
    > { '0': 'Hello', '1': true, __length__: 2 }


    // decode a single-value data of a method
    const data =
    '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
    const decodedResult = decodeFunctionReturn(
    {
    inputs: [
    { internalType: 'string', name: '_greeting', type: 'string' }
    ],
    name: 'setGreeting',
    outputs: [{ internalType: 'string', name: '', type: 'string' }],
    stateMutability: 'nonpayable',
    type: 'function',
    },
    data,
    );

    console.log(decodedResult);
    > 'Hello'

    Parameters

    • functionsAbi: AbiFunctionFragment

      The JSON interface object of the function.

    • optionalreturnValues: string

      The data (the function-returned-values) to decoded

    Returns unknown

    • The ABI encoded function call, which, means the function signature and the parameters passed.

decodeLog

  • decodeLog<ReturnType_1>(inputs: readonly AbiParameter[] | AbiParameter[], data: string, topics: string | string[]): ReturnType_1
  • Decodes ABI-encoded log data and indexed topic data.

    @example
    let res = web3.eth.abi.decodeLog(
    [
    {
    type: "string",
    name: "myString",
    },
    {
    type: "uint256",
    name: "myNumber",
    indexed: true,
    },
    {
    type: "uint8",
    name: "mySmallNumber",
    indexed: true,
    },
    ],
    "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000748656c6c6f252100000000000000000000000000000000000000000000000000",
    [
    "0x000000000000000000000000000000000000000000000000000000000000f310",
    "0x0000000000000000000000000000000000000000000000000000000000000010",
    ]
    );
    > {
    '0': 'Hello%!',
    '1': 62224n,
    '2': 16n,
    __length__: 3,
    myString: 'Hello%!',
    myNumber: 62224n,
    mySmallNumber: 16n
    }

    Type parameters

    Parameters

    • inputs: readonly AbiParameter[] | AbiParameter[]

      A AbiParameter input array. See the Solidity documentation for a list of types.

    • data: string

      The ABI byte code in the data field of a log.

    • topics: string | string[]

      An array with the index parameter topics of the log, without the topic[0] if its a non-anonymous event, otherwise with topic[0]

    Returns ReturnType_1

    • The result object containing the decoded parameters.

decodeParameter

  • decodeParameter(abi: AbiInput, bytes: string): unknown
  • Decodes an ABI encoded parameter to its JavaScript type.

    @example
      const res = web3.eth.abi.decodeParameter(
    "uint256",
    "0x0000000000000000000000000000000000000000000000000000000000000010"
    );
    console.log(res);
    > 16n

    const res = web3.eth.abi.decodeParameter(
    "string",
    "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000848656c6c6f212521000000000000000000000000000000000000000000000000"
    );

    console.log(res);
    > Hello!%!

    const res = web3.eth.abi.decodeParameter(
    {
    ParentStruct: {
    propertyOne: "uint256",
    propertyTwo: "uint256",
    childStruct: {
    propertyOne: "uint256",
    propertyTwo: "uint256",
    },
    },
    },
    "0x000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004e"
    );

    console.log(res);
    {
    '0': 42n,
    '1': 56n,
    '2': {
    '0': 45n,
    '1': 78n,
    __length__: 2,
    propertyOne: 45n,
    propertyTwo: 78n
    },
    __length__: 3,
    propertyOne: 42n,
    propertyTwo: 56n,
    childStruct: {
    '0': 45n,
    '1': 78n,
    __length__: 2,
    propertyOne: 45n,
    propertyTwo: 78n
    }
    }

    Parameters

    Returns unknown

    • The decoded parameter

decodeParameters

  • decodeParameters(abi: readonly AbiInput[] | AbiInput[], bytes: string): { __length__: number }
  • Decodes ABI encoded parameters to its JavaScript types.

    @example
    let res = web3.eth.abi.decodeParameters(
    ["string", "uint256"],
    "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000000848656c6c6f212521000000000000000000000000000000000000000000000000"
    );
    console.log(res);
    > { '0': 'Hello!%!', '1': 234n, __length__: 2 }

    let res = web3.eth.abi.decodeParameters(
    [
    {
    type: "string",
    name: "myString",
    },
    {
    type: "uint256",
    name: "myNumber",
    },
    ],
    "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000ea000000000000000000000000000000000000000000000000000000000000000848656c6c6f212521000000000000000000000000000000000000000000000000"
    );
    console.log(res);
    > {
    '0': 'Hello!%!',
    '1': 234n,
    __length__: 2,
    myString: 'Hello!%!',
    myNumber: 234n
    }

    const res = web3.eth.abi.decodeParameters(
    [
    "uint8[]",
    {
    ParentStruct: {
    propertyOne: "uint256",
    propertyTwo: "uint256",
    childStruct: {
    propertyOne: "uint256",
    propertyTwo: "uint256",
    },
    },
    },
    ],
    "0x00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000018"
    );
    console.log(res);
    >
    '0': [ 42n, 24n ],
    '1': {
    '0': 42n,
    '1': 56n,
    '2': {
    '0': 45n,
    '1': 78n,
    __length__: 2,
    propertyOne: 45n,
    propertyTwo: 78n
    },
    __length__: 3,
    propertyOne: 42n,
    propertyTwo: 56n,
    childStruct: {
    '0': 45n,
    '1': 78n,
    __length__: 2,
    propertyOne: 45n,
    propertyTwo: 78n
    }
    },
    __length__: 2,
    ParentStruct: {
    '0': 42n,
    '1': 56n,
    '2': {
    '0': 45n,
    '1': 78n,
    __length__: 2,
    propertyOne: 45n,
    propertyTwo: 78n
    },
    __length__: 3,
    propertyOne: 42n,
    propertyTwo: 56n,
    childStruct: {
    '0': 45n,
    '1': 78n,
    __length__: 2,
    propertyOne: 45n,
    propertyTwo: 78n
    }
    }
    }

    Parameters

    Returns { __length__: number }

    • The result object containing the decoded parameters.
    • [key string]: unknown
    • __length__: number

decodeParametersWith

  • decodeParametersWith(abis: readonly AbiInput[] | AbiInput[], bytes: string, loose: boolean): { __length__: number }
  • Should be used to decode list of params


    Parameters

    Returns { __length__: number }

    • [key string]: unknown
    • __length__: number

encodeErrorSignature

  • Encodes the error name to its ABI signature, which are the sha3 hash of the error name including input types.


    Parameters

    Returns string

encodeEventSignature

  • Encodes the event name to its ABI signature, which are the sha3 hash of the event name including input types.

    @example
    const event = web3.eth.abi.encodeEventSignature({
    name: "myEvent",
    type: "event",
    inputs: [
    {
    type: "uint256",
    name: "myNumber",
    },
    {
    type: "bytes32",
    name: "myBytes",
    },
    ],
    });
    console.log(event);
    > 0xf2eeb729e636a8cb783be044acf6b7b1e2c5863735b60d6daae84c366ee87d97

    const event = web3.eth.abi.encodeEventSignature({
    inputs: [
    {
    indexed: true,
    name: "from",
    type: "address",
    },
    {
    indexed: true,
    name: "to",
    type: "address",
    },
    {
    indexed: false,
    name: "value",
    type: "uint256",
    },
    ],
    name: "Transfer",
    type: "event",
    });
    console.log(event);
    > 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef

    Parameters

    • functionName: string | AbiEventFragment

      The event name to encode, or the AbiEventFragment object of the event. If string, it has to be in the form of eventName(param1Type,param2Type,...). eg: myEvent(uint256,bytes32).

    Returns string

    • The ABI signature of the event.

encodeFunctionCall

  • Encodes a function call using its JSON interface object and given parameters. The JSON interface spec documentation https://docs.soliditylang.org/en/latest/abi-spec.html#json

    @example
    const sig = web3.eth.abi.encodeFunctionCall(
    {
    name: "myMethod",
    type: "function",
    inputs: [
    {
    type: "uint256",
    name: "myNumber",
    },
    {
    type: "string",
    name: "myString",
    },
    ],
    },
    ["2345675643", "Hello!%"]
    );
    console.log(sig);
    > 0x24ee0097000000000000000000000000000000000000000000000000000000008bd02b7b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000748656c6c6f212500000000000000000000000000000000000000000000000000



    const sig = web3.eth.abi.encodeFunctionCall(
    {
    inputs: [
    {
    name: "account",
    type: "address",
    },
    ],
    name: "balanceOf",
    outputs: [
    {
    name: "",
    type: "uint256",
    },
    ],
    stateMutability: "view",
    type: "function",
    },
    ["0x1234567890123456789012345678901234567890"]
    );

    console.log(sig);
    > 0x70a082310000000000000000000000001234567890123456789012345678901234567890

    Parameters

    • jsonInterface: AbiFunctionFragment

      The JSON interface object of the function.

    • params: unknown[]

      The parameters to encode

    Returns string

    • The ABI encoded function call, which, means the function signature and the parameters passed.

encodeFunctionSignature

  • Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. The JSON interface spec documentation https://docs.soliditylang.org/en/latest/abi-spec.html#json

    @example
    const signature = web3.eth.abi.encodeFunctionSignature({
    name: "myMethod",
    type: "function",
    inputs: [
    {
    type: "uint256",
    name: "myNumber",
    },
    {
    type: "string",
    name: "myString",
    },
    ],
    });
    console.log(signature);
    > 0x24ee0097

    const signature = web3.eth.abi.encodeFunctionSignature('myMethod(uint256,string)')
    console.log(signature);
    > 0x24ee0097

    const signature = web3.eth.abi.encodeFunctionSignature('safeTransferFrom(address,address,uint256,bytes)');
    console.log(signature);
    > 0xb88d4fde

    Parameters

    • functionName: string | AbiFunctionFragment

      The function name to encode or the JSON interface object of the function. If the passed parameter is a string, it has to be in the form of functionName(param1Type,param2Type,...). eg: myFunction(uint256,uint32[],bytes10,bytes)

    Returns string

    • The ABI signature of the function.

encodeParameter

  • encodeParameter(abi: AbiInput, param: unknown): string
  • Encodes a parameter based on its type to its ABI representation.

    @example
     const res = web3.eth.abi.encodeParameter("uint256", "2345675643");
    console.log(res);
    0x000000000000000000000000000000000000000000000000000000008bd02b7b

    const res = web3.eth.abi.encodeParameter("uint", "2345675643");

    console.log(res);
    >0x000000000000000000000000000000000000000000000000000000008bd02b7b

    const res = web3.eth.abi.encodeParameter("bytes32", "0xdf3234");

    console.log(res);
    >0xdf32340000000000000000000000000000000000000000000000000000000000

    const res = web3.eth.abi.encodeParameter("bytes", "0xdf3234");

    console.log(res);
    > 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003df32340000000000000000000000000000000000000000000000000000000000

    const res = web3.eth.abi.encodeParameter("bytes32[]", ["0xdf3234", "0xfdfd"]);

    console.log(res);
    > 0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002df32340000000000000000000000000000000000000000000000000000000000fdfd000000000000000000000000000000000000000000000000000000000000

    const res = web3.eth.abi.encodeParameter(
    {
    ParentStruct: {
    propertyOne: "uint256",
    propertyTwo: "uint256",
    childStruct: {
    propertyOne: "uint256",
    propertyTwo: "uint256",
    },
    },
    },
    {
    propertyOne: 42,
    propertyTwo: 56,
    childStruct: {
    propertyOne: 45,
    propertyTwo: 78,
    },
    }
    );

    console.log(res);
    > 0x000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000004e

    Parameters

    Returns string

    • The ABI encoded parameter

encodeParameters

  • encodeParameters(abi: readonly AbiInput[], params: unknown[]): string
  • Encodes a parameter based on its type to its ABI representation.

    @example
    const res = web3.eth.abi.encodeParameters(
    ["uint256", "string"],
    ["2345675643", "Hello!%"]
    );

    console.log(res);
    > 0x000000000000000000000000000000000000000000000000000000008bd02b7b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000748656c6c6f212500000000000000000000000000000000000000000000000000

    Parameters

    Returns string

    • The ABI encoded parameters

flattenTypes

  • flattenTypes(includeTuple: boolean, puts: readonly AbiParameter[]): string[]
  • used to flatten json abi inputs/outputs into an array of type-representing-strings


    Parameters

    Returns string[]

formatOddHexstrings

  • formatOddHexstrings(param: string): string
  • format odd-length bytes to even-length


    Parameters

    • param: string

    Returns string

formatParam

  • formatParam(type: string, _param: unknown): unknown
  • Handle some formatting of params for backwards compatibility with Ethers V4


    Parameters

    • type: string
    • _param: unknown

    Returns unknown

getEncodedEip712Data

  • Get the EIP-191 encoded message to sign, from the typedData object. If hash is enabled, the message will be hashed with Keccak256.


    Parameters

    Returns string

inferTypesAndEncodeParameters

  • inferTypesAndEncodeParameters(params: unknown[]): string
  • Infer a smart contract method parameter type and then encode this parameter.

    @remarks

    This method is useful when you don't know the type of the parameters you want to encode. It will infer the type of the parameters and then encode them. However, it is not recommended to use this method when you know the type of the parameters you want to encode. In this case, use the encodeParameters method instead. The type inference is not perfect and can lead to unexpected results. Especially when you want to encode an array, uint that is not uint256 or bytes....

    @example
    const res = web3.eth.abi.encodeParameters(
    ["2345675643", "Hello!%"]
    );

    console.log(res);
    > 0x000000000000000000000000000000000000000000000000000000008bd02b7b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000748656c6c6f212500000000000000000000000000000000000000000000000000

    Parameters

    • params: unknown[]

      The parameters to encode.

    Returns string

    • The ABI encoded parameters

isAbiConstructorFragment

isAbiErrorFragment

isAbiEventFragment

isAbiFragment

isAbiFunctionFragment

isOddHexstring

  • isOddHexstring(param: unknown): boolean
  • returns true if input is a hexstring and is odd-lengthed


    Parameters

    • param: unknown

    Returns boolean

isSimplifiedStructFormat

jsonInterfaceMethodToString

  • Should be used to create full function/event name from json abi returns a string


    Parameters

    Returns string

mapStructNameAndType

  • mapStructNameAndType(structName: string): AbiStruct
  • Maps the correct tuple type and name when the simplified format in encode/decodeParameter is used


    Parameters

    • structName: string

    Returns AbiStruct

mapStructToCoderFormat

  • Maps the simplified format in to the expected format of the ABICoder


    Parameters

    Returns AbiCoderStruct[]

mapTypes

  • Map types if simplified format is used


    Parameters

    Returns (string | Record<string, unknown> | AbiParameter)[]

accounts

accounts:

txUtils

txUtils:

checkMaxInitCodeSize

  • checkMaxInitCodeSize(common: Common, length: number): void
  • Parameters

    • common: Common
    • length: number

    Returns void

getAccessListData

  • getAccessListData(accessList: AccessListUint8Array | AccessList): { AccessListJSON: AccessList; accessList: AccessListUint8Array }
  • Parameters

    • accessList: AccessListUint8Array | AccessList

    Returns { AccessListJSON: AccessList; accessList: AccessListUint8Array }

    • AccessListJSON: AccessList
    • accessList: AccessListUint8Array

getAccessListJSON

  • getAccessListJSON(accessList: AccessListUint8Array): { address: string; storageKeys: string[] }[]
  • Parameters

    • accessList: AccessListUint8Array

    Returns { address: string; storageKeys: string[] }[]

getDataFeeEIP2930

  • getDataFeeEIP2930(accessList: AccessListUint8Array, common: Common): number
  • Parameters

    • accessList: AccessListUint8Array
    • common: Common

    Returns number

verifyAccessList

  • verifyAccessList(accessList: AccessListUint8Array): void
  • Parameters

    • accessList: AccessListUint8Array

    Returns void

Capability

Capability:

Can be used in conjunction with Transaction.supports to query on tx capabilities

EIP1559FeeMarket

EIP1559FeeMarket: 1559

Tx supports EIP-1559 gas fee market mechanism See: 1559 Fee Market EIP

EIP155ReplayProtection

EIP155ReplayProtection: 155

Tx supports EIP-155 replay protection See: 155 Replay Attack Protection EIP

EIP2718TypedTransaction

EIP2718TypedTransaction: 2718

Tx is a typed transaction as defined in EIP-2718 See: 2718 Transaction Type EIP

EIP2930AccessLists

EIP2930AccessLists: 2930

Tx supports access list generation as defined in EIP-2930 See: 2930 Access Lists EIP

Chain

Chain:

Goerli

Goerli: 5

Mainnet

Mainnet: 1

Sepolia

Sepolia: 11155111

ConsensusAlgorithm

ConsensusAlgorithm:

Casper

Casper: casper

Clique

Clique: clique

Ethash

Ethash: ethash

ConsensusType

ConsensusType:

ProofOfAuthority

ProofOfAuthority: poa

ProofOfStake

ProofOfStake: pos

ProofOfWork

ProofOfWork: pow

CustomChain

CustomChain:

ArbitrumOne

ArbitrumOne: arbitrum-one

Arbitrum One - mainnet for Arbitrum roll-up

ArbitrumRinkebyTestnet

ArbitrumRinkebyTestnet: arbitrum-rinkeby-testnet

Arbitrum Rinkeby Testnet

OptimisticEthereum

OptimisticEthereum: optimistic-ethereum

Optimistic Ethereum - mainnet for Optimism roll-up

OptimisticKovan

OptimisticKovan: optimistic-kovan

Optimistic Kovan - testnet for Optimism roll-up

PolygonMainnet

PolygonMainnet: polygon-mainnet

Polygon (Matic) Mainnet

PolygonMumbai

PolygonMumbai: polygon-mumbai

Polygon (Matic) Mumbai Testnet

xDaiChain

xDaiChain: x-dai-chain

xDai EVM sidechain with a native stable token

Hardfork

Hardfork:

ArrowGlacier

ArrowGlacier: arrowGlacier

Berlin

Berlin: berlin

Byzantium

Byzantium: byzantium

Chainstart

Chainstart: chainstart

Constantinople

Constantinople: constantinople

Dao

Dao: dao

GrayGlacier

GrayGlacier: grayGlacier

Homestead

Homestead: homestead

Istanbul

Istanbul: istanbul

London

London: london

Merge

Merge: merge

MergeForkIdTransition

MergeForkIdTransition: mergeForkIdTransition

MuirGlacier

MuirGlacier: muirGlacier

Petersburg

Petersburg: petersburg

Shanghai

Shanghai: shanghai

ShardingForkDev

ShardingForkDev: shardingFork

SpuriousDragon

SpuriousDragon: spuriousDragon

TangerineWhistle

TangerineWhistle: tangerineWhistle

TypeOutput

TypeOutput:

Type output options

BigInt

BigInt: 1

Number

Number: 0

PrefixedHexString

PrefixedHexString: 3

Uint8Array

Uint8Array: 2

AccessListEIP2930Transaction

AccessListEIP2930Transaction:

Typed transaction with optional access lists

constructor

  • new AccessListEIP2930Transaction(txData: AccessListEIP2930TxData, opts?: TxOptions): AccessListEIP2930Transaction
  • This constructor takes the values, validates them, assigns them and freezes the object.

    It is not recommended to use this constructor directly. Instead use the static factory methods to assist in creating a Transaction object from varying data types.


    Parameters

    • txData: AccessListEIP2930TxData
    • optionalopts: TxOptions

    Returns AccessListEIP2930Transaction

readonlyAccessListJSON

AccessListJSON: AccessList

readonlyaccessList

accessList: AccessListUint8Array

readonlychainId

chainId: bigint

readonlycommon

common: Common

readonlydata

data: Uint8Array

readonlygasLimit

gasLimit: bigint

readonlygasPrice

gasPrice: bigint

readonlynonce

nonce: bigint

optionalreadonlyr

r?: bigint

optionalreadonlys

s?: bigint

optionalreadonlyto

to?: Address

optionalreadonlyv

v?: bigint

readonlyvalue

value: bigint

type

  • get type(): number
  • Returns the transaction type.

    Note: legacy txs will return tx type 0.


    Returns number

_processSignature

  • _processSignature(v: bigint, r: Uint8Array, s: Uint8Array): AccessListEIP2930Transaction
  • Parameters

    • v: bigint
    • r: Uint8Array
    • s: Uint8Array

    Returns AccessListEIP2930Transaction

errorStr

  • errorStr(): string
  • Return a compact error string representation of the object


    Returns string

getBaseFee

  • getBaseFee(): bigint
  • The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)


    Returns bigint

getDataFee

  • getDataFee(): bigint
  • The amount of gas paid for the data in this tx


    Returns bigint

getMessageToSign

  • getMessageToSign(hashMessage?: boolean): Uint8Array
  • Returns the serialized unsigned tx (hashed or raw), which can be used to sign the transaction (e.g. for sending to a hardware wallet).

    Note: in contrast to the legacy tx the raw message format is already serialized and doesn't need to be RLP encoded any more.

    const serializedMessage = tx.getMessageToSign(false) // use this for the HW wallet input

    Parameters

    • optionalhashMessage: boolean

      Return hashed message if set to true (default: true)

    Returns Uint8Array

getMessageToVerifySignature

  • getMessageToVerifySignature(): Uint8Array
  • Computes a sha3-256 hash which can be used to verify the signature


    Returns Uint8Array

getSenderAddress

  • getSenderAddress(): Address
  • Returns the sender's address


    Returns Address

getSenderPublicKey

  • getSenderPublicKey(): Uint8Array
  • Returns the public key of the sender


    Returns Uint8Array

getUpfrontCost

  • getUpfrontCost(): bigint
  • The up front amount that an account must have for this transaction to be valid


    Returns bigint

hash

  • hash(): Uint8Array
  • Computes a sha3-256 hash of the serialized tx.

    This method can only be used for signed txs (it throws otherwise). Use AccessListEIP2930Transaction.getMessageToSign to get a tx hash for the purpose of signing.


    Returns Uint8Array

isSigned

  • isSigned(): boolean
  • Returns boolean

raw

  • raw(): AccessListEIP2930ValuesArray
  • Returns a Uint8Array Array of the raw Uint8Arrays of the EIP-2930 transaction, in order.

    Format:

    [chainId, nonce, gasPrice, gasLimit, to, value, data, accessList,
    signatureYParity (v), signatureR (r), signatureS (s)]

    Use AccessListEIP2930Transaction.serialize to add a transaction to a block with Block.fromValuesArray.

    For an unsigned tx this method uses the empty UINT8ARRAY values for the signature parameters v, r and s for encoding. For an EIP-155 compliant representation for external signing use AccessListEIP2930Transaction.getMessageToSign.


    Returns AccessListEIP2930ValuesArray

serialize

  • serialize(): Uint8Array
  • Returns the serialized encoding of the EIP-2930 transaction.

    Format:

    0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList,
    signatureYParity (v), signatureR (r), signatureS (s)])

    Note that in contrast to the legacy tx serialization format this is not valid RLP any more due to the raw tx type preceding and concatenated to the RLP encoding of the values.


    Returns Uint8Array

sign

  • sign(privateKey: Uint8Array): AccessListEIP2930Transaction
  • Signs a transaction.

    Note that the signed tx is returned as a new object, use as follows:

    const signedTx = tx.sign(privateKey)

    Parameters

    • privateKey: Uint8Array

    Returns AccessListEIP2930Transaction

supports

  • supports(capability: Capability): boolean
  • Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.

    Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.

    This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).

    See Capabilites in the types module for a reference on all supported capabilities.


    Parameters

    • capability: Capability

    Returns boolean

toCreationAddress

  • toCreationAddress(): boolean
  • If the tx's to is to the creation address


    Returns boolean

toJSON

  • toJSON(): JsonTx
  • Returns an object with the JSON representation of the transaction


    Returns JsonTx

validate

  • validate(): boolean
  • validate(stringError: false): boolean
  • validate(stringError: true): string[]
  • Checks if the transaction has the minimum amount of gas required (DataFee + TxFee + Creation Fee).


    Returns boolean

verifySignature

  • verifySignature(): boolean
  • Determines if the signature is valid


    Returns boolean

staticfromSerializedTx

  • fromSerializedTx(serialized: Uint8Array, opts?: TxOptions): AccessListEIP2930Transaction
  • Instantiate a transaction from the serialized tx.

    Format:

    0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList,
    signatureYParity (v), signatureR (r), signatureS (s)])


    Parameters

    • serialized: Uint8Array
    • optionalopts: TxOptions

    Returns AccessListEIP2930Transaction

staticfromTxData

  • fromTxData(txData: AccessListEIP2930TxData, opts?: TxOptions): AccessListEIP2930Transaction
  • Instantiate a transaction from a data dictionary.

    Format: { chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s }

    Notes:

    • chainId will be set automatically if not provided
    • All parameters are optional and have some basic default values

    Parameters

    • txData: AccessListEIP2930TxData
    • optionalopts: TxOptions

    Returns AccessListEIP2930Transaction

staticfromValuesArray

  • fromValuesArray(values: AccessListEIP2930ValuesArray, opts?: TxOptions): AccessListEIP2930Transaction
  • Create a transaction from a values array.

    Format:

    [chainId, nonce, gasPrice, gasLimit, to, value, data, accessList,
    signatureYParity (v), signatureR (r), signatureS (s)]


    Parameters

    • values: AccessListEIP2930ValuesArray
    • optionalopts: TxOptions

    Returns AccessListEIP2930Transaction

abstractBaseTransaction

BaseTransaction<TransactionObject>:

This base class will likely be subject to further refactoring along the introduction of additional tx types on the Ethereum network.

It is therefore not recommended to use directly.


Type parameters

  • TransactionObject

constructor

  • new BaseTransaction<TransactionObject>(txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData, opts: TxOptions): BaseTransaction<TransactionObject>
  • Type parameters

    • TransactionObject

    Parameters

    • txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData
    • opts: TxOptions

    Returns BaseTransaction<TransactionObject>

readonlycommon

common: Common

readonlydata

data: Uint8Array

readonlygasLimit

gasLimit: bigint

readonlynonce

nonce: bigint

optionalreadonlyr

r?: bigint

optionalreadonlys

s?: bigint

optionalreadonlyto

to?: Address

optionalreadonlyv

v?: bigint

readonlyvalue

value: bigint

type

  • get type(): number
  • Returns the transaction type.

    Note: legacy txs will return tx type 0.


    Returns number

abstracterrorStr

  • errorStr(): string
  • Return a compact error string representation of the object


    Returns string

getBaseFee

  • getBaseFee(): bigint
  • The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)


    Returns bigint

getDataFee

  • getDataFee(): bigint
  • The amount of gas paid for the data in this tx


    Returns bigint

abstractgetMessageToSign

  • getMessageToSign(hashMessage: false): Uint8Array | Uint8Array[]
  • getMessageToSign(hashMessage?: true): Uint8Array
  • Parameters

    • hashMessage: false

    Returns Uint8Array | Uint8Array[]

abstractgetMessageToVerifySignature

  • getMessageToVerifySignature(): Uint8Array
  • Returns Uint8Array

getSenderAddress

  • getSenderAddress(): Address
  • Returns the sender's address


    Returns Address

abstractgetSenderPublicKey

  • getSenderPublicKey(): Uint8Array
  • Returns the public key of the sender


    Returns Uint8Array

abstractgetUpfrontCost

  • getUpfrontCost(): bigint
  • The up front amount that an account must have for this transaction to be valid


    Returns bigint

abstracthash

  • hash(): Uint8Array
  • Returns Uint8Array

isSigned

  • isSigned(): boolean
  • Returns boolean

abstractraw

  • raw(): FeeMarketEIP1559ValuesArray | AccessListEIP2930ValuesArray | TxValuesArray
  • Returns a Uint8Array Array of the raw Uint8Arrays of this transaction, in order.

    Use BaseTransaction.serialize to add a transaction to a block with Block.fromValuesArray.

    For an unsigned tx this method uses the empty Uint8Array values for the signature parameters v, r and s for encoding. For an EIP-155 compliant representation for external signing use BaseTransaction.getMessageToSign.


    Returns FeeMarketEIP1559ValuesArray | AccessListEIP2930ValuesArray | TxValuesArray

abstractserialize

  • serialize(): Uint8Array
  • Returns the encoding of the transaction.


    Returns Uint8Array

sign

  • sign(privateKey: Uint8Array): TransactionObject
  • Signs a transaction.

    Note that the signed tx is returned as a new object, use as follows:

    const signedTx = tx.sign(privateKey)

    Parameters

    • privateKey: Uint8Array

    Returns TransactionObject

supports

  • supports(capability: Capability): boolean
  • Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.

    Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.

    This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).

    See Capabilites in the types module for a reference on all supported capabilities.


    Parameters

    • capability: Capability

    Returns boolean

toCreationAddress

  • toCreationAddress(): boolean
  • If the tx's to is to the creation address


    Returns boolean

abstracttoJSON

  • toJSON(): JsonTx
  • Returns an object with the JSON representation of the transaction


    Returns JsonTx

validate

  • validate(): boolean
  • validate(stringError: false): boolean
  • validate(stringError: true): string[]
  • Checks if the transaction has the minimum amount of gas required (DataFee + TxFee + Creation Fee).


    Returns boolean

verifySignature

  • verifySignature(): boolean
  • Determines if the signature is valid


    Returns boolean

staticfromSerializedTx

  • fromSerializedTx(serialized: Uint8Array, opts?: TxOptions): any
  • Parameters

    • serialized: Uint8Array
    • optionalopts: TxOptions

    Returns any

staticfromTxData

  • fromTxData(txData: any, opts?: TxOptions): any
  • Parameters

    • txData: any
    • optionalopts: TxOptions

    Returns any

Common

Common:

Common class to access chain and hardfork parameters and to provide a unified and shared view on the network and hardfork state.

Use the Common.custom static constructor for creating simple custom chain Common objects (more complete custom chain setups can be created via the main constructor and the CommonOpts.customChains parameter).

constructor

  • new Common(opts: CommonOpts): Common
  • Parameters

    • opts: CommonOpts

    Returns Common

readonlyDEFAULT_HARDFORK

DEFAULT_HARDFORK: string

_calcForkHash

  • _calcForkHash(hardfork: string, genesisHash: Uint8Array): string
  • Internal helper function to calculate a fork hash


    Parameters

    • hardfork: string

      Hardfork name

    • genesisHash: Uint8Array

      Genesis block hash of the chain

    Returns string

    Fork hash as hex string

_getHardfork

  • _getHardfork(hardfork: string): null | HardforkConfig
  • Internal helper function, returns the params for the given hardfork for the chain set


    Parameters

    • hardfork: string

      Hardfork name

    Returns null | HardforkConfig

    Dictionary with hardfork params or null if hardfork not on chain

activeOnBlock

  • activeOnBlock(blockNumber: Numbers): boolean
  • Alias to hardforkIsActiveOnBlock when hardfork is set


    Parameters

    Returns boolean

    True if HF is active on block number

bootstrapNodes

  • bootstrapNodes(): undefined | BootstrapNodeConfig[]
  • Returns bootstrap nodes for the current chain


    Returns undefined | BootstrapNodeConfig[]

    Dict with bootstrap nodes

chainId

  • chainId(): bigint
  • Returns the Id of current chain


    Returns bigint

    chain Id

chainName

  • chainName(): string
  • Returns the name of current chain


    Returns string

    chain name (lower case)

consensusAlgorithm

  • consensusAlgorithm(): string
  • Returns the concrete consensus implementation algorithm or protocol for the network e.g. "ethash" for "pow" consensus type, "clique" for "poa" consensus type or "casper" for "pos" consensus type.

    Note: This value can update along a Hardfork.


    Returns string

consensusConfig

  • consensusConfig(): {}
  • Returns a dictionary with consensus configuration parameters based on the consensus algorithm

    Expected returns (parameters must be present in the respective chain json files):

    ethash: empty object clique: period, epoch casper: empty object

    Note: This value can update along a Hardfork.


    Returns {}

    • [key string]: CliqueConfig | EthashConfig | CasperConfig

consensusType

  • consensusType(): string
  • Returns the consensus type of the network Possible values: "pow"|"poa"|"pos"

    Note: This value can update along a Hardfork.


    Returns string

copy

  • copy(): Common
  • Returns a deep copy of this Common instance.


    Returns Common

dnsNetworks

  • dnsNetworks(): string[]
  • Returns DNS networks for the current chain


    Returns string[]

    Array of DNS ENR urls

eipBlock

  • eipBlock(eip: number): null | bigint
  • Returns the hardfork change block for eip


    Parameters

    • eip: number

      EIP number

    Returns null | bigint

    Block number or null if unscheduled

eips

  • eips(): number[]
  • Returns the active EIPs


    Returns number[]

    List of EIPs

forkHash

  • forkHash(_hardfork?: string, genesisHash?: Uint8Array): string
  • Returns an eth/64 compliant fork hash (EIP-2124)


    Parameters

    • optional_hardfork: string
    • optionalgenesisHash: Uint8Array

      Genesis block hash of the chain, optional if already defined and not needed to be calculated

    Returns string

genesis

  • genesis(): GenesisBlockConfig
  • Returns the Genesis parameters of the current chain


    Returns GenesisBlockConfig

    Genesis dictionary

getHardforkByBlockNumber

  • Returns the hardfork based on the block number or an optional total difficulty (Merge HF) provided.

    An optional TD takes precedence in case the corresponding HF block is set to null or otherwise needs to match (if not an error will be thrown).


    Parameters

    Returns string

    The name of the HF

getMaxListeners

  • getMaxListeners(): number
  • Returns number

gteHardfork

  • gteHardfork(hardfork: string): boolean
  • Alias to hardforkGteHardfork when hardfork is set


    Parameters

    • hardfork: string

      Hardfork name

    Returns boolean

    True if hardfork set is greater than hardfork provided

hardfork

  • hardfork(): string
  • Returns the hardfork set


    Returns string

    Hardfork name

hardforkBlock

  • hardforkBlock(_hardfork?: string): null | bigint
  • Returns the hardfork change block for hardfork provided or set


    Parameters

    • optional_hardfork: string

    Returns null | bigint

    Block number or null if unscheduled

hardforkForForkHash

  • hardforkForForkHash(forkHash: string): null | HardforkConfig

  • Parameters

    • forkHash: string

      Fork hash as a hex string

    Returns null | HardforkConfig

    Array with hardfork data (name, block, forkHash)

hardforkGteHardfork

  • hardforkGteHardfork(_hardfork1: null | string, hardfork2: string): boolean
  • Sequence based check if given or set HF1 is greater than or equal HF2


    Parameters

    • _hardfork1: null | string
    • hardfork2: string

      Hardfork name

    Returns boolean

    True if HF1 gte HF2

hardforkIsActiveOnBlock

  • hardforkIsActiveOnBlock(_hardfork: null | string, _blockNumber: Numbers): boolean
  • Checks if set or provided hardfork is active on block number


    Parameters

    • _hardfork: null | string
    • _blockNumber: Numbers

    Returns boolean

    True if HF is active on block number

hardforkTTD

  • hardforkTTD(_hardfork?: string): null | bigint
  • Returns the hardfork change total difficulty (Merge HF) for hardfork provided or set


    Parameters

    • optional_hardfork: string

    Returns null | bigint

    Total difficulty or null if no set

hardforkTimestamp

  • hardforkTimestamp(_hardfork?: string): null | bigint
  • Parameters

    • optional_hardfork: string

    Returns null | bigint

hardforks

  • hardforks(): HardforkConfig[]
  • Returns the hardforks for current chain


    Returns HardforkConfig[]

    Array with arrays of hardforks

isActivatedEIP

  • isActivatedEIP(eip: number): boolean
  • Checks if an EIP is activated by either being included in the EIPs manually passed in with the CommonOpts.eips or in a hardfork currently being active

    Note: this method only works for EIPs being supported by the CommonOpts.eips constructor option


    Parameters

    • eip: number

    Returns boolean

isHardforkBlock

  • isHardforkBlock(_blockNumber: Numbers, _hardfork?: string): boolean
  • True if block number provided is the hardfork (given or set) change block

    @deprecated

    Parameters

    • _blockNumber: Numbers
    • optional_hardfork: string

    Returns boolean

    True if blockNumber is HF block

isNextHardforkBlock

  • isNextHardforkBlock(_blockNumber: Numbers, _hardfork?: string): boolean
  • True if block number provided is the hardfork change block following the hardfork given or set

    @deprecated

    Parameters

    • _blockNumber: Numbers
    • optional_hardfork: string

    Returns boolean

    True if blockNumber is HF block

networkId

  • networkId(): bigint
  • Returns the Id of current network


    Returns bigint

    network Id

nextHardforkBlock

  • nextHardforkBlock(_hardfork?: string): null | bigint
  • Returns the change block for the next hardfork after the hardfork provided or set

    @deprecated

    Parameters

    • optional_hardfork: string

    Returns null | bigint

    Block number or null if not available

nextHardforkBlockOrTimestamp

  • nextHardforkBlockOrTimestamp(_hardfork?: string): null | bigint
  • Returns the change block for the next hardfork after the hardfork provided or set


    Parameters

    • optional_hardfork: string

    Returns null | bigint

    Block timestamp, number or null if not available

param

  • param(topic: string, name: string): bigint
  • Returns a parameter for the current chain setup

    If the parameter is present in an EIP, the EIP always takes precedence. Otherwise the parameter if taken from the latest applied HF with a change on the respective parameter.


    Parameters

    • topic: string

      Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow')

    • name: string

      Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic)

    Returns bigint

    The value requested or BigInt(0) if not found

paramByBlock

  • paramByBlock(topic: string, name: string, blockNumber: Numbers, td?: Numbers, timestamp?: Numbers): bigint
  • Returns a parameter for the hardfork active on block number or optional provided total difficulty (Merge HF)


    Parameters

    • topic: string

      Parameter topic

    • name: string

      Parameter name

    • blockNumber: Numbers

      Block number

    • optionaltd: Numbers

      Total difficulty *

    • optionaltimestamp: Numbers

    Returns bigint

    The value requested or BigInt(0) if not found

paramByEIP

  • paramByEIP(topic: string, name: string, eip: number): undefined | bigint
  • Returns a parameter corresponding to an EIP


    Parameters

    • topic: string

      Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow')

    • name: string

      Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic)

    • eip: number

      Number of the EIP

    Returns undefined | bigint

    The value requested or undefined if not found

paramByHardfork

  • paramByHardfork(topic: string, name: string, hardfork: string): bigint
  • Returns the parameter corresponding to a hardfork


    Parameters

    • topic: string

      Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow')

    • name: string

      Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic)

    • hardfork: string

      Hardfork name

    Returns bigint

    The value requested or BigInt(0) if not found

setChain

  • setChain(chain: string | number | bigint | object): ChainConfig
  • Sets the chain


    Parameters

    • chain: string | number | bigint | object

      String ('mainnet') or Number (1) chain representation. Or, a Dictionary of chain parameters for a private network.

    Returns ChainConfig

    The dictionary with parameters set as chain

setEIPs

  • setEIPs(eips?: number[]): void
  • Sets the active EIPs


    Parameters

    • optionaleips: number[]

    Returns void

setForkHashes

  • setForkHashes(genesisHash: Uint8Array): void
  • Sets any missing forkHashes on the passed-in Common instance


    Parameters

    • genesisHash: Uint8Array

      The genesis block hash

    Returns void

setHardfork

  • setHardfork(hardfork: string): void
  • Sets the hardfork to get params for


    Parameters

    • hardfork: string

      String identifier (e.g. 'byzantium') or Hardfork enum

    Returns void

setHardforkByBlockNumber

  • Sets a new hardfork based on the block number or an optional total difficulty (Merge HF) provided.

    An optional TD takes precedence in case the corresponding HF block is set to null or otherwise needs to match (if not an error will be thrown).


    Parameters

    Returns string

    The name of the HF set

setMaxListeners

  • setMaxListeners(maxListeners: number): this
  • Parameters

    • maxListeners: number

    Returns this

static_getInitializedChains

  • _getInitializedChains(customChains?: ChainConfig[]): ChainsConfig
  • Parameters

    • optionalcustomChains: ChainConfig[]

    Returns ChainsConfig

staticcustom

  • custom(chainParamsOrName: Partial<ChainConfig> | CustomChain, opts?: CustomCommonOpts): Common
  • Creates a Common object for a custom chain, based on a standard one.

    It uses all the Chain parameters from the baseChain option except the ones overridden in a provided chainParamsOrName dictionary. Some usage example:

    Common.custom({chainId: 123})

    There are also selected supported custom chains which can be initialized by using one of the CustomChains for chainParamsOrName, e.g.:

    Common.custom(CustomChains.MaticMumbai)

    Note that these supported custom chains only provide some base parameters (usually the chain and network ID and a name) and can only be used for selected use cases (e.g. sending a tx with the web3-utils/tx library to a Layer-2 chain).


    Parameters

    • chainParamsOrName: Partial<ChainConfig> | CustomChain

      Custom parameter dict (name will default to custom-chain) or string with name of a supported custom chain

    • optionalopts: CustomCommonOpts

      Custom chain options to set the CustomCommonOpts.baseChain, selected CustomCommonOpts.hardfork and others

    Returns Common

staticfromGethGenesis

  • fromGethGenesis(genesisJson: any, to: GethConfigOpts): Common
  • Static method to load and set common from a geth genesis json


    Parameters

    • genesisJson: any

      json of geth configuration

    • to: GethConfigOpts

      further configure the common instance

    Returns Common

    Common

staticisSupportedChainId

  • isSupportedChainId(chainId: bigint): boolean
  • Static method to determine if a chainId is supported as a standard chain


    Parameters

    • chainId: bigint

      bigint id (1) of a standard chain

    Returns boolean

    boolean

FeeMarketEIP1559Transaction

FeeMarketEIP1559Transaction:

Typed transaction with a new gas fee market mechanism

constructor

  • new FeeMarketEIP1559Transaction(txData: FeeMarketEIP1559TxData, opts?: TxOptions): FeeMarketEIP1559Transaction
  • This constructor takes the values, validates them, assigns them and freezes the object.

    It is not recommended to use this constructor directly. Instead use the static factory methods to assist in creating a Transaction object from varying data types.


    Parameters

    • txData: FeeMarketEIP1559TxData
    • optionalopts: TxOptions

    Returns FeeMarketEIP1559Transaction

readonlyAccessListJSON

AccessListJSON: AccessList

readonlyaccessList

accessList: AccessListUint8Array

readonlychainId

chainId: bigint

readonlycommon

common: Common

readonlydata

data: Uint8Array

readonlygasLimit

gasLimit: bigint

readonlymaxFeePerGas

maxFeePerGas: bigint

readonlymaxPriorityFeePerGas

maxPriorityFeePerGas: bigint

readonlynonce

nonce: bigint

optionalreadonlyr

r?: bigint

optionalreadonlys

s?: bigint

optionalreadonlyto

to?: Address

optionalreadonlyv

v?: bigint

readonlyvalue

value: bigint

type

  • get type(): number
  • Returns the transaction type.

    Note: legacy txs will return tx type 0.


    Returns number

_processSignature

  • _processSignature(v: bigint, r: Uint8Array, s: Uint8Array): FeeMarketEIP1559Transaction
  • Parameters

    • v: bigint
    • r: Uint8Array
    • s: Uint8Array

    Returns FeeMarketEIP1559Transaction

errorStr

  • errorStr(): string
  • Return a compact error string representation of the object


    Returns string

getBaseFee

  • getBaseFee(): bigint
  • The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)


    Returns bigint

getDataFee

  • getDataFee(): bigint
  • The amount of gas paid for the data in this tx


    Returns bigint

getMessageToSign

  • getMessageToSign(hashMessage?: boolean): Uint8Array
  • Returns the serialized unsigned tx (hashed or raw), which can be used to sign the transaction (e.g. for sending to a hardware wallet).

    Note: in contrast to the legacy tx the raw message format is already serialized and doesn't need to be RLP encoded any more.

    const serializedMessage = tx.getMessageToSign(false) // use this for the HW wallet input

    Parameters

    • optionalhashMessage: boolean

      Return hashed message if set to true (default: true)

    Returns Uint8Array

getMessageToVerifySignature

  • getMessageToVerifySignature(): Uint8Array
  • Computes a sha3-256 hash which can be used to verify the signature


    Returns Uint8Array

getSenderAddress

  • getSenderAddress(): Address
  • Returns the sender's address


    Returns Address

getSenderPublicKey

  • getSenderPublicKey(): Uint8Array
  • Returns the public key of the sender


    Returns Uint8Array

getUpfrontCost

  • getUpfrontCost(baseFee?: bigint): bigint
  • The up front amount that an account must have for this transaction to be valid


    Parameters

    • optionalbaseFee: bigint

      The base fee of the block (will be set to 0 if not provided)

    Returns bigint

hash

  • hash(): Uint8Array
  • Computes a sha3-256 hash of the serialized tx.

    This method can only be used for signed txs (it throws otherwise). Use FeeMarketEIP1559Transaction.getMessageToSign to get a tx hash for the purpose of signing.


    Returns Uint8Array

isSigned

  • isSigned(): boolean
  • Returns boolean

raw

  • raw(): FeeMarketEIP1559ValuesArray
  • Returns a Uint8Array Array of the raw Uint8Arrays of the EIP-1559 transaction, in order.

    Format:

    [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data,
    accessList, signatureYParity, signatureR, signatureS]

    Use FeeMarketEIP1559Transaction.serialize to add a transaction to a block with Block.fromValuesArray.

    For an unsigned tx this method uses the empty Uint8Array values for the signature parameters v, r and s for encoding. For an EIP-155 compliant representation for external signing use FeeMarketEIP1559Transaction.getMessageToSign.


    Returns FeeMarketEIP1559ValuesArray

serialize

  • serialize(): Uint8Array
  • Returns the serialized encoding of the EIP-1559 transaction.

    Format:

    0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data,
    accessList, signatureYParity, signatureR, signatureS])

    Note that in contrast to the legacy tx serialization format this is not valid RLP any more due to the raw tx type preceding and concatenated to the RLP encoding of the values.


    Returns Uint8Array

sign

  • sign(privateKey: Uint8Array): FeeMarketEIP1559Transaction
  • Signs a transaction.

    Note that the signed tx is returned as a new object, use as follows:

    const signedTx = tx.sign(privateKey)

    Parameters

    • privateKey: Uint8Array

    Returns FeeMarketEIP1559Transaction

supports

  • supports(capability: Capability): boolean
  • Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.

    Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.

    This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).

    See Capabilites in the types module for a reference on all supported capabilities.


    Parameters

    • capability: Capability

    Returns boolean

toCreationAddress

  • toCreationAddress(): boolean
  • If the tx's to is to the creation address


    Returns boolean

toJSON

  • toJSON(): JsonTx
  • Returns an object with the JSON representation of the transaction


    Returns JsonTx

validate

  • validate(): boolean
  • validate(stringError: false): boolean
  • validate(stringError: true): string[]
  • Checks if the transaction has the minimum amount of gas required (DataFee + TxFee + Creation Fee).


    Returns boolean

verifySignature

  • verifySignature(): boolean
  • Determines if the signature is valid


    Returns boolean

staticfromSerializedTx

  • fromSerializedTx(serialized: Uint8Array, opts?: TxOptions): FeeMarketEIP1559Transaction
  • Instantiate a transaction from the serialized tx.

    Format:

    0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data,
    accessList, signatureYParity, signatureR, signatureS])


    Parameters

    • serialized: Uint8Array
    • optionalopts: TxOptions

    Returns FeeMarketEIP1559Transaction

staticfromTxData

  • fromTxData(txData: FeeMarketEIP1559TxData, opts?: TxOptions): FeeMarketEIP1559Transaction
  • Instantiate a transaction from a data dictionary.

    Format: { chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, v, r, s }

    Notes:

    • chainId will be set automatically if not provided
    • All parameters are optional and have some basic default values

    Parameters

    • txData: FeeMarketEIP1559TxData
    • optionalopts: TxOptions

    Returns FeeMarketEIP1559Transaction

staticfromValuesArray

  • fromValuesArray(values: FeeMarketEIP1559ValuesArray, opts?: TxOptions): FeeMarketEIP1559Transaction
  • Create a transaction from a values array.

    Format:

    [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data,
    accessList, signatureYParity, signatureR, signatureS]


    Parameters

    • values: FeeMarketEIP1559ValuesArray
    • optionalopts: TxOptions

    Returns FeeMarketEIP1559Transaction

Transaction

Transaction:

An Ethereum non-typed (legacy) transaction

constructor

  • new Transaction(txData: TxData, opts?: TxOptions): Transaction
  • This constructor takes the values, validates them, assigns them and freezes the object.

    It is not recommended to use this constructor directly. Instead use the static factory methods to assist in creating a Transaction object from varying data types.


    Parameters

    • txData: TxData
    • optionalopts: TxOptions

    Returns Transaction

readonlycommon

common: Common

readonlydata

data: Uint8Array

readonlygasLimit

gasLimit: bigint

readonlygasPrice

gasPrice: bigint

readonlynonce

nonce: bigint

optionalreadonlyr

r?: bigint

optionalreadonlys

s?: bigint

optionalreadonlyto

to?: Address

optionalreadonlyv

v?: bigint

readonlyvalue

value: bigint

type

  • get type(): number
  • Returns the transaction type.

    Note: legacy txs will return tx type 0.


    Returns number

errorStr

  • errorStr(): string
  • Return a compact error string representation of the object


    Returns string

getBaseFee

  • getBaseFee(): bigint
  • The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)


    Returns bigint

getDataFee

  • getDataFee(): bigint
  • The amount of gas paid for the data in this tx


    Returns bigint

getMessageToSign

  • getMessageToSign(hashMessage: false): Uint8Array[]
  • getMessageToSign(hashMessage?: true): Uint8Array
  • Returns the unsigned tx (hashed or raw), which can be used to sign the transaction (e.g. for sending to a hardware wallet).

    Note: the raw message message format for the legacy tx is not RLP encoded and you might need to do yourself with:

    import { bufArrToArr } from '../util'
    import { RLP } from '../rlp'
    const message = tx.getMessageToSign(false)
    const serializedMessage = RLP.encode(message) // use this for the HW wallet input

    Parameters

    • hashMessage: false

      Return hashed message if set to true (default: true)

    Returns Uint8Array[]

getMessageToVerifySignature

  • getMessageToVerifySignature(): Uint8Array
  • Computes a sha3-256 hash which can be used to verify the signature


    Returns Uint8Array

getSenderAddress

  • getSenderAddress(): Address
  • Returns the sender's address


    Returns Address

getSenderPublicKey

  • getSenderPublicKey(): Uint8Array
  • Returns the public key of the sender


    Returns Uint8Array

getUpfrontCost

  • getUpfrontCost(): bigint
  • The up front amount that an account must have for this transaction to be valid


    Returns bigint

hash

  • hash(): Uint8Array
  • Computes a sha3-256 hash of the serialized tx.

    This method can only be used for signed txs (it throws otherwise). Use Transaction.getMessageToSign to get a tx hash for the purpose of signing.


    Returns Uint8Array

isSigned

  • isSigned(): boolean
  • Returns boolean

raw

  • raw(): TxValuesArray
  • Returns a Uint8Array Array of the raw Uint8Arrays of the legacy transaction, in order.

    Format: [nonce, gasPrice, gasLimit, to, value, data, v, r, s]

    For legacy txs this is also the correct format to add transactions to a block with Block.fromValuesArray (use the serialize() method for typed txs).

    For an unsigned tx this method returns the empty Uint8Array values for the signature parameters v, r and s. For an EIP-155 compliant representation have a look at Transaction.getMessageToSign.


    Returns TxValuesArray

serialize

  • serialize(): Uint8Array
  • Returns the serialized encoding of the legacy transaction.

    Format: rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])

    For an unsigned tx this method uses the empty Uint8Array values for the signature parameters v, r and s for encoding. For an EIP-155 compliant representation for external signing use Transaction.getMessageToSign.


    Returns Uint8Array

sign

  • sign(privateKey: Uint8Array): Transaction
  • Signs a transaction.

    Note that the signed tx is returned as a new object, use as follows:

    const signedTx = tx.sign(privateKey)

    Parameters

    • privateKey: Uint8Array

    Returns Transaction

supports

  • supports(capability: Capability): boolean
  • Checks if a tx type defining capability is active on a tx, for example the EIP-1559 fee market mechanism or the EIP-2930 access list feature.

    Note that this is different from the tx type itself, so EIP-2930 access lists can very well be active on an EIP-1559 tx for example.

    This method can be useful for feature checks if the tx type is unknown (e.g. when instantiated with the tx factory).

    See Capabilites in the types module for a reference on all supported capabilities.


    Parameters

    • capability: Capability

    Returns boolean

toCreationAddress

  • toCreationAddress(): boolean
  • If the tx's to is to the creation address


    Returns boolean

toJSON

  • toJSON(): JsonTx
  • Returns an object with the JSON representation of the transaction.


    Returns JsonTx

validate

  • validate(): boolean
  • validate(stringError: false): boolean
  • validate(stringError: true): string[]
  • Checks if the transaction has the minimum amount of gas required (DataFee + TxFee + Creation Fee).


    Returns boolean

verifySignature

  • verifySignature(): boolean
  • Determines if the signature is valid


    Returns boolean

staticfromSerializedTx

  • fromSerializedTx(serialized: Uint8Array, opts?: TxOptions): Transaction
  • Instantiate a transaction from the serialized tx.

    Format: rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])


    Parameters

    • serialized: Uint8Array
    • optionalopts: TxOptions

    Returns Transaction

staticfromTxData

  • fromTxData(txData: TxData, opts?: TxOptions): Transaction
  • Instantiate a transaction from a data dictionary.

    Format: { nonce, gasPrice, gasLimit, to, value, data, v, r, s }

    Notes:

    • All parameters are optional and have some basic default values

    Parameters

    • txData: TxData
    • optionalopts: TxOptions

    Returns Transaction

staticfromValuesArray

  • fromValuesArray(values: TxValuesArray, opts?: TxOptions): Transaction
  • Create a transaction from a values array.

    Format: [nonce, gasPrice, gasLimit, to, value, data, v, r, s]


    Parameters

    • values: TxValuesArray
    • optionalopts: TxOptions

    Returns Transaction

TransactionFactory

TransactionFactory:

staticfromBlockBodyData

  • fromBlockBodyData(data: Uint8Array | Uint8Array[], txOptions?: TxOptions): TypedTransaction
  • When decoding a BlockBody, in the transactions field, a field is either: A Uint8Array (a TypedTransaction - encoded as TransactionType || rlp(TransactionPayload)) A Uint8Array[] (Legacy Transaction) This method returns the right transaction.


    Parameters

    • data: Uint8Array | Uint8Array[]

      A Uint8Array or Uint8Array[]

    • optionaltxOptions: TxOptions

      The transaction options

    Returns TypedTransaction

staticfromSerializedData

  • fromSerializedData(data: Uint8Array, txOptions?: TxOptions): TypedTransaction
  • This method tries to decode serialized data.


    Parameters

    • data: Uint8Array

      The data Uint8Array

    • optionaltxOptions: TxOptions

      The transaction options

    Returns TypedTransaction

staticfromTxData

  • fromTxData(txData: TxData | TypedTransaction, txOptions?: TxOptions): TypedTransaction
  • Create a transaction from a txData object


    Parameters

    • txData: TxData | TypedTransaction

      The transaction data. The type field will determine which transaction type is returned (if undefined, creates a legacy transaction)

    • optionaltxOptions: TxOptions

      Options to pass on to the constructor of the transaction

    Returns TypedTransaction

staticregisterTransactionType

  • registerTransactionType<NewTxTypeClass>(type: Numbers, txClass: NewTxTypeClass): void
  • Type parameters

    • NewTxTypeClass: { prototype: BaseTransaction<any>; fromSerializedTx: any; fromTxData: any }

    Parameters

    • type: Numbers
    • txClass: NewTxTypeClass

    Returns void

statictypeToInt

  • Parameters

    Returns number

Wallet

Wallet<T>:

Wallet is an in memory wallet that can hold multiple accounts. These accounts can be used when using web3.eth.sendTransaction() or web3.eth.contract.methods.contractfunction().send();

For using Wallet functionality, install Web3 package using npm i web3 or yarn add web3. After that, Wallet functionality will be available as mentioned below.

import { Web3 } from 'web3';
const web3 = new Web3('http://127.0.0.1:7545');

const wallet = await web3.eth.accounts.wallet.create(2);

const signature = wallet.at(0).sign("Test Data"); // use wallet

// fund account before sending following transaction ...

const receipt = await web3.eth.sendTransaction({ // internally sign transaction using wallet
from: wallet.at(0).address,
to: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
value: 1
//....
});

constructor

add

  • add(account: string | T): this
  • Adds an account using a private key or account object to the wallet.


    Parameters

    • account: string | T

      A private key or account object

    Returns this

    The wallet

    web3.eth.accounts.wallet.add('0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387');
    > Wallet(1) [
    {
    address: '0x85D70633b90e03e0276B98880286D0D055685ed7',
    privateKey: '0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [Function: encrypt]
    },
    _accountProvider: {
    create: [Function: create],
    privateKeyToAccount: [Function: privateKeyToAccount],
    decrypt: [Function: decrypt]
    },
    _addressMap: Map(1) { '0x85d70633b90e03e0276b98880286d0d055685ed7' => 0 },
    _defaultKeyName: 'web3js_wallet'
    ]

clear

  • clear(): this
  • Securely empties the wallet and removes all its accounts. Use this with *caution as it will remove all accounts stored in local wallet.


    Returns this

    The wallet object


    web3.eth.accounts.wallet.clear();
    > Wallet(0) [
    _accountProvider: {
    create: [Function: create],
    privateKeyToAccount: [Function: privateKeyToAccount],
    decrypt: [Function: decrypt]
    },
    _addressMap: Map(0) {},
    _defaultKeyName: 'web3js_wallet'
    ]

create

  • create(numberOfAccounts: number): this
  • Generates one or more accounts in the wallet. If wallets already exist they will not be overridden.


    Parameters

    • numberOfAccounts: number

      Number of accounts to create. Leave empty to create an empty wallet.

    Returns this

    The wallet

    web3.eth.accounts.wallet.create(2)
    > Wallet(2) [
    {
    address: '0xde38310a42B751AE57d30cFFF4a0A3c52A442fCE',
    privateKey: '0x6422c9d28efdcbee93c1d32a5fc6fd6fa081b985487885296cf8c9bbb5872600',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [Function: encrypt]
    },
    {
    address: '0x766BF755246d924B1d017Fdb5390f38a60166691',
    privateKey: '0x756530f13c0eb636ebdda655335f5dea9921e3362e2e588b0ad59e556f7751f0',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [Function: encrypt]
    },
    _accountProvider: {
    create: [Function: create],
    privateKeyToAccount: [Function: privateKeyToAccount],
    decrypt: [Function: decrypt]
    },
    _addressMap: Map(2) {
    '0xde38310a42b751ae57d30cfff4a0a3c52a442fce' => 0,
    '0x766bf755246d924b1d017fdb5390f38a60166691' => 1
    },
    _defaultKeyName: 'web3js_wallet'
    ]

decrypt

  • decrypt(encryptedWallets: KeyStore[], password: string, options?: Record<string, unknown>): Promise<Wallet<T>>
  • Decrypts keystore v3 objects.


    Parameters

    • encryptedWallets: KeyStore[]

      An array of encrypted keystore v3 objects to decrypt

    • password: string

      The password to encrypt with

    • optionaloptions: Record<string, unknown>

      decrypt options for the wallets

    Returns Promise<Wallet<T>>

    The decrypted wallet object

    web3.eth.accounts.wallet.decrypt([
    { version: 3,
    id: '83191a81-aaca-451f-b63d-0c5f3b849289',
    address: '06f702337909c06c82b09b7a22f0a2f0855d1f68',
    crypto:
    { ciphertext: '7d34deae112841fba86e3e6cf08f5398dda323a8e4d29332621534e2c4069e8d',
    cipherparams: { iv: '497f4d26997a84d570778eae874b2333' },
    cipher: 'aes-128-ctr',
    kdf: 'scrypt',
    kdfparams:
    { dklen: 32,
    salt: '208dd732a27aa4803bb760228dff18515d5313fd085bbce60594a3919ae2d88d',
    n: 262144,
    r: 8,
    p: 1 },
    mac: '0062a853de302513c57bfe3108ab493733034bf3cb313326f42cf26ea2619cf9' } },
    { version: 3,
    id: '7d6b91fa-3611-407b-b16b-396efb28f97e',
    address: 'b5d89661b59a9af0b34f58d19138baa2de48baaf',
    crypto:
    { ciphertext: 'cb9712d1982ff89f571fa5dbef447f14b7e5f142232bd2a913aac833730eeb43',
    cipherparams: { iv: '8cccb91cb84e435437f7282ec2ffd2db' },
    cipher: 'aes-128-ctr',
    kdf: 'scrypt',
    kdfparams:
    { dklen: 32,
    salt: '08ba6736363c5586434cd5b895e6fe41ea7db4785bd9b901dedce77a1514e8b8',
    n: 262144,
    r: 8,
    p: 1 },
    mac: 'd2eb068b37e2df55f56fa97a2bf4f55e072bef0dd703bfd917717d9dc54510f0' } }
    ], 'test').then(console.log)
    > Wallet {
    _accountProvider: {
    create: [Function: create],
    privateKeyToAccount: [Function: privateKeyToAccount],
    decrypt: [Function: decrypt]
    },
    _defaultKeyName: 'web3js_wallet',
    _accounts: {
    '0x85d70633b90e03e0276b98880286d0d055685ed7': {
    address: '0x85D70633b90e03e0276B98880286D0D055685ed7',
    privateKey: '0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [Function: encrypt]
    },
    '0x06f702337909c06c82b09b7a22f0a2f0855d1f68': {
    address: '0x06F702337909C06C82B09B7A22F0a2f0855d1F68',
    privateKey: '87a51da18900da7398b3bab03996833138f269f8f66dd1237b98df6b9ce14573',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [Function: encrypt]
    },
    '0xb5d89661b59a9af0b34f58d19138baa2de48baaf': {
    address: '0xB5d89661B59a9aF0b34f58D19138bAa2de48BAaf',
    privateKey: '7ee61c5282979aae9dd795bb6a54e8bdc2bfe009acb64eb9a67322eec3b3da6e',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [Function: encrypt]
    }
    }
    }

encrypt

  • encrypt(password: string, options?: Record<string, unknown>): Promise<KeyStore[]>
  • Encrypts all wallet accounts to an array of encrypted keystore v3 objects.


    Parameters

    • password: string

      The password which will be used for encryption

    • optionaloptions: Record<string, unknown>

      encryption options

    Returns Promise<KeyStore[]>

    An array of the encrypted keystore v3.

    web3.eth.accounts.wallet.create(1)
    web3.eth.accounts.wallet.encrypt("abc").then(console.log);
    > [
    '{"version":3,"id":"fa46e213-a7c3-4844-b903-dd14d39cc7db",
    "address":"fa3e41a401609103c241431cbdee8623ae2a321a","crypto":
    {"ciphertext":"8d179a911d6146ad2924e86bf493ed89b8ff3596ffec0816e761c542016ab13c",
    "cipherparams":{"iv":"acc888c6cf4a19b86846cef0185a7164"},"cipher":"aes-128-ctr",
    "kdf":"scrypt","kdfparams":{"n":8192,"r":8,"p":1,"dklen":32,"salt":"6a743c9b367d15f4758e4f3f3378ff0fd443708d1c64854e07588ea5331823ae"},
    "mac":"410544c8307e3691fda305eb3722d82c3431f212a87daa119a21587d96698b57"}}'
    ]

get

  • get(addressOrIndex: string | number): undefined | T
  • Get the account of the wallet with either the index or public address.


    Parameters

    • addressOrIndex: string | number

      A string of the address or number index within the wallet.

    Returns undefined | T

    The account object or undefined if the account doesn't exist

load

  • load(password: string, keyName?: string): Promise<Wallet<T>>
  • Loads a wallet from local storage and decrypts it. NOTE: Browser only


    Parameters

    • password: string

      The password to decrypt the wallet.

    • optionalkeyName: string

      (optional)The key used for local storage position, defaults to web3js_wallet"

    Returns Promise<Wallet<T>>

    Returns the wallet object

    web3.eth.accounts.wallet.save('test#!$');
    > true
    web3.eth.accounts.wallet.load('test#!$');
    { defaultKeyName: "web3js_wallet",
    length: 0,
    _accounts: Accounts {_requestManager: RequestManager, givenProvider: Proxy, providers: {}, _provider: WebsocketProvider,},
    [[Prototype]]: Object
    }

remove

  • remove(addressOrIndex: string | number): boolean
  • Removes an account from the wallet.


    Parameters

    • addressOrIndex: string | number

      The account address, or index in the wallet.

    Returns boolean

    true if the wallet was removed. false if it couldn't be found.

    web3.eth.accounts.wallet.add('0xbce9b59981303e76c4878b1a6d7b088ec6b9dd5c966b7d5f54d7a749ff683387');

    web3.eth.accounts.wallet.remove('0x85D70633b90e03e0276B98880286D0D055685ed7');
    > true
    web3.eth.accounts.wallet
    > Wallet(0) [
    _accountProvider: {
    create: [Function: create],
    privateKeyToAccount: [Function: privateKeyToAccount],
    decrypt: [Function: decrypt]
    },
    _addressMap: Map(0) {},
    _defaultKeyName: 'web3js_wallet'
    ]

save

  • save(password: string, keyName?: string): Promise<boolean>
  • Stores the wallet encrypted and as string in local storage. NOTE: Browser only


    Parameters

    • password: string

      The password to encrypt the wallet

    • optionalkeyName: string

      (optional) The key used for the local storage position, defaults to "web3js_wallet".

    Returns Promise<boolean>

    Will return boolean value true if saved properly

    web3.eth.accounts.wallet.save('test#!$');
    >true

staticgetStorage

  • getStorage(): undefined | WebStorage
  • Get the storage object of the browser


    Returns undefined | WebStorage

    the storage

AccessListEIP2930TxData

AccessListEIP2930TxData:

AccessListEIP2930Transaction data.

optionalaccessList

accessList?: null | AccessListUint8Array | AccessList

The access list which contains the addresses/storage slots which the transaction wishes to access

optionalchainId

chainId?: Numbers

The transaction's chain ID

optionaldata

data?: Uint8ArrayLike

This will contain the data of the message or the init of a contract.

optionalgasLimit

gasLimit?: Uint8Array | Numbers

The transaction's gas limit.

optionalgasPrice

gasPrice?: null | Uint8Array | Numbers

The transaction's gas price.

optionalnonce

nonce?: Uint8Array | Numbers

The transaction's nonce.

optionalr

r?: Uint8Array | Numbers

EC signature parameter.

optionals

s?: Uint8Array | Numbers

EC signature parameter.

optionalto

to?: string | Uint8Array | Address

The transaction's the address is sent to.

optionaltype

type?: Numbers

The transaction type

optionalv

v?: Uint8Array | Numbers

EC recovery ID.

optionalvalue

value?: Uint8Array | Numbers

The amount of Ether sent.

BootstrapNodeConfig

BootstrapNodeConfig:

optionalchainId

chainId?: number

comment

comment: string

id

id: string

ip

ip: string

location

location: string

optionalnetwork

network?: string

port

port: string | number

ChainConfig

ChainConfig:

optionalbootstrapNodes

bootstrapNodes?: BootstrapNodeConfig[]

chainId

chainId: number | bigint

optionalcomment

comment?: string

consensus

consensus: { algorithm: string; casper?: CasperConfig; clique?: CliqueConfig; ethash?: EthashConfig; type: string }

Type declaration

  • algorithm: string
  • optionalcasper?: CasperConfig
  • optionalclique?: CliqueConfig
  • optionalethash?: EthashConfig
  • type: string

optionaldefaultHardfork

defaultHardfork?: string

optionaldnsNetworks

dnsNetworks?: string[]

genesis

genesis: GenesisBlockConfig

hardforks

hardforks: HardforkConfig[]

name

name: string

networkId

networkId: number | bigint

optionalurl

url?: string

ChainName

ChainName:

ChainsConfig

ChainsConfig:

CommonOpts

CommonOpts:

Options for instantiating a Common instance.

chain

chain: string | number | bigint | object

Chain name ('mainnet'), id (1), or Chain enum, either from a chain directly supported or a custom chain passed in via CommonOpts.customChains.

optionalcustomChains

customChains?: ChainConfig[]

Initialize (in addition to the supported chains) with the selected custom chains. Custom genesis state should be passed to the Blockchain class if used.

Usage (directly with the respective chain initialization via the CommonOpts.chain option):

import myCustomChain1 from '[PATH_TO_MY_CHAINS]/myCustomChain1.json'
const common = new Common({ chain: 'myCustomChain1', customChains: [ myCustomChain1 ]})

optionaleips

eips?: number[]

Selected EIPs which can be activated, please use an array for instantiation (e.g. eips: [ 2537, ])

Currently supported:

optionalhardfork

hardfork?: string

String identifier ('byzantium') for hardfork or Hardfork enum.

Default: Hardfork.London

CustomCommonOpts

CustomCommonOpts:

Options to be used with the Common.custom static constructor.

optionalbaseChain

baseChain?: string | number | bigint

The name (mainnet), id (1), or Chain enum of a standard chain used to base the custom chain params on.

optionaleips

eips?: number[]

Selected EIPs which can be activated, please use an array for instantiation (e.g. eips: [ 2537, ])

Currently supported:

optionalhardfork

hardfork?: string

String identifier ('byzantium') for hardfork or Hardfork enum.

Default: Hardfork.London

ECDSASignature

ECDSASignature:

r

r: Uint8Array

s

s: Uint8Array

v

v: bigint

FeeMarketEIP1559TxData

FeeMarketEIP1559TxData:

FeeMarketEIP1559Transaction data.

optionalaccessList

accessList?: null | AccessListUint8Array | AccessList

The access list which contains the addresses/storage slots which the transaction wishes to access

optionalchainId

chainId?: Numbers

The transaction's chain ID

optionaldata

data?: Uint8ArrayLike

This will contain the data of the message or the init of a contract.

optionalgasLimit

gasLimit?: Uint8Array | Numbers

The transaction's gas limit.

optionalgasPrice

gasPrice?: null

The transaction's gas price, inherited from Transaction. This property is not used for EIP1559 transactions and should always be undefined for this specific transaction type.

optionalmaxFeePerGas

maxFeePerGas?: Uint8Array | Numbers

The maximum total fee

optionalmaxPriorityFeePerGas

maxPriorityFeePerGas?: Uint8Array | Numbers

The maximum inclusion fee per gas (this fee is given to the miner)

optionalnonce

nonce?: Uint8Array | Numbers

The transaction's nonce.

optionalr

r?: Uint8Array | Numbers

EC signature parameter.

optionals

s?: Uint8Array | Numbers

EC signature parameter.

optionalto

to?: string | Uint8Array | Address

The transaction's the address is sent to.

optionaltype

type?: Numbers

The transaction type

optionalv

v?: Uint8Array | Numbers

EC recovery ID.

optionalvalue

value?: Uint8Array | Numbers

The amount of Ether sent.

GenesisBlockConfig

GenesisBlockConfig:

optionalbaseFeePerGas

baseFeePerGas?: string

difficulty

difficulty: number

extraData

extraData: string

gasLimit

gasLimit: number

nonce

nonce: string

optionaltimestamp

timestamp?: string

GethConfigOpts

GethConfigOpts:

optionalchain

chain?: string

optionaleips

eips?: number[]

Selected EIPs which can be activated, please use an array for instantiation (e.g. eips: [ 2537, ])

Currently supported:

optionalgenesisHash

genesisHash?: Uint8Array

optionalhardfork

hardfork?: string

String identifier ('byzantium') for hardfork or Hardfork enum.

Default: Hardfork.London

optionalmergeForkIdPostMerge

mergeForkIdPostMerge?: boolean

HardforkConfig

HardforkConfig:

block

block: null | number

optionalforkHash

forkHash?: null | string

name

name: string

optionaltimestamp

timestamp?: string | number

optionalttd

ttd?: string | bigint

JsonTx

JsonTx:

Generic interface for all tx types with a JSON representation of a transaction.

Note that all values are marked as optional and not all the values are present on all tx types (an EIP1559 tx e.g. lacks a gasPrice).

optionalaccessList

accessList?: JsonAccessListItem[]

optionalchainId

chainId?: string

optionaldata

data?: string

optionalgasLimit

gasLimit?: string

optionalgasPrice

gasPrice?: string

optionalmaxFeePerDataGas

maxFeePerDataGas?: string

optionalmaxFeePerGas

maxFeePerGas?: string

optionalmaxPriorityFeePerGas

maxPriorityFeePerGas?: string

optionalnonce

nonce?: string

optionalr

r?: string

optionals

s?: string

optionalto

to?: string

optionaltype

type?: string

optionalv

v?: string

optionalvalue

value?: string

optionalversionedHashes

versionedHashes?: string[]

TransformableToArray

TransformableToArray:

toArray

  • toArray(): Uint8Array
  • Returns Uint8Array

TxOptions

TxOptions:

The options for initializing a Transaction.

optionalallowUnlimitedInitCodeSize

allowUnlimitedInitCodeSize?: boolean

Allows unlimited contract code-size init while debugging. This (partially) disables EIP-3860. Gas cost for initcode size analysis will still be charged. Use with caution.

optionalcommon

common?: Common

A Common object defining the chain and hardfork for the transaction.

Object will be internally copied so that tx behavior don't incidentally change on future HF changes.

Default: Common object set to mainnet and the default hardfork as defined in the Common class.

Current default hardfork: istanbul

optionalfreeze

freeze?: boolean

A transaction object by default gets frozen along initialization. This gives you strong additional security guarantees on the consistency of the tx parameters. It also enables tx hash caching when the hash() method is called multiple times.

If you need to deactivate the tx freeze - e.g. because you want to subclass tx and add additional properties - it is strongly encouraged that you do the freeze yourself within your code instead.

Default: true

Web3Account

Web3Account:

address

address: string

readonlyencrypt

encrypt: (password: string, options?: Record<string, unknown>) => Promise<KeyStore>

Type declaration

    • (password: string, options?: Record<string, unknown>): Promise<KeyStore>
    • Parameters

      • password: string
      • optionaloptions: Record<string, unknown>

      Returns Promise<KeyStore>

privateKey

privateKey: string

readonlysign

sign: (data: string | Record<string, unknown>) => SignResult

Type declaration

    • (data: string | Record<string, unknown>): SignResult
    • Parameters

      • data: string | Record<string, unknown>

      Returns SignResult

readonlysignTransaction

signTransaction: (tx: Transaction) => Promise<SignTransactionResult>

Type declaration

    • Parameters

      Returns Promise<SignTransactionResult>

WebStorage

WebStorage:

This Web Storage API interface provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items.

readonlylength

length: number

Returns the number of key/value pairs.

clear

  • clear(): void
  • Removes all key/value pairs, if there are any.

    Dispatches a storage event on Window objects holding an equivalent Storage object.


    Returns void

getItem

  • getItem(key: string): null | string
  • Returns the current value associated with the given key, or null if the given key does not exist.


    Parameters

    • key: string

    Returns null | string

key

  • key(index: number): null | string
  • Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.


    Parameters

    • index: number

    Returns null | string

removeItem

  • removeItem(key: string): void
  • Removes the key/value pair with the given key, if a key/value pair with the given key exists.

    Dispatches a storage event on Window objects holding an equivalent Storage object.


    Parameters

    • key: string

    Returns void

setItem

  • setItem(key: string, value: string): void
  • Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.

    Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)

    Dispatches a storage event on Window objects holding an equivalent Storage object.


    Parameters

    • key: string
    • value: string

    Returns void

AccessList

AccessList: AccessListItem[]

AccessListEIP2930ValuesArray

AccessListEIP2930ValuesArray: [Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, AccessListUint8Array, Uint8Array?, Uint8Array?, Uint8Array?]

Uint8Array values array for an AccessListEIP2930Transaction

AccessListItem

AccessListItem: { address: PrefixedHexString; storageKeys: PrefixedHexString[] }

Type declaration

  • address: PrefixedHexString
  • storageKeys: PrefixedHexString[]

AccessListUint8Array

AccessListUint8Array: AccessListUint8ArrayItem[]

AccessListUint8ArrayItem

AccessListUint8ArrayItem: [Uint8Array, Uint8Array[]]

BigIntLike

BigIntLike: bigint | PrefixedHexString | number | Uint8Array

CasperConfig

CasperConfig: Record<string, unknown>

CliqueConfig

CliqueConfig: { epoch: number; period: number }

Type declaration

  • epoch: number
  • period: number

EthashConfig

EthashConfig: Record<string, unknown>

FeeMarketEIP1559ValuesArray

FeeMarketEIP1559ValuesArray: [Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, Uint8Array, AccessListUint8Array, Uint8Array?, Uint8Array?, Uint8Array?]

Uint8Array values array for a FeeMarketEIP1559Transaction

NestedUint8Array

NestedUint8Array: (Uint8Array | NestedUint8Array)[]

PrefixedHexString

PrefixedHexString: string

SignResult

SignResult: SignatureObject & { message?: string; signature: string }

SignTransactionResult

SignTransactionResult: SignatureObject & { rawTransaction: string; transactionHash: string }

SignatureObject

SignatureObject: { messageHash: string; r: string; s: string; v: string }

Type declaration

  • messageHash: string
  • r: string
  • s: string
  • v: string

ToBytesInputTypes

ToBytesInputTypes: PrefixedHexString | number | bigint | Uint8Array | number[] | TransformableToArray | null | undefined

TxData

TxData: { data?: Uint8ArrayLike; gasLimit?: Numbers | Uint8Array; gasPrice?: Numbers | Uint8Array | null; nonce?: Numbers | Uint8Array; r?: Numbers | Uint8Array; s?: Numbers | Uint8Array; to?: Address | Uint8Array | HexString; type?: Numbers; v?: Numbers | Uint8Array; value?: Numbers | Uint8Array }

Legacy Transaction Data


Type declaration

  • optionaldata?: Uint8ArrayLike

    This will contain the data of the message or the init of a contract.

  • optionalgasLimit?: Numbers | Uint8Array

    The transaction's gas limit.

  • optionalgasPrice?: Numbers | Uint8Array | null

    The transaction's gas price.

  • optionalnonce?: Numbers | Uint8Array

    The transaction's nonce.

  • optionalr?: Numbers | Uint8Array

    EC signature parameter.

  • optionals?: Numbers | Uint8Array

    EC signature parameter.

  • optionalto?: Address | Uint8Array | HexString

    The transaction's the address is sent to.

  • optionaltype?: Numbers

    The transaction type

  • optionalv?: Numbers | Uint8Array

    EC recovery ID.

  • optionalvalue?: Numbers | Uint8Array

    The amount of Ether sent.

TxValuesArray

TxValuesArray: Uint8Array[]

Uint8Array values array for a legacy Transaction

TypeOutputReturnType

TypeOutputReturnType: { 0: number; 1: bigint; 2: Uint8Array; 3: PrefixedHexString }

Type declaration

  • 0: number
  • 1: bigint
  • 2: Uint8Array
  • 3: PrefixedHexString

TypedTransaction

TypedTransaction: Transaction | AccessListEIP2930Transaction | FeeMarketEIP1559Transaction

Uint8ArrayLike

Uint8ArrayLike: Uint8Array | number[] | number | bigint | PrefixedHexString

constkeyStoreSchema

keyStoreSchema: { properties: { address: { type: string }; crypto: { properties: { cipher: { type: string }; cipherparams: { type: string }; ciphertext: { type: string }; kdf: { type: string }; kdfparams: { type: string }; mac: { type: string }; salt: { type: string } }; required: string[]; type: string }; id: { type: string }; version: { type: string } }; required: string[]; type: string }

Type declaration

  • properties: { address: { type: string }; crypto: { properties: { cipher: { type: string }; cipherparams: { type: string }; ciphertext: { type: string }; kdf: { type: string }; kdfparams: { type: string }; mac: { type: string }; salt: { type: string } }; required: string[]; type: string }; id: { type: string }; version: { type: string } }
    • address: { type: string }
      • type: string
    • crypto: { properties: { cipher: { type: string }; cipherparams: { type: string }; ciphertext: { type: string }; kdf: { type: string }; kdfparams: { type: string }; mac: { type: string }; salt: { type: string } }; required: string[]; type: string }
      • properties: { cipher: { type: string }; cipherparams: { type: string }; ciphertext: { type: string }; kdf: { type: string }; kdfparams: { type: string }; mac: { type: string }; salt: { type: string } }
        • cipher: { type: string }
          • type: string
        • cipherparams: { type: string }
          • type: string
        • ciphertext: { type: string }
          • type: string
        • kdf: { type: string }
          • type: string
        • kdfparams: { type: string }
          • type: string
        • mac: { type: string }
          • type: string
        • salt: { type: string }
          • type: string
      • required: string[]
      • type: string
    • id: { type: string }
      • type: string
    • version: { type: string }
      • type: string
  • required: string[]
  • type: string

assertIsUint8Array

  • assertIsUint8Array(input: unknown): asserts input is Uint8Array
  • Throws if input is not a Uint8Array


    Parameters

    • input: unknown

      value to check

    Returns asserts input is Uint8Array

bigIntToHex

  • bigIntToHex(num: bigint): string
  • Converts a bigint to a 0x prefixed hex string


    Parameters

    • num: bigint

    Returns string

bigIntToUint8Array

  • bigIntToUint8Array(num: bigint): Uint8Array
  • Converts a bigint to a Uint8Array


    Parameters

    • num: bigint

    Returns Uint8Array

bigIntToUnpaddedUint8Array

  • bigIntToUnpaddedUint8Array(value: bigint): Uint8Array
  • Convert value from bigint to an unpadded Uint8Array (useful for RLP transport)


    Parameters

    • value: bigint

      value to convert

    Returns Uint8Array

create

  • create(): Web3Account
  • Generates and returns a Web3Account object that includes the private and public key For creation of private key, it uses an audited package ethereum-cryptography/secp256k1 that is cryptographically secure random number with certain characteristics. Read more: https://www.npmjs.com/package/ethereum-cryptography#secp256k1-curve


    Returns Web3Account

    A Web3Account object

    web3.eth.accounts.create();
    {
    address: '0xbD504f977021b5E5DdccD8741A368b147B3B38bB',
    privateKey: '0x964ced1c69ad27a311c432fdc0d8211e987595f7eb34ab405a5f16bdc9563ec5',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [AsyncFunction: encrypt]
    }

decrypt

  • decrypt(keystore: string | KeyStore, password: string | Uint8Array, nonStrict?: boolean): Promise<Web3Account>
  • Decrypts a v3 keystore JSON, and creates the account.


    Parameters

    • keystore: string | KeyStore

      the encrypted Keystore object or string to decrypt

    • password: string | Uint8Array

      The password that was used for encryption

    • optionalnonStrict: boolean

      if true and given a json string, the keystore will be parsed as lowercase.

    Returns Promise<Web3Account>

    Returns the decrypted Web3Account object Decrypting scrypt

    web3.eth.accounts.decrypt({
    version: 3,
    id: 'c0cb0a94-4702-4492-b6e6-eb2ac404344a',
    address: 'cda9a91875fc35c8ac1320e098e584495d66e47c',
    crypto: {
    ciphertext: 'cb3e13e3281ff3861a3f0257fad4c9a51b0eb046f9c7821825c46b210f040b8f',
    cipherparams: { iv: 'bfb43120ae00e9de110f8325143a2709' },
    cipher: 'aes-128-ctr',
    kdf: 'scrypt',
    kdfparams: {
    n: 8192,
    r: 8,
    p: 1,
    dklen: 32,
    salt: '210d0ec956787d865358ac45716e6dd42e68d48e346d795746509523aeb477dd'
    },
    mac: 'efbf6d3409f37c0084a79d5fdf9a6f5d97d11447517ef1ea8374f51e581b7efd'
    }
    }, '123').then(console.log);


    > {
    address: '0xcdA9A91875fc35c8Ac1320E098e584495d66e47c',
    privateKey: '67f476289210e3bef3c1c75e4de993ff0a00663df00def84e73aa7411eac18a6',
    signTransaction: [Function: signTransaction],
    sign: [Function: sign],
    encrypt: [AsyncFunction: encrypt]
    }

ecrecover

  • ecrecover(msgHash: Uint8Array, v: bigint, r: Uint8Array, s: Uint8Array, chainId?: bigint): Uint8Array
  • ECDSA public key recovery from signature. NOTE: Accepts v === 0 | v === 1 for EIP1559 transactions


    Parameters

    • msgHash: Uint8Array
    • v: bigint
    • r: Uint8Array
    • s: Uint8Array
    • optionalchainId: bigint

    Returns Uint8Array

    Recovered public key

encrypt

  • encrypt a private key with a password, returns a V3 JSON Keystore

    Read more: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition


    Parameters

    • privateKey: Bytes

      The private key to encrypt, 32 bytes.

    • password: string | Uint8Array

      The password used for encryption.

    • optionaloptions: CipherOptions

      Options to configure to encrypt the keystore either scrypt or pbkdf2

    Returns Promise<KeyStore>

    Returns a V3 JSON Keystore

    Encrypt using scrypt options:


    web3.eth.accounts.encrypt(
    '0x67f476289210e3bef3c1c75e4de993ff0a00663df00def84e73aa7411eac18a6',
    '123',
    {
    n: 8192,
    iv: web3.utils.hexToBytes('0xbfb43120ae00e9de110f8325143a2709'),
    salt: web3.utils.hexToBytes('0x210d0ec956787d865358ac45716e6dd42e68d48e346d795746509523aeb477dd'),
    }).then(console.log)

    > {
    version: 3,
    id: 'c0cb0a94-4702-4492-b6e6-eb2ac404344a',
    address: 'cda9a91875fc35c8ac1320e098e584495d66e47c',
    crypto: {
    ciphertext: 'cb3e13e3281ff3861a3f0257fad4c9a51b0eb046f9c7821825c46b210f040b8f',
    cipherparams: { iv: 'bfb43120ae00e9de110f8325143a2709' },
    cipher: 'aes-128-ctr',
    kdf: 'scrypt',
    kdfparams: {
    n: 8192,
    r: 8,
    p: 1,
    dklen: 32,
    salt: '210d0ec956787d865358ac45716e6dd42e68d48e346d795746509523aeb477dd'
    },
    mac: 'efbf6d3409f37c0084a79d5fdf9a6f5d97d11447517ef1ea8374f51e581b7efd'
    }
    }

    Encrypting using pbkdf2 options:

    web3.eth.accounts.encrypt('0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709',
    '123',
    {
    iv: 'bfb43120ae00e9de110f8325143a2709',
    salt: '210d0ec956787d865358ac45716e6dd42e68d48e346d795746509523aeb477dd',
    c: 262144,
    kdf: 'pbkdf2',
    }).then(console.log)

    >
    {
    version: 3,
    id: '77381417-0973-4e4b-b590-8eb3ace0fe2d',
    address: 'b8ce9ab6943e0eced004cde8e3bbed6568b2fa01',
    crypto: {
    ciphertext: '76512156a34105fa6473ad040c666ae7b917d14c06543accc0d2dc28e6073b12',
    cipherparams: { iv: 'bfb43120ae00e9de110f8325143a2709' },
    cipher: 'aes-128-ctr',
    kdf: 'pbkdf2',
    kdfparams: {
    dklen: 32,
    salt: '210d0ec956787d865358ac45716e6dd42e68d48e346d795746509523aeb477dd',
    c: 262144,
    prf: 'hmac-sha256'
    },
    mac: '46eb4884e82dc43b5aa415faba53cc653b7038e9d61cc32fd643cf8c396189b7'
    }
    }

hashMessage

  • hashMessage(message: string, skipPrefix?: boolean): string
  • Hashes the given message. The data will be UTF-8 HEX decoded and enveloped as follows: "\x19Ethereum Signed Message:\n" + message.length + message and hashed using keccak256.


    Parameters

    • message: string

      A message to hash, if its HEX it will be UTF8 decoded.

    • optionalskipPrefix: boolean

      (default: false) If true, the message will be not prefixed with "\x19Ethereum Signed Message:\n" + message.length

    Returns string

    The hashed message

    web3.eth.accounts.hashMessage("Hello world")

    > "0x8144a6fa26be252b86456491fbcd43c1de7e022241845ffea1c3df066f7cfede"

    web3.eth.accounts.hashMessage(web3.utils.utf8ToHex("Hello world")) // Will be hex decoded in hashMessage

    > "0x8144a6fa26be252b86456491fbcd43c1de7e022241845ffea1c3df066f7cfede"

    web3.eth.accounts.hashMessage("Hello world", true)

    > "0xed6c11b0b5b808960df26f5bfc471d04c1995b0ffd2055925ad1be28d6baadfd"

intToUint8Array

  • intToUint8Array(i: number): Uint8Array
  • Converts an Number to a Uint8Array


    Parameters

    • i: number

    Returns Uint8Array

isAccessList

  • isAccessList(input: AccessListUint8Array | AccessList): input is AccessList
  • Parameters

    • input: AccessListUint8Array | AccessList

    Returns input is AccessList

isAccessListUint8Array

  • isAccessListUint8Array(input: AccessListUint8Array | AccessList): input is AccessListUint8Array
  • Parameters

    • input: AccessListUint8Array | AccessList

    Returns input is AccessListUint8Array

padToEven

  • padToEven(value: string): string
  • Pads a String to have an even length


    Parameters

    • value: string

    Returns string

    output

parseAndValidatePrivateKey

  • parseAndValidatePrivateKey(data: Bytes, ignoreLength?: boolean): Uint8Array
  • Get the private key Uint8Array after the validation. Note: This function is not exported through main web3 package, so for using it directly import from accounts package.


    Parameters

    • data: Bytes

      Private key

    • optionalignoreLength: boolean

      Optional, ignore length check during validation

    Returns Uint8Array

    The Uint8Array private key

    parseAndValidatePrivateKey("0x08c673022000ece7964ea4db2d9369c50442b2869cbd8fc21baaca59e18f642c")

    > Uint8Array(32) [
    186, 26, 143, 168, 235, 179, 90, 75,
    101, 63, 84, 221, 152, 150, 30, 203,
    8, 113, 94, 226, 53, 213, 216, 5,
    194, 159, 17, 53, 219, 97, 121, 248
    ]

parseGethGenesis

  • parseGethGenesis(json: any, name?: string, mergeForkIdPostMerge?: boolean): { bootstrapNodes: never[]; chainId: number; consensus: { algorithm: string; clique: { epoch: any; period: any }; ethash?: undefined; type: string } | { algorithm: string; clique?: undefined; ethash: {}; type: string }; genesis: { baseFeePerGas: string; coinbase: string; difficulty: number; extraData: string; gasLimit: number; mixHash: string; nonce: string; timestamp: string }; hardfork: string | undefined; hardforks: ConfigHardfork[]; name: string; networkId: number }
  • Parses a genesis.json exported from Geth into parameters for Common instance


    Parameters

    • json: any

      representing the Geth genesis file

    • optionalname: string

      optional chain name

    • optionalmergeForkIdPostMerge: boolean

    Returns { bootstrapNodes: never[]; chainId: number; consensus: { algorithm: string; clique: { epoch: any; period: any }; ethash?: undefined; type: string } | { algorithm: string; clique?: undefined; ethash: {}; type: string }; genesis: { baseFeePerGas: string; coinbase: string; difficulty: number; extraData: string; gasLimit: number; mixHash: string; nonce: string; timestamp: string }; hardfork: string | undefined; hardforks: ConfigHardfork[]; name: string; networkId: number }

    parsed params

    • bootstrapNodes: never[]
    • chainId: number
    • consensus: { algorithm: string; clique: { epoch: any; period: any }; ethash?: undefined; type: string } | { algorithm: string; clique?: undefined; ethash: {}; type: string }
    • genesis: { baseFeePerGas: string; coinbase: string; difficulty: number; extraData: string; gasLimit: number; mixHash: string; nonce: string; timestamp: string }
      • baseFeePerGas: string
      • coinbase: string
      • difficulty: number
      • extraData: string
      • gasLimit: number
      • mixHash: string
      • nonce: string
      • timestamp: string
    • hardfork: string | undefined
    • hardforks: ConfigHardfork[]
    • name: string
    • networkId: number

privateKeyToAccount

  • privateKeyToAccount(privateKey: Bytes, ignoreLength?: boolean): Web3Account
  • Get an Account object from the privateKey


    Parameters

    • privateKey: Bytes

      String or Uint8Array of 32 bytes

    • optionalignoreLength: boolean

      if true, will not error check length

    Returns Web3Account

    A Web3Account object

    The Web3Account.signTransaction is not stateful if directly imported from accounts package and used. Network access is required to get the account nonce and chainId to sign the transaction, so use Web3.eth.accounts.signTransaction for signing transactions.

    :

    web3.eth.accounts.privateKeyToAccount("0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709");

    > {
    address: '0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01',
    privateKey: '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709',
    sign,
    signTransaction,
    encrypt,
    }

privateKeyToAddress

  • privateKeyToAddress(privateKey: Bytes): string
  • Get the ethereum Address from a private key

    @example
    web3.eth.accounts.privateKeyToAddress("0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728")

    > "0xEB014f8c8B418Db6b45774c326A0E64C78914dC0"

    Parameters

    • privateKey: Bytes

      String or Uint8Array of 32 bytes

    Returns string

    The Ethereum address

privateKeyToPublicKey

  • privateKeyToPublicKey(privateKey: Bytes, isCompressed: boolean): string
  • Get the public key from a private key

    @example
    web3.eth.accounts.privateKeyToPublicKey("0x1e046a882bb38236b646c9f135cf90ad90a140810f439875f2a6dd8e50fa261f", true)

    > "0x42beb65f179720abaa3ec9a70a539629cbbc5ec65bb57e7fc78977796837e537662dd17042e6449dc843c281067a4d6d8d1a1775a13c41901670d5de7ee6503a" // uncompressed public key

    Parameters

    • privateKey: Bytes

      String or Uint8Array of 32 bytes

    • isCompressed: boolean

      if true, will generate a 33 byte compressed public key instead of a 65 byte public key

    Returns string

    The public key

recover

  • recover(data: string | SignatureObject, signatureOrV?: string, prefixedOrR?: string | boolean, s?: string, prefixed?: boolean): string
  • Recovers the Ethereum address which was used to sign the given data


    Parameters

    • data: string | SignatureObject

      Either a signed message, hash, or the signatureObject

    • optionalsignatureOrV: string

      signature or V

    • optionalprefixedOrR: string | boolean

      prefixed or R

    • optionals: string

      S value in signature

    • optionalprefixed: boolean

      (default: false) If the last parameter is true, the given message will NOT automatically be prefixed with "\\x19Ethereum Signed Message:\\n" + message.length + message, and assumed to be already prefixed and hashed.

    Returns string

    The Ethereum address used to sign this data

    const data = 'Some data';
    const sigObj = web3.eth.accounts.sign(data, '0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728')

    > {
    message: 'Some data',
    messageHash: '0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655',
    v: '0x1b',
    r: '0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f9',
    s: '0x53e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb150',
    signature: '0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f953e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb1501b'
    }

    // now recover
    web3.eth.accounts.recover(data, sigObj.v, sigObj.r, sigObj.s)

    > 0xEB014f8c8B418Db6b45774c326A0E64C78914dC0

recoverTransaction

  • recoverTransaction(rawTransaction: string): string
  • Recovers the Ethereum address which was used to sign the given RLP encoded transaction.


    Parameters

    • rawTransaction: string

      The hex string having RLP encoded transaction

    Returns string

    The Ethereum address used to sign this transaction

    web3.eth.accounts.recoverTransaction('0xf869808504e3b29200831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a0c9cf86333bcb065d140032ecaab5d9281bde80f21b9687b3e94161de42d51895a0727a108a0b8d101465414033c3f705a9c7b826e596766046ee1183dbc8aeaa68');
    > "0x2c7536E3605D9C16a7a3D7b1898e529396a65c23"

setLengthLeft

  • setLengthLeft(msg: Uint8Array, length: number): Uint8Array
  • Left Pads a Uint8Array with leading zeros till it has length bytes. Or it truncates the beginning if it exceeds.


    Parameters

    • msg: Uint8Array

      the value to pad (Uint8Array)

    • length: number

      the number of bytes the output should be

    Returns Uint8Array

    (Uint8Array)

sign

  • sign(data: string, privateKey: Bytes): SignResult
  • Signs arbitrary data with a given private key. :::info The value passed as the data parameter will be UTF-8 HEX decoded and wrapped as follows: "\x19Ethereum Signed Message:\n" + message.length + message :::


    Parameters

    • data: string

      The data to sign

    • privateKey: Bytes

      The 32 byte private key to sign with

    Returns SignResult

    The signature Object containing the message, messageHash, signature r, s, v

    web3.eth.accounts.sign('Some data', '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')
    > {
    message: 'Some data',
    messageHash: '0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655',
    v: '0x1c',
    r: '0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd',
    s: '0x6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a029',
    signature: '0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c'
    }

signMessageWithPrivateKey

  • signMessageWithPrivateKey(hash: string, privateKey: Bytes): SignResult
  • Takes a hash of a message and a private key, signs the message using the SECP256k1 elliptic curve algorithm, and returns the signature components.


    Parameters

    • hash: string

      The hash of the message to be signed, represented as a hexadecimal string.

    • privateKey: Bytes

      The private key used to sign the message, represented as a byte array.

    Returns SignResult

    • The signature Object containing the message, messageHash, signature r, s, v

signRaw

  • signRaw(data: string, privateKey: Bytes): SignResult
  • Signs raw data with a given private key without adding the Ethereum-specific prefix.


    Parameters

    • data: string

      The raw data to sign. If it's a hex string, it will be used as-is. Otherwise, it will be UTF-8 encoded.

    • privateKey: Bytes

      The 32 byte private key to sign with

    Returns SignResult

    The signature Object containing the message, messageHash, signature r, s, v

    web3.eth.accounts.signRaw('Some data', '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')
    > {
    message: 'Some data',
    messageHash: '0x43a26051362b8040b289abe93334a5e3662751aa691185ae9e9a2e1e0c169350',
    v: '0x1b',
    r: '0x93da7e2ddd6b2ff1f5af0c752f052ed0d7d5bff19257db547a69cd9a879b37d4',
    s: '0x334485e42b33815fd2cf8a245a5393b282214060844a9681495df2257140e75c',
    signature: '0x93da7e2ddd6b2ff1f5af0c752f052ed0d7d5bff19257db547a69cd9a879b37d4334485e42b33815fd2cf8a245a5393b282214060844a9681495df2257140e75c1b'
    }

signTransaction

  • signTransaction(transaction: TypedTransaction, privateKey: string): Promise<SignTransactionResult>
  • Signs an Ethereum transaction with a given private key.


    Parameters

    • transaction: TypedTransaction

      The transaction, must be a legacy, EIP2930 or EIP 1559 transaction type

    • privateKey: string

      The private key to import. This is 32 bytes of random data.

    Returns Promise<SignTransactionResult>

    A signTransactionResult object that contains message hash, r, s, v, transaction hash and raw transaction.

    This function is not stateful here. We need network access to get the account nonce and chainId to sign the transaction. This function will rely on user to provide the full transaction to be signed. If you want to sign a partial transaction object Use Web3.eth.accounts.sign instead.

    Signing a legacy transaction

    import {signTransaction, Transaction} from 'web3-eth-accounts';

    signTransaction(new Transaction({
    to: '0x118C2E5F57FD62C2B5b46a5ae9216F4FF4011a07',
    value: '0x186A0',
    gasLimit: '0x520812',
    gasPrice: '0x09184e72a000',
    data: '',
    chainId: 1,
    nonce: 0 }),
    '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')

    > {
    messageHash: '0x28b7b75f7ba48d588a902c1ff4d5d13cc0ca9ac0aaa39562368146923fb853bf',
    v: '0x25',
    r: '0x601b0017b0e20dd0eeda4b895fbc1a9e8968990953482214f880bae593e71b5',
    s: '0x690d984493560552e3ebdcc19a65b9c301ea9ddc82d3ab8cfde60485fd5722ce',
    rawTransaction: '0xf869808609184e72a0008352081294118c2e5f57fd62c2b5b46a5ae9216f4ff4011a07830186a08025a00601b0017b0e20dd0eeda4b895fbc1a9e8968990953482214f880bae593e71b5a0690d984493560552e3ebdcc19a65b9c301ea9ddc82d3ab8cfde60485fd5722ce',
    transactionHash: '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'

    Signing an eip 1559 transaction

    import {signTransaction, Transaction} from 'web3-eth-accounts';

    signTransaction(new Transaction({
    to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
    maxPriorityFeePerGas: '0x3B9ACA00',
    maxFeePerGas: '0xB2D05E00',
    gasLimit: '0x6A4012',
    value: '0x186A0',
    data: '',
    chainId: 1,
    nonce: 0}),
    "0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318")
    > {
    messageHash: '0x5744f24d5f0aff6c70487c8e85adf07d8564e50b08558788f00479611d7bae5f',
    v: '0x25',
    r: '0x78a5a6b2876c3985f90f82073d18d57ac299b608cc76a4ba697b8bb085048347',
    s: '0x9cfcb40cc7d505ed17ff2d3337b51b066648f10c6b7e746117de69b2eb6358d',
    rawTransaction: '0xf8638080836a401294f0109fc8df283027b6285cc889f5aa624eac1f55830186a08025a078a5a6b2876c3985f90f82073d18d57ac299b608cc76a4ba697b8bb085048347a009cfcb40cc7d505ed17ff2d3337b51b066648f10c6b7e746117de69b2eb6358d',
    transactionHash: '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
    }

    Signing an eip 2930 transaction

    import {signTransaction, Transaction} from 'web3-eth-accounts';

    signTransaction(new Transaction ({
    chainId: 1,
    nonce: 0,
    gasPrice: '0x09184e72a000',
    gasLimit: '0x2710321',
    to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
    value: '0x186A0',
    data: '',
    accessList: [
    {
    address: '0x0000000000000000000000000000000000000101',
    storageKeys: [
    '0x0000000000000000000000000000000000000000000000000000000000000000',
    '0x00000000000000000000000000000000000000000000000000000000000060a7',
    ],
    },
    ],
    }),"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318")

    > {
    messageHash: '0xc55ea24bdb4c379550a7c9a6818ac39ca33e75bc78ddb862bd82c31cc1c7a073',
    v: '0x26',
    r: '0x27344e77871c8b2068bc998bf28e0b5f9920867a69c455b2ed0c1c150fec098e',
    s: '0x519f0130a1d662841d4a28082e9c9bb0a15e0e59bb46cfc39a52f0e285dec6b9',
    rawTransaction: '0xf86a808609184e72a000840271032194f0109fc8df283027b6285cc889f5aa624eac1f55830186a08026a027344e77871c8b2068bc998bf28e0b5f9920867a69c455b2ed0c1c150fec098ea0519f0130a1d662841d4a28082e9c9bb0a15e0e59bb46cfc39a52f0e285dec6b9',
    transactionHash: '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
    }

stripHexPrefix

  • stripHexPrefix(str: string): string
  • Removes '0x' from a given String if present


    Parameters

    • str: string

      the string value

    Returns string

    the string without 0x prefix

stripZeros

  • stripZeros<T>(a: T): T
  • Trims leading zeros from a Uint8Array, String or Number[].


    Type parameters

    • T: string | Uint8Array | number[]

    Parameters

    • a: T

      (Uint8Array|Array|String)

    Returns T

    (Uint8Array|Array|String)

toType

  • toType<T>(input: null, outputType: T): null
  • toType<T>(input: undefined, outputType: T): undefined
  • toType<T>(input: ToBytesInputTypes, outputType: T): TypeOutputReturnType[T]
  • Convert an input to a specified type. Input of null/undefined returns null/undefined regardless of the output type.


    Type parameters

    • T: TypeOutput

    Parameters

    • input: null

      value to convert

    • outputType: T

      type to output

    Returns null

toUint8Array

  • toUint8Array(v: ToBytesInputTypes): Uint8Array
  • Attempts to turn a value into a Uint8Array. Inputs supported: Uint8Array String (hex-prefixed), Number, null/undefined, BigInt and other objects with a toArray() or toUint8Array() method.


    Parameters

    • v: ToBytesInputTypes

      the value

    Returns Uint8Array

uint8ArrayToBigInt

  • uint8ArrayToBigInt(buf: Uint8Array): bigint
  • Converts a Uint8Array to a bigint


    Parameters

    • buf: Uint8Array

    Returns bigint

unpadUint8Array

  • unpadUint8Array(a: Uint8Array): Uint8Array
  • Trims leading zeros from a Uint8Array.


    Parameters

    • a: Uint8Array

      (Uint8Array)

    Returns Uint8Array

    (Uint8Array)

zeros

  • zeros(bytes: number): Uint8Array
  • Returns a Uint8Array filled with 0s.


    Parameters

    • bytes: number

      the number of bytes the Uint8Array should be

    Returns Uint8Array

contract

contract:

Contract

Re-exports Contract

ContractDeploySend

ContractMethodSend

default

Renames and re-exports Contract

ContractLogsSubscription

ContractLogsSubscription:

ContractLogsSubscription to be used to subscribe to events logs.

Following events are supported and can be accessed with either ContractLogsSubscription.once or $ContractLogsSubscription.on methods.

  • connected: Emitted when the subscription is connected.
  • data: Fires on each incoming event with the event object as argument.
  • changed: Fires on each event which was removed from the blockchain. The event will have the additional property removed: true.
  • error: Fires on each error.
const subscription = await myContract.events.MyEvent({
filter: {myIndexedParam: [20,23], myOtherIndexedParam: '0x123456789...'}, // Using an array means OR: e.g. 20 or 23
fromBlock: 0
});

subscription.on("connected", function(subscriptionId){
console.log(subscriptionId);
});

subscription.on('data', function(event){
console.log(event); // same results as the optional callback above
});

subscription.on('changed', function(event){
// remove event from local database
})

subscription.on('error', function(error, receipt) { // If the transaction was rejected by the network with a receipt, the second parameter will be the receipt.
...
});

// event output example
> {
returnValues: {
myIndexedParam: 20,
myOtherIndexedParam: '0x123456789...',
myNonIndexParam: 'My String'
},
raw: {
data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
},
event: 'MyEvent',
signature: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
logIndex: 0,
transactionIndex: 0,
transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
blockNumber: 1234,
address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
}

constructor

  • new ContractLogsSubscription(args: { abi: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }; address?: string; jsonInterface: ContractAbiWithSignature; topics?: (null | string | string[])[] }, options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<unknown, {}> }): ContractLogsSubscription
  • new ContractLogsSubscription(args: { abi: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }; address?: string; jsonInterface: ContractAbiWithSignature; topics?: (null | string | string[])[] }, options: { requestManager: Web3RequestManager<EthExecutionAPI>; returnFormat?: DataFormat }): ContractLogsSubscription
  • Parameters

    • args: { abi: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }; address?: string; jsonInterface: ContractAbiWithSignature; topics?: (null | string | string[])[] }
      • abi: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }
      • optionaladdress: string
      • jsonInterface: ContractAbiWithSignature
      • optionaltopics: (null | string | string[])[]
    • options: { returnFormat?: DataFormat; subscriptionManager: Web3SubscriptionManager<unknown, {}> }

    Returns ContractLogsSubscription

readonlyabi

abi: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }

The JSON Interface of the event.

optionalreadonlyaddress

address?: string

Address of tye contract

readonlyargs

args: { abi: AbiEventFragment; address?: string; topics?: (null | string | string[])[] }

Type declaration

  • abi: AbiEventFragment
  • optionaladdress?: string
  • optionaltopics?: (null | string | string[])[]

readonlyjsonInterface

jsonInterface: ContractAbiWithSignature

optionalreadonlytopics

topics?: (null | string | string[])[]

The list of topics subscribed

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

  • Returns undefined | BlockOutput

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: unknown): void
  • Parameters

    • data: unknown

    Returns void

emit

  • emit<K>(eventName: K, params: { changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]): void
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents>

    Parameters

    • eventName: K
    • params: { changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents>

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents>

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • off<K>(eventName: K, fn: Web3EventCallback<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents>

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]>

    Returns void

on

  • on<K>(eventName: K, fn: Web3EventCallback<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents>

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]>

    Returns void

once

  • once<K>(eventName: K, fn: Web3EventCallback<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents>

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ changed: EventLog & { removed: true }; data: EventLog } & CommonSubscriptionEvents[K]>

    Returns void

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>

DeployerMethodClass

DeployerMethodClass<FullContractAbi>:

Type parameters

constructor

  • new DeployerMethodClass<FullContractAbi>(parent: Contract<FullContractAbi>, deployOptions: undefined | { arguments?: ContractConstructorArgs<FullContractAbi>; data?: string; input?: string }): DeployerMethodClass<FullContractAbi>
  • Type parameters

    Parameters

    • parent: Contract<FullContractAbi>
    • deployOptions: undefined | { arguments?: ContractConstructorArgs<FullContractAbi>; data?: string; input?: string }
      • optionalarguments: ContractConstructorArgs<FullContractAbi>

        The arguments which get passed to the constructor on deployment.

      • optionaldata: string

        The byte code of the contract.

      • optionalinput: string

    Returns DeployerMethodClass<FullContractAbi>

deployOptions

deployOptions: undefined | { arguments?: ContractConstructorArgs<FullContractAbi>; data?: string; input?: string }

parent

parent: Contract<FullContractAbi>

decodeData

  • decodeData(data: string): { __length__: number; __method__: string }
  • Parameters

    • data: string

    Returns { __length__: number; __method__: string }

    • __length__: number
    • __method__: string

encodeABI

  • encodeABI(): string
  • Returns string

estimateGas

  • Type parameters

    • ReturnFormat: DataFormat = { bytes: HEX; number: BIGINT }

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

populateTransaction

send

ContractEventOptions

ContractEventOptions:

optionalfilter

filter?: Record<string, unknown>

Let you filter events by indexed parameters, e.g. {filter: {myNumber: [12,13]}} means all events where myNumber is 12 or 13.

optionalfromBlock

fromBlock?: BlockNumberOrTag

The block number (greater than or equal to) from which to get events on. Pre-defined block numbers as earliest, latest, pending, safe or finalized can also be used. For specific range use Contract.getPastEvents.

optionaltopics

topics?: string[]

This allows to manually set the topics for the event filter. If given the filter property and event signature, (topic[0]) will not be set automatically. Each topic can also be a nested array of topics that behaves as or operation between the given nested topics.

ContractOptions

ContractOptions:

Represents the options for a contract.

optionaladdress

address?: string

The address used for this contract instance. All transactions generated by web3.js from this contract will contain this address as the to.

The address will be stored in lowercase.

@example
myContract.options.address;
> '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'

// set a new address
myContract.options.address = '0x1234FFDD...';

optionalreadonlydata

data?: Bytes

The byte code of the contract. Used when the contract gets deployed

optionalreadonlyfrom

from?: string

The address transactions should be made from.

optionalreadonlygas

gas?: string

The maximum gas provided for a transaction (gas limit).

optionalreadonlygasPrice

gasPrice?: string

The gas price in wei to use for transactions.

optionalreadonlyinput

input?: Bytes

The byte code of the contract. Used when the contract gets deployed

optionalmaxFeePerGas

maxFeePerGas?: string

The max fee per gas to use for transactions.

optionalmaxPriorityFeePerGas

maxPriorityFeePerGas?: string

The max priority fee per gas to use for transactions.

jsonInterface

  • get jsonInterface(): ContractAbiWithSignature
  • set jsonInterface(value: ContractAbi): void
  • The json interface object derived from the ABI of this contract.

    Re-setting this will regenerate the methods and events of the contract instance.

    @example
    myContract.options.jsonInterface;
    > [{
    "type":"function",
    "name":"foo",
    "inputs": [{"name":"a","type":"uint256"}],
    "outputs": [{"name":"b","type":"address"}],
    "signature": "0x...",
    },{
    "type":"event",
    "name":"Event",
    "inputs": [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"bytes32","indexed":false}],
    "signature": "0x...",
    }]

    // Set a new ABI interface
    // Note: the "signature" of every function and event's ABI is not needed to be provided when assigning.
    // It will be calculated and set automatically inside the setter.
    myContract.options.jsonInterface = [...];

    Returns ContractAbiWithSignature

  • Parameters

    Returns void

EventLog

EventLog:

readonlyaddress

address: string

optionalreadonlyblockHash

blockHash?: string

optionalreadonlyblockNumber

blockNumber?: string | number | bigint

readonlydata

data: string

readonlyevent

event: string

optionalreadonlyid

id?: string

optionalreadonlylogIndex

logIndex?: string | number | bigint

optionalreadonlyraw

raw?: { data: string; topics: unknown[] }

Type declaration

  • data: string
  • topics: unknown[]

readonlyreturnValues

returnValues: Record<string, unknown>

optionalreadonlysignature

signature?: string

readonlytopics

topics: string[]

optionalreadonlytransactionHash

transactionHash?: string

optionalreadonlytransactionIndex

transactionIndex?: string | number | bigint

NonPayableMethodObject

NonPayableMethodObject<Inputs, Outputs>:

Type parameters

  • Inputs = unknown[]
  • Outputs = unknown[]

arguments

arguments: Inputs

call

  • This will call a method and execute its smart contract method in the EVM without sending any transaction. Note calling cannot alter the smart contract state.

    // using the promise
    const result = await myContract.methods.myMethod(123).call({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'});

    // MULTI-ARGUMENT RETURN:
    // Solidity
    contract MyContract {
    function myFunction() returns(uint256 myNumber, string myString) {
    return (23456, "Hello!%");
    }
    }

    // web3.js
    var MyContract = new web3.eth.Contract(abi, address);
    const result = MyContract.methods.myFunction().call()
    console.log(result)
    > Result {
    myNumber: '23456',
    myString: 'Hello!%',
    0: '23456', // these are here as fallbacks if the name is not know or given
    1: 'Hello!%'
    }


    // SINGLE-ARGUMENT RETURN:
    // Solidity
    contract MyContract {
    function myFunction() returns(string myString) {
    return "Hello!%";
    }
    }

    // web3.js
    const MyContract = new web3.eth.Contract(abi, address);
    const result = await MyContract.methods.myFunction().call();
    console.log(result);
    > "Hello!%"

    Type parameters

    • SpecialOutput = Outputs

    Parameters

    • optionaltx: NonPayableCallOptions

      The options used for calling.

    • optionalblock: BlockNumberOrTag

      If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as earliest, latest, pending, safe or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.

    Returns Promise<SpecialOutput>

    • The return value(s) of the smart contract method. If it returns a single value, it’s returned as is. If it has multiple return values they are returned as an object with properties and indices.

createAccessList

  • This method generates an access list for a transaction. You must specify a from address and gas if it’s not specified in options.


    Parameters

    • optionaltx: NonPayableCallOptions
    • optionalblock: BlockNumberOrTag

      If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as earliest, latest, pending, safe or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.

    Returns Promise<AccessListResult>

    The returned data of the createAccessList, e.g. The generated access list for transaction.

     const result = await MyContract.methods.myFunction().createAccessList();
    console.log(result);

    > {
    "accessList": [
    {
    "address": "0x15859bdf5aff2080a9968f6a410361e9598df62f",
    "storageKeys": [
    "0x0000000000000000000000000000000000000000000000000000000000000000"
    ]
    }
    ],
    "gasUsed": "0x7671"
    }

decodeData

  • decodeData<SpecialInputs>(data: string): SpecialInputs
  • Decode raw result of method call into readable value(s).


    Type parameters

    • SpecialInputs = Inputs

    Parameters

    • data: string

      The data to decode.

    Returns SpecialInputs

    • The decoded data.

encodeABI

  • encodeABI(): string
  • Encodes the ABI for this method. The resulting hex string is 32-bit function signature hash plus the passed parameters in Solidity tightly packed format. This can be used to send a transaction, call a method, or pass it into another smart contract’s method as arguments. Set the data field on web3.eth.sendTransaction options as the encodeABI() result and it is the same as calling the contract method with contract.myMethod.send().

    Some use cases for encodeABI() include: preparing a smart contract transaction for a multi signature wallet, working with offline wallets and cold storage and creating transaction payload for complex smart contract proxy calls.


    Returns string

    • The encoded ABI byte code to send via a transaction or call.

estimateGas

  • Returns the amount of gas consumed by executing the method locally without creating a new transaction on the blockchain. The returned amount can be used as a gas estimate for executing the transaction publicly. The actual gas used can be different when sending the transaction later, as the state of the smart contract can be different at that time.

    const gasAmount = await myContract.methods.myMethod(123).estimateGas({gas: 5000000});
    if(gasAmount == 5000000) {
    console.log('Method ran out of gas');
    }

    Type parameters

    • ReturnFormat: DataFormat = { bytes: HEX; number: BIGINT }

    Parameters

    • optionaloptions: NonPayableCallOptions

      The options used for calling

    • optionalreturnFormat: ReturnFormat

      The data format you want the output in.

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    • The gas amount estimated.

populateTransaction

send

  • send(tx?: NonPayableCallOptions): Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; events?: {}; from: string; gasUsed: bigint; logs: { address?: string; blockHash?: string; blockNumber?: bigint; data?: string; id?: string; logIndex?: bigint; removed?: boolean; topics?: string[]; transactionHash?: string; transactionIndex?: bigint }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint }, SendTransactionEvents<{ bytes: HEX; number: BIGINT }>>
  • This will send a transaction to the smart contract and execute its method. Note this can alter the smart contract state.

    await myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'});

    const receipt = await myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'});


    // using the event emitter
    const sendObj = myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'})
    sendObj.on('transactionHash', function(hash){
    ...
    });

    sendObj.on('confirmation', function(confirmationNumber, receipt){
    ...
    });

    sendObj.on('receipt', function(receipt){
    // receipt example
    console.log(receipt);
    > {
    "transactionHash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
    "transactionIndex": 0,
    "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
    "blockNumber": 3,
    "contractAddress": "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
    "cumulativeGasUsed": 314159,
    "gasUsed": 30234,
    "events": {
    "MyEvent": {
    returnValues: {
    myIndexedParam: 20,
    myOtherIndexedParam: '0x123456789...',
    myNonIndexParam: 'My String'
    },
    raw: {
    data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
    },
    event: 'MyEvent',
    signature: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
    logIndex: 0,
    transactionIndex: 0,
    transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
    blockNumber: 1234,
    address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
    },
    "MyOtherEvent": {
    ...
    },
    "MyMultipleEvent":[{...}, {...}] // If there are multiple of the same event, they will be in an array
    }
    }
    });

    sendObj.on('error', function(error, receipt) { // If the transaction was rejected by the network with a receipt, the second parameter will be the receipt.
    ...
    });

    Parameters

    Returns Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; events?: {}; from: string; gasUsed: bigint; logs: { address?: string; blockHash?: string; blockNumber?: bigint; data?: string; id?: string; logIndex?: bigint; removed?: boolean; topics?: string[]; transactionHash?: string; transactionIndex?: bigint }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint }, SendTransactionEvents<{ bytes: HEX; number: BIGINT }>>

    • Returns a PromiEvent resolved with transaction receipt.

PayableMethodObject

PayableMethodObject<Inputs, Outputs>:

Type parameters

  • Inputs = unknown[]
  • Outputs = unknown[]

arguments

arguments: Inputs

call

  • Will call a method and execute its smart contract method in the EVM without sending any transaction. Note calling cannot alter the smart contract state.

    // using the promise
    const result = await myContract.methods.myMethod(123).call({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'});

    // MULTI-ARGUMENT RETURN:
    // Solidity
    contract MyContract {
    function myFunction() returns(uint256 myNumber, string myString) {
    return (23456, "Hello!%");
    }
    }

    // web3.js
    var MyContract = new web3.eth.Contract(abi, address);
    const result = MyContract.methods.myFunction().call()
    console.log(result)
    > Result {
    myNumber: '23456',
    myString: 'Hello!%',
    0: '23456', // these are here as fallbacks if the name is not know or given
    1: 'Hello!%'
    }


    // SINGLE-ARGUMENT RETURN:
    // Solidity
    contract MyContract {
    function myFunction() returns(string myString) {
    return "Hello!%";
    }
    }

    // web3.js
    const MyContract = new web3.eth.Contract(abi, address);
    const result = await MyContract.methods.myFunction().call();
    console.log(result);
    > "Hello!%"

    Type parameters

    • SpecialOutput = Outputs

    Parameters

    • optionaltx: PayableCallOptions

      The options used for calling.

    • optionalblock: BlockNumberOrTag

      If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as earliest, latest, pending, safe or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.

    Returns Promise<SpecialOutput>

    • The return value(s) of the smart contract method. If it returns a single value, it’s returned as is. If it has multiple return values they are returned as an object with properties and indices.

createAccessList

  • This method generates an access list for a transaction. You must specify a from address and gas if it’s not specified in options.


    Parameters

    • optionaltx: PayableCallOptions
    • optionalblock: BlockNumberOrTag

      If you pass this parameter it will not use the default block set with contract.defaultBlock. Pre-defined block numbers as earliest, latest, pending, safe or `finalized can also be used. Useful for requesting data from or replaying transactions in past blocks.

    Returns Promise<AccessListResult>

    The returned data of the createAccessList, e.g. The generated access list for transaction.

     const result = await MyContract.methods.myFunction().createAccessList();
    console.log(result);

    > {
    "accessList": [
    {
    "address": "0x15859bdf5aff2080a9968f6a410361e9598df62f",
    "storageKeys": [
    "0x0000000000000000000000000000000000000000000000000000000000000000"
    ]
    }
    ],
    "gasUsed": "0x7671"
    }

decodeData

  • decodeData<SpecialInputs>(data: string): SpecialInputs
  • Decode raw result of method call into readable value(s).


    Type parameters

    • SpecialInputs = Inputs

    Parameters

    • data: string

      The data to decode.

    Returns SpecialInputs

    • The decoded data.

encodeABI

  • encodeABI(): string
  • Encodes the ABI for this method. The resulting hex string is 32-bit function signature hash plus the passed parameters in Solidity tightly packed format. This can be used to send a transaction, call a method, or pass it into another smart contract’s method as arguments. Set the data field on web3.eth.sendTransaction options as the encodeABI() result and it is the same as calling the contract method with contract.myMethod.send().

    Some use cases for encodeABI() include: preparing a smart contract transaction for a multi signature wallet, working with offline wallets and cold storage and creating transaction payload for complex smart contract proxy calls.


    Returns string

    • The encoded ABI byte code to send via a transaction or call.

estimateGas

  • Returns the amount of gas consumed by executing the method locally without creating a new transaction on the blockchain. The returned amount can be used as a gas estimate for executing the transaction publicly. The actual gas used can be different when sending the transaction later, as the state of the smart contract can be different at that time.

    const gasAmount = await myContract.methods.myMethod(123).estimateGas({gas: 5000000});
    if(gasAmount == 5000000) {
    console.log('Method ran out of gas');
    }

    Type parameters

    • ReturnFormat: DataFormat = { bytes: HEX; number: BIGINT }

    Parameters

    • optionaloptions: PayableCallOptions

      The options used for calling

    • optionalreturnFormat: ReturnFormat

      The data format you want the output in.

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    • The gas amount estimated.

populateTransaction

send

  • send(tx?: PayableCallOptions): Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; events?: {}; from: string; gasUsed: bigint; logs: { address?: string; blockHash?: string; blockNumber?: bigint; data?: string; id?: string; logIndex?: bigint; removed?: boolean; topics?: string[]; transactionHash?: string; transactionIndex?: bigint }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint }, SendTransactionEvents<{ bytes: HEX; number: BIGINT }>>
  • Will send a transaction to the smart contract and execute its method. Note this can alter the smart contract state.

    await myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'});

    const receipt = await myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'});


    // using the event emitter
    const sendObj = myContract.methods.myMethod(123).send({from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'})
    sendObj.on('transactionHash', function(hash){
    ...
    });

    sendObj.on('confirmation', function(confirmationNumber, receipt){
    ...
    });

    sendObj.on('receipt', function(receipt){
    // receipt example
    console.log(receipt);
    > {
    "transactionHash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
    "transactionIndex": 0,
    "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
    "blockNumber": 3,
    "contractAddress": "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
    "cumulativeGasUsed": 314159,
    "gasUsed": 30234,
    "events": {
    "MyEvent": {
    returnValues: {
    myIndexedParam: 20,
    myOtherIndexedParam: '0x123456789...',
    myNonIndexParam: 'My String'
    },
    raw: {
    data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
    },
    event: 'MyEvent',
    signature: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
    logIndex: 0,
    transactionIndex: 0,
    transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
    blockNumber: 1234,
    address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
    },
    "MyOtherEvent": {
    ...
    },
    "MyMultipleEvent":[{...}, {...}] // If there are multiple of the same event, they will be in an array
    }
    }
    });

    sendObj.on('error', function(error, receipt) { // If the transaction was rejected by the network with a receipt, the second parameter will be the receipt.
    ...
    });

    Parameters

    Returns Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; events?: {}; from: string; gasUsed: bigint; logs: { address?: string; blockHash?: string; blockNumber?: bigint; data?: string; id?: string; logIndex?: bigint; removed?: boolean; topics?: string[]; transactionHash?: string; transactionIndex?: bigint }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint }, SendTransactionEvents<{ bytes: HEX; number: BIGINT }>>

    • Returns a PromiEvent object resolved with transaction receipt.

ContractAbiWithSignature

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

ContractEventEmitterInterface

ContractEventEmitterInterface<Abi>: { [ EventAbi in FilterAbis<Abi, AbiFunctionFragment & { type: event }> as EventAbi[name] ]: ContractEvent<EventAbi>[Inputs] }

Type parameters

ContractEventsInterface

ContractEventsInterface<Abi, Events>: { [ Name in keyof Events | allEvents ]: ContractBoundEvent } & {}

Type parameters

ContractMethodsInterface

ContractMethodsInterface<Abi>: { [ MethodAbi in FilterAbis<Abi, AbiFunctionFragment & { type: function }> as MethodAbi[name] ]: ContractBoundMethod<MethodAbi> } & {}

Type parameters

ContractOverloadedMethodInputs

ContractOverloadedMethodInputs<AbiArr>: NonNullable<AbiArr extends readonly [] ? undefined : AbiArr extends readonly [infer A, ...infer R] ? A extends AbiFunctionFragment ? ContractMethodInputParameters<A[inputs]> | ContractOverloadedMethodInputs<R> : undefined : undefined>

Type parameters

  • AbiArr: ReadonlyArray<unknown>

ContractOverloadedMethodOutputs

ContractOverloadedMethodOutputs<AbiArr>: NonNullable<AbiArr extends readonly [] ? undefined : AbiArr extends readonly [infer A, ...infer R] ? A extends AbiFunctionFragment ? ContractMethodOutputParameters<A[outputs]> | ContractOverloadedMethodOutputs<R> : undefined : undefined>

Type parameters

  • AbiArr: ReadonlyArray<unknown>

LogsSubscription

LogsSubscription: ContractLogsSubscription
@deprecated

Use ContractLogsSubscription instead.

NonPayableTxOptions

NonPayableTxOptions: NonPayableCallOptions

PayableTxOptions

PayableTxOptions: PayableCallOptions

Web3ContractContext

Web3ContractContext: Partial<Web3ContextInitOptions<EthExecutionAPI, { logs: typeof ContractLogsSubscription; newBlockHeaders: typeof NewHeadsSubscription; newHeads: typeof NewHeadsSubscription }>>

create2ContractAddress

  • create2ContractAddress(from: string, salt: string, initCode: string): string
  • Parameters

    • from: string
    • salt: string
    • initCode: string

    Returns string

createContractAddress

  • createContractAddress(from: string, nonce: Numbers): string
  • Parameters

    Returns string

decodeEventABI

  • decodeEventABI(event: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }, data: LogsInput, jsonInterface: ContractAbiWithSignature, returnFormat?: DataFormat): EventLog
  • Parameters

    Returns EventLog

decodeMethodParams

decodeMethodReturn

  • @deprecated

    import decodeFunctionReturn from ''web3-eth-abi' instead.


    Parameters

    Returns unknown

encodeEventABI

  • encodeEventABI(__namedParameters: ContractOptions, event: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }, options?: Filter): Writeable<Filter>
  • Parameters

    • __namedParameters: ContractOptions
    • event: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }
    • optionaloptions: Filter

    Returns Writeable<Filter>

encodeMethodABI

getCreateAccessListParams

  • getCreateAccessListParams(__namedParameters: { abi: AbiFunctionFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { to?: string | undefined; dataInputFill?: "input" | "data" | "both" | undefined; }; params: unknown[] }): TransactionForAccessList
  • Parameters

    • __namedParameters: { abi: AbiFunctionFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { to?: string | undefined; dataInputFill?: "input" | "data" | "both" | undefined; }; params: unknown[] }
      • abi: AbiFunctionFragment
      • contractOptions: ContractOptions
      • optionaloptions: (PayableCallOptions | NonPayableCallOptions) & { to?: string | undefined; dataInputFill?: "input" | "data" | "both" | undefined; }
      • params: unknown[]

    Returns TransactionForAccessList

getEstimateGasParams

  • getEstimateGasParams(__namedParameters: { abi: AbiFunctionFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { dataInputFill?: "input" | "data" | "both" | undefined; }; params: unknown[] }): Partial<TransactionWithSenderAPI>
  • Parameters

    • __namedParameters: { abi: AbiFunctionFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { dataInputFill?: "input" | "data" | "both" | undefined; }; params: unknown[] }
      • abi: AbiFunctionFragment
      • contractOptions: ContractOptions
      • optionaloptions: (PayableCallOptions | NonPayableCallOptions) & { dataInputFill?: "input" | "data" | "both" | undefined; }
      • params: unknown[]

    Returns Partial<TransactionWithSenderAPI>

getEthTxCallParams

  • getEthTxCallParams(__namedParameters: { abi: AbiFunctionFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { to?: string | undefined; dataInputFill?: "input" | "data" | "both" | undefined; }; params: unknown[] }): TransactionCall
  • Parameters

    • __namedParameters: { abi: AbiFunctionFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { to?: string | undefined; dataInputFill?: "input" | "data" | "both" | undefined; }; params: unknown[] }
      • abi: AbiFunctionFragment
      • contractOptions: ContractOptions
      • optionaloptions: (PayableCallOptions | NonPayableCallOptions) & { to?: string | undefined; dataInputFill?: "input" | "data" | "both" | undefined; }
      • params: unknown[]

    Returns TransactionCall

getSendTxParams

  • getSendTxParams(__namedParameters: { abi: AbiFunctionFragment | AbiConstructorFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { input?: string | undefined; data?: string | undefined; to?: string | undefined; dataInputFill?: "input" | ... 2 more ... | undefined; }; params: unknown[] }): TransactionCall
  • Parameters

    • __namedParameters: { abi: AbiFunctionFragment | AbiConstructorFragment; contractOptions: ContractOptions; options?: (PayableCallOptions | NonPayableCallOptions) & { input?: string | undefined; data?: string | undefined; to?: string | undefined; dataInputFill?: "input" | ... 2 more ... | undefined; }; params: unknown[] }
      • abi: AbiFunctionFragment | AbiConstructorFragment
      • contractOptions: ContractOptions
      • optionaloptions: (PayableCallOptions | NonPayableCallOptions) & { input?: string | undefined; data?: string | undefined; to?: string | undefined; dataInputFill?: "input" | ... 2 more ... | undefined; }
      • params: unknown[]

    Returns TransactionCall

isWeb3ContractContext

ens

ens:

ENS

ENS:

This class is designed to interact with the ENS system on the Ethereum blockchain. For using ENS package, first install Web3 package using: npm i web3 or yarn add web3 based on your package manager, after that ENS features can be used as mentioned in following snippet.


import { Web3 } from 'web3';

const web3 = new Web3('https://127.0.0.1:4545');

console.log(await web3.eth.ens.getAddress('ethereum.eth'))

For using individual package install web3-eth-ens packages using: npm i web3-eth-ens or yarn add web3-eth-ens. This is more efficient approach for building lightweight applications.

import { ENS } from 'web3-eth-ens';

const ens = new ENS(undefined,'https://127.0.0.1:4545');

console.log(await ens.getAddress('vitalik.eth'));

constructor

  • Use to create an instance of ENS

    @example
    const ens = new ENS(
    "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
    "http://localhost:8545"
    );

    console.log( ens.defaultChain);
    > mainnet

    Parameters

    Returns ENS

config

readonlyproviders

providers: { HttpProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }

Type declaration

registryAddress

registryAddress: string

The registryAddress property can be used to define a custom registry address when you are connected to an unknown chain. It defaults to the main registry address.

staticoptionalgivenProvider

givenProvider?: SupportedProviders<never>

staticreadonlyproviders

providers: { HttpProvider: Web3BaseProviderConstructor; WebsocketProvider: Web3BaseProviderConstructor }

Type declaration

BatchRequest

accountProvider

blockHeaderTimeout

  • get blockHeaderTimeout(): number
  • set blockHeaderTimeout(val: number): void
  • The blockHeaderTimeout is used over socket-based connections. This option defines the amount seconds it should wait for 'newBlockHeaders' event before falling back to polling to fetch transaction receipt. Default is 10 seconds.


    Returns number

  • Will set the blockHeaderTimeout


    Parameters

    • val: number

    Returns void

contractDataInputFill

  • get contractDataInputFill(): input | data | both
  • set contractDataInputFill(val: input | data | both): void
  • The contractDataInputFill options property will allow you to set the hash of the method signature and encoded parameters to the property either data, input or both within your contract. This will affect the contracts send, call and estimateGas methods Default is data.


    Returns input | data | both

  • Will set the contractDataInputFill


    Parameters

    • val: input | data | both

    Returns void

currentProvider

  • Will return the current provider. (The same as provider)

    @example
    const web3Context = new Web3Context("http://localhost:8545");
    console.log(web3Context.provider);
    > HttpProvider {
    clientUrl: 'http://localhost:8545',
    httpProviderOptions: undefined
    }

    Returns undefined | Web3BaseProvider<API>

    Returns the current provider

  • Will set the current provider. (The same as provider)

    @example
     const web3Context = new Web3Context("http://localhost:8545");
    web3Context.currentProvider = "ws://localhost:8545";
    console.log(web3Context.provider);
    > WebSocketProvider {
    _eventEmitter: EventEmitter {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    ...
    }

    Parameters

    Returns void

customTransactionSchema

defaultAccount

  • get defaultAccount(): undefined | string
  • set defaultAccount(val: undefined | string): void
  • This default address is used as the default from property, if no from property is specified in for the following methods:

    • web3.eth.sendTransaction()
    • web3.eth.call()
    • myContract.methods.myMethod().call()
    • myContract.methods.myMethod().send()

    Returns undefined | string

  • Will set the default account.


    Parameters

    • val: undefined | string

    Returns void

defaultBlock

  • The default block is used for certain methods. You can override it by passing in the defaultBlock as last parameter. The default value is "latest".

    • web3.eth.getBalance()
    • web3.eth.getCode()
    • web3.eth.getTransactionCount()
    • web3.eth.getStorageAt()
    • web3.eth.call()
    • myContract.methods.myMethod().call()

    Returns BlockNumberOrTag

  • Will set the default block.

    • A block number
    • "earliest" - String: The genesis block
    • "latest" - String: The latest block (current head of the blockchain)
    • "pending" - String: The currently mined block (including pending transactions)
    • "finalized" - String: (For POS networks) The finalized block is one which has been accepted as canonical by greater than 2/3 of validators
    • "safe" - String: (For POS networks) The safe head block is one which under normal network conditions, is expected to be included in the canonical chain. Under normal network conditions the safe head and the actual tip of the chain will be equivalent (with safe head trailing only by a few seconds). Safe heads will be less likely to be reorged than the proof of work network's latest blocks.

    Parameters

    Returns void

defaultChain

  • get defaultChain(): string
  • set defaultChain(val: string): void
  • Returns string

  • Parameters

    • val: string

    Returns void

defaultCommon

  • get defaultCommon(): undefined | Common
  • set defaultCommon(val: undefined | Common): void
  • Will get the default common property The default common property does contain the following Common object:

    • customChain - Object: The custom chain properties
      • name - string: (optional) The name of the chain
      • networkId - number: Network ID of the custom chain
      • chainId - number: Chain ID of the custom chain
    • baseChain - string: (optional) mainnet, goerli, kovan, rinkeby, or ropsten
    • hardfork - string: (optional) chainstart, homestead, dao, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, or london Default is undefined.

    Returns undefined | Common

  • Will set the default common property


    Parameters

    Returns void

defaultHardfork

  • get defaultHardfork(): string
  • set defaultHardfork(val: string): void
  • Will return the default hardfork. Default is london The default hardfork property can be one of the following:

    • chainstart
    • homestead
    • dao
    • tangerineWhistle
    • spuriousDragon
    • byzantium
    • constantinople
    • petersburg
    • istanbul
    • berlin
    • london
    • 'arrowGlacier',
    • 'tangerineWhistle',
    • 'muirGlacier'

    Returns string

  • Will set the default hardfork.


    Parameters

    • val: string

    Returns void

defaultMaxPriorityFeePerGas

  • get defaultMaxPriorityFeePerGas(): Numbers
  • set defaultMaxPriorityFeePerGas(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

defaultNetworkId

  • get defaultNetworkId(): undefined | Numbers
  • set defaultNetworkId(val: undefined | Numbers): void
  • Returns undefined | Numbers

  • Parameters

    Returns void

defaultReturnFormat

  • Returns DataFormat

  • Parameters

    Returns void

defaultTransactionType

  • get defaultTransactionType(): Numbers
  • set defaultTransactionType(val: Numbers): void
  • Returns Numbers

  • Parameters

    Returns void

enableExperimentalFeatures

  • get enableExperimentalFeatures(): { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
  • set enableExperimentalFeatures(val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }): void
  • The enableExperimentalFeatures is used to enable trying new experimental features that are still not fully implemented or not fully tested or still have some related issues. Default is false for every feature.


    Returns { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }

    • useRpcCallSpecification: boolean
    • useSubscriptionWhenCheckingBlockTimeout: boolean
  • Will set the enableExperimentalFeatures


    Parameters

    • val: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }
      • useRpcCallSpecification: boolean
      • useSubscriptionWhenCheckingBlockTimeout: boolean

    Returns void

events

  • get events(): ContractEventsInterface<readonly [{ anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }], ContractEvents<readonly [{ anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }]>>

  • Returns ContractEventsInterface<readonly [{ anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }], ContractEvents<readonly [{ anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes32; name: label; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: NewOwner; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: resolver; type: address }]; name: NewResolver; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: owner; type: address }]; name: Transfer; type: event }, { inputs: readonly [{ internalType: address; name: owner; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: owner; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: recordExists; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: resolver; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: ttl; outputs: readonly [{ internalType: uint64; name: ; type: uint64 }]; stateMutability: view; type: function }]>>

    • Returns all events that can be emitted by the ENS registry.

givenProvider

  • Will return the givenProvider if available.

    When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise undefined.


    Returns undefined | SupportedProviders<never>

handleRevert

  • get handleRevert(): boolean
  • set handleRevert(val: boolean): void
  • The handleRevert options property returns the revert reason string if enabled for the following methods:

    • web3.eth.sendTransaction()
    • web3.eth.call()
    • myContract.methods.myMethod().call()
    • myContract.methods.myMethod().send() Default is false.

    Note: At the moment handleRevert is only supported for sendTransaction and not for sendSignedTransaction


    Returns boolean

  • Will set the handleRevert


    Parameters

    • val: boolean

    Returns void

ignoreGasPricing

  • get ignoreGasPricing(): boolean
  • set ignoreGasPricing(val: boolean): void
  • Will get the ignoreGasPricing property. When true, the gasPrice, maxPriorityFeePerGas, and maxFeePerGas will not be autofilled in the transaction object. Useful when you want wallets to handle gas pricing.


    Returns boolean

  • Parameters

    • val: boolean

    Returns void

maxListenersWarningThreshold

  • get maxListenersWarningThreshold(): number
  • set maxListenersWarningThreshold(val: number): void
  • Returns number

  • Parameters

    • val: number

    Returns void

provider

  • Will return the current provider.

    @example
    const web3 = new Web3Context("http://localhost:8545");
    console.log(web3.provider);
    > HttpProvider {
    clientUrl: 'http://localhost:8545',
    httpProviderOptions: undefined
    }

    Returns undefined | Web3BaseProvider<API>

    Returns the current provider

  • Will set the current provider.

    @example
     const web3Context = new web3ContextContext("http://localhost:8545");
    web3Context.provider = "ws://localhost:8545";
    console.log(web3Context.provider);
    > WebSocketProvider {
    _eventEmitter: EventEmitter {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    ...
    }

    Parameters

    Returns void

requestManager

subscriptionManager

transactionBlockTimeout

  • get transactionBlockTimeout(): number
  • set transactionBlockTimeout(val: number): void
  • The transactionBlockTimeout is used over socket-based connections. This option defines the amount of new blocks it should wait until the first confirmation happens, otherwise the PromiEvent rejects with a timeout error. Default is 50.


    Returns number

  • Will set the transactionBlockTimeout.


    Parameters

    • val: number

    Returns void

transactionBuilder

  • Returns undefined | TransactionBuilder<unknown>

  • Parameters

    Returns void

transactionConfirmationBlocks

  • get transactionConfirmationBlocks(): number
  • set transactionConfirmationBlocks(val: number): void
  • This defines the number of blocks it requires until a transaction is considered confirmed. Default is 24.


    Returns number

  • Will set the transactionConfirmationBlocks.


    Parameters

    • val: number

    Returns void

transactionConfirmationPollingInterval

  • get transactionConfirmationPollingInterval(): undefined | number
  • set transactionConfirmationPollingInterval(val: undefined | number): void
  • Returns undefined | number

  • Parameters

    • val: undefined | number

    Returns void

transactionPollingInterval

  • get transactionPollingInterval(): number
  • set transactionPollingInterval(val: number): void
  • Used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. Default is 1000 ms.


    Returns number

  • Will set the transactionPollingInterval.


    Parameters

    • val: number

    Returns void

transactionPollingTimeout

  • get transactionPollingTimeout(): number
  • set transactionPollingTimeout(val: number): void
  • Used over HTTP connections. This option defines the number of seconds Web3 will wait for a receipt which confirms that a transaction was mined by the network. Note: If this method times out, the transaction may still be pending. Default is 750 seconds (12.5 minutes).


    Returns number

  • Will set the transactionPollingTimeout.


    Parameters

    • val: number

    Returns void

transactionReceiptPollingInterval

  • get transactionReceiptPollingInterval(): undefined | number
  • set transactionReceiptPollingInterval(val: undefined | number): void
  • The transactionPollingInterval is used over HTTP connections. This option defines the number of seconds between Web3 calls for a receipt which confirms that a transaction was mined by the network. Default is undefined


    Returns undefined | number

  • Will set the transactionReceiptPollingInterval


    Parameters

    • val: undefined | number

    Returns void

transactionSendTimeout

  • get transactionSendTimeout(): number
  • set transactionSendTimeout(val: number): void
  • The time used to wait for Ethereum Node to return the sent transaction result. Note: If the RPC call stuck at the Node and therefor timed-out, the transaction may still be pending or even mined by the Network. We recommend checking the pending transactions in such a case. Default is 750 seconds (12.5 minutes).


    Returns number

  • Will set the transactionSendTimeout.


    Parameters

    • val: number

    Returns void

transactionTypeParser

wallet

checkNetwork

  • checkNetwork(): Promise<string>
  • Checks if the current used network is synced and looks for ENS support there. Throws an error if not.

    @example
    console.log(await web3.eth.ens.checkNetwork());
    > '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'

    Returns Promise<string>

    • The address of the ENS registry if the network has been detected successfully

emit

  • emit<K>(eventName: K, params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • params: { CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

extend

  • This method allows extending the web3 modules. Note: This method is only for backward compatibility, and It is recommended to use Web3 v4 Plugin feature for extending web3.js functionality if you are developing something new.


    Parameters

    Returns this

getAddress

  • getAddress(ENSName: string, coinType?: number): Promise<MatchPrimitiveType<bytes, unknown>>
  • Resolves an ENS name to an Ethereum address.


    Parameters

    • ENSName: string

      The ENS name to resolve

    • optionalcoinType: number

      (Optional) The coin type, defaults to 60 (ETH)

    Returns Promise<MatchPrimitiveType<bytes, unknown>>

    • The Ethereum address of the given name
    const address = await web3.eth.ens.getAddress('ethereum.eth');
    console.log(address);
    > '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'

getContenthash

  • Returns the content hash object associated with an ENS node.

    @example
    const hash = await web3.eth.ens.getContenthash('ethereum.eth');
    console.log(hash);
    > 'QmaEBknbGT4bTQiQoe2VNgBJbRfygQGktnaW5TbuKixjYL'

    Parameters

    • ENSName: string

      The ENS name

    Returns Promise<MatchPrimitiveType<bytes, unknown>>

    • The content hash object associated with an ENS node

getContextObject

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getName

  • getName(ENSName: string, checkInterfaceSupport?: boolean): Promise<string>
  • Resolves the name of an ENS node.


    Parameters

    • ENSName: string

      The node to resolve

    • optionalcheckInterfaceSupport: boolean

    Returns Promise<string>

    • The name

getOwner

  • getOwner(name: string): Promise<unknown>
  • Returns the owner by the given name and current configured or detected Registry

    @example
    const owner = await web3.eth.ens.getOwner('ethereum.eth');

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

    • Returns the address of the owner of the name.

getPubkey

  • Returns the X and Y coordinates of the curve point for the public key.

    @example
    const key = await web3.eth.ens.getPubkey('ethereum.eth');
    console.log(key);
    > {
    "0": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "1": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "x": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "y": "0x0000000000000000000000000000000000000000000000000000000000000000"
    }

    Parameters

    • ENSName: string

      The ENS name

    Returns Promise<unknown[] & Record<1, MatchPrimitiveType<bytes32, unknown>> & Record<0, MatchPrimitiveType<bytes32, unknown>> & [] & Record<x, MatchPrimitiveType<bytes32, unknown>> & Record<y, MatchPrimitiveType<bytes32, unknown>>>

    • The X and Y coordinates of the curve point for the public key

getResolver

  • getResolver(name: string): Promise<Contract<readonly [{ anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: a; type: address }]; name: AddrChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint256; name: coinType; type: uint256 }, { indexed: false; internalType: bytes; name: newAddress; type: bytes }]; name: AddressChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: hash; type: bytes }]; name: ContenthashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }, { indexed: false; internalType: bytes; name: record; type: bytes }]; name: DNSRecordChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }]; name: DNSRecordDeleted; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }]; name: DNSZoneCleared; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: lastzonehash; type: bytes }, { indexed: false; internalType: bytes; name: zonehash; type: bytes }]; name: DNSZonehashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes4; name: interfaceID; type: bytes4 }, { indexed: false; internalType: address; name: implementer; type: address }]; name: InterfaceChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: string; name: name; type: string }]; name: NameChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes32; name: x; type: bytes32 }, { indexed: false; internalType: bytes32; name: y; type: bytes32 }]; name: PubkeyChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: string; name: indexedKey; type: string }, { indexed: false; internalType: string; name: key; type: string }]; name: TextChanged; type: event }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentTypes; type: uint256 }]; name: ABI; outputs: readonly [{ internalType: uint256; name: ; type: uint256 }, { internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: addr; outputs: readonly [{ internalType: address payable; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }]; name: addr; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: contenthash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }, { internalType: uint16; name: resource; type: uint16 }]; name: dnsRecord; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }]; name: hasDNSRecords; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }]; name: interfaceImplementer; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: account; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: name; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: pubkey; outputs: readonly [{ internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes4; name: interfaceID; type: bytes4 }]; name: supportsInterface; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }]; name: text; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: zonehash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: a; type: address }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }]>>
  • Returns the Resolver by the given address

    @example
    const resolver = await ens.getResolver('resolver');

    console.log(resolver.options.address);
    > '0x1234567890123456789012345678901234567890'

    Parameters

    • name: string

      The name of the ENS domain

    Returns Promise<Contract<readonly [{ anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: address; name: a; type: address }]; name: AddrChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: uint256; name: coinType; type: uint256 }, { indexed: false; internalType: bytes; name: newAddress; type: bytes }]; name: AddressChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: address; name: owner; type: address }, { indexed: true; internalType: address; name: operator; type: address }, { indexed: false; internalType: bool; name: approved; type: bool }]; name: ApprovalForAll; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: hash; type: bytes }]; name: ContenthashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }, { indexed: false; internalType: bytes; name: record; type: bytes }]; name: DNSRecordChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: name; type: bytes }, { indexed: false; internalType: uint16; name: resource; type: uint16 }]; name: DNSRecordDeleted; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }]; name: DNSZoneCleared; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes; name: lastzonehash; type: bytes }, { indexed: false; internalType: bytes; name: zonehash; type: bytes }]; name: DNSZonehashChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: bytes4; name: interfaceID; type: bytes4 }, { indexed: false; internalType: address; name: implementer; type: address }]; name: InterfaceChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: string; name: name; type: string }]; name: NameChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: false; internalType: bytes32; name: x; type: bytes32 }, { indexed: false; internalType: bytes32; name: y; type: bytes32 }]; name: PubkeyChanged; type: event }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: string; name: indexedKey; type: string }, { indexed: false; internalType: string; name: key; type: string }]; name: TextChanged; type: event }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentTypes; type: uint256 }]; name: ABI; outputs: readonly [{ internalType: uint256; name: ; type: uint256 }, { internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: addr; outputs: readonly [{ internalType: address payable; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }]; name: addr; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: contenthash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }, { internalType: uint16; name: resource; type: uint16 }]; name: dnsRecord; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: name; type: bytes32 }]; name: hasDNSRecords; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }]; name: interfaceImplementer; outputs: readonly [{ internalType: address; name: ; type: address }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: address; name: account; type: address }, { internalType: address; name: operator; type: address }]; name: isApprovedForAll; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: name; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: pubkey; outputs: readonly [{ internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes4; name: interfaceID; type: bytes4 }]; name: supportsInterface; outputs: readonly [{ internalType: bool; name: ; type: bool }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }]; name: text; outputs: readonly [{ internalType: string; name: ; type: string }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }]; name: zonehash; outputs: readonly [{ internalType: bytes; name: ; type: bytes }]; stateMutability: view; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: a; type: address }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }]>>

    • An contract instance of the resolver

getTTL

  • getTTL(name: string): Promise<unknown>
  • Returns the caching TTL (time-to-live) of an ENS name.

    @example
    const owner = await web3.eth.ens.getTTL('ethereum.eth');

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

    • Returns the caching TTL (time-to-live) of a name.

getText

  • getText(ENSNameOrAddr: string, key: string): Promise<string>

link

  • link<T>(parentContext: T): void
  • Link current context to another context.


    Type parameters

    Parameters

    • parentContext: T

    Returns void

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • off<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>

    Returns void

on

  • on<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>

    Returns void

once

  • once<K>(eventName: K, fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>): void
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ CONFIG_CHANGE: { name: handleRevert; newValue: boolean; oldValue: boolean } | { name: defaultAccount; newValue: undefined | string; oldValue: undefined | string } | { name: defaultBlock; newValue: BlockNumberOrTag; oldValue: BlockNumberOrTag } | { name: transactionSendTimeout; newValue: number; oldValue: number } | { name: transactionBlockTimeout; newValue: number; oldValue: number } | { name: transactionConfirmationBlocks; newValue: number; oldValue: number } | { name: transactionPollingInterval; newValue: number; oldValue: number } | { name: transactionPollingTimeout; newValue: number; oldValue: number } | { name: transactionReceiptPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: transactionConfirmationPollingInterval; newValue: undefined | number; oldValue: undefined | number } | { name: blockHeaderTimeout; newValue: number; oldValue: number } | { name: maxListenersWarningThreshold; newValue: number; oldValue: number } | { name: contractDataInputFill; newValue: input | data | both; oldValue: input | data | both } | { name: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { name: ignoreGasPricing; newValue: boolean; oldValue: boolean } | { name: defaultCommon; newValue: undefined | Common; oldValue: undefined | Common } | { name: defaultTransactionType; newValue: Numbers; oldValue: Numbers } | { name: defaultMaxPriorityFeePerGas; newValue: Numbers; oldValue: Numbers } | { name: enableExperimentalFeatures; newValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean }; oldValue: { useRpcCallSpecification: boolean; useSubscriptionWhenCheckingBlockTimeout: boolean } } | { name: transactionBuilder; newValue: undefined | TransactionBuilder<unknown>; oldValue: undefined | TransactionBuilder<unknown> } | { name: transactionTypeParser; newValue: undefined | TransactionTypeParser; oldValue: undefined | TransactionTypeParser } | { name: customTransactionSchema; newValue: undefined | CustomTransactionSchema; oldValue: undefined | CustomTransactionSchema } | { name: defaultReturnFormat; newValue: DataFormat; oldValue: DataFormat } }[K]>

    Returns void

recordExists

  • recordExists(name: string): Promise<unknown>
  • Returns true if the record exists

    @example
    const exists = await web3.eth.ens.recordExists('ethereum.eth');

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

    • Returns true if node exists in this ENS registry. This will return false for records that are in the legacy ENS registry but have not yet been migrated to the new one.

registerPlugin

  • Parameters

    Returns void

removeAllListeners

  • Returns EventEmitter

setAddress

  • Sets the address of an ENS name in his resolver.


    Parameters

    • name: string

      The ENS name

    • address: string

      The address to set

    • txConfig: PayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt
    const receipt = await ens.setAddress('web3js.eth','0xe2597eb05cf9a87eb1309e86750c903ec38e527e');

setConfig

  • Parameters

    Returns void

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

setProvider

setRequestManagerMiddleware

supportsInterface

  • supportsInterface(ENSName: string, interfaceId: string): Promise<MatchPrimitiveType<bool, unknown>>
  • Returns true if the related Resolver does support the given signature or interfaceId.

    @example
    const supports = await web3.eth.ens.supportsInterface('ethereum.eth', 'addr(bytes32');
    console.log(supports);
    > true

    Parameters

    • ENSName: string

      The ENS name

    • interfaceId: string

      The signature of the function or the interfaceId as described in the ENS documentation

    Returns Promise<MatchPrimitiveType<bool, unknown>>

    • true if the related Resolver does support the given signature or interfaceId.

use

  • Use to create new object of any type extended by Web3Context and link it to current context. This can be used to initiate a global context object and then use it to create new objects of any type extended by Web3Context.


    Type parameters

    Parameters

    Returns T

staticfromContextObject

constregistryAddresses

registryAddresses: {}

An object holding the addressed of the ENS registries on the different networks (mainnet, goerli).


Type declaration

  • [T string]: string

iban

iban:

Iban

Re-exports Iban

default

Renames and re-exports Iban

IbanOptions

IbanOptions: { identifier: string; institution: string }

An object that could hold the components for an Indirect IBAN (BBAN)


Type declaration

  • identifier: string
  • institution: string

personal

personal:

Personal

Re-exports Personal

default

Renames and re-exports Personal

Classes

LogsSubscription

LogsSubscription:

subscribe('logs')

Subscribes to incoming logs, filtered by the given options. If a valid numerical fromBlock options property is set, web3.js will retrieve logs beginning from this point, backfilling the response as necessary.

You can subscribe to logs matching a given filter object, which can take the following parameters:

  • fromBlock: (optional, default: 'latest') Integer block number, or 'latest' for the last mined block or 'pending', 'earliest' for not yet mined transactions.
  • address: (optional) Contract address or a list of addresses from which logs should originate.
  • topics: (optional) Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with or options.

constructor

readonlyargs

args: { address?: string | string[]; fromBlock?: BlockNumberOrTag; topics?: string[] }

Type declaration

  • optionalreadonlyaddress?: string | string[]
  • optionalreadonlyfromBlock?: BlockNumberOrTag
  • optionalreadonlytopics?: string[]

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

  • Returns undefined | BlockOutput

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: unknown): void
  • Parameters

    • data: unknown

    Returns void

emit

  • emit<K>(eventName: K, params: { data: LogsOutput } & CommonSubscriptionEvents[K]): void
  • Type parameters

    Parameters

    • eventName: K
    • params: { data: LogsOutput } & CommonSubscriptionEvents[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

on

once

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>

NewHeadsSubscription

NewHeadsSubscription:

subscribe('newHeads') ( same as subscribe('newBlockHeaders'))

Subscribes to incoming block headers. This can be used as timer to check for changes on the blockchain.

The structure of a returned block header is BlockHeaderOutput:

@example
(await web3.eth.subscribe('newHeads')).on( // 'newBlockHeaders' would work as well
'data',
console.log
);
>{
parentHash: '0x9e746a1d906b299def98c75b06f714d62dacadd567c7515d76eeaa8c8074c738',
sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
miner: '0x0000000000000000000000000000000000000000',
stateRoot: '0xe0f04b04861ecfa95e82a9310d6a7ef7aef8d7417f5209c182582bfb98a8e307',
transactionsRoot: '0x31ab4ea571a9e10d3a19aaed07d190595b1dfa34e03960c04293fec565dea536',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
difficulty: 2n,
number: 21n,
gasLimit: 11738125n,
gasUsed: 830006n,
timestamp: 1678797237n,
extraData: '0xd883010b02846765746888676f312e32302e31856c696e757800000000000000e0a6e93cf40e2e71a72e493272210c3f43738ccc7e7d7b14ffd51833797d896c09117e8dc4fbcbc969bd21b42e5af3e276a911524038c001b2109b63b8e0352601',
nonce: 0n
}

constructor

readonlyargs

args: any

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

  • Returns undefined | BlockOutput

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: unknown): void
  • Parameters

    • data: unknown

    Returns void

emit

  • emit<K>(eventName: K, params: { data: BlockHeaderOutput } & CommonSubscriptionEvents[K]): void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

on

once

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>

NewPendingTransactionsSubscription

NewPendingTransactionsSubscription:

subscribe('pendingTransactions')

Subscribes to incoming pending transactions.

You can subscribe to pending transactions by calling web3.eth.subscribe('pendingTransactions').

@example
(await web3.eth.subscribe('pendingTransactions')).on('data', console.log);

constructor

readonlyargs

args: any

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

  • Returns undefined | BlockOutput

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: unknown): void
  • Parameters

    • data: unknown

    Returns void

emit

  • emit<K>(eventName: K, params: { data: string } & CommonSubscriptionEvents[K]): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    • eventName: K
    • params: { data: string } & CommonSubscriptionEvents[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • off<K>(eventName: K, fn: Web3EventCallback<{ data: string } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    Returns void

on

  • on<K>(eventName: K, fn: Web3EventCallback<{ data: string } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    Returns void

once

  • once<K>(eventName: K, fn: Web3EventCallback<{ data: string } & CommonSubscriptionEvents[K]>): void
  • Type parameters

    • K: Web3EventKey<{ data: string } & CommonSubscriptionEvents>

    Parameters

    Returns void

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>

SendTxHelper

SendTxHelper<ReturnFormat, ResolveType, TxType>:

constructor

checkRevertBeforeSending

emitConfirmation

  • emitConfirmation(__namedParameters: { customTransactionReceiptSchema?: Schema; receipt: ResolveType; transactionHash: string }): void
  • Parameters

    • __namedParameters: { customTransactionReceiptSchema?: Schema; receipt: ResolveType; transactionHash: string }
      • optionalcustomTransactionReceiptSchema: Schema
      • receipt: ResolveType
      • transactionHash: string

    Returns void

emitReceipt

  • emitReceipt(receipt: ResolveType): void
  • Parameters

    • receipt: ResolveType

    Returns void

emitSending

  • emitSending(tx: string | TxType): void
  • Parameters

    • tx: string | TxType

    Returns void

emitSent

  • emitSent(tx: string | TxType): void
  • Parameters

    • tx: string | TxType

    Returns void

emitTransactionHash

  • emitTransactionHash(hash: string & Uint8Array): void
  • Parameters

    • hash: string & Uint8Array

    Returns void

getReceiptWithEvents

handleError

  • handleError(__namedParameters: { error: unknown; tx: TransactionCall }): Promise<unknown>

handleResolve

  • handleResolve(__namedParameters: { receipt: ResolveType; tx: TransactionCall }): Promise<ResolveType>

populateGasPrice

  • populateGasPrice(__namedParameters: { transaction: TxType; transactionFormatted: TxType }): Promise<TxType>
  • Parameters

    • __namedParameters: { transaction: TxType; transactionFormatted: TxType }
      • transaction: TxType
      • transactionFormatted: TxType

    Returns Promise<TxType>

signAndSend

  • signAndSend(__namedParameters: { tx: TxType; wallet: undefined | Web3BaseWalletAccount }): Promise<string>

SyncingSubscription

SyncingSubscription:

subscribe('syncing')

Subscribe to syncing events. This will return true when the node is syncing and when it’s finished syncing will return false, for the changed event.

@example
(await web3.eth.subscribe('syncing')).on('changed', console.log);
> `true` // when syncing

(await web3.eth.subscribe('syncing')).on('data', console.log);
> {
startingBlock: 0,
currentBlock: 0,
highestBlock: 0,
pulledStates: 0,
knownStates: 0
}

constructor

readonlyargs

args: any

id

  • get id(): undefined | string
  • Returns undefined | string

lastBlock

  • Returns undefined | BlockOutput

_processSubscriptionError

  • _processSubscriptionError(error: Error): void
  • Parameters

    • error: Error

    Returns void

_processSubscriptionResult

  • _processSubscriptionResult(data: boolean | { status: SyncOutput; syncing: boolean }): void
  • Parameters

    Returns void

emit

  • emit<K>(eventName: K, params: { changed: boolean; data: SyncOutput } & CommonSubscriptionEvents[K]): void
  • Type parameters

    Parameters

    • eventName: K
    • params: { changed: boolean; data: SyncOutput } & CommonSubscriptionEvents[K]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount<K>(eventName: K): number
  • Type parameters

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): (...args: any[]) => void[]
  • Type parameters

    Parameters

    • eventName: K

    Returns (...args: any[]) => void[]

off

  • Type parameters

    Parameters

    Returns void

on

  • Type parameters

    Parameters

    Returns void

once

  • Type parameters

    Parameters

    Returns void

processSubscriptionData

removeAllListeners

  • Returns EventEmitter

resubscribe

  • resubscribe(): Promise<void>
  • Returns Promise<void>

sendSubscriptionRequest

  • sendSubscriptionRequest(): Promise<string>
  • Returns Promise<string>

sendUnsubscribeRequest

  • sendUnsubscribeRequest(): Promise<void>
  • Returns Promise<void>

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

  • subscribe(): Promise<string>
  • Returns Promise<string>

unsubscribe

  • unsubscribe(): Promise<void>
  • Returns Promise<void>

Interfaces

RevertReason

RevertReason:

optionaldata

data?: string

reason

reason: string

optionalsignature

signature?: string

RevertReasonWithCustomError

RevertReasonWithCustomError:

customErrorArguments

customErrorArguments: Record<string, unknown>

customErrorDecodedSignature

customErrorDecodedSignature: string

customErrorName

customErrorName: string

optionaldata

data?: string

reason

reason: string

optionalsignature

signature?: string

SendSignedTransactionOptions

SendSignedTransactionOptions<ResolveType>:

Type parameters

optionalcheckRevertBeforeSending

checkRevertBeforeSending?: boolean

optionalcontractAbi

contractAbi?: ContractAbi

optionaltransactionResolver

transactionResolver?: (receipt: TransactionReceipt) => ResolveType

Type declaration

SendTransactionOptions

SendTransactionOptions<ResolveType>:

Type parameters

optionalcheckRevertBeforeSending

checkRevertBeforeSending?: boolean

optionalcontractAbi

contractAbi?: ContractAbi

optionalignoreFillingGasLimit

ignoreFillingGasLimit?: boolean

optionalignoreGasPricing

ignoreGasPricing?: boolean

optionaltransactionResolver

transactionResolver?: (receipt: TransactionReceipt) => ResolveType

Type declaration

TransactionMiddleware

TransactionMiddleware:

processTransaction

Type Aliases

CustomTransactionSchema

CustomTransactionSchema: { properties: Record<string, Schema>; type: string }

Type declaration

  • properties: Record<string, Schema>
  • type: string

InternalTransaction

InternalTransaction: FormatType<Transaction, typeof ETH_DATA_FORMAT>

RegisteredSubscription

RegisteredSubscription: { logs: typeof LogsSubscription; newBlockHeaders: typeof NewHeadsSubscription; newHeads: typeof NewHeadsSubscription; newPendingTransactions: typeof NewPendingTransactionsSubscription; pendingTransactions: typeof NewPendingTransactionsSubscription; syncing: typeof SyncingSubscription }

Type declaration

SendSignedTransactionEvents

SendSignedTransactionEvents<ReturnFormat>: SendTransactionEventsBase<ReturnFormat, Bytes>

Type parameters

SendTransactionEvents

SendTransactionEvents<ReturnFormat>: SendTransactionEventsBase<ReturnFormat, Transaction>

Type parameters

SendTransactionEventsBase

SendTransactionEventsBase<ReturnFormat, TxType>: { confirmation: { confirmations: FormatType<Numbers, ReturnFormat>; latestBlockHash: FormatType<Bytes, ReturnFormat>; receipt: FormatType<TransactionReceipt, ReturnFormat> }; error: TransactionRevertedWithoutReasonError<FormatType<TransactionReceipt, ReturnFormat>> | TransactionRevertInstructionError<FormatType<TransactionReceipt, ReturnFormat>> | TransactionRevertWithCustomError<FormatType<TransactionReceipt, ReturnFormat>> | TransactionPollingTimeoutError | InvalidResponseError | ContractExecutionError; receipt: FormatType<TransactionReceipt, ReturnFormat>; sending: FormatType<TxType, typeof ETH_DATA_FORMAT>; sent: FormatType<TxType, typeof ETH_DATA_FORMAT>; transactionHash: FormatType<Bytes, ReturnFormat> }

Type parameters

Type declaration

TransactionMiddlewareData

Variables

constALL_EVENTS

ALL_EVENTS: ALLEVENTS = "ALLEVENTS"

constALL_EVENTS_ABI

ALL_EVENTS_ABI: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }

constNUMBER_DATA_FORMAT

NUMBER_DATA_FORMAT: { bytes: FMT_BYTES.HEX; number: FMT_NUMBER.NUMBER }

Type declaration

  • readonlybytes: FMT_BYTES.HEX
  • readonlynumber: FMT_NUMBER.NUMBER

constSignatureObjectSchema

SignatureObjectSchema: { properties: { message: { format: string }; messageHash: { format: string }; r: { format: string }; s: { format: string }; signature: { format: string }; v: { format: string } }; type: string }

Type declaration

  • properties: { message: { format: string }; messageHash: { format: string }; r: { format: string }; s: { format: string }; signature: { format: string }; v: { format: string } }
    • message: { format: string }
      • format: string
    • messageHash: { format: string }
      • format: string
    • r: { format: string }
      • format: string
    • s: { format: string }
      • format: string
    • signature: { format: string }
      • format: string
    • v: { format: string }
      • format: string
  • type: string

constaccessListItemSchema

accessListItemSchema: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }

Type declaration

  • properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }
    • address: { format: string }
      • format: string
    • storageKeys: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
  • type: string

constaccessListResultSchema

accessListResultSchema: { properties: { accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }; gasUsed: { type: string } }; type: string }

Type declaration

  • properties: { accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }; gasUsed: { type: string } }
    • accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }
      • items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }
        • properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }
          • address: { format: string }
            • format: string
          • storageKeys: { items: { format: string }; type: string }
            • items: { format: string }
              • format: string
            • type: string
        • type: string
      • type: string
    • gasUsed: { type: string }
      • type: string
  • type: string

constaccessListSchema

accessListSchema: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }

Type declaration

  • items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }
    • properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }
      • address: { format: string }
        • format: string
      • storageKeys: { items: { format: string }; type: string }
        • items: { format: string }
          • format: string
        • type: string
    • type: string
  • type: string

constaccountSchema

accountSchema: { properties: { accountProof: { items: { format: string }; type: string }; balance: { format: string }; codeHash: { format: string }; nonce: { format: string }; storageHash: { format: string }; storageProof: { items: { properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }; type: string }; type: string } }; type: string }

Type declaration

  • properties: { accountProof: { items: { format: string }; type: string }; balance: { format: string }; codeHash: { format: string }; nonce: { format: string }; storageHash: { format: string }; storageProof: { items: { properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }; type: string }; type: string } }
    • accountProof: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • balance: { format: string }
      • format: string
    • codeHash: { format: string }
      • format: string
    • nonce: { format: string }
      • format: string
    • storageHash: { format: string }
      • format: string
    • storageProof: { items: { properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }; type: string }; type: string }
      • items: { properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }; type: string }
        • properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }
          • key: { format: string }
            • format: string
          • proof: { items: { format: string }; type: string }
            • items: { format: string }
              • format: string
            • type: string
          • value: { format: string }
            • format: string
        • type: string
      • type: string
  • type: string

constblockHeaderSchema

blockHeaderSchema: { properties: { author: { format: string }; baseFeePerGas: { format: string }; blobGasUsed: { format: string }; difficulty: { format: string }; excessBlobGas: { format: string }; excessDataGas: { format: string }; extraData: { format: string }; gasLimit: { format: string }; gasUsed: { format: string }; hash: { format: string }; logsBloom: { format: string }; miner: { format: string }; mixHash: { format: string }; nonce: { format: string }; number: { format: string }; parentBeaconBlockRoot: { format: string }; parentHash: { format: string }; receiptsRoot: { format: string }; sha3Uncles: { format: string }; size: { format: string }; stateRoot: { format: string }; timestamp: { format: string }; totalDifficulty: { format: string }; transactions: { items: { format: string }; type: string }; transactionsRoot: { format: string }; uncles: { items: { format: string }; type: string }; withdrawals: { items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }; type: string }; withdrawalsRoot: { format: string } }; type: string }

Type declaration

  • properties: { author: { format: string }; baseFeePerGas: { format: string }; blobGasUsed: { format: string }; difficulty: { format: string }; excessBlobGas: { format: string }; excessDataGas: { format: string }; extraData: { format: string }; gasLimit: { format: string }; gasUsed: { format: string }; hash: { format: string }; logsBloom: { format: string }; miner: { format: string }; mixHash: { format: string }; nonce: { format: string }; number: { format: string }; parentBeaconBlockRoot: { format: string }; parentHash: { format: string }; receiptsRoot: { format: string }; sha3Uncles: { format: string }; size: { format: string }; stateRoot: { format: string }; timestamp: { format: string }; totalDifficulty: { format: string }; transactions: { items: { format: string }; type: string }; transactionsRoot: { format: string }; uncles: { items: { format: string }; type: string }; withdrawals: { items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }; type: string }; withdrawalsRoot: { format: string } }
    • author: { format: string }
      • format: string
    • baseFeePerGas: { format: string }
      • format: string
    • blobGasUsed: { format: string }
      • format: string
    • difficulty: { format: string }
      • format: string
    • excessBlobGas: { format: string }
      • format: string
    • excessDataGas: { format: string }
      • format: string
    • extraData: { format: string }
      • format: string
    • gasLimit: { format: string }
      • format: string
    • gasUsed: { format: string }
      • format: string
    • hash: { format: string }
      • format: string
    • logsBloom: { format: string }
      • format: string
    • miner: { format: string }
      • format: string
    • mixHash: { format: string }
      • format: string
    • nonce: { format: string }
      • format: string
    • number: { format: string }
      • format: string
    • parentBeaconBlockRoot: { format: string }
      • format: string
    • parentHash: { format: string }
      • format: string
    • receiptsRoot: { format: string }
      • format: string
    • sha3Uncles: { format: string }
      • format: string
    • size: { format: string }
      • format: string
    • stateRoot: { format: string }
      • format: string
    • timestamp: { format: string }
      • format: string
    • totalDifficulty: { format: string }
      • format: string
    • transactions: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • transactionsRoot: { format: string }
      • format: string
    • uncles: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • withdrawals: { items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }; type: string }
      • items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }
        • properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }
          • address: { format: string }
            • format: string
          • amount: { format: string }
            • format: string
          • index: { format: string }
            • format: string
          • validatorIndex: { format: string }
            • format: string
        • type: string
      • type: string
    • withdrawalsRoot: { format: string }
      • format: string
  • type: string

constblockSchema

blockSchema: { properties: { baseFeePerGas: { format: string }; blobGasUsed: { format: string }; difficulty: { format: string }; excessBlobGas: { format: string }; extraData: { format: string }; gasLimit: { format: string }; gasUsed: { format: string }; hash: { format: string }; logsBloom: { format: string }; miner: { format: string }; mixHash: { format: string }; nonce: { format: string }; number: { format: string }; parentBeaconBlockRoot: { format: string }; parentHash: { format: string }; receiptsRoot: { format: string }; sha3Uncles: { format: string }; size: { format: string }; stateRoot: { format: string }; timestamp: { format: string }; totalDifficulty: { format: string }; transactions: { oneOf: ({ items: { format?: undefined; properties: { accessList: { items: { properties: ...; type: ... }; type: string }; blockHash: { format: string }; blockNumber: { format: string }; chain: { enum: ...[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: ...; customChain: ...; hardfork: ... }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: ...[]; type: string }; hash: { format: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ...[] }; transactionIndex: { format: string }; type: { format: string }; v: { format: string }; value: { format: string } }; type: string }; type: string } | { items: { format: string }; type: string })[] }; transactionsRoot: { format: string }; uncles: { items: { format: string }; type: string }; withdrawals: { items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }; type: string }; withdrawalsRoot: { format: string } }; type: string }

Type declaration

  • properties: { baseFeePerGas: { format: string }; blobGasUsed: { format: string }; difficulty: { format: string }; excessBlobGas: { format: string }; extraData: { format: string }; gasLimit: { format: string }; gasUsed: { format: string }; hash: { format: string }; logsBloom: { format: string }; miner: { format: string }; mixHash: { format: string }; nonce: { format: string }; number: { format: string }; parentBeaconBlockRoot: { format: string }; parentHash: { format: string }; receiptsRoot: { format: string }; sha3Uncles: { format: string }; size: { format: string }; stateRoot: { format: string }; timestamp: { format: string }; totalDifficulty: { format: string }; transactions: { oneOf: ({ items: { format?: undefined; properties: { accessList: { items: { properties: ...; type: ... }; type: string }; blockHash: { format: string }; blockNumber: { format: string }; chain: { enum: ...[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: ...; customChain: ...; hardfork: ... }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: ...[]; type: string }; hash: { format: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ...[] }; transactionIndex: { format: string }; type: { format: string }; v: { format: string }; value: { format: string } }; type: string }; type: string } | { items: { format: string }; type: string })[] }; transactionsRoot: { format: string }; uncles: { items: { format: string }; type: string }; withdrawals: { items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }; type: string }; withdrawalsRoot: { format: string } }
    • baseFeePerGas: { format: string }
      • format: string
    • blobGasUsed: { format: string }
      • format: string
    • difficulty: { format: string }
      • format: string
    • excessBlobGas: { format: string }
      • format: string
    • extraData: { format: string }
      • format: string
    • gasLimit: { format: string }
      • format: string
    • gasUsed: { format: string }
      • format: string
    • hash: { format: string }
      • format: string
    • logsBloom: { format: string }
      • format: string
    • miner: { format: string }
      • format: string
    • mixHash: { format: string }
      • format: string
    • nonce: { format: string }
      • format: string
    • number: { format: string }
      • format: string
    • parentBeaconBlockRoot: { format: string }
      • format: string
    • parentHash: { format: string }
      • format: string
    • receiptsRoot: { format: string }
      • format: string
    • sha3Uncles: { format: string }
      • format: string
    • size: { format: string }
      • format: string
    • stateRoot: { format: string }
      • format: string
    • timestamp: { format: string }
      • format: string
    • totalDifficulty: { format: string }
      • format: string
    • transactions: { oneOf: ({ items: { format?: undefined; properties: { accessList: { items: { properties: ...; type: ... }; type: string }; blockHash: { format: string }; blockNumber: { format: string }; chain: { enum: ...[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: ...; customChain: ...; hardfork: ... }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: ...[]; type: string }; hash: { format: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ...[] }; transactionIndex: { format: string }; type: { format: string }; v: { format: string }; value: { format: string } }; type: string }; type: string } | { items: { format: string }; type: string })[] }
      • oneOf: ({ items: { format?: undefined; properties: { accessList: { items: { properties: ...; type: ... }; type: string }; blockHash: { format: string }; blockNumber: { format: string }; chain: { enum: ...[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: ...; customChain: ...; hardfork: ... }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: ...[]; type: string }; hash: { format: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ...[] }; transactionIndex: { format: string }; type: { format: string }; v: { format: string }; value: { format: string } }; type: string }; type: string } | { items: { format: string }; type: string })[]
    • transactionsRoot: { format: string }
      • format: string
    • uncles: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • withdrawals: { items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }; type: string }
      • items: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }
        • properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }
          • address: { format: string }
            • format: string
          • amount: { format: string }
            • format: string
          • index: { format: string }
            • format: string
          • validatorIndex: { format: string }
            • format: string
        • type: string
      • type: string
    • withdrawalsRoot: { format: string }
      • format: string
  • type: string

constchainSchema

chainSchema: { enum: string[]; type: string }

Type declaration

  • enum: string[]
  • type: string

constcustomChainSchema

customChainSchema: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }

Type declaration

  • properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }
    • chainId: { format: string }
      • format: string
    • name: { format: string }
      • format: string
    • networkId: { format: string }
      • format: string
  • type: string

constfeeHistorySchema

feeHistorySchema: { properties: { baseFeePerGas: { items: { format: string }; type: string }; gasUsedRatio: { items: { type: string }; type: string }; oldestBlock: { format: string }; reward: { items: { items: { format: string }; type: string }; type: string } }; type: string }

Type declaration

  • properties: { baseFeePerGas: { items: { format: string }; type: string }; gasUsedRatio: { items: { type: string }; type: string }; oldestBlock: { format: string }; reward: { items: { items: { format: string }; type: string }; type: string } }
    • baseFeePerGas: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • gasUsedRatio: { items: { type: string }; type: string }
      • items: { type: string }
        • type: string
      • type: string
    • oldestBlock: { format: string }
      • format: string
    • reward: { items: { items: { format: string }; type: string }; type: string }
      • items: { items: { format: string }; type: string }
        • items: { format: string }
          • format: string
        • type: string
      • type: string
  • type: string

consthardforkSchema

hardforkSchema: { enum: string[]; type: string }

Type declaration

  • enum: string[]
  • type: string

constlogSchema

logSchema: { properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }; type: string }

Type declaration

  • properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }
    • address: { format: string }
      • format: string
    • blockHash: { format: string }
      • format: string
    • blockNumber: { format: string }
      • format: string
    • data: { format: string }
      • format: string
    • logIndex: { format: string }
      • format: string
    • removed: { format: string }
      • format: string
    • topics: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • transactionHash: { format: string }
      • format: string
    • transactionIndex: { format: string }
      • format: string
  • type: string

constregisteredSubscriptions

registeredSubscriptions: { logs: typeof LogsSubscription; newBlockHeaders: typeof NewHeadsSubscription; newHeads: typeof NewHeadsSubscription; newPendingTransactions: typeof NewPendingTransactionsSubscription; pendingTransactions: typeof NewPendingTransactionsSubscription; syncing: typeof SyncingSubscription }

Type declaration

conststorageProofSchema

storageProofSchema: { properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }; type: string }

Type declaration

  • properties: { key: { format: string }; proof: { items: { format: string }; type: string }; value: { format: string } }
    • key: { format: string }
      • format: string
    • proof: { items: { format: string }; type: string }
      • items: { format: string }
        • format: string
      • type: string
    • value: { format: string }
      • format: string
  • type: string

constsyncSchema

syncSchema: { properties: { currentBlock: { format: string }; highestBlock: { format: string }; knownStates: { format: string }; pulledStates: { format: string }; startingBlock: { format: string } }; type: string }

Type declaration

  • properties: { currentBlock: { format: string }; highestBlock: { format: string }; knownStates: { format: string }; pulledStates: { format: string }; startingBlock: { format: string } }
    • currentBlock: { format: string }
      • format: string
    • highestBlock: { format: string }
      • format: string
    • knownStates: { format: string }
      • format: string
    • pulledStates: { format: string }
      • format: string
    • startingBlock: { format: string }
      • format: string
  • type: string

consttransactionInfoSchema

transactionInfoSchema: { properties: { accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }; blockHash: { format: string }; blockNumber: { format: string }; chain: { enum: string[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: string[]; type: string }; hash: { format: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[] }; transactionIndex: { format: string }; type: { format: string }; v: { format: string }; value: { format: string } }; type: string }

Type declaration

  • properties: { accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }; blockHash: { format: string }; blockNumber: { format: string }; chain: { enum: string[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: string[]; type: string }; hash: { format: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[] }; transactionIndex: { format: string }; type: { format: string }; v: { format: string }; value: { format: string } }
    • accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }
      • items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }
        • properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }
          • address: { format: string }
            • format: string
          • storageKeys: { items: { format: string }; type: string }
            • items: { format: string }
              • format: string
            • type: string
        • type: string
      • type: string
    • blockHash: { format: string }
      • format: string
    • blockNumber: { format: string }
      • format: string
    • chain: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • chainId: { format: string }
      • format: string
    • common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }
      • properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }
        • baseChain: { enum: string[]; type: string }
          • enum: string[]
          • type: string
        • customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }
          • properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }
            • chainId: { format: string }
              • format: string
            • name: { format: string }
              • format: string
            • networkId: { format: string }
              • format: string
          • type: string
        • hardfork: { enum: string[]; type: string }
          • enum: string[]
          • type: string
      • type: string
    • data: { format: string }
      • format: string
    • effectiveGasPrice: { format: string }
      • format: string
    • from: { format: string }
      • format: string
    • gas: { format: string }
      • format: string
    • gasLimit: { format: string }
      • format: string
    • gasPrice: { format: string }
      • format: string
    • hardfork: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • hash: { format: string }
      • format: string
    • input: { format: string }
      • format: string
    • maxFeePerGas: { format: string }
      • format: string
    • maxPriorityFeePerGas: { format: string }
      • format: string
    • networkId: { format: string }
      • format: string
    • nonce: { format: string }
      • format: string
    • r: { format: string }
      • format: string
    • s: { format: string }
      • format: string
    • to: { oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[] }
      • oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[]
    • transactionIndex: { format: string }
      • format: string
    • type: { format: string }
      • format: string
    • v: { format: string }
      • format: string
    • value: { format: string }
      • format: string
  • type: string

consttransactionReceiptSchema

transactionReceiptSchema: { properties: { blockHash: { format: string }; blockNumber: { format: string }; contractAddress: { format: string }; cumulativeGasUsed: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gasUsed: { format: string }; logs: { items: { properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }; type: string }; type: string }; logsBloom: { format: string }; root: { format: string }; status: { format: string }; to: { format: string }; transactionHash: { format: string }; transactionIndex: { format: string }; type: { format: string } }; type: string }

Type declaration

  • properties: { blockHash: { format: string }; blockNumber: { format: string }; contractAddress: { format: string }; cumulativeGasUsed: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gasUsed: { format: string }; logs: { items: { properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }; type: string }; type: string }; logsBloom: { format: string }; root: { format: string }; status: { format: string }; to: { format: string }; transactionHash: { format: string }; transactionIndex: { format: string }; type: { format: string } }
    • blockHash: { format: string }
      • format: string
    • blockNumber: { format: string }
      • format: string
    • contractAddress: { format: string }
      • format: string
    • cumulativeGasUsed: { format: string }
      • format: string
    • effectiveGasPrice: { format: string }
      • format: string
    • from: { format: string }
      • format: string
    • gasUsed: { format: string }
      • format: string
    • logs: { items: { properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }; type: string }; type: string }
      • items: { properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }; type: string }
        • properties: { address: { format: string }; blockHash: { format: string }; blockNumber: { format: string }; data: { format: string }; logIndex: { format: string }; removed: { format: string }; topics: { items: { format: string }; type: string }; transactionHash: { format: string }; transactionIndex: { format: string } }
          • address: { format: string }
            • format: string
          • blockHash: { format: string }
            • format: string
          • blockNumber: { format: string }
            • format: string
          • data: { format: string }
            • format: string
          • logIndex: { format: string }
            • format: string
          • removed: { format: string }
            • format: string
          • topics: { items: { format: string }; type: string }
            • items: { format: string }
              • format: string
            • type: string
          • transactionHash: { format: string }
            • format: string
          • transactionIndex: { format: string }
            • format: string
        • type: string
      • type: string
    • logsBloom: { format: string }
      • format: string
    • root: { format: string }
      • format: string
    • status: { format: string }
      • format: string
    • to: { format: string }
      • format: string
    • transactionHash: { format: string }
      • format: string
    • transactionIndex: { format: string }
      • format: string
    • type: { format: string }
      • format: string
  • type: string

consttransactionSchema

transactionSchema: { properties: { accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }; chain: { enum: string[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: string[]; type: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[] }; type: { format: string }; v: { format: string }; value: { format: string } }; type: string }

Type declaration

  • properties: { accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }; chain: { enum: string[]; type: string }; chainId: { format: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { format: string }; effectiveGasPrice: { format: string }; from: { format: string }; gas: { format: string }; gasLimit: { format: string }; gasPrice: { format: string }; hardfork: { enum: string[]; type: string }; input: { format: string }; maxFeePerGas: { format: string }; maxPriorityFeePerGas: { format: string }; networkId: { format: string }; nonce: { format: string }; r: { format: string }; s: { format: string }; to: { oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[] }; type: { format: string }; v: { format: string }; value: { format: string } }
    • accessList: { items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }; type: string }
      • items: { properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }; type: string }
        • properties: { address: { format: string }; storageKeys: { items: { format: string }; type: string } }
          • address: { format: string }
            • format: string
          • storageKeys: { items: { format: string }; type: string }
            • items: { format: string }
              • format: string
            • type: string
        • type: string
      • type: string
    • chain: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • chainId: { format: string }
      • format: string
    • common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }
      • properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }; hardfork: { enum: string[]; type: string } }
        • baseChain: { enum: string[]; type: string }
          • enum: string[]
          • type: string
        • customChain: { properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }; type: string }
          • properties: { chainId: { format: string }; name: { format: string }; networkId: { format: string } }
            • chainId: { format: string }
              • format: string
            • name: { format: string }
              • format: string
            • networkId: { format: string }
              • format: string
          • type: string
        • hardfork: { enum: string[]; type: string }
          • enum: string[]
          • type: string
      • type: string
    • data: { format: string }
      • format: string
    • effectiveGasPrice: { format: string }
      • format: string
    • from: { format: string }
      • format: string
    • gas: { format: string }
      • format: string
    • gasLimit: { format: string }
      • format: string
    • gasPrice: { format: string }
      • format: string
    • hardfork: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • input: { format: string }
      • format: string
    • maxFeePerGas: { format: string }
      • format: string
    • maxPriorityFeePerGas: { format: string }
      • format: string
    • networkId: { format: string }
      • format: string
    • nonce: { format: string }
      • format: string
    • r: { format: string }
      • format: string
    • s: { format: string }
      • format: string
    • to: { oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[] }
      • oneOf: ({ format: string; type?: undefined } | { format?: undefined; type: string })[]
    • type: { format: string }
      • format: string
    • v: { format: string }
      • format: string
    • value: { format: string }
      • format: string
  • type: string

constwithdrawalsSchema

withdrawalsSchema: { properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }; type: string }

Type declaration

  • properties: { address: { format: string }; amount: { format: string }; index: { format: string }; validatorIndex: { format: string } }
    • address: { format: string }
      • format: string
    • amount: { format: string }
      • format: string
    • index: { format: string }
      • format: string
    • validatorIndex: { format: string }
      • format: string
  • type: string

Functions

call

createAccessList

detectTransactionType

  • detectTransactionType(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }, web3Context?: Web3Context<EthExecutionAPI, any>): undefined | string
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string
    • optionalweb3Context: Web3Context<EthExecutionAPI, any>

    Returns undefined | string

estimateGas

formatTransaction

getBalance

getBlock

  • getBlock<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Uint8Array, hydrated: undefined | boolean, returnFormat: ReturnFormat): Promise<{ baseFeePerGas?: NumberTypes[ReturnFormat[number]]; difficulty?: NumberTypes[ReturnFormat[number]]; extraData: ByteTypes[ReturnFormat[bytes]]; gasLimit: NumberTypes[ReturnFormat[number]]; gasUsed: NumberTypes[ReturnFormat[number]]; hash?: ByteTypes[ReturnFormat[bytes]]; logsBloom?: ByteTypes[ReturnFormat[bytes]]; miner: ByteTypes[ReturnFormat[bytes]]; mixHash: ByteTypes[ReturnFormat[bytes]]; nonce: NumberTypes[ReturnFormat[number]]; number: NumberTypes[ReturnFormat[number]]; parentHash: ByteTypes[ReturnFormat[bytes]]; receiptsRoot: ByteTypes[ReturnFormat[bytes]]; sha3Uncles: ByteTypes[ReturnFormat[bytes]]; size: NumberTypes[ReturnFormat[number]]; stateRoot: ByteTypes[ReturnFormat[bytes]]; timestamp: NumberTypes[ReturnFormat[number]]; totalDifficulty: NumberTypes[ReturnFormat[number]]; transactions: string[] | { accessList?: { address?: string; storageKeys?: string[] }[]; blockHash?: ByteTypes[ReturnFormat[bytes]]; blockNumber?: NumberTypes[ReturnFormat[number]]; chain?: ValidChains; chainId?: NumberTypes[ReturnFormat[number]]; common?: { baseChain?: ValidChains; customChain: { chainId: NumberTypes[ReturnFormat[number]]; name?: string; networkId: NumberTypes[ReturnFormat[number]] }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: ByteTypes[ReturnFormat[bytes]]; from: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; hash: ByteTypes[ReturnFormat[bytes]]; input?: ByteTypes[ReturnFormat[bytes]]; maxFeePerGas?: NumberTypes[ReturnFormat[number]]; maxPriorityFeePerGas?: NumberTypes[ReturnFormat[number]]; networkId?: NumberTypes[ReturnFormat[number]]; nonce?: NumberTypes[ReturnFormat[number]]; r?: ByteTypes[ReturnFormat[bytes]]; s?: ByteTypes[ReturnFormat[bytes]]; to?: string | null; transactionIndex?: NumberTypes[ReturnFormat[number]]; type?: NumberTypes[ReturnFormat[number]]; v?: NumberTypes[ReturnFormat[number]]; value?: NumberTypes[ReturnFormat[number]]; yParity?: string }[]; transactionsRoot: ByteTypes[ReturnFormat[bytes]]; uncles: string[] }>
  • View additional documentations here: Web3Eth.getBlock


    Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • block: undefined | string | number | bigint | Uint8Array
    • hydrated: undefined | boolean
    • returnFormat: ReturnFormat

    Returns Promise<{ baseFeePerGas?: NumberTypes[ReturnFormat[number]]; difficulty?: NumberTypes[ReturnFormat[number]]; extraData: ByteTypes[ReturnFormat[bytes]]; gasLimit: NumberTypes[ReturnFormat[number]]; gasUsed: NumberTypes[ReturnFormat[number]]; hash?: ByteTypes[ReturnFormat[bytes]]; logsBloom?: ByteTypes[ReturnFormat[bytes]]; miner: ByteTypes[ReturnFormat[bytes]]; mixHash: ByteTypes[ReturnFormat[bytes]]; nonce: NumberTypes[ReturnFormat[number]]; number: NumberTypes[ReturnFormat[number]]; parentHash: ByteTypes[ReturnFormat[bytes]]; receiptsRoot: ByteTypes[ReturnFormat[bytes]]; sha3Uncles: ByteTypes[ReturnFormat[bytes]]; size: NumberTypes[ReturnFormat[number]]; stateRoot: ByteTypes[ReturnFormat[bytes]]; timestamp: NumberTypes[ReturnFormat[number]]; totalDifficulty: NumberTypes[ReturnFormat[number]]; transactions: string[] | { accessList?: { address?: string; storageKeys?: string[] }[]; blockHash?: ByteTypes[ReturnFormat[bytes]]; blockNumber?: NumberTypes[ReturnFormat[number]]; chain?: ValidChains; chainId?: NumberTypes[ReturnFormat[number]]; common?: { baseChain?: ValidChains; customChain: { chainId: NumberTypes[ReturnFormat[number]]; name?: string; networkId: NumberTypes[ReturnFormat[number]] }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: ByteTypes[ReturnFormat[bytes]]; from: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; hash: ByteTypes[ReturnFormat[bytes]]; input?: ByteTypes[ReturnFormat[bytes]]; maxFeePerGas?: NumberTypes[ReturnFormat[number]]; maxPriorityFeePerGas?: NumberTypes[ReturnFormat[number]]; networkId?: NumberTypes[ReturnFormat[number]]; nonce?: NumberTypes[ReturnFormat[number]]; r?: ByteTypes[ReturnFormat[bytes]]; s?: ByteTypes[ReturnFormat[bytes]]; to?: string | null; transactionIndex?: NumberTypes[ReturnFormat[number]]; type?: NumberTypes[ReturnFormat[number]]; v?: NumberTypes[ReturnFormat[number]]; value?: NumberTypes[ReturnFormat[number]]; yParity?: string }[]; transactionsRoot: ByteTypes[ReturnFormat[bytes]]; uncles: string[] }>

getBlockNumber

getBlockTransactionCount

  • getBlockTransactionCount<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Uint8Array, returnFormat: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>

getBlockUncleCount

  • getBlockUncleCount<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Uint8Array, returnFormat: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>

getChainId

getCode

getCoinbase

getFeeHistory

getGasPrice

getHashRate

getLogs

getMaxPriorityFeePerGas

getPendingTransactions

  • getPendingTransactions<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, returnFormat: ReturnFormat): Promise<{ accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: NumberTypes[ReturnFormat[number]]; common?: { baseChain?: ValidChains; customChain: { chainId: NumberTypes[ReturnFormat[number]]; name?: string; networkId: NumberTypes[ReturnFormat[number]] }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: ByteTypes[ReturnFormat[bytes]]; from?: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: ByteTypes[ReturnFormat[bytes]]; maxFeePerGas?: NumberTypes[ReturnFormat[number]]; maxPriorityFeePerGas?: NumberTypes[ReturnFormat[number]]; networkId?: NumberTypes[ReturnFormat[number]]; nonce?: NumberTypes[ReturnFormat[number]]; r?: ByteTypes[ReturnFormat[bytes]]; s?: ByteTypes[ReturnFormat[bytes]]; to?: string | null; type?: NumberTypes[ReturnFormat[number]]; v?: NumberTypes[ReturnFormat[number]]; value?: NumberTypes[ReturnFormat[number]]; yParity?: string }[]>
  • View additional documentations here: Web3Eth.getPendingTransactions


    Type parameters

    Parameters

    Returns Promise<{ accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: NumberTypes[ReturnFormat[number]]; common?: { baseChain?: ValidChains; customChain: { chainId: NumberTypes[ReturnFormat[number]]; name?: string; networkId: NumberTypes[ReturnFormat[number]] }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: ByteTypes[ReturnFormat[bytes]]; from?: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: ByteTypes[ReturnFormat[bytes]]; maxFeePerGas?: NumberTypes[ReturnFormat[number]]; maxPriorityFeePerGas?: NumberTypes[ReturnFormat[number]]; networkId?: NumberTypes[ReturnFormat[number]]; nonce?: NumberTypes[ReturnFormat[number]]; r?: ByteTypes[ReturnFormat[bytes]]; s?: ByteTypes[ReturnFormat[bytes]]; to?: string | null; type?: NumberTypes[ReturnFormat[number]]; v?: NumberTypes[ReturnFormat[number]]; value?: NumberTypes[ReturnFormat[number]]; yParity?: string }[]>

getProof

getProtocolVersion

getStorageAt

getTransaction

  • getTransaction<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, transactionHash: Bytes, returnFormat?: ReturnFormat): Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList?: undefined; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>
  • View additional documentations here: Web3Eth.getTransaction


    Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • transactionHash: Bytes
    • optionalreturnFormat: ReturnFormat

    Returns Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList?: undefined; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>

getTransactionCount

getTransactionFromBlock

  • getTransactionFromBlock<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Uint8Array, transactionIndex: Numbers, returnFormat: ReturnFormat): Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList?: undefined; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>
  • View additional documentations here: Web3Eth.getTransactionFromBlock


    Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • block: undefined | string | number | bigint | Uint8Array
    • transactionIndex: Numbers
    • returnFormat: ReturnFormat

    Returns Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v?: undefined; value: string; yParity: string } | { accessList?: undefined; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>

getTransactionFromOrToAttr

getTransactionReceipt

  • getTransactionReceipt<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, transactionHash: Bytes, returnFormat: ReturnFormat): Promise<{ blockHash: ByteTypes[ReturnFormat[bytes]]; blockNumber: NumberTypes[ReturnFormat[number]]; contractAddress?: string; cumulativeGasUsed: NumberTypes[ReturnFormat[number]]; effectiveGasPrice?: NumberTypes[ReturnFormat[number]]; events?: {}; from: string; gasUsed: NumberTypes[ReturnFormat[number]]; logs: { address?: string; blockHash?: ByteTypes[ReturnFormat[bytes]]; blockNumber?: NumberTypes[ReturnFormat[number]]; data?: ByteTypes[ReturnFormat[bytes]]; id?: string; logIndex?: NumberTypes[ReturnFormat[number]]; removed?: boolean; topics?: ByteTypes[ReturnFormat[bytes]][]; transactionHash?: ByteTypes[ReturnFormat[bytes]]; transactionIndex?: NumberTypes[ReturnFormat[number]] }[]; logsBloom: ByteTypes[ReturnFormat[bytes]]; root: ByteTypes[ReturnFormat[bytes]]; status: NumberTypes[ReturnFormat[number]]; to: string; transactionHash: ByteTypes[ReturnFormat[bytes]]; transactionIndex: NumberTypes[ReturnFormat[number]]; type?: NumberTypes[ReturnFormat[number]] } | undefined>
  • View additional documentations here: Web3Eth.getTransactionReceipt


    Type parameters

    Parameters

    Returns Promise<{ blockHash: ByteTypes[ReturnFormat[bytes]]; blockNumber: NumberTypes[ReturnFormat[number]]; contractAddress?: string; cumulativeGasUsed: NumberTypes[ReturnFormat[number]]; effectiveGasPrice?: NumberTypes[ReturnFormat[number]]; events?: {}; from: string; gasUsed: NumberTypes[ReturnFormat[number]]; logs: { address?: string; blockHash?: ByteTypes[ReturnFormat[bytes]]; blockNumber?: NumberTypes[ReturnFormat[number]]; data?: ByteTypes[ReturnFormat[bytes]]; id?: string; logIndex?: NumberTypes[ReturnFormat[number]]; removed?: boolean; topics?: ByteTypes[ReturnFormat[bytes]][]; transactionHash?: ByteTypes[ReturnFormat[bytes]]; transactionIndex?: NumberTypes[ReturnFormat[number]] }[]; logsBloom: ByteTypes[ReturnFormat[bytes]]; root: ByteTypes[ReturnFormat[bytes]]; status: NumberTypes[ReturnFormat[number]]; to: string; transactionHash: ByteTypes[ReturnFormat[bytes]]; transactionIndex: NumberTypes[ReturnFormat[number]]; type?: NumberTypes[ReturnFormat[number]] } | undefined>

getUncle

  • getUncle<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Uint8Array, uncleIndex: Numbers, returnFormat: ReturnFormat): Promise<{ baseFeePerGas?: NumberTypes[ReturnFormat[number]]; difficulty?: NumberTypes[ReturnFormat[number]]; extraData: ByteTypes[ReturnFormat[bytes]]; gasLimit: NumberTypes[ReturnFormat[number]]; gasUsed: NumberTypes[ReturnFormat[number]]; hash?: ByteTypes[ReturnFormat[bytes]]; logsBloom?: ByteTypes[ReturnFormat[bytes]]; miner: ByteTypes[ReturnFormat[bytes]]; mixHash: ByteTypes[ReturnFormat[bytes]]; nonce: NumberTypes[ReturnFormat[number]]; number: NumberTypes[ReturnFormat[number]]; parentHash: ByteTypes[ReturnFormat[bytes]]; receiptsRoot: ByteTypes[ReturnFormat[bytes]]; sha3Uncles: ByteTypes[ReturnFormat[bytes]]; size: NumberTypes[ReturnFormat[number]]; stateRoot: ByteTypes[ReturnFormat[bytes]]; timestamp: NumberTypes[ReturnFormat[number]]; totalDifficulty: NumberTypes[ReturnFormat[number]]; transactions: string[] | { accessList?: { address?: string; storageKeys?: string[] }[]; blockHash?: ByteTypes[ReturnFormat[bytes]]; blockNumber?: NumberTypes[ReturnFormat[number]]; chain?: ValidChains; chainId?: NumberTypes[ReturnFormat[number]]; common?: { baseChain?: ValidChains; customChain: { chainId: NumberTypes[ReturnFormat[number]]; name?: string; networkId: NumberTypes[ReturnFormat[number]] }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: ByteTypes[ReturnFormat[bytes]]; from: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; hash: ByteTypes[ReturnFormat[bytes]]; input?: ByteTypes[ReturnFormat[bytes]]; maxFeePerGas?: NumberTypes[ReturnFormat[number]]; maxPriorityFeePerGas?: NumberTypes[ReturnFormat[number]]; networkId?: NumberTypes[ReturnFormat[number]]; nonce?: NumberTypes[ReturnFormat[number]]; r?: ByteTypes[ReturnFormat[bytes]]; s?: ByteTypes[ReturnFormat[bytes]]; to?: string | null; transactionIndex?: NumberTypes[ReturnFormat[number]]; type?: NumberTypes[ReturnFormat[number]]; v?: NumberTypes[ReturnFormat[number]]; value?: NumberTypes[ReturnFormat[number]]; yParity?: string }[]; transactionsRoot: ByteTypes[ReturnFormat[bytes]]; uncles: string[] }>
  • View additional documentations here: Web3Eth.getUncle


    Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • block: undefined | string | number | bigint | Uint8Array
    • uncleIndex: Numbers
    • returnFormat: ReturnFormat

    Returns Promise<{ baseFeePerGas?: NumberTypes[ReturnFormat[number]]; difficulty?: NumberTypes[ReturnFormat[number]]; extraData: ByteTypes[ReturnFormat[bytes]]; gasLimit: NumberTypes[ReturnFormat[number]]; gasUsed: NumberTypes[ReturnFormat[number]]; hash?: ByteTypes[ReturnFormat[bytes]]; logsBloom?: ByteTypes[ReturnFormat[bytes]]; miner: ByteTypes[ReturnFormat[bytes]]; mixHash: ByteTypes[ReturnFormat[bytes]]; nonce: NumberTypes[ReturnFormat[number]]; number: NumberTypes[ReturnFormat[number]]; parentHash: ByteTypes[ReturnFormat[bytes]]; receiptsRoot: ByteTypes[ReturnFormat[bytes]]; sha3Uncles: ByteTypes[ReturnFormat[bytes]]; size: NumberTypes[ReturnFormat[number]]; stateRoot: ByteTypes[ReturnFormat[bytes]]; timestamp: NumberTypes[ReturnFormat[number]]; totalDifficulty: NumberTypes[ReturnFormat[number]]; transactions: string[] | { accessList?: { address?: string; storageKeys?: string[] }[]; blockHash?: ByteTypes[ReturnFormat[bytes]]; blockNumber?: NumberTypes[ReturnFormat[number]]; chain?: ValidChains; chainId?: NumberTypes[ReturnFormat[number]]; common?: { baseChain?: ValidChains; customChain: { chainId: NumberTypes[ReturnFormat[number]]; name?: string; networkId: NumberTypes[ReturnFormat[number]] }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: ByteTypes[ReturnFormat[bytes]]; from: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; hash: ByteTypes[ReturnFormat[bytes]]; input?: ByteTypes[ReturnFormat[bytes]]; maxFeePerGas?: NumberTypes[ReturnFormat[number]]; maxPriorityFeePerGas?: NumberTypes[ReturnFormat[number]]; networkId?: NumberTypes[ReturnFormat[number]]; nonce?: NumberTypes[ReturnFormat[number]]; r?: ByteTypes[ReturnFormat[bytes]]; s?: ByteTypes[ReturnFormat[bytes]]; to?: string | null; transactionIndex?: NumberTypes[ReturnFormat[number]]; type?: NumberTypes[ReturnFormat[number]]; v?: NumberTypes[ReturnFormat[number]]; value?: NumberTypes[ReturnFormat[number]]; yParity?: string }[]; transactionsRoot: ByteTypes[ReturnFormat[bytes]]; uncles: string[] }>

isAccessList

isAccessListEntry

isBaseTransaction

isMining

isSyncing

isTransaction1559Unsigned

isTransaction2930Unsigned

isTransactionCall

isTransactionLegacyUnsigned

isTransactionWithSender

prepareTransactionForSigning

  • prepareTransactionForSigning(transaction: Transaction, web3Context: Web3Context<EthExecutionAPI, any>, privateKey?: string | Uint8Array, fillGasPrice?: boolean, fillGasLimit?: boolean): Promise<TypedTransaction>
  • Parameters

    Returns Promise<TypedTransaction>

sendSignedTransaction

sendTransaction

sign

  • sign<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, message: Bytes, addressOrIndex: string | number, returnFormat?: ReturnFormat): Promise<{ message?: string; messageHash: string; r: string; s: string; signature: string; v: string } | ByteTypes[ReturnFormat[bytes]]>
  • View additional documentations here: Web3Eth.sign


    Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • message: Bytes
    • addressOrIndex: string | number
    • optionalreturnFormat: ReturnFormat

    Returns Promise<{ message?: string; messageHash: string; r: string; s: string; signature: string; v: string } | ByteTypes[ReturnFormat[bytes]]>

signTransaction

signTypedData

transactionBuilder

  • transactionBuilder<ReturnType_1>(options: { fillGasLimit?: boolean; fillGasPrice?: boolean; privateKey?: string | Uint8Array; transaction: Transaction; web3Context: Web3Context<EthExecutionAPI, any> }): Promise<ReturnType_1>

trySendTransaction

  • An internal function to send a transaction or throws if sending did not finish during the timeout during the blocks-timeout.


    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      the context to read the configurations from

    • sendTransactionFunc: AsyncFunction<string, unknown>

      the function that will send the transaction (could be sendTransaction or sendRawTransaction)

    • optionaltransactionHash: Bytes

      to be used inside the exception message if there will be any exceptions.

    Returns Promise<string>

    the Promise

    <string>
    returned by the sendTransactionFunc.

validateBaseChain

  • validateBaseChain(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateChainInfo

  • validateChainInfo(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateCustomChainInfo

  • validateCustomChainInfo(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateFeeMarketGas

  • validateFeeMarketGas(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateGas

  • validateGas(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • This method checks if all required gas properties are present for either legacy gas (type 0x0 and 0x1) OR fee market transactions (0x2)


    Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateHardfork

  • validateHardfork(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateLegacyGas

  • validateLegacyGas(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string

    Returns void

validateTransactionCall

validateTransactionForSigning

  • validateTransactionForSigning(transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }, overrideMethod?: (transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }) => void, options?: { transactionSchema?: CustomTransactionSchema }): void
  • Parameters

    • transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }
      • optionalaccessList: { address?: string; storageKeys?: string[] }[]
      • optionalchain: ValidChains
      • optionalchainId: string
      • optionalcommon: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }
      • optionaldata: string
      • optionalfrom: string
      • optionalgas: string
      • optionalgasLimit: string
      • optionalgasPrice: string
      • optionalhardfork: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella
      • optionalinput: string
      • optionalmaxFeePerGas: string
      • optionalmaxPriorityFeePerGas: string
      • optionalnetworkId: string
      • optionalnonce: string
      • optionalr: string
      • optionals: string
      • optionalto: null | string
      • optionaltype: string
      • optionalv: string
      • optionalvalue: string
      • optionalyParity: string
    • optionaloverrideMethod: (transaction: { accessList?: { address?: string; storageKeys?: string[] }[]; chain?: ValidChains; chainId?: string; common?: { baseChain?: ValidChains; customChain: { chainId: string; name?: string; networkId: string }; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: arrowGlacier | berlin | byzantium | chainstart | constantinople | dao | homestead | istanbul | london | merge | muirGlacier | petersburg | shanghai | spuriousDragon | tangerineWhistle | frontier | altair | grayGlacier | bellatrix | capella; input?: string; maxFeePerGas?: string; maxPriorityFeePerGas?: string; networkId?: string; nonce?: string; r?: string; s?: string; to?: null | string; type?: string; v?: string; value?: string; yParity?: string }) => void
      • optionaloptions: { transactionSchema?: CustomTransactionSchema }

      Returns void

    validateTransactionWithSender

    waitForTransactionReceipt

    Page Options