TON Provider

The Tomo Telegram SDK provides a TON Provider for querying account data and sending transactions.

Connect with the Walletarrow-up-right

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

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

We also support connecting through TON proof:

// the tonProof must be a hex string
const res = await tomo_ton.connect({
  tonProof: Buffer.from('your challenge', 'utf8').toString('hex'),
});

//At the dapp backend, check the tonProof res
const { tonProof } = res;

We also support connecting to the TON testnet as follows:

// You must use the Tomo TON provider to connect the testnet.
// Other wallet providers through TON Connect do not work.
const res = await tomo_ton.connect({
  network: 'testnet'
});

Query Methods

TON provider supports two query methods:

  • getAddress

  • getBalance

Sending Methods

In TON providers, we provide one send methods:

  • sendTransaction

This method allows signing and sending transactions in one call. The input for this method is TonTxParams, defined as the following:

You can construct your payload as a BOC(Bag of Cells) in the same way as the standard one. Then, convert it into a base64 string or hexadecimal string and pass it to sendTx method.

Payload for TON transaction

You can create a general payload arrow-up-rightusing @ton/core

Or tonweb:

Payload for Jetton transaction

Below is an example use JettonWallet under tonweb for transferring jetton:

Last updated