# AccountIndex | CICADA
Documentation for CICADA

Provides an instance of the accounts registry contract. Allows querying of accounts that have been registered as valid accounts in the network.

remarks

  This is our interface to the accounts registry contract.

### Hierarchy

- AccountIndex

## Index

### Constructors

- constructor

### Properties

- contract
- contractAddress
- signerAddress

### Methods

- addToAccountRegistry
- haveAccount
- last
- totalAccounts

## Constructors

### constructor

- new AccountIndex(contractAddress: string, signerAddress?: string): AccountIndex

- - Defined in src/app/_eth/accountIndex.ts:26

  Create a connection to the deployed account registry contract.

  #### Parameters

  - ##### contractAddress: string

    The deployed account registry contract's address.

  - ##### Optional signerAddress: string

    The account address of the account that deployed the account registry contract.

  #### Returns AccountIndex

## Properties

### contract

contract: any

- Defined in src/app/_eth/accountIndex.ts:22

The instance of the account registry contract.

### contractAddress

contractAddress: string

- Defined in src/app/_eth/accountIndex.ts:24

The deployed account registry contract's address.

### signerAddress

signerAddress: string

- Defined in src/app/_eth/accountIndex.ts:26

The account address of the account that deployed the account registry contract.

## Methods

### addToAccountRegistry

- addToAccountRegistry(address: string): Promise<boolean>

- - Defined in src/app/_eth/accountIndex.ts:58

  Registers an account to the accounts registry. Requires availability of the signer address.

  async
  example

    Prints "true" for registration of '0xc0ffee254729296a45a3885639AC7E10F9d54979':

        console.log(await addToAccountRegistry('0xc0ffee254729296a45a3885639AC7E10F9d54979'));

  #### Parameters

  - ##### address: string

    The account address to be registered to the accounts registry contract.

  #### Returns Promise<boolean>

  true - If registration is successful or account had already been registered.

### haveAccount

- haveAccount(address: string): Promise<boolean>

- - Defined in src/app/_eth/accountIndex.ts:79

  Checks whether a specific account address has been registered in the accounts registry. Returns "true" for available and "false" otherwise.

  async
  example

    Prints "true" or "false" depending on whether '0xc0ffee254729296a45a3885639AC7E10F9d54979' has been registered:

        console.log(await haveAccount('0xc0ffee254729296a45a3885639AC7E10F9d54979'));

  #### Parameters

  - ##### address: string

    The account address to be validated.

  #### Returns Promise<boolean>

  true - If the address has been registered in the accounts registry.

### last

- last(numberOfAccounts: number): Promise<string[]>

- - Defined in src/app/_eth/accountIndex.ts:96

  Returns a specified number of the most recently registered accounts.

  async
  example

    Prints an array of accounts:

        console.log(await last(5));

  #### Parameters

  - ##### numberOfAccounts: number

    The number of accounts to return from the accounts registry.

  #### Returns Promise<string[]>

  An array of registered account addresses.

### totalAccounts

- totalAccounts(): Promise<number>

- - Defined in src/app/_eth/accountIndex.ts:122

  Returns the total number of accounts that have been registered in the network.

  async
  example

    Prints the total number of registered accounts:

        console.log(await totalAccounts());

  #### Returns Promise<number>

  The total number of registered accounts.

Generated using TypeDoc