markets method
All tradeable (active) markets with the state a frontend needs to render and mint: one chain read for ids + one batched PTB for the states.
Implementation
Future<List<ActiveMarket>> markets() async {
final ids = await markets_reads.activeMarketIds(_c._client, _c._config);
final states =
await markets_reads.marketStates(_c._client, _c._config, ids);
return [
for (var i = 0; i < ids.length; i++)
ActiveMarket(
id: ids[i],
expiryMs: states[i].expiryMs,
tickSize: fromRaw(states[i].tickSizeRaw, 9),
admissionTickSize: fromRaw(states[i].admissionTickSizeRaw, 9),
mintPaused: states[i].mintPaused,
referencePrice: PredictClient._referencePriceOf(states[i]),
)
];
}