New Functional And Fixes [PHP Graphene Node Client v4.0.0 & v4.0.1]

in #utopian-io6 years ago (edited)

php-graphene-node-client

It is PHP API client for Steem/GOLOS blockchain

Github or packagist with MIT license. Author @t3ran13 and active helper @semasping

In Release v4.0.0

  • requests format was changed to json-rpc2.0 style
  • single commands was moved to Single namespace
  • new Commads class with commands aggregator
  • string serializer critical bug was fixed

In Release v4.0.1

  • fix critical bug of connectors
  • upd php version in composer.json

Requests format was changed to json-rpc2.0 style

If you use connectors from php-graphene-node-client it will send requests to node STEEM/GOLOS with json-rpc2.0 style.

Single commands was moved to Single namespace

All static commands have GrapheneNodeClient\Commands\Single namespace since v4.0.0 .
You have to fix namespaces of all user commands, example

//was 
namespace GrapheneNodeClient\Commands\Broadcast

$coomand = new BroadcastTransactionCommand($connector);

//now
namespace GrapheneNodeClient\Commands\Single

$coomand = new BroadcastTransactionCommand($connector);

New commads class with commands aggregator

Before v4.0.0 you have to use only static commands. Now you have choice and can use only 1 class for all commands, see example below

<?php

use GrapheneNodeClient\Commands\CommandQueryData;
use GrapheneNodeClient\Commands\Commands;
use GrapheneNodeClient\Commands\Single\GetDiscussionsByCreatedCommand;
use GrapheneNodeClient\Connectors\WebSocket\GolosWSConnector;


//Set params for query
$commandQuery = new CommandQueryData();
$data = [
    [
        'limit'       => $limit,
        'select_tags' => ['golos'], // for GOLOS
        'tag'         => 'steemit', // for STEEMIT     
    ]
];
$commandQuery->setParams($data);

//OR 
$commandQuery = new CommandQueryData();
$commandQuery->setParamByKey('0:limit', $limit);
$commandQuery->setParamByKey('0:select_tags', [$tag]);
$commandQuery->setParamByKey('0:tag', $tag);


//and use single command
$command = new GetDiscussionsByCreatedCommand(new GolosWSConnector());
$golosPosts = $command->execute(
    $commandQuery
);

//or commands aggregator class
$commands = new Commands(new GolosWSConnector());
$golosPosts = $commands->get_discussions_by_created()
    ->execute(
       $commandQuery
);

String serializer critical bug was fixed

If you used permlink, post body or other strings with length more than 128 symbols it was leading to error "3030000 tx_missing_posting_auth: missing required posting authority". It was fixed.

Fix critical bug of connectors

Before v4.0.1 reconnection to node when got wrong answer did not work properly, it was fixed and now you can use few nodes in your connector and make few tries to get answer from node.

<?php

namespace My\App\Commands;

use GrapheneNodeClient\Commands\Single\CommandAbstract;
use GrapheneNodeClient\Connectors\ConnectorInterface;

class SteemWSConnector extends WSConnectorAbstract
{
    /**
     * @var string
     */
    protected $platform = self::PLATFORM_STEEMIT;

    /**
     * waiting answer from Node during $wsTimeoutSeconds seconds
     *
     * @var int
     */
    protected $wsTimeoutSeconds = 5;

    /**
     * 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://steemd.minnowsupportproject.org', 'wss://rpc.buildteam.io'];
}

Upd php version for lib

Minimal version of php for properly working php-graphene-node-client was updated to 7.0


It is better with each commit

Commits were done by me for release v4.0.0 and v4.0.1

  • Merge pull request #12 from semasping/0.17.0 (utopian details here )
  • del LoginCommand.php
  • upd commands partly
  • upd Commands.php
  • upd commands partly
  • upd README.md
  • fix critical broadcast bug
  • upd commands namespace
  • upd Transaction.php
  • upd README.md
  • fix critical bag of connectors
  • upd php version in composer.json
Sort:  

Hello, nice work, however I am afraid that according to the rules, this cannot be accepted:

Updates on Own Projects can be committed directly, without a Pull Request. Commits must not be older than 14 days.


Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.

[utopian-moderator]

ok, could you accept it without upvote?

I am afraid no. :(

@resteemator is a new bot casting votes for its followers. Follow @resteemator and vote this comment to increase your chance to be voted in the future!

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 58484.86
ETH 3100.06
USDT 1.00
SBD 2.40