Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_token_accounts_by_owner_json_parsed is not returning SOL balance #428

Open
Aviksaikat opened this issue May 16, 2024 · 0 comments
Open

Comments

@Aviksaikat
Copy link

As mentioned here #48 I'm doing the following the get the token balance of a token account

opts = TokenAccountOpts(program_id=Pubkey.from_string('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'))
data = http_client.get_token_accounts_by_owner_json_parsed(addr,  opts)
print(data)
GetTokenAccountsByOwnerJsonParsedResp {
   context: RpcResponseContext {
      slot: 266082342,
      api_version: Some(
         "1.17.28",
      ),
   },
   value: [
      RpcKeyedAccountJsonParsed {
         pubkey: Pubkey(
            DDbasA38QbfNA3newPNSi7ecNSuX2mocuXQBTEb4oPw4,
         ),
         account: AccountJSON {
            lamports: 2039280,
            data: ParsedAccount(
               ParsedAccount {
                  program: "spl-token",
                  parsed: Object {
                     "info": Object {
                        "isNative": Bool(false),
                        "mint": String("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"),
                        "owner": String("addr"),
                        "state": String("initialized"),
                        "tokenAmount": Object {
                           "amount": String("14322586"),
                           "decimals": Number(6),
                           "uiAmount": Number(14.322586),
                           "uiAmountString": String("14.322586"),
                  },
               },
                     "type": String("account"),
            },
                  space: 165,
         },
            ),
            owner: Pubkey(
               TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA,
            ),
            executable: false,
            rent_epoch: 18446744073709551615,      },   },
      RpcKeyedAccountJsonParsed {
         pubkey: Pubkey(
            9S7bZeawU8UM2ez5oZWC5ye2f3xJZNsCKFFEZHa1kPTz,
         ),
         account: AccountJSON {
            lamports: 2039280,
            data: ParsedAccount(
               ParsedAccount {
                  program: "spl-token",
                  parsed: Object {
                     "info": Object {
                        "isNative": Bool(false),
                        "mint": String("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),
                        "owner": String("addr"),
                        "state": String("initialized"),
                        "tokenAmount": Object {
                           "amount": String("1430977"),
                           "decimals": Number(6),
                           "uiAmount": Number(1.430977),
                           "uiAmountString": String("1.430977"),
                  },
               },
                     "type": String("account"),
            },
                  space: 165,
         },
            ),
            owner: Pubkey(
               TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA,
            ),
            executable: false,
            rent_epoch: 18446744073709551615,      },   },
   ],
}

This is my account that I'm fetching

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant