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
Interfaces
Section titled “Interfaces”SubnetStatusOptions
Section titled “SubnetStatusOptions”Defined in: packages/core/src/agent/subnetStatus/index.ts:56
Properties
Section titled “Properties”agent:
HttpAgent
Defined in: packages/core/src/agent/subnetStatus/index.ts:65
The agent to use to make the subnet request.
disableCertificateTimeVerification?
Section titled “disableCertificateTimeVerification?”
optionaldisableCertificateTimeVerification?:boolean
Defined in: packages/core/src/agent/subnetStatus/index.ts:75
Whether to disable the certificate freshness checks.
Default
Section titled “Default”falsepaths?
Section titled “paths?”Defined in: packages/core/src/agent/subnetStatus/index.ts:70
The paths to request.
Default
Section titled “Default”[]subnetId
Section titled “subnetId”subnetId:
Principal
Defined in: packages/core/src/agent/subnetStatus/index.ts:61
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.
Type Aliases
Section titled “Type Aliases”Path =
"time"|"canisterRanges"|"publicKey"|"nodeKeys"|CustomPath
Defined in: packages/core/src/agent/subnetStatus/index.ts:52
Pre-configured fields for subnet status paths
Status
Section titled “Status”Status =
BaseStatus|SubnetNodeKeys|CanisterRanges
Defined in: packages/core/src/agent/subnetStatus/index.ts:47
StatusMap
Section titled “StatusMap”Defined in: packages/core/src/agent/subnetStatus/index.ts:54
SubnetStatus
Section titled “SubnetStatus”SubnetStatus =
BaseSubnetStatus&object
Defined in: packages/core/src/agent/subnetStatus/index.ts:40
Type Declaration
Section titled “Type Declaration”publicKey
Section titled “publicKey”publicKey:
Uint8Array
The public key of the subnet
Variables
Section titled “Variables”IC_ROOT_SUBNET_ID
Section titled “IC_ROOT_SUBNET_ID”
constIC_ROOT_SUBNET_ID:Principal
Defined in: packages/core/src/agent/utils/readState.ts:26
The root subnet ID for IC mainnet
Functions
Section titled “Functions”encodePath()
Section titled “encodePath()”encodePath(
path,subnetId):Uint8Array<ArrayBufferLike>[]
Defined in: packages/core/src/agent/subnetStatus/index.ts:233
Encode a path for subnet state queries
Parameters
Section titled “Parameters”the path to encode
subnetId
Section titled “subnetId”the subnet ID
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike>[]
the encoded path as an array of Uint8Arrays
lookupSubnetInfo()
Section titled “lookupSubnetInfo()”lookupSubnetInfo(
certificate,subnetId):SubnetStatus
Defined in: packages/core/src/agent/subnetStatus/index.ts:202
Fetch subnet info including node keys from a certificate
Parameters
Section titled “Parameters”certificate
Section titled “certificate”Uint8Array
the certificate bytes
subnetId
Section titled “subnetId”the subnet ID
Returns
Section titled “Returns”SubnetStatus with subnet ID and node keys
request()
Section titled “request()”request(
options):Promise<StatusMap>
Defined in: packages/core/src/agent/subnetStatus/index.ts:94
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.
Parameters
Section titled “Parameters”options
Section titled “options”The configuration for the subnet status request.
Returns
Section titled “Returns”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.
Example
Section titled “Example”const status = await subnetStatus.request({ subnetId: IC_ROOT_SUBNET_ID, paths: ['time', 'nodeKeys'], agent,});
const time = status.get('time');const nodeKeys = status.get('nodeKeys');References
Section titled “References”CustomPath
Section titled “CustomPath”Re-exports CustomPath
DecodeStrategy
Section titled “DecodeStrategy”Re-exports DecodeStrategy