Cache for blocks.
executeBatchCalls
is supposed to decrease calls to blockchain.
It only sends one request and returns data from each call.
web3 instance
web3 calls
array of return values from web3 calls
Internal function to get blocks by block number. It uses cache to avoid unnecessary requests.
web3 instance.
block numbers to get.
blocks data.
Returns blocks from cache by specified numbers.
blocks numbers
blocks data.
Function to log messages.
arguments to log
Function to optimize cached blocks. It removes old blocks from cache.
count of new blocks to add to cache
Function to save blocks to cache. It also optimizes cache size.
blocks to save to cache
Generated using TypeDoc
Class to get blocks by blockNumber. It uses cache to avoid unnecessary requests.
const getBlocksManager = new GetBlocksManager(); const blocks = await getBlocksManager.getBlocks(web3, blockNumbers);