Skip to main content

eth

Index

References

Web3Eth

Re-exports Web3Eth

Namespaces

abi

abi:

decodeContractErrorData

decodeLog

  • decodeLog<ReturnType_1>(inputs: 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: 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: 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: AbiInput[], bytes: string, loose: boolean): { __length__: number }
  • Should be used to decode list of params


    Parameters

    • abis: AbiInput[]
    • bytes: string
    • loose: boolean

    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.

    @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.

    @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

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)[]

modifyParams

  • modifyParams(coder: Coder, param: unknown[]): unknown
  • Parameters

    • coder: Coder
    • param: unknown[]

    Returns unknown

accounts

accounts:

Wallet

Wallet<T>:

Wallet is an in memory wallet that can hold multiple accounts. These accounts can be used when using web3.eth.sendTransaction().

Parameters

Web3AccountProvider - AccountProvider for the wallet

import Web3 from 'web3';
const web3 = new Web3("https://localhost:8454")
web3.eth.accounts.wallet
> Wallet(0) [
_accountProvider: {
create: [Function: create],
privateKeyToAccount: [Function: privateKeyToAccount],
decrypt: [Function: decrypt]
},
_addressMap: Map(0) {},
_defaultKeyName: 'web3js_wallet'
]

constructor

add

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


    Parameters

    • account: string | T

      A private key or account object

    Returns Wallet<T>

    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(): Wallet<T>
  • Securely empties the wallet and removes all its accounts. Use this with *caution as it will remove all accounts stored in local wallet.


    Returns Wallet<T>

    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): Wallet<T>
  • 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 Wallet<T>

    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

Web3Account

Web3Account:

address

address: string

privateKey

privateKey: string

readonlyencrypt

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

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

    Returns Promise<KeyStore>

readonlysign

  • sign(data: string | Record<string, unknown>): { message?: string; messageHash: string; r: string; s: string; signature: string; v: string }
  • Parameters

    • data: string | Record<string, unknown>

    Returns { message?: string; messageHash: string; r: string; s: string; signature: string; v: string }

    • optionalreadonlymessage?: string
    • readonlymessageHash: string
    • readonlyr: string
    • readonlys: string
    • readonlysignature: string
    • readonlyv: string

readonlysignTransaction

  • signTransaction(tx: Record<string, unknown>): Promise<{ messageHash: string; r: string; rawTransaction: string; s: string; transactionHash: string; v: string }>
  • Parameters

    • tx: Record<string, unknown>

    Returns Promise<{ messageHash: string; r: string; rawTransaction: string; s: string; transactionHash: string; v: string }>

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

SignFunction

SignFunction: (data: string, privateKey: string) => SignResult

Type declaration

    • (data: string, privateKey: string): SignResult
    • Parameters

      • data: string
      • privateKey: string

      Returns SignResult

SignResult

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

SignTransactionFunction

SignTransactionFunction: (transaction: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | Record<string, unknown>) => SignTransactionResult

Type declaration

    • (transaction: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | Record<string, unknown>): SignTransactionResult
    • Parameters

      • transaction: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | Record<string, unknown>

      Returns SignTransactionResult

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

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

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 | Buffer, 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 | Buffer

      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

    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]
    }

encrypt

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


    Parameters

    • privateKey: Bytes

      The private key to encrypt, 32 bytes.

    • password: string | Buffer

      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

    encrypt('0x67f476289210e3bef3c1c75e4de993ff0a00663df00def84e73aa7411eac18a6',
    '123',
    {
    n: 8192,
    iv: Buffer.from('bfb43120ae00e9de110f8325143a2709', 'hex'),
    salt: Buffer.from(
    '210d0ec956787d865358ac45716e6dd42e68d48e346d795746509523aeb477dd',
    'hex',
    ),
    }).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

    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): 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.

    Returns string

    The hashed message

    hashMessage("Hello world")
    > "0x8144a6fa26be252b86456491fbcd43c1de7e022241845ffea1c3df066f7cfede"
    hashMessage(utf8ToHex("Hello world")) // Will be hex decoded in hashMessage
    > "0x8144a6fa26be252b86456491fbcd43c1de7e022241845ffea1c3df066f7cfede"

parseAndValidatePrivateKey

  • parseAndValidatePrivateKey(data: Bytes, ignoreLength?: boolean): Buffer
  • Get the private key buffer after the validation


    Parameters

    • data: Bytes
    • optionalignoreLength: boolean

    Returns Buffer

privateKeyToAccount

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


    Parameters

    • privateKey: Bytes

      String or buffer of 32 bytes

    • optionalignoreLength: boolean

      if true, will not error check length

    Returns Web3Account

    A Web3Account object

    The Web3Account.signTransaction is not stateful here. We need network access to get the account nonce and chainId to sign the transaction. Use Web3.eth.accounts.signTransaction instead.

    privateKeyToAccount("0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709");
    > {
    address: '0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01',
    privateKey: '0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709',
    sign,
    signTransaction,
    encrypt,
    }

privateKeyToAddress

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

    @example
    privateKeyToAddress("0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728")
    > "0xEB014f8c8B418Db6b45774c326A0E64C78914dC0"

    Parameters

    • privateKey: Bytes

      String or buffer of 32 bytes

    Returns string

    The Ethereum address

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

      signatureOrV

    • optionalprefixedOrR: string | boolean

      prefixedOrR

    • optionals: string

      s

    • 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.

    Returns string

    The Ethereum address used to sign this data

    sign('Some data', '0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728');
    > {
    message: 'Some data',
    messageHash: '0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655',
    v: '0x1b',
    r: '0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f9',
    s: '0x53e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb150',
    signature: '0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f953e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb1501b'
    }
    recover('0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f953e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb1501b');
    > '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

    recoverTransaction('0xf869808504e3b29200831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a0c9cf86333bcb065d140032ecaab5d9281bde80f21b9687b3e94161de42d51895a0727a108a0b8d101465414033c3f705a9c7b826e596766046ee1183dbc8aeaa68');
    > "0x2c7536E3605D9C16a7a3D7b1898e529396a65c23"

sign

  • sign(data: string, privateKey: Bytes): SignResult
  • Signs arbitrary data with a given private key. NOTE: 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'
    }

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

    signTransaction({
    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

    signTransaction({
    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

    signTransaction({
    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'
    }

contract

contract:

The web3.eth.Contract object makes it easy to interact with smart contracts on the Ethereum blockchain. When you create a new contract object you give it the JSON interface of the respective smart contract and web3 will auto convert all calls into low level ABI calls over RPC for you. This allows you to interact with smart contracts as if they were JavaScript objects.

To use it standalone:

const Contract = require('web3-eth-contract');

// set provider for all later instances to use
Contract.setProvider('ws://localhost:8546');

const contract = new Contract(jsonInterface, address);

contract.methods.somFunc().send({from: ....})
.on('receipt', function(){
...
});

Contract

Re-exports Contract

default

Renames and re-exports Contract

LogsSubscription

LogsSubscription:

LogSubscription to be used to subscribe to events logs.

Following events are supported and can be accessed with either LogsSubscription.once or $LogsSubscription.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 LogsSubscription(args: { abi: AbiBaseFragment & { anonymous?: boolean; inputs?: readonly AbiParameter[]; name: string; type: string } & { signature: string }; address?: string; jsonInterface: ContractAbiWithSignature; topics?: (string | string[])[] }, options: { requestManager: Web3RequestManager<EthExecutionAPI>; returnFormat?: DataFormat }): LogsSubscription
  • Parameters

    Returns LogsSubscription

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?: (string | string[])[] }

Type declaration

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

readonlyjsonInterface

jsonInterface: ContractAbiWithSignature

optionalreadonlytopics

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

The list of topics subscribed

id

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

lastBlock

  • Returns undefined | BlockOutput

emit

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

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }>

    Parameters

    • eventName: K
    • params: { changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }[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 }; connected: number; data: EventLog; error: Error }>

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): Function[]
  • Type parameters

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }>

    Parameters

    • eventName: K

    Returns Function[]

off

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

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }>

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }[K]>

    Returns void

on

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

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }>

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }[K]>

    Returns void

once

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

    • K: Web3EventKey<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }>

    Parameters

    • eventName: K
    • fn: Web3EventCallback<{ changed: EventLog & { removed: true }; connected: number; data: EventLog; error: Error }[K]>

    Returns void

removeAllListeners

  • removeAllListeners(): EventEmitter
  • Returns EventEmitter

resubscribe

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

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

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

unsubscribe

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

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.

ContractInitOptions

ContractInitOptions:

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).

optionalreadonlygasLimit

gasLimit?: string

optionalreadonlygasPrice

gasPrice?: string

The gas price in wei to use for transactions.

optionalreadonlyinput

input?: Bytes

optionalreadonlyprovider

provider?: string | SupportedProviders<EthExecutionAPI>

optionalreadonlysyncWithContext

syncWithContext?: boolean

If true, the defaults of the contract instance will be updated automatically based on the changes of the context used to instantiate the contract.

ContractOptions

ContractOptions:

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.

myContract.options.address;
> '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'

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

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

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.

    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

  • The json interface object derived from the ABI of this contract.

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

    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 = [...];

    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

NonPayableCallOptions

NonPayableCallOptions:

optionalchainId

chainId?: string

optionaldata

data?: string

optionalfrom

from?: string

The address the call transaction should be made from. For calls the from property is optional however it is highly recommended to explicitly set it or it may default to address(0) depending on your node or provider.

optionalgas

gas?: string

The maximum gas provided for this call “transaction” (gas limit)

optionalgasPrice

gasPrice?: string

The gas price in wei to use for this call transaction.

optionalinput

input?: string

optionalmaxFeePerGas

maxFeePerGas?: string

optionalmaxPriorityFeePerGas

maxPriorityFeePerGas?: string

optionalnonce

nonce?: string

optionalto

to?: string

optionaltype

type?: string | number

NonPayableMethodObject

NonPayableMethodObject<Inputs, Outputs>:

Type parameters

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

arguments

arguments: Inputs

call

  • call<SpecialOutput>(tx?: NonPayableCallOptions, block?: BlockNumberOrTag): Promise<SpecialOutput>
  • 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"
    }

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

  • estimateGas<ReturnFormat>(options?: NonPayableCallOptions, returnFormat?: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>
  • 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.

send

  • send(tx?: NonPayableCallOptions): Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; 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

    • optionaltx: NonPayableCallOptions

      The options used for sending.

    Returns Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; 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.

PayableCallOptions

PayableCallOptions:

optionalchainId

chainId?: string

optionaldata

data?: string

optionalfrom

from?: string

The address the call transaction should be made from. For calls the from property is optional however it is highly recommended to explicitly set it or it may default to address(0) depending on your node or provider.

optionalgas

gas?: string

The maximum gas provided for this call “transaction” (gas limit)

optionalgasPrice

gasPrice?: string

The gas price in wei to use for this call transaction.

optionalinput

input?: string

optionalmaxFeePerGas

maxFeePerGas?: string

optionalmaxPriorityFeePerGas

maxPriorityFeePerGas?: string

optionalnonce

nonce?: string

optionalto

to?: string

optionaltype

type?: string | number

optionalvalue

value?: string

PayableMethodObject

PayableMethodObject<Inputs, Outputs>:

Type parameters

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

arguments

arguments: Inputs

call

  • call<SpecialOutput>(tx?: PayableCallOptions, block?: BlockNumberOrTag): Promise<SpecialOutput>
  • 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: 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"
    }

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

  • estimateGas<ReturnFormat>(options?: PayableCallOptions, returnFormat?: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>
  • 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.

send

  • send(tx?: PayableCallOptions): Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; 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

    • optionaltx: PayableCallOptions

      The options used for sending.

    Returns Web3PromiEvent<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; 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 }>

ContractBoundEvent

ContractBoundEvent: (options?: ContractEventOptions) => LogsSubscription

Type declaration

    • (options?: ContractEventOptions): LogsSubscription
    • The event object can be accessed from myContract.events.myEvent.

      &gt; Remember: To subscribe to an event, your provider must have support for subscriptions.

      const subscription = await myContract.events.MyEvent([options])

      Parameters

      • optionaloptions: ContractEventOptions

        The options used to subscribe for the event

      Returns LogsSubscription

      • A Promise resolved with LogsSubscription object

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>

NonPayableTxOptions

NonPayableTxOptions: NonPayableCallOptions

PayableTxOptions

PayableTxOptions: PayableCallOptions

TransactionReceipt

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

Web3ContractContext

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

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

decodeMethodReturn

encodeEventABI

  • Parameters

    Returns { address?: string; filter: Filter; fromBlock?: Numbers; toBlock?: Numbers; topics?: (string | string[])[] }

    • optionaladdress?: string
    • filter: Filter
    • optionalfromBlock?: Numbers
    • optionaltoBlock?: Numbers
    • optionaltopics?: (string | string[])[]

encodeMethodABI

ens

ens:

The web3.eth.ens functions let you interact with ENS. We recommend reading the ENS documentation to get deeper insights about the internals of the name service.

Breaking Changes

  • All the API level interfaces returning or accepting null in 1.x, use undefined in 4.x.
  • Functions don’t accept a callback anymore.
  • Functions that accepted an optional TransactionConfig as the last argument, now accept an optional NonPayableCallOptions. See web3-eth-contract package for more details.

ENS

ENS:

This class is designed to interact with the ENS system on the Ethereum blockchain.

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; IpcProvider: 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; IpcProvider: 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

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

    Returns the current provider

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

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 }

    Returns void

events

  • get events(): ContractEventsInterface<readonly [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { 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: 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: uint64; name: ttl; type: uint64 }]; name: NewTTL; 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: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; 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 [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { 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: 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: uint64; name: ttl; type: uint64 }]; name: NewTTL; 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: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; 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 [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { 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: 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: uint64; name: ttl; type: uint64 }]; name: NewTTL; 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: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; 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 [{ inputs: readonly []; stateMutability: nonpayable; type: constructor }, { 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: 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: uint64; name: ttl; type: uint64 }]; name: NewTTL; 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: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setOwner; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: resolver; type: address }]; name: setResolver; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }]; name: setSubnodeOwner; outputs: readonly [{ internalType: bytes32; name: ; type: bytes32 }]; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: label; type: bytes32 }, { internalType: address; name: owner; type: address }, { internalType: address; name: resolver; type: address }, { internalType: uint64; name: ttl; type: uint64 }]; name: setSubnodeRecord; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint64; name: ttl; type: uint64 }]; name: setTTL; outputs: readonly []; stateMutability: nonpayable; 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

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


    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

    Returns the current provider

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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[K]

    Returns void

eventNames

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

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

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 [{ inputs: readonly [{ internalType: contract ENS; name: _ens; type: address }, { internalType: contract INameWrapper; name: wrapperAddress; type: address }, { internalType: address; name: _trustedETHController; type: address }, { internalType: address; name: _trustedReverseRegistrar; type: address }]; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: uint256; name: contentType; type: uint256 }]; name: ABIChanged; type: event }, { 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: clearDNSZone; outputs: readonly []; stateMutability: nonpayable; 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: bytes[]; name: data; type: bytes[] }]; name: multicall; outputs: readonly [{ internalType: bytes[]; name: results; type: bytes[] }]; stateMutability: nonpayable; 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: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentType; type: uint256 }, { internalType: bytes; name: data; type: bytes }]; name: setABI; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }, { internalType: bytes; name: a; type: bytes }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: a; type: address }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setContenthash; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: data; type: bytes }]; name: setDNSRecords; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }, { internalType: address; name: implementer; type: address }]; name: setInterface; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: newName; type: string }]; name: setName; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; name: setPubkey; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }, { internalType: string; name: value; type: string }]; name: setText; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setZonehash; outputs: readonly []; stateMutability: nonpayable; 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 }]>>
  • 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 [{ inputs: readonly [{ internalType: contract ENS; name: _ens; type: address }, { internalType: contract INameWrapper; name: wrapperAddress; type: address }, { internalType: address; name: _trustedETHController; type: address }, { internalType: address; name: _trustedReverseRegistrar; type: address }]; stateMutability: nonpayable; type: constructor }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: bytes32; name: node; type: bytes32 }, { indexed: true; internalType: uint256; name: contentType; type: uint256 }]; name: ABIChanged; type: event }, { 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: clearDNSZone; outputs: readonly []; stateMutability: nonpayable; 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: bytes[]; name: data; type: bytes[] }]; name: multicall; outputs: readonly [{ internalType: bytes[]; name: results; type: bytes[] }]; stateMutability: nonpayable; 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: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: contentType; type: uint256 }, { internalType: bytes; name: data; type: bytes }]; name: setABI; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: uint256; name: coinType; type: uint256 }, { internalType: bytes; name: a; type: bytes }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: address; name: a; type: address }]; name: setAddr; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: address; name: operator; type: address }, { internalType: bool; name: approved; type: bool }]; name: setApprovalForAll; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setContenthash; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: data; type: bytes }]; name: setDNSRecords; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes4; name: interfaceID; type: bytes4 }, { internalType: address; name: implementer; type: address }]; name: setInterface; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: newName; type: string }]; name: setName; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes32; name: x; type: bytes32 }, { internalType: bytes32; name: y; type: bytes32 }]; name: setPubkey; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: string; name: key; type: string }, { internalType: string; name: value; type: string }]; name: setText; outputs: readonly []; stateMutability: nonpayable; type: function }, { inputs: readonly [{ internalType: bytes32; name: node; type: bytes32 }, { internalType: bytes; name: hash; type: bytes }]; name: setZonehash; outputs: readonly []; stateMutability: nonpayable; 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 }]>>

    • An contract instance of the resolver

getTTL

  • getTTL(name: string): Promise<unknown>
  • Returns the address of the owner of an ENS name.

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

    Parameters

    • name: string

      The ENS name

    Returns Promise<unknown>

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

isApprovedForAll

  • isApprovedForAll(owner: string, operator: string, returnFormat?: DataFormat): Promise<unknown>
  • Returns true if the operator is approved to make ENS registry operations on behalf of the owner.

    @example
    const approved = await web3.eth.ens.isApprovedForAll('0x1234567890123456789012345678901234567890', '0x690B9A9E9aa1C9dB991C7721a92d351Db4FaC990');

    Parameters

    • owner: string

      The owner address

    • operator: string

      The operator address

    • optionalreturnFormat: DataFormat

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<unknown>

    • true if the operator is approved, false otherwise

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): Function[]
  • Type parameters

    • K: CONFIG_CHANGE

    Parameters

    • eventName: K

    Returns Function[]

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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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: defaultNetworkId; newValue: undefined | Numbers; oldValue: undefined | Numbers } | { name: defaultChain; newValue: string; oldValue: string } | { name: defaultHardfork; newValue: string; oldValue: string } | { 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 } }[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

  • removeAllListeners(): EventEmitter
  • 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: NonPayableCallOptions

      (Optional) The transaction config

    • optionalreturnFormat: DataFormat

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

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

setApprovalForAll

  • setApprovalForAll(operator: string, approved: boolean, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets or clears an approval by the given operator.

    @example
    const receipt = web3.eth.ens.setApprovalForAll('0x1234567890123456789012345678901234567890', true )

    Parameters

    • operator: string

      The operator address

    • approved: boolean

      true to set the approval, false to clear it

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setConfig

  • Parameters

    Returns void

setContenthash

  • setContenthash(name: string, hash: string, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the content hash associated with an ENS node. Emits a ContenthashChanged event.

    @example
    const receipt = web3.eth.ens.setContenthash(
    'ethereum.eth',
    'ipfs://QmaEBknbGT4bTQiQoe2VNgBJbRfygQGktnaW5TbuKixjYL',
    )

    Parameters

    • name: string

      The ENS name

    • hash: string

      The content hash to set

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

setOwner

  • Sets the address of the owner of an ENS name.

    @example
    const receipt = await ens.setOwner('ethereum.eth', , sendOptions);

    Parameters

    • name: string

      The ENS name

    • address: string

      The address of the new owner

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • optionalreturnFormat: DataFormat

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setProvider

setPubkey

  • setPubkey(name: string, x: string, y: string, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the SECP256k1 public key associated with an ENS node. (Emits a PublicKeyChanged event)


    Parameters

    • name: string

      The ENS name

    • x: string

      The X coordinate of the public key

    • y: string

      The Y coordinate of the public key

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt
      const receipt = await web3.eth.ens.setPubkey(
      'ethereum.eth',
      '0x0000000000000000000000000000000000000000000000000000000000000000',
      '0x0000000000000000000000000000000000000000000000000000000000000000',
      { from: '0x9CC9a2c777605Af16872E0997b3Aeb91d96D5D8c' });

setRecord

  • setRecord(name: string, owner: string, resolver: string, ttl: number, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Returns the address of the owner of an ENS name.

    @example
    const receipt = await ens.setRecord( 'web3js.eth','0xe2597eb05cf9a87eb1309e86750c903ec38e527e', '0x7ed0e85b8e1e925600b4373e6d108f34ab38a401', 1000);

    Parameters

    • name: string

      The ENS name

    • owner: string

      The owner of the name record.

    • resolver: string

      The resolver of the name record.

    • ttl: number

      Time to live value

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setResolver

  • setResolver(name: string, address: string, txConfig: NonPayableCallOptions, returnFormat?: DataFormat): Promise<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint } | { code: bigint; innerError: undefined | { name: string; message: string; stack?: string | undefined; } | { name: string; message: string; stack?: string | undefined; }[]; name: string; reason: string; signature: string; stack: undefined | string; toJSON: any }>
  • set the resolver of the given name

    @example
    const receipt = await ens.setResolver('resolver', '0x1234567890123456789012345678901234567890', {from: '0x1234567890123456789012345678901234567890'});

    Parameters

    • name: string

      The name of the ENS domain

    • address: string

      The address of the resolver

    • txConfig: NonPayableCallOptions

      The transaction config

    • optionalreturnFormat: DataFormat

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<{ blockHash: string; blockNumber: bigint; contractAddress?: string; cumulativeGasUsed: bigint; effectiveGasPrice?: bigint; from: string; gasUsed: bigint; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: bigint | undefined; readonly transactionIndex?: bigint | undefined; readonly transactionHash?: string | undefined; ... 4 more ...; readonly topics?: string[] | undefined; }[]; logsBloom: string; root: string; status: bigint; to: string; transactionHash: string; transactionIndex: bigint; type?: bigint } | { code: bigint; innerError: undefined | { name: string; message: string; stack?: string | undefined; } | { name: string; message: string; stack?: string | undefined; }[]; name: string; reason: string; signature: string; stack: undefined | string; toJSON: any }>

    The transaction receipt

setSubnodeOwner

  • setSubnodeOwner(node: string, label: string, address: string, txConfig: NonPayableCallOptions, returnFormat?: DataFormat): Promise<TransactionReceipt | RevertInstructionError>
  • Creates a new subdomain of the given node, assigning ownership of it to the specified owner.

    @example
    const receipt = await ens.setSubnodeOwner('ethereum.eth', 'web3', '0x1234567890123456789012345678901234567890', {from: '0x1234567890123456789012345678901234567890'});

    Parameters

    • node: string

      The ENS name

    • label: string

      The name of the sub-domain or the sha3 hash of it

    • address: string

      The registrar of this sub-domain

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • optionalreturnFormat: DataFormat

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setSubnodeRecord

  • setSubnodeRecord(name: string, label: string, owner: string, resolver: string, ttl: number, txConfig: NonPayableCallOptions, returnFormat?: DataFormat): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the owner, resolver and TTL for a subdomain, creating it if necessary.

    @example
    const receipt = await web3.eth.ens.setSubnodeRecord('ethereum.eth', 'web3', '0x1234567890123456789012345678901234567890','0xAA9133EeC3ae5f9440C1a1E61E2D2Cc571675527', 1000000);

    Parameters

    • name: string

      The ENS name

    • label: string

      The name of the sub-domain or sha3 hash of it

    • owner: string

      The owner of the name record

    • resolver: string

      The resolver address of the name record

    • ttl: number

      Time to live value

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    • optionalreturnFormat: DataFormat

      (Optional) The return format, defaults to DEFAULT_RETURN_FORMAT

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

setTTL

  • setTTL(name: string, ttl: number, txConfig: NonPayableCallOptions): Promise<TransactionReceipt | RevertInstructionError>
  • Sets the TTL of a name. Emits a NewTTL event.

    @example
    const receipt = await web3.eth.ens.setTTL('ethereum.eth', 1000);

    Parameters

    • name: string

      THe ENS name

    • ttl: number

      The TTL value

    • txConfig: NonPayableCallOptions

      (Optional) The transaction config

    Returns Promise<TransactionReceipt | RevertInstructionError>

    • The transaction receipt

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:

The web3-eth-personal package allows you to interact with the Ethereum node’s accounts.

NOTE: Many of these functions send sensitive information like passwords. Never call these functions over a unsecured Websocket or HTTP provider, as your password will be sent in plain text!

import Personal from ‘web3-eth-personal’;

const personal = new Personal(‘http://localhost:8545&#39;);

or using the web3 umbrella package

import Personal from ‘web3-eth-personal’; const web3 = new Web3(‘http://localhost:8545&#39;); // web3.eth.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: LogsOutput): void
  • Parameters

    Returns void

emit

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

    Parameters

    • eventName: K
    • params: CommonSubscriptionEvents & { data: LogsOutput }[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): Function[]
  • Type parameters

    Parameters

    • eventName: K

    Returns Function[]

off

on

once

removeAllListeners

  • removeAllListeners(): EventEmitter
  • Returns EventEmitter

resubscribe

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

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

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

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

emit

  • emit<K>(eventName: K, params: CommonSubscriptionEvents & { data: BlockHeaderOutput }[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): Function[]
  • Type parameters

    Parameters

    • eventName: K

    Returns Function[]

off

on

once

removeAllListeners

  • removeAllListeners(): EventEmitter
  • Returns EventEmitter

resubscribe

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

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

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

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
 web3.eth.subscribe('pendingTransactions').on("data", console.log(transaction);

constructor

readonlyargs

args: any

id

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

lastBlock

  • Returns undefined | BlockOutput

emit

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

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

    Parameters

    • eventName: K
    • params: CommonSubscriptionEvents & { data: string }[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<CommonSubscriptionEvents & { data: string }>

    Parameters

    • eventName: K

    Returns number

listeners

  • listeners<K>(eventName: K): Function[]
  • Type parameters

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

    Parameters

    • eventName: K

    Returns Function[]

off

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

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

    Parameters

    Returns void

on

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

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

    Parameters

    Returns void

once

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

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

    Parameters

    Returns void

removeAllListeners

  • removeAllListeners(): EventEmitter
  • Returns EventEmitter

resubscribe

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

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

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

unsubscribe

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

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

emit

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

    Parameters

    • eventName: K
    • params: CommonSubscriptionEvents & { changed: boolean; data: SyncOutput }[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): Function[]
  • Type parameters

    Parameters

    • eventName: K

    Returns Function[]

off

  • Type parameters

    Parameters

    Returns void

on

  • Type parameters

    Parameters

    Returns void

once

  • Type parameters

    Parameters

    Returns void

removeAllListeners

  • removeAllListeners(): EventEmitter
  • Returns EventEmitter

resubscribe

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

setMaxListenerWarningThreshold

  • setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void
  • Parameters

    • maxListenersWarningThreshold: number

    Returns void

subscribe

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

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

  • ResolveType = TransactionReceipt

optionalcheckRevertBeforeSending

checkRevertBeforeSending?: boolean

optionalcontractAbi

contractAbi?: ContractAbi

optionaltransactionResolver

  • transactionResolver(receipt: TransactionReceipt): ResolveType
  • Parameters

    • receipt: TransactionReceipt

    Returns ResolveType

SendTransactionOptions

SendTransactionOptions<ResolveType>:

Type parameters

  • ResolveType = TransactionReceipt

optionalcheckRevertBeforeSending

checkRevertBeforeSending?: boolean

optionalcontractAbi

contractAbi?: ContractAbi

optionalignoreGasPricing

ignoreGasPricing?: boolean

optionaltransactionResolver

  • transactionResolver(receipt: TransactionReceipt): ResolveType
  • Parameters

    • receipt: TransactionReceipt

    Returns ResolveType

Type Aliases

InternalTransaction

InternalTransaction: FormatType<Transaction, typeof ETH_DATA_FORMAT>

SendSignedTransactionEvents

SendSignedTransactionEvents<ReturnFormat>: { 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>> | InvalidResponseError | ContractExecutionError; receipt: FormatType<TransactionReceipt, ReturnFormat>; sending: FormatType<Bytes, typeof ETH_DATA_FORMAT>; sent: FormatType<Bytes, typeof ETH_DATA_FORMAT>; transactionHash: FormatType<Bytes, ReturnFormat> }

Type parameters

Type declaration

SendTransactionEvents

SendTransactionEvents<ReturnFormat>: { 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>> | InvalidResponseError | ContractExecutionError; receipt: FormatType<TransactionReceipt, ReturnFormat>; sending: FormatType<Transaction, typeof ETH_DATA_FORMAT>; sent: FormatType<Transaction, typeof ETH_DATA_FORMAT>; transactionHash: FormatType<Bytes, ReturnFormat> }

Type parameters

Type declaration

Variables

constaccessListItemSchema

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

Type declaration

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

constaccessListResultSchema

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

Type declaration

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

constaccessListSchema

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

Type declaration

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

constaccountSchema

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

Type declaration

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

constblockHeaderSchema

blockHeaderSchema: { properties: { difficulty: { eth: string }; extraData: { eth: string }; gasLimit: { eth: string }; gasUsed: { eth: string }; logsBloom: { eth: string }; miner: { eth: string }; nonce: { eth: string }; number: { eth: string }; parentHash: { eth: string }; receiptRoot: { eth: string }; sha3Uncles: { eth: string }; stateRoot: { eth: string }; timestamp: { eth: string }; transactionsRoot: { eth: string } }; type: string }

Type declaration

  • properties: { difficulty: { eth: string }; extraData: { eth: string }; gasLimit: { eth: string }; gasUsed: { eth: string }; logsBloom: { eth: string }; miner: { eth: string }; nonce: { eth: string }; number: { eth: string }; parentHash: { eth: string }; receiptRoot: { eth: string }; sha3Uncles: { eth: string }; stateRoot: { eth: string }; timestamp: { eth: string }; transactionsRoot: { eth: string } }
    • difficulty: { eth: string }
      • eth: string
    • extraData: { eth: string }
      • eth: string
    • gasLimit: { eth: string }
      • eth: string
    • gasUsed: { eth: string }
      • eth: string
    • logsBloom: { eth: string }
      • eth: string
    • miner: { eth: string }
      • eth: string
    • nonce: { eth: string }
      • eth: string
    • number: { eth: string }
      • eth: string
    • parentHash: { eth: string }
      • eth: string
    • receiptRoot: { eth: string }
      • eth: string
    • sha3Uncles: { eth: string }
      • eth: string
    • stateRoot: { eth: string }
      • eth: string
    • timestamp: { eth: string }
      • eth: string
    • transactionsRoot: { eth: string }
      • eth: string
  • type: string

constblockSchema

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

Type declaration

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

constchainSchema

chainSchema: { enum: string[]; type: string }

Type declaration

  • enum: string[]
  • type: string

constcustomChainSchema

customChainSchema: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }

Type declaration

  • properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }
    • chainId: { eth: string }
      • eth: string
    • name: { eth: string }
      • eth: string
    • networkId: { eth: string }
      • eth: string
  • type: string

constfeeHistorySchema

feeHistorySchema: { properties: { baseFeePerGas: { items: { eth: string }; type: string }; gasUsedRatio: { items: { type: string }; type: string }; oldestBlock: { eth: string }; reward: { items: { items: { eth: string }; type: string }; type: string } }; type: string }

Type declaration

  • properties: { baseFeePerGas: { items: { eth: string }; type: string }; gasUsedRatio: { items: { type: string }; type: string }; oldestBlock: { eth: string }; reward: { items: { items: { eth: string }; type: string }; type: string } }
    • baseFeePerGas: { items: { eth: string }; type: string }
      • items: { eth: string }
        • eth: string
      • type: string
    • gasUsedRatio: { items: { type: string }; type: string }
      • items: { type: string }
        • type: string
      • type: string
    • oldestBlock: { eth: string }
      • eth: string
    • reward: { items: { items: { eth: string }; type: string }; type: string }
      • items: { items: { eth: string }; type: string }
        • items: { eth: string }
          • eth: string
        • type: string
      • type: string
  • type: string

consthardforkSchema

hardforkSchema: { enum: string[]; type: string }

Type declaration

  • enum: string[]
  • type: string

constlogSchema

logSchema: { properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }; type: string }

Type declaration

  • properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }
    • address: { eth: string }
      • eth: string
    • blockHash: { eth: string }
      • eth: string
    • blockNumber: { eth: string }
      • eth: string
    • data: { eth: string }
      • eth: string
    • logIndex: { eth: string }
      • eth: string
    • removed: { eth: string }
      • eth: string
    • topics: { items: { eth: string }; type: string }
      • items: { eth: string }
        • eth: string
      • type: string
    • transactionHash: { eth: string }
      • eth: string
    • transactionIndex: { eth: string }
      • eth: 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: { eth: string }; proof: { items: { eth: string }; type: string }; value: { eth: string } }; type: string }

Type declaration

  • properties: { key: { eth: string }; proof: { items: { eth: string }; type: string }; value: { eth: string } }
    • key: { eth: string }
      • eth: string
    • proof: { items: { eth: string }; type: string }
      • items: { eth: string }
        • eth: string
      • type: string
    • value: { eth: string }
      • eth: string
  • type: string

constsyncSchema

syncSchema: { properties: { currentBlock: { eth: string }; highestBlock: { eth: string }; knownStates: { eth: string }; pulledStates: { eth: string }; startingBlock: { eth: string } }; type: string }

Type declaration

  • properties: { currentBlock: { eth: string }; highestBlock: { eth: string }; knownStates: { eth: string }; pulledStates: { eth: string }; startingBlock: { eth: string } }
    • currentBlock: { eth: string }
      • eth: string
    • highestBlock: { eth: string }
      • eth: string
    • knownStates: { eth: string }
      • eth: string
    • pulledStates: { eth: string }
      • eth: string
    • startingBlock: { eth: string }
      • eth: string
  • type: string

consttransactionInfoSchema

transactionInfoSchema: { properties: { accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }; blockHash: { eth: string }; blockNumber: { eth: string }; chain: { enum: string[]; type: string }; chainId: { eth: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gas: { eth: string }; gasLimit: { eth: string }; gasPrice: { eth: string }; hardfork: { enum: string[]; type: string }; hash: { eth: string }; input: { eth: string }; maxFeePerGas: { eth: string }; maxPriorityFeePerGas: { eth: string }; networkId: { eth: string }; nonce: { eth: string }; r: { eth: string }; s: { eth: string }; to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }; transactionIndex: { eth: string }; type: { eth: string }; v: { eth: string }; value: { eth: string } }; type: string }

Type declaration

  • properties: { accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }; blockHash: { eth: string }; blockNumber: { eth: string }; chain: { enum: string[]; type: string }; chainId: { eth: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gas: { eth: string }; gasLimit: { eth: string }; gasPrice: { eth: string }; hardfork: { enum: string[]; type: string }; hash: { eth: string }; input: { eth: string }; maxFeePerGas: { eth: string }; maxPriorityFeePerGas: { eth: string }; networkId: { eth: string }; nonce: { eth: string }; r: { eth: string }; s: { eth: string }; to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }; transactionIndex: { eth: string }; type: { eth: string }; v: { eth: string }; value: { eth: string } }
    • accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }
      • items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }
        • properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }
          • address: { eth: string }
            • eth: string
          • storageKeys: { items: { eth: string }; type: string }
            • items: { eth: string }
              • eth: string
            • type: string
        • type: string
      • type: string
    • blockHash: { eth: string }
      • eth: string
    • blockNumber: { eth: string }
      • eth: string
    • chain: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • chainId: { eth: string }
      • eth: string
    • common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }
      • properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }
        • baseChain: { enum: string[]; type: string }
          • enum: string[]
          • type: string
        • customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }
          • properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }
            • chainId: { eth: string }
              • eth: string
            • name: { eth: string }
              • eth: string
            • networkId: { eth: string }
              • eth: string
          • type: string
        • hardfork: { enum: string[]; type: string }
          • enum: string[]
          • type: string
      • type: string
    • data: { eth: string }
      • eth: string
    • effectiveGasPrice: { eth: string }
      • eth: string
    • from: { eth: string }
      • eth: string
    • gas: { eth: string }
      • eth: string
    • gasLimit: { eth: string }
      • eth: string
    • gasPrice: { eth: string }
      • eth: string
    • hardfork: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • hash: { eth: string }
      • eth: string
    • input: { eth: string }
      • eth: string
    • maxFeePerGas: { eth: string }
      • eth: string
    • maxPriorityFeePerGas: { eth: string }
      • eth: string
    • networkId: { eth: string }
      • eth: string
    • nonce: { eth: string }
      • eth: string
    • r: { eth: string }
      • eth: string
    • s: { eth: string }
      • eth: string
    • to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }
      • oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[]
    • transactionIndex: { eth: string }
      • eth: string
    • type: { eth: string }
      • eth: string
    • v: { eth: string }
      • eth: string
    • value: { eth: string }
      • eth: string
  • type: string

consttransactionReceiptSchema

transactionReceiptSchema: { properties: { blockHash: { eth: string }; blockNumber: { eth: string }; contractAddress: { eth: string }; cumulativeGasUsed: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gasUsed: { eth: string }; logs: { items: { properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }; type: string }; type: string }; logsBloom: { eth: string }; root: { eth: string }; status: { eth: string }; to: { eth: string }; transactionHash: { eth: string }; transactionIndex: { eth: string }; type: { eth: string } }; type: string }

Type declaration

  • properties: { blockHash: { eth: string }; blockNumber: { eth: string }; contractAddress: { eth: string }; cumulativeGasUsed: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gasUsed: { eth: string }; logs: { items: { properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }; type: string }; type: string }; logsBloom: { eth: string }; root: { eth: string }; status: { eth: string }; to: { eth: string }; transactionHash: { eth: string }; transactionIndex: { eth: string }; type: { eth: string } }
    • blockHash: { eth: string }
      • eth: string
    • blockNumber: { eth: string }
      • eth: string
    • contractAddress: { eth: string }
      • eth: string
    • cumulativeGasUsed: { eth: string }
      • eth: string
    • effectiveGasPrice: { eth: string }
      • eth: string
    • from: { eth: string }
      • eth: string
    • gasUsed: { eth: string }
      • eth: string
    • logs: { items: { properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }; type: string }; type: string }
      • items: { properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }; type: string }
        • properties: { address: { eth: string }; blockHash: { eth: string }; blockNumber: { eth: string }; data: { eth: string }; logIndex: { eth: string }; removed: { eth: string }; topics: { items: { eth: string }; type: string }; transactionHash: { eth: string }; transactionIndex: { eth: string } }
          • address: { eth: string }
            • eth: string
          • blockHash: { eth: string }
            • eth: string
          • blockNumber: { eth: string }
            • eth: string
          • data: { eth: string }
            • eth: string
          • logIndex: { eth: string }
            • eth: string
          • removed: { eth: string }
            • eth: string
          • topics: { items: { eth: string }; type: string }
            • items: { eth: string }
              • eth: string
            • type: string
          • transactionHash: { eth: string }
            • eth: string
          • transactionIndex: { eth: string }
            • eth: string
        • type: string
      • type: string
    • logsBloom: { eth: string }
      • eth: string
    • root: { eth: string }
      • eth: string
    • status: { eth: string }
      • eth: string
    • to: { eth: string }
      • eth: string
    • transactionHash: { eth: string }
      • eth: string
    • transactionIndex: { eth: string }
      • eth: string
    • type: { eth: string }
      • eth: string
  • type: string

consttransactionSchema

transactionSchema: { properties: { accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }; chain: { enum: string[]; type: string }; chainId: { eth: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gas: { eth: string }; gasLimit: { eth: string }; gasPrice: { eth: string }; hardfork: { enum: string[]; type: string }; input: { eth: string }; maxFeePerGas: { eth: string }; maxPriorityFeePerGas: { eth: string }; networkId: { eth: string }; nonce: { eth: string }; r: { eth: string }; s: { eth: string }; to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }; type: { eth: string }; v: { eth: string }; value: { eth: string } }; type: string }

Type declaration

  • properties: { accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }; chain: { enum: string[]; type: string }; chainId: { eth: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gas: { eth: string }; gasLimit: { eth: string }; gasPrice: { eth: string }; hardfork: { enum: string[]; type: string }; input: { eth: string }; maxFeePerGas: { eth: string }; maxPriorityFeePerGas: { eth: string }; networkId: { eth: string }; nonce: { eth: string }; r: { eth: string }; s: { eth: string }; to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }; type: { eth: string }; v: { eth: string }; value: { eth: string } }
    • accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }
      • items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }
        • properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }
          • address: { eth: string }
            • eth: string
          • storageKeys: { items: { eth: string }; type: string }
            • items: { eth: string }
              • eth: string
            • type: string
        • type: string
      • type: string
    • chain: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • chainId: { eth: string }
      • eth: string
    • common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }
      • properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }
        • baseChain: { enum: string[]; type: string }
          • enum: string[]
          • type: string
        • customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }
          • properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }
            • chainId: { eth: string }
              • eth: string
            • name: { eth: string }
              • eth: string
            • networkId: { eth: string }
              • eth: string
          • type: string
        • hardfork: { enum: string[]; type: string }
          • enum: string[]
          • type: string
      • type: string
    • data: { eth: string }
      • eth: string
    • effectiveGasPrice: { eth: string }
      • eth: string
    • from: { eth: string }
      • eth: string
    • gas: { eth: string }
      • eth: string
    • gasLimit: { eth: string }
      • eth: string
    • gasPrice: { eth: string }
      • eth: string
    • hardfork: { enum: string[]; type: string }
      • enum: string[]
      • type: string
    • input: { eth: string }
      • eth: string
    • maxFeePerGas: { eth: string }
      • eth: string
    • maxPriorityFeePerGas: { eth: string }
      • eth: string
    • networkId: { eth: string }
      • eth: string
    • nonce: { eth: string }
      • eth: string
    • r: { eth: string }
      • eth: string
    • s: { eth: string }
      • eth: string
    • to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }
      • oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[]
    • type: { eth: string }
      • eth: string
    • v: { eth: string }
      • eth: string
    • value: { eth: string }
      • eth: string
  • type: string

Functions

call

  • Executes a message call within the EVM without creating a transaction. It does not publish anything to the blockchain and does not consume any gas.


    Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • transaction: TransactionCall

      A transaction object where all properties are optional except to, however it’s recommended to include the from property or it may default to 0x0000000000000000000000000000000000000000 depending on your node or provider.

    • blockNumber: undefined | BlockNumberOrTag

      (BlockNumberOrTag defaults to Web3Eth.defaultBlock) - Specifies what block to use as the current state of the blockchain while processing the transaction.

    • returnFormat: ReturnFormat

      (DataFormat defaults to DEFAULT_RETURN_FORMAT) - Specifies how the return data from the call should be formatted.

    Returns Promise<string>

    The returned data of the call, e.g. a smart contract function’s return value.

createAccessList

  • This function generates access list for a transaction.


    Type parameters

    Parameters

    Returns Promise<{ accessList?: { address?: string; storageKeys?: string[] }[]; gasUsed?: NumberTypes[ReturnFormat[number]] }>

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

detectTransactionType

  • detectTransactionType(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }
    • optionalweb3Context: Web3Context<EthExecutionAPI, any>

    Returns undefined | string

estimateGas

  • Simulates the transaction within the EVM to estimate the amount of gas to be used by the transaction. The transaction will not be added to the blockchain, and actual gas usage can vary when interacting with a contract as a result of updating the contract’s state.


    Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The used gas for the simulated transaction execution.

    const transaction = {
    from: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
    to: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
    value: '0x1',
    nonce: '0x1',
    type: '0x0'
    }

    web3.eth.estimateGas(transaction).then(console.log);
    > 21000n

    web3.eth.estimateGas(transaction, { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
    > 21000

formatTransaction

  • formatTransaction<ReturnFormat, TransactionType>(transaction: TransactionType, returnFormat?: ReturnFormat, options?: { transactionSchema: { properties: { accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }; chain: { enum: string[]; type: string }; chainId: { eth: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gas: { eth: string }; gasLimit: { eth: string }; gasPrice: { eth: string }; hardfork: { enum: string[]; type: string }; input: { eth: string }; maxFeePerGas: { eth: string }; maxPriorityFeePerGas: { eth: string }; networkId: { eth: string }; nonce: { eth: string }; r: { eth: string }; s: { eth: string }; to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }; type: { eth: string }; v: { eth: string }; value: { eth: string } }; type: string } | ValidationSchemaInput }): FormatType<TransactionType, ReturnFormat>
  • Type parameters

    Parameters

    • transaction: TransactionType
    • optionalreturnFormat: ReturnFormat
    • optionaloptions: { transactionSchema: { properties: { accessList: { items: { properties: { address: { eth: string }; storageKeys: { items: { eth: string }; type: string } }; type: string }; type: string }; chain: { enum: string[]; type: string }; chainId: { eth: string }; common: { properties: { baseChain: { enum: string[]; type: string }; customChain: { properties: { chainId: { eth: string }; name: { eth: string }; networkId: { eth: string } }; type: string }; hardfork: { enum: string[]; type: string } }; type: string }; data: { eth: string }; effectiveGasPrice: { eth: string }; from: { eth: string }; gas: { eth: string }; gasLimit: { eth: string }; gasPrice: { eth: string }; hardfork: { enum: string[]; type: string }; input: { eth: string }; maxFeePerGas: { eth: string }; maxPriorityFeePerGas: { eth: string }; networkId: { eth: string }; nonce: { eth: string }; r: { eth: string }; s: { eth: string }; to: { oneOf: ({ eth: string; type?: undefined } | { eth?: undefined; type: string })[] }; type: { eth: string }; v: { eth: string }; value: { eth: string } }; type: string } | ValidationSchemaInput }

    Returns FormatType<TransactionType, ReturnFormat>

getBalance

  • Get the balance of an address at a given block.


    Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The current balance for the given address in wei.

    web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
    > 1000000000000n

    web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1", { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
    > "0xe8d4a51000"

getBlock

  • Retrieves a Block matching the provided block number, block hash or block tag.


    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 | Buffer | ArrayBuffer | Uint8Array

      The BlockNumberOrTag (defaults to Web3Eth.defaultBlock) or block hash of the desired block.

    • hydrated: undefined | boolean

      If specified true, the returned block will contain all transactions as objects. If false it will only contain transaction hashes.

    • returnFormat: ReturnFormat

      (DataFormat defaults to DEFAULT_RETURN_FORMAT) Specifies how the return data should be formatted (does not format transaction objects or hashes).

    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?: Hardfork }; data?: ByteTypes[ReturnFormat[bytes]]; from: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: Hardfork; 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[] }>

    A Block object matching the provided block number or block hash.

    web3.eth.getBlock(0).then(console.log);
    > {
    hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
    parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
    miner: '0x0000000000000000000000000000000000000000',
    stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
    transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    difficulty: 1n,
    number: 0n,
    gasLimit: 30000000n,
    gasUsed: 0n,
    timestamp: 1658281638n,
    extraData: '0x',
    mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    nonce: 0n,
    totalDifficulty: 1n,
    baseFeePerGas: 1000000000n,
    size: 514n,
    transactions: [],
    uncles: []
    }

    web3.eth.getBlock(
    "0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d",
    false,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > {
    hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
    parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
    miner: '0x0000000000000000000000000000000000000000',
    stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
    transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    difficulty: 1,
    number: 0,
    gasLimit: 30000000,
    gasUsed: 0,
    timestamp: 1658281638,
    extraData: '0x',
    mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    nonce: 0,
    totalDifficulty: 1,
    baseFeePerGas: 1000000000,
    size: 514,
    transactions: [],
    uncles: []
    }

getBlockNumber

  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The current block number.

    web3.eth.getBlockNumber().then(console.log);
    > 2744n

    web3.eth.getBlockNumber({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
    > "0xab8"

getBlockTransactionCount

  • getBlockTransactionCount<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Buffer | ArrayBuffer | Uint8Array, returnFormat: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>
  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The number of transactions in the provided block.

    web3.eth.getBlockTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
    > 1n

    web3.eth.getBlockTransactionCount(
    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > 1

getBlockUncleCount

  • getBlockUncleCount<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Buffer | ArrayBuffer | Uint8Array, returnFormat: ReturnFormat): Promise<NumberTypes[ReturnFormat[number]]>
  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The number of uncles in the provided block.

    web3.eth.getBlockUncleCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
    > 1n

    web3.eth.getBlockUncleCount(
    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > 1

getChainId

  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The chain ID of the current connected node as described in the EIP-695.

    web3.eth.getChainId().then(console.log);
    > 61n

    web3.eth.getChainId({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
    > 61

getCode

  • Get the code at a specific address.


    Type parameters

    Parameters

    Returns Promise<string>

    The data at the provided address.

    web3.eth.getCode("0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234").then(console.log);
    > "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"

    web3.eth.getCode(
    "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234",
    undefined,
    { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.BUFFER }
    ).then(console.log);
    > <Buffer 30 78 36 30 30 31 36 30 30 30 38 30 33 35 38 31 31 61 38 31 38 31 38 31 31 34 36 30 31 32 35 37 38 33 30 31 30 30 35 62 36 30 31 62 36 30 30 31 33 35 ... >

getCoinbase

  • Parameters

    Returns Promise<string>

    Returns the coinbase address to which mining rewards will go.

    web3.eth.getCoinbase().then(console.log);
    > "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe"

getFeeHistory

  • Type parameters

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • blockCount: Numbers

      Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.

    • newestBlock: undefined | BlockNumberOrTag

      Highest number block of the requested range.

    • rewardPercentiles: Numbers[]

      A monotonically increasing list of percentile values to sample from each block’s effective priority fees per gas in ascending order, weighted by gas used. Example: [“0”, “25”, “50”, “75”, “100”] or [“0”, “0.5”, “1”, “1.5”, “3”, “80”]

    • returnFormat: ReturnFormat

      (DataFormat defaults to DEFAULT_RETURN_FORMAT) - Specifies how the return data from the call should be formatted.

    Returns Promise<{ baseFeePerGas: NumberTypes[ReturnFormat[number]]; gasUsedRatio: NumberTypes[ReturnFormat[number]][]; oldestBlock: NumberTypes[ReturnFormat[number]]; reward: NumberTypes[ReturnFormat[number]][][] }>

    baseFeePerGas and transaction effective priorityFeePerGas history for the requested block range if available. The range between headBlock - 4 and headBlock is guaranteed to be available while retrieving data from the pending block and older history are optional to support. For pre-EIP-1559 blocks the gasPrices are returned as rewards and zeroes are returned for the baseFeePerGas.

    web3.eth.getFeeHistory(4, 'pending', [0, 25, 75, 100]).then(console.log);
    > {
    baseFeePerGas: [
    22983878621n,
    21417903463n,
    19989260230n,
    17770954829n,
    18850641304n
    ],
    gasUsedRatio: [
    0.22746546666666667,
    0.2331871,
    0.05610054885262125,
    0.7430227268212117
    ],
    oldestBlock: 15216343n,
    reward: [
    [ '0x3b9aca00', '0x53724e00', '0x77359400', '0x1d92c03423' ],
    [ '0x3b9aca00', '0x3b9aca00', '0x3b9aca00', '0xee6b2800' ],
    [ '0x3b9aca00', '0x4f86a721', '0x77d9743a', '0x9502f900' ],
    [ '0xcc8ff9e', '0x53724e00', '0x77359400', '0x1ec9771bb3' ]
    ]
    }

    web3.eth.getFeeHistory(4, BlockTags.LATEST, [0, 25, 75, 100], { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
    > {
    baseFeePerGas: [
    22983878621,
    21417903463,
    19989260230,
    17770954829,
    18850641304
    ],
    gasUsedRatio: [
    0.22746546666666667,
    0.2331871,
    0.05610054885262125,
    0.7430227268212117
    ],
    oldestBlock: 15216343,
    reward: [
    [ '0x3b9aca00', '0x53724e00', '0x77359400', '0x1d92c03423' ],
    [ '0x3b9aca00', '0x3b9aca00', '0x3b9aca00', '0xee6b2800' ],
    [ '0x3b9aca00', '0x4f86a721', '0x77d9743a', '0x9502f900' ],
    [ '0xcc8ff9e', '0x53724e00', '0x77359400', '0x1ec9771bb3' ]
    ]
    }

getGasPrice

  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The gas price determined by the last few blocks median gas price.

    web3.eth.getGasPrice().then(console.log);
    > 20000000000n

    web3.eth.getGasPrice({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
    > "0x4a817c800"

getHashRate

  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The number of hashes per second that the node is mining with.

    web3.eth.getHashRate().then(console.log);
    > 493736n

    web3.eth.getHashRate({ number: FMT_NUMBER.HEX , bytes: FMT_BYTES.HEX }).then(console.log);
    > "0x788a8"

getLogs

  • Gets past logs, matching the provided filter.


    Type parameters

    Parameters

    Returns Promise<(string | { 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]] })[]>

    FilterResultsAPI, an array of Log objects.

    web3.eth.getPastLogs({
    address: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
    topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"]
    }).then(console.log);
    > [{
    data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
    logIndex: 0n,
    transactionIndex: 0n,
    transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
    blockNumber: 1234n,
    address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
    },
    {...}]

    web3.eth.getPastLogs(
    {
    address: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
    topics: ["0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"]
    },
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > [{
    data: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    topics: ['0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7', '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385']
    logIndex: 0,
    transactionIndex: 0,
    transactionHash: '0x7f9fade1c0d57a7af66ab4ead79fade1c0d57a7af66ab4ead7c2c2eb7b11a91385',
    blockHash: '0xfd43ade1c09fade1c0d57a7af66ab4ead7c2c2eb7b11a91ffdd57a7af66ab4ead7',
    blockNumber: 1234,
    address: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe'
    },
    {...}]

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?: Hardfork }; data?: ByteTypes[ReturnFormat[bytes]]; from?: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: Hardfork; 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 }[]>

    A list of pending transactions.

    web3.eth.getPendingTransactions().then(console.log);
    > [
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0n,
    nonce: 0n,
    blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    blockNumber: null,
    transactionIndex: 0n,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1n,
    gas: 90000n,
    gasPrice: 2000000000n,
    input: '0x',
    v: 2709n,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    },
    {
    hash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
    type: 0n,
    nonce: 1n,
    blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    blockNumber: null,
    transactionIndex: 0n,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1n,
    gas: 90000n,
    gasPrice: 2000000000n,
    input: '0x',
    v: 2710n,
    r: '0x55ac19fade21db035a1b7ea0a8d49e265e05dbb926e75f273f836ad67ce5c96a',
    s: '0x6550036a7c3fd426d5c3d35d96a7075cd673957620b7889846a980d2d017ec08'
    }
    ]

    * web3.eth.getPendingTransactions({ number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
    > [
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0,
    nonce: 0,
    blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    blockNumber: null,
    transactionIndex: 0,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1,
    gas: 90000,
    gasPrice: 2000000000,
    input: '0x',
    v: 2709,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    },
    {
    hash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
    type: 0,
    nonce: 1,
    blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    blockNumber: null,
    transactionIndex: 0,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1,
    gas: 90000,
    gasPrice: 2000000000,
    input: '0x',
    v: 2710,
    r: '0x55ac19fade21db035a1b7ea0a8d49e265e05dbb926e75f273f836ad67ce5c96a',
    s: '0x6550036a7c3fd426d5c3d35d96a7075cd673957620b7889846a980d2d017ec08'
    }
    ]

getProof

  • Type parameters

    Parameters

    • web3Context: Web3Context<Web3EthExecutionAPI, any>

      (Web3Context) Web3 configuration object that contains things such as the provider, request manager, wallet, etc.

    • address: string

      The Address of the account or contract.

    • storageKeys: Bytes[]

      Array of storage-keys which should be proofed and included. See web3.getStorageAt.

    • blockNumber: undefined | BlockNumberOrTag

      (BlockNumberOrTag defaults to Web3Eth.defaultBlock) - Specifies what block to use as the current state of the blockchain while processing the gas estimation.

    • returnFormat: ReturnFormat

      (DataFormat defaults to DEFAULT_RETURN_FORMAT) - Specifies how the return data from the call should be formatted.

    Returns Promise<{ accountProof: ByteTypes[ReturnFormat[bytes]][]; balance: NumberTypes[ReturnFormat[number]]; codeHash: ByteTypes[ReturnFormat[bytes]]; nonce: NumberTypes[ReturnFormat[number]]; storageHash: ByteTypes[ReturnFormat[bytes]]; storageProof: { key: ByteTypes[ReturnFormat[bytes]]; proof: ByteTypes[ReturnFormat[bytes]][]; value: NumberTypes[ReturnFormat[number]] }[] }>

    The account and storage-values of the specified account including the Merkle-proof as described in EIP-1186.

    web3.eth.getProof(
    "0x1234567890123456789012345678901234567890",
    ["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"],
    "latest"
    ).then(console.log);
    > {
    "address": "0x1234567890123456789012345678901234567890",
    "accountProof": [
    "0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80",
    "0xf90211a0395d87a95873cd98c21cf1df9421af03f7247880a2554e20738eec2c7507a494a0bcf6546339a1e7e14eb8fb572a968d217d2a0d1f3bc4257b22ef5333e9e4433ca012ae12498af8b2752c99efce07f3feef8ec910493be749acd63822c3558e6671a0dbf51303afdc36fc0c2d68a9bb05dab4f4917e7531e4a37ab0a153472d1b86e2a0ae90b50f067d9a2244e3d975233c0a0558c39ee152969f6678790abf773a9621a01d65cd682cc1be7c5e38d8da5c942e0a73eeaef10f387340a40a106699d494c3a06163b53d956c55544390c13634ea9aa75309f4fd866f312586942daf0f60fb37a058a52c1e858b1382a8893eb9c1f111f266eb9e21e6137aff0dddea243a567000a037b4b100761e02de63ea5f1fcfcf43e81a372dafb4419d126342136d329b7a7ba032472415864b08f808ba4374092003c8d7c40a9f7f9fe9cc8291f62538e1cc14a074e238ff5ec96b810364515551344100138916594d6af966170ff326a092fab0a0d31ac4eef14a79845200a496662e92186ca8b55e29ed0f9f59dbc6b521b116fea090607784fe738458b63c1942bba7c0321ae77e18df4961b2bc66727ea996464ea078f757653c1b63f72aff3dcc3f2a2e4c8cb4a9d36d1117c742833c84e20de994a0f78407de07f4b4cb4f899dfb95eedeb4049aeb5fc1635d65cf2f2f4dfd25d1d7a0862037513ba9d45354dd3e36264aceb2b862ac79d2050f14c95657e43a51b85c80",
    "0xf90171a04ad705ea7bf04339fa36b124fa221379bd5a38ffe9a6112cb2d94be3a437b879a08e45b5f72e8149c01efcb71429841d6a8879d4bbe27335604a5bff8dfdf85dcea00313d9b2f7c03733d6549ea3b810e5262ed844ea12f70993d87d3e0f04e3979ea0b59e3cdd6750fa8b15164612a5cb6567cdfb386d4e0137fccee5f35ab55d0efda0fe6db56e42f2057a071c980a778d9a0b61038f269dd74a0e90155b3f40f14364a08538587f2378a0849f9608942cf481da4120c360f8391bbcc225d811823c6432a026eac94e755534e16f9552e73025d6d9c30d1d7682a4cb5bd7741ddabfd48c50a041557da9a74ca68da793e743e81e2029b2835e1cc16e9e25bd0c1e89d4ccad6980a041dda0a40a21ade3a20fcd1a4abb2a42b74e9a32b02424ff8db4ea708a5e0fb9a09aaf8326a51f613607a8685f57458329b41e938bb761131a5747e066b81a0a16808080a022e6cef138e16d2272ef58434ddf49260dc1de1f8ad6dfca3da5d2a92aaaadc58080",
    "0xf851808080a009833150c367df138f1538689984b8a84fc55692d3d41fe4d1e5720ff5483a6980808080808080808080a0a319c1c415b271afc0adcb664e67738d103ac168e0bc0b7bd2da7966165cb9518080"
    ],
    "balance": 0n,
    "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
    "nonce": 0n,
    "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "storageProof": [
    {
    "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "value": 0n,
    "proof": []
    },
    {
    "key": "0x0000000000000000000000000000000000000000000000000000000000000001",
    "value": 0n,
    "proof": []
    }
    ]
    }

    web3.eth.getProof(
    "0x1234567890123456789012345678901234567890",
    ["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"],
    undefined,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > {
    "address": "0x1234567890123456789012345678901234567890",
    "accountProof": [
    "0xf90211a090dcaf88c40c7bbc95a912cbdde67c175767b31173df9ee4b0d733bfdd511c43a0babe369f6b12092f49181ae04ca173fb68d1a5456f18d20fa32cba73954052bda0473ecf8a7e36a829e75039a3b055e51b8332cbf03324ab4af2066bbd6fbf0021a0bbda34753d7aa6c38e603f360244e8f59611921d9e1f128372fec0d586d4f9e0a04e44caecff45c9891f74f6a2156735886eedf6f1a733628ebc802ec79d844648a0a5f3f2f7542148c973977c8a1e154c4300fec92f755f7846f1b734d3ab1d90e7a0e823850f50bf72baae9d1733a36a444ab65d0a6faaba404f0583ce0ca4dad92da0f7a00cbe7d4b30b11faea3ae61b7f1f2b315b61d9f6bd68bfe587ad0eeceb721a07117ef9fc932f1a88e908eaead8565c19b5645dc9e5b1b6e841c5edbdfd71681a069eb2de283f32c11f859d7bcf93da23990d3e662935ed4d6b39ce3673ec84472a0203d26456312bbc4da5cd293b75b840fc5045e493d6f904d180823ec22bfed8ea09287b5c21f2254af4e64fca76acc5cd87399c7f1ede818db4326c98ce2dc2208a06fc2d754e304c48ce6a517753c62b1a9c1d5925b89707486d7fc08919e0a94eca07b1c54f15e299bd58bdfef9741538c7828b5d7d11a489f9c20d052b3471df475a051f9dd3739a927c89e357580a4c97b40234aa01ed3d5e0390dc982a7975880a0a089d613f26159af43616fd9455bb461f4869bfede26f2130835ed067a8b967bfb80",
    "0xf90211a0395d87a95873cd98c21cf1df9421af03f7247880a2554e20738eec2c7507a494a0bcf6546339a1e7e14eb8fb572a968d217d2a0d1f3bc4257b22ef5333e9e4433ca012ae12498af8b2752c99efce07f3feef8ec910493be749acd63822c3558e6671a0dbf51303afdc36fc0c2d68a9bb05dab4f4917e7531e4a37ab0a153472d1b86e2a0ae90b50f067d9a2244e3d975233c0a0558c39ee152969f6678790abf773a9621a01d65cd682cc1be7c5e38d8da5c942e0a73eeaef10f387340a40a106699d494c3a06163b53d956c55544390c13634ea9aa75309f4fd866f312586942daf0f60fb37a058a52c1e858b1382a8893eb9c1f111f266eb9e21e6137aff0dddea243a567000a037b4b100761e02de63ea5f1fcfcf43e81a372dafb4419d126342136d329b7a7ba032472415864b08f808ba4374092003c8d7c40a9f7f9fe9cc8291f62538e1cc14a074e238ff5ec96b810364515551344100138916594d6af966170ff326a092fab0a0d31ac4eef14a79845200a496662e92186ca8b55e29ed0f9f59dbc6b521b116fea090607784fe738458b63c1942bba7c0321ae77e18df4961b2bc66727ea996464ea078f757653c1b63f72aff3dcc3f2a2e4c8cb4a9d36d1117c742833c84e20de994a0f78407de07f4b4cb4f899dfb95eedeb4049aeb5fc1635d65cf2f2f4dfd25d1d7a0862037513ba9d45354dd3e36264aceb2b862ac79d2050f14c95657e43a51b85c80",
    "0xf90171a04ad705ea7bf04339fa36b124fa221379bd5a38ffe9a6112cb2d94be3a437b879a08e45b5f72e8149c01efcb71429841d6a8879d4bbe27335604a5bff8dfdf85dcea00313d9b2f7c03733d6549ea3b810e5262ed844ea12f70993d87d3e0f04e3979ea0b59e3cdd6750fa8b15164612a5cb6567cdfb386d4e0137fccee5f35ab55d0efda0fe6db56e42f2057a071c980a778d9a0b61038f269dd74a0e90155b3f40f14364a08538587f2378a0849f9608942cf481da4120c360f8391bbcc225d811823c6432a026eac94e755534e16f9552e73025d6d9c30d1d7682a4cb5bd7741ddabfd48c50a041557da9a74ca68da793e743e81e2029b2835e1cc16e9e25bd0c1e89d4ccad6980a041dda0a40a21ade3a20fcd1a4abb2a42b74e9a32b02424ff8db4ea708a5e0fb9a09aaf8326a51f613607a8685f57458329b41e938bb761131a5747e066b81a0a16808080a022e6cef138e16d2272ef58434ddf49260dc1de1f8ad6dfca3da5d2a92aaaadc58080",
    "0xf851808080a009833150c367df138f1538689984b8a84fc55692d3d41fe4d1e5720ff5483a6980808080808080808080a0a319c1c415b271afc0adcb664e67738d103ac168e0bc0b7bd2da7966165cb9518080"
    ],
    "balance": 0,
    "codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
    "nonce": 0,
    "storageHash": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "storageProof": [
    {
    "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "value": 0,
    "proof": []
    },
    {
    "key": "0x0000000000000000000000000000000000000000000000000000000000000001",
    "value": 0,
    "proof": []
    }
    ]
    }

getProtocolVersion

  • Parameters

    Returns Promise<string>

    Returns the ethereum protocol version of the node.

    web3.eth.getProtocolVersion().then(console.log);
    > "63"

getStorageAt

  • Get the storage at a specific position of an address.


    Type parameters

    Parameters

    Returns Promise<string>

    The value in storage at the given position.

    web3.eth.getStorageAt("0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234", 0).then(console.log);
    > "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234"

    web3.eth.getStorageAt(
    "0x033456732123ffff2342342dd12342434324234234fd234fd23fd4f23d4234",
    0,
    undefined,
    { number: FMT_NUMBER.HEX , bytes: FMT_BYTES.BUFFER }
    ).then(console.log);
    > <Buffer 03 34 56 73 21 23 ff ff 23 42 34 2d d1 23 42 43 43 24 23 42 34 fd 23 4f d2 3f d4 f2 3d 42 34>

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; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; 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; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; value: string; yParity: string } | { blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>
  • Type parameters

    Parameters

    Returns Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; 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; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; value: string; yParity: string } | { blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>

    The desired transaction object.

    web3.eth.getTransaction('0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc').then(console.log);
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0n,
    nonce: 0n,
    blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
    blockNumber: 1n,
    transactionIndex: 0n,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1n,
    gas: 90000n,
    gasPrice: 2000000000n,
    input: '0x',
    v: 2709n,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    }

    web3.eth.getTransaction(
    <Buffer 30 78 37 33 61 65 61 37 30 65 39 36 39 39 34 31 66 32 33 66 39 64 32 34 31 30 33 65 39 31 61 61 31 66 35 35 63 37 39 36 34 65 62 31 33 64 61 66 31 63 ... >,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0,
    nonce: 0,
    blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
    blockNumber: 1,
    transactionIndex: 0,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1,
    gas: 90000,
    gasPrice: 2000000000,
    input: '0x',
    v: 2709,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    }

getTransactionCount

  • Type parameters

    Parameters

    Returns Promise<NumberTypes[ReturnFormat[number]]>

    The number of transactions sent from the provided address.

    web3.eth.getTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
    > 1n

    web3.eth.getTransactionCount(
    "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    undefined,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > 1

getTransactionFromBlock

  • getTransactionFromBlock<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, block: undefined | string | number | bigint | Buffer | ArrayBuffer | Uint8Array, transactionIndex: Numbers, returnFormat: ReturnFormat): Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; 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; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; value: string; yParity: string } | { blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>
  • Type parameters

    Parameters

    Returns Promise<{ accessList: { address?: string; storageKeys?: string[] }[]; blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; hash: string; input: string; maxFeePerGas: string; maxPriorityFeePerGas: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; 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; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; value: string; yParity: string } | { blockHash?: string; blockNumber?: string; chainId?: string; data?: string; from: string; gas: string; gasPrice: string; hash: string; input: string; nonce: string; r: string; s: string; to?: string | null; transactionIndex?: string; type: string; v: string; value: string } | undefined>

    The desired transaction object.

    web3.eth.getTransactionFromBlock('0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00', 0).then(console.log);
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0n,
    nonce: 0n,
    blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
    blockNumber: 1n,
    transactionIndex: 0n,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1n,
    gas: 90000n,
    gasPrice: 2000000000n,
    input: '0x',
    v: 2709n,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    }

    web3.eth.getTransactionFromBlock(
    <Buffer 30 78 34 33 32 30 32 62 64 31 36 62 36 62 64 35 34 62 65 61 31 62 33 31 30 37 33 36 62 64 37 38 62 64 62 65 39 33 61 36 34 61 64 39 34 30 66 37 35 38 ... >,
    0,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    {
    hash: '0x73aea70e969941f23f9d24103e91aa1f55c7964eb13daf1c9360c308a72686dc',
    type: 0,
    nonce: 0,
    blockHash: '0x43202bd16b6bd54bea1b310736bd78bdbe93a64ad940f7586739d9eb25ad8d00',
    blockNumber: 1,
    transactionIndex: 0,
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    value: 1,
    gas: 90000,
    gasPrice: 2000000000,
    input: '0x',
    v: 2709,
    r: '0x8b336c290f6d7b2af3ccb2c02203a8356cc7d5b150ab19cce549d55636a3a78c',
    s: '0x5a83c6f816befc5cd4b0c997a347224a8aa002e5799c4b082a3ec726d0e9531d'
    }

getTransactionReceipt

  • getTransactionReceipt<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, transactionHash: Bytes, returnFormat: ReturnFormat): Promise<TransactionReceipt | undefined>
  • Type parameters

    Parameters

    Returns Promise<TransactionReceipt | undefined>

    The desired TransactionReceipt object.

    web3.eth.getTransactionReceipt("0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f").then(console.log);
    > {
    transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
    transactionIndex: 0n,
    blockNumber: 2n,
    blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a',
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    cumulativeGasUsed: 21000n,
    gasUsed: 21000n,
    logs: [],
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    status: 1n,
    effectiveGasPrice: 2000000000n,
    type: 0n
    }

    web3.eth.getTransactionReceipt(
    "0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f",
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > {
    transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
    transactionIndex: 0,
    blockNumber: 2,
    blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a',
    from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
    to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
    cumulativeGasUsed: 21000,
    gasUsed: 21000,
    logs: [],
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    status: 1,
    effectiveGasPrice: 2000000000,
    type: 0n
    }

getUncle

  • Type parameters

    Parameters

    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?: Hardfork }; data?: ByteTypes[ReturnFormat[bytes]]; from: string; gas?: NumberTypes[ReturnFormat[number]]; gasLimit?: NumberTypes[ReturnFormat[number]]; gasPrice?: NumberTypes[ReturnFormat[number]]; hardfork?: Hardfork; 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[] }>

    A blocks uncle by a given uncle index position.

    web3.eth.getUncle(0, 1).then(console.log);
    > {
    hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
    parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
    miner: '0x0000000000000000000000000000000000000000',
    stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
    transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    difficulty: 1n,
    number: 0n,
    gasLimit: 30000000n,
    gasUsed: 0n,
    timestamp: 1658281638n,
    extraData: '0x',
    mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    nonce: 0n,
    totalDifficulty: 1n,
    baseFeePerGas: 1000000000n,
    size: 514n,
    transactions: [],
    uncles: []
    }

    web3.eth.getUncle(
    "0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d",
    1,
    { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }
    ).then(console.log);
    > {
    hash: '0x7dbfdc6a7a67a670cb9b0c3f81ca60c007762f1e4e598cb027a470678ff26d0d',
    parentHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
    miner: '0x0000000000000000000000000000000000000000',
    stateRoot: '0x5ed9882897d363c4632a6e67fba6203df61bd994813dcf048da59be442a9c6c4',
    transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    difficulty: 1,
    number: 0,
    gasLimit: 30000000,
    gasUsed: 0,
    timestamp: 1658281638,
    extraData: '0x',
    mixHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
    nonce: 0,
    totalDifficulty: 1,
    baseFeePerGas: 1000000000,
    size: 514,
    transactions: [],
    uncles: []
    }

isAccessList

isAccessListEntry

isBaseTransaction

isMining

  • Checks whether the node is mining or not.


    Parameters

    Returns Promise<boolean>

    true if the node is mining, otherwise false.

    web3.eth.isMining().then(console.log);
    > true

isSyncing

  • Checks if the node is currently syncing.


    Parameters

    Returns Promise<SyncingStatusAPI>

    Either a SyncingStatusAPI, or false.

    web3.eth.isSyncing().then(console.log);
    > {
    startingBlock: 100,
    currentBlock: 312,
    highestBlock: 512,
    knownStates: 234566,
    pulledStates: 123455
    }

isTransaction1559Unsigned

isTransaction2930Unsigned

isTransactionCall

isTransactionLegacyUnsigned

isTransactionWithSender

prepareTransactionForSigning

sendSignedTransaction

  • Type parameters

    • ReturnFormat: DataFormat
    • ResolveType = { blockHash: ByteTypes[ReturnFormat[bytes]]; blockNumber: NumberTypes[ReturnFormat[number]]; contractAddress?: string; cumulativeGasUsed: NumberTypes[ReturnFormat[number]]; effectiveGasPrice?: NumberTypes[ReturnFormat[number]]; from: string; gasUsed: NumberTypes[ReturnFormat[number]]; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: NumberTypes[ReturnFormat["number"]] | undefined; ... 6 more ...; readonly topics?: ByteTypes[ReturnFormat["bytes"]][] | undefined; }[]; 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]] }

    Parameters

    Returns Web3PromiEvent<ResolveType, SendSignedTransactionEvents<ReturnFormat>>

    If awaited or .thend (i.e. the promise resolves), the transaction hash is returned.

    const signedTransaction = "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f"

    const transactionHash = await web3.eth.sendSignedTransaction(signedTransaction);
    console.log(transactionHash);
    > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700

    web3.eth.sendSignedTransaction(signedTransaction).then(console.log);
    > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700

    web3.eth.sendSignedTransaction(signedTransaction).catch(console.log);
    > <Some TransactionError>

    Otherwise, a Web3PromiEvent is returned which has several events than can be listened to using the .on syntax, such as:

    • sending
      web3.eth.sendSignedTransaction(signedTransaction).on('sending', transactionToBeSent => console.log(transactionToBeSent));
      > "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f"
    • sent
      web3.eth.sendSignedTransaction(signedTransaction).on('sent', sentTransaction => console.log(sentTransaction));
      > "0xf86580843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a95a03a42d53ca5b71f845e1cd4c65359b05446a85d16881372d3bfaab8980935cb04a0711497bc8dd3b541152e2fed14fe650a647f1f0edab0d386ad9506f0e642410f"
    • transactionHash
      web3.eth.sendSignedTransaction(signedTransaction).on('transactionHash', transactionHash => console.log(transactionHash));
      > 0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700
    • receipt
      web3.eth.sendSignedTransaction(signedTransaction).on('receipt', receipt => console.log(receipt));
      > {
      blockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081',
      blockNumber: 1n,
      cumulativeGasUsed: 21000n,
      effectiveGasPrice: 1000000001n,
      from: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
      gasUsed: 21000n,
      logs: [],
      logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      status: 1n,
      to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
      transactionHash: '0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700',
      transactionIndex: 0n,
      type: 0n
      }
    • confirmation
      web3.eth.sendSignedTransaction(signedTransaction).on('confirmation', confirmation => console.log(confirmation));
      > {
      confirmations: 1n,
      receipt: {
      blockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081',
      blockNumber: 1n,
      cumulativeGasUsed: 21000n,
      effectiveGasPrice: 1000000001n,
      from: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
      gasUsed: 21000n,
      logs: [],
      logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      status: 1n,
      to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
      transactionHash: '0xed8c241ea44d57f4605dc22c63500de46254d6c7844fd65fa438b128c80cf700',
      transactionIndex: 0n,
      type: 0n
      },
      latestBlockHash: '0xff2b1687995d81066361bc6affe4455746120a7d4bb75fc938211a2692a50081'
      }
    • error
      web3.eth.sendSignedTransaction(signedTransaction).on('error', error => console.log(error));
      > <Some TransactionError>

sendTransaction

  • Type parameters

    • ReturnFormat: DataFormat
    • ResolveType = { blockHash: ByteTypes[ReturnFormat[bytes]]; blockNumber: NumberTypes[ReturnFormat[number]]; contractAddress?: string; cumulativeGasUsed: NumberTypes[ReturnFormat[number]]; effectiveGasPrice?: NumberTypes[ReturnFormat[number]]; from: string; gasUsed: NumberTypes[ReturnFormat[number]]; logs: { readonly id?: string | undefined; readonly removed?: boolean | undefined; readonly logIndex?: NumberTypes[ReturnFormat["number"]] | undefined; ... 6 more ...; readonly topics?: ByteTypes[ReturnFormat["bytes"]][] | undefined; }[]; 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]] }

    Parameters

    Returns Web3PromiEvent<ResolveType, SendTransactionEvents<ReturnFormat>>

    If awaited or .thend (i.e. the promise resolves), the transaction hash is returned.

    const transaction = {
    from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
    to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
    value: '0x1'
    }

    const transactionHash = await web3.eth.sendTransaction(transaction);
    console.log(transactionHash);
    > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f

    web3.eth.sendTransaction(transaction).then(console.log);
    > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f

    web3.eth.sendTransaction(transaction).catch(console.log);
    > <Some TransactionError>

    // Example using options.ignoreGasPricing = true
    web3.eth.sendTransaction(transaction, undefined, { ignoreGasPricing: true }).then(console.log);
    > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f

    Otherwise, a Web3PromiEvent is returned which has several events than can be listened to using the .on syntax, such as:

    • sending
      web3.eth.sendTransaction(transaction).on('sending', transactionToBeSent => console.log(transactionToBeSent));
      > {
      from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
      to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
      value: '0x1',
      gasPrice: '0x77359400',
      maxPriorityFeePerGas: undefined,
      maxFeePerGas: undefined
      }
    • sent
      web3.eth.sendTransaction(transaction).on('sent', sentTransaction => console.log(sentTransaction));
      > {
      from: '0x6E599DA0bfF7A6598AC1224E4985430Bf16458a4',
      to: '0x6f1DF96865D09d21e8f3f9a7fbA3b17A11c7C53C',
      value: '0x1',
      gasPrice: '0x77359400',
      maxPriorityFeePerGas: undefined,
      maxFeePerGas: undefined
      }
    • transactionHash
      web3.eth.sendTransaction(transaction).on('transactionHash', transactionHash => console.log(transactionHash));
      > 0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f
    • receipt
      web3.eth.sendTransaction(transaction).on('receipt', receipt => console.log(receipt));
      > {
      transactionHash: '0xdf7756865c2056ce34c4eabe4eff42ad251a9f920a1c620c00b4ea0988731d3f',
      transactionIndex: 0n,
      blockNumber: 2n,
      blockHash: '0xeb1565a08b23429552dafa92e32409f42eb43944f7611963c63ce40e7243941a',
      from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
      to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
      cumulativeGasUsed: 21000n,
      gasUsed: 21000n,
      logs: [],
      logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      status: 1n,
      effectiveGasPrice: 2000000000n,
      type: 0n
      }
    • confirmation
      web3.eth.sendTransaction(transaction).on('confirmation', confirmation => console.log(confirmation));
      > {
      confirmations: 1n,
      receipt: {
      transactionHash: '0xb4a3a35ae0f3e77ef0ff7be42010d948d011b21a4e341072ee18717b67e99ab8',
      transactionIndex: 0n,
      blockNumber: 5n,
      blockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548',
      from: '0x6e599da0bff7a6598ac1224e4985430bf16458a4',
      to: '0x6f1df96865d09d21e8f3f9a7fba3b17a11c7c53c',
      cumulativeGasUsed: 21000n,
      gasUsed: 21000n,
      logs: [],
      logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      status: 1n,
      effectiveGasPrice: 2000000000n,
      type: 0n
      },
      latestBlockHash: '0xb57fbe6f145cefd86a305a9a024a4351d15d4d39607d7af53d69a319bc3b5548'
      }
    • error
      web3.eth.sendTransaction(transaction).on('error', error => console.log);
      > <Some TransactionError>

sign

  • sign<ReturnFormat>(web3Context: Web3Context<EthExecutionAPI, any>, message: Bytes, addressOrIndex: string | number, returnFormat: ReturnFormat): Promise<string | { message?: string; messageHash: string; r: string; s: string; signature: string; v: string }>
  • Type parameters

    Parameters

    Returns Promise<string | { message?: string; messageHash: string; r: string; s: string; signature: string; v: string }>

    The signed message.

    // Using an unlocked account managed by connected RPC client
    web3.eth.sign("0x48656c6c6f20776f726c64", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe").then(console.log);
    > "0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400"

    // Using an unlocked account managed by connected RPC client
    web3.eth.sign("0x48656c6c6f20776f726c64", "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.BUFFER }).then(console.log);
    > <Buffer 30 78 33 30 37 35 35 65 64 36 35 33 39 36 66 61 63 66 38 36 63 35 33 65 36 32 31 37 63 35 32 62 34 64 61 65 62 65 37 32 61 61 34 39 34 31 64 38 39 36 ... >

    // Using an indexed account managed by local Web3 wallet web3.eth.sign(“0x48656c6c6f20776f726c64”, 0).then(console.log);

    “0x30755ed65396facf86c53e6217c52b4daebe72aa4941d89635409de4c9c7f9466d4e9aaec7977f05e923889b33c0d0dd27d7226b6e6f56ce737465c5cfd04be400”

signTransaction

  • Type parameters

    Parameters

    Returns Promise<SignedTransactionInfoAPI>

    SignedTransactionInfoAPI, an object containing the RLP encoded signed transaction (accessed via the raw property) and the signed transaction object (accessed via the tx property).

    const transaction = {
    from: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
    to: '0xe899f0130FD099c0b896B2cE4E5E15A25b23139a',
    value: '0x1',
    gas: '21000',
    gasPrice: await web3Eth.getGasPrice(),
    nonce: '0x1',
    type: '0x0'
    }

    web3.eth.signTransaction(transaction).then(console.log);
    > {
    raw: '0xf86501843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a96a0adb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679a027d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
    tx: {
    type: 0n,
    nonce: 1n,
    gasPrice: 1000000001n,
    gas: 21000n,
    value: 1n,
    v: 2710n,
    r: '0xadb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679',
    s: '0x27d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
    to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
    data: '0x'
    }
    }

    web3.eth.signTransaction(transaction, { number: FMT_NUMBER.NUMBER , bytes: FMT_BYTES.HEX }).then(console.log);
    > {
    raw: '0xf86501843b9aca0182520894e899f0130fd099c0b896b2ce4e5e15a25b23139a0180820a96a0adb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679a027d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
    tx: {
    type: 0,
    nonce: 1,
    gasPrice: 1000000001,
    gas: 21000,
    value: 1,
    v: 2710,
    r: '0xadb3468dbb4dce89fe1785ea9182e85fb56b399b378f82b93af7a8a12a4f9679',
    s: '0x27d37d736e9bcf00121f78b2d10e4404fa5c45856d62b746574345f5cd278097',
    to: '0xe899f0130fd099c0b896b2ce4e5e15a25b23139a',
    data: '0x'
    }
    }

transactionBuilder

  • Type parameters

    • ReturnType_1 = Record<string, unknown>

    Parameters

    Returns Promise<ReturnType_1>

validateBaseChain

  • validateBaseChain(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateChainInfo

  • validateChainInfo(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateCustomChainInfo

  • validateCustomChainInfo(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateFeeMarketGas

  • validateFeeMarketGas(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateGas

  • validateGas(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateHardfork

  • validateHardfork(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateLegacyGas

  • validateLegacyGas(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }

    Returns void

validateTransactionCall

validateTransactionForSigning

  • validateTransactionForSigning(transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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): void
  • Parameters

    • transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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 }
    • optionaloverrideMethod: (transaction: { accessList?: { readonly address?: string | undefined; readonly storageKeys?: string[] | undefined; }[]; chain?: ValidChains; chainId?: string; common?: { customChain: { name?: string | undefined; networkId: string; chainId: string; }; baseChain?: ValidChains | undefined; hardfork?: Hardfork | undefined; }; data?: string; from?: string; gas?: string; gasLimit?: string; gasPrice?: string; hardfork?: Hardfork; 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

    Returns void

validateTransactionWithSender