Options
All
  • Public
  • Public/Protected
  • All
Menu

API class provides wrapper for account information.

Hierarchy

  • AccountApi

Index

Constructors

constructor

  • new AccountApi(dbApi: Database, chainApi: ChainApi, historyApi: HistoryApi): AccountApi

Methods

getAccountById

  • getAccountById(id: string): Promise<Account>
  • Gets chain account for given Account id.

    Parameters

    • id: string

      example: "1.2.345"

    Returns Promise<Account>

getAccountByName

  • getAccountByName(name: string): Promise<Account>
  • Gets chain account for given Account name.

    Parameters

    • name: string

      example: "u123456789abcdef123456789"

    Returns Promise<Account>

getAccountHistory

  • getAccountHistory(accountId: string, resultLimit?: number): Promise<HistoryRecord[]>
  • List chain operations history list for given user Operations can be filtered using Chain.ChainOperationType

    Parameters

    • accountId: string

      Users account id, example: '1.2.30'

    • Default value resultLimit: number = 100

      Number of results to be returned, max value is 100

    Returns Promise<HistoryRecord[]>

    Return variable object types, based on operation in history record

getBalance

  • getBalance(accountId: string): Promise<number>
  • Current account balance of DCT asset on given account

    Parameters

    • accountId: string

      Account id, example: '1.2.345'

    Returns Promise<number>

getTransactionHistory

  • getTransactionHistory(accountId: string, privateKeys: string[], order?: string, startObjectId?: string, resultLimit?: number): Promise<TransactionRecord[]>
  • Gets transaction history for given Account name.

    deprecated

    This method will be removed since future DCore update. Use getAccountHistory instead

    Parameters

    • accountId: string

      example: "1.2.345"

    • privateKeys: string[]

      Array of private keys in case private/public pair has been changed to be able of decrypt older memo messages from transactions.

    • Default value order: string = SearchAccountHistoryOrder.timeDesc

      SearchAccountHistoryOrder class holds all available options. Default SearchParamsOrder.createdDesc

    • Default value startObjectId: string = "0.0.0"

      Id of object to start search from for paging purposes. Default 0.0.0

    • Default value resultLimit: number = 100

      Number of returned transaction history records for paging. Default 100(max)

    Returns Promise<TransactionRecord[]>

isTransactionConfirmed

  • isTransactionConfirmed(accountId: string, transactionId: string): Promise<boolean>
  • Determine if block with transaction is verified and irreversible. Unverified blocks still can be reversed.

    NOTICE: Transaction object with id in form '1.7.X' can be fetched from AccountApi.getAccountHistory(:) method.

    Parameters

    • accountId: string

      User's account id, example: '1.2.30'

    • transactionId: string

      Transaction id in format '1.7.X'.

    Returns Promise<boolean>

transfer

  • transfer(amount: number, fromAccount: string, toAccount: string, memo: string, privateKey: string): Promise<void>
  • Transfers exact amount of DCT between accounts with optional message for recipient

    Parameters

    • amount: number
    • fromAccount: string

      Name or id of account

    • toAccount: string

      Name or id of account

    • memo: string

      Message for recipient

    • privateKey: string

      Private key used to encrypt memo and sign transaction

    Returns Promise<void>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc