requestCurrentTickInfo
Queries the current tick and epoch from a Qubic node.
Signature
requestCurrentTickInfo(
conn: NodeConnection | NodePool,
options?: { signal?: AbortSignal },
): Promise<CurrentTickInfo>Purpose
Queries the current tick and epoch from a node.
import { createNodePool, requestCurrentTickInfo } from "@qubic.org/tcp"
const pool = createNodePool(["node1.qubic.org", "node2.qubic.org"])
const { epoch, tick, initialTick } = await requestCurrentTickInfo(pool)
console.log(`Epoch ${epoch}, tick ${tick}`)
pool.close()Parameters
| Name | Type | Description |
|---|---|---|
conn | NodeConnection | NodePool | Connection or pool |
options.signal | AbortSignal | Optional. Abort the request early. |
Returns
Promise<CurrentTickInfo> — { epoch: number, tick: number, initialTick: number }
Combining with timeout
const info = await requestCurrentTickInfo(pool, {
signal: AbortSignal.timeout(3000),
})
console.log("Tick:", info.tick)