Web3
extends Net
in package
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
debugGetRawBlock()
public
debugGetRawBlock([int|BlockParam $blockParam = BlockParam::LATEST ]) : array<string|int, mixed>
Parameters
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
array<string|int, mixed>debugGetRawHeader()
public
debugGetRawHeader([int|BlockParam $blockParam = BlockParam::LATEST ]) : array<string|int, mixed>
Parameters
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
array<string|int, mixed>debugGetRawReceipts()
public
debugGetRawReceipts([int|BlockParam $blockParam = BlockParam::LATEST ]) : array<string|int, mixed>
Parameters
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
array<string|int, mixed>debugGetRawTransaction()
public
debugGetRawTransaction(Hash $h) : Transaction
Parameters
- $h : Hash
Tags
Return values
TransactionethAccounts()
public
ethAccounts() : array<string|int, Address>
Tags
Return values
array<string|int, Address>ethBlockNumber()
public
ethBlockNumber() : int
Tags
Return values
intethCall()
public
ethCall(Transaction $message[, Address|null $from = null ][, int|BlockParam $blockParam = BlockParam::LATEST ]) : string
Parameters
- $message : Transaction
- $from : Address|null = null
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
stringethChainID()
public
ethChainID() : int
Tags
Return values
intethCoinbase()
public
ethCoinbase() : Address
Tags
Return values
AddressethEstimateGas()
public
ethEstimateGas(Transaction $txn, Address|null $from) : int
Parameters
- $txn : Transaction
- $from : Address|null
Tags
Return values
intethGasPrice()
public
ethGasPrice() : OOGmp
Tags
Return values
OOGmpethGetBalance()
public
ethGetBalance(Address $address[, int|BlockParam $blockParam = BlockParam::LATEST ]) : OOGmp
Parameters
- $address : Address
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
OOGmpethGetBlockByHash()
public
ethGetBlockByHash(Hash $hash[, bool $fullBlock = false ]) : Block
Parameters
- $hash : Hash
- $fullBlock : bool = false
Tags
Return values
BlockethGetBlockByNumber()
public
ethGetBlockByNumber([int|BlockParam $blockParam = BlockParam::LATEST ][, bool $fullBlock = false ]) : Block
Parameters
- $blockParam : int|BlockParam = BlockParam::LATEST
- $fullBlock : bool = false
Tags
Return values
BlockethGetBlockTransactionCountByHash()
public
ethGetBlockTransactionCountByHash(Hash|Block $block) : int
Parameters
Tags
Return values
intethGetBlockTransactionCountByNumber()
public
ethGetBlockTransactionCountByNumber([int|BlockParam $blockParam = BlockParam::LATEST ]) : int
Parameters
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
intethGetCode()
public
ethGetCode(Address $address[, int|BlockParam $blockParam = BlockParam::LATEST ]) : string
Parameters
- $address : Address
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
stringethGetFilterChanges()
public
ethGetFilterChanges(OOGmp $filterId) : array<string|int, mixed>
Parameters
- $filterId : OOGmp
Tags
Return values
array<string|int, mixed>ethGetFilterLogs()
public
ethGetFilterLogs(OOGmp $filterId) : array<string|int, Log>
Parameters
- $filterId : OOGmp
Tags
Return values
array<string|int, Log>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
Return values
array<string|int, Log>ethGetStorageAt()
public
ethGetStorageAt(Address $address, OOGmp $position[, int|BlockParam $blockParam = BlockParam::LATEST ]) : OOGmp
Parameters
- $address : Address
- $position : OOGmp
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
OOGmpethGetTransactionByBlockHashAndIndex()
public
ethGetTransactionByBlockHashAndIndex(Hash $hash, int $index) : Transaction
Parameters
- $hash : Hash
- $index : int
Tags
Return values
TransactionethGetTransactionByBlockNumberAndIndex()
public
ethGetTransactionByBlockNumberAndIndex(int|BlockParam $blockParam, int $index) : Transaction
Parameters
- $blockParam : int|BlockParam
- $index : int
Tags
Return values
TransactionethGetTransactionByHash()
public
ethGetTransactionByHash(Hash $hash) : Transaction
Parameters
- $hash : Hash
Tags
Return values
TransactionethGetTransactionCount()
public
ethGetTransactionCount(Address $address[, int|BlockParam $blockParam = BlockParam::PENDING ]) : OOGmp
Parameters
- $address : Address
- $blockParam : int|BlockParam = BlockParam::PENDING
Tags
Return values
OOGmpethGetTransactionReceipt()
public
ethGetTransactionReceipt(Hash $hash) : Receipt
Parameters
- $hash : Hash
Tags
Return values
ReceiptethGetUncleByBlockHashAndIndex()
public
ethGetUncleByBlockHashAndIndex(Hash $hash, int $unclePos) : Block
Parameters
- $hash : Hash
- $unclePos : int
Tags
Return values
BlockethGetUncleByBlockNumberAndIndex()
public
ethGetUncleByBlockNumberAndIndex(int|BlockParam $blockParam, int $unclePos) : Block
Parameters
- $blockParam : int|BlockParam
- $unclePos : int
Tags
Return values
BlockethGetUncleCountByBlockHash()
public
ethGetUncleCountByBlockHash(Hash|Block $block) : int
Parameters
Tags
Return values
intethGetUncleCountByBlockNumber()
public
ethGetUncleCountByBlockNumber([int|BlockParam $blockParam = BlockParam::LATEST ]) : int
Parameters
- $blockParam : int|BlockParam = BlockParam::LATEST
Tags
Return values
intethHashrate()
public
ethHashrate() : OOGmp
Tags
Return values
OOGmpethMaxPriorityFeePerGas()
public
ethMaxPriorityFeePerGas() : OOGmp
Tags
Return values
OOGmpethMining()
public
ethMining() : bool
Tags
Return values
boolethNewFilter()
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
Return values
OOGmpethProtocolVersion()
public
ethProtocolVersion() : int
Tags
Return values
intethSendRawTransaction()
public
ethSendRawTransaction(Transaction $signedTransaction) : Hash
Parameters
- $signedTransaction : Transaction
Tags
Return values
HashethSendRawTransactionHex()
public
ethSendRawTransactionHex(string $rawTransactionHex) : Hash
Parameters
- $rawTransactionHex : string
Tags
Return values
HashethSendTransaction()
public
ethSendTransaction(Transaction $txn, Address $from) : Hash
Parameters
- $txn : Transaction
- $from : Address
Tags
Return values
HashethSign()
public
ethSign(Address $address, string $dataHex) : string
Parameters
- $address : Address
- $dataHex : string
Tags
Return values
stringethSignTransaction()
public
ethSignTransaction(Transaction $txn, Address $from) : string
Parameters
- $txn : Transaction
- $from : Address
Tags
Return values
stringethSyncing()
public
ethSyncing() : false|array<string|int, mixed>
Tags
Return values
false|array<string|int, mixed>netListening()
public
netListening() : bool
Tags
Return values
boolnetPeerCount()
public
netPeerCount() : int
Tags
Return values
intnetVersion()
public
netVersion() : int
Tags
Return values
intrunRpc()
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
Return values
array<string|int, mixed> —result of the RPC call
web3ClientVersion()
public
web3ClientVersion() : string
Tags
Return values
stringweb3Sha3Keccak()
public
web3Sha3Keccak(string $inputHex) : Hash
Parameters
- $inputHex : string
Tags
Return values
Hashweb3Sha3KeccakBin()
public
web3Sha3KeccakBin(string $inputBin) : Hash
Parameters
- $inputBin : string
Tags
Return values
HashblockHash()
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
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
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