> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qu.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Signer

A Signer represents an account on the Ethereum Blockchain, and is most often backed by a private key represented by a
mnemonic or residing on a Hardware Wallet.

The API remains abstract though, so that it can deal with more advanced exotic Signing entities, such as Smart
Contract Wallets or Virtual Wallets (where the private key may not be known).

## Extends

* [`Addressable`](/sdk/content/interfaces/Addressable).[`ContractRunner`](/sdk/content/interfaces/ContractRunner)

## Properties

| Property   | Type                                                     | Description                                                                            | Overrides                                                             |
| :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------------------- | :-------------------------------------------------------------------- |
| `provider` | `null` \| [`Provider`](/sdk/content/interfaces/Provider) | The [**Provider**](/sdk/content/interfaces/Provider) attached to this Signer (if any). | [`ContractRunner`](/sdk/content/interfaces/ContractRunner).`provider` |

## Methods

### call()

```ts theme={null}
call(tx): Promise<string>
```

Evaluates th tx by running it against the current Blockchain state. This cannot change state and has no cost in
ether, as it is effectively simulating execution.

This can be used to have the Blockchain perform computations based on its state (e.g. running a Contract's
getters) or to simulate the effect of a transaction before actually performing an operation.

#### Parameters

| Parameter | Type                                                                 | Description              |
| :-------- | :------------------------------------------------------------------- | :----------------------- |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) | The transaction to call. |

#### Returns

`Promise`\<`string`>

A promise resolving to the result of the call.

#### Overrides

`ContractRunner.call`

#### Source

[signers/signer.ts:124](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L124)

***

### connect()

```ts theme={null}
connect(provider): Signer
```

Returns a new instance of this Signer connected to provider or detached from any Provider if null.

#### Parameters

| Parameter  | Type                                                     | Description                 |
| :--------- | :------------------------------------------------------- | :-------------------------- |
| `provider` | `null` \| [`Provider`](/sdk/content/interfaces/Provider) | The Provider to connect to. |

#### Returns

[`Signer`](/sdk/content/interfaces/Signer)

A new instance of this Signer.

#### Throws

If the Signer cannot be connected to the Provider.

#### Source

[signers/signer.ts:31](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L31)

***

### createAccessList()

```ts theme={null}
createAccessList(tx): Promise<AccessList>
```

Creates an AccessList for the transaction. This is used to specify which addresses the transaction might touch.

#### Parameters

| Parameter | Type                                                                 | Description |
| :-------- | :------------------------------------------------------------------- | :---------- |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) |             |

#### Returns

`Promise`\<[`AccessList`](/sdk/content/type-aliases/AccessList)>

A promise resolving to the access list.

#### Overrides

`ContractRunner.createAccessList`

#### Source

[signers/signer.ts:112](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L112)

***

### estimateGas()

```ts theme={null}
estimateGas(tx): Promise<bigint>
```

Estimates the required gas required to execute tx on the Blockchain. This will be the expected amount a
transaction will require as its `gasLimit` to successfully run all the necessary computations and store the
needed state that the transaction intends.

Keep in mind that this is **best efforts**, since the state of the Blockchain is in flux, which could affect
transaction gas requirements.

#### Parameters

| Parameter | Type                                                                 | Description                          |
| :-------- | :------------------------------------------------------------------- | :----------------------------------- |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) | The transaction to estimate gas for. |

#### Returns

`Promise`\<`bigint`>

A promise resolving to the estimated gas.

#### Overrides

`ContractRunner.estimateGas`

#### Throws

UNPREDICTABLE\_GAS\_LIMIT A transaction that is believed by the node to likely fail will throw an error
during gas estimation. This could indicate that it will actually fail or that the circumstances are simply too
complex for the node to take into account. In these cases, a manually determined `gasLimit` will need to be
made.

#### Source

[signers/signer.ts:104](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L104)

***

### getAddress()

```ts theme={null}
getAddress(): Promise<string>
```

Get the address of the Signer.

#### Returns

`Promise`\<`string`>

The address of the Signer.

#### Overrides

[`Addressable`](/sdk/content/interfaces/Addressable).[`getAddress`](/sdk/content/interfaces/Addressable#getaddress)

#### Throws

If the Signer has no address.

#### Source

[signers/signer.ts:42](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L42)

***

### getNonce()

```ts theme={null}
getNonce(blockTag?): Promise<number>
```

Gets the next nonce required for this Signer to send a transaction.

#### Parameters

| Parameter   | Type                                             | Description                                                                                                                                          |
| :---------- | :----------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
| `blockTag`? | [`BlockTag`](/sdk/content/type-aliases/BlockTag) | The blocktag to base the transaction count on, keep in mind many nodes do not honour this value<br />  and silently ignore it \[default: `"latest"`] |

#### Returns

`Promise`\<`number`>

The next nonce.

#### Source

[signers/signer.ts:51](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L51)

***

### populateCall()

```ts theme={null}
populateCall(tx): Promise<TransactionLike>
```

Prepares a [TransactionRequest](/sdk/content/type-aliases/TransactionRequest) for calling:

* Resolves `to` and `from` addresses
* If `from` is specified , check that it matches this Signer

#### Parameters

| Parameter | Type                                                                 | Description         |
| :-------- | :------------------------------------------------------------------- | :------------------ |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) | The call to prepare |

#### Returns

`Promise`\<[`TransactionLike`](/sdk/content/interfaces/TransactionLike)>

A promise resolving to the prepared transaction.

#### Source

[signers/signer.ts:65](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L65)

***

### populateQuaiTransaction()

```ts theme={null}
populateQuaiTransaction(tx): Promise<TransactionLike>
```

Prepares a [TransactionRequest](/sdk/content/type-aliases/TransactionRequest) for sending to the network by populating any missing properties:

* Resolves `to` and `from` addresses
* If `from` is specified , check that it matches this Signer
* Populates `nonce` via `signer.getNonce("pending")`
* Populates `gasLimit` via `signer.estimateGas(tx)`
* Populates `chainId` via `signer.provider.getNetwork()`
* Populates `type` and relevant fee data for that type (`gasPrice`)

#### Parameters

| Parameter | Type                                                                 | Description                 |
| :-------- | :------------------------------------------------------------------- | :-------------------------- |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) | The transaction to prepare. |

#### Returns

`Promise`\<[`TransactionLike`](/sdk/content/interfaces/TransactionLike)>

A promise resolving to the prepared transaction.

#### Throws

If the transaction is invalid.

#### Note

Some Signer implementations may skip populating properties that
are populated downstream; for example JsonRpcSigner defers to the
node to populate the nonce and fee data.

#### Source

[signers/signer.ts:84](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L84)

***

### sendTransaction()

```ts theme={null}
sendTransaction(tx): Promise<TransactionResponse>
```

Sends `tx` to the Network. The `signer.populateTransaction(tx)` is called first to ensure all necessary
properties for the transaction to be valid have been popualted first.

#### Parameters

| Parameter | Type                                                                 | Description              |
| :-------- | :------------------------------------------------------------------- | :----------------------- |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) | The transaction to send. |

#### Returns

`Promise`\<[`TransactionResponse`](/sdk/content/type-aliases/TransactionResponse)>

A promise resolving to the transaction response.

#### Overrides

`ContractRunner.sendTransaction`

#### Throws

If the transaction is invalid.

#### Source

[signers/signer.ts:147](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L147)

***

### signMessage()

```ts theme={null}
signMessage(message): Promise<string>
```

Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) prefixed personal message.

If the `message` is a string, it is signed as UTF-8 encoded bytes. It is **not** interpretted as a
[BytesLike](../type-aliases/BytesLike); so the string `"0x1234"` is signed as six characters, **not** two bytes.

To sign that example as two bytes, the Uint8Array should be used (i.e. `new Uint8Array([ 0x12, 0x34 ])`).

#### Parameters

| Parameter | Type                     | Description          |
| :-------- | :----------------------- | :------------------- |
| `message` | `string` \| `Uint8Array` | The message to sign. |

#### Returns

`Promise`\<`string`>

A promise resolving to the signed message.

#### Throws

If the message is invalid.

#### Source

[signers/signer.ts:161](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L161)

***

### signTransaction()

```ts theme={null}
signTransaction(tx): Promise<string>
```

Signs `tx`, returning the fully signed transaction. This does not populate any additional properties within the
transaction.

#### Parameters

| Parameter | Type                                                                 | Description              |
| :-------- | :------------------------------------------------------------------- | :----------------------- |
| `tx`      | [`TransactionRequest`](/sdk/content/type-aliases/TransactionRequest) | The transaction to sign. |

#### Returns

`Promise`\<`string`>

A promise resolving to the signed transaction.

#### Throws

If the transaction is invalid.

#### Source

[signers/signer.ts:137](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L137)

***

### signTypedData()

```ts theme={null}
signTypedData(
   domain, 
   types, 
value): Promise<string>
```

Signs the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data.

#### Parameters

| Parameter | Type                                                                               | Description                   |
| :-------- | :--------------------------------------------------------------------------------- | :---------------------------- |
| `domain`  | [`TypedDataDomain`](/sdk/content/interfaces/TypedDataDomain)                       | The domain of the typed data. |
| `types`   | `Record`\<`string`, [`TypedDataField`](/sdk/content/interfaces/TypedDataField)\[]> | The types of the typed data.  |
| `value`   | `Record`\<`string`, `any`>                                                         | The value of the typed data.  |

#### Returns

`Promise`\<`string`>

A promise resolving to the signed typed data.

#### Source

[signers/signer.ts:171](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/signers/signer.ts#L171)
