# hcaAdmin.grantUpgradeSetRoles

> For the complete documentation index, see [llms.txt](https://ensforge.com/llms.txt).

Grants root roles on the HCA upgrade set (role admins only). Parameters, return value, errors and examples for hcaAdmin.grantUpgradeSetRoles in @ensforge/hca.

Source: https://ensforge.com/docs/reference/hca/hca-admin/grant-upgrade-set-roles

<ApiMeta kind="Write" stability="experimental" since="1.0.0" source="packages/hca/src/actions/hcaAdmin/grantUpgradeSetRoles/index.ts#L43" />

<Callout type="info" title="Experimental">
`@ensforge/hca` is experimental: its API can change in a minor release.
</Callout>

Grants root roles on the HCA upgrade set (role admins only). Resolves once the transaction is submitted.

## When to use [#when-to-use]

Use to let another account approve HCA upgrade targets.

## Signature [#signature]

```ts
function grantUpgradeSetRoles(
  client: Like,
  options: grantUpgradeSetRoles.Options & Write.Options,
): Promise<grantUpgradeSetRoles.ReturnType>
```

Call it as `ens.hcaAdmin.grantUpgradeSetRoles(options)` on a client, or `Actions.hcaAdmin.grantUpgradeSetRoles(client, options)`.

## Parameters [#parameters]

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `grantee` (required) | `string` |  | Account to grant. |
| `roles` (required) | `bigint` |  | Role bitmap. |

Also takes the [write options](/docs/reference/sdk/client#write-options).

## Returns [#returns]

Resolves to `Write.Result`. Submitted transaction hashes and the plan that produced them.

| Field | Type | Description |
| --- | --- | --- |
| `hash` | `Hex` | Hash of the last transaction. |
| `hashes` | `readonly Hex[]` | Every submitted transaction, in order. |
| `id` | `string` | EIP-5792 bundle id when the calls were sent as one batch. |
| `plan` | `Plan` | The plan the write executed: its steps, in order, as they were submitted. |

## Errors [#errors]

| Error | Codes | When |
| --- | --- | --- |
| [`InvalidInputError`](/docs/reference/errors/invalid-input-error) | [`INVALID_ADDRESS`](/docs/reference/errors/INVALID_ADDRESS) | an invalid address. |
| [`HcaError`](/docs/reference/errors/hca-error) | [`HCA_UNAVAILABLE`](/docs/reference/errors/HCA_UNAVAILABLE) | on chains without an HCA deployment. |

It can also fail with the errors every write can (`Errors.WriteError`: the common errors plus `InsufficientFundsError`, `TransactionError`, `UnsupportedError`, `UserRejectedError`, `WalletError`).

See [How errors work](/docs/sdk/errors-explained).

## Examples [#examples]

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Granting upgrade-set roles"
const { hash } = await ens.hcaAdmin.grantUpgradeSetRoles({ grantee, roles })
```
</Tab>

<Tab>
```ts title="Granting upgrade-set roles with a standalone call"
import { Actions } from "@ensforge/hca"

await Actions.hcaAdmin.grantUpgradeSetRoles(ens, { grantee, roles })
```
</Tab>

<Tab>
```ts title="Granting upgrade-set roles in an Effect program"
import { Actions } from "@ensforge/hca/effect"

yield* Actions.hcaAdmin.grantUpgradeSetRoles(ens, { grantee, roles })
```
</Tab>
</Tabs>

## Plan methods [#plan-methods]

Each method takes the same options as `hcaAdmin.grantUpgradeSetRoles` and sends nothing. See [Preview before sending](/docs/sdk/preview-before-sending).

| Method | Description |
| --- | --- |
| `hcaAdmin.grantUpgradeSetRoles.prepare(options)` | Builds the plan without sending anything. |
| `hcaAdmin.grantUpgradeSetRoles.simulate(options)` | Simulates the plan with `eth_call`, reporting each step. |
| `hcaAdmin.grantUpgradeSetRoles.estimateGas(options)` | Estimates the gas and ETH the plan needs. |

## Wait for the receipt with `grantUpgradeSetRolesSync` [#wait-for-the-receipt-with-grantupgradesetrolessync]

Grants root roles on the HCA upgrade set (role admins only). Resolves once the receipt is in.

Use when the next step depends on the change being on-chain.

`hcaAdmin.grantUpgradeSetRolesSync` takes the same options plus [`confirmations` and `timeout`](/docs/reference/sdk/client#sync-options).

Resolves to `Write.SyncResult`. Receipts plus the submitted hashes and plan.

<Tabs groupId="api" items={["Client","Standalone","Effect"]} persist>
<Tab>
```ts title="Granting upgrade-set roles and waiting"
const { receipt } = await ens.hcaAdmin.grantUpgradeSetRolesSync({ grantee, roles })
```
</Tab>

<Tab>
```ts title="Granting upgrade-set roles with a standalone call and waiting"
import { Actions } from "@ensforge/hca"

await Actions.hcaAdmin.grantUpgradeSetRolesSync(ens, { grantee, roles })
```
</Tab>

<Tab>
```ts title="Granting upgrade-set roles in an Effect program and waiting"
import { Actions } from "@ensforge/hca/effect"

yield* Actions.hcaAdmin.grantUpgradeSetRolesSync(ens, { grantee, roles })
```
</Tab>
</Tabs>