Account APIs

Account API handles all operations regarding user accounts' profiles or settings.

getTonAddress

Fetch the TON address linked to the user's account, which can be used to send and receive TON-based assets.

Request Parameters:

  • Authorization (string, header, optional): The authorization token for secure access.

Example Request:

const getTONAddress = async () => {
  return await fetch('https://apis.tomo.inc/wind/v1/ton/address', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  }).then(res => res.json());
};

getFavoriteTokens

Retrieves the list of tokens the user starred. The output is a list of JSON objects describing the token details.

const favouriteTokens = async () => {
  return await fetch('https://apis.tomo.inc/sky/api/socialLogin/teleGram/wallet/favouriteTokens', {
    method: 'GET'
  }).then(res => res.json());
};

updateFavoriteTokens

Updates the list of tokens that the user starred.

Request Body Parameters:

  • userId (number, required): The user's unique ID.

  • tokens (array of strings, required): List of token names that will overwrite the existing list.

const updateTokens = async () => {
  return await fetch('https://apis.tomo.inc/sky/api/socialLogin/teleGram/wallet/favouriteTokens', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      userId: 123,
      tokens: ["token1", "token2"]
    })
  }).then(res => res.json());
};

getTokenAsset

Fetch all the token assets associated with the user's account, including native and contract tokens. It allows users to view their token holdings across different blockchains.

Request Parameters:

  • chain_ids (array of integers, query, optional): The chain IDs to filter the tokens by specific blockchains.

  • page (integer, query, optional): The page number for paginated results.

  • pagesize (integer, query, optional): The number of results per page.

  • Authorization (string, header, optional): The authorization token for secure access.

const getTokenAssets = async () => {
  return await fetch('https://apis.tomo.inc/wind/v1/asset/all?chain_ids=1,56&page=1&pagesize=10', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  }).then(res => res.json());
};

delTokenAsset

Remove a specified token asset from the user's portfolio based on the provided blockchain ID and token contract address. This is useful for users who want to remove unwanted or obsolete tokens from their asset list.

Request Parameters:

  • chain_ids (array of integers, query, required): The chain IDs to filter the tokens by specific blockchains.

  • token(string, query, required): The address of the token the user wants to delete from the view.

  • Authorization (string, header, optional): The authorization token for secure access.

const deleteTokenAsset = async () => {
  return await fetch('https://apis.tomo.inc/wind/v1/asset/del/1/0xTokenAddress', {
    method: 'DELETE',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  }).then(res => res.json());
};

addCustomizedToken

It allows users to add a new token asset to their portfolio by specifying its details, such as name, symbol, chain ID, and other relevant information. This feature is handy for users who want to track or interact with a token that is not automatically listed by the platform.

Request Body Parameters:

  • chain_id (number, required): The blockchain ID where the token resides.

  • decimals (number, required): The number of decimal places the token supports.

  • image (string, optional): A URL to the token's image or logo.

  • name (string, required): The full name of the token.

  • symbol (string, required): The token's symbol (e.g., "ETH" for Ethereum).

  • token (string, required): The contract address of the token.

const addNewAsset = async () => {
  return await fetch('https://apis.tomo.inc/wind/v1/asset/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    },
    body: JSON.stringify({
      chain_id: 1,
      decimals: 18,
      image: "https://example.com/token-images/tkn.png",
      name: "Token Name",
      symbol: "TKN",
      token: "0xTokenAddress"
    })
  }).then(res => res.json());
};

queryTokenBalance

Fetches the balance of all tokens linked to the user's addresses on supported blockchains. This API is useful for users who want to view their token holdings in one place.

Request Parameters:

  • evm_address (string, query, required): The user's Ethereum-based address to retrieve token balances.

  • solana_address (string, query, required): The user's Solana-based address to retrieve token balances.

  • Authorization (string, header, optional): The authorization token for secure access.

const queryTokenBalance = async () => {
  return await fetch('https://apis.tomo.inc/wind/v1/token/balance?evm_address=0xYourEthereumAddress&solana_address=YourSolanaAddress', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
    }
  }).then(res => res.json());
};

bindEmailCode

Sends a verification code to the user's email and binds the email to the user's account.

Request Parameters:

  • email (string, required): The email address to verify.

const response = async () => {
  return await fetch('https://apis.tomo.inc/sky/api/socialLogin/projectUser/bindEmailCode?email=user@example.com', {
    method: 'GET'
  }).then(res => res.json());
};

bindEmailCodeVerify

Checks the validity of a verification code sent to the user-provided email address.

Request Body Parameters:

  • email (string, required): The email address to which the code is sent.

  • code (string, required): The verification code received via email.

const response = async () => {
  return await fetch('https://apis.tomo.inc/sky/api/socialLogin/projectUser/bindEmailCodeVerify', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      email: "user@example.com",
      code: "123456"
    })
  }).then(res => res.json());
};

Last updated