Getting Started

Prerequisites

  • Node.js: Ensure you have Node.js installed (version 14 or higher recommended).

  • Package Manager: You will need npm or yarn to install the SDK.

  • Basic Knowledge: Familiarity with JavaScript, blockchain concepts, and Telegram mini-apps is helpful.

Installation

To get started with TMAWallet, install the SDK using npm or yarn:

npm install @tmawallet/sdk

or

yarn add @tmawallet/sdk

Basic Setup

Below is a simple example of how to set up TMAWallet in your project and create a wallet:

import { TMAWalletClient } from '@tmawallet/sdk';

(async () => {
  // Initialize the TMAWallet client with your project's public token
  const tmaWallet = new TMAWalletClient('your_project_public_token');

  // Initialize the wallet
  await tmaWallet.init();

  // Check if a bundle exists or create a new one
  if (!tmaWallet.isBundleExists) {
    await tmaWallet.createBundle();
  }

  console.log('Wallet address:', tmaWallet.walletAddress);
})();

This example shows how to initialize the TMAWallet client, create a bundle if it doesn't exist, and retrieve the wallet address.

Quick Start Guide

  1. Install the SDK: Use npm or yarn to install TMAWallet.

  2. Initialize the Client: Import TMAWalletClient and initialize it with your project's public token.

  3. Create or Restore a Wallet: Use createBundle() to create a new wallet or check the existing wallet bundle.

  4. Interact with Ethereum: Use the SDK to sign transactions, connect to Ethereum, and interact with smart contracts.

Last updated