eiyaro / core-php
Set of classes to deal with EIYARO's API
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/eiyaro/core-php
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.8
README
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";