# Manage tokens and balances

HOT Kit significantly simplifies token management, providing access to token information across various networks, current exchange rates in USD, and balances of connected wallets. Let's take a closer look at the tokens manager:

### Tokens repository

Each token has a unique ID, which is structured as `chainID:tokenAddress`. You can retrieve a specific token's class using `tokens.get`. This class offers several useful methods for formatting the balance according to the token's decimals.

```typescript
import { tokens, chains, Network } from '@hot-labs/kit'

// The repository chains contains data on all popular blockchains.
const baseChain = chains.get(Network.Base)

// The tokens repository contains a list of primary tokens, 
// which are supported for exchange and display in portfolios.
const ethOnBase = tokens.get("native", Network.Base)

// Converts an int to a float using the token's decimals.
ethOnBase.float(10_000_000n)

// Converts a number to an integer using decimals.
ethOnBase.int(10)

// Actual 0.01 ETH in dollars
console.log(`USD: ${ethOnBase.float(10n ** BigInt(ethOnBase.decimals - 2)) * ethOnBase.usd}`)

// IMPORTANT:
// ID of token is combination of chain id and address
// Any native token has address === 'native'
token.id === `${token.chain}:${token.address}`
```

### Refresh tokens and rates

If you are working with the `HotConnector` class, the current list of tokens and balances are automatically updated. If you received a token through `tokens.get`, its USD rate will be updated automatically, meaning any access to `token.usd` will give you the current rate within a 5-minute interval.

If you are working with Node.js or do not wish to use `HotConnector`, you can explicitly initialize automatic balance updates or request a forced update of the entire repository.

```typescript
tokens.startTokenPolling(interval?: number) // default inverval 2 minutes
tokens.refreshTokens() // or force refresh
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hotdao.ai/hot-kit/manage-tokens-and-balances.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
