cURL
curl --request GET \ --url https://api.example.com/{EP_STATEMENT_AVAILABLE}
{ "data": { "availables": [ { "currency": { "id": "<string>", "name": "<string>", "decimals": 123, "allowTransfers": true, "disabled": true, "priority": 123 }, "quoteCurrency": {}, "amount": "<string>", "estPrice": "<string>", "estValue": "<string>" } ] }, "status": 123 }
Retrieve a list of all available token balances across all currencies
pollIntervalMs
pollIntervalMs > 0
Show Available Tokens Data
Show Available Token Object
Show Currency
"BTC"
"ETH"
"USDT"
"Bitcoin"
"Ethereum"
8
2
"0.0083506"
"76.4778"
"91141.05"
"761.08"
200
{ "data": { "availables": [ { "currency": { "id": "BTC", "name": "Bitcoin", "decimals": 8, "allowTransfers": true, "disabled": false, "priority": 3 }, "quoteCurrency": { "id": "USDT", "name": "Tether", "decimals": 2, "allowTransfers": true, "disabled": false, "priority": 3 }, "amount": "0.0083506", "estPrice": "91141.05", "estValue": "761.08" }, { "currency": { "id": "ETH", "name": "Ethereum", "decimals": 8, "allowTransfers": true, "disabled": false, "priority": 2 }, "quoteCurrency": { "id": "USDT", "name": "Tether", "decimals": 2, "allowTransfers": true, "disabled": false, "priority": 3 }, "amount": "0.04256646", "estPrice": "3143.105", "estValue": "133.79" }, { "currency": { "id": "USDC", "name": "USD Coin", "decimals": 4, "allowTransfers": true, "disabled": false, "priority": 2 }, "quoteCurrency": { "id": "USDT", "name": "Tether", "decimals": 2, "allowTransfers": true, "disabled": false, "priority": 3 }, "amount": "76.4778", "estPrice": "1.00065", "estValue": "76.52" }, { "currency": { "id": "SOL", "name": "Solana", "decimals": 8, "allowTransfers": true, "disabled": false, "priority": 1 }, "quoteCurrency": { "id": "USDT", "name": "Tether", "decimals": 2, "allowTransfers": true, "disabled": false, "priority": 3 }, "amount": "0.29265251", "estPrice": "135.045", "estValue": "39.52" }, { "currency": { "id": "USDT", "name": "Tether", "decimals": 2, "allowTransfers": true, "disabled": false, "priority": 3 }, "quoteCurrency": { "id": "USDT", "name": "Tether", "decimals": 2, "allowTransfers": true, "disabled": false, "priority": 3 }, "amount": "34.49", "estPrice": "1", "estValue": "34.49" } ] }, "status": 200 }
import { z } from "zod"; import { CurrencySchema } from "./net-worth-data"; export const AvailableTokenDataSchema = z.object({ currency: CurrencySchema, quoteCurrency: CurrencySchema, amount: z.string(), estPrice: z.string(), estValue: z.string(), }); export type AvailableTokenData = z.infer<typeof AvailableTokenDataSchema>; export const AvailablesDataSchema = z.object({ availables: z.array(AvailableTokenDataSchema), }); export type AvailablesData = z.infer<typeof AvailablesDataSchema>; export const availablesDataResponseSchema = z.object({ data: AvailablesDataSchema, status: z.number(), }); export type AvailablesDataResponse = z.infer<typeof availablesDataResponseSchema>; // Formatted UI type export type AvailablesDataItemUI = { id: string; name: string; amount: string; value: string; };
import { useAvailables } from '@/services/hooks/use-availables'; function AvailableBalancesComponent() { const userId = "user-123"; const pollInterval = 30000; // Poll every 30 seconds const { data: availables, isLoading, error } = useAvailables( userId, pollInterval ); if (isLoading) return <div>Loading balances...</div>; if (error) return <div>Error loading balances</div>; return ( <div> <h1>Available Balances</h1> <ul> {availables?.map((token) => ( <li key={token.id}> {token.name}: {token.amount} (${token.value}) </li> ))} </ul> </div> ); }
// Raw API response is transformed to: { id: "BTC", // currency.id name: "Bitcoin", // currency.name amount: "0.0083506", // amount value: "761.08" // estValue }
// Filter tokens with non-zero balances const nonZeroBalances = availables?.filter( (token) => parseFloat(token.amount) > 0 ); // Sort by value (descending) const sortedByValue = availables?.sort( (a, b) => parseFloat(b.value) - parseFloat(a.value) );