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

getAssociatedTokenAddress

Gets the associated token address of a Solana account

(async() => {
    let associated_token_address_1 = await SOLPay.getAssociatedTokenAddress("TOKEN_ADDRESS"); // {"address": "..."}
    let associated_token_address_2 = await SOLPay.getAssociatedTokenAddress("TOKEN_ADDRESS", "SOLANA_ADDRESS"); // {"address": "..."}
})();

Parameters:

  • token_address: string - the mint address of the token with which to get the associated address

  • address (optional, default: connected wallet address): string - the Solana address with which to get the associated address

Returns:

object ({"address": "..."}) - the details for the associated token account

  • address: string - the address of the associated token account

Throws:

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

  • SOL Pay SDK Fatal Error: Invalid address ${address}, and no wallet was connected. Use SOLPay.connectWallet() to connect to a Solana wallet. - an invalid address was used, and no wallet was connected

  • 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

PreviousgetAccountInfoNextgetTokenBalance

Last updated 3 years ago