Options
All
  • Public
  • Public/Protected
  • All
Menu

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

  • new AccountIndex(contractAddress: string, signerAddress?: string): AccountIndex
  • 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

The instance of the account registry contract.

contractAddress

contractAddress: string

The deployed account registry contract's address.

signerAddress

signerAddress: string

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

Methods

addToAccountRegistry

  • addToAccountRegistry(address: string): Promise<boolean>
  • 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>
  • 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[]>
  • 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>
  • 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