Useful for: validatorsanalyticsdevelopers
The Big Picture
Frees storage and returns deposit.
Use Cases
- Track cleanup
From Chain Metadata
A preimage has ben cleared.
Triggers
Emitted by
Preconditions
- Preimage exists
- Not requested
Effects
Storage Modified
Postconditions
- Data removed
- Deposit returned
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | hash | H256 T::Hash | hash: Cryptographic hash (32 bytes) |
Code Examples
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Subscribe to Cleared events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Preimage.Cleared.get(block.hash);
for (const evt of events) {
console.log("Cleared:", evt.payload);
}
});Runtime Info
- Pallet Index
- 14
- Event Index
- 2
- First Version
- v133
- Current Version
- v411