Indexing Bigmap Update

The @indexBigMapChange decorator can be used to mark an indexer method that will be listening for when a value in a bigmap stored with the contract changes.

When a bigmap change is detected on an indexed contract, the method will be invoked with detailed information about the change.

Parameters

The following parameters will be passed to the indexing method:

Example

The following code will print the value of the property bar every time the contract's bigmap called foo is updated:

interface FooValue {
    bar: string;
}

export class MyContractIndexer {
    @indexBigMapUpdate({ name: 'foo' })
    async indexTokenLambdasUpdate(
        key: string,
        value: FooValue | undefined, // Undefined represents a removal.
        dbContext: DbContext,
        indexingContext: BigMapUpdateIndexingContext,
    ): Promise<void> {
        console.log(value.bar);
    }
}

Last updated