Skip to content

SubnetStatus

The SubnetStatus utility is used to request structured data directly from the IC public API. This data can be accessed using agent.readSubnetState, but SubnetStatus provides a helpful abstraction with some known paths.

The primary method for this namespace is SubnetStatus.request

Defined in: packages/core/src/agent/subnetStatus/index.ts:82

agent: HttpAgent

Defined in: packages/core/src/agent/subnetStatus/index.ts:91

The agent to use to make the subnet request.

optional disableCertificateTimeVerification?: boolean

Defined in: packages/core/src/agent/subnetStatus/index.ts:101

Whether to disable the certificate freshness checks.

false

optional paths?: Set<Path> | Path[]

Defined in: packages/core/src/agent/subnetStatus/index.ts:96

The paths to request.

[]

subnetId: Principal

Defined in: packages/core/src/agent/subnetStatus/index.ts:87

The subnet ID to query. Use IC_ROOT_SUBNET_ID for the IC mainnet root subnet. You can use HttpAgent.getSubnetIdFromCanister to get a subnet ID from a canister.

Path = "time" | "canisterRanges" | "publicKey" | "nodeKeys" | CustomPath

Defined in: packages/core/src/agent/subnetStatus/index.ts:44

Pre-configured fields for subnet status paths


Status = BaseStatus | SubnetNodeKeys | CanisterRanges

Defined in: packages/core/src/agent/subnetStatus/index.ts:39


StatusMap = Map<Path | string, Status>

Defined in: packages/core/src/agent/subnetStatus/index.ts:46


SubnetStatus = BaseSubnetStatus & object

Defined in: packages/core/src/agent/subnetStatus/index.ts:32

publicKey: Uint8Array

The public key of the subnet

const IC_ROOT_SUBNET_ID: Principal

Defined in: packages/core/src/agent/utils/readState.ts:28

The root subnet ID for IC mainnet

encodePath(path, subnetId): Uint8Array<ArrayBufferLike>[]

Defined in: packages/core/src/agent/subnetStatus/index.ts:214

Encode a path for subnet state queries

Path

the path to encode

Principal

the subnet ID

Uint8Array<ArrayBufferLike>[]

the encoded path as an array of Uint8Arrays

Use HttpAgent.readState directly with StatePaths instead


lookupSubnetInfo(certificate, subnetId): SubnetStatus

Defined in: packages/core/src/agent/subnetStatus/index.ts:182

Fetch subnet info including node keys from a certificate

Uint8Array

the certificate bytes

Principal

the subnet ID

SubnetStatus

SubnetStatus with subnet ID and node keys


request(options): Promise<StatusMap>

Defined in: packages/core/src/agent/subnetStatus/index.ts:121

Requests information from a subnet’s read_state endpoint. Can be used to request information about the subnet’s time, canister ranges, public key, node keys, and metrics.

SubnetStatusOptions

The configuration for the subnet status request.

Promise<StatusMap>

A map populated with data from the requested paths. Each path is a key in the map, and the value is the data obtained from the certificate for that path.

SubnetStatusOptions for detailed options.

Use HttpAgent.readState directly with StatePaths instead. This function will be removed in a future release.

const status = await subnetStatus.request({
subnetId: IC_ROOT_SUBNET_ID,
paths: ['time', 'nodeKeys'],
agent,
});
const time = status.get('time');
const nodeKeys = status.get('nodeKeys');

Re-exports CustomPath


Re-exports DecodeStrategy