QubicKit Docs
CoreInterop & Clients

Connectors & Node Facades

Event-driven connectors and helpers that wrap Qubic nodes for long-running services.

Use the connector layer when you need to maintain live state—poll ticks, emit lifecycle events, or provide a single client façade for downstream consumers.

BaseConnector

BaseConnector defines a type-safe event emitter with lifecycle awareness:

import { BaseConnector } from "@qubiq/core";

class CustomConnector extends BaseConnector {
  async start() {
    this.setStatus("connecting");
    // wire sockets/pollers...
    this.setStatus("ready");
  }

  async stop() {
    this.setStatus("closed");
  }
}
  • Events: status, tick, and any custom payloads you emit.
  • Helpers on, off, and getStatus() keep orchestration code tidy.
  • Abort-friendly: call stop() to cancel timers/sockets.

HttpConnector

import { HttpConnector } from "@qubiq/core";

const connector = new HttpConnector({
  pollIntervalMs: 1_000,
  liveClient: customLive,
  queryClient: customQuery,
});

connector.on("tick", (tick) => console.log("new tick", tick.tick));
await connector.start();
  • Polls /v1/tick-info and emits tick deltas.
  • Tracks state transitions (idle → connecting → ready → closed) so you can expose health endpoints.
  • Delegates broadcasts + processed tick queries to the underlying clients.
Customization hooks
  • Provide injected liveClient/queryClient (with caching, auth, etc.).
  • Change pollIntervalMs when running in serverless or cron contexts.
  • Combine with TelemetryMetricsRegistry to surface connector state.

createHttpConnector helper

createHttpConnector wires default LiveServiceClient + QueryServiceClient instances based on ClientConfig (custom base URLs, poll intervals).

import { createHttpConnector } from "@qubiq/core";

const connector = createHttpConnector({
  liveBaseUrl: "https://api.qubic.org",
  queryServiceBaseUrl: "https://query.qubic.org",
  pollIntervalMs: 500,
});

QubicNodeClient

QubicNodeClient lives under @qubiq/core/node and acts like an SDK-ready façade:

import { QubicNodeClient } from "@qubiq/core";

const node = new QubicNodeClient();
const balance = await node.getBalance("SUZ...");
const tx = await node.getTransactionsForIdentity({ identity: "SUZ...", limit: 10 });
const watcher = node.watchWallet("SUZ...");
  • Exposes both live + query endpoints behind one object.
  • Spawns wallet watchers (WalletWatcher) for you.
  • Creates proposal coordinators so automation pipelines can ingest governance data.

Boot integration

Combine connectors with BootManager (see the boot page) to decide whether to start from scratch or reuse cached state, then bring the connector up accordingly. This is useful for headless nodes, orchestrators, or custom validators.