> For the complete documentation index, see [llms.txt](https://docs.zama.org/protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/protocol/sdk/api-references/react/uselistpairs.md).

# useListPairs

Fetches paginated token wrapper pairs from the on-chain `ConfidentialTokenWrappersRegistry`. Supports optional metadata enrichment (name, symbol, decimals, totalSupply) for both the underlying ERC-20 and the confidential token.

This is the recommended hook for building token-pair listings. For raw index-based access, see the lower-level hooks.

## Import

```ts
import { useListPairs } from "@zama-fhe/react-sdk";
```

## Usage

{% tabs %}
{% tab title="TokenPairList.tsx" %}

```tsx
import { useListPairs } from "@zama-fhe/react-sdk";

function TokenPairList() {
  const { data, isLoading, error } = useListPairs({ page: 1, pageSize: 20, metadata: true });

  if (isLoading) return <p>Loading pairs...</p>;
  if (error) return <p>Error: {error.message}</p>;
  if (!data) return null;

  return (
    <div>
      <p>
        {data.total} pairs total (page {data.page})
      </p>
      <ul>
        {data.items.map((pair) => (
          <li key={pair.tokenAddress}>
            {"underlying" in pair
              ? `${pair.underlying.symbol} -> ${pair.confidential.symbol}`
              : `${pair.tokenAddress} -> ${pair.confidentialTokenAddress}`}
          </li>
        ))}
      </ul>
    </div>
  );
}
```

{% endtab %}
{% endtabs %}

## Parameters

### page

`number | undefined`

Page number (1-indexed). Default: `1`.

```ts
useListPairs({ page: 2 });
```

### pageSize

`number | undefined`

Number of items per page. Default: `100`.

```ts
useListPairs({ pageSize: 20 });
```

### metadata

`boolean | undefined`

When `true`, fetches on-chain metadata (name, symbol, decimals) for both tokens, plus `totalSupply` for the underlying ERC-20. Default: `false`.

```ts
useListPairs({ metadata: true });
```

## Return Type

The `data` field resolves to `PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>`:

```ts
interface PaginatedResult<T> {
  readonly items: readonly T[];
  readonly total: number;
  readonly page: number;
  readonly pageSize: number;
}
```

When `metadata: false` (default), items are `TokenWrapperPair`:

```ts
interface TokenWrapperPair {
  readonly tokenAddress: Address;
  readonly confidentialTokenAddress: Address;
  readonly isValid: boolean;
}
```

When `metadata: true`, items are `TokenWrapperPairWithMetadata`:

```ts
interface TokenWrapperPairWithMetadata extends TokenWrapperPair {
  readonly underlying: {
    readonly name: string;
    readonly symbol: string;
    readonly decimals: number;
    readonly totalSupply: bigint;
  };
  readonly confidential: {
    readonly name: string;
    readonly symbol: string;
    readonly decimals: number;
  };
}
```

## Caching

Results are cached with a TTL matching the SDK's `registryTTL` (default: 24 hours). The registry uses an in-memory cache shared across all registry queries.

## Related

* [WrappersRegistry](/protocol/sdk/api-references/sdk/wrappersregistry.md) -- SDK-level registry class with `listPairs()` method
* [useTokenPairsRegistry](/protocol/sdk/api-references/react/usetokenpairsregistry.md) -- fetch all pairs at once (no pagination)
* [useConfidentialTokenAddress](/protocol/sdk/api-references/react/useconfidentialtokenaddress.md) -- look up a single token's wrapper
* [Query Keys](/protocol/sdk/api-references/react/query-keys.md) -- manual cache control via `zamaQueryKeys.wrappersRegistry`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.zama.org/protocol/sdk/api-references/react/uselistpairs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
