Tezos Dappetizer
  • Quick Start
  • How-to Guides
    • Using PostgreSQL
    • Exposing API with Hasura
  • Reference
    • Decorator-based Indexing
      • Indexing Entrypoint Call
      • Indexing Storage Change
      • Indexing Bigmap Update
      • Indexing Incoming Transaction
    • Interface-based Indexing
    • Configuration
    • Command Line
    • Usage Statistics
  • Technical Concepts
    • Indexing Cycle
    • Indexer Modules
  • Token Indexer
    • Introduction
    • Running Standalone in Docker
  • API Docs
  • dappetizer GitLab
Powered by GitBook
On this page
  • Parameters
  • Example

Was this helpful?

  1. Reference
  2. Decorator-based Indexing

Indexing Incoming Transaction

PreviousIndexing Bigmap UpdateNextInterface-based Indexing

Last updated 3 years ago

Was this helpful?

The 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, 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.

Parameters

The following parameters will be passed to the indexing method:

Name
Description

parameter

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)

dbContext

indexingContext

Example

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

export class MyContractIndexer {
    @indexTransaction()
    indexTransaction(
        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`);
    }
}

The to store data to.

The with additional information about the call.

@indexTransaction
@indexEntrypoint
DbContext
TransactionIndexingContext