Open a wallet session, restore it across reloads, and disconnect cleanly.Documentation Index
Fetch the complete documentation index at: https://companyname-a7d5b98e-feature-fumodocs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How it works
A wallet is the signing application that owns the keys. A connector is the transport AppKit uses to open the wallet flow, restore sessions, list connected wallets, and route signing requests. A connector is not a wallet and does not sign — signing always happens inside the user’s wallet application. AppKit can track multiple connected wallets, but one wallet is selected for actions such as transfers and data signing. A selected wallet can change after disconnects, network changes, or session restore, so read it from AppKit state instead of storing it as long-lived application state. The same wallet on a different network has a different wallet id, and AppKit treats those as separate wallet objects.Before you begin
You need anAppKit instance with at least one connector and the React providers mounted. See Add wallet connectors for the instance and Installation → Wrap the application for the provider setup.
Drop-in button
<TonConnectButton /> from @ton/appkit-react opens the TON Connect modal, manages the session, and renders the connected address. This is the recommended path for most apps.
Custom connector picker
When the app needs a tailored UI, render the connector list directly.useConnectors() returns an array of registered connectors, and useConnect() accepts a connectorId.
connectorId passed to connect is not registered, the action throws Connector with id "<id>" not found. Confirm registration with getConnectors (or useConnectors in React) before calling connect.
Read the connected wallet
useSelectedWallet returns the wallet used by the next action. The wallet exposes getAddress() and getNetwork().
useAddress is the convenience hook:
Register a connector after construction
If connector configuration is not available at construction time, register it withaddConnector. Use this for user-scoped manifest URLs, feature flags, or dynamic wallet sets. addConnector accepts a Connector instance or a factory and returns an unregister function.
destroy() on the previous one before installing the new.
Connect from vanilla JS
connector.connectWallet() and connector.disconnectWallet() are the lower-level equivalents when direct connector access is preferred.
Wallet and Connector interfaces
Every connected wallet exposes the same minimum surface: a reference to the connector that produced it, four identity readers, and two wallet-approved operations that are routed through the connector.createTonConnectConnector covers most apps. It wraps @tonconnect/ui, restores prior sessions when the connector is first read, and syncs TON Connect with AppKit’s default network.
Errors and recovery
Wrap every action in try/catch and convert errors withgetErrorMessage from @ton/appkit.
| Error | Recovery |
|---|---|
| User rejected | Keep state unchanged and allow retry. |
| Missing connector | Check the AppKit configuration. |
| Expired session | Disconnect and request a new connection. |
| Wrong network | Prompt the user to switch network in their wallet. |
Tips
- Do not call mutations or signing actions while
getSelectedWalletisnull— the action will throw. - Do not assume every connector supports every flow. Catch rejections from the wallet and surface a recovery option.
- Do not store
selectedWalletIdas long-lived application state. The selected wallet can change after disconnects, network changes, or session restores. - In application code, use public actions or React hooks instead of calling connector methods directly, so AppKit’s event flow stays consistent. Connector methods are still the public surface for custom connector implementations.