Skip to content

EIYARO-Project/core-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EIYARO Core-PHP

Supports Windows Supports Linux License Latest Release Downloads

Set of classes to deal with EIYARO's API.

Examples

Common code:

include __DIR__ . '/vendor/autoload.php';

$base_uri = 'https://api.eiyaro.com';
$accessToken = null;

use EIYARO\API;

$api = new API($base_uri, $accessToken);

Net Info

echo "== Net Info ==\n";
$netInfo = $api->getNetInfo();
echo json_encode($netInfo) . "\n";
echo "==============\n\n";

Block Count

echo "== Block Count ==\n";
$blockCount = $api->getBlockCount();
echo "Height: {$blockCount}\n";
echo "=================\n\n";

Block

echo "== Block ==\n";
$block = $api->getBlock($6635);
echo "Block({$blockCount}): {$block->hash}\n";
echo "===========\n\n";

Transaction

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";

List Pending Transactions

echo "== List Pending Transactions ==\n";
$transactions = $api->getPendingTransactions();
echo json_encode($transactions, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";

Get Pending Transaction

echo "== Get Pending Transaction ==\n";
$transaction = $api->getPendingTransaction("fc64be31e56a448879f9984599cafead466ec5b1a985c6ce8e6d45685c55b7d1");
echo json_encode($transaction, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";

List Assets

echo "== List Assets ==\n";
$assets = $api->getAssets();
echo json_encode($assets, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";

Get Asset

echo "== Get Asset ==\n";
$asset = $api->getAsset('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
echo json_encode($asset, JSON_PRETTY_PRINT)."\n";
echo "===========\n\n";