Skip to content

Reference

getCurrentRoundNumber

Determine numeric mining round using validator open-round snapshots sorted by payload.round_number.

Calls getOpenAndIssuingMiningRounds, validates open_mining_rounds non-empty, sorts descending via findLatestMiningRound, returns contract.payload.round_number from canonical snake_case payloads.

Throws MINING_ROUND_NOT_FOUND when arrays empty or sorting yields null.

Setup

import { Canton, getCurrentRoundNumber } from '@fairmint/canton-node-sdk';

const canton = new Canton({
  network: 'NETWORK_NAME',
  partyId: 'PARTY_ID',
});

Minimal example

const round = await getCurrentRoundNumber(canton.validator);
console.log(round);

Parameters

  • validatorClient — Implements MiningRoundClient.

Returns

Promise<number> — Highest round_number among open rounds returned by validator snapshot.

Errors

Throws OperationError MINING_ROUND_NOT_FOUND when validator yields none.

Source

src/utils/mining/mining-rounds.ts