@fairmint/canton-node-sdk
Version:
Canton Node SDK
47 lines • 2.27 kB
TypeScript
import { type DisclosedContract } from '../../clients/ledger-json-api/schemas';
import { type ValidatorApiClient } from '../../clients/validator-api';
/** Context information derived from open / issuing mining rounds. */
export interface MiningRoundContext {
/** Contract ID of the open mining round to reference in commands */
openMiningRound: string;
/** Contract information (for disclosed contracts) of the open mining round */
openMiningRoundContract: DisclosedContract;
/** Issuing mining rounds formatted for command arguments */
issuingMiningRounds: Array<{
round: number;
contractId: string;
}>;
}
/**
* Finds the latest mining round that is currently open (`opensAt` is in the past) and returns useful context
* information.
*
* @throws Error if no mining round satisfies the criteria
*/
export declare function getCurrentMiningRoundContext(validatorClient: ValidatorApiClient): Promise<MiningRoundContext>;
/**
* Gets the domain ID from the current mining round context. This is useful for operations that need to automatically
* determine the domain ID.
*
* @param validatorClient - Validator API client for getting mining round information
* @returns Promise resolving to the domain ID string
* @throws Error if no mining round satisfies the criteria
*/
export declare function getCurrentMiningRoundDomainId(validatorClient: ValidatorApiClient): Promise<string>;
/**
* Gets the current mining round number by fetching the latest open mining round
*
* @param validatorClient Validator API client to fetch round information
* @returns Promise resolving to the current round number
* @throws Error if no open mining rounds are found
*/
export declare function getCurrentRoundNumber(validatorClient: ValidatorApiClient): Promise<number>;
/**
* Wait until the mining round has actually changed, confirming the change
*
* @param validatorClient Validator API client to fetch round information
* @param maxWaitTime Maximum time to wait in milliseconds (default: 20 minutes)
* @returns Promise that resolves when the round has changed
*/
export declare function waitForRoundChange(validatorClient: ValidatorApiClient, maxWaitTime?: number): Promise<void>;
//# sourceMappingURL=mining-rounds.d.ts.map