text: /* @flow */
  
  import GenericWallet from '@colony/purser-core/genericWallet';
  import { userInputValidator } from '@colony/purser-core/helpers';
  import { DESCRIPTORS, REQUIRED_PROPS } from '@colony/purser-core/defaults';
  import { TYPE_HARDWARE, SUBTYPE_LEDGER } from '@colony/purser-core/types';
  import type {
    GenericClassArgumentsType,
    TransactionObjectType,
  } from '@colony/purser-core/flowtypes';
  
  import { signTransaction, signMessage, verifyMessage } from './staticMethods';
  
  const { WALLET_PROPS } = DESCRIPTORS;
  
  export default class LedgerWallet extends GenericWallet {
    constructor(propObject: GenericClassArgumentsType) {
      super(propObject);
      Object.defineProperties(this, {
        /*
         * Set the actual type and subtype (overwrite the generic ones)
         */
        type: { value: TYPE_HARDWARE, ...WALLET_PROPS},
        subtype: { value: SUBTYPE_LEDGER, ...WALLET_PROPS},
        sign: {
          
          value: async (transactionObject: TransactionObjectType) => {
              /*
               * Validate the trasaction's object input
               */
              userInputValidator({
                firstArgument: transactionObject,
              });
              const { chainId = this.chainId } = transactionObject || {};
              return signTransaction(
                { ...transactionObject, derivationPath: await this.derivationPath,
                  chainId,},
              );
            },
          ...WALLET_PROPS,
        },
        signMessage: {
          
          value: async (messageObject: Object = {}) => {
              /*
               * Validate the trasaction's object input
               */
              userInputValidator({
                firstArgument: messageObject,
                requiredOr: REQUIRED_PROPS.SIGN_MESSAGE,
              });
              return signMessage({
                derivationPath: await this.derivationPath,
                message: messageObject.message,
                messageData: messageObject.messageData,
              });
            },
          ...WALLET_PROPS,
        },
        verifyMessage: {
          
          value: async (signatureVerificationObject: Object = {}) => {
              /*
               * Validate the trasaction's object input
               */
              userInputValidator({
                firstArgument: signatureVerificationObject,
                requiredAll: REQUIRED_PROPS.VERIFY_MESSAGE,
              });
              const { message, signature } = signatureVerificationObject;
              return verifyMessage({
                publicKey: await this.publicKey,
                message,
                signature,
              });
            },
          ...WALLET_PROPS,
        },
      });
    }
  }
  