Indexing Storage Change
The @indexStorageChange decorator can be used to mark an indexer method that will be listening for storage changes on a contract.
When a storage 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
newStorage
The new storage value. The exact type will depend on the code of the contract.
dbContext
The DbContext to store data to.
indexingContext
The StorageChangeIndexingContext with additional information about the change.

Example

The following code will print the value of the property foo every time the contract has new storage:
1
interface MyContractChangedStorage {
2
foo: string;
3
}
4
5
export class MyContractIndexer {
6
@indexStorageChange()
7
async indexStorageChange(
8
newStorage: MyContractChangedStorage,
9
dbContext: DbContext,
10
indexingContext: StorageChangeIndexingContext,
11
): Promise<void> {
12
console.log(newStorage.foo);
13
}
14
}
Copied!
Copy link