Options
All
  • Public
  • Public/Protected
  • All
Menu

Websocket client.

TODO: correlate request and response with id, so socket can be reused.

Hierarchy

  • WebsocketClient

Index

Constructors

constructor

Properties

debug

debug: boolean

Decides if the client runs in debug mode so it can print info for debug.

url

url: string

Url of blockchain node

Methods

getAllowance

  • getAllowance(asset: string, from: Address, to: Address): Promise<any>

getBalance

  • getBalance(address: Address): Promise<any>

getBlock

  • getBlock(value: number | string): Promise<any>
  • Get block's info by block's height or hash. The result is hex encoded string.

    Parameters

    • value: number | string

      Block's height or hash

    Returns Promise<any>

getBlockHeight

  • getBlockHeight(): Promise<any>

getBlockHeightByTxHash

  • getBlockHeightByTxHash(hash: string): Promise<any>

getBlockJson

  • getBlockJson(value: number | string): Promise<any>

getContract

  • getContract(hash: string): Promise<any>

getContractJson

  • getContractJson(hash: string): Promise<any>

getGenerateBlockTime

  • getGenerateBlockTime(): Promise<any>

getMerkleProof

  • getMerkleProof(hash: string): Promise<any>

getNodeCount

  • getNodeCount(): Promise<any>

getRawTransaction

  • getRawTransaction(txHash: string): Promise<any>
  • Get raw transaction by transaction hash. The result is hex encoded transaction.

    Parameters

    • txHash: string

      Reversed transaction hash

    Returns Promise<any>

getRawTransactionJson

  • getRawTransactionJson(txHash: string): Promise<any>

getSmartCodeEvent

  • getSmartCodeEvent(value: number | string): Promise<any>
  • Get smart conde event by transaction hash or block's height. If parameter is transaction hash, the result is the event of that transaction. If parameter is block's height, the result is all the events of that block.

    Parameters

    • value: number | string

      Reversed transaction hash or block's height

    Returns Promise<any>

getStorage

  • getStorage(codeHash: string, key: string): Promise<any>
  • Get stored value in smart contract by contract's code hash and the key.

    Parameters

    • codeHash: string

      Contract's code hash

    • key: string

      Key of stored value

    Returns Promise<any>

Private send

  • send(raw: string, waitNotify?: boolean): Promise<any>
  • Send msg to blockchain

    Parameters

    • raw: string

      Message to send

    • Default value waitNotify: boolean = false

      Decides if need to wait for notify from blockchain

    Returns Promise<any>

sendHeartBeat

  • sendHeartBeat(): Promise<any>

sendRawTransaction

  • sendRawTransaction(hexData: string, preExec?: boolean, waitNotify?: boolean): Promise<any>
  • Send raw transaction

    Parameters

    • hexData: string

      Hex encoded data

    • Default value preExec: boolean = false

      Decides if it is a pre-executed transaction

    • Default value waitNotify: boolean = false

      Decides if client waits for notify from blockchain.

    Returns Promise<any>

sendSubscribe

  • sendSubscribe(subscribeEvent?: boolean, subscribeJsonBlock?: boolean, subscribeRawBlock?: boolean, subscribeBlockTxHashes?: boolean): Promise<any>
  • Send subscribe request

    Parameters

    • Default value subscribeEvent: boolean = false
    • Default value subscribeJsonBlock: boolean = false
    • Default value subscribeRawBlock: boolean = false
    • Default value subscribeBlockTxHashes: boolean = false

    Returns Promise<any>

Generated using TypeDoc