Documentation
Wallet Client
connect

connect

A function of wallet clients to connect to any wallet.

Usage

import { walletClient } from './client';
 
const walletConnection = await walletClient.connect();

Returns

DataOrTypedError<
  Wallet,
  | 'ConnectUIFunctionUnavailableError'
  | 'TonConnectUIError'
  | 'TonWalletConnectionError'
  | 'UserRejectedConnectionError'
>

A wallet connection object or one of the typed errors.

Parameters

walletConnector

  • Type: WalletInfo
  • Required for WalletClient, optional for WalletClientUI

An information about the wallet to connect to.

const wallets = await walletClient.getWallets();
const selectedWallet = wallets[0];
 
const walletConnection = await walletClient.connect(selectedWallet);