Dispatched

Event v133 → v148, v149 → current #2

Emitted when a scheduled task is executed.

View events on chain
Useful for: developersanalytics

The Big Picture

The actual execution of a scheduled call - includes dispatch result for success/failure.

Use Cases

  • Track task execution outcomes
  • Monitor scheduled operations

From Chain Metadata

Dispatched some task.

Triggers

Preconditions

  • Block reached scheduled time
  • Task existed in Agenda

Effects

Postconditions

  • Task executed (success or failure recorded in result)

Side Effects

  • Side effects of the dispatched call
  • May reschedule if periodic

Event Data

#NameTypeDescription
0
task
(u32, u32) TaskAddress<BlockNumberFor<T>>Task address as (block_number, index) tuple
1
id
Option Option<TaskName>Optional 32-byte task name (None for anonymous tasks)
2
result
Result DispatchResultDispatch result (Ok or Err with error details)

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 Dispatched events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Scheduler.Dispatched.get(block.hash);
  for (const evt of events) {
    console.log("Dispatched:", evt.payload);
  }
});

Version History

v133 block 1,404,224 3 args
v149 block 3,014,339 3 args Current

Runtime Info

Pallet Index
15
Event Index
2
First Version
v133
Current Version
v411