TON DocsTON Docs
AppKitGet started

Add networks in AppKit

Declare every chain the app can read. A network in AppKit is the chain context AppKit uses to read data and to compare wallet state against the app's expected chain — each network is identified by a Network value with a chainId and carries an apiClient that reads chain state for that chain.

A single AppKit instance can hold more than one network. The user picks at connect time, and a flow can move between networks without rebuilding the instance.

Before you begin

Install AppKit first. See Prepare your project.

Basic configuration

By default, AppKit constructs a mainnet-only ApiClientToncenter with no API key when networks is omitted. That is enough to start exploring AppKit, but production traffic will hit TON Center's public rate limits — apps that ship to users should supply their own key.

Pass an apiClient entry on the network with a key to lift the limits. AppKit has preset URLs for mainnet (https://toncenter.com) and testnet (https://testnet.toncenter.com), so url can be omitted for those. For other networks, specify url explicitly.

const appKit = new AppKit({
  networks: {
    [Network.mainnet().chainId]: {
      apiClient: {
        key: 'your-key',
      },
    },
  },
});

Next steps

  • Continue to Use basic getter hooks to read the connected wallet's state from the configured networks.
  • For multiple networks, custom chains, the default network, and mismatch handling, see Configure networks.

On this page