Documentation

Web3 extends Net
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.

Table of Contents

Properties

$cachedChainId  : int|null

Methods

debugGetRawBlock()  : array<string|int, mixed>
debugGetRawHeader()  : array<string|int, mixed>
debugGetRawReceipts()  : array<string|int, mixed>
debugGetRawTransaction()  : Transaction
ethAccounts()  : array<string|int, Address>
ethBlockNumber()  : int
ethCall()  : string
ethChainID()  : int
ethCoinbase()  : Address
ethEstimateGas()  : int
ethGasPrice()  : OOGmp
ethGetBalance()  : OOGmp
ethGetBlockByHash()  : Block
ethGetBlockByNumber()  : Block
ethGetBlockTransactionCountByHash()  : int
ethGetBlockTransactionCountByNumber()  : int
ethGetCode()  : string
ethGetFilterChanges()  : array<string|int, mixed>
ethGetFilterLogs()  : array<string|int, Log>
ethGetLogs()  : array<string|int, Log>
ethGetStorageAt()  : OOGmp
ethGetTransactionByBlockHashAndIndex()  : Transaction
ethGetTransactionByBlockNumberAndIndex()  : Transaction
ethGetTransactionByHash()  : Transaction
ethGetTransactionCount()  : OOGmp
ethGetTransactionReceipt()  : Receipt
ethGetUncleByBlockHashAndIndex()  : Block
ethGetUncleByBlockNumberAndIndex()  : Block
ethGetUncleCountByBlockHash()  : int
ethGetUncleCountByBlockNumber()  : int
ethHashrate()  : OOGmp
ethMaxPriorityFeePerGas()  : OOGmp
ethMining()  : bool
ethNewFilter()  : OOGmp
Installs event filterer on rpc node and returns ID of the filter. Accepts few types, but bear in mind that string type is always considered to be binary blob.
ethProtocolVersion()  : int
ethSendRawTransaction()  : Hash
ethSendRawTransactionHex()  : Hash
ethSendTransaction()  : Hash
ethSign()  : string
ethSignTransaction()  : string
ethSyncing()  : false|array<string|int, mixed>
netListening()  : bool
netPeerCount()  : int
netVersion()  : int
runRpc()  : array<string|int, mixed>
Executes an RPC call with the given method and parameters.
web3ClientVersion()  : string
web3Sha3Keccak()  : Hash
web3Sha3KeccakBin()  : Hash
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.
parseFilterInput()  : array<string|int, mixed>
transactionToRPCArr()  : array<string|int, mixed>

Properties

$cachedChainId

private int|null $cachedChainId = null

Methods

ethGetLogs()

public ethGetLogs(Address|array<string|int, mixed> $address, int|BlockParam|null $fromBlock, int|BlockParam|null $toBlock, Hash|null $blockHash, string|bool|HashSerializable|array<string|int, mixed> $topic0[, string|bool|HashSerializable|array<string|int, mixed>|null $topic1 = null ][, string|bool|HashSerializable|array<string|int, mixed>|null $topic2 = null ][, string|bool|HashSerializable|array<string|int, mixed>|null $topic3 = null ]) : array<string|int, Log>
Parameters
$address : Address|array<string|int, mixed>
$fromBlock : int|BlockParam|null

if $blockHash not null, it MUST be null

$toBlock : int|BlockParam|null

if $blockHash not null, it MUST be null

$blockHash : Hash|null

if $fromBlock and/or $toBlock is not null, it MUST be null

$topic0 : string|bool|HashSerializable|array<string|int, mixed>
$topic1 : string|bool|HashSerializable|array<string|int, mixed>|null = null
$topic2 : string|bool|HashSerializable|array<string|int, mixed>|null = null
$topic3 : string|bool|HashSerializable|array<string|int, mixed>|null = null
Tags
throws
BadAddressChecksumException
throws
EthBinderArgumentException
throws
EthBinderLogicException
throws
InvalidHexException
throws
InvalidHexLengthException
throws
RPCGeneralException
throws
RPCInvalidResponseParamException
throws
RPCNotFoundException
Return values
array<string|int, Log>

ethNewFilter()

Installs event filterer on rpc node and returns ID of the filter. Accepts few types, but bear in mind that string type is always considered to be binary blob.

public ethNewFilter(Address|array<string|int, Address$address, int|BlockParam|null $fromBlock, int|BlockParam|null $toBlock, string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable$topic0[, null|string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable$topic1 = null ][, null|string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable$topic2 = null ][, null|string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable$topic3 = null ]) : OOGmp
Parameters
$address : Address|array<string|int, Address>
$fromBlock : int|BlockParam|null
$toBlock : int|BlockParam|null
$topic0 : string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable>
$topic1 : null|string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable> = null
$topic2 : null|string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable> = null
$topic3 : null|string|bool|HashSerializable|array<string|int, string>|array<string|int, bool>|array<string|int, HashSerializable> = null
Tags
throws
EthBinderArgumentException
throws
RPCGeneralException
throws
RPCInvalidResponseParamException
throws
RPCNotFoundException
throws
EthBinderLogicException
Return values
OOGmp

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"

parseFilterInput()

protected parseFilterInput(Address|array<string|int, mixed> $address, null|int|BlockParam $fromBlock, null|int|BlockParam $toBlock, null|Hash $blockHash, string|bool|HashSerializable|array<string|int, mixed> $topic0[, null|string|bool|HashSerializable|array<string|int, mixed> $topic1 = null ][, null|string|bool|HashSerializable|array<string|int, mixed> $topic2 = null ][, null|string|bool|HashSerializable|array<string|int, mixed> $topic3 = null ]) : array<string|int, mixed>
Parameters
$address : Address|array<string|int, mixed>
$fromBlock : null|int|BlockParam
$toBlock : null|int|BlockParam
$blockHash : null|Hash
$topic0 : string|bool|HashSerializable|array<string|int, mixed>
$topic1 : null|string|bool|HashSerializable|array<string|int, mixed> = null
$topic2 : null|string|bool|HashSerializable|array<string|int, mixed> = null
$topic3 : null|string|bool|HashSerializable|array<string|int, mixed> = null
Tags
throws
EthBinderLogicException
throws
EthBinderArgumentException
Return values
array<string|int, mixed>

transactionToRPCArr()

private transactionToRPCArr(Transaction $txn, Address|null $from[, bool $asMessage = false ]) : array<string|int, mixed>
Parameters
$txn : Transaction
$from : Address|null
$asMessage : bool = false
Return values
array<string|int, mixed>

        
On this page

Search results