-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
enhancementNew feature or improvement.New feature or improvement.
Description
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
Labels
enhancementNew feature or improvement.New feature or improvement.