Class: OfflineSignerAdapter
Adapter class to use a CosmJS OfflineSigner instance as a Signer instance.
Hierarchy
↳
OfflineSignerAdapter
Constructors
constructor
• new OfflineSignerAdapter(signer
): OfflineSignerAdapter
Parameters
Name | Type |
---|---|
signer | OfflineSigner |
Returns
Overrides
Defined in
packages/core/src/signers/adapter.ts:41
Properties
_signMode
• Private
Readonly
_signMode: undefined
| SigningMode
Defined in
packages/core/src/signers/adapter.ts:39
signer
• Private
Readonly
signer: OfflineSigner
Defined in
packages/core/src/signers/adapter.ts:37
Accessors
isConnected
• get
isConnected(): boolean
Tells whether the signer is connected or not.
Returns
boolean
Inherited from
Signer.isConnected
Defined in
packages/core/src/signers/signer.ts:104
signingMode
• get
signingMode(): SigningMode
Returns the signing mode supported by the signer.
Returns
Overrides
Signer.signingMode
Defined in
packages/core/src/signers/adapter.ts:89
status
• get
status(): SignerStatus
Gets the current signer status.
Returns
Inherited from
Signer.status
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
Name | Type | Description |
---|---|---|
observer | SignerObserver | The observer to be called. |
Returns
void
Inherited from
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
Inherited from
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
>
Overrides
Defined in
packages/core/src/signers/adapter.ts:94
disconnect
▸ disconnect(): Promise
<void
>
Disconnect the signer. If the signer is already disconnect no actions will be performed.
Returns
Promise
<void
>
Overrides
Defined in
packages/core/src/signers/adapter.ts:100
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
[]>
Overrides
Defined in
packages/core/src/signers/adapter.ts:79
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
>
Overrides
Defined in
packages/core/src/signers/adapter.ts:83
removeStatusListener
▸ removeStatusListener(observer
): void
Removes an observer so that it will not be called when the status changes.
Parameters
Name | Type | Description |
---|---|---|
observer | SignerObserver | The observer to be removed. |
Returns
void
Inherited from
Defined in
packages/core/src/signers/signer.ts:90
signAmino
▸ signAmino(signerAddress
, signDoc
): Promise
<AminoSignResponse
>
Implements OfflineAminoSigner.
Parameters
Name | Type |
---|---|
signerAddress | string |
signDoc | StdSignDoc |
Returns
Promise
<AminoSignResponse
>
Overrides
Defined in
packages/core/src/signers/adapter.ts:65
signDirect
▸ signDirect(signerAddress
, signDoc
): Promise
<DirectSignResponse
>
Implements OfflineDirectSigner.
Parameters
Name | Type |
---|---|
signerAddress | string |
signDoc | SignDoc |
Returns
Promise
<DirectSignResponse
>
Overrides
Defined in
packages/core/src/signers/adapter.ts:51
updateStatus
▸ updateStatus(newStatus
): void
Updates the signer status and notifies the observers.
Parameters
Name | Type | Description |
---|---|---|
newStatus | SignerStatus | The new signer status. |
Returns
void
Inherited from
Defined in
packages/core/src/signers/signer.ts:63
fromMnemonic
▸ fromMnemonic(mode
, mnemonic
, options?
): Promise
<OfflineSignerAdapter
>
Create a signer from the given BIP39 mnemonic.
Parameters
Name | Type | Description |
---|---|---|
mode | SigningMode | The sign mode supported from the signer. |
mnemonic | string | Any valid English mnemonic. |
options? | Partial <OfflineSignerConfig > | An optional OfflineSignerConfig object optionally containing an HD path and prefix. |
Returns
Promise
<OfflineSignerAdapter
>
Defined in
packages/core/src/signers/adapter.ts:112
generate
▸ generate(mode
, length?
, options?
): Promise
<OfflineSignerAdapter
>
Generates a new wallet with a BIP39 mnemonic of the given length.
Parameters
Name | Type | Description |
---|---|---|
mode | SigningMode | The sign mode supported from the signer. |
length? | 12 | 15 | 18 | 21 | 24 | The number of words in the mnemonic (12, 15, 18, 21 or 24). |
options? | Partial <OfflineSignerConfig > | An optional OfflineSignerConfig object optionally containing an HD path and prefix. |
Returns
Promise
<OfflineSignerAdapter
>