Indexing Entrypoint Call
The @indexEntrypoint decorator can be used to mark an indexer method that will be listening for entrypoint calls on a contract. Please note that if you are interested in all incoming transactions regardless of the entrypoint, @indexTransaction is better suited for the job.
When a transaction calling a given named entrypoint is detected on an indexed contract, the method will be invoked with detailed information about the call.
Parameters
The following parameters will be passed to the indexing method:
parameter
The entrypoint parameter value. The exact type will depend on the code of the contract.
dbContext
The DbContext to store data to.
indexingContext
The TransactionIndexingContext with additional information about the call.
Example
The following code will print the value of the property bar
every time the contract's entrypoint foo
is called:
interface FooEntrypointParameter {
bar: string;
}
export class MyContractIndexer {
@indexEntrypoint('foo')
async indexFoo(
parameter: FooEntrypointParameter,
dbContext: DbContext,
indexingContext: TransactionIndexingContext,
): Promise<void> {
console.log(parameter.bar);
}
}
Last updated
Was this helpful?