Any solution to get Tezos(XTZ) balance of wallet address in Flutter? Any packages? or direct API? PS: I used https://pub.dev/packages/tezster_dart, but it’s not worked with my flutter version, which has not been updated until 16 months.
1 Answer
I don't use Flutter, so not sure about that specifically. But yes there is the Tezos RPC, which is an API to query data from the node directly.
For example heres how to query an XTZ balance of a specific contract: https://gitlab.com/tezos/tezos/-/blob/master/docs/api/jakarta-openapi.json#/default/get_context_contracts__contract_id__balance
I've sent you a link to this API previously also for token balances / NFT balances. This API also has endpoints for querying info about an account: https://api.tzkt.io/
-
How to provide contract-id ??? At this time I just have the wallet address? I want to get balance of XTZ coin– TalebCommented Jul 15, 2022 at 7:18
-
I used "api.tzkt.io/v1/accounts{address}/balance" before, but I have two questions about it. 1. what is the return type? Is it a balance in USD or num of XTZ? 2. Is this result of my whole wallet balance or the XTZ contract balance inside my wallet?– TalebCommented Jul 15, 2022 at 7:52
-
1@Taleb
contract-id
is a wallet address or a smart contract address. They are both "contracts". The result of the TZKT call is XTZ balance, XTZ is the primary currency of the network, not USD. There is no "XTZ contract inside my wallet", your wallet address IS the contract that holds the XTZ. You can test these things yourself, you can search for a wallet address on the TZKT webpage: tzkt.io and compare the API response to whats displayed on the frontend– Simon McLoughlin ♦Commented Jul 15, 2022 at 8:26