Skip to content

Commit

Permalink
upd README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
t3ran13 committed Apr 3, 2018
1 parent 50de4e3 commit 24887ea
Showing 1 changed file with 43 additions and 3 deletions.
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ install extensions
<?php

use GrapheneNodeClient\Commands\CommandQueryData;
use GrapheneNodeClient\Commands\Commands;
use GrapheneNodeClient\Commands\Single\GetDiscussionsByCreatedCommand;
use GrapheneNodeClient\Connectors\WebSocket\GolosWSConnector;
use GrapheneNodeClient\Connectors\WebSocket\SteemitWSConnector;
Expand All @@ -48,10 +49,21 @@ $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
);


// will return
// [
// "id" => 1,
Expand All @@ -66,12 +78,25 @@ $golosPosts = $command->execute(
// ]
// ]


//single command
$command = new GetDiscussionsByCreatedCommand(new SteemitWSConnector());
$steemitPosts = $command->execute(
$commandQuery,
'result',
SteemitWSConnector::ANSWER_FORMAT_ARRAY // or SteemitWSConnector::ANSWER_FORMAT_OBJECT
);

//or commands aggregator class
$commands = new Commands(new GolosWSConnector());
$golosPosts = $commands->get_discussions_by_created()
->execute(
$commandQuery,
'result',
SteemitWSConnector::ANSWER_FORMAT_ARRAY // or SteemitWSConnector::ANSWER_FORMAT_OBJECT
);


// will return
// [
// [
Expand Down Expand Up @@ -119,7 +144,11 @@ $steemitPosts = $command->execute(

All single commands can be called through Commands Class as methods (example: (new Commands)->get_block()->execute(...) )


### broadcast operations templates

namespace GrapheneNodeClient\Tools\ChainOperations

- vote
- transfer
- comment
Expand Down Expand Up @@ -161,12 +190,16 @@ $answer = OpVote::doSynchronous(

## Implemented Connectors List

namespace: GrapheneNodeClient\Connectors\WebSocket;
namespace: GrapheneNodeClient\Connectors\WebSocket OR GrapheneNodeClient\Connectors\Http;

- GolosWSConnector (wss://ws.golos.io)
- SteemitWSConnector (wss://ws.steemit.com)
- SteemitWSConnector (wss://steemd.minnowsupportproject.org)
- SteemitHttpConnector (https://steemd.privex.io)

List of available STEEM nodes are [here](https://www.steem.center/index.php?title=Public_Websocket_Servers)


switch between connectors
#### Switching between connectors
```php
<?php

Expand Down Expand Up @@ -254,6 +287,13 @@ class GolosWSConnector extends WSConnectorAbstract
*/
protected $platform = self::PLATFORM_GOLOS;

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

/**
* max number of tries to get answer from the node
*
Expand Down

0 comments on commit 24887ea

Please sign in to comment.