Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • AccountApi

Index

Constructors

constructor

Properties

Private api

Methods

countAll

  • countAll(): Promise<Long>
  • Get the total number of accounts registered on the blockchain.

    Returns Promise<Long>

create

  • Create a new account.

    Parameters

    • registrar: Credentials

      credentials used to register the new account

    • name: string

      new account name

    • address: Address

      new account public key address

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<TransactionConfirmation>

    a transaction confirmation

createAccountOperation

  • Create a register new account operation.

    Parameters

    • registrar: ChainObject

      credentials used to register the new account

    • name: string

      new account name

    • address: Address

      new account public key address

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<AccountCreateOperation>

    a transaction confirmation

createCredentials

  • createCredentials(accountName: string, privateKey: string): Promise<Credentials>
  • Create API credentials.

    Parameters

    • accountName: string

      account name

    • privateKey: string

      private key in wif base58 format, eg. 5Jd7zdvxXYNdUfnEXt5XokrE3zwJSs734yQ36a1YaqioRTGGLtn

    Returns Promise<Credentials>

    credentials

createMemo

  • Create a memo. Can be used in TransferOperation or AssetIssueOperation

    Parameters

    • message: string

      text message to send

    • Optional recipient: AccountRef

      account name or id, mandatory for encrypted message

    • Optional keyPair: ECKeyPair

      sender's key pair, mandatory for encrypted message

    Returns Promise<Memo>

createTransfer

  • Create a transfer operation.

    Parameters

    • credentials: Credentials

      account credentials

    • account: AccountRef

      account id or account name

    • amount: AssetAmount

      amount to send with asset type

    • Optional memo: undefined | string

      optional message

    • Default value encrypted: boolean = true

      encrypted is visible only for sender and receiver, unencrypted is visible publicly

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<TransferOperation>

    a transaction confirmation

createUpdateOperation

  • Create update account operation. Fills model with actual account values.

    Parameters

    • account: AccountRef

      account id or name

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<AccountUpdateOperation>

exist

  • Check if the account exist.

    Parameters

    Returns Promise<boolean>

    account exists in DCore database

findAll

  • Get registered accounts that match search term.

    Parameters

    • searchTerm: string

      will try to partially match account name or id

    • Default value order: SearchAccountsOrder = SearchAccountsOrder.NameDesc

      sort data by field

    • Default value id: ChainObject = ObjectType.Null.genericId()

      object id to start searching from

    • Default value limit: number = 1000

      number of items to get, max 1000

    Returns Promise<Account[]>

    list of found accounts

findAllReferencesByAccount

  • Get all accounts that refer to the account id in their owner or active authorities.

    Parameters

    Returns Promise<ChainObject[]>

    a list of account object ids

findAllReferencesByKeys

  • Get account object ids by public key addresses.

    Parameters

    • keys: Address[]

      formatted public keys of the account, eg. DCT5j2bMj7XVWLxUW7AXeMiYPambYFZfCcMroXDvbCfX1VoswcZG4

    Returns Promise<ChainObject[][]>

    a list of account object ids

get

getAll

  • Get account objects by ids.

    Parameters

    • accountIds: ChainObject[]

      object ids of the account, 1.2.*

    Returns Promise<Account[]>

    an account list if found, ObjectNotFoundError otherwise

getAllByNames

  • getAllByNames(names: string[]): Promise<Account[]>
  • Get a list of accounts by name.

    Parameters

    • names: string[]

      account names to retrieve

    Returns Promise<Account[]>

    list of accounts or ObjectNotFoundError if none exist

getByName

  • getByName(name: string): Promise<Account>
  • Get account object by name.

    Parameters

    • name: string

      the name of the account

    Returns Promise<Account>

    an account if found, ObjectNotFoundError otherwise

getFullAccounts

  • getFullAccounts(namesOrIds: string[], subscribe?: boolean): Promise<Map<string, FullAccount>>
  • Fetch all objects relevant to the specified accounts and subscribe to updates.

    Parameters

    • namesOrIds: string[]

      list of account names or ids

    • Default value subscribe: boolean = false

      true to subscribe to updates

    Returns Promise<Map<string, FullAccount>>

    map of names or ids to account, or empty map if not present

getStatistics

listAllRelative

  • listAllRelative(lowerBound: string, limit?: number): Promise<Map<string, ChainObject>>
  • Get names and IDs for registered accounts.

    Parameters

    • lowerBound: string

      lower bound of the first name to return

    • Default value limit: number = 1000

      number of items to get, max 1000

    Returns Promise<Map<string, ChainObject>>

    map of account names to corresponding IDs

transfer

  • Make a transfer.

    Parameters

    • credentials: Credentials

      account credentials

    • account: AccountRef

      account id or account name

    • amount: AssetAmount

      amount to send with asset type

    • Optional memo: undefined | string

      optional message

    • Default value encrypted: boolean = true

      encrypted is visible only for sender and receiver, unencrypted is visible publicly

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<TransactionConfirmation>

    a transaction confirmation

update

  • Update account.

    Parameters

    • credentials: Credentials

      account credentials

    • Optional options: AccountOptions

      new account options

    • Optional active: Authority

      new active authority

    • Optional owner: Authority

      new owner authority

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<TransactionConfirmation>

Generated using TypeDoc