# Balance Tracking Build portfolio dashboards and account management interfaces that track both fungible tokens and NFT holdings across Kadena chains. ## FungibleAccount: Token Balance Tracking Track fungible token balances (like KDA) for any account across all 20 Kadena chains with aggregated totals. ```graphql query FungibleAccount($accountName: String!) { fungibleAccount(accountName: $accountName) { fungibleName accountName totalBalance chainAccounts { balance chainId guard { ... on KeysetGuard { keys predicate } } } } } ``` **Variables** ```json { "accountName": "k:fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" } ``` **Response** ```json { "data": { "fungibleAccount": { "fungibleName": "coin", "accountName": "k:fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30", "totalBalance": 41.448545654965024, "chainAccounts": [ { "balance": 9.954759845315, "chainId": "0", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 17.775934326463, "chainId": "1", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.019117254116, "chainId": "2", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.10949543, "chainId": "3", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 1.75668982, "chainId": "4", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 8.058975679, "chainId": "5", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.000579, "chainId": "6", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.000579, "chainId": "7", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.768194120071, "chainId": "8", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.000377, "chainId": "9", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.000379, "chainId": "10", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.00001, "chainId": "11", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.000579, "chainId": "12", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.999788, "chainId": "13", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.0001, "chainId": "14", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 2.00278818, "chainId": "15", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.0001, "chainId": "16", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0.0001, "chainId": "17", "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } } ] } } } ``` **Use Cases** - Portfolio management dashboards - Multi-chain balance aggregation - Wallet interfaces showing KDA distribution - DeFi position tracking **Notes** totalBalance aggregates balances across all chains. Missing chainIds indicate zero balance. Use chainAccounts for chain-specific balance displays. ## NonFungibleAccount: NFT Portfolio Tracking Track all NFT (Non-Fungible Token) holdings for any Kadena account across all chains. ```graphql query NonFungibleAccount($accountName: String!) { nonFungibleAccount(accountName: $accountName) { nonFungibleTokenBalances { balance chainId tokenId info { precision supply uri } guard { ... on KeysetGuard { keys predicate } } } } } ``` **Variables** ```json { "accountName": "k:fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" } ``` **Response** ```json { "data": { "nonFungibleAccount": { "nonFungibleTokenBalances": [ { "balance": 1, "chainId": "8", "tokenId": "sgk-gen-1:1851", "info": { "precision": 0, "supply": 1, "uri": "data:https,https://secret-garden-of-kadena-gen-1.nyc3.cdn.digitaloceanspaces.com/images/1851.png" }, "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 1, "chainId": "8", "tokenId": "t:2sfhbduRCRuTwb-Ia7fSc3d0nFzmwcIjxF3KnFi-Fus", "info": { "precision": 0, "supply": 150, "uri": "data:image/png,https://bafybeigw56be56j3ir3rrcyxlllbxnzfx6xzpgbsit4tp6omagngn4k4oy.ipfs.w3s.link/vuejsforge4.png" }, "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } }, { "balance": 0, "chainId": "8", "tokenId": "pit-bull-bushido #1911", "info": { "precision": 0, "supply": 1, "uri": "data:https,https://pit-bull-bushido.nyc3.cdn.digitaloceanspaces.com/7-15.png" }, "guard": { "keys": [ "fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30" ], "predicate": "keys-all" } } ] } } } ``` **Use Cases** - NFT portfolio dashboards - Digital art collection tracking - Gaming asset inventory systems - NFT marketplace integration **Notes** Balance 0 indicates previously owned but transferred NFTs. Use uri field to fetch NFT metadata and images. Supply=1 indicates unique NFTs, higher values for semi-fungible tokens. ## Balance: Multi-Token Portfolio Overview Track all token balances across different protocols and chains for comprehensive portfolio management. ```graphql query Query( $accountName: String! $first: Int $before: String $after: String $last: Int $chainIds: [String!] ) { lastBlockHeight balance( accountName: $accountName first: $first before: $before after: $after last: $last chainIds: $chainIds ) { edges { cursor node { balance chainId module } } pageInfo { endCursor hasNextPage hasPreviousPage startCursor } } } ``` **Variables** ```json { "accountName": "k:fc0c4b9e0b1c2df1a50694f5dbeb2faf7e637018e74f6046da1eb7e8e32e3d30", "first": null, "last": null, "before": null, "after": null, "chainIds": null } ``` **Response** ```json { "data": { "lastBlockHeight": 6213212, "balance": { "edges": [ { "cursor": "NjIxOTc2NzYw", "node": { "balance": "1.2", "chainId": "0", "module": "mok.token" } }, { "cursor": "NjEyMDk2ODk0", "node": { "balance": "0.199909627678", "chainId": "0", "module": "hypercent.prod-hype-coin" } }, { "cursor": "NDY3NTMzNDk3", "node": { "balance": "11", "chainId": "0", "module": "kdlaunch.kdswap-token" } }, { "cursor": "MzYzNzk3ODk1", "node": { "balance": "0.1", "chainId": "0", "module": "n_b742b4e9c600892af545afb408326e82a6c0c6ed.zUSD" } }, { "cursor": "MjUwNjg1ODg4", "node": { "balance": "78.776240348282", "chainId": "0", "module": "free.docu" } }, { "cursor": "MjE0MjI0Mjkz", "node": { "balance": "21", "chainId": "0", "module": "arkade.token" } }, { "cursor": "MjA2MTM0MjEw", "node": { "balance": "2.15814", "chainId": "2", "module": "hypercent.prod-hype-coin" } }, { "cursor": "MTk5MDg3NzA4", "node": { "balance": "5.053303", "chainId": "2", "module": "mok.token" } }, { "cursor": "MTk2ODI2NTY0", "node": { "balance": "0.10445973", "chainId": "2", "module": "runonflux.flux" } }, { "cursor": "MTk0OTgzMDA2", "node": { "balance": "6593.542985790795", "chainId": "2", "module": "free.KAYC" } }, { "cursor": "MTcxOTAyMzk0", "node": { "balance": "0.999788", "chainId": "13", "module": "coin" } } ], "pageInfo": { "endCursor": "MTcxOTAyMzk0", "hasNextPage": true, "hasPreviousPage": false, "startCursor": "NjIxOTc2NzYw" } } } } ``` **Use Cases** - DeFi portfolio aggregation - Multi-token wallet interfaces - Protocol-specific balance tracking - Cross-chain asset management **Notes** Shows all token types (modules) held by account. Use chainIds filter for specific chains. Zero balances indicate previous holdings. Includes lastBlockHeight for real-time sync status. ``` ```