phph1
in package
The PHPH1 wrapper class.
When invoking the class there are certain variables that must be passed to the class for operation. All variables are required and are located in inc/config.php which means before invoking the class you will most likely want to require_once() the config file or set the configurations in your project somehow.
See the __construct() function for more information.
Table of Contents
- $apiaddr : string
- $default_pagesize : int
- $dorequest : int
- $errors : array<string|int, mixed>
- $goodinputs : array<string|int, mixed>
- $lastjson : string
- $max_pagesize : int
- $network : string
- $phph1_allowbigdata : int
- $phph1_allowedaddr : array<string|int, mixed>
- $phph1_apiaddresses : array<string|int, mixed>
- $phph1_blockedaddr : array<string|int, mixed>
- $phph1_debug : int
- $phph1_method : string
- $phph1_methods : array<string|int, mixed>
- $rpc_call : int
- $rpc_posturl : array<string|int, mixed>
- $rpc_url : string
- $shard : int
- $validinput : int
- __construct() : void
- The __construct function is used to set PHPH1 configurations settings when invoking the class. The parameters are all REQUIRED when invoking the class
- chk_access() : booleen
- Check the client and report whether they are allowed to connect and make requests
- chk_dorequest() : booleen
- chk_dorequest() is used to check if we have form data submitted anf the request is valid enough to move forward
- chk_goodinput() : booleen
- chk_goodinput() checks if a form field has successfully passed validation by checking the goodinputs array which is filled during validation methods.
- chk_request() : booleen
- Check if we have a valid method input and make sure $_GET['method'] is in $phph1_methods array in the phph1 class The methods array is set in config.php and loaded to the class in boot.php when the class handle is created THEN it checks if $_POST['dorequest'] which is a hidden field in every method formis set and sets the class variable $dorequest so it is known everywhere that a method form has been submitted
- convert_atto() : number
- Converts numbers in atto to decimal
- docurlrequest() : object
- docurlrequest() takes the generated json request for the current method from genjsonrequest() and makes the call to the API RPC Node. If rpc_call is set to 0, it generates a data object for output.
- genjsonrequest() : string
- genjsonrequest() is used by the method functions to generate the JSON request for the Node API host
- genrequesturl() : string
- genrequesturl() is used by the method functions to generate the PHPH1 request url for a method request
- get_apiaddr() : string
- get_apiaddr() is used to get the currently used Node API address The API address is set during _construct using the supplied network and shard information
- get_currentmethod() : string
- get_currentmethod() is used to get the current method The current method is set during _contruct when creating a class handle
- get_debugstatus() : int
- get_debugstatus() is used to determine if the script is running in debug mode or not The debug bit in the PHPH1 class is set during _construct and can be turned on and off in inc/config.php
- get_errors() : array<string|int, mixed>
- get_errors() is used to get the current array of errors from inc/boot.php and method requests The error array is generated during the validation of method inputs
- get_goodinput() : string
- get_goodinput() gets a validated value from user input.
- get_lastjson() : string
- get_lastjson() is used to get the last (current) json request generated for a method This is used later in the Method Explorer for educational output
- get_methods() : array<string|int, mixed>
- get_methods() is used to get the current array of available methods which was set during _construct The methods array is set in inc/config.php
- get_rpcposturl() : string
- get_rpcurl() is used to retrieve the current RPC URL.
- get_rpcstatus() : int
- get_rpcstatus() is used to check the current rpc status bit which is set when creating a class handle This is used by the Method Explorer to determine what output to show, either graphical or raw json output for RPC calls from external scripting languages
- get_rpcurl() : string
- get_rpcurl() is used to retrieve the current RPC URL.
- get_sessionnetwork() : string
- get_sessionnetwork() is used to get the current network we are working on The network is set when creating a class handle in _construct and the settings are found in inc/config.php
- get_sessionshard() : string
- get_sessionshard() is used to get the current network shard we are working on The network shard is set when creating a class handle in _construct and the settings array is found in inc/config.php
- get_validinput() : int
- get_validinput() is used to retrieve the current input validation status The validation status bit is set when validating user input
- getapiaddr() : string
- getapiaddr() is used to set the Node API host address during __construct. It gets the address using the network name and shard from $phph1_apiaddresses which is also set during __construct using settings from inc/config.php
- hmyv2_blockNumber() : int
- Get the current block number
- hmyv2_call() : string
- hmyv2_call() Executes a new message call immediately, without creating a transaction on the block chain. The hmyv2_call method can be used to query internal contract state, to execute validations coded into a contract or even to test what the effect of a transaction would be without running it live.
- hmyv2_epochLastBlock() : int
- Get the last block for a specified epoch
- hmyv2_estimateGas() : string
- hmyv2_estimateGas() Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
- hmyv2_gasPrice() : int
- Gets the current average gas price of transactions
- hmyv2_getAllValidatorAddresses() : array<string|int, mixed>
- Gets a list of wallet addresses that have created validators on the network.
- hmyv2_getAllValidatorInformation() : array<string|int, mixed>
- Gets all information for all validators.
- hmyv2_getAllValidatorInformationByBlockNumber() : array<string|int, mixed>
- Get all validator information by block number
- hmyv2_getBalance() : number
- Gets the current balance in atto for the specified wallet
- hmyv2_getBalanceByBlockNumber() : number
- Gets the current balance in atto for the specified wallet at the specified block number
- hmyv2_getBlockByHash() : array<string|int, mixed>
- Gets block information using the specified block hash.
- hmyv2_getBlockByNumber() : array<string|int, mixed>
- Gets block information using the specified block number.
- hmyv2_getBlocks() : array<string|int, mixed>
- Gets block information on a series of blocks between two block numbers.
- hmyv2_getBlockSignerKeys() : array<string|int, mixed>
- Gets block signer BLS keys using the specified block number.
- hmyv2_getBlockSigners() : array<string|int, mixed>
- Gets a list of block signer wallet addresses using the specified block number.
- hmyv2_getBlockTransactionCountByHash() : number
- Gets the number of transactions in a block using the specified block hash.
- hmyv2_getBlockTransactionCountByNumber() : number
- Gets the number of transactions in a block using the specified block number.
- hmyv2_getCirculatingSupply() : int
- Get the current circulating supply of tokens in ONE
- hmyv2_getCode() : string
- This method can be used to distinguish between contract addresses and wallet addresses.
- hmyv2_getCurrentBadBlocks() : array<string|int, mixed>
- Gets a list of bad blocks in node memory
- hmyv2_getCurrentStakingErrorSink() : array<string|int, mixed>
- Retrieves a list of transaction errors currently in the staking error sink
- hmyv2_getCurrentTransactionErrorSink() : array<string|int, mixed>
- Retrieves a list of transaction errors currently in the transaction error sink
- hmyv2_getCurrentUtilityMetrics() : array<string|int, mixed>
- Retrieves the current utility metrics
- hmyv2_getCXReceiptByHash() : array<string|int, mixed>
- Query the CX receipt hash on the receiving shard endpoint
- hmyv2_getDelegationsByDelegator() : array<string|int, mixed>
- Get delegations by delegator address
- hmyv2_getDelegationsByDelegatorByBlockNumber() : array<string|int, mixed>
- Get delegations using delegator address and block number
- hmyv2_getDelegationsByValidator() : mixed
- Get delegations using validator address
- hmyv2_getElectedValidatorAddresses() : array<string|int, mixed>
- Get all elected Validator addresses
- hmyv2_getEpoch() : int
- Get the current epoch
- hmyv2_getHeaderByNumber() : array<string|int, mixed>
- Gets the block header data for the specified block number.
- hmyv2_getLastCrossLinks() : array<string|int, mixed>
- Get the current information on the last crosslinks
- hmyv2_getLatestChainHeaders() : array<string|int, mixed>
- Gets a list of the latest beacon chain headers and their related information.
- hmyv2_getLeader() : string
- Get the wallet address of current leader
- hmyv2_getMedianRawStakeSnapshot() : array<string|int, mixed>
- Retrieves the median raw stake snapshot
- hmyv2_getNodeMetadata() : array<string|int, mixed>
- Gets the current node metadata.
- hmyv2_getPendingCXReceipts() : array<string|int, mixed>
- Retrieves a list of currently pending cross shard transaction receipts
- hmyv2_getPoolStats() : array<string|int, mixed>
- Retrieves current transaction pool stats
- hmyv2_getShardingStructure() : array<string|int, mixed>
- Get a list of all shards and their information
- hmyv2_getStakingNetworkInfo() : array<string|int, mixed>
- Retrieves current network staking information
- hmyv2_getStakingTransactionByBlockHashAndIndex() : array<string|int, mixed>
- Use this API call to retrieve a staking transaction info using block hash and transaction index
- hmyv2_getStakingTransactionByBlockNumberAndIndex() : array<string|int, mixed>
- Use this API call to retrieve a staking transaction info using block number and transaction index
- hmyv2_getStakingTransactionByHash() : array<string|int, mixed>
- Use this API call to retrieve a staking transaction info using the staking transaction hash (stkhash is validated in boot.php)
- hmyv2_getStakingTransactionsCount() : number
- Gets the number of staking transactions for the specified ONE wallet address.
- hmyv2_getStakingTransactionsHistory() : string
- Gets staking transactions history for a specified ONE wallet.
- hmyv2_getStorageAt() : string
- Returns the value from a storage position at a given address, or in other words, returns the state of the contract's storage, which may not be exposed via the contract's methods.
- hmyv2_getSuperCommittees() : array<string|int, mixed>
- Retrieves current super committee information
- hmyv2_getTotalSupply() : int
- Get the total number of pre-mined tokens
- hmyv2_getTransactionByBlockHashAndIndex() : array<string|int, mixed>
- Use this API call to retrieve transaction info using block hash and transaction index (blockhash is validated in boot.php)
- hmyv2_getTransactionByBlockNumberAndIndex() : array<string|int, mixed>
- Use this API call to retrieve transaction info using block number and transaction index
- hmyv2_getTransactionByHash() : array<string|int, mixed>
- Use this API call to retrieve transaction info using the transaction hash
- hmyv2_getTransactionReceipt() : array<string|int, mixed>
- Use this API call to retrieve transaction info using the transaction hash
- hmyv2_getTransactionsCount() : number
- Gets the number of transactions for the specified ONE wallet address.
- hmyv2_getTransactionsHistory() : string
- Gets transactions history for a specified ONE wallet.
- hmyv2_getValidatorInformation() : array<string|int, mixed>
- Get all information for a validator
- hmyv2_getValidatorKeys() : array<string|int, mixed>
- Get validator information from epoch number
- hmyv2_getValidators() : array<string|int, mixed>
- Get validator information from epoch number
- hmyv2_isBlockSigner() : booleen
- Gets whether specified ONE address is a block signer for a specified block number.
- hmyv2_latestHeader() : array<string|int, mixed>
- Gets the current blockchain header information.
- hmyv2_pendingStakingTransactions() : array<string|int, mixed>
- Retrieves a list of currently pending staking transactions
- hmyv2_pendingTransactions() : array<string|int, mixed>
- Retrieves a list of currently pending transactions
- hmyv2_protocolVersion() : number
- Gets the current network protocol version.
- hmyv2_resendCx() : bool
- Use this API call to resend the cross shard receipt to the receiving shard to re-process if the transaction did not pay out
- hmyv2_sendRawStakingTransaction() : string
- Send a raw staking transaction using the hex representation of a signed staking transaction
- hmyv2_sendRawTransaction() : string
- Send a raw transaction using the hex representation of a signed transaction
- net_peerCount() : number
- Gets the current number of peers on the network in the form of a hex string.
- phph1_prepinput() : string
- phph1_prepinput() is used to prepare userinput for validation
- phph1_reset() : booleen
- phph1_reset() resets all dynamic class information after a request has been finished.
- set_booterrors() : booleen
- set_booterrors() is used to import any pre class instantiation errors to the class errors array
- set_rpc() : booleen
- setrpc() is used to set the rpc_call variable that determines whether we are making a remote rpc call or using the explorer interface
- set_validinput() : booleen
- set_validinput() is used to set the validinput bit 1 (valid) or 0(not) This is set after validating the input data for methods so the class knows if it is okay to make the RPC call
- val_blockhash() : booleen
- Validates a block hash
- val_blocknum() : booleen
- Validates a block number
- val_call() : booleen
- val_call() Validates user input for hmyv2_call()
- val_cxtxhash() : booleen
- Validates a cross shard transaction hash
- val_epoch() : booleen
- Validates an epoch
- val_epochLastBlock() : booleen
- Validate input for hmyv2_epochLastBlock
- val_estimateGas() : booleen
- val_estimateGas() Validates the user input for hmyv2_estimateGas()
- val_ethaddr() : booleen
- Validates an ETH wallet address
- val_getAllValidatorInformation() : int
- Validation function for hmyv2_getAllValidatorInformation()
- val_getAllValidatorInformationByBlockNumber() : int
- Validation function for hmyv2_getAllValidatorInformationByBlockNumber
- val_getBalance() : number
- Validate input for hmyv2_getBalance
- val_getBalanceByBlockNumber() : number
- Validate input for hmyv2_getBalanceByBlockNumber
- val_getBlockByHash() : booleen
- Validates the input data for hmyv2_getBlockByHash()
- val_getBlockByNumber() : booleen
- Validates the input data for hmyv2_getBlockByNumber().
- val_getBlocks() : booleen
- Validates the input for hmyv2_getBlocks().
- val_getBlockSignerKeys() : booleen
- Validates the input data for hmyv2_getBlockSignerKeys().
- val_getBlockSigners() : booleen
- Validates the input data for hmyv2_getBlockSigners()
- val_getBlockTransactionCountByHash() : booleen
- Validates the input data for hmyv2_getBlockTransactionCountByHash()
- val_getBlockTransactionCountByNumber() : booleen
- Validates the input data for hmyv2_getBlockTransactionCountByNumber().
- val_getCode() : string
- Validates hmyv2_getCode input
- val_getCXReceiptByHash() : booleen
- Validate the CX receipt transaction hash input for hmyv2_getCXReceiptByHash
- val_getDelegationsByDelegator() : booleen
- Validation function for hmyv2_getDelegationsByDelegator()
- val_getDelegationsByDelegatorByBlockNumber() : int
- Validation function for hmyv2_getDelegationsByDelegatorByBlockNumber()
- val_getDelegationsByValidator() : int
- Validation function for hmyv2_getDelegationsByValidator()
- val_getHeaderByNumber() : booleen
- Validates the input data for hmyv2_getHeaderByNumber()
- val_getStakingTransactionByBlockHashAndIndex() : booleen
- Validate input for hmyv2_getStakingTransactionByBlockHashAndIndex (blockhash is validated in boot.php)
- val_getStakingTransactionByBlockNumberAndIndex() : booleen
- Validate input for val_getStakingTransactionByBlockNumberAndIndex (blocknum is validated in boot.php)
- val_getStakingTransactionByHash() : booleen
- Validate input for hmyv2_getStakingTransactionByHash
- val_getStakingTransactionsCount() : booleen
- Validates the input for hmyv2_getStakingTransactionsCount().
- val_getStakingTransactionsHistory() : booleen
- Validates the input data for hmyv2_getStakingTransactionsHistory().
- val_getStorageAt() : booleen
- Validation function for hmyv2_getStorageAt()
- val_getTransactionByBlockHashAndIndex() : booleen
- Validate input for val_getTransactionByBlockHashAndIndex (blockhash is validated in boot.php)
- val_getTransactionByBlockNumberAndIndex() : booleen
- Validate input for hmyv2_getTransactionByBlockNumberAndIndex (blocknum is validated in boot.php)
- val_getTransactionByHash() : booleen
- Validate input for hmyv2_getTransactionByHash
- val_getTransactionReceipt() : booleen
- Validate input for hmyv2_getTransactionReceipt
- val_getTransactionsCount() : booleen
- Validates the input for hmyv2_getTransactionsCount().
- val_getTransactionsHistory() : booleen
- Validates the input data for hmyv2_getTransactionsHistory().
- val_getValidatorInformation() : int
- Validation function for hmyv2_getValidatorInformation
- val_getValidatorKeys() : booleen
- Validate input for hmyv2_getValidatorKeys
- val_getValidators() : booleen
- Validate input for hmyv2_getValidators
- val_hash() : booleen
- Validates a hash
- val_isBlockSigner() : booleen
- Validation for hmyv2_isBlockSigner
- val_oneaddr() : booleen
- Validates a ONE wallet address
- val_resendCx() : booleen
- Validate the cross transaction receipt transaction hash input for hmyv2_resendCx
- val_scaddress() : booleen
- Validates a smart contract address
- val_sendRawStakingTransaction() : booleen
- Validate input for hmyv2_sendRawStakingTransaction
- val_sendRawTransaction() : booleen
- Validate input for hmyv2_sendRawTransaction
- val_stlocation() : booleen
- Validates storage location
- val_txindex() : booleen
- Validates transaction index
Properties
$apiaddr
private
string
$apiaddr
The API address being used during this session. It is set during __construct by applying the $network and $shard inputs to the function getapiaddr(). It is set during __construct
$default_pagesize
private
int
$default_pagesize
Sets the default page size for methods that output multiple pages of data. It is set during __construct
$dorequest
private
int
$dorequest
= 0
dorequest is a placeholder so the whole class knows the request has passed the first validation step of sending $_GET['dorequest'] in the method request url. This should help filter out some of the dumber bots. It is set to 0 by default and cannot be null
$errors
private
array<string|int, mixed>
$errors
= array()
An array of errors generated when creating the class handle and validating method inputs. This is later used to output any errors to the explorer method output page.
$goodinputs
private
array<string|int, mixed>
$goodinputs
= array()
An array of validated input generated when validating method inputs. This is later used to populate any field forms after the request, if all fields are good, all fields get populated.
$lastjson
private
string
$lastjson
lastjson is set while generating a method. It is stored to use later when the explorer displays its method results
$max_pagesize
private
int
$max_pagesize
Sets the maximum page size a multi-paged method output can output. This is mostly used to prevent a call from a user asking for a huge page size which could slow things down due to memory and network usage
$network
private
string
$network
This sets the network currently being used for the API calls during __construct and is one from the $phph1_apiaddresses array set in inc/config.php. example "mainnet"
$phph1_allowbigdata
private
int
$phph1_allowbigdata
Some requests have a page index (page number) option included in some of those options is the ability to use -1 as the index page. When using -1 the data set returned could possibly be huge causing a massive load on the server. By default using the -1 option is disabled to prevent this from happening. You can enable -1 page requests here by setting $phph1_allowbigdata to 1 in inc/config.php. UPDATE 2022-5-3: When last tested, none of the methods that are supposed to be able to use -1 according to the Harmony doc are not working and return an error. Since discovering this, I have staticly set this to 0 and and changing it in inc/config.php will not change anything.
$phph1_allowedaddr
private
array<string|int, mixed>
$phph1_allowedaddr
An array of allowed IP addresses set in inc/config.php This is set during __construct when the class is invoked. When this is set, only the hpst addresses in the array are allowed to retrieve data.
$phph1_apiaddresses
private
array<string|int, mixed>
$phph1_apiaddresses
This is set during _construct when the class is invoked and is defined in inc/config.php. This is a multi-dimensional array that holds the node and shard information.
$phph1_blockedaddr
private
array<string|int, mixed>
$phph1_blockedaddr
An array of blocked IP addresses set in inc/config.php This is set during __construct when the class is invoked. This gets ignored if the $phph1_allowedaddr array is not empty
$phph1_debug
private
int
$phph1_debug
Determines whether debug output is displayed in the explorer when a method is run. It is set during __construct
$phph1_method
private
string
$phph1_method
The current method being used. It is set while validating input in inc/boot.php
$phph1_methods
private
array<string|int, mixed>
$phph1_methods
This is set during __construct when the class is invoked and holds all available networks and shards in an array. It is defined in inc/config.php and set when creating the class handle in inc/boot.php
$rpc_call
private
int
$rpc_call
= 0
Determines whether whether the current method being called is an rpc call. If set to 1, the explorer knows to not output anything but the raw json output from the API Node. inc/boot.php has the check and set for this varibale in it. The variable is usually set at the top of a page. You can see it inaction in phph1_call.php
$rpc_posturl
private
array<string|int, mixed>
$rpc_posturl
= []
When a method is called and run, it generates the RPC URL and sets it here for output later on
$rpc_url
private
string
$rpc_url
When a method is called and run, it generates the RPC URL and sets it here for output later on
$shard
private
int
$shard
$validinput
private
int
$validinput
= 0
is set while validating user input and is used to determine whether the method being used should be run or not.
Methods
__construct()
The __construct function is used to set PHPH1 configurations settings when invoking the class. The parameters are all REQUIRED when invoking the class
public
__construct(array<string|int, mixed> $phph1_apiaddresses, array<string|int, mixed> $phph1_methods, int $phph1_debug, int $max_pagesize, int $default_pagesize, string $network, int $shard, array<string|int, mixed> $phph1_blockedaddr, array<string|int, mixed> $phph1_allowedaddr, int $phph1_allowbigdata) : void
Parameters
- $phph1_apiaddresses : array<string|int, mixed>
-
This is set in inc/config.php and is an array of arrays, each array item is the network "name" such as "mainnet" and is an array itself of addresses used as shards for that network. For example $phph1_apiaddresses['mainnet'][0] would be an address for shard 0 on the mainnet network.
- $phph1_methods : array<string|int, mixed>
-
This is set in inc/config.php and is an array of available methods by name. The array is used to verify that the method being called upon is a valid method. If the method is not in the array, all actions can be stopped before any input is used. You can also comment out methods in the inc/config.php to limit which methods are used in your project. This can also be extended with custom methods added to the phph1 class.
- $phph1_debug : int
-
Set in inc/config.php and sets whether debugging output is on or off. Debugging output will present information concerning how the JSON call is being created through the process to aid in development. In most cases, this should be set to 0 to diable debugging.
- $max_pagesize : int
-
This sets the maximum number of return items per page on API calls that return multiple pages of data in the explorer or your project. This is helpful in preventing huge return data sets which could present a heavy load on the web server or the web servers data throughput.
- $default_pagesize : int
-
This sets the default page size for API calls that return pages of data. This is helpful in the Explorer and can also be used in your project when not using the explorer.
- $network : string
-
This sets the network currently being used for the API calls and is one from the $phph1_apiaddresses array set in inc/config.php. example "mainnet"
- $shard : int
-
This is the index number of the shard from the $network array. The shard MUST be defined in the inc/config.php $phph1_apiaddresses array. example: If 'mainnet' were selected for $network above and we wanted to use chard 0, the value for this would be 0.
- $phph1_blockedaddr : array<string|int, mixed>
-
This is a one per line array of IP addresses that should not be allowed to run methods. The array is set in inc/config.php and if left empty will block nobody. This array is ignored if the $phph1_allowedaddr array is not empty.
- $phph1_allowedaddr : array<string|int, mixed>
-
This is a one per line array of IP addresses that are the only addresses allowed to run methods. The array is set in inc/config.php and if left empty will not be used. If this array is not empty, $phph1_blockedaddr will be ignored (due to redundancy).
- $phph1_allowbigdata : int
-
Some requests have a page index (page number) option included in some of those options is the ability to use -1 as the index page. When using -1 the data set returned could possibly be huge causing a massive load on the server. By default using the -1 option is disabled to prevent this from happening. You can enable -1 page requests here by setting $phph1_allowbigdata to 1 in inc/config.php. UPDATE 2022-5-3: When last tested, none of the methods that are supposed to be able to use -1 according to the Harmony doc are not working and return an error. Since discovering this, I have staticly set this to 0 and and changing it in inc/config.php will not change anything.
Return values
void —chk_access()
Check the client and report whether they are allowed to connect and make requests
public
chk_access() : booleen
Return values
booleen —1 = the client is allowed access, 0 = The client is denied access
chk_dorequest()
chk_dorequest() is used to check if we have form data submitted anf the request is valid enough to move forward
public
chk_dorequest() : booleen
Return values
booleen —1 = the form has been submitted, 0 = The form has not been submitted
chk_goodinput()
chk_goodinput() checks if a form field has successfully passed validation by checking the goodinputs array which is filled during validation methods.
public
chk_goodinput(mixed $inputname) : booleen
This is used to check before using get_goodinput() to retrieve the data.
Parameters
- $inputname : mixed
Return values
booleen —1 = the form field data has been validated and is good, 0 = bad input
chk_request()
Check if we have a valid method input and make sure $_GET['method'] is in $phph1_methods array in the phph1 class The methods array is set in config.php and loaded to the class in boot.php when the class handle is created THEN it checks if $_POST['dorequest'] which is a hidden field in every method formis set and sets the class variable $dorequest so it is known everywhere that a method form has been submitted
public
chk_request() : booleen
Return values
booleen —1 = the form has been submitted, 0 = The form has not been submitted
convert_atto()
Converts numbers in atto to decimal
public
convert_atto(mixed $attonum) : number
Parameters
- $attonum : mixed
Return values
number —The converted atto number in decimal format
docurlrequest()
docurlrequest() takes the generated json request for the current method from genjsonrequest() and makes the call to the API RPC Node. If rpc_call is set to 0, it generates a data object for output.
public
docurlrequest(string $thisjson) : object
If rpc_call is set to 1, it returns the raw json output from API RPC Node.
Parameters
- $thisjson : string
-
The JSON API request generated by genjsonrequest()
Return values
object —An object containing the output data
genjsonrequest()
genjsonrequest() is used by the method functions to generate the JSON request for the Node API host
public
genjsonrequest(string $method, array<string|int, mixed> $paramsarr) : string
Parameters
- $method : string
-
The method being used in this request. example: hmyv2_getBalance
- $paramsarr : array<string|int, mixed>
-
This is an array of the parameters for the method being called. It is formatted in each method function in this class
Return values
string —The formatted json data for this method request
genrequesturl()
genrequesturl() is used by the method functions to generate the PHPH1 request url for a method request
public
genrequesturl(string $method, array<string|int, mixed> $paramsarr) : string
Parameters
- $method : string
-
The method being used in this request. example: hmyv2_getBalance
- $paramsarr : array<string|int, mixed>
-
This is an array of the parameters for the method being called. It is formatted in each method function in this class
Return values
string —The URL to call from the method explorer page
get_apiaddr()
get_apiaddr() is used to get the currently used Node API address The API address is set during _construct using the supplied network and shard information
public
get_apiaddr() : string
Return values
string —The API address currently being used (example: https://a.api.s0.t.hmny.io/)
get_currentmethod()
get_currentmethod() is used to get the current method The current method is set during _contruct when creating a class handle
public
get_currentmethod() : string
Return values
string —Current method being used
get_debugstatus()
get_debugstatus() is used to determine if the script is running in debug mode or not The debug bit in the PHPH1 class is set during _construct and can be turned on and off in inc/config.php
public
get_debugstatus() : int
Return values
int —Current input status 1 = debugging on, 0 = debugging off
get_errors()
get_errors() is used to get the current array of errors from inc/boot.php and method requests The error array is generated during the validation of method inputs
public
get_errors() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of errors from the currently run method
get_goodinput()
get_goodinput() gets a validated value from user input.
public
get_goodinput(mixed $inputname) : string
When user input is being validated, every user form input that passes validation is set in the goodinputs array. When repopulating a form after submission only fields with valid input will populate from this list
Parameters
- $inputname : mixed
Return values
string —Current value for the requested form field
get_lastjson()
get_lastjson() is used to get the last (current) json request generated for a method This is used later in the Method Explorer for educational output
public
get_lastjson() : string
Return values
string —The last (current) generated JSON request
get_methods()
get_methods() is used to get the current array of available methods which was set during _construct The methods array is set in inc/config.php
public
get_methods() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of available methods
get_rpcposturl()
get_rpcurl() is used to retrieve the current RPC URL.
public
get_rpcposturl() : string
The URL is set in _construct when creating the class handle and is determined from the $phph1_apiaddresses array using the network and hsard settings in inc/config.php unless settings have been set in the Method Explorer interface
Return values
string —Current RPC URL
get_rpcstatus()
get_rpcstatus() is used to check the current rpc status bit which is set when creating a class handle This is used by the Method Explorer to determine what output to show, either graphical or raw json output for RPC calls from external scripting languages
public
get_rpcstatus() : int
Return values
int —Current RPC status
get_rpcurl()
get_rpcurl() is used to retrieve the current RPC URL.
public
get_rpcurl() : string
The URL is set in _construct when creating the class handle and is determined from the $phph1_apiaddresses array using the network and hsard settings in inc/config.php unless settings have been set in the Method Explorer interface
Return values
string —Current RPC URL
get_sessionnetwork()
get_sessionnetwork() is used to get the current network we are working on The network is set when creating a class handle in _construct and the settings are found in inc/config.php
public
get_sessionnetwork() : string
Return values
string —The current network name the class is using (example: mainnet)
get_sessionshard()
get_sessionshard() is used to get the current network shard we are working on The network shard is set when creating a class handle in _construct and the settings array is found in inc/config.php
public
get_sessionshard() : string
Return values
string —The current network shard the class is using (example: 0)
get_validinput()
get_validinput() is used to retrieve the current input validation status The validation status bit is set when validating user input
public
get_validinput() : int
Return values
int —Current input status 1 = good input, 0 = bad input
getapiaddr()
getapiaddr() is used to set the Node API host address during __construct. It gets the address using the network name and shard from $phph1_apiaddresses which is also set during __construct using settings from inc/config.php
public
getapiaddr(string $network, number $shard, mixed $phph1_apiaddresses) : string
Parameters
- $network : string
-
The network name from the $phph1_apiaddresses array, default is mainnet
- $shard : number
-
The network shard for the network we will be using, default is shard 0
- $phph1_apiaddresses : mixed
Return values
string —The URL for the API Node that was selected
hmyv2_blockNumber()
Get the current block number
public
hmyv2_blockNumber() : int
See Explorer Method Page or Harmony API Documentation for output details.
Return values
int —Current block number.
hmyv2_call()
hmyv2_call() Executes a new message call immediately, without creating a transaction on the block chain. The hmyv2_call method can be used to query internal contract state, to execute validations coded into a contract or even to test what the effect of a transaction would be without running it live.
public
hmyv2_call(string $scaddress, string $from, string $gas, string $gasprice, string $value, string $data, number $blocknum) : string
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $scaddress : string
-
The ETH address the transaction was sent to
- $from : string
-
The ETH address the transaction was sent from (optional)
- $gas : string
-
Gas to execute the smart contract call (optional)
- $gasprice : string
-
Gas price to execute smart contract call (optional)
- $value : string
-
Value sent with the smart contract call (optional)
- $data : string
-
Hash of smart contract method and parameters (optional)
- $blocknum : number
-
Block number
Return values
string —Return value of the executed smart contract.
hmyv2_epochLastBlock()
Get the last block for a specified epoch
public
hmyv2_epochLastBlock(int $epoch) : int
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $epoch : int
-
Epoch number
Return values
int —Last block of the given epoch
hmyv2_estimateGas()
hmyv2_estimateGas() Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
public
hmyv2_estimateGas(string $toaddr, string $from, string $gas, string $gasprice, string $value, string $data) : string
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $toaddr : string
-
The ETH wallet address the transaction would be sent to (required)
- $from : string
-
The ETH wallet address the transaction would be sent from (optional)
- $gas : string
-
Gas to execute the transaction (optional)
- $gasprice : string
-
Gas price to execute the transaction (optional)
- $value : string
-
Value sent with the transaction (optional)
- $data : string
-
Hash of transaction method and parameters (optional)
Return values
string —Hex value of estimated gas price for the transaction.
hmyv2_gasPrice()
Gets the current average gas price of transactions
public
hmyv2_gasPrice() : int
See Explorer Method Page or Harmony API Documentation for output details.
Return values
int —Current average gas price of transactions.
hmyv2_getAllValidatorAddresses()
Gets a list of wallet addresses that have created validators on the network.
public
hmyv2_getAllValidatorAddresses() : array<string|int, mixed>
See Explorer method page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —List of wallet addresses that have created validators on the network.
hmyv2_getAllValidatorInformation()
Gets all information for all validators.
public
hmyv2_getAllValidatorInformation(number $pagenum) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $pagenum : number
-
Page to request (page size is 100), -1 for all validators (needs to be added to explorer)
Return values
array<string|int, mixed> —List of all validator detailed information.
hmyv2_getAllValidatorInformationByBlockNumber()
Get all validator information by block number
public
hmyv2_getAllValidatorInformationByBlockNumber(int $pagenum, number $blocknum) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $pagenum : int
- $blocknum : number
-
Block number
Return values
array<string|int, mixed> —List of all validator detailed information.
hmyv2_getBalance()
Gets the current balance in atto for the specified wallet
public
hmyv2_getBalance(string $oneaddr) : number
Parameters
- $oneaddr : string
-
The ONE address of the wallet
Return values
number —Current wallet balance in atto. See Explorer Method Page or Harmony API Documentation for output details.
hmyv2_getBalanceByBlockNumber()
Gets the current balance in atto for the specified wallet at the specified block number
public
hmyv2_getBalanceByBlockNumber(string $oneaddr, number $blocknum) : number
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $blocknum : number
-
The block number to get the wallet balance from
Return values
number —Current wallet balance in atto. See Explorer Method Page or Harmony API Documentation for output details.
hmyv2_getBlockByHash()
Gets block information using the specified block hash.
public
hmyv2_getBlockByHash(string $blockhash, booleen $fulltx, booleen $incltx, booleen $withsigners, booleen $inclstaking) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blockhash : string
-
Block hash
- $fulltx : booleen
-
Include full transaction data
- $incltx : booleen
-
Include regular transactions
- $withsigners : booleen
-
Block hash
- $inclstaking : booleen
-
Include staking transactions
Return values
array<string|int, mixed> —Block information.
hmyv2_getBlockByNumber()
Gets block information using the specified block number.
public
hmyv2_getBlockByNumber(int $blocknum, mixed $fulltx, booleen $incltx, booleen $withsigners, booleen $inclstaking) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : int
-
Block number
- $fulltx : mixed
- $incltx : booleen
-
Include regular transactions
- $withsigners : booleen
-
Include the block signers information
- $inclstaking : booleen
-
Include staking transactions
Return values
array<string|int, mixed> —The block information
hmyv2_getBlocks()
Gets block information on a series of blocks between two block numbers.
public
hmyv2_getBlocks(mixed $blocknum, mixed $blocknum2, booleen $fulltx, booleen $withsigners, booleen $inclstaking) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : mixed
- $blocknum2 : mixed
- $fulltx : booleen
-
Include full transaction data
- $withsigners : booleen
-
Include the block signers information
- $inclstaking : booleen
-
Include staking transactions
Return values
array<string|int, mixed> —List of blocks and the information for each block searched
hmyv2_getBlockSignerKeys()
Gets block signer BLS keys using the specified block number.
public
hmyv2_getBlockSignerKeys(string $blocknum) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : string
-
Block number
Return values
array<string|int, mixed> —List of block signer public BLS keys.
hmyv2_getBlockSigners()
Gets a list of block signer wallet addresses using the specified block number.
public
hmyv2_getBlockSigners(mixed $blocknum) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : mixed
Return values
array<string|int, mixed> —List of block signer wallet addresses.
hmyv2_getBlockTransactionCountByHash()
Gets the number of transactions in a block using the specified block hash.
public
hmyv2_getBlockTransactionCountByHash(string $blockhash) : number
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blockhash : string
-
Block hash
Return values
number —Number of transactions in the block
hmyv2_getBlockTransactionCountByNumber()
Gets the number of transactions in a block using the specified block number.
public
hmyv2_getBlockTransactionCountByNumber(string $blocknum) : number
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : string
-
Block number
Return values
number —Number of transactions in the block
hmyv2_getCirculatingSupply()
Get the current circulating supply of tokens in ONE
public
hmyv2_getCirculatingSupply() : int
See Explorer Method Page or Harmony API Documentation for output details.
Return values
int —Circulation supply of tokens in ONE.
hmyv2_getCode()
This method can be used to distinguish between contract addresses and wallet addresses.
public
hmyv2_getCode(string $scaddress, int $blocknum) : string
Will return contract code if it's a contract and nothing (0x) if it's a wallet
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $scaddress : string
-
Smart contract address
- $blocknum : int
-
Block number
Return values
string —Return value of the executed smart contract.
hmyv2_getCurrentBadBlocks()
Gets a list of bad blocks in node memory
public
hmyv2_getCurrentBadBlocks() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details. NOTE: This method currently has known issues with the RPC not returning correctly.
Return values
array<string|int, mixed> —List of bad blocks in node memory
hmyv2_getCurrentStakingErrorSink()
Retrieves a list of transaction errors currently in the staking error sink
public
hmyv2_getCurrentStakingErrorSink() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current transaction errors in the staking error sink.
hmyv2_getCurrentTransactionErrorSink()
Retrieves a list of transaction errors currently in the transaction error sink
public
hmyv2_getCurrentTransactionErrorSink() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current errors in the transaction error sink.
hmyv2_getCurrentUtilityMetrics()
Retrieves the current utility metrics
public
hmyv2_getCurrentUtilityMetrics() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current utility metrics.
hmyv2_getCXReceiptByHash()
Query the CX receipt hash on the receiving shard endpoint
public
hmyv2_getCXReceiptByHash(mixed $txhash) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $txhash : mixed
Return values
array<string|int, mixed> —hmyv2_getDelegationsByDelegator()
Get delegations by delegator address
public
hmyv2_getDelegationsByDelegator(string $deladdr) : array<string|int, mixed>
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $deladdr : string
-
Delegator address
Return values
array<string|int, mixed> —hmyv2_getDelegationsByDelegatorByBlockNumber()
Get delegations using delegator address and block number
public
hmyv2_getDelegationsByDelegatorByBlockNumber(mixed $oneaddr, string $blocknum) : array<string|int, mixed>
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $oneaddr : mixed
- $blocknum : string
-
Block Number
Return values
array<string|int, mixed> —hmyv2_getDelegationsByValidator()
Get delegations using validator address
public
hmyv2_getDelegationsByValidator(string $oneaddr) : mixed
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $oneaddr : string
-
Validator wallet address. This is validated in boot.php
$return array List of delegations for the provided validator address
Return values
mixed —hmyv2_getElectedValidatorAddresses()
Get all elected Validator addresses
public
hmyv2_getElectedValidatorAddresses() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —List of wallet addresses that are currently elected.
hmyv2_getEpoch()
Get the current epoch
public
hmyv2_getEpoch() : int
See Explorer Method Page or Harmony API Documentation for output details.
Return values
int —The current epoch.
hmyv2_getHeaderByNumber()
Gets the block header data for the specified block number.
public
hmyv2_getHeaderByNumber(string $blocknum) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : string
-
Block number
Return values
array<string|int, mixed> —Block header data
hmyv2_getLastCrossLinks()
Get the current information on the last crosslinks
public
hmyv2_getLastCrossLinks() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —current information on the last crosslinks.
hmyv2_getLatestChainHeaders()
Gets a list of the latest beacon chain headers and their related information.
public
hmyv2_getLatestChainHeaders() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Chain header data
hmyv2_getLeader()
Get the wallet address of current leader
public
hmyv2_getLeader() : string
See Explorer Method Page or Harmony API Documentation for output details.
Return values
string —Wallet address of current leader.
hmyv2_getMedianRawStakeSnapshot()
Retrieves the median raw stake snapshot
public
hmyv2_getMedianRawStakeSnapshot() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current utility metrics.
hmyv2_getNodeMetadata()
Gets the current node metadata.
public
hmyv2_getNodeMetadata() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —List of bad blocks in node memory
hmyv2_getPendingCXReceipts()
Retrieves a list of currently pending cross shard transaction receipts
public
hmyv2_getPendingCXReceipts() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of currently pending cross shard transaction receipts.
hmyv2_getPoolStats()
Retrieves current transaction pool stats
public
hmyv2_getPoolStats() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current transaction pool stats.
hmyv2_getShardingStructure()
Get a list of all shards and their information
public
hmyv2_getShardingStructure() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Current shards on the network and their information.
hmyv2_getStakingNetworkInfo()
Retrieves current network staking information
public
hmyv2_getStakingNetworkInfo() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current utility metrics.
hmyv2_getStakingTransactionByBlockHashAndIndex()
Use this API call to retrieve a staking transaction info using block hash and transaction index
public
hmyv2_getStakingTransactionByBlockHashAndIndex(string $blockhash, int $txindex) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blockhash : string
-
Block number
- $txindex : int
-
Staking transaction index
Return values
array<string|int, mixed> —hmyv2_getStakingTransactionByBlockNumberAndIndex()
Use this API call to retrieve a staking transaction info using block number and transaction index
public
hmyv2_getStakingTransactionByBlockNumberAndIndex(int $blocknum, int $txindex) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : int
-
Block number
- $txindex : int
-
Staking transaction index
Return values
array<string|int, mixed> —hmyv2_getStakingTransactionByHash()
Use this API call to retrieve a staking transaction info using the staking transaction hash (stkhash is validated in boot.php)
public
hmyv2_getStakingTransactionByHash(string $hash) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $hash : string
-
Staking transaction hash
Return values
array<string|int, mixed> —hmyv2_getStakingTransactionsCount()
Gets the number of staking transactions for the specified ONE wallet address.
public
hmyv2_getStakingTransactionsCount(string $oneaddr, string $txtype) : number
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $txtype : string
-
The transaction type to count (ALL, SENT, RECEIVED)
Return values
number —Number of staking transactions.
hmyv2_getStakingTransactionsHistory()
Gets staking transactions history for a specified ONE wallet.
public
hmyv2_getStakingTransactionsHistory(string $oneaddr, number $pagenum, number $pagesize, booleen $fulltx, string $txtype, string $order) : string
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $pagenum : number
-
Which page of transactions to retrieve
- $pagesize : number
-
Number of transactions per page
- $fulltx : booleen
-
return full transaction data or just transaction hashes
- $txtype : string
-
Which type of transactions to display (ALL, RECEIVED, or SENT)
- $order : string
-
Sort transactions in ascending or descending order based on timestamp (ASC or DESC)
Return values
string —List of transaction hashes
hmyv2_getStorageAt()
Returns the value from a storage position at a given address, or in other words, returns the state of the contract's storage, which may not be exposed via the contract's methods.
public
hmyv2_getStorageAt(string $scaddress, string $stlocation, number $blocknum) : string
See Explorer method page or Harmony API Documentation for output details.
Parameters
- $scaddress : string
-
Smart contract address
- $stlocation : string
-
Hex representation of storage location
- $blocknum : number
-
Block number
Return values
string —Data stored at the smart contract location.
hmyv2_getSuperCommittees()
Retrieves current super committee information
public
hmyv2_getSuperCommittees() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of current utility metrics.
hmyv2_getTotalSupply()
Get the total number of pre-mined tokens
public
hmyv2_getTotalSupply() : int
See Explorer Method Page or Harmony API Documentation for output details.
Return values
int —Total number of pre-mined tokens.
hmyv2_getTransactionByBlockHashAndIndex()
Use this API call to retrieve transaction info using block hash and transaction index (blockhash is validated in boot.php)
public
hmyv2_getTransactionByBlockHashAndIndex(mixed $blockhash, int $txindex) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blockhash : mixed
- $txindex : int
-
Staking transaction index
Return values
array<string|int, mixed> —hmyv2_getTransactionByBlockNumberAndIndex()
Use this API call to retrieve transaction info using block number and transaction index
public
hmyv2_getTransactionByBlockNumberAndIndex(int $blocknum, int $txindex) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $blocknum : int
-
Block number
- $txindex : int
-
Transaction index
Return values
array<string|int, mixed> —hmyv2_getTransactionByHash()
Use this API call to retrieve transaction info using the transaction hash
public
hmyv2_getTransactionByHash(string $hash) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $hash : string
-
Transaction hash
Return values
array<string|int, mixed> —hmyv2_getTransactionReceipt()
Use this API call to retrieve transaction info using the transaction hash
public
hmyv2_getTransactionReceipt(mixed $hash) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $hash : mixed
Return values
array<string|int, mixed> —hmyv2_getTransactionsCount()
Gets the number of transactions for the specified ONE wallet address.
public
hmyv2_getTransactionsCount(string $oneaddr[, string $txtype = 'ALL' ]) : number
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $txtype : string = 'ALL'
-
The transaction type to count (ALL, SENT, RECEIVED)
Return values
number —Number of transactions.
hmyv2_getTransactionsHistory()
Gets transactions history for a specified ONE wallet.
public
hmyv2_getTransactionsHistory(string $oneaddr, number $pagenum, number $pagesize, booleen $fulltx, string $txtype, string $order) : string
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $pagenum : number
-
Which page of transactions to retrieve
- $pagesize : number
-
Number of transactions per page
- $fulltx : booleen
-
return full transaction data or just transaction hashes
- $txtype : string
-
Which type of transactions to display (ALL, RECEIVED, or SENT)
- $order : string
-
Sort transactions in ascending or descending order based on timestamp (ASC or DESC)
Return values
string —List of transaction hashes
hmyv2_getValidatorInformation()
Get all information for a validator
public
hmyv2_getValidatorInformation(string $valaddr) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $valaddr : string
-
The validator's wallet address
Return values
array<string|int, mixed> —Array of validator detailed information.
hmyv2_getValidatorKeys()
Get validator information from epoch number
public
hmyv2_getValidatorKeys(int $epoch) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $epoch : int
-
Epoch number (default is epoch 1 or everything)
Return values
array<string|int, mixed> —List of public BLS keys in the elected committee.
hmyv2_getValidators()
Get validator information from epoch number
public
hmyv2_getValidators(int $epoch) : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $epoch : int
-
Epoch number (default is epoch 1 or everything)
Return values
array<string|int, mixed> —Array of validators ONE addresses and some of their information.
hmyv2_isBlockSigner()
Gets whether specified ONE address is a block signer for a specified block number.
public
hmyv2_isBlockSigner(string $oneaddr, number $blocknum) : booleen
See Explorer Method Page for output details.
Parameters
- $oneaddr : string
-
The ONE address of the validator
- $blocknum : number
-
Block number
Return values
booleen —Returns 1 if address is a block signer
hmyv2_latestHeader()
Gets the current blockchain header information.
public
hmyv2_latestHeader() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Current blockchain header information
hmyv2_pendingStakingTransactions()
Retrieves a list of currently pending staking transactions
public
hmyv2_pendingStakingTransactions() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of currently pending staking transactions.
hmyv2_pendingTransactions()
Retrieves a list of currently pending transactions
public
hmyv2_pendingTransactions() : array<string|int, mixed>
See Explorer Method Page or Harmony API Documentation for output details.
Return values
array<string|int, mixed> —Array of currently pending transactions.
hmyv2_protocolVersion()
Gets the current network protocol version.
public
hmyv2_protocolVersion() : number
See Explorer Method Page or Harmony API Documentation for output details.
Return values
number —Protocol version
hmyv2_resendCx()
Use this API call to resend the cross shard receipt to the receiving shard to re-process if the transaction did not pay out
public
hmyv2_resendCx(mixed $txhash) : bool
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $txhash : mixed
Return values
bool —If cross shard receipt was successfully resent (true) or not (false)
hmyv2_sendRawStakingTransaction()
Send a raw staking transaction using the hex representation of a signed staking transaction
public
hmyv2_sendRawStakingTransaction(string $transhex) : string
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $transhex : string
-
Hex representation of signed staking transaction
Return values
string —if successful returns staking transaction hash. If failed it returns an error
hmyv2_sendRawTransaction()
Send a raw transaction using the hex representation of a signed transaction
public
hmyv2_sendRawTransaction(string $transhex) : string
See Explorer Method Page or Harmony API Documentation for output details.
Parameters
- $transhex : string
-
Hex representation of signed staking transaction
Return values
string —if successful returns staking transaction hash. If failed it returns an error
net_peerCount()
Gets the current number of peers on the network in the form of a hex string.
public
net_peerCount() : number
See Explorer Method Page or Harmony API Documentation for output details.
Return values
number —Protocol version in hex
phph1_prepinput()
phph1_prepinput() is used to prepare userinput for validation
public
phph1_prepinput(mixed $forminput, mixed $datatype) : string
Parameters
- $forminput : mixed
- $datatype : mixed
Return values
string —he requested input value
phph1_reset()
phph1_reset() resets all dynamic class information after a request has been finished.
public
phph1_reset() : booleen
This is intended to be used for custom built applications using the class so it can make multiple requests using a single class handle for a single page load
Return values
booleen —1 = success
set_booterrors()
set_booterrors() is used to import any pre class instantiation errors to the class errors array
public
set_booterrors(array<string|int, mixed> $boot_errors) : booleen
Parameters
- $boot_errors : array<string|int, mixed>
-
An array or boot time errors created in boot.php
Return values
booleen —1 = success, 0 = failure (in this case we should only have success)
set_rpc()
setrpc() is used to set the rpc_call variable that determines whether we are making a remote rpc call or using the explorer interface
public
set_rpc(int $rpc_call) : booleen
Parameters
- $rpc_call : int
-
Accepts a value of 1(yes this is an rpc call) or 0 (data will be used in the explorer interface)
Return values
booleen —1 = success, 0 = failure (in this case we should only have success)
set_validinput()
set_validinput() is used to set the validinput bit 1 (valid) or 0(not) This is set after validating the input data for methods so the class knows if it is okay to make the RPC call
public
set_validinput(int $valid) : booleen
Parameters
- $valid : int
-
1 = we have validated input, 0 = we an an invalid userinput in the request
Return values
booleen —1 = all inputs are validated and valid, 0 = there was an invalid input for the requested method
val_blockhash()
Validates a block hash
public
val_blockhash(mixed $blockhash) : booleen
Parameters
- $blockhash : mixed
Return values
booleen —1 = good address, 0 = bad address
val_blocknum()
Validates a block number
public
val_blocknum(mixed $blocknum) : booleen
Parameters
- $blocknum : mixed
Return values
booleen —1 = good address, 0 = bad address
val_call()
val_call() Validates user input for hmyv2_call()
public
val_call(string $scaddress, mixed $fromaddr, string $gas, string $gasprice, string $value, string $data, number $blocknum) : booleen
Parameters
- $scaddress : string
-
The ETH address the transaction was sent to
- $fromaddr : mixed
- $gas : string
-
Gas to execute the smart contract call (optional)
- $gasprice : string
-
Gas price to execute smart contract call (optional)
- $value : string
-
Value sent with the smart contract call (optional)
- $data : string
-
Hash of smart contract method and parameters (optional)
- $blocknum : number
-
Block number
Return values
booleen —1 = Good input, 0 = bad input
val_cxtxhash()
Validates a cross shard transaction hash
public
val_cxtxhash(string $trhash) : booleen
Parameters
- $trhash : string
-
The cross shard transaction hash
Return values
booleen —1 = good address, 0 = bad address
val_epoch()
Validates an epoch
public
val_epoch(mixed $epoch) : booleen
Parameters
- $epoch : mixed
Return values
booleen —1 = good address, 0 = bad address
val_epochLastBlock()
Validate input for hmyv2_epochLastBlock
public
val_epochLastBlock(int $epoch) : booleen
Parameters
- $epoch : int
-
Epoch number
Return values
booleen —1 = good input, 0 = bad input
val_estimateGas()
val_estimateGas() Validates the user input for hmyv2_estimateGas()
public
val_estimateGas(string $toaddr, mixed $fromaddr, string $gas, string $gasprice, string $value, string $data) : booleen
Parameters
- $toaddr : string
-
The ETH smart contract address the transaction would be sent to
- $fromaddr : mixed
- $gas : string
-
Gas to execute the smart contract call (optional)
- $gasprice : string
-
Gas price to execute smart contract call (optional)
- $value : string
-
Value sent with the smart contract call (optional)
- $data : string
-
Hash of smart contract method and parameters (optional)
Return values
booleen —1 = Good input, 0 = bad input
val_ethaddr()
Validates an ETH wallet address
public
val_ethaddr(mixed $addr) : booleen
Parameters
- $addr : mixed
Return values
booleen —1 = good address, 0 = bad address
val_getAllValidatorInformation()
Validation function for hmyv2_getAllValidatorInformation()
public
val_getAllValidatorInformation(int $pagenum) : int
Parameters
- $pagenum : int
-
Page number to display
Return values
int —good data = 1, bad data = 0
val_getAllValidatorInformationByBlockNumber()
Validation function for hmyv2_getAllValidatorInformationByBlockNumber
public
val_getAllValidatorInformationByBlockNumber(int $pagenum, string $blocknum) : int
Parameters
- $pagenum : int
- $blocknum : string
-
Block number
Return values
int —good data =1, bad data = 0
val_getBalance()
Validate input for hmyv2_getBalance
public
val_getBalance(string $oneaddr) : number
Parameters
- $oneaddr : string
-
The ONE address of the wallet
Return values
number —0 = bad input, 1 = good input
val_getBalanceByBlockNumber()
Validate input for hmyv2_getBalanceByBlockNumber
public
val_getBalanceByBlockNumber(string $oneaddr, string $blocknum) : number
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $blocknum : string
-
Block number
Return values
number —0 = bad input, 1 = good input
val_getBlockByHash()
Validates the input data for hmyv2_getBlockByHash()
public
val_getBlockByHash(string $blockhash, booleen $fulltx, booleen $incltx, booleen $withsigners, booleen $inclstaking) : booleen
Parameters
- $blockhash : string
-
Block hash
- $fulltx : booleen
-
Include full transaction data
- $incltx : booleen
-
Include regular transactions
- $withsigners : booleen
-
Block hash
- $inclstaking : booleen
-
Include staking transactions
Return values
booleen —1 = good data, 0 = bad data
val_getBlockByNumber()
Validates the input data for hmyv2_getBlockByNumber().
public
val_getBlockByNumber(int $blocknum, mixed $fulltx, booleen $incltx, booleen $withsigners, booleen $inclstaking) : booleen
Parameters
- $blocknum : int
-
Block number
- $fulltx : mixed
- $incltx : booleen
-
Include regular transactions
- $withsigners : booleen
-
Include the block signers information
- $inclstaking : booleen
-
Include staking transactions
Return values
booleen —1 = good data, 0 = bad data
val_getBlocks()
Validates the input for hmyv2_getBlocks().
public
val_getBlocks(int $blocknum, mixed $blocknum2, mixed $fulltx, booleen $withsigners, booleen $inclstaking) : booleen
Parameters
- $blocknum : int
-
Starting block number
- $blocknum2 : mixed
- $fulltx : mixed
- $withsigners : booleen
-
Include the block signers information
- $inclstaking : booleen
-
Include staking transactions
Return values
booleen —1 = good data, 0 = bad data
val_getBlockSignerKeys()
Validates the input data for hmyv2_getBlockSignerKeys().
public
val_getBlockSignerKeys(int $blocknum) : booleen
Parameters
- $blocknum : int
-
Block number
Return values
booleen —1 = good data, 0 = bad data
val_getBlockSigners()
Validates the input data for hmyv2_getBlockSigners()
public
val_getBlockSigners(string $blocknum) : booleen
Parameters
- $blocknum : string
-
Block number
Return values
booleen —1 = good data, 0 = bad data
val_getBlockTransactionCountByHash()
Validates the input data for hmyv2_getBlockTransactionCountByHash()
public
val_getBlockTransactionCountByHash(string $blockhash) : booleen
Parameters
- $blockhash : string
-
Block hash
Return values
booleen —1 = good data, 0 = bad data
val_getBlockTransactionCountByNumber()
Validates the input data for hmyv2_getBlockTransactionCountByNumber().
public
val_getBlockTransactionCountByNumber(int $blocknum) : booleen
Parameters
- $blocknum : int
-
Block number
Return values
booleen —1 = good data, 0 = bad data
val_getCode()
Validates hmyv2_getCode input
public
val_getCode(string $scaddress, int $blocknum) : string
Parameters
- $scaddress : string
-
Smart contract address
- $blocknum : int
-
Block number
Return values
string —Return value of the executed smart contract.
val_getCXReceiptByHash()
Validate the CX receipt transaction hash input for hmyv2_getCXReceiptByHash
public
val_getCXReceiptByHash(string $txhash) : booleen
Parameters
- $txhash : string
-
Cross shard receipt transaction hash
Return values
booleen —good input = 1, bad input = 0
val_getDelegationsByDelegator()
Validation function for hmyv2_getDelegationsByDelegator()
public
val_getDelegationsByDelegator(string $oneaddr) : booleen
Parameters
- $oneaddr : string
-
delegate ONE address
Return values
booleen —1 = Good input, 0 = bad input
val_getDelegationsByDelegatorByBlockNumber()
Validation function for hmyv2_getDelegationsByDelegatorByBlockNumber()
public
val_getDelegationsByDelegatorByBlockNumber(string $oneaddr, string $blocknum) : int
Parameters
- $oneaddr : string
-
Delegator address
- $blocknum : string
-
Block Number
Return values
int —good data = 1, bad data = 0
val_getDelegationsByValidator()
Validation function for hmyv2_getDelegationsByValidator()
public
val_getDelegationsByValidator(string $oneaddr) : int
Parameters
- $oneaddr : string
-
Validator address
Return values
int —good data = 1, bad data = 0
val_getHeaderByNumber()
Validates the input data for hmyv2_getHeaderByNumber()
public
val_getHeaderByNumber(string $blocknum) : booleen
Parameters
- $blocknum : string
-
Block number
Return values
booleen —1 = good data, 0 = bad data
val_getStakingTransactionByBlockHashAndIndex()
Validate input for hmyv2_getStakingTransactionByBlockHashAndIndex (blockhash is validated in boot.php)
public
val_getStakingTransactionByBlockHashAndIndex(string $blockhash, string $txindex) : booleen
Parameters
- $blockhash : string
-
Block hash
- $txindex : string
-
Staking transaction index
Return values
booleen —1 = good input, 0 = bad input
val_getStakingTransactionByBlockNumberAndIndex()
Validate input for val_getStakingTransactionByBlockNumberAndIndex (blocknum is validated in boot.php)
public
val_getStakingTransactionByBlockNumberAndIndex(int $blocknum, int $txindex) : booleen
Parameters
- $blocknum : int
-
Block number
- $txindex : int
-
Staking transaction index
Return values
booleen —1 = good input, 0 = bad input
val_getStakingTransactionByHash()
Validate input for hmyv2_getStakingTransactionByHash
public
val_getStakingTransactionByHash(string $hash) : booleen
Parameters
- $hash : string
-
Staking transaction hash
Return values
booleen —1 = good input, 0 = bad input
val_getStakingTransactionsCount()
Validates the input for hmyv2_getStakingTransactionsCount().
public
val_getStakingTransactionsCount(string $oneaddr, string $txtype) : booleen
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $txtype : string
-
The transaction type to count (ALL, SENT, RECEIVED)
Return values
booleen —1 = good input, 0 = bad input
val_getStakingTransactionsHistory()
Validates the input data for hmyv2_getStakingTransactionsHistory().
public
val_getStakingTransactionsHistory(string $oneaddr, number $pagenum, number $pagesize, booleen $fulltx, string $txtype, string $order) : booleen
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $pagenum : number
-
Which page number of transactions to retrieve
- $pagesize : number
-
Number of transactions per page
- $fulltx : booleen
-
return full transaction data or just transaction hashes
- $txtype : string
-
Which type of transactions to display (ALL, RECEIVED, or SENT)
- $order : string
-
Sort transactions in ascending or descending order based on timestamp (ASC or DESC)
Return values
booleen —1 = good input, 0 = bad input
val_getStorageAt()
Validation function for hmyv2_getStorageAt()
public
val_getStorageAt(string $scaddress, string $stlocation, number $blocknum) : booleen
Parameters
- $scaddress : string
-
Smart contract address
- $stlocation : string
-
Hex representation of storage location
- $blocknum : number
-
Block number
Return values
booleen —1 = Good input, 0 = bad input
val_getTransactionByBlockHashAndIndex()
Validate input for val_getTransactionByBlockHashAndIndex (blockhash is validated in boot.php)
public
val_getTransactionByBlockHashAndIndex(string $blockhash, string $txindex) : booleen
Parameters
- $blockhash : string
-
Block hash
- $txindex : string
-
Transaction index
Return values
booleen —1 = good input, 0 = bad input
val_getTransactionByBlockNumberAndIndex()
Validate input for hmyv2_getTransactionByBlockNumberAndIndex (blocknum is validated in boot.php)
public
val_getTransactionByBlockNumberAndIndex(int $blocknum, int $txindex) : booleen
Parameters
- $blocknum : int
-
Block number
- $txindex : int
-
Staking transaction index
Return values
booleen —1 = good input, 0 = bad input
val_getTransactionByHash()
Validate input for hmyv2_getTransactionByHash
public
val_getTransactionByHash(int $hash) : booleen
Parameters
- $hash : int
-
hash
Return values
booleen —1 = good input, 0 = bad input
val_getTransactionReceipt()
Validate input for hmyv2_getTransactionReceipt
public
val_getTransactionReceipt(int $hash) : booleen
Parameters
- $hash : int
-
hash
Return values
booleen —1 = good input, 0 = bad input
val_getTransactionsCount()
Validates the input for hmyv2_getTransactionsCount().
public
val_getTransactionsCount(string $oneaddr, string $txtype) : booleen
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $txtype : string
-
The transaction type to count (ALL, SENT, RECEIVED)
Return values
booleen —1 = good input, 0 = bad input
val_getTransactionsHistory()
Validates the input data for hmyv2_getTransactionsHistory().
public
val_getTransactionsHistory(string $oneaddr, number $pagenum, number $pagesize, booleen $fulltx, string $txtype, string $order) : booleen
Parameters
- $oneaddr : string
-
The ONE address of the wallet
- $pagenum : number
-
Which page of transactions to retrieve
- $pagesize : number
-
Number of transactions per page
- $fulltx : booleen
-
return full transaction data or just transaction hashes
- $txtype : string
-
Which type of transactions to display (ALL, RECEIVED, or SENT)
- $order : string
-
Sort transactions in ascending or descending order based on timestamp (ASC or DESC)
Return values
booleen —1 = good input, 0 = bad input
val_getValidatorInformation()
Validation function for hmyv2_getValidatorInformation
public
val_getValidatorInformation(string $oneaddr) : int
Parameters
- $oneaddr : string
-
The validator's wallet address
Return values
int —good data =1, bad data = 0
val_getValidatorKeys()
Validate input for hmyv2_getValidatorKeys
public
val_getValidatorKeys(int $epoch) : booleen
Parameters
- $epoch : int
-
Epoch number
Return values
booleen —1 = good input, 0 = bad input
val_getValidators()
Validate input for hmyv2_getValidators
public
val_getValidators(int $epoch) : booleen
Parameters
- $epoch : int
-
Epoch number
Return values
booleen —1 = good input, 0 = bad input
val_hash()
Validates a hash
public
val_hash(mixed $hash) : booleen
Parameters
- $hash : mixed
Return values
booleen —1 = good address, 0 = bad address
val_isBlockSigner()
Validation for hmyv2_isBlockSigner
public
val_isBlockSigner(string $oneaddr, number $blocknum) : booleen
Parameters
- $oneaddr : string
-
The ONE address of the validator
- $blocknum : number
-
Block number
Return values
booleen —good data = 1, bad data = 0
val_oneaddr()
Validates a ONE wallet address
public
val_oneaddr(mixed $oneaddr) : booleen
Parameters
- $oneaddr : mixed
Return values
booleen —1 = good address, 0 = bad address
val_resendCx()
Validate the cross transaction receipt transaction hash input for hmyv2_resendCx
public
val_resendCx(string $txhash) : booleen
Parameters
- $txhash : string
-
Cross shard receipt transaction hash
Return values
booleen —good input = 1, bad input = 0
val_scaddress()
Validates a smart contract address
public
val_scaddress(string $scaddress) : booleen
Parameters
- $scaddress : string
-
The smart contract address
Return values
booleen —1 = good address, 0 = bad address
val_sendRawStakingTransaction()
Validate input for hmyv2_sendRawStakingTransaction
public
val_sendRawStakingTransaction(string $transhex) : booleen
Parameters
- $transhex : string
-
Hex representation of signed staking transaction
Return values
booleen —1 = good input, 0 = bad input
val_sendRawTransaction()
Validate input for hmyv2_sendRawTransaction
public
val_sendRawTransaction(string $transhex) : booleen
Parameters
- $transhex : string
-
Hex representation of signed staking transaction
Return values
booleen —1 = good input, 0 = bad input
val_stlocation()
Validates storage location
public
val_stlocation(string $stlocation) : booleen
Parameters
- $stlocation : string
-
The storage location hash
Return values
booleen —1 = good address, 0 = bad address
val_txindex()
Validates transaction index
public
val_txindex(int $txindex) : booleen
Parameters
- $txindex : int
-
The transaction index
Return values
booleen —1 = good transaction index, 0 = bad transaction index