> 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/usewrapperdiscovery.md).

# useWrapperDiscovery

Find the confidential wrapper contract address for an ERC-20 token via the on-chain registry. The result is cached indefinitely since wrapper addresses never change.

## Import

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

## Usage

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

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

function WrapperInfo({ tokenAddress }: { tokenAddress: `0x${string}` }) {
  const {
    data: wrapperAddress,
    isLoading,
    error,
  } = useWrapperDiscovery({ tokenAddress, erc20Address: "0xUSDC" });

  if (isLoading) return <p>Discovering wrapper...</p>;
  if (error) return <p>Error: {error.message}</p>;

  return <p>Wrapper: {wrapperAddress}</p>;
}
```

{% endtab %}
{% endtabs %}

## Parameters

### tokenAddress

`Address`

Address of any confidential token you control. Used to scope the query cache key and to gate whether the query is enabled — it does not affect which wrapper the registry returns.

### erc20Address

`Address | undefined`

Address of the ERC-20 token to discover the wrapper for. Pass `undefined` to disable the query.

```ts
useWrapperDiscovery({ tokenAddress: "0xConfidentialToken", erc20Address: "0xUSDC" });
```

## Return Type

The `data` field resolves to `Address | null` -- the wrapper contract address for the given token, or `null` if no wrapper exists.

## Caching

The query uses `staleTime: Infinity`. Wrapper addresses are immutable once deployed, so the result never re-fetches automatically.

## Suspense

Use `useWrapperDiscoverySuspense` inside a `<Suspense>` boundary to avoid manual loading state handling:

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

function WrapperInfo({ tokenAddress }: { tokenAddress: `0x${string}` }) {
  const { data: wrapperAddress } = useWrapperDiscoverySuspense({
    tokenAddress,
    erc20Address: "0xUSDC",
  });

  return <p>Wrapper: {wrapperAddress}</p>;
}
```

## Related

* [useMetadata](/protocol/sdk/api-references/react/usemetadata.md) -- read token name, symbol, and decimals
* [Hooks overview](/protocol/sdk/api-references/react/query-keys.md) -- all available hooks


---

# 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/usewrapperdiscovery.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.
