AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.

Start building today!     

Contents

getTokenAccountsByDelegate RPC Method

The API credit value for this method is 1 . To learn more about API credits and each method's value, visit the API Credits page.

Parameters:

  1. Pubkey - string - The Pubkey of token Mint to query encoded as base-58 string
  2. object - (optional) A JSON object with one of the following fields:
  3. mint - string - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or

    programId - string - Pubkey of the Token program that owns the accounts, as base-58 encoded string

  4. object - (optional) The configuration object with the following fields:

    Commitment - string - (optional) The level of commitment required for the query. The options include:

    Finalized - string - The node will query the most recent block confirmed by the supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized

    Confirmed - string - The node will query the most recent block that has been voted on by the supermajority of the cluster

    Processed - string - The node will query its most recent block. Note that the block may not be complete

    encoding - string - (optional) (default: base58) The encoding format for account data. It can be either base58 (slow, DEPRECATED) or base64

    dataSlice - string - (optional) The returned account data using the provided offset: 'usize' and length: 'usize' fields; only available for base58, base64, or base64+zstd encodings

    minContextSlot - integer - (optional) The minimum slot at which the request can be evaluated

Returns:

  1. result - An object with the following fields:

    context - The information about the current state of the program

    apiVersion - The version of the Solana RPC API to use

    slot - An integer representing the slot for which to retrieve the fee calculator

    value - A JSON object with the following fields:

    account - An address on the Solana blockchain that is used to store assets

    data - A string containing the encoded data to be passed to the instruction

    program - The program that manages the token

    parsed - An array of parsed instructions that were executed in the block's transactions

    info - An array of information objects that provide additional details about the transactions in the block

    tokenAmount - The balance of the token in the token account

    amount - The raw total token supply without decimals, a string representation of a u64 integer

    decimals - An integer value representing the number of decimal places used by the token

    uiAmount - The total token supply using mint-prescribed decimals (DEPRECATED)

    uiAmountString - The total token supply as a string using mint-prescribed decimals

    delegate - The public address of the delegate from which the account tokens are to be retrieved encoded as base-58 string

    delegateAmount - The configuration object with the following fields:

    amount - The raw total token supply without decimals, a string representation of a u64 integer

    decimals - An integer value representing the number of decimal places used by the token

    uiAmount - The total token supply using mint-prescribed decimals (DEPRECATED)

    uiAmountString - The total token supply as a string using mint-prescribed decimals

    isNative - A boolean value indicating whether the token is a native token of the Solana blockchain

    mint - Provides information about the creation of new tokens

    owner - The base-58 encoded Pubkey of the program this account has been assigned to

    state - The current state of the token account

    type - The type of the block. It can be used to differentiate between regular blocks and special blocks such as snapshot or transaction confirmation blocks

    space - The amount of storage space required to store the token account

    executable - A boolean indicating if the account contains a program (and is strictly read-only)

    lamports - The number of lamports assigned to this account as u64 (64-bit unsigned integer)

    owner - The base-58 encoded Pubkey of the program this account has been assigned to

    rentEpoch - The epoch at which the token account's storage will be subject to rent

    space - The amount of storage space required to store the token account

    pubkey - The pubkey of token as base-58 encoded string

Code Examples:

// not currently supported by solanaJS
const axios = require("axios");
(() => {
  const config = {
    headers: {
      "Content-Type": "application/json",
    },
  };
  const data = {
    jsonrpc: "2.0",
    id: 1,
    method: "getTokenAccountsByDelegate",
    params: [
      "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
      {
        programId: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
      },
      {
        encoding: "jsonParsed",
      },
    ],
  };
  axios
    .post("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/", data, config)
    .then(function (response) {
      // handle success
      console.log(response.data);
    })
    .catch((err) => {
      // handle error
      console.log(err);
    });
})();
Ready to get started? Create a free account