注意: 此页面尚未翻译成中文。以下内容为英文原版。A signer that uses JSON-RPC to sign transactions and messages.
Extends
Constructors
new JsonRpcSigner()
Parameters
| Parameter | Type | Description |
|---|---|---|
provider | JsonRpcApiProvider<any> | The JSON-RPC provider. |
address | string | The address of the signer. |
Returns
JsonRpcSigner
Overrides
AbstractSigner.constructor
Source
providers/provider-jsonrpc.ts:328Properties
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
provider | readonly | JsonRpcApiProvider<FetchRequest> | The provider this signer is connected to. | AbstractSigner.provider |
Methods
connect()
Parameters
| Parameter | Type | Description |
|---|---|---|
provider | null | Provider | The provider to connect to. |
Returns
Signer
The connected signer.
Overrides
AbstractSigner.connect
Throws
If the signer cannot be reconnected.Source
providers/provider-jsonrpc.ts:342getAddress()
Returns
Promise<string>
The address of the signer.
Overrides
AbstractSigner.getAddress
Source
providers/provider-jsonrpc.ts:353sendTransaction()
Parameters
| Parameter | Type | Description |
|---|---|---|
tx | TransactionRequest | The transaction request. |
Returns
Promise<TransactionResponse>
The transaction response.
Overrides
AbstractSigner.sendTransaction
Throws
If the transaction cannot be sent.Source
providers/provider-jsonrpc.ts:438signMessage()
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:551signTransaction()
Parameters
| Parameter | Type | Description |
|---|---|---|
_tx | 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:521signTypedData()
Parameters
| Parameter | Type | Description |
|---|---|---|
domain | TypedDataDomain | The domain of the typed data. |
types | Record<string, 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:564unlock()
Parameters
| Parameter | Type | Description |
|---|---|---|
password | string | The password to unlock the account. |
Returns
Promise<boolean>
True if the account is unlocked, false otherwise.
