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

# usePendingUnshield

Read the unwrap tx hash of an unshield interrupted between its two phases.

Read the unwrap transaction hash of an unshield that was interrupted between its two phases (returns `null` if none is pending for the wrapper).

The SDK persists this automatically when [`useUnshield`](https://docs.zama.org/protocol/sdk/api-references/react/useunshield.md) / [`useUnshieldAll`](https://docs.zama.org/protocol/sdk/api-references/react/useunshieldall.md) submit phase 1, and clears it once phase 2 finalizes — the unshield and unwrap mutations invalidate this query on success. Surface the returned hash as a "resume" prompt and pass it to [`useResumeUnshield`](https://docs.zama.org/protocol/sdk/api-references/react/useresumeunshield.md); resuming is caller-driven so a wallet transaction is never triggered on load.

The SDK verifies the persisted hash on-chain before reporting it: if the unwrap request was already finalized, it clears the record and returns `null`, so a stale entry never shows a resume prompt. If the verification read fails, the hash is returned unverified; a network error never deletes recovery state.

## Import

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

## Usage

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

```tsx
import { usePendingUnshield, useResumeUnshield } from "@zama-fhe/react-sdk";
import type { Address } from "@zama-fhe/sdk";

function ResumeUnshieldGuard({
  wrapperAddress,
  children,
}: {
  wrapperAddress: Address;
  children: React.ReactNode;
}) {
  const { data: unwrapTxHash } = usePendingUnshield(wrapperAddress);
  const { mutate: resumeUnshield } = useResumeUnshield(wrapperAddress);

  if (unwrapTxHash) {
    // Finalize on user action, not on load — never trigger a wallet tx unprompted.
    return <button onClick={() => resumeUnshield({ unwrapTxHash })}>Resume unshield</button>;
  }

  return children;
}
```

{% endtab %}
{% endtabs %}

## Parameters

### tokenAddress

`Address`

Address of the confidential wrapper contract. Passed positionally as the first argument.

```ts
const { data: unwrapTxHash } = usePendingUnshield("0xWrapper");
```

## Return Type

`data` is `Hex | null` — the unwrap transaction hash of an interrupted unshield, or `null` when none is pending.

## Suspense

Use `usePendingUnshieldSuspense` inside a `<Suspense>` boundary. The hook throws a promise while loading, so `data` is always defined (`Hex | null`).

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

const { data: unwrapTxHash } = usePendingUnshieldSuspense("0xWrapper");
```

## Related

* [`useResumeUnshield`](https://docs.zama.org/protocol/sdk/api-references/react/useresumeunshield.md) — resume the interrupted unshield from the returned hash
* [`useUnshield`](https://docs.zama.org/protocol/sdk/api-references/react/useunshield.md) — standard unshield (persists/clears pending state automatically)
* [`WrappedToken.getPendingUnshield`](https://docs.zama.org/protocol/sdk/api-references/sdk/wrappedtoken.md#getpendingunshield) — imperative equivalent on the `WrappedToken` class
* [`zamaQueryKeys.pendingUnshield`](https://docs.zama.org/protocol/sdk/api-references/react/query-keys.md) — cache keys for manual invalidation


---

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