0xWeb
  • 0xWeb
  • πŸ’»Installation
  • πŸ—ƒοΈBlockchains
  • πŸ“¦Package Manager
    • πŸ“‚Folder structure
    • πŸš€Dequanto dependency
    • πŸŽ†Installing contracts
    • πŸ”’Versioning
  • πŸ”Wallet
    • πŸ”‘Keys notice
    • πŸ™‚Accounts
  • πŸ’»CLI
    • Commands Overview
  • πŸ—„οΈGnosis Safe
    • πŸ™†β€β™‚οΈZero Trust Wallet
  • πŸš€Dequanto
    • ℹ️Info
    • πŸ•ΈοΈRPC Client Pool
    • πŸ—οΈTx Builder
    • πŸ“€Tx Writer
    • ⛓️Blockchain Explorers
    • πŸͺ™Token Services
    • πŸ—ƒοΈIndexer
    • ✨Utilities
  • ⛑️Hardhat
    • ℹ️Info
    • ⬇️Installation
    • 🧩Compile
    • πŸ’«Deploy
  • 0️Openzeppelin
    • Openzeppelin contracts
Powered by GitBook
On this page
  1. Dequanto

Indexer

PreviousToken ServicesNextUtilities

Last updated 3 years ago

See πŸ”— for details.

With the indexer, you can go through a range of blocks and handle the transactions.

A range can be specified by block numbers or dates. The Indexer can also listen for incoming block headers and transactions.

import { BlocksTxIndexer } from '@dequanto/indexer/BlocksTxIndexer'

let indexer = new BlocksTxIndexer(platform, {
    name: 'foo worker',
    // loads also transactions from the mined blocks
    loadTransactions: true,
    // saves blockNumbers of already processed blocks
    persistance: true,
});

indexer.onBlock(async (
    client: Web3Client, 
    block: BlockTransactionString, 
    txs: Transaction[]
) => {
    // process txs
});

// starts indexing from the block at specified date
// as no end date is provided, after indexer is ready, it will listen for incomming blocks
indexer.start(new Date('2022-04-22T00:00:00Z'));

// gets current status 
let status = indexer.stats();
πŸš€
πŸ—ƒοΈ
BlocksTxIndexer