Skip to main content
Before initializing the TON Connect’s WalletKit, install it in your web project:
Alternatively, explore the complete demo wallet with WalletKit integration:

Demo wallet, deployed

Demo wallet, GitHub repository

Initialization

The basic kit initialization consists of creating a corresponding object by passing it a minimal set of necessary arguments. One needs to pick a TON network to operate on, provide the necessary device and wallet manifest configurations.
See also: TON Connect’s wallet manifest.

TON wallet initialization

The configuration before is enough to outline necessary wallet information and initialize the WalletKit, but it isn’t enough for deeper interactions with the blockchain. For that, you need at least one TON wallet contract to be set up. You may load or create a new TON wallet using one of these options:

Create a TON wallet from a mnemonic

Create a TON wallet from a private key

Create a TON wallet with a custom signer

Note that you can provide multiple TON wallets to WalletKit and switch between them as needed.

From mnemonic

To initialize a TON wallet from an existing BIP-39 or TON-specific mnemonic seed phrase, use the createWalletInitConfigMnemonic() function of WalletKit.

From private key

To initialize a TON wallet from an existing private key, use the createWalletInitConfigPrivateKey() function of WalletKit. If there is a mnemonic, one can convert it to an Ed25519 key pair with public and private key by using the MnemonicToKeyPair().

From signer

To provide a custom signing mechanism as an alternative to using a mnemonic phrase or a private key, use the createWalletInitConfigSigner() function of WalletKit. In that case, you would need to pass a public key and your custom signing function of type WalletSigner. It should take the Uint8Array of data bytes and then asynchronously produce an Uint8Array signature. This approach is useful if you want to maintain full control over the signing process, such as when using a hardware wallet or signing data on the backend.

Configuration parameters

Required

CHAIN.TESTNET | CHAIN.MAINNET
required
The TON network to use.
DeviceInfo
required
Core information and constraints of the given wallet.
There, Feature type is defined as:
The maxMessages number depends on the TON wallet used, because every wallet has its own limit on the volume of messages.For example,
  • Ledger wallet would only handle 1 message per transaction
  • Wallet v4r2 handles up to 4 messages
  • Wallet v5r1 handles up to 255 messages
WalletInfo
required
How your wallet interacts with the TON Connect. This field is closely related to the corresponding JSON manifest file.

Optional

object | ApiClient
Which API or RPC provider to use to interact with TON Blockchain.
BridgeConfig
Connectivity options: either an HTTP or JavaScript bridge setup. The former’s bridgeUrl points to the publicly exposed bridge URL, while the latter’s jsBridgeKey points to the property name within the window object on the same web page.
object | StorageAdapter
How to store intermediate events.
object
Strictness and wallet checks.
EventProcessorConfig
How TON Connect events are processed.
AnalyticsConfig
Collect and gather analytical data.

Next steps

Handle connection requests

See also

WalletKit overview

TON Connect's wallet manifest

TON Connect overview