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

# JsonRpcSigner

> **注意**: 此页面尚未翻译成中文。以下内容为英文原版。

A signer that uses JSON-RPC to sign transactions and messages.

## Extends

* [`AbstractSigner`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner)\<[`JsonRpcApiProvider`](https://docs.qu.ai/cn/sdk/content/classes/JsonRpcApiProvider)>

## Constructors

### new JsonRpcSigner()

```ts theme={null}
new JsonRpcSigner(provider, address): JsonRpcSigner
```

Creates a new JsonRpcSigner instance.

#### Parameters

| Parameter | Type | Description |
| :- | :- | :- |
| `provider` | [`JsonRpcApiProvider`](https://docs.qu.ai/cn/sdk/content/classes/JsonRpcApiProvider)\<`any`> | The JSON-RPC provider. |
| `address` | `string` | The address of the signer. |

#### Returns

[`JsonRpcSigner`](https://docs.qu.ai/cn/sdk/content/classes/JsonRpcSigner)

#### Overrides

[`AbstractSigner`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner).[`constructor`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner#constructors)

#### Source

[providers/provider-jsonrpc.ts:328](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L328)

## Properties

| Property | Modifier | Type | Description | Inherited from |
| :- | :- | :- | :- | :- |
| `provider` | `readonly` | [`JsonRpcApiProvider`](https://docs.qu.ai/cn/sdk/content/classes/JsonRpcApiProvider)\<[`FetchRequest`](https://docs.qu.ai/cn/sdk/content/classes/FetchRequest)> | The provider this signer is connected to. | [`AbstractSigner`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner).`provider` |

## Methods

### connect()

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

Connects the signer to a provider.

#### Parameters

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

#### Returns

[`Signer`](https://docs.qu.ai/cn/sdk/content/interfaces/Signer)

The connected signer.

#### Overrides

[`AbstractSigner`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner).[`connect`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner#connect)

#### Throws

If the signer cannot be reconnected.

#### Source

[providers/provider-jsonrpc.ts:342](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L342)

***

### getAddress()

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

Gets the address of the signer.

#### Returns

`Promise`\<`string`>

The address of the signer.

#### Overrides

[`AbstractSigner`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner).[`getAddress`](https://docs.qu.ai/cn/sdk/content/classes/AbstractSigner#getaddress)

#### Source

[providers/provider-jsonrpc.ts:353](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L353)

***

### sendTransaction()

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

Sends a transaction.

#### Parameters

| Parameter | Type | Description |
| :- | :- | :- |
| `tx` | [`TransactionRequest`](https://docs.qu.ai/cn/sdk/content/type-aliases/TransactionRequest) | The transaction request. |

#### Returns

`Promise`\<[`TransactionResponse`](https://docs.qu.ai/cn/sdk/content/type-aliases/TransactionResponse)>

The transaction response.

#### Overrides

`AbstractSigner.sendTransaction`

#### Throws

If the transaction cannot be sent.

#### Source

[providers/provider-jsonrpc.ts:438](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L438)

***

### signMessage()

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

Signs a message.

#### Parameters

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

#### Returns

`Promise`\<`string`>

The signed message.

#### Overrides

`AbstractSigner.signMessage`

#### Source

[providers/provider-jsonrpc.ts:551](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L551)

***

### signTransaction()

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

Signs a transaction.

#### Parameters

| Parameter | Type | Description |
| :- | :- | :- |
| `_tx` | [`TransactionRequest`](https://docs.qu.ai/cn/sdk/content/type-aliases/TransactionRequest) | The transaction request. |

#### Returns

`Promise`\<`string`>

The signed transaction.

#### Overrides

`AbstractSigner.signTransaction`

#### Throws

If the transaction cannot be signed.

#### Source

[providers/provider-jsonrpc.ts:521](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L521)

***

### signTypedData()

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

Signs typed data.

#### Parameters

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

#### Returns

`Promise`\<`string`>

The signed typed data.

#### Overrides

`AbstractSigner.signTypedData`

#### Source

[providers/provider-jsonrpc.ts:564](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L564)

***

### unlock()

```ts theme={null}
unlock(password): Promise<boolean>
```

Unlocks the account.

#### Parameters

| Parameter | Type | Description |
| :- | :- | :- |
| `password` | `string` | The password to unlock the account. |

#### Returns

`Promise`\<`boolean`>

True if the account is unlocked, false otherwise.

#### Source

[providers/provider-jsonrpc.ts:583](https://github.com/dominant-strategies/quais.js/blob/c1c12d43f9d34c6baad2b0542bd6d0acd6fefcbf/src/providers/provider-jsonrpc.ts#L583)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.