Releases: t3ran13/php-graphene-node-client
Releases · t3ran13/php-graphene-node-client
Broadcast critical bug was fixed
- added flag JSON_UNESCAPED_UNICODE to json_encode function for multi-byte symbols in transactions
- deleted trash from code
hack for fix bug of spec256k1-php and updates
- hack for fix bug of spec256k1-php
- tx init upd
- Op* classes upd
- readme upd
HTTP Connector For Steemit
- HTTP connector for steemit
- SteemitHttpConnector in InitConnector by default
New Broadcast Operations
- new broadcast operations
- transfer
- comment
- new operation serializer structure
Transactions/Broadcast
In Release
- broadcast (example for vote)
- tools for broadcast
- bag fixes for broadcast commands
Install Via Composer
For readonly, without broadcast
composer require t3ran13/php-graphene-node-client
with broadcast (sending transactions to blockchain)
(details and dockerfile here)
install components
- automake
- libtool
- libgmp-dev
install extensions
- secp256k1 (how to install (secp256k1-php)[https://github.com/Bit-Wasp/secp256k1-php])
- gmp
broadcast_api operations templates
- vote
<?php
use GrapheneNodeClient\Tools\ChainOperations\OpVote;
use GrapheneNodeClient\Tools\Transaction;
$answer = OpVote::doSynchronous(
Transaction::CHAIN_STEEM, //Transaction::CHAIN_GOLOS
'guest123',
'5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg',
'firepower',
'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians',
10000
);
// example of answer
//Array
//(
// [id] => 5
// [result] => Array
// (
// [id] => a2c52988ea870e446480782ff046994de2666e0d
// [block_num] => 17852337
// [trx_num] => 1
// [expired] =>
// )
//
//)
Transaction for blockchain (broadcast)
<?php
use GrapheneNodeClient\Tools\Transaction;
/** @var CommandQueryData $tx */
$tx = Transaction::init($chainName);
$tx->setParamByKey(
'0:operations:0',
[
'vote',
[
'voter' => $voter,
'author' => $author,
'permlink' => $permlink,
'weight' => $weight
]
]
);
if (Transaction::CHAIN_GOLOS === $chainName) {
$connector = new GolosWSConnector();
} elseif (Transaction::CHAIN_STEEM === $chainName) {
$connector = new SteemitWSConnector();
}
$command = new BroadcastTransactionSynchronousCommand($connector);
Transaction::sign($chainName, $tx, ['posting' => $publicWif]);
$answer = $command->execute(
$tx
);
WARNING
Transactions are signing with spec256k1-php with function secp256k1_ecdsa_sign_recoverable($context, $signatureRec, $msg32, $privateKey) and if it is not canonical from first time, you have to make transaction for other block. For searching canonical sign function have to implement two more parameters, but spec256k1-php library does not have it.
new commands and bugfix
New commands in database api:
- get_active_votes,
- get_content_replies,
- get_current_median_history_price
Bugfix
- get_accounts need array
Bug fix in WSConnectorAbstract.php
reassign variable name was fixed
Bug fix in WSConnectorAbstract.php
Check that answer has the same id or id from previous tries, else it is answer from other request
Recall to API And reserve nodes
WSConnectorAbstract.php was updated
- possibility to recall to API when getting error in answer (default $maxNumberOfTriesToCallApi = 3)
- possibility to connetc to reserve nodes (after $maxNumberOfTriesToCallApi tries recall you can connect to reserve nodes)
Use
<?php
namespace My\App\Commands;
use GrapheneNodeClient\Commands\DataBase\CommandAbstract;
use GrapheneNodeClient\Connectors\ConnectorInterface;
class GolosWSConnector extends WSConnectorAbstract
{
/**
* @var string
*/
protected $platform = self::PLATFORM_GOLOS;
/**
* max number of tries to get answer from the node
*
* @var int
*/
protected $maxNumberOfTriesToCallApi = 3;
/**
* wss or ws servers, can be list. First node is default, other are reserve.
* After $maxNumberOfTriesToCallApi tries connects to default it is connected to reserve node.
*
* @var string|array
*/
protected $nodeURL = ['wss://ws.golos.io', 'wss://api.golos.cf'];
}
New commands
database_api
- GetBlockHeaderCommand
- GetAccountCountCommand
- GetAccountHistoryCommand
- GetAccountVotesCommand