> 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).

# usePendingUnshield

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`](/protocol/sdk/api-references/react/useunshield.md) / [`useUnshieldAll`](/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`](/protocol/sdk/api-references/react/useresumeunshield.md); resuming is caller-driven so a wallet transaction is never triggered on load.

## 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/react-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`](/protocol/sdk/api-references/react/useresumeunshield.md) — resume the interrupted unshield from the returned hash
* [`useUnshield`](/protocol/sdk/api-references/react/useunshield.md) — standard unshield (persists/clears pending state automatically)
* [`WrappedToken.getPendingUnshield`](/protocol/sdk/api-references/sdk/wrappedtoken.md#getpendingunshield) — imperative equivalent on the `WrappedToken` class
* [`zamaQueryKeys.pendingUnshield`](/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 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/usependingunshield.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.
