PHPH1 elephant logo

Description

Parameters

  • No Parameters Required

Returns

  • Array of Object
    List of regular & smart contract transactions in the transaction pool
  • blockHash - String:
    Block hash that transaction was finalized. null if the transaction is pending.
  • blockNumber - Number:
    Block number that transaction was finalized. null if the transaction is pending.
  • ethHash - String:
    ETH hash
  • from - String:
    Wallet address
  • gas - Number:
    Gas limit in Atto
  • gasPrice - Number:
    Gas price in Atto
  • hash - String:
    Transaction hash
  • input - String:
    Transaction data, used for smart contracts
  • nonce - Number:
    Wallet nonce for the transaction
  • r - String:
    FIXME
  • s - String:
    FIXME
  • shardID - Number :
    Shard where amount is from
  • timestamp - Number:
    Timestamp in Unix time when transaction was finalized
  • to - String:
    Wallet address of receiver
  • toShardID - Number :
    Shard where the amount is sent
  • transactionIndex - Number:
    Index of transaction in block. null if the transaction is pending.
  • v - String:
    FIXME
  • value - Number:
    Amount transfered in Atto
{"jsonrpc":"2.0","id":1,"method":"hmyv2_pendingTransactions","params":[]}			

<script>
// In a production environment this function should probably be expanded with response and error checks etc.
async function getHMYV2Data(){
	// This URL is for mainnet shard 0
  let response = await fetch('https://a.api.s0.t.hmny.io/', {
    method: "POST",
    body: '{"jsonrpc":"2.0","id":1,"method":"hmyv2_pendingTransactions","params":[]}',
    headers: { "Content-type": "application/json" }
  });

  let mydata = await response.json();

  // Check the console for output
  console.log("method data:" + JSON.stringify(mydata));
  // What you do with the returned data after this is up to you
}

// Run the getHMYV2Data function
getHMYV2Data();
</script>
	

<script>
// You can reuse this function with multiple methods
// In a production environment this function should probably be expanded with response and error checks etc.
async function getPHPH1Data(url, formdata){
  let response = await fetch(url, {
    method: "POST",
    body: formdata,
    headers: { "Content-type": "application/x-www-form-urlencoded" }
  });

  let mydata = await response.json();

  // Check the console for output
  console.log("method data:" + JSON.stringify(mydata));
  // What you do with the returned data after this is up to you
}

// This is the call URL. It will always require the method being used to be sent in the URL
// Depending on your setup, you may need to adjust the path to this url
// For example: /your/path/to/phph1/phph1_call.php?method=hmyv2_pendingTransactions
var url = "phph1_call.php?method=hmyv2_pendingTransactions";

// The formdata variable is always set
// Even if there is no form data we need the dorequest sent
var formdata = "dorequest=1";

// Run the getPHPH1Data function
getPHPH1Data(url, formdata);
</script>