Cleared

Event v133 → current #2

A preimage has been cleared.

View events on chain
Useful for: validatorsanalyticsdevelopers

The Big Picture

Frees storage and returns deposit.

Use Cases

  • Track cleanup

From Chain Metadata

A preimage has ben cleared.

Triggers

Preconditions

  • Preimage exists
  • Not requested

Effects

Postconditions

  • Data removed
  • Deposit returned

Event Data

#NameTypeDescription
0
hash
H256 T::Hashhash: 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