Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
xboston committed Aug 26, 2019
2 parents 717df60 + cc01691 commit 47a27de
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 202 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ composer require xboston/metahash
- [x] get-dump-block-by-number
- [x] get-dump-block-by-hash
- [x] get-count-blocks
- [x] get-forging-sum
- [x] get-last-node-stat-result
- [x] get-last-node-stat-trust
- [x] get-last-node-stat-count
- [x] get-last-nodes-stats-count
- [x] get-all-last-nodes-count
- [x] get-nodes-raiting
- [x] get-common-balance
- [x] status
- [x] mhc_send
- [x] getinfo
Expand Down
100 changes: 50 additions & 50 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 34 additions & 32 deletions examples/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,69 @@
$metaHash = new MetaHash();
$metaHash->setNetwork(MetaHash::NETWORK_MAIN);

$key = $metaHash->generateKey();
Dump::d('generateKey', $key);
Dump::d('generateKey', $metaHash->generateKey());

// torrent nodes
$fetchBalance = $metaHash->fetchBalance('0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833');
Dump::d('fetchBalance', $fetchBalance);
Dump::d('fetch-balance', $metaHash->fetchBalance('0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833'));

$fetchBalances = $metaHash->fetchBalances([
'0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833',
'0x0033626a3977271fd3d1c47e05e3f34c69f38661bdebacad65',
]);
Dump::d('fetchBalances', $fetchBalances);
Dump::d('fetch-balances', $fetchBalances);

$fetchHistory = $metaHash->fetchHistory('0x00312d149c348120faffe00ca275d012e2a64524979df899d3');
Dump::d('fetchHistory', $fetchHistory);
Dump::d('fetch-history', $metaHash->fetchHistory('0x00312d149c348120faffe00ca275d012e2a64524979df899d3'));

$fetchHistory10 = $metaHash->fetchHistory('0x00312d149c348120faffe00ca275d012e2a64524979df899d3', 10);
Dump::d('fetchHistory 10', $fetchHistory10);
Dump::d('fetch-history 10', $metaHash->fetchHistory('0x00312d149c348120faffe00ca275d012e2a64524979df899d3', 10));

$fetchHistory1010 = $metaHash->fetchHistory('0x00312d149c348120faffe00ca275d012e2a64524979df899d3', 10, 10);
Dump::d('fetchHistory 10 10', $fetchHistory1010);
Dump::d('fetch-history 10 10', $metaHash->fetchHistory('0x00312d149c348120faffe00ca275d012e2a64524979df899d3', 10, 10));

$filter = new HistoryFilters();
$filter->setIsForging(true);
$fetchHistoryFilter = $metaHash->fetchHistoryFilter('0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833', $filter, 2);
Dump::d('fetchHistoryFilter', $fetchHistoryFilter);
Dump::d('fetch-history-filter', $fetchHistoryFilter);

Dump::d('get-tx', $metaHash->getTx('dd86635a7d7a8d8d44fc604f5fbb51eeb920dd28611b0f634e40b60af02a8c68'));

Dump::d('get-block-by-hash', $metaHash->getBlockByHash('c59b4fd84827c5b836c46c51aacd5b70d640ef2d79e527d0d7ee5579253c197e', 2));

Dump::d('get-block-by-number', $metaHash->getBlockByNumber(1074984, 2));

Dump::d('get-last-txs', $metaHash->getLastTxs());

Dump::d('get-last-txs', $metaHash->getBlocks(10, 10));

Dump::d('get-dump-block-by-hash', $metaHash->getDumpBlockByHash('c59b4fd84827c5b836c46c51aacd5b70d640ef2d79e527d0d7ee5579253c197e', true));

Dump::d('get-dump-block-by-number', $metaHash->getDumpBlockByNumber(1074984, true));

Dump::d('get-count-blocks', $metaHash->getCountBlocks());

$getTx = $metaHash->getTx('dd86635a7d7a8d8d44fc604f5fbb51eeb920dd28611b0f634e40b60af02a8c68');
Dump::d('getTx', $getTx);
Dump::d('get-forging-sum', $metaHash->getForgingSum(1));

$getBlockByHash = $metaHash->getBlockByHash('c59b4fd84827c5b836c46c51aacd5b70d640ef2d79e527d0d7ee5579253c197e', 2);
Dump::d('getBlockByHash', $getBlockByHash);
Dump::d('get-last-node-stat-result', $metaHash->getLastNodeStatResult('0x00d5b768fee94349103e2f69484dff207a3bbb2a5077defd6e'));

$getBlockByNumber = $metaHash->getBlockByNumber(1074984, 2);
Dump::d('getBlockByNumber', $getBlockByNumber);
Dump::d('get-last-node-stat-trust', $metaHash->getLastNodeStatTrust('0x00d5b768fee94349103e2f69484dff207a3bbb2a5077defd6e'));

$getLastTxs = $metaHash->getLastTxs();
Dump::d('getLastTxs', $getLastTxs);
Dump::d('get-last-node-stat-count', $metaHash->getLastNodeStatCount('0x00d5b768fee94349103e2f69484dff207a3bbb2a5077defd6e'));

$getLastTxs = $metaHash->getBlocks(10, 10);
Dump::d('getLastTxs', $getLastTxs);
Dump::d('get-last-nodes-stats-count', $metaHash->getLastNodesStatsCount());

$getDumpBlockByHash = $metaHash->getDumpBlockByHash('c59b4fd84827c5b836c46c51aacd5b70d640ef2d79e527d0d7ee5579253c197e', true);
Dump::d('getDumpBlockByHash', $getDumpBlockByHash);
Dump::d('get-all-last-nodes-count', $metaHash->getAllLastNodesCount(2));

$getDumpBlockByNumber = $metaHash->getDumpBlockByNumber(1074984, true);
Dump::d('getDumpBlockByNumber', $getDumpBlockByNumber);
Dump::d('get-nodes-raiting', $metaHash->getNodesRaiting('0x00d5b768fee94349103e2f69484dff207a3bbb2a5077defd6e', 2));

$getCountBlocks = $metaHash->getCountBlocks();
Dump::d('getCountBlocks', $getCountBlocks);
Dump::d('get-common-balance', $metaHash->getCommonBalance());

$status = $metaHash->status();
Dump::d('status', $status);
Dump::d('status', $metaHash->status());

// proxy nodes
$key = $metaHash->generateKey();
$sendTx = $metaHash->sendTx($key['private'], '0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833', 0, 'https://github.com/xboston/php-metahash');
Dump::d('sendTx', $sendTx);
Dump::d('mhc_send', $sendTx);

$getInfo = $metaHash->getInfo();
Dump::d('getInfo', $getInfo);
Dump::d('getinfo', $getInfo);

// extra methods
$getNonce = $metaHash->getNonce('0x00fa2a5279f8f0fd2f0f9d3280ad70403f01f9d62f52373833');
Expand Down
Loading

0 comments on commit 47a27de

Please sign in to comment.