# token.getAllowance

Reads the amount of tokens a spender is allowed to spend on behalf of an account.

## Usage

:::code-group

```ts twoslash [example.ts]
import { client } from './viem.config'

const allowance = await client.token.getAllowance({
  account: '0x55FE002aefF02F77364de339a1292923A15844B8',
  spender: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
  token: 'usdc',
})
// @log: { amount: 1000000000n, decimals: 6, formatted: '1000' }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/token/viem.config.ts:setup]
```

:::

### Composing Calls

Use `.call` to build a `getAllowance` contract call, ready to pass to
[`multicall`](/docs/contract/multicall), [`simulateContract`](/docs/contract/simulateContract), or any
other Action that accepts a contract call.

:::code-group

```ts twoslash [example.ts]
import { client } from './viem.config'

const call = client.token.getAllowance.call({ account: '0x…', spender: '0x…', token: 'usdc' })
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/token/viem.config.ts:setup]
```

:::

## Return Type

```ts
type ReturnType = {
  /** Allowance in the token's base units. */
  amount: bigint
  /** Token decimals used to derive `formatted`. */
  decimals: number
  /** Allowance formatted with the token's `decimals`. */
  formatted: string
}
```

The remaining allowance, both in base units (`amount`) and as a human-readable decimal string
(`formatted`, derived from the token's `decimals`).

## Parameters

### account

* **Type:** `Address`

Account that owns the tokens.

### spender

* **Type:** `Address`

Account allowed to spend the account's tokens.

### token

* **Type:** `string`

Token to operate on: a [Client-declared](/tokens/tokens#token-lookup)
token symbol (resolving its `address` and `decimals`), or a token address.

### decimals (optional)

* **Type:** `number`

Token decimals for converting base units to human-readable amounts. Inferred
from the Client's `tokens` array, or fetched from the token contract when omitted.
