Ask or search…
K
Links

Fungible Token Extension (Beta)

The most versatile API for working with tokens on Solana.

Background

Originally, the DAS API only supported ownership queries against Metaplex NFTs and cNFTs. Helius has extended the DAS API to support all tokens, including plain SPL tokens (without metadata) and Token22 (plus their extensions).
Users can query for the token balances of any account, across all tokens (SPL, Token22, NFTs, compressed NFTs).
As a bonus, we've even included token prices in USD.
Want to learn more about Token22? Check out the Helius blog post!

What problem does this solve?

Querying an account's balances in Solana is notoriously difficult because they are fragmented across accounts and programs.
A Solana token is defined by it's mint account. For example, the mint account for USDC is EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v. When you buy $40 of USDC, a token account is created that holds 40 USDC tokens. When you buy another $60 of USDC, a second token account is created. Your overall balance is 100 USDC but it is scattered across two token accounts. This can extend to hundreds (and even more) token accounts for calculating a single balance.
Let's look at this with an example. Say we want to the balances for account foobar, then we would need to take the following steps:
  1. 1.
    Call the getTokenAccountsByOwner RPC endpoint for the Token program. This returns a list of token accounts.
  2. 2.
    Iterate over the token accounts. Aggregate them by mint account.
  3. 3.
    For each mint account, call the getAccountInfo RPC endpoint and parse the binary data to extract decimals and supply.
  4. 4.
    Call getTokenAccountsByOwner against the Token22 program.
  5. 5.
    Repeat steps #2 and #3, and additionally parse the Token22 extensions.
  6. 6.
    Aggregate all the results within a single response.
This is insane. A normal user does not have the patience to wait for these operations to execute at runtime. The new DAS extension allows you to perform steps #1 through #6 above within a single, optimized query. On top of this, you can also query for compressed NFTs.

How does it work?

The Helius extension for fungible tokens resolves around ownership indexing. The following queries provide a unified view of the assets owned an account.

Backwards Compatibility

For backwards compatibility, the behaviour is identical to the original DAS – meaning only NFTs and compressed NFTs are returned.
{
"jsonrpc": "2.0",
"id": "helius-test",
"method": "searchAssets",
"params": {
"ownerAddress": "5aZZ4duJUKiMsJN9vRsoAn4SDX7agvKu7Q3QdFWRfWze"
}
}

Fungible Support

The Helius extension adds an extra field called tokenType. This field allows you to query against all assets owned by the account, including fungible and Token22 tokens.
{
"jsonrpc": "2.0",
"id": "helius-test",
"method": "searchAssets",
"params": {
"ownerAddress": "5aZZ4duJUKiMsJN9vRsoAn4SDX7agvKu7Q3QdFWRfWze",
"tokenType": "all"
}
}
In the response you'll now see fungible tokens like JitoSOL (response trimmed for brevity). It will include the total account balance, the token's program address, the associated token address, the total supply in circulation, and the price information.
"id": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
"content": {
"$schema": "",
"json_uri": "",
"metadata": {
"description": "MEV-Powered Liquid Staking Derivative",
"name": "Jito Staked SOL",
"symbol": "JitoSOL",
"token_standard": "Fungible"
},
[...],
"token_info": {
"symbol": "JitoSOL",
"balance": 35688813508,
"supply": 5949594702758293,
"decimals": 9,
"token_program": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"associated_token_address": "H7iLu4DPFpzEx1AGN8BCN7Qg966YFndt781p6ukhgki9",
"price_info": {
"price_per_token": 56.47943,
"total_price": 2015.6838854339217,
"currency": "USDC"
}
},
[...]

Token22 Support

We support Token22 tokens and parse their extensions. The response will include the mint_extensions field if it is a Token22 program. Here is an example for BERN:
"mint_extensions": {
"transfer_fee_config": {
"withheld_amount": 0,
"newer_transfer_fee": {
"epoch": 457,
"maximum_fee": 3906250000000000000,
"transfer_fee_basis_points": 690
},
"older_transfer_fee": {
"epoch": 455,
"maximum_fee": 3906250000000000000,
"transfer_fee_basis_points": 0
},
"withdraw_withheld_authority": "7MyTjmRygJoCuDBUtAuSugiYZFULD2SWaoUTmtjtRDzD",
"transfer_fee_config_authority": "7MyTjmRygJoCuDBUtAuSugiYZFULD2SWaoUTmtjtRDzD"
}
}

TokenType Options

The current options are fungible, nonFungible, regularNft , compressedNft, and all.

How to Get Started?

Just use the DAS API as you would before but also keep in mind that GetAsset, GetAssetsByOwner, and SearchAssets now also support fungible tokens!