Advanced options
When initializing Checkpoint library there is an optional parameter that can be passed to configure some extra behavior of the library.
The type definition for the option object is:
This option can be provided as the final argument to the Checkpoint constructor like this:
See more about the configuration options below.
Database options
By default, when a Checkpoint
object is started, it looks up the DATABASE_URL
environment variable, but with dbConnection
option parameter, you can specify a different connection string within the codebase itself and this value will override the DATABASE_URL
value in the environment when connecting to the database.
Logging options
There are six (6) log levels currently supported by Checkpoint, these are:
In a non-production environment, you can set the prettifyLogs
option to true
and this will output a pretty version
Overrides config
Seed checkpoints manually
You can seed Checkpoint with a list of blocks, and Checkpoint will start by scanning this list of blocks first and invokes the appropriate data writers for any events founds. Once Checkpoint checks through the list of seeded blocks, it continues sequential scanning from the next block.
There is a seedCheckpoints
method defined on Checkpoint instances:
This seedCheckpoints
method should be called before starting the indexer, and the method can be called with as many contracts and blocks you already have.\
Exporting checkpoint blocks
You can set up a process (or external service) that periodically uses the _checkpoints
query to fetch the latest blocks and export them for archiving or sharing with another instance of Checkpoint.
Using our Poster contract examples from above, to fetch all blocks where Checkpoint has encountered an event, you can run the following query:
Last updated
Was this helpful?