Skip to main content
If there is a dApp that uses TON Connect UI libraries, migrate that dApp to AppKit in a few steps:

Installation

Before initializing the TON Connect’s AppKit, install it with the necessary peer dependencies:
Core packages require a Buffer polyfill. Extend the module bundle configuration according to the bundler in use:

Initialization

The basic kit initialization does not require any configuration options.
To communicate with the blockchain, AppKit uses TON Center APIs by default. In particular, operations with assets require many API calls — obtain a key to access higher limits and prevent frequent rate limit 429 errors. Alternative API clients and their configuration options can be supplied per network:

Connectors

The basic setup allows for direct API requests but is insufficient for connecting TON wallets via the TON Connect protocol. For that, configure a connector and host a public app manifest file adjusted to the needs of a given dApp. For local development and testing, use the manifest file from this demo dApp.

Providers

The setup with connectors connects to TON wallets via services such as Tonkeeper. To enable advanced DeFi operations like asset swaps or staking, configure DeFi providers. Supported swap providers:
  • Omniston is the primary swap provider.
Supported staking providers: To set up all DeFi providers:
1

Install the SDK

Swaps with Omniston require its SDK to be installed:
2

Set up DeFi providers

Queries and mutations

TanStack Query is an opinionated library that simplifies fetching, caching, synchronizing and updating server state in web applications. To enable it for React, wrap the application inside AppKitProvider in the QueryClientProvider from @tanstack/react-query:

Complete setup

The following initialization example sets up everything at once:

Dynamic configuration

AppKit instance can be dynamically extended with new connectors and providers.

Add new connectors

To add a new connector, call the .addConnector() method on the initialized AppKit object:

Add new providers

To add a new provider, call the .registerProvider() method on the initialized AppKit object:
To specifically add a swap provider, register it via kit.swapManager:

Configuration parameters

Record<CHAIN, NetworkConfig>
For one or more TON networks, configure their respective API or RPC providers to interact with.
TypeScript
It is also possible to provide an entirely custom provider with its own ApiClient interface implementation.
TypeScript
Connector[] | undefined
Array of connectors that enable wallet connections. The primary connector is TonConnectConnector, which is created by dedicated function.Each connector must expose the following methods:
  • initialize() — creates the connector, restores connections, sets up event listeners.
  • destroy() — cleans up connector resources.
  • connectWallet() — connects a wallet through the UI.
  • disconnectWallet() — disconnects a wallet.
  • getConnectedWallets() — lists connected wallets.
Additionally, each connector has metadata that can be displayed in the UI:
Providers[] | undefined
Array of DeFi providers that enable additional functionality, such as asset swaps via Omniston.

Relation to TON Connect libraries

Lower-level TON Connect libraries, such as @tonconnect/ui-react and @tonconnect/ui, only give access to wallet services via the TON Connect protocol and basic facilities to query connected TON wallets with direct API calls. AppKit builds on the foundation provided by these libraries and extends functionality with convenient components, hooks, and functions. It enables balance tracking and asset management, gives ready-made React UI components for common cases, handles API-related state management, and even registers DeFi integrations for advanced use cases. If there is an existing dApp that uses either @tonconnect/ui-react or @tonconnect/ui, consider migrating to AppKit to simplify development and reduce boilerplate.

Migrate from @tonconnect/ui-react

Before migrating, install AppKit and peer packages and add necessary polyfills.
1

Ensure the TON Connect UI package is of the latest version

Ensure that TON Connect packages are of the latest version:
2

Initialize AppKit and replace TonConnectUIProvider

Use AppKitProvider in place of the TonConnectUIProvider:
Refer to the complete initialization setup for all the possible AppKit configuration options.
3

Keep existing hooks as is

The AppKitProvider bridges to TON Connect under the hood. Existing few @tonconnect/ui-react hooks, such as useTonAddress(), useTonWallet(), and others, will continue to work inside the AppKitProvider automatically.

Migrate from @tonconnect/ui

Before migrating, install AppKit and peer packages and add necessary polyfills.
1

Ensure the TON Connect UI package is of the latest version

2

Initialize AppKit and reuse TonConnectUI object

It is possible to reuse the existing TonConnectUI object when configuring AppKit connectors:
One can also extend the existing AppKit instance dynamically:
Refer to the complete initialization setup for all the possible AppKit configuration options.
3

Replace method calls with exported functions

Instead of consolidating everything within the instantiated TonConnectUI object, AppKit offers several tree-shakable functions that enhance and expand the capabilities of the existing TonConnectUI functionality. Refer to relevant how-to pages for concrete examples.

Next steps

Work with Toncoin

See also