import "../_dnt.polyfills.js"; import { Chain } from "./ChainRune.js" import { PatternRune } from "./PatternRune.js" export class EventsRune extends PatternRune, C, U> {} export interface Event { phase: EventPhase event: RE topics: Uint8Array[] } export type EventPhase = | ApplyExtrinsicEventPhase | FinalizationEventPhase | InitializationEventPhase export interface ApplyExtrinsicEventPhase { type: "ApplyExtrinsic" value: number } export interface FinalizationEventPhase { type: "Finalization" } export interface InitializationEventPhase { type: "Initialization" } // TODO: delete this export type SystemExtrinsicFailedEvent = Event<{ type: "System" value: { type: "ExtrinsicFailed" dispatchError: DispatchError dispatchInfo: any // TODO } }> export type DispatchError = | "Other" | "CannotLookup" | "BadOrigin" | "Module" | "ConsumerRemaining" | "NoProviders" | "TooManyConsumers" | "Token" | "Arithmetic" | "Transactional" | "Exhausted" | "Corruption" | "Unavailable" | { type: "Module"; value: number } export function isSystemExtrinsicFailedEvent(event: Event): event is SystemExtrinsicFailedEvent { if (event.event.type === "System") { const { value } = event.event return typeof value === "object" && value !== null && "type" in value && value.type === "ExtrinsicFailed" } return false }