Wallet Integration
Connecting to TON wallets is a crucial step in building hybrid dApps with TAC. This guide explains how to integrate TON wallets into your application using the TAC SDK.
TAC SDK supports two methods for sending transactions: using TON Connect for web applications or using a raw wallet via mnemonic for backend services and testing.
TON Connect Integration (Recommended for Web Apps)
TON Connect is the recommended way to connect to TON wallets in web applications. It provides a consistent user experience and supports popular wallets like Tonkeeper and Tonhub.
Setting Up TON Connect
First, install the TON Connect UI package:
Then, create a TON Connect instance in your application:
You need to create a TON Connect manifest file and host it at a publicly accessible URL. Learn more about creating a manifest in the TON Connect documentation.
React Integration
If you’re using React or Next.js, you can use the TON Connect React components:
Creating a Sender with TON Connect
Once you have TON Connect set up, you can create a TonConnectSender for use with the TAC SDK:
Raw Wallet Integration (For Backend/Testing)
For backend services, testing, or situations where TON Connect isn’t suitable, you can use a raw wallet with a mnemonic phrase.
Never expose your mnemonic phrase in frontend code. The raw wallet approach should only be used in secure environments like backend services or local testing.
Creating a Raw Sender
Supported Wallet Versions
The TAC SDK supports these TON wallet versions:
- V2R1
- V2R2
- V3R1
- V3R2
- V4 (recommended)
- V5R1
- HIGHLOAD_V3
Complete Wallet Integration Example
Here’s a complete example showing both methods:
Error Handling
When creating senders, you might encounter these errors:
WalletError
: Invalid wallet version provided
Handle these errors properly:
Was this page helpful?