EthereumService
extends EthereumRPC
in package
Class EthereumService
Table of Contents
- ETHEREUM_ADDRESS = '/^0x[a-fA-F0-9]{40}$/'
- Base ethereum regex
- RPC_VERSION = "2.0"
- $credentials : ConnectionInterface
- $curl : CurlHandle|resource
- __construct() : mixed
- EthereumRPC constructor.
- __get() : void
- __isset() : mixed
- __set() : mixed
- apiVersion() : string|null
- baseHeaders() : array<string|int, mixed>
- baseUrl() : string
- ethCall() : string
- getBalance() : string
- getBlockTransactions() : array<string|int, mixed>
- getBlockTransactionsCountByNumber() : int
- getCurrentBlockNumber() : int
- getGethGasPrice() : string
- getHost() : string
- getPort() : int|null
- getSsl() : bool
- getTransactionByHash() : array<string|int, mixed>|null
- getTransactionReceipt() : array<string|int, mixed>|null
- getTxCountForAddress() : string
- jsonRPC() : array<string|int, mixed>
- sendNodeRequest() : array<string|int, mixed>
- validateAddress() : void
- url() : string
Constants
ETHEREUM_ADDRESS
Base ethereum regex
public
mixed
ETHEREUM_ADDRESS
= '/^0x[a-fA-F0-9]{40}$/'
RPC_VERSION
public
mixed
RPC_VERSION
= "2.0"
Properties
$credentials
protected
ConnectionInterface
$credentials
$curl
protected
CurlHandle|resource
$curl
Methods
__construct()
EthereumRPC constructor.
public
__construct(ConnectionInterface $credentials) : mixed
Parameters
- $credentials : ConnectionInterface
Return values
mixed —__get()
public
__get(string $name) : void
Parameters
- $name : string
Tags
Return values
void —__isset()
public
__isset(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —__set()
public
__set(mixed $name, mixed $value) : mixed
Parameters
- $name : mixed
- $value : mixed
Return values
mixed —apiVersion()
public
apiVersion() : string|null
Return values
string|null —baseHeaders()
public
baseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed> —baseUrl()
public
baseUrl() : string
Return values
string —ethCall()
public
ethCall( $tx[, string|int $block = "latest" ][, mixed $functionName = '' ]) : string
Parameters
Tags
Return values
string —getBalance()
public
getBalance(string $address) : string
Parameters
- $address : string
Return values
string —getBlockTransactions()
public
getBlockTransactions(int $blockNumber[, bool $onlyHashes = false ]) : array<string|int, mixed>
Parameters
- $blockNumber : int
- $onlyHashes : bool = false
Return values
array<string|int, mixed> —getBlockTransactionsCountByNumber()
public
getBlockTransactionsCountByNumber(int $blockNumber) : int
Parameters
- $blockNumber : int
Return values
int —getCurrentBlockNumber()
public
getCurrentBlockNumber() : int
Return values
int —getGethGasPrice()
public
getGethGasPrice() : string
Return values
string —getHost()
public
getHost() : string
Return values
string —getPort()
public
getPort() : int|null
Return values
int|null —getSsl()
public
getSsl() : bool
Return values
bool —getTransactionByHash()
public
getTransactionByHash(string $hash) : array<string|int, mixed>|null
Parameters
- $hash : string
Return values
array<string|int, mixed>|null —getTransactionReceipt()
public
getTransactionReceipt(string $txHash) : array<string|int, mixed>|null
Parameters
- $txHash : string
Return values
array<string|int, mixed>|null —getTxCountForAddress()
public
getTxCountForAddress(string $address[, string $quantity = "pending" ]) : string
Parameters
- $address : string
- $quantity : string = "pending"
Return values
string —jsonRPC()
public
jsonRPC(string $command[, string|null $endpoint = null ][, array<string|int, mixed>|null $params = null ][, mixed $functionName = '' ]) : array<string|int, mixed>
Parameters
- $command : string
- $endpoint : string|null = null
- $params : array<string|int, mixed>|null = null
- $functionName : mixed = ''
Return values
array<string|int, mixed> —sendNodeRequest()
public
sendNodeRequest([null $data = null ][, null $method = null ][, false $need_encode = true ][, false $is_put = false ][, mixed $functionName = '' ]) : array<string|int, mixed>
Parameters
- $data : null = null
- $method : null = null
- $need_encode : false = true
- $is_put : false = false
- $functionName : mixed = ''
Tags
Return values
array<string|int, mixed> —validateAddress()
public
validateAddress(mixed ...$addresses) : void
Parameters
- $addresses : mixed
Tags
Return values
void —url()
private
url([null|string $endPoint = null ]) : string
Parameters
- $endPoint : null|string = null