Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Account

Hierarchy

Index

Constructors

constructor

  • Parameters

    • Default value options: AccountOptions = {label: null,address: null,publicKey: null,balance: '0',pendingBalance: '0',wallet: null,chain: [],receiveChain: [],pendingChain: [],version: 1}

    Returns Account

Properties

Private _address

_address: string

Private _balance

_balance: string

Private _chain

_chain: Request[]

Private _label

_label: string

Private _pendingBalance

_pendingBalance: string

Private _pendingChain

_pendingChain: Request[]

Private _previous

_previous: string

Private _publicKey

_publicKey: string

Private _receiveChain

_receiveChain: Request[]

Private _sequence

_sequence: number

Private _synced

_synced: boolean

Private _version

_version: number

Private _wallet

_wallet: Wallet

Accessors

address

  • get address(): string
  • The address of the account

    type

    {string}

    readonly

    Returns string

balance

  • get balance(): string
  • set balance(amount: string): void
  • The balance of the account in reason

    type

    {string}

    Returns string

  • The balance of the account in reason

    Parameters

    • amount: string

    Returns void

balanceInLogos

  • get balanceInLogos(): string
  • Return the balance of the account in Logos

    readonly

    Returns string

chain

label

  • get label(): string
  • set label(label: string): void

pendingBalance

  • get pendingBalance(): string
  • set pendingBalance(amount: string): void
  • The pending balance of the account in reason

    pending balance is balance minus the sends that are pending

    type

    {string}

    readonly

    Returns string

  • The pending balance of the account in reason

    pending balance is balance minus the sends that are pending

    Parameters

    • amount: string

    Returns void

pendingChain

  • get pendingChain(): Request[]
  • set pendingChain(val: Request[]): void
  • array of pending requests on the account

    These requests have been sent for consensus but we haven't heard back on if they are confirmed yet.

    type

    {Request[]}

    Returns Request[]

  • array of pending requests on the account

    These requests have been sent for consensus but we haven't heard back on if they are confirmed yet.

    Parameters

    Returns void

pendingRequestCount

  • get pendingRequestCount(): number
  • Gets the total number of requests on the pending chain

    type

    {number} count of all the requests

    readonly

    Returns number

previous

  • get previous(): string
  • Return the previous request as hash

    type

    {string}

    readonly

    Returns string

    hash of the previous transaction

publicKey

  • get publicKey(): string
  • The public key of the account

    type

    {string}

    readonly

    Returns string

receiveChain

  • get receiveChain(): Request[]
  • set receiveChain(val: Request[]): void

receiveCount

  • get receiveCount(): number
  • Gets the total number of requests on the receive chain

    type

    {number} count of all the requests

    readonly

    Returns number

requestCount

  • get requestCount(): number
  • Gets the total number of requests on the send chain

    type

    {number} count of all the requests

    readonly

    Returns number

sequence

  • get sequence(): number
  • Return the sequence value

    type

    {number}

    readonly

    Returns number

    sequence of for the next transaction

synced

  • get synced(): boolean
  • set synced(val: boolean): void
  • If the account has been synced with the RPC

    type

    {boolean}

    Returns boolean

  • If the account has been synced with the RPC

    Parameters

    • val: boolean

    Returns void

version

  • get version(): number
  • Account version of webwallet SDK

    type

    {number}

    readonly

    Returns number

wallet

Methods

addRequest

  • Adds the request to the pending chain and publishes it

    throws

    An exception if the pending balance is less than the required amount to adjust a users status

    Parameters

    • request: Request

      Request information from the RPC or MQTT

    Returns Promise<Request>

Protected addToReceiveChain

  • addToReceiveChain(request: Request): void
  • Adds the request to the Receive chain if it doesn't already exist

    Parameters

    Returns void

Protected addToSendChain

  • addToSendChain(request: Request): void
  • Adds the request to the Send chain if it doesn't already exist

    Parameters

    Returns void

broadcastRequest

  • broadcastRequest(): Promise<Request>

getChainRequest

  • getChainRequest(hash: string): Request
  • Finds the request object of the specified request hash in the confirmed chain

    Parameters

    • hash: string

      The hash of the request we are looking for

    Returns Request

    false if no request object of the specified hash was found

getPendingRequest

  • getPendingRequest(hash: string): Request
  • Finds the request object of the specified request hash in the pending chain

    Parameters

    • hash: string

      The hash of the request we are looking for

    Returns Request

    false if no request object of the specified hash was found

getPendingRequestsUpTo

  • getPendingRequestsUpTo(hash: string): Request[]
  • Gets the requests up to a certain hash from the pending chain

    Parameters

    • hash: string

      Hash of the request you wish to stop retrieving requests at

    Returns Request[]

    all the requests up to and including the specified request

getReceiveRequestsUpTo

  • getReceiveRequestsUpTo(hash: string): Request[]
  • Gets the requests up to a certain hash from the receive chain

    Parameters

    • hash: string

      Hash of the request you wish to stop retrieving requests at

    Returns Request[]

    all the requests up to and including the specified request

Protected getRecieveRequest

  • getRecieveRequest(hash: string): Request
  • Finds the request object of the specified request hash in the recieve chain

    Parameters

    • hash: string

      The hash of the request we are looking for

    Returns Request

    false if no request object of the specified hash was found

getRequest

  • getRequest(hash: string): Request
  • Finds the request object of the specified request hash

    Parameters

    • hash: string

      The hash of the request we are looking for

    Returns Request

    null if no request object of the specified hash was found

getRequestsUpTo

  • getRequestsUpTo(hash: string): Request[]
  • Gets the requests up to a certain hash from the send chain

    Parameters

    • hash: string

      Hash of the request you wish to stop retrieving requests at

    Returns Request[]

    all the requests up to and including the specified request

recentPendingRequests

  • recentPendingRequests(count?: number, offset?: number): Request[]
  • Retreives pending requests from the send chain

    Parameters

    • Default value count: number = 5

      Number of requests you wish to retrieve

    • Default value offset: number = 0

      Number of requests back from the frontier tip you wish to start at

    Returns Request[]

    all the requests

recentReceiveRequests

  • recentReceiveRequests(count?: number, offset?: number): Request[]
  • Retreives requests from the receive chain

    Parameters

    • Default value count: number = 5

      Number of requests you wish to retrieve

    • Default value offset: number = 0

      Number of requests back from the frontier tip you wish to start at

    Returns Request[]

    all the requests

recentRequests

  • recentRequests(count?: number, offset?: number): Request[]
  • Retreives requests from the send chain

    Parameters

    • Default value count: number = 5

      Number of requests you wish to retrieve

    • Default value offset: number = 0

      Number of requests back from the frontier tip you wish to start at

    Returns Request[]

    all the requests

removePendingRequest

  • removePendingRequest(hash: string): boolean
  • Called when a request is confirmed to remove it from the pending request pool

    Parameters

    • hash: string

      The hash of the request we are confirming

    Returns boolean

    true or false if the pending request was found and removed

removePendingRequests

  • removePendingRequests(): void
  • Removes all pending requests from the pending chain

    Returns void

toJSON

Abstract validateRequest

  • validateRequest(request: Request): Promise<boolean>
  • Validates that the account has enough funds at the current time to publish the request

    Parameters

    • request: Request

      Request information from the RPC or MQTT

    Returns Promise<boolean>

verifyChain

  • verifyChain(): boolean
  • Verify the integrity of the send & pending chains

    Returns boolean

verifyReceiveChain

  • verifyReceiveChain(): boolean
  • Verify the integrity of the receive chain

    throws

    An exception if there is an invalid request in the receive requestchain

    Returns boolean

Generated using TypeDoc