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:
Name
Description
key
The changed key in the bigmap. The exact type will depend on the code of the contract.
value
The new value (or null, if the item was removed). The exact type will depend on the code of the contract.
dbContext
The DbContext to store data to.
indexingContext
The BigMapUpdateIndexingContext with additional information about the change.

Example

The following code will print the value of the property bar every time the contract's bigmap called foo is updated:
1
interface FooValue {
2
bar: string;
3
}
4
5
export class MyContractIndexer {
6
@indexBigMapUpdate({ name: 'foo' })
7
async indexTokenLambdasUpdate(
8
key: string,
9
value: FooValue | undefined, // Undefined represents a removal.
10
dbContext: DbContext,
11
indexingContext: BigMapUpdateIndexingContext,
12
): Promise<void> {
13
console.log(value.bar);
14
}
15
}
Copied!
Copy link