Skip to main content

Class: Signer

Represents a remote signer.

Hierarchy

Implements

  • OfflineDirectSigner
  • OfflineAminoSigner

Constructors

constructor

new Signer(status): Signer

Builds a new Signer instance.

Parameters

NameTypeDescription
statusSignerStatusInitial signer status.

Returns

Signer

Defined in

packages/core/src/signers/signer.ts:53

Properties

observerManager

Private observerManager: ObserverManager<SignerStatus>

Defined in

packages/core/src/signers/signer.ts:46


signerStatus

Private signerStatus: SignerStatus

Defined in

packages/core/src/signers/signer.ts:44

Accessors

isConnected

get isConnected(): boolean

Tells whether the signer is connected or not.

Returns

boolean

Defined in

packages/core/src/signers/signer.ts:104


signingMode

get signingMode(): SigningMode

Returns the signing mode supported by the signer.

Returns

SigningMode

Defined in

packages/core/src/signers/signer.ts:111


status

get status(): SignerStatus

Gets the current signer status.

Returns

SignerStatus

Defined in

packages/core/src/signers/signer.ts:97

Methods

addStatusListener

addStatusListener(observer): void

Adds an observer that will be called each time the signer changes state.

Parameters

NameTypeDescription
observerSignerObserverThe observer to be called.

Returns

void

Defined in

packages/core/src/signers/signer.ts:82


assertConnected

assertConnected(): void

Checks if the signer is connected and if not throws a SignerNotConnected exception.

Returns

void

Defined in

packages/core/src/signers/signer.ts:72


connect

connect(): Promise<void>

Connects the signer. If the signer is already connected no actions will be performed.

Returns

Promise<void>

Defined in

packages/core/src/signers/signer.ts:117


disconnect

disconnect(): Promise<void>

Disconnect the signer. If the signer is already disconnect no actions will be performed.

Returns

Promise<void>

Defined in

packages/core/src/signers/signer.ts:123


getAccounts

getAccounts(): Promise<readonly AccountData[]>

Gets all the accounts managed by the signer.

NOTE: In some signer implementations, this method might execute asynchronously. This means the returned promise might never complete.

Returns

Promise<readonly AccountData[]>

Implementation of

OfflineDirectSigner.getAccounts

Defined in

packages/core/src/signers/signer.ts:137


getCurrentAccount

getCurrentAccount(): Promise<undefined | AccountData>

Gets the account selected by the user as the account to be used, or undefined if no account has been selected yet.

Returns

Promise<undefined | AccountData>

Defined in

packages/core/src/signers/signer.ts:129


removeStatusListener

removeStatusListener(observer): void

Removes an observer so that it will not be called when the status changes.

Parameters

NameTypeDescription
observerSignerObserverThe observer to be removed.

Returns

void

Defined in

packages/core/src/signers/signer.ts:90


signAmino

signAmino(signerAddress, signDoc): Promise<AminoSignResponse>

Implements OfflineAminoSigner.

Parameters

NameType
signerAddressstring
signDocStdSignDoc

Returns

Promise<AminoSignResponse>

Implementation of

OfflineAminoSigner.signAmino

Defined in

packages/core/src/signers/signer.ts:150


signDirect

signDirect(signerAddress, signDoc): Promise<DirectSignResponse>

Implements OfflineDirectSigner.

Parameters

NameType
signerAddressstring
signDocSignDoc

Returns

Promise<DirectSignResponse>

Implementation of

OfflineDirectSigner.signDirect

Defined in

packages/core/src/signers/signer.ts:142


updateStatus

updateStatus(newStatus): void

Updates the signer status and notifies the observers.

Parameters

NameTypeDescription
newStatusSignerStatusThe new signer status.

Returns

void

Defined in

packages/core/src/signers/signer.ts:63