> 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). Agents can also search and read this documentation through its [MCP server](https://docs.zama.org/protocol/~gitbook/mcp).

# useListPairs

Fetch paginated token wrapper pairs from the on-chain registry, with optional metadata enrichment.

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](https://docs.zama.org/protocol/sdk/api-references/sdk/wrappersregistry.md) -- SDK-level registry class with `listPairs()` method
* [useTokenPairsRegistry](https://docs.zama.org/protocol/sdk/api-references/react/usetokenpairsregistry.md) -- fetch all pairs at once (no pagination)
* [useConfidentialTokenAddress](https://docs.zama.org/protocol/sdk/api-references/react/useconfidentialtokenaddress.md) -- look up a single token's wrapper
* [Query Keys](https://docs.zama.org/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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
