> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Sign Authorization \[wallet.signAuthorization]

Signs an [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) Authorization object.
Fills required fields such as `nonce` and `chainId` when you omit them.

Only Local Accounts can sign Authorizations; JSON-RPC Accounts are rejected.

## Usage

This example signs an [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) Authorization object.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const authorization = await client.wallet.signAuthorization({
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
// @log: {
// @log:   address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
// @log:   chainId: 1,
// @log:   nonce: 664n,
// @log:   r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
// @log:   s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
// @log:   yParity: 0,
// @log: }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Account, Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  account: Account.fromPrivateKey('0x…'),
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

### Standalone Action

Call `Actions.wallet.signAuthorization` directly by passing the Client as the first argument.

:::code-group
```ts twoslash [example.ts]
import { Actions } from 'viem'
import { client } from './viem.config'

const authorization = await Actions.wallet.signAuthorization(client, {
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
// @log: {
// @log:   address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
// @log:   chainId: 1,
// @log:   nonce: 664n,
// @log:   r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
// @log:   s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
// @log:   yParity: 0,
// @log: }
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Account, Client, http } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  account: Account.fromPrivateKey('0x…'),
  chain: mainnet,
  transport: http(),
})
```
:::

## Recipes

### Sign with a Specific Local Account

Pass a Local Account when the Client does not define the signer. JSON-RPC Account addresses cannot
sign Authorizations.

:::code-group
```ts twoslash [example.ts]
import { Account } from 'viem'
import { client } from './viem.config'

const account = Account.fromPrivateKey('0x…')

const authorization = await client.wallet.signAuthorization({
  account, // [!code focus]
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

### Sign for Self-Execution

Set `executor: 'self'` when the signing account will submit the EIP-7702 transaction. The derived
Authorization nonce accounts for the execution transaction.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const authorization = await client.wallet.signAuthorization({
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
  executor: 'self', // [!code focus]
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Account, Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  account: Account.fromPrivateKey('0x…'),
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

### Sign with a Known Nonce

Pass `nonce` when the Authorization nonce is already reserved. This option avoids a nonce lookup
before signing.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

export function signAtNonce(nonce: bigint) {
  return client.wallet.signAuthorization({
    address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
    nonce, // [!code focus]
  })
}
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { Account, Client, http, walletActions } from 'viem'
import { mainnet } from 'viem/chains'

export const client = Client.create({
  account: Account.fromPrivateKey('0x…'),
  chain: mainnet,
  transport: http(),
}).extend(walletActions())
```
:::

## Return Value

`Authorization<true>`

The signed Authorization object.

## Parameters

### account

* **Type:** `Account | Address`
* **Default:** `client.account`

Local Account (or address) signing the Authorization.

```ts twoslash
import { Account, Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const authorization = await Actions.wallet.signAuthorization(client, {
  account: Account.fromPrivateKey('0x…'), // [!code focus]
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
```

### address

* **Type:** `Address`

Address of the contract to delegate to.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const authorization = await Actions.wallet.signAuthorization(client, {
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', // [!code focus]
})
```

### chainId

* **Type:** `number`
* **Default:** `client.chain.id`

Chain ID to scope the Authorization to.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const authorization = await Actions.wallet.signAuthorization(client, {
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
  chainId: 1, // [!code focus]
})
```

### executor

* **Type:** `'self' | Account | Address`

Whether the signing EOA or another Account will execute the EIP-7702 transaction.

Pass `'self'` when the signing EOA also submits the transaction.
Viem then increments the nonce for the execution transaction.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const authorization = await Actions.wallet.signAuthorization(client, {
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
  executor: 'self', // [!code focus]
})
```

### nonce

* **Type:** `bigint`
* **Default:** account nonce

Nonce of the Authorization.

```ts twoslash
import { Actions } from 'viem'
// [!include ~/snippets/docs/reference-client.ts:setup]
// ---cut---
const authorization = await Actions.wallet.signAuthorization(client, {
  address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
  nonce: 69n, // [!code focus]
})
```

## Errors

| Error | Description |
| --- | --- |
| `Account.NotFoundError` | No `account` was provided and the client has no account. |
| `AccountTypeNotSupportedError` | The account is a JSON-RPC Account, which cannot sign Authorizations. |
