Home Reference Source Test
public class | source

PKWallet

Extends:

Wallet → PKWallet

libsimba-js Private Key Wallet implementation Use when you already have access to the decrypted private key Wraps the [ethersjs]https://docs.ethers.io/ethers.js/html/ library.

Constructor Summary

Public Constructor
public

constructor(private_key: string, signingConfirmation: function)

Use when you already have access to the decrypted private key

Member Summary

Public Members
public

pk: *

public

wallet: *

Method Summary

Public Methods
public
public

generateWallet(passkey: string, progressCB: function): Promise

public
public

getEncryptedJson(passkey: string, progressCB: function): Promise<string>

public

The mnemonic phrase for this wallet, or null if the mnemonic is unknown.

public

unlockWallet(passkey: string, progressCB: function): Promise

public
Protected Methods
protected

sign(payload: Object): Promise<string>

Private Methods
private

Inherited Summary

From class Wallet
public
public abstract
public abstract
public abstract
public abstract
public abstract
protected abstract

sign(payload: Object): Promise<string>

Public Constructors

public constructor(private_key: string, signingConfirmation: function) source

Use when you already have access to the decrypted private key

Override:

Wallet#constructor

Params:

NameTypeAttributeDescription
private_key string
  • optional

The private key in hexidecimal format

signingConfirmation function
  • optional
  • an optional callback for requesting user permission to sign a transaction. Should resolve a promise with true for accept, and false (or reject) for reject.

Public Members

public pk: * source

public wallet: * source

Public Methods

public deleteWallet() source

Override:

Wallet#deleteWallet

public generateWallet(passkey: string, progressCB: function): Promise source

Override:

Wallet#generateWallet

Params:

NameTypeAttributeDescription
passkey string

The pass key to lock the wallet

progressCB function
  • optional

A callback, accepting a number between 0-1, indicating decryption progress

Return:

Promise

Returns a promise resolving with the private key when the wallet is created

public getAddress(): Promise<string> source

Override:

Wallet#getAddress

Return:

Promise<string>

Returns a promise resolving to the wallets address

public getEncryptedJson(passkey: string, progressCB: function): Promise<string> source

Params:

NameTypeAttributeDescription
passkey string

Passkey to encrypt the wallet

progressCB function
  • optional

An optional callback to monitor progress of encryption, calls with a value between 0-1

Return:

Promise<string>

A promise that resolves with the JSON wallet

public getMnemonic(): string source

The mnemonic phrase for this wallet, or null if the mnemonic is unknown.

Return:

string

The mnemonic phrase for this wallet, or null if the mnemonic is unknown.

public unlockWallet(passkey: string, progressCB: function): Promise source

Override:

Wallet#unlockWallet

Params:

NameTypeAttributeDescription
passkey string

The pass key to unlock the wallet

progressCB function
  • optional

A callback, accepting a number between 0-1, indicating decryption progress

Return:

Promise

Returns a promise resolving when the wallet is unlocked

public walletExists(): boolean source

Override:

Wallet#walletExists

Return:

boolean

does the wallet exist

Protected Methods

protected sign(payload: Object): Promise<string> source

Override:

Wallet#sign

Params:

NameTypeAttributeDescription
payload Object

The transaction to sign

Return:

Promise<string>

Returns a promise resolving to the signed transaction

Private Methods

private cleanPayload(payload: Object): string source

Params:

NameTypeAttributeDescription
payload Object

The transaction to clean

Return:

string

The cleaned transaction