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
      • Supported Chains
    • Tomo Web SDK
      • Quick Start
      • Solana Provider
      • EVM Provider
      • Bitcoin Provider
      • Tron Provider
      • Movement Provider
      • Sui Provider
    • 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
  • Connect with the Wallet​
  • Query Methods
  • Signing Methods
  • Sign message
  • SOL transfer transaction
  • SPL token transaction
  • Sending Methods
  1. Tomo SDK
  2. Tomo Telegram SDK
  3. Wallet Provider

Solana Provider

PreviousEVM ProviderNextSui Provider (Beta)

Last updated 3 months ago

The Tomo Telegram SDK provides a Solana Provider for querying and sending SOL and SPL tokens.

// get provider 
const sol = window.tomo_sol;

Connect with the Wallet

Before using the provider, the user needs to log in to the wallet through the modal by following the method:

// connect wallet
await sol?.connectWallet();

Query Methods

Solana providers support two query methods:

  • getAddress

  • getBalance

const address = sol.getAddress();
const balance = await sol.getBalance(address);

Signing Methods

In Solana providers, we provide four signing methods:

  • signMessage

  • signTransaction

  • signTransactions

  • signTokenTransaction

Sign message

signMessage the method will create an offchain signature for one message and return the signed transaction in hex.

 const response = await sol.signMessage(signMsg);

To verify the signature, you need to add the header "\xffsolana offchain" before the `signMsg`

SOL transfer transaction

signTransaction is typically used to send SOL to another address and return the signed transaction. You can also use signTransactions it to pass an array of transactions for signing.

const response = await sol.signTransaction({
  from: 8y9wmwVhban5Mrp8j68fQv1Kceeifeowt5Yw1DjwXoxk,
  to: 646rZ228LDcYecNvoBGNysJ9pGLc7gBeTrnSgZ476rBp,
  value: 0.01,
});

SPL token transaction

and signTokenTransaction supports signing transactions for sending SPL tokens. You need to provide a mint address for this transaction.

const response = await sol.signTokenTransaction({
  from: '8y9wmwVhban5Mrp8j68fQv1Kceeifeowt5Yw1DjwXoxk',
  to: '646rZ228LDcYecNvoBGNysJ9pGLc7gBeTrnSgZ476rBp',
  value: val,
  chainId: 501,
  contract: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
});

Sending Methods

After signing transactions, you can use sendTransaction it to send the transaction. The return value is the transaction hash:

const res = await sol.sendTransaction(response);

​