Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Daemon

Hierarchy

  • EventEmitter
    • Daemon

Implements

Index

Constructors

constructor

  • new Daemon(host: string, port: number, isCacheApi?: undefined | false | true, ssl?: undefined | false | true): Daemon
  • Parameters

    • host: string

      The host to access the API on. Can be an IP, or a URL, for example, 1.1.1.1, or seedpro2.zent.cash

    • port: number

      The port to access the API on. Normally 21698 for a Zent Cash daemon, 80 for a HTTP api, or 443 for a HTTPS api.

    • Optional isCacheApi: undefined | false | true

      You can optionally specify whether this API is a blockchain cache API to save a couple of requests. If you're not sure, do not specify this parameter - we will work it out automatically.

    • Optional ssl: undefined | false | true

      You can optionally specify whether this API supports ssl/tls/https to save a couple of requests. If you're not sure, do not specify this parameter - we will work it out automatically.

    Returns Daemon

Methods

getCancelledTransactions

  • getCancelledTransactions(transactionHashes: string[]): Promise<string[]>

getConnectionInfo

getConnectionString

  • getConnectionString(): string

getGlobalIndexesForRange

  • getGlobalIndexesForRange(startHeight: number, endHeight: number): Promise<Map<string, number[]>>
  • Parameters

    • startHeight: number
    • endHeight: number

    Returns Promise<Map<string, number[]>>

    Returns a mapping of transaction hashes to global indexes

    Get global indexes for the transactions in the range [startHeight, endHeight]

getLocalDaemonBlockCount

  • getLocalDaemonBlockCount(): number
  • Get the amount of blocks the daemon we're connected to has

    Returns number

getNetworkBlockCount

  • getNetworkBlockCount(): number

getRandomOutputsByAmount

  • getRandomOutputsByAmount(amounts: number[], requestedOuts: number): Promise<Array<[number, Array<[number, string]>]>>
  • Gets random outputs for the given amounts. requestedOuts per. Usually mixin+1.

    Parameters

    • amounts: number[]
    • requestedOuts: number

    Returns Promise<Array<[number, Array<[number, string]>]>>

    Returns an array of amounts to global indexes and keys. There should be requestedOuts indexes if the daemon fully fulfilled our request.

getWalletSyncData

  • getWalletSyncData(blockHashCheckpoints: string[], startHeight: number, startTimestamp: number): Promise<[Block[], TopBlock | boolean]>
  • Parameters

    • blockHashCheckpoints: string[]

      Hashes of the last known blocks. Later blocks (higher block height) should be ordered at the front of the array.

    • startHeight: number

      Height to start taking blocks from

    • startTimestamp: number

      Block timestamp to start taking blocks from

      Gets blocks from the daemon. Blocks are returned starting from the last known block hash (if higher than the startHeight/startTimestamp)

    Returns Promise<[Block[], TopBlock | boolean]>

init

  • init(): Promise<void>
  • Initialize the daemon and the fee info

    Returns Promise<void>

nodeFee

  • nodeFee(): [string, number]
  • Get the node fee and address

    Returns [string, number]

sendTransaction

  • sendTransaction(rawTransaction: string): Promise<[boolean, string | undefined]>
  • Parameters

    • rawTransaction: string

    Returns Promise<[boolean, string | undefined]>

updateConfig

  • updateConfig(config: IConfig): void

updateDaemonInfo

  • updateDaemonInfo(): Promise<void>
  • Update the daemon info

    Returns Promise<void>

Generated using TypeDoc