Solana: Add SPL token-specific RPC endpoints

Created on 27 Jul 2020  路  3Comments  路  Source: solana-labs/solana

Problem

It's currently cumbersome to get SPL Token state information from a node, generally requiring the use of getProgramAccounts with particular filters.

Proposed Solution

Add SPL token-specific RPC endpoints such that support for tokens is as robust as for native SOL. In particular, add these endpoints:

  • getTokenAccountBalance
  • getTokenSupply
  • getTokenAccountsByOwner
  • getTokenAccountsByDelegate

Also, cc: #10476 to decode Token instructions in getConfirmedBlock and getConfirmedTransaction RPCs

Most helpful comment

I favour making it explicit for now, while saving save room in the API to make it optional later once we go through a couple re-deploys. Less magic that'll break somebody's front-end

All 3 comments

The RPC endpoint should expect an explicit program id, so that we don't need new RPC endpoints for different versions of the token program.

The RPC endpoint should expect an explicit program id, so that we don't need new RPC endpoints for different versions of the token program.

Optional, and default to the most recent released version of SPL token?

I favour making it explicit for now, while saving save room in the API to make it optional later once we go through a couple re-deploys. Less magic that'll break somebody's front-end

Was this page helpful?
0 / 5 - 0 ratings