Trying to access custom token based on solana wallet

When asking for help in this category, please make sure to provide the following details:

  • SDK Version: Flutter sdk 3.19.4
  • Platform: Flutter (Android/iOS)
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken (JWT):

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

Hi, we’ve created a 3 custom token within the solana blockchain, so when a user logs in through web3Auth and has a wallet created, we’d be sending them these 3 custom tokens. My question is, how can I access the balance from these 3 accounts? I CAN access the main solana wallet token balance by using

balance = await provider.getBalance(keypair.address);

as in the web3auth docs, but how do I access the custom token balances? Basically, is there a method that lists all the accounts under a solana wallet address and then I can get the balance from each of the accounts (aka the custom token balances)? As an example to follow what I’m trying to acheive:

1.) Go here: Tokens | 4ynbQEKkginKrFohd1hzhjApYBRHS6cKcrBZPaLYUQ2u | Solana …As you can see, the wallet address here is: 4ynbQEKkginKrFohd1hzhjApYBRHS6cKcrBZPaLYUQ2u that gets created on web3auth login.
2.) If you go down, you’ll see “Tokens” tab under " Token Holdings", you’ll see 3 different accounts, each with a balance of 4.
3.) I would like to get all three of these balances for each of these accounts returned as 4, 4, 4

Help appreciated. Thanks!

Hey @service2, to access the solana custom token balances for an account, you can use the third party APIs. Web3Auth is just a wallet as a service, so we only generate wallet for users. Developers are free to choose the APIs they want to use to fetch the token balances, NFTs, or any other data.

Couple of the API providers you can try are Bitquery, and Unmarshal.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.