Skip to content

Commit 3b846f7

Browse files
committed
upd README.md
1 parent adff6d2 commit 3b846f7

File tree

1 file changed

+60
-33
lines changed

1 file changed

+60
-33
lines changed

README.md

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ use GrapheneNodeClient\Connectors\ConnectorInterface;
249249

250250
class MyConnector implements ConnectorInterface
251251
{
252+
public function setConnectionTimeoutSeconds($timeoutSeconds) {
253+
// TODO: Implement setConnectionTimeoutSeconds() method.
254+
}
255+
256+
public function setMaxNumberOfTriesToReconnect($triesN) {
257+
// TODO: Implement setMaxNumberOfTriesToReconnect() method.
258+
}
259+
252260
/**
253261
* platform name for witch connector is. steemit or golos.
254262
*/
@@ -319,49 +327,49 @@ class GolosWSConnector extends WSConnectorAbstract
319327

320328

321329
## Creating Own Command
330+
331+
You have to update $steemAPI/$golosAPI properties in class GrapheneNodeClient\Commands\Commands.php as shown below
332+
322333
```php
323334
<?php
324335

325-
namespace My\App\Commands;
326336

327-
use GrapheneNodeClient\Commands\Single\CommandAbstract;
337+
namespace GrapheneNodeClient\Commands;
338+
339+
328340
use GrapheneNodeClient\Connectors\ConnectorInterface;
329341

330-
class MyCommand extends CommandAbstract
342+
/**
343+
* @method Commands broadcast_transaction()
344+
* //...
345+
* @method Commands your_method()
346+
*/
347+
class Commands implements CommandInterface
331348
{
332-
protected $method = 'method_name';
333-
//protected $apiName = 'login_api'; in CommandAbstract have to be set correct $apiName
334-
335-
//If different for platforms
336-
protected $queryDataMap = [
337-
ConnectorInterface::PLATFORM_GOLOS => [
338-
//on the left is array keys and on the right is validators
339-
//validators for ani list element have to be have '*'
340-
'*:limit' => ['integer'], //the discussions return amount top limit
341-
'*:select_tags:*' => ['nullOrString'], //list of tags to include, posts without these tags are filtered
342-
'*:select_authors:*' => ['nullOrString'], //list of authors to select
343-
'*:truncate_body' => ['nullOrInteger'], //the amount of bytes of the post body to return, 0 for all
344-
'*:start_author' => ['nullOrString'], //the author of discussion to start searching from
345-
'*:start_permlink' => ['nullOrString'], //the permlink of discussion to start searching from
346-
'*:parent_author' => ['nullOrString'], //the author of parent discussion
347-
'*:parent_permlink' => ['nullOrString'] //the permlink of parent discussion
349+
//...
350+
//protected $projectApi = [ 'method_name' => [ 'apiName' => 'api_name', 'fields'=>['массив с полями из команды']]];
351+
protected $steemAPI = [
352+
//...
353+
'broadcast_transaction' => [
354+
'apiName' => 'network_broadcast_api',
355+
'fields' => [
356+
'0:ref_block_num' => ['integer'],
357+
'0:ref_block_prefix' => ['integer'],
358+
'0:expiration' => ['string'],
359+
'0:operations:*:0' => ['string'],
360+
'0:operations:*:1' => ['array'],
361+
'0:extensions' => ['array'],
362+
'0:signatures' => ['array']
363+
]
348364
],
349-
ConnectorInterface::PLATFORM_STEEMIT => [
350-
//for list params
351-
'*:tag' => ['nullOrString'], //'author',
352-
'*:limit' => ['integer'], //'limit'
353-
'*:start_author' => ['nullOrString'], //'start_author' for pagination,
354-
'*:start_permlink' => ['nullOrString'] //'start_permlink' for pagination,
365+
//...
366+
'broadcast_transaction' => [
367+
'apiName' => 'your_method',
368+
'fields' => [
369+
//your fields
370+
]
355371
]
356372
];
357-
358-
359-
//If the same for platforms
360-
//protected $queryDataMap = [
361-
// route example: 'key:123:array' => $_SESSION['key'][123]['array']
362-
// 'some_array_key:some_other_key' => ['integer'], // available validators are 'required', 'array', 'string',
363-
// 'integer', 'nullOrArray', 'nullOrString', 'nullOrInteger'.
364-
//];
365373
}
366374

367375

@@ -399,6 +407,25 @@ $rep = Reputation::calculate($account['reputation']);
399407

400408
```
401409

410+
## Bandwidth
411+
412+
Before to make transaction you can see user bandwidth
413+
414+
```php
415+
<?php
416+
417+
use GrapheneNodeClient\Tools\Bandwidth;
418+
419+
$answer = Bandwidth::getBandwidthByAccountName('golos-top-newbie', 'market', $connector);
420+
421+
//Array
422+
//(
423+
// [used] => 3120016
424+
// [available] => 148362781
425+
//)
426+
427+
```
428+
402429

403430
## Transaction for blockchain (broadcast)
404431

0 commit comments

Comments
 (0)