Quick Start

Please check our demo arrow-up-rightapplication to experience what you can do with Tomo Telegram SDK. We provide some demo examples for you to initiate a project with Tomo SDK: 1. Wagmiarrow-up-right 2. Rainbowkitarrow-up-right

Installation

Tomo Telegram SDK is published and maintained through NPM. Use the following commands for installing the package.

npm i @tomo-inc/tomo-telegram-sdk

or

pnpm i @tomo-inc/tomo-telegram-sdk

Initialization

Initiate the SDK with one of the following choices according to your application once in the application.

// Use full features
import { TomoWalletTgSdkV2 } from '@tomo-inc/tomo-telegram-sdk';

// Initiate with UI
new TomoWalletTgSdkV2({ injected: true })

// If you do not want UI, you can use 
new TomoWalletTgSdkV2()

If you only use EVM providers, you can use the following way to initiate the EVM provider only:

import { EthereumProvider } from '@tomo-inc/tomo-telegram-sdk/tomoEvmProvider.esm';

useEffect(() => {
  const ethereumProvider = new EthereumProvider({
    injected: true,
    overrideRpcUrl: {
      // Specify all networks you want to use here.
      // Example:
      // 80084: 'https://bartioXXX.rpc.berachain.com'
    },
  });
}, []);

Use the Modal

Drawing
Modal for user login

Developers need to associate the modal with the login button in the UI so the user can log in through our SDK.

React Framework

pure JavaScript

Connect Other Wallets

Other than the Tomo native provider based on the user's Tomo Telegram SDK Wallet, users can connect to their OKX Telegram wallet/OKX web3 wallet, Bitget Wallet, UXUY wallet, or TON Native Wallet by different connect maps. The developer can control this through the parameters of supportedConnects in the TomoProvider⁣. More EVM connectors are coming soon.

We unify the providers' interfaces into providers across all different wallet solutions so you can use them transparently.

Connect/Disconnect Wallet Providers

You can connect wallet providers for the chain you want to use. Currently, our SDK supports the EVM chains, Sui, Solana, and TON networks, and we plan to add support for BTC soon.

GetWalletInfo

After connecting the wallet, we can use getWalletInfo()to get which wallet user used.

In react framework, you can directly fetch the wallet info:

Last updated