Minimal version of Web3 RPC client For smart contract interaction

Constructors

Properties

instance: Web3RPCClient

Methods

  • Estimates gas for a transaction This can be used to set the gas limit

    Parameters

    Returns Promise<bigint>

    The estimated gas used by the transaction

  • Gets the current gas price in wei

    Parameters

    Returns Promise<bigint>

    The gas price

  • Get account balance

    Parameters

    • address: string

      Address (0x...)

    • tag: BlockTag

      Tag that can be latest=last block or pending=last pending transaction

    • options: RPCOptions

      RPC options

    Returns Promise<bigint>

    The account balance

  • Gets a block by number (required for certain calls)

    Parameters

    • num: string | number | bigint

      Block number

    • options: RPCOptions

      RPC options

    Returns Promise<BlockData>

    The block data

  • Gets the network ID This is used by default if the chain ID is not specified

    Parameters

    Returns Promise<bigint>

    The network ID

  • Get transaction count (for next nonce)

    Parameters

    • address: string

      Address (0x...)

    • tag: BlockTag

      Tag that can be latest=last block or pending=last pending transaction

    • options: RPCOptions

      RPC options

    Returns Promise<bigint>

    The transaction count

  • Performs a message call (for pure and view methods)

    Parameters

    Returns Promise<Buffer>

    The results (ABI encoded)

  • Performs a JSON-RPC request

    Parameters

    • method: string

      RPC Method

    • params: any[]

      Method parameters

    • options: RPCOptions

      Request options

    Returns Promise<any>

    The JSON RPC result

  • Sends raw transaction

    Parameters

    Returns Promise<Buffer>

    The transaction hash

Generated using TypeDoc