aftermath-ts-sdk
Version:
Aftermath TypeScript SDK
58 lines • 2.27 kB
TypeScript
import { SuiSystemStateSummary } from "@mysten/sui/client";
import { Caller } from "../../general/utils/caller";
import { CallerConfig } from "../../types";
import { AftermathApi } from "../../general/providers";
/**
* The `Sui` class provides utilities to fetch core Sui chain information,
* such as the system state. It also exposes a set of constant addresses
* related to the Sui network package IDs.
*/
export declare class Sui extends Caller {
private readonly Provider?;
/**
* Static constants containing important addresses on the Sui network:
* - `zero`: The zero address (commonly used as a null placeholder).
* - `suiPackageId`: The package ID for the Sui system package.
* - `suiSystemStateId`: The object ID for the Sui system state.
* - `suiClockId`: The object ID for the Sui on-chain clock.
*/
static readonly constants: {
addresses: {
zero: string;
suiPackageId: string;
suiSystemStateId: string;
suiClockId: string;
};
};
/**
* Creates a new instance of the `Sui` class for fetching chain-level info.
*
* @param config - Optional configuration, including the Sui network and an access token.
* @param Provider - An optional `AftermathApi` instance for advanced transaction building or data fetching.
*/
constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
/**
* Fetches the Sui system state summary object, which contains details
* about the current epoch, validator set, and other protocol-level data.
*
* @returns A promise that resolves to a `SuiSystemStateSummary` instance.
*
* @example
* ```typescript
* const afSdk = new Aftermath("MAINNET");
* await afSdk.init(); // initialize provider
*
* const sui = afSdk.Sui();
*
* const systemState = await sui.getSystemState();
* console.log(systemState.epoch, systemState.validators);
* ```
*/
getSystemState(): Promise<SuiSystemStateSummary>;
/**
* Internal helper to return the configured `Sui` provider. Throws an error if
* no `AftermathApi` provider is defined.
*/
private useProvider;
}
//# sourceMappingURL=sui.d.ts.map