Options
All
  • Public
  • Public/Protected
  • All
Menu

Module jsonrpc/api

Index

Functions

Const call

  • call(url: string, params: [{ data?: undefined | string; from?: undefined | string; gas?: undefined | number; gasPrice?: undefined | number; to: string; value?: undefined | number }, Tag]): Promise<string>
  • Send an eth_call call to the node.

    Parameters

    • url: string
    • params: [{ data?: undefined | string; from?: undefined | string; gas?: undefined | number; gasPrice?: undefined | number; to: string; value?: undefined | number }, Tag]

    Returns Promise<string>

Const getBalance

  • getBalance(url: string, address: string): Promise<bigint>
  • Returns the balance for an address as bigint.

    Parameters

    • url: string
    • address: string

    Returns Promise<bigint>

Const getChainId

  • getChainId(url: string): Promise<number>
  • Returns the current chain ID as number.

    Parameters

    • url: string

    Returns Promise<number>

Const getRequestData

  • getRequestData<T>(method: T["method"], params: T["params"]): Request<T>

Const getVersion

  • getVersion(url: string): Promise<number>
  • Returns the current network ID as number.

    Parameters

    • url: string

    Returns Promise<number>

Const sendRequest

  • Send a JSONRPC request to the provided node with the provided data. Currently, this does not handle errors returned from the server.

    Type parameters

    Parameters

    Returns Promise<Response<T>>

Generated using TypeDoc