Avalanche SDK Client - v0.0.4-alpha.14
    Preparing search index...

    Function getSubnets

    • Type Parameters

      • chain extends undefined | Chain

      Parameters

      Returns Promise<GetSubnetsReturnType>

      The list of subnets. GetSubnetsReturnType

      platform.getSubnets is deprecated in AvalancheGo and can be removed in a future release. Use getSubnet to get one subnet by ID. To list subnets, use an indexer, such as the Data API in @avalanche-sdk/chainkit (data.primaryNetwork.listSubnets).

      import { createAvalancheCoreClient } from '@avalanche-sdk/client'
      import { avalanche } from '@avalanche-sdk/client/chains'
      import { getSubnets } from '@avalanche-sdk/client/methods/pChain'

      const client = createAvalancheCoreClient({
      chain: avalanche,
      transport: {
      type: "http",
      url: "<url>",
      },
      })

      const subnets = await getSubnets(client, {})