Options
All
  • Public
  • Public/Protected
  • All
Menu

Wrapper class for RPC apis.

Hierarchy

  • RpcClient

Index

Constructors

constructor

  • new RpcClient(url?: undefined | string): RpcClient

Properties

url

url: string

Url of the blockchain node

Methods

getAllowance

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

    Parameters

    • asset: string

      Asset's type.Only ONT and ONG supported.

    • from: Address

      Address of allowance's sender.

    • to: Address

      Address of allowance's receiver.

    Returns Promise<any>

getBalance

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

getBlock

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

    Parameters

    • value: string | number

      Block's height or hash

    Returns Promise<any>

getBlockCount

  • getBlockCount(): Promise<any>

getBlockHeight

  • getBlockHeight(): Promise<any>

getBlockHeightByTxHash

  • getBlockHeightByTxHash(txHash: string): Promise<any>
  • Get block height by transaction hash

    Parameters

    • txHash: string

      Reversed transaction hash

    Returns Promise<any>

getBlockJson

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

    Parameters

    • value: string | number

      Block's hash or height

    Returns Promise<any>

getContract

  • getContract(hash: string): Promise<any>
  • Get contract info by contract' code hash. The result is hex encoded string.

    Parameters

    • hash: string

      Contract's code hash.

    Returns Promise<any>

getContractJson

  • getContractJson(codeHash: string): Promise<any>
  • Get contract info by contract's code hash. The result is json.

    Parameters

    • codeHash: string

      Contract's code hash.

    Returns Promise<any>

getGenerateBlockTime

  • getGenerateBlockTime(): Promise<any>
  • Get the generation time for each block. If the blockchain node runs in vbft, the result is null cause the time is not fixed.

    Returns Promise<any>

getMerkleProof

  • getMerkleProof(hash: string): Promise<any>
  • Get merkle proof by transaction hash.

    Parameters

    • hash: string

      Reversed transaction hash

    Returns Promise<any>

getNodeCount

  • getNodeCount(): Promise<any>

getRawTransaction

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

    Parameters

    • txHash: string

      Reversed transaction hash

    Returns Promise<any>

getRawTransactionJson

  • getRawTransactionJson(txHash: string): Promise<any>
  • Get transaction info by transaction hash. The result is json.

    Parameters

    • txHash: string

      Reversed transaction hash.

    Returns Promise<any>

getSmartCodeEvent

  • getSmartCodeEvent(value: string | number): Promise<any>
  • Get smart contract event. If parameter is transaction's 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: string | number

      Transaction's 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>

getUrl

  • getUrl(): string

makeRequest

  • makeRequest(method: string, ...params: any[]): object
  • Make request base on method and parameters

    Parameters

    • method: string

      Method's name

    • Rest ...params: any[]

      Parameters

    Returns object

    • id: number
    • jsonrpc: string
    • method: string
    • params: any[]

sendRawTransaction

  • sendRawTransaction(data: string, preExec?: boolean): Promise<any>
  • Send ran transaction to blockchain.

    Parameters

    • data: string

      Hex encoded data.

    • Default value preExec: boolean = false

      Decides if it is a pre-execute transaction.

    Returns Promise<any>

Generated using TypeDoc