# Importing Tokens

Viem exports reusable token definitions from `viem/tokens`. Use these imports when you need token
metadata, a Client token definition, or a token address for a supported chain.

## Usage

```ts twoslash
import { mainnet } from 'viem/chains'
import { usdc } from 'viem/tokens'

usdc
// @log: {
// @log:   addresses: {
// @log:     1: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
// @log:     10: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
// @log:     8453: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
// @log:   },
// @log:   currency: 'USD',
// @log:   decimals: 6,
// @log:   name: 'USD Coin',
// @log:   popular: true,
// @log:   symbol: 'USDC',
// @log: }

const mainnetUsdc = usdc(mainnet.id)
// @log: {
// @log:   address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
// @log:   currency: 'USD',
// @log:   decimals: 6,
// @log:   name: 'USD Coin',
// @log:   popular: true,
// @log:   symbol: 'USDC',
// @log: }
```

## Attach to a Client

To select a token by symbol in Token Actions, attach the imported definition to the Client's
`tokens` array.

```ts twoslash
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { usdc } from 'viem/tokens'

export const client = createPublicClient({
  chain: mainnet,
  tokens: [usdc], // [!code hl]
  transport: http(),
})
```

Once attached, use the lowercased token symbol as the Action selector.

```ts twoslash
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { usdc } from 'viem/tokens' // [!code focus]

const client = createPublicClient({
  chain: mainnet,
  tokens: [usdc], // [!code focus]
  transport: http(),
})
// ---cut---
const balance = await client.token.getBalance({
  account: '0x55FE002aefF02F77364de339a1292923A15844B8',
  token: 'usdc',
})
// @log: { amount: 1000000000n, decimals: 6, formatted: '1000' }
```

## Use the Address

Imported tokens also expose an `addresses` map. Use it when you want to pass a token contract
address directly.

```ts twoslash
import { usdc } from 'viem/tokens'

const addresses = usdc.addresses
// @log: {
// @log:   1: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
// @log:   10: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85',
// @log:   8453: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
// @log: }
```
