PHP code example of kyber / monitor-kyber-tx

1. Go to this page and download the library: Download kyber/monitor-kyber-tx library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kyber / monitor-kyber-tx example snippets


 

\Monitor;

$monitor = new Monitor([
  'node' => 'https://ropsten.infura.io',
  'network' => 'ropsten',
  'blockConfirm' => 7,
  'txLostTimeout' => 15, // minutes
  'intervalRefetchTx' => 10, // seconds
  'checkPaymentValid' => true,
  'receivedAddress' => '0x63b42a7662538a1da732488c252433313396eade',
  'amount' => 0.05,
  'receivedToken' => "OMG",
  'useIntervalLoop' => false
]);

$tx = '0x5388158e57fecefd3a850283f606ab58e4670c29f730f470ab7f413551c01af4';
$data = $monitor->checkStatus($tx);


[
  "status" => "SUCCESS",  // "FAIL" , "LOST"
  "from" => [
    "address" => "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "decimal" => 18,
    "symbol" => "ETH",
    "amount" => "0.001",
  ],
  "to" => [
    "address" => "0x4e470dc7321e84ca96fcaedd0c8abcebbaeb68c6",
    "decimal"=> 18,
    "symbol" => "KNC",
    "amount" => "0.368905346628",
  ],
  "sentAddress" => "0x3cf628d49ae46b49b210f0521fbd9f82b461a9e1",
  "receivedAddress" => "0x3cf628d49ae46b49b210f0521fbd9f82b461a9e1",
  "timestamp" => 1543398038,
  "type" => "pay",  // "transfer" , "trade"

  "paymentValid" => "true",
  "paymentData" => "abc123asdasdasdassd3e423wsdfsdfsdfsdfdsfsdfsdfdsfsdfghfgh",
]

 

\Monitor;

$monitor = new Monitor([
  'node' => 'https://ropsten.infura.io',
  'network' => 'ropsten',
  'useIntervalLoop' => false
]);

$monitor->recheckTxDB();