Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

@tevm/receipt-manager

ZEVM-backed transaction receipt storage and lookup. Powers Tevm's eth_getTransactionReceipt, eth_getBlockReceipts, eth_getLogs, filter, and subscription flows.

Installation

npm install @tevm/receipt-manager

API

ReceiptsManager

import { ReceiptsManager } from '@tevm/receipt-manager'
 
const receiptsManager = new ReceiptsManager(mapDb, chain)

Methods:

  • saveReceipts(block, receipts)
  • getReceipts(blockHash)
  • getReceiptByTxHash(txHash)
  • getLogs(from, to, addresses?, topics?)
  • deleteReceipts(block)

Receipt Types

interface BaseTxReceipt {
  cumulativeBlockGasUsed: bigint
  bitvector: Uint8Array
  logs: Log[]
}
 
interface PreByzantiumTxReceipt extends BaseTxReceipt {
  stateRoot: Uint8Array
}
 
interface PostByzantiumTxReceipt extends BaseTxReceipt {
  status: 0 | 1
}
 
interface EIP4844BlobTxReceipt extends PostByzantiumTxReceipt {
  blobGasUsed: bigint
  blobGasPrice: bigint
}
 
type TxReceipt = PreByzantiumTxReceipt | PostByzantiumTxReceipt | EIP4844BlobTxReceipt

MapDb

import { createMapDb } from '@tevm/receipt-manager'
 
const mapDb = createMapDb({ cache: new Map() })
interface MetaDBManagerOptions {
  cache: Map<`0x${string}`, Uint8Array>
}

Limits

GET_LOGS_LIMIT = 10000
GET_LOGS_LIMIT_MEGABYTES = 150
GET_LOGS_BLOCK_RANGE_LIMIT = 2500

Usage Examples

await receiptsManager.saveReceipts(block, receipts)
const receipts = await receiptsManager.getReceipts(blockHash)
const receipt = await receiptsManager.getReceiptByTxHash(txHash)
const logs = await receiptsManager.getLogs(fromBlock, toBlock, addresses, topics)

DbType

type DbType = 'Receipts' | 'TxHash' | 'SkeletonBlock' | 'SkeletonBlockHashToNumber' |
  'SkeletonStatus' | 'SkeletonUnfinalizedBlockByHash' | 'Preimage'