Documentation

AbstractModule
in package

AbstractYes

AbstractModule serves as the base class for specific modules, enabling them to access the runRpc() method.

Note that only the first module in the inheritance chain will inherit this, as PHP allows single inheritance only.

Tags
author

DubbaThony

Table of Contents

Methods

runRpc()  : array<string|int, mixed>
Executes an RPC call with the given method and parameters.
blockHash()  : string
Either extracts block hash from block and returns it as hex string, or returns hash hex string. Used for parameter normalization in RPC calls, for convenience of API.
blockParam()  : string
Normalizes a block number parameter for RPC calls.

Methods

runRpc()

Executes an RPC call with the given method and parameters.

public abstract runRpc(string $method[, array<string|int, mixed>|null $params = null ]) : array<string|int, mixed>
Parameters
$method : string

the RPC method name

$params : array<string|int, mixed>|null = null

optional array of parameters for the RPC call

Tags
throws
RPCGeneralException

if any unexpected error is present in RPC response

throws
RPCInvalidResponseParamException

if the 'result' field is missing in the response

throws
RPCNotFoundException

if the method is not found

Return values
array<string|int, mixed>

result of the RPC call

blockHash()

Either extracts block hash from block and returns it as hex string, or returns hash hex string. Used for parameter normalization in RPC calls, for convenience of API.

protected blockHash(Hash|Block $block) : string

@param Hash|Block $block the block object or a Hash object

Parameters
$block : Hash|Block
Return values
string

hexadecimal representation of the block hash

blockParam()

Normalizes a block number parameter for RPC calls.

protected blockParam(int|BlockParam $blockNumber) : string
Parameters
$blockNumber : int|BlockParam

the block number or a BlockParam object

Return values
string

hexadecimal representation of the block number or RPC alias string, such as "latest"


        
On this page

Search results