Skip to content

owenvoke/btgexp-api

Repository files navigation

btgexp-api

Latest Version on Packagist Software License Build Status Style CI Code Coverage Total Downloads

An API wrapper for BTGexp.com

Structure

src/
tests/
vendor/

Install

Via Composer

$ composer require pxgamer/btgexp-api

Usage

Basic methods

Initialise the Basic class.

$basic = new pxgamer\BTGExp\Basic();

Retrieve the current difficulty as a double.

$basic->getDifficulty();

Retrieve the current connection count as an integer.

$basic->getConnectionCount();

Retrieve the current block count as an integer.

$basic->getBlockCount();

Retrieve the block hash for a specified index.

$basic->getBlockHashByIndex(int $index);

Retrieve a Block instance by hash.

$basic->getBlockByHash(string $hash);

Retrieve a transaction as a string or a Transaction instance.

// As a Transaction instance (default).
$basic->getTransactionById(string $hash, true);
// As an encrypted string.
$basic->getTransactionById(string $hash, false);

Retrieve the current network hash rate (hash/s) as a double.

$basic->getNetworkHashRate();

Extended methods

Initialise the Extended class.

$extended = new pxgamer\BTGExp\Extended();

Retrieve the current money supply as a double.

$extended->getMoneySupply();

Retrieve the current network details as a Network instance.

$extended->getNetwork();

Retrieve information for an address as an Address instance.

$extended->getAddress(string $address);

Retrieve the balance for an address as a double.

$extended->getBalance(string $address);

Retrieve the latest transactions as an array.

$extended->getLastTransactions();
$extended->getLastTransactions(int $count);
$extended->getLastTransactions(int $count, int $min);

Retrieve the last 7 blocks as an array.

$extended->getLastBlocks();

Retrieve a Block instance specified by it's height.

$extended->getBlockByHeight(int $height);

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email owzie123@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.