SOL Pay
  • SOL Pay
  • Quick Start
  • Streams
  • Stake Pools
  • Reference
    • SDK Reference
      • connectNetwork
      • connectWallet
      • sendSolanaLamports
      • sendSolana
      • sendTokens
      • sendTokensDecimal
      • signTransaction
      • broadcastSerializedTransaction
      • streamLamports
      • backupStreamWallet
      • getStreamDetails
      • refillStream
      • pauseStream
      • resumeStream
      • closeStream
      • signMessage
      • getBalance
      • getTokenBalances
      • getAccountInfo
      • getAssociatedTokenAddress
      • getTokenBalance
      • tokens.getData
      • tokens.getTags
      • tokens.getToken
      • tokens.search
      • tokens.getRawUnvalidatedList
      • adapters
      • networks
    • API Reference
      • transaction.php
      • token_transaction.php
      • signature.php
  • Website
  • Source Code
Powered by GitBook
On this page
  • Parameters:
  • Returns:
  • Throws:
  1. Reference
  2. SDK Reference

tokens.getToken

Gets the metadata for an SPL token from the SPL token registry

Previoustokens.getTagsNexttokens.search

Last updated 3 years ago

(async() => {
    let token_info_1 = await SOLPay.tokens.getToken("TOKEN_ADDRESS"); // {...}
    let token_info_2 = await SOLPay.tokens.getToken("TOKEN_ADDRESS", true); // {...}
})();

Parameters:

  • address: string - the mint address of the token with which to get the info from the SPL token registry

  • skip_validation (optional, default: false): boolean - whether to skip validation on if a token in the SPL token registry is a valid SPL token (true for skipping validation, false for not skipping validation)

Returns:

object ({...}) - the token information (see for format)

Throws:

  • SOL Pay SDK Fatal Error: Invalid address ${address}. - an invalid address was used

  • SOL Pay SDK Fatal Error: No connection found. Use SOLPay.connectNetwork() to connect to the Solana network. - could not find a connection to the Solana network

  • SOL Pay SDK Fatal Error: Connection did not respond. Use SOLPay.connectNetwork() to connect to the Solana network. - did not receive response from Solana network

https://github.com/solana-labs/token-list/blob/main/src/tokens/solana.tokenlist.json