Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Invalid type for block transactions #7090

@ghost

Description

Expected behavior

The eth.getBlock().transactions should either return empty array in case of empty block, or include undefined as part of its return type.

Actual behavior

import { Web3 } from "web3";

const web3 = new Web3('https://sepolia.infura.io/v3/xxxxxx');

const block = await web3.eth.getBlock(6058307, true);

console.log(block.transactions); // this is undefined!

Steps to reproduce the behavior

  1. use web3.eth.getBlock on an empty block.

Logs

Doesn't matter.

Environment

Doesn't matter.

Metadata

Metadata

Assignees

Labels

4.x4.0 relatedBugAddressing a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions