Tomo Docs
Tomo Docs
  • Overview
    • Introducing Tomo
    • Tomo's Key Management
  • Tomo SDK
    • TomoEVMKit
      • Quick Start
      • Use with Ethers.js
      • Migration from RainbowKit
      • Migration from Blocknative
      • Internal Wallet Services
      • Supported Chains
    • Tomo Web SDK
      • Quick Start
      • Solana Provider
      • EVM Provider
      • Bitcoin Provider
      • Tron Provider
      • Movement Provider
      • Sui Provider
      • Internal Wallet Services
    • Tomo Telegram SDK
      • Quick Start
      • Wallet Provider
        • EVM Provider
        • Solana Provider
        • Sui Provider (Beta)
        • TON Provider
      • Partners
    • Tomo Enterprise SDK
      • For Babylon
        • Install the SDK
        • Tomo Wallet Provider
        • Bitcoin Provider
        • Cosmos Provider
        • Multiple Connection Mode
        • Integrate Extension Wallet
          • Submit Wallet PR
          • Extend the SDK
          • Q & A
        • Integrate Mobile Wallet
  • TOMO WALLET
    • Tomo Wallets
    • Mobile Wallet
      • Tomo Keys
        • Bonding Curve Explained
        • How to: Tomo Keys
      • TomoID
        • How to: TomoID
        • How to: Connect Instagram
      • Tomo Socials
      • Tomo Android App
      • Tomo iOS App
    • Extension Wallet
      • Developer Manual
        • EVM Integration
        • Bitcoin Integration
      • Example of User Flows
        • Claiming Signet BTC
        • Staking at Testnet
      • Install Link
    • Telegram Wallet
      • Quick Start
      • Chains/Networks
      • User Manual
        • Account Security
        • Gift feature
        • FAQ
        • Transaction
        • Swap
  • ABOUT US
    • Brand Assets
    • Privacy Policy
Powered by GitBook
On this page
  • Service Types
  • Invoke Services
  1. Tomo SDK
  2. Tomo Web SDK

Internal Wallet Services

PreviousSui ProviderNextTomo Telegram SDK

Last updated 11 days ago

Tomo provides a few internal wallet services to wallet users so developers can selectively embed these services into their applications with minimum effort. Currently, these features are only available for users using social login, and users can only operate through a pop-up Tomo UI component. We will add support for extension wallet users and provide more configurable ways to invoke these services.

Service Types

Tomo supports the following basic service types:

enum WebWalletInvokeType {
  SWAP = "swap",             // Swap between selected token pairs
  ONRAMP = "onramp",         // Purchase Token by card
  SEND = "send",             // Send token to a given address
  RECEIVE = "receive",       // Display QR code and address for given token
}

Modals for Internal Services

Invoke Services

import "@tomo-inc/tomo-web-sdk/style.css";
import { TomoContextProvider, useTomo,WebWalletInvokeType  } from "@tomo-inc/tomo-web-sdk";

// Get tomo SDK instance
const { openConnectModal, tomoSDK } = useTomo();

const handleAction = async (type: WebWalletInvokeType) => {
    tomoSDK?.handleWebWalletInvoke(type);
  };

// your app logic
...
<button onClick={() => handleAction(WebWalletInvokeType.SWAP)}>
        Swap
      </button>

Example


import "@tomo-inc/tomo-web-sdk/style.css";
import { TomoContextProvider, useTomo,WebWalletInvokeType  } from "@tomo-inc/tomo-web-sdk";

const OrderComponent = () => {
  const { openConnectModal, tomoSDK } = useTomo();

  const handleAction = async (type: WebWalletInvokeType) => {
    tomoSDK?.handleWebWalletInvoke(type);
  };

  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
      <h1>WebSDK Demo</h1>
      <button  onClick={() => openConnectModal()}>Connect Wallet</button>
      <button  onClick={() => handleAction(WebWalletInvokeType.ONRAMP)}>Onramp</button>
      <button  onClick={() => handleAction(WebWalletInvokeType.SWAP)}>Swap</button>
      <button  onClick={() => handleAction(WebWalletInvokeType.SEND)}>Send</button>
      <button  onClick={() => handleAction(WebWalletInvokeType.RECEIVE)}>Receive</button>
    </div>
  );
};

export default function WebSDKPage() {

  return (
    <TomoContextProvider
      theme="light"
      chainTypes={["sui"]}
      clientId="YOUR_CLIENT_ID"
    >
      <div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
        {/* Add your page content here */}
        <OrderComponent />
      </div>
    </TomoContextProvider>
  );
}
Modals for Onramp Services
Modals for Swap Services
Drawing
Drawing