Skip to content

Please add the ability to use eth_getBlockReceipts #5073

@dlebee

Description

@dlebee

Describe the Feature

Please incorporate the ability to getting a block receipts in one request.

Made an example PR here: #5069

Appreciated,
David

Code Example

export async function getBlockReceipts(
    rpc: ethers.JsonRpcApiProvider,
    block: ethers.Block
): Promise<ethers.TransactionReceipt[]> {
    // Regular Infura/compatible RPC takes block number as hexadecimal string
    const finalBlockNumber = `0x${block.number.toString(16)}`;

    // Call the RPC method to get all receipts for the block
    const receiptsRaw: Array<any> = await rpc.send('eth_getBlockReceipts', [finalBlockNumber]);
    
    // Wrap raw receipts into proper TransactionReceipt objects
    const receipts = receiptsRaw.map(r => {
        const receipt = rpc._wrapTransactionReceipt(r, rpc._network);
        return receipt;
    });
    
    return receipts;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions