This package allows you to read from BitShares network from selected BitShares node. Package does not contain signing operations so any operation which needs signing does not work.
composer require codaone/bitshares-php
- PHP >= 7.0
All methods are passed as rpc meh
$bitShares = new BitShares('wss://node.com');
$block = $bitShares->getBlock('40385973');
$bitShares->getChainId();
Getting data from named api
$bitShares = new BitShares('wss://node.com');
$block = $bitShares->call('history', 'method_name', ['param1', 'param2']);
$account = new Account('account-name');
$openorders = $account->getOpenOrders();
foreach($openorders as $order) {
...
}
$market = new Market('BTS/USD'); // delimiter can also be : _ -
$market->getVolume24h('BTS')->getAmount();
$market->getTicker();
$market->getOrderBook(25)->getAsks();
$asset = new Asset('BTS');
$asset->getId(); // 1.3.0
$asset->getPrecision(); // 5
Every class under Component namespace extends Object class which is iterable and has arrayAccess. This means that for example these are possible:
$market = new Market('BTS/USD');
$market->getBase()->getSymbol(); // BTS
$market['base']['symbol]; // BTS
$account = new Account('account-name');
$account->getData('owner/weight_threshold');
$account['owner']['weight_threshold'];
$account->getBalances(); // returns balances array
$account->getData('balances/0/asset_type');
$account['balances'][0]['asset_type'];
foreach($account as $key => $value) {
...
}
Feel free to open pull requests or add an issue
A copy of the license is available in the repository's LICENSE file.