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

Extends

Constructors

new JsonRpcSigner()

new JsonRpcSigner(provider, address): JsonRpcSigner

Creates a new JsonRpcSigner instance.

Parameters

ParameterTypeDescription
providerJsonRpcApiProvider<any>The JSON-RPC provider.
addressstringThe address of the signer.

Returns

JsonRpcSigner

Overrides

AbstractSigner.constructor

Source

providers/provider-jsonrpc.ts:326

Properties

PropertyModifierTypeDescriptionInherited from
providerreadonlyJsonRpcApiProvider<FetchRequest>The provider this signer is connected to.AbstractSigner.provider

Methods

connect()

connect(provider): Signer

Connects the signer to a provider.

Parameters

ParameterTypeDescription
providernull | ProviderThe provider to connect to.

Returns

Signer

The connected signer.

Overrides

AbstractSigner.connect

Throws

If the signer cannot be reconnected.

Source

providers/provider-jsonrpc.ts:340


getAddress()

getAddress(): Promise<string>

Gets the address of the signer.

Returns

Promise<string>

The address of the signer.

Overrides

AbstractSigner.getAddress

Source

providers/provider-jsonrpc.ts:351


sendTransaction()

sendTransaction(tx): Promise<TransactionResponse>

Sends a transaction.

Parameters

ParameterTypeDescription
txTransactionRequestThe transaction request.

Returns

Promise<TransactionResponse>

The transaction response.

Overrides

AbstractSigner.sendTransaction

Throws

If the transaction cannot be sent.

Source

providers/provider-jsonrpc.ts:436


signMessage()

signMessage(_message): Promise<string>

Signs a message.

Parameters

ParameterTypeDescription
_messagestring | Uint8ArrayThe message to sign.

Returns

Promise<string>

The signed message.

Overrides

AbstractSigner.signMessage

Source

providers/provider-jsonrpc.ts:549


signTransaction()

signTransaction(_tx): Promise<string>

Signs a transaction.

Parameters

ParameterTypeDescription
_txTransactionRequestThe transaction request.

Returns

Promise<string>

The signed transaction.

Overrides

AbstractSigner.signTransaction

Throws

If the transaction cannot be signed.

Source

providers/provider-jsonrpc.ts:519


signTypedData()

signTypedData(
   domain, 
   types, 
_value): Promise<string>

Signs typed data.

Parameters

ParameterTypeDescription
domainTypedDataDomainThe domain of the typed data.
typesRecord<string, TypedDataField[]>The types of the typed data.
_valueRecord<string, any>The value of the typed data.

Returns

Promise<string>

The signed typed data.

Overrides

AbstractSigner.signTypedData

Source

providers/provider-jsonrpc.ts:562


unlock()

unlock(password): Promise<boolean>

Unlocks the account.

Parameters

ParameterTypeDescription
passwordstringThe password to unlock the account.

Returns

Promise<boolean>

True if the account is unlocked, false otherwise.

Source

providers/provider-jsonrpc.ts:581