abstract Accounts class

### Hierarchy

- Accounts

## Index

### Methods

- addAccountFunctions
- create
- decrypt
- encrypt
- fromExtendedKey
- fromSeed
- getTransactionFee
- hashMessage
- recover
- recoverTransaction
- sign
- signTransaction

## Methods

### Static addAccountFunctions

- addAccountFunctions(account: Account): AccountObject

- - Defined in cs/accounts/index.ts:458

  #### Parameters

  - ##### account: Account

  #### Returns AccountObject

### Static create

- create(entropy?: string): AccountObject

- - Defined in cs/accounts/index.ts:28

  Create a account object by entropy

  ### Example

      Accounts.create(entropy)
      // => [Object Account]

  #### Parameters

  - ##### Optional entropy: string

    seed or extended key or mnemonic or null

  #### Returns AccountObject

  HD-Account

### Static decrypt

- decrypt(keystore: EncryptResult | string, password: string, nonStrict?: boolean): AccountObject

- - Defined in cs/accounts/index.ts:387

  Decrypt a keystore

  ### Example

      Accounts.decrypt(keystore, password)
      // => [Object Account]

  #### Parameters

  - ##### keystore: EncryptResult | string

  - ##### password: string

  - ##### Optional nonStrict: boolean

  #### Returns AccountObject

  account object

### Static encrypt

- encrypt(seed: string, password: string, options?: EncryptOptions): EncryptResult

- - Defined in cs/accounts/index.ts:281

  Encrypt a seed

  ### Example

      Accounts.encrypt(seed, password, options)
      // => {address: '...', ...}

  #### Parameters

  - ##### seed: string

    seed use to encrypt

  - ##### password: string

    password use to encrypt

  - ##### Default value options: EncryptOptions = {}

    some encrypt options

  #### Returns EncryptResult

  a encrypt result

### Static fromExtendedKey

- fromExtendedKey(extendedKey: string): AccountObject

- - Defined in cs/accounts/index.ts:56

  Return account object by mnemonic

  ### Example

      Accounts.fromExtendedKey('xprv9s21ZrQH143K4XtJWPuM421RYzNoQKGJi29eVSM2pHTj1wtM5dBbFwhJ5D7QHFaaQ8A7yY7THs43D2dwvZ5fYdbo9k4xzSqQUB1u6mxfe4m')
      // => [Object: Account]

  #### Parameters

  - ##### extendedKey: string

  #### Returns AccountObject

  HD-Account

### Static fromSeed

- fromSeed(seed: string): AccountObject

- - Defined in cs/accounts/index.ts:76

  Return account object by mnemonic

  ### Example

      Accounts.fromExtendedKey('0x1457fff042637cf08e36424a1ebcc8a185bb7a9b02e7899666ff3829fbea16f79d1156aea347e8ed9695d1f64c04ea30b1faf5cda9b27eb2bf3db7dca94fe318')
      // => [Object: Account]

  #### Parameters

  - ##### seed: string

    seed

  #### Returns AccountObject

  HD-Account

### Static getTransactionFee

- getTransactionFee(transactionData: TransactionData): string

- - Defined in cs/accounts/index.ts:108

  Get transaction fee

  #### Parameters

  - ##### transactionData: TransactionData

  #### Returns string

### Static hashMessage

- hashMessage(data: any): string

- - Defined in cs/accounts/index.ts:137

  Hash data

  ### Example

      Accounts.hashMessage('some data')
      => 0x3b9d51379da4f56cb55ca3e7f7ca92c8798b1d25abe0d6a6abab50b135e7794e

  #### Parameters

  - ##### data: any

    data used to hash

  #### Returns string

  the hash of the data

### Static recover

- recover(message: string, signature: string, prefixed?: boolean): string
- recover(message: string, v: string, r: string, s: string, prefixed?: boolean): string
- recover(sig: object): string

- - Defined in cs/accounts/index.ts:197

  Recover a address from signature and message

  ### Example

      Accounts.recover('Some data', '0x123476d36992bdef82362488eb00a154b52284cc0ccec330227f6d3b2b8d763d6d9e18d574a01d519024b91e4193d43fd94e806bc6b0c35941e36dd0a79f0b971c')
      // => 0xEB014f8c8B418Db6b45774c326A0E64C78914dC0

  #### Parameters

  - ##### message: string

  - ##### signature: string

  - ##### Optional prefixed: boolean

    whether to use already hash data to recover address

  #### Returns string

  a address

- - Defined in cs/accounts/index.ts:215

  Recover a address from v, r, s

  ### Example

      Accounts.recover('Some data', '0x1c', '0x123476d36992bdef82362488eb00a154b52284cc0ccec330227f6d3b2b8d763d', '0x6d9e18d574a01d519024b91e4193d43fd94e806bc6b0c35941e36dd0a79f0b97')
      // => 0xEB014f8c8B418Db6b45774c326A0E64C78914dC0

  #### Parameters

  - ##### message: string

  - ##### v: string

  - ##### r: string

  - ##### s: string

  - ##### Optional prefixed: boolean

    whether to use already hash data to recover address

  #### Returns string

  a address

- - Defined in cs/accounts/index.ts:235

  Recover a address from sig object

  ### Example

      Accounts.recover(sig)
      // => 0xEB014f8c8B418Db6b45774c326A0E64C78914dC0

  #### Parameters

  - ##### sig: object

    a signature object that have hash message and v, r ,s

  #### Returns string

  a address

### Static recoverTransaction

- recoverTransaction(raw: string): string

- - Defined in cs/accounts/index.ts:120

  Recover from a signed transaction

  #### Parameters

  - ##### raw: string

    transaction raw

  #### Returns string

### Static sign

- sign(data: any, privateKey: string, addToValue?: number): SignResult

- - Defined in cs/accounts/index.ts:166

  Use private key to sign an data

  ### Example

      Accounts.sign('Some data', '0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728')
      // => {
      // message: 'Some data',
      // messageHash: '0x3b9d51379da4f56cb55ca3e7f7ca92c8798b1d25abe0d6a6abab50b135e7794e',
      // r: '0x123476d36992bdef82362488eb00a154b52284cc0ccec330227f6d3b2b8d763d',
      // s: '0x6d9e18d574a01d519024b91e4193d43fd94e806bc6b0c35941e36dd0a79f0b97',
      // v: '0x1c',
      // signature: '0x123476d36992bdef82362488eb00a154b52284cc0ccec330227f6d3b2b8d763d6d9e18d574a01d519024b91e4193d43fd94e806bc6b0c35941e36dd0a79f0b971c'
      // }

  #### Parameters

  - ##### data: any

    data used to sign

  - ##### privateKey: string

    private key

  - ##### Optional addToValue: number

  #### Returns SignResult

  a sign result

### Static signTransaction

- signTransaction(transactionData: TransactionData, privateKey: string, chainId?: string): SignedTransactionResult

- - Defined in cs/accounts/index.ts:91

  Sign an transaction

  #### Parameters

  - ##### transactionData: TransactionData

  - ##### privateKey: string

  - ##### Optional chainId: string

  #### Returns SignedTransactionResult

Generated using TypeDoc