# grantPermissions | @account-kit/wallet-client

> Overview of the grantPermissions function from @account-kit/wallet-client

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function grantPermissions<TAccount>(
  client,
  signer,
  params,
): Promise<GrantPermissionsResult>;
```

Defined in: [account-kit/wallet-client/src/client/actions/grantPermissions.ts:94](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/wallet-client/src/client/actions/grantPermissions.ts#L94)

Grants permissions to a smart account by creating a session.
This allows another key to perform operations on behalf of the account.

## Example

```ts
// Create a session key and grant root permissions
const sessionKey = LocalAccountSigner.generatePrivateKeySigner();
const account = await client.requestAccount();

const permissions = await client.grantPermissions({
  account: account.address,
  expirySec: Math.floor(Date.now() / 1000) + 60 * 60, // 1 hour from now
  key: {
    publicKey: await sessionKey.getAddress(),
    type: "secp256k1",
  },
  permissions: [{ type: "root" }],
});

// Use the permissions to prepare a call
const preparedCalls = await client.prepareCalls({
  calls: [{ to: zeroAddress, value: "0x0" }],
  from: account.address,
  capabilities: {
    paymasterService: {
      policyId: "your-paymaster-policy-id",
    },
    permissions,
  },
});

// Sign with the session key
const signedCalls = await signPreparedCalls(sessionKey, preparedCalls);

// Send the prepared call using the session key
const result = await client.sendPreparedCalls({
  ...signedCalls,
  capabilities: {
    permissions,
  },
});
```

## Type Parameters

<table>
  <thead>
    <tr>
      <th align="left">Type Parameter</th>
      <th align="left">Default type</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `TAccount` *extends* `undefined` | `` `0x${string}` ``
      </td>

      <td>
        `undefined` | `` `0x${string}` ``
      </td>
    </tr>

  </tbody>
</table>

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `client`
      </td>

      <td>
        `InnerWalletApiClient`
      </td>

      <td>
        The wallet API client to use for the request
      </td>
    </tr>

    <tr>
      <td>
        `signer`
      </td>

      <td>
        `SmartWalletSigner`
      </td>

      <td>
        The signer of the smart account
      </td>
    </tr>

    <tr>
      <td>
        `params`
      </td>

      <td>
        \{ \[K in string | number | symbol]: (Omit\<\{} & \{}, "account" | "chainId"> & (IsUndefined\<TAccount> extends true ? \{ account: \`0x$\{string}\` } : \{ account?: undefined }))\[K] }
      </td>

      <td>
        The parameters for granting permissions
      </td>
    </tr>

  </tbody>
</table>

## Returns

`Promise`\<[`GrantPermissionsResult`](../type-aliases/GrantPermissionsResult)>

A Promise that resolves to the result containing a context identifier