Class: PrivateKeySigner
Signer that uses a private key provided from a PrivateKeyProvider to sign a transaction.
Hierarchy
↳
PrivateKeySigner
Constructors
constructor
• new PrivateKeySigner(provider
, signingMode
, options?
): PrivateKeySigner
Parameters
Name | Type |
---|---|
provider | PrivateKeyProvider |
signingMode | SigningMode |
options? | PrivateKeySignerOptions |
Returns
Overrides
Defined in
packages/core/src/signers/privatekey.ts:221
Properties
_privateKey
• Private
Optional
_privateKey: PrivateKey
Defined in
packages/core/src/signers/privatekey.ts:185
aminoSigner
• Private
Optional
aminoSigner: Secp256k1Wallet
Defined in
packages/core/src/signers/privatekey.ts:187
currentAccount
• Private
Optional
currentAccount: AccountData
Defined in
packages/core/src/signers/privatekey.ts:183
directSigner
• Private
Optional
directSigner: DirectSecp256k1Wallet
Defined in
packages/core/src/signers/privatekey.ts:189
keyProvider
• Private
keyProvider: PrivateKeyProvider
Defined in
packages/core/src/signers/privatekey.ts:177
keyProviderStatusListener
• Private
keyProviderStatusListener: Observer
<PrivateKeyProviderStatus
>
Defined in
packages/core/src/signers/privatekey.ts:159
prefix
• Private
Readonly
prefix: string
Defined in
packages/core/src/signers/privatekey.ts:181
signMode
• Private
Readonly
signMode: SigningMode
Defined in
packages/core/src/signers/privatekey.ts:179
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
privateKey
• get
privateKey(): PrivateKey
Returns
Defined in
packages/core/src/signers/privatekey.ts:340
signingMode
• get
signingMode(): SigningMode
Returns the signing mode supported by the signer.
Returns
Overrides
Signer.signingMode
Defined in
packages/core/src/signers/privatekey.ts:336
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
clearSessionFields
▸ clearSessionFields(): void
Returns
void
Defined in
packages/core/src/signers/privatekey.ts:233
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/privatekey.ts:240
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/privatekey.ts:281
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/privatekey.ts:295
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/privatekey.ts:304
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/privatekey.ts:310
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/privatekey.ts:323
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
fromSecp256k1
▸ fromSecp256k1(privateKey
, signingMode
, options?
): PrivateKeySigner
Build the signer from a secp256k1 private key.
Parameters
Name | Type | Description |
---|---|---|
privateKey | string | Uint8Array | Hex encoded private key, or raw private key bytes. |
signingMode | SigningMode | Hex encoded private key, or raw private key bytes. |
options? | PrivateKeySignerOptions | Signer options. |
Returns
Defined in
packages/core/src/signers/privatekey.ts:197
generate
▸ generate(signMode
, options?
): PrivateKeySigner
Build the signer with a randomly generated secp256k1 private key.
Parameters
Name | Type | Description |
---|---|---|
signMode | SigningMode | - |
options? | PrivateKeySignerOptions | Signer options. |
Returns
Defined in
packages/core/src/signers/privatekey.ts:215
keyProviderStatusToSignerStatus
▸ keyProviderStatusToSignerStatus(status
): SignerStatus
Parameters
Name | Type |
---|---|
status | PrivateKeyProviderStatus |