All files / src liskWallet.ts

100% Statements 14/14
83.33% Branches 5/6
100% Functions 4/4
100% Lines 12/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x           1x   1520x 608x           1x 101x 101x   101x           1x 101x     1x  
import {deriveDPOSAddress} from './utils/dposUtils';
import {GenericWallet} from './wallet';
 
/**
 * Lisk Wallet.
 * you can use this wallet class to instantiate other coins wallets such as RISE,SHIFT,OXY etc.
 */
export class LiskWallet extends GenericWallet {
 
  constructor(secret: string, private suffix: string = 'L') {
    super(secret);
  }
 
  /**
   * @returns {string} derived address.
   */
  get address() {
    Eif (typeof(this._address) === 'undefined') {
      this.deriveAddress();
    }
    return this._address;
  }
 
  /**
   * calculates the address from publicKey.
   */
  protected deriveAddress() {
    this._address = deriveDPOSAddress(this.publicKey, this.suffix);
  }
 
}