Set of classes to deal with EIYARO
's API
.
Common code:
include __DIR__ . '/vendor/autoload.php';
$base_uri = 'https://api.eiyaro.com';
$accessToken = null;
use EIYARO\API;
$api = new API($base_uri, $accessToken);
echo "== Net Info ==\n";
$netInfo = $api->getNetInfo();
echo json_encode($netInfo) . "\n";
echo "==============\n\n";
echo "== Block Count ==\n";
$blockCount = $api->getBlockCount();
echo "Height: {$blockCount}\n";
echo "=================\n\n";
echo "== Block ==\n";
$block = $api->getBlock($6635);
echo "Block({$blockCount}): {$block->hash}\n";
echo "===========\n\n";
echo "== Transaction ==\n";
try {
$transaction = $api->getTransaction("fc64be31e56a448879f9984599cafead466ec5b1a985c6ce8e6d45685c55b7d1");
echo json_encode($transaction, JSON_PRETTY_PRINT) . "\n";
} catch (Exception $e) {
echo "Error: ". $e->getMessage() ."\n";
}
echo "===========\n\n";
echo "== List Pending Transactions ==\n";
$transactions = $api->getPendingTransactions();
echo json_encode($transactions, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";
echo "== Get Pending Transaction ==\n";
$transaction = $api->getPendingTransaction("fc64be31e56a448879f9984599cafead466ec5b1a985c6ce8e6d45685c55b7d1");
echo json_encode($transaction, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";
echo "== List Assets ==\n";
$assets = $api->getAssets();
echo json_encode($assets, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";
echo "== Get Asset ==\n";
$asset = $api->getAsset('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
echo json_encode($asset, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";