Skip to content

queryDokenStateByIndex

queryDokenStateByIndex(api, doken, index): Promise<DokenState>

Retrieves the state change details for a specific index in the doken’s state history.

api: ApiPromise

An instance of ApiPromise from @polkadot/api, connected to the CORD network.

doken: string

A string representing the doken identifier (not necessarily in hex).

index: number

A non-negative integer indicating the position of the state change in the history (e.g., 0 for creation).

Promise<DokenState>

A Promise resolving to a DokenState object containing the state, action, and height.

Error if doken is invalid, index is negative or non-integer, or no state change is found at the given index.

const state = await queryDokenStateByIndex(api, 'T6fvpeF1Q5y1qFB15aUnTpreo7JRLgJFM1ED5Qzqw6dV8oCnP4kS', 0);
console.log(state); // { state: '...', action: 'RegistryEntryCreated', height: 748 }

utils/src/DokenHistory.ts:31