From Chain Metadata
`:code` was updated.
Triggers
Preconditions
- Valid runtime upgrade authorized
- New code is valid WASM
Effects
Storage Modified
Postconditions
- New runtime code in effect
- Spec version typically incremented
Side Effects
- All nodes must update to new runtime
- May change behavior of existing calls
This event has no data fields.
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 CodeUpdated events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.System.CodeUpdated.get(block.hash);
for (const evt of events) {
console.log("CodeUpdated:", evt.payload);
}
});Runtime Info
- Pallet Index
- 0
- Event Index
- 2
- First Version
- v101
- Current Version
- v411