Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Client

Client is a tool for calling Muta GraphQL API shortly, it implements js code for you to send raw GraphQL RPC to node and do some prepare job locally.

Hierarchy

  • Client

Index

Constructors

constructor

Properties

getBlock

getBlock: GetBlock = (async (height?: Uint64): Promise<Maybe<Block>> => {const heightVariable = !isNil(height) ? { height } : undefined;const res = await this.rawClient.getBlock(heightVariable);return res.getBlock ?? null;}) as GetBlock

get a Block or get the latest Block

param

the target height, or empty for the latest block

Private options

options: ClientOption

Private rawClient

rawClient: RawClient

Methods

composeTransaction

getAccount

  • getAccount(): Account | undefined

getLatestBlockHeight

  • getLatestBlockHeight(): Promise<number>

getRawClient

getReceipt

getTransaction

queryService

sendTransaction

waitForNextNBlock

  • waitForNextNBlock(n?: number, options?: RetryConfig): Promise<number>
  • wait for next n block

    example
    async main() {
      const before =  await client.getLatestBlockHeight();
      await client.waitForNextNBlock(2);
      const after =  await client.getLatestBlockHeight();
      console.log(after - before);
    }

    Parameters

    • Default value n: number = 1

      block count

    • Default value options: RetryConfig = {}

    Returns Promise<number>

Generated using TypeDoc