Documentation

EthereumService extends EthereumRPC

Class EthereumService

Table of Contents

ETHEREUM_ADDRESS  = '/^0x[a-fA-F0-9]{40}$/'
Base ethereum regex
ETHEREUM_HASH  = '/^0x[a-fA-F0-9]{64}$/'
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
calculateGasLimit()  : string
ethCall()  : string
getBalance()  : string
getBlockTransactions()  : array<string|int, mixed>
getBlockTransactionsCountByNumber()  : int
getChainId()  : int
getCredentials()  : ConnectionInterface
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>
prepareTransaction()  : array<string|int, mixed>
sendNodeRequest()  : array<string|int, mixed>
signAndBroadcastTransaction()  : string
signAndBroadcastTransactionByNode()  : string
validateAddress()  : void
broadcastTransactionHash()  : string|null
handleBigCommissionPriceTransactions()  : string
handleNonceLowTransactions()  : string
handleUnderPricedTransactions()  : string
url()  : string

Constants

ETHEREUM_ADDRESS

Base ethereum regex

public mixed ETHEREUM_ADDRESS = '/^0x[a-fA-F0-9]{40}$/'

Properties

Methods

__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>

calculateGasLimit()

public calculateGasLimit(string $from, string $to, int $amount[, string $data = '00' ][, string $block = 'latest' ]) : string
Parameters
$from : string
$to : string
$amount : int
$data : string = '00'
$block : string = 'latest'
Return values
string

ethCall()

public ethCall( $tx[, string|int $block = "latest" ][, mixed $functionName = '' ]) : string
Parameters
$tx :
$block : string|int = "latest"
$functionName : mixed = ''
Tags
throws
GethException
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>

prepareTransaction()

public prepareTransaction(string $from, string $to, int $amountInWEI[, string $data = '00' ]) : array<string|int, mixed>
Parameters
$from : string
$to : string
$amountInWEI : int
$data : string = '00'
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
throws
JsonException
Return values
array<string|int, mixed>

signAndBroadcastTransaction()

public signAndBroadcastTransaction(Transaction $transaction, string $privateKey) : string
Parameters
$transaction : Transaction
$privateKey : string
Return values
string

signAndBroadcastTransactionByNode()

public signAndBroadcastTransactionByNode(Transaction $transaction, string $privateKey) : string
Parameters
$transaction : Transaction
$privateKey : string
Return values
string

broadcastTransactionHash()

protected broadcastTransactionHash(string $hash) : string|null
Parameters
$hash : string
Return values
string|null

handleBigCommissionPriceTransactions()

protected handleBigCommissionPriceTransactions(Transaction $transaction, string $privateKey) : string
Parameters
$transaction : Transaction
$privateKey : string
Return values
string

handleNonceLowTransactions()

protected handleNonceLowTransactions(Transaction $transaction, string $privateKey) : string
Parameters
$transaction : Transaction
$privateKey : string
Return values
string

handleUnderPricedTransactions()

protected handleUnderPricedTransactions(Transaction $transaction, string $privateKey) : string
Parameters
$transaction : Transaction
$privateKey : string
Return values
string

url()

private url([null|string $endPoint = null ]) : string
Parameters
$endPoint : null|string = null
Return values
string

Search results