Indexing Incoming Transaction

The @indexTransaction decorator can be used to mark an indexer method that will be listening for incoming transactions on a contract. Please note that if you are only interested in handling calls to specific entrypoints, @indexEntrypoint is better suited for the job.

When an incoming transaction is detected on an indexed contract, the method will be invoked with detailed information about the call.


The following parameters will be passed to the indexing method:



The parameter object containing:

  • entrypoint property with the name of the entrypoint (string)

  • value with the parameter value (the exact type of the value will depend on the code of the contract)




The following code will print the sender and the tokens received on each incoming transaction:

export class MyContractIndexer {
        parameter: { entrypoint: string; value: unknown },
        dbContext: DbContext,
        indexingContext: TransactionIndexingContext,
    ): void | Promise<void> {
        let op = indexingContext.operationWithResult;
        console.log(`${op.sourceAddress} sent us ${op.amount} mutez`);

Last updated