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

# useDelegatedDecryptValues

Mutation hook that decrypts FHE encrypted values using delegated user credentials.

Mutation hook that decrypts FHE encrypted values on behalf of a delegator who granted the connected wallet decryption rights (via [`useDelegateDecryption`](/protocol/sdk/api-references/react/usedelegatedecryption.md)). Returns a map of encrypted value to plaintext.

## Import

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

## Usage

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

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

const CONTRACT = "0xYourContract" as const;

function DecryptAsDelegate({
  encryptedValue,
  delegatorAddress,
}: {
  encryptedValue: string;
  delegatorAddress: `0x${string}`;
}) {
  const { mutate: decrypt, data, isPending } = useDelegatedDecryptValues();

  return (
    <div>
      <button
        onClick={() =>
          decrypt({
            encryptedInputs: [{ encryptedValue, contractAddress: CONTRACT }],
            delegatorAddress,
          })
        }
        disabled={isPending}
      >
        {isPending ? "Decrypting..." : "Decrypt"}
      </button>
      {data && <output>{data[encryptedValue]?.toString()}</output>}
    </div>
  );
}
```

{% endtab %}
{% endtabs %}

## Parameters

This hook takes no arguments.

***

## Mutation variables

```ts
import { type DelegatedDecryptValuesMutationParams } from "@zama-fhe/sdk/query";
```

The function passed to `mutate` / `mutateAsync` accepts:

### encryptedInputs

`DecryptInput[]`

Encrypted values (with their contract addresses) to decrypt. Each entry pairs an encrypted value with the address of the contract that owns it.

```ts
import { type DecryptInput } from "@zama-fhe/sdk";
```

| Field             | Type             | Description                                            |
| ----------------- | ---------------- | ------------------------------------------------------ |
| `encryptedValue`  | `EncryptedValue` | The encrypted value (hex string) to decrypt.           |
| `contractAddress` | `Address`        | Address of the contract that owns the encrypted value. |

### delegatorAddress

`Address`

Address of the account that delegated decryption rights to the connected wallet.

```ts
decrypt({
  encryptedInputs: [{ encryptedValue: "0xEncryptedValue1", contractAddress: "0xContract" }],
  delegatorAddress: "0xDelegator",
});
```

## Return Type

The `data` property (after a successful mutation) is `Record<EncryptedValue, ClearValue>` — a map from each encrypted value to its decrypted plaintext value (`bigint`, `boolean`, or `string`).

```ts
// data => { "0xEncryptedValue1": 1000n }
```

## Related

* [useDelegateDecryption](/protocol/sdk/api-references/react/usedelegatedecryption.md) -- grant decryption rights to another address
* [useDecryptBalanceAs](/protocol/sdk/api-references/react/usedecryptbalanceas.md) -- decrypt a token balance as the delegate
* [useDecryptValues](/protocol/sdk/api-references/react/usedecryptvalues.md) -- decrypt your own values (non-delegated)
* [Delegated Decryption](/protocol/sdk/api-references/sdk/delegation.md) -- SDK reference


---

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