Skip to main content

getBlockUncleCount

Callable

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

  • Type parameters

    • ReturnFormat: DataFormat

    Parameters

    • web3Context: Web3Context<EthExecutionAPI, any>

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

    • block: string | number | bigint | Buffer | Uint8Array | ArrayBuffer = web3Context.defaultBlock

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

    • returnFormat: ReturnFormat

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

    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