Skip to content

Reference

getCurrentMiningRoundContext

Resolve latest opened mining round plus issuing rounds into disclosed-contract bundles suitable for Amulet exercises.

Calls validatorClient.getOpenAndIssuingMiningRounds(), filters open_mining_rounds where opensAt ≤ now, selects the chronologically last opened round (array order assumption), converts payload into DisclosedContract (domain_id mapped to synchronizerId per SDK legacy behaviour), maps issuing_mining_rounds into { round, contractId } tuples.

Throws OperationError MINING_ROUND_NOT_FOUND when filters exclude everything.

Setup

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

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

Minimal example

const ctx = await getCurrentMiningRoundContext(canton.validator);

console.log(ctx.openMiningRound, ctx.issuingMiningRounds.length);

Parameters

  • validatorClient — Any object exposing getOpenAndIssuingMiningRounds (MiningRoundClient).

Returns

Promise<MiningRoundContext>openMiningRound contract ID string, openMiningRoundContract (DisclosedContract), issuingMiningRounds enumeration.

Errors

Throws OperationError MINING_ROUND_NOT_FOUND when no qualifying rounds exist.

Auth and party

Requires validator credentials exposing mining-round introspection APIs.

See also

Source

src/utils/mining/mining-rounds.ts