Avalanche SDK Client
    Preparing search index...

    Function createInfoApiClient

    • Creates an Info API Client with a given transport configured for a Chain.

      The Info API Client is an interface to interact with the Info API through Avalanche-specific JSON-RPC API methods.

      Type Parameters

      • transport extends Transport
      • chain extends undefined | Chain = undefined
      • accountOrAddress extends undefined | `0x${string}` | Account = undefined
      • rpcSchema extends undefined | RpcSchema = undefined
      • raw extends boolean = false

      Parameters

      Returns {
          acps: () => Promise<AcpsReturnType>;
          extend: <const client extends { [key: string]: unknown }>(
              fn: (
                  client: {
                      acps: ...;
                      extend: ...;
                      getBlockchainID: ...;
                      getNetworkID: ...;
                      getNetworkName: ...;
                      getNodeID: ...;
                      getNodeIP: ...;
                      getNodeVersion: ...;
                      getTxFee: ...;
                      getVMs: ...;
                      isBootstrapped: ...;
                      peers: ...;
                      upgrades: ...;
                      uptime: ...;
                  },
              ) => client,
          ) => { [K in (...)
          | (...)
          | (...)]: (...)[(...)] };
          getBlockchainID: (args: GetBlockchainIDParameters) => Promise<GetBlockchainIDReturnType>;
          getNetworkID: () => Promise<GetNetworkIDReturnType>;
          getNetworkName: () => Promise<GetNetworkNameReturnType>;
          getNodeID: () => Promise<GetNodeIDReturnType>;
          getNodeIP: () => Promise<GetNodeIPReturnType>;
          getNodeVersion: () => Promise<GetNodeVersionReturnType>;
          getTxFee: () => Promise<GetTxFeeReturnType>;
          getVMs: () => Promise<GetVMsReturnType>;
          isBootstrapped: (args: IsBootstrappedParameters) => Promise<IsBootstrappedReturnType>;
          peers: (args: PeersParameters) => Promise<PeersReturnType>;
          upgrades: () => Promise<UpgradesReturnType>;
          uptime: () => Promise<UptimeReturnType>;
      }

      An Info API Client. InfoApiClient

      • acps: () => Promise<AcpsReturnType>

        Returns peer preferences for Avalanche Community Proposals (ACPs).

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const acpPreferences = await client.info.acps()
      • extend: <const client extends { [key: string]: unknown }>(
            fn: (
                client: {
                    acps: ...;
                    extend: ...;
                    getBlockchainID: ...;
                    getNetworkID: ...;
                    getNetworkName: ...;
                    getNodeID: ...;
                    getNodeIP: ...;
                    getNodeVersion: ...;
                    getTxFee: ...;
                    getVMs: ...;
                    isBootstrapped: ...;
                    peers: ...;
                    upgrades: ...;
                    uptime: ...;
                },
            ) => client,
        ) => { [K in (...)
        | (...)
        | (...)]: (...)[(...)] }
      • getBlockchainID: (args: GetBlockchainIDParameters) => Promise<GetBlockchainIDReturnType>
        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const blockchainID = await client.info.getBlockchainID({
        alias: "X"
        })
      • getNetworkID: () => Promise<GetNetworkIDReturnType>

        Get the ID of the network this node is participating in. Network ID of 1 = Mainnet, Network ID of 5 = Fuji (testnet).

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const networkID = await client.info.getNetworkID()
      • getNetworkName: () => Promise<GetNetworkNameReturnType>

        Get the name of the network this node is participating in.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const networkName = await client.info.getNetworkName()
      • getNodeID: () => Promise<GetNodeIDReturnType>

        Get the ID, the BLS key, and the proof of possession of this node. Note: This endpoint is only available on specific nodes, not on public servers.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const nodeInfo = await client.info.getNodeID()
      • getNodeIP: () => Promise<GetNodeIPReturnType>
        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const nodeIP = await client.info.getNodeIP()
      • getNodeVersion: () => Promise<GetNodeVersionReturnType>
        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const nodeVersion = await client.info.getNodeVersion()
      • getTxFee: () => Promise<GetTxFeeReturnType>

        Get the transaction fee for this node.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const txFee = await client.info.getTxFee()
      • getVMs: () => Promise<GetVMsReturnType>

        Get the virtual machines (VMs) this node is running.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const vms = await client.info.getVMs()
      • isBootstrapped: (args: IsBootstrappedParameters) => Promise<IsBootstrappedReturnType>

        Check whether a given chain is done bootstrapping.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const isBootstrapped = await client.info.isBootstrapped({
        chain: "X"
        })
      • peers: (args: PeersParameters) => Promise<PeersReturnType>

        Get a description of peer connections.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const peers = await client.info.peers({
        nodeIDs: []
        })
      • upgrades: () => Promise<UpgradesReturnType>

        Returns the upgrade history and configuration of the network.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const upgrades = await client.info.upgrades()
      • uptime: () => Promise<UptimeReturnType>

        Returns the network's observed uptime of this node. This is the only reliable source of data for your node's uptime.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const uptime = await client.info.uptime()
      import { createInfoApiClient} from '@avalanche-sdk/client'
      import { avalanche } from '@avalanche-sdk/client/chains'

      const client = createInfoApiClient({
      chain: avalanche,
      transport: {
      type: "http",
      },
      })

      // Get info
      const info = await client.getNetworkID()