import { AVAX_PUBLIC_URL } from '../constants/public-urls'; import { Api } from '../vms/common/baseApi'; import type { GetBlockchainIDResponse, GetNetworkIdResponse, GetNetworkNameResponse, GetNodeIdResponse, GetNodeIpResponse, GetNodeVersionReply, GetPeersResponse, isBootstrapped, UptimeResponse, GetUpgradesInfoResponse, } from './model'; export class InfoApi extends Api { constructor(private readonly baseURL: string = AVAX_PUBLIC_URL) { super(baseURL, '/ext/info', 'info'); } getNodeVersion(): Promise { return this.callRpc('getNodeVersion'); } async getNodeId(): Promise { return this.callRpc('getNodeID'); } getNodeIp(): Promise { return this.callRpc('getNodeIP'); } getNetworkId(): Promise { return this.callRpc('getNetworkID'); } getNetworkName(): Promise { return this.callRpc('getNetworkName'); } getBlockchainId(alias: string): Promise { return this.callRpc('getBlockchainID', { alias }); } peers(nodeIDs?: string[]): Promise { return this.callRpc('peers', { nodeIDs }); } isBootstrapped(chain: string): Promise { return this.callRpc('peers', { chain }); } uptime(): Promise { return this.callRpc('uptime'); } getVMs(): Promise> { return this.callRpc>('getVMs'); } // Post-Etna API // get upgrades info getUpgradesInfo(): Promise { return this.callRpc('upgrades'); } }