nanook 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/Gemfile.lock +5 -1
- data/README.md +34 -22
- data/bin/console +2 -6
- data/docs/1.0.0/classes/Nanook/Account.html +50 -32
- data/docs/1.0.0/classes/Nanook/Block.html +202 -32
- data/docs/1.0.0/classes/Nanook/Wallet.html +95 -67
- data/docs/1.0.0/created.rid +13 -13
- data/docs/1.0.0/files/README_md.html +43 -23
- data/docs/1.0.0/files/lib/nanook/account_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/block_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/key_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/node_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/rpc_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/util_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/version_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/wallet_account_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/wallet_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook/work_peer_rb.html +1 -1
- data/docs/1.0.0/files/lib/nanook_rb.html +1 -1
- data/docs/1.0.0/js/search_index.js +1 -1
- data/lib/nanook/account.rb +1 -0
- data/lib/nanook/block.rb +128 -5
- data/lib/nanook/version.rb +1 -1
- data/lib/nanook/wallet.rb +11 -11
- data/nanook.gemspec +1 -0
- metadata +16 -2
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
<meta name="keywords" content="Nanook::Block class">
|
23
23
|
|
24
|
-
<meta name="keywords" content="new, account, cancel_work, chain, generate_work, history, id, info, is_valid_work?, republish, pending?, process, successors">
|
24
|
+
<meta name="keywords" content="new, account, cancel_work, chain, generate_work, history, id, info, is_valid_work?, republish, pending?, publish, process, successors">
|
25
25
|
|
26
26
|
</head>
|
27
27
|
|
@@ -53,19 +53,22 @@
|
|
53
53
|
<p>The <code>Nanook::Block</code> class contains methods to discover
|
54
54
|
publicly-available information about blocks on the nano network.</p>
|
55
55
|
|
56
|
-
<p>A block is represented by a unique
|
56
|
+
<p>A block is represented by a unique id like this:</p>
|
57
|
+
|
58
|
+
<pre><code>"FBF8B0E6623A31AB528EBD839EEAA91CAFD25C12294C46754E45FD017F7939EB"
|
59
|
+
</code></pre>
|
57
60
|
|
58
61
|
<p>Initialize this class through the convenient <a
|
59
62
|
href="../Nanook.html#method-i-block">Nanook#block</a> method:</p>
|
60
63
|
|
61
64
|
<pre><code>nanook = Nanook.new
|
62
|
-
account = nanook.block("
|
65
|
+
account = nanook.block("FBF8B0E...")
|
63
66
|
</code></pre>
|
64
67
|
|
65
68
|
<p>Or compose the longhand way like this:</p>
|
66
69
|
|
67
70
|
<pre><code>rpc_conn = Nanook::Rpc.new
|
68
|
-
block = Nanook::Block.new(rpc_conn, "
|
71
|
+
block = Nanook::Block.new(rpc_conn, "FBF8B0E...")
|
69
72
|
</code></pre>
|
70
73
|
|
71
74
|
</div>
|
@@ -185,7 +188,12 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
185
188
|
|
186
189
|
|
187
190
|
<li>
|
188
|
-
<a href="#method-i-process">process</a
|
191
|
+
<a href="#method-i-process">process</a>,
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li>
|
196
|
+
<a href="#method-i-publish">publish</a>
|
189
197
|
</li>
|
190
198
|
|
191
199
|
</ul>
|
@@ -266,7 +274,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
266
274
|
|
267
275
|
</p>
|
268
276
|
<div id="method-c-new_source" class="dyn-source">
|
269
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
277
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 21</span>
|
270
278
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">rpc</span>, <span class="ruby-identifier">block</span>)
|
271
279
|
<span class="ruby-ivar">@rpc</span> = <span class="ruby-identifier">rpc</span>
|
272
280
|
<span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
|
@@ -291,7 +299,12 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
291
299
|
|
292
300
|
|
293
301
|
<div class="description">
|
294
|
-
|
302
|
+
<p>Returns a String of the account id of the block.</p>
|
303
|
+
|
304
|
+
<h4 id="method-i-account-label-Example">Example</h4>
|
305
|
+
|
306
|
+
<pre><code>block.account # => "xrb_3x7c..."
|
307
|
+
</code></pre>
|
295
308
|
</div>
|
296
309
|
|
297
310
|
|
@@ -309,7 +322,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
309
322
|
|
310
323
|
</p>
|
311
324
|
<div id="method-i-account_source" class="dyn-source">
|
312
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
325
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 32</span>
|
313
326
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">account</span>
|
314
327
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:block_account</span>, <span class="ruby-value">:hash</span>)[<span class="ruby-value">:account</span>]
|
315
328
|
<span class="ruby-keyword">end</span></pre>
|
@@ -328,7 +341,14 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
328
341
|
|
329
342
|
|
330
343
|
<div class="description">
|
331
|
-
|
344
|
+
<p>Stop generating work for a block.</p>
|
345
|
+
|
346
|
+
<p>Returns boolean signalling if the action was successful.</p>
|
347
|
+
|
348
|
+
<h4 id="method-i-cancel_work-label-Example">Example</h4>
|
349
|
+
|
350
|
+
<pre><code>block.cancel_work # => true
|
351
|
+
</code></pre>
|
332
352
|
</div>
|
333
353
|
|
334
354
|
|
@@ -346,7 +366,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
346
366
|
|
347
367
|
</p>
|
348
368
|
<div id="method-i-cancel_work_source" class="dyn-source">
|
349
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
369
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 43</span>
|
350
370
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">cancel_work</span>
|
351
371
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:work_cancel</span>, <span class="ruby-value">:hash</span>).<span class="ruby-identifier">empty?</span>
|
352
372
|
<span class="ruby-keyword">end</span></pre>
|
@@ -365,7 +385,29 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
365
385
|
|
366
386
|
|
367
387
|
<div class="description">
|
368
|
-
|
388
|
+
<p>Returns an Array of block hashes in the account chain starting at this
|
389
|
+
block.</p>
|
390
|
+
|
391
|
+
<p>See also <a href="Block.html#method-i-successors">successors</a>.</p>
|
392
|
+
|
393
|
+
<h4 id="method-i-chain-label-Arguments">Arguments</h4>
|
394
|
+
<dl class="rdoc-list label-list"><dt><code>limit:</code>
|
395
|
+
<dd>
|
396
|
+
<p>Maximum number of block hashes to return (default is 1000)</p>
|
397
|
+
</dd></dl>
|
398
|
+
|
399
|
+
<h4 id="method-i-chain-label-Example">Example</h4>
|
400
|
+
|
401
|
+
<pre><code>block.chain(limit: 2)
|
402
|
+
</code></pre>
|
403
|
+
|
404
|
+
<h4 id="method-i-chain-label-Example+reponse">Example reponse</h4>
|
405
|
+
|
406
|
+
<pre><code>[
|
407
|
+
"36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E",
|
408
|
+
"FBF8B0E6623A31AB528EBD839EEAA91CAFD25C12294C46754E45FD017F7939EB"
|
409
|
+
]
|
410
|
+
</code></pre>
|
369
411
|
</div>
|
370
412
|
|
371
413
|
|
@@ -383,7 +425,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
383
425
|
|
384
426
|
</p>
|
385
427
|
<div id="method-i-chain_source" class="dyn-source">
|
386
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
428
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 66</span>
|
387
429
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">chain</span>(<span class="ruby-value">limit:</span> <span class="ruby-value">1000</span>)
|
388
430
|
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:chain</span>, <span class="ruby-value">:block</span>, <span class="ruby-value">count:</span> <span class="ruby-identifier">limit</span>)[<span class="ruby-value">:blocks</span>]
|
389
431
|
<span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-constant">Array</span>)
|
@@ -403,7 +445,12 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
403
445
|
|
404
446
|
|
405
447
|
<div class="description">
|
406
|
-
|
448
|
+
<p>Generate work for a block.</p>
|
449
|
+
|
450
|
+
<p>Returns the work id of the work completed.</p>
|
451
|
+
|
452
|
+
<pre><code>block.generate_work # => "2bf29ef00786a6bc"
|
453
|
+
</code></pre>
|
407
454
|
</div>
|
408
455
|
|
409
456
|
|
@@ -421,7 +468,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
421
468
|
|
422
469
|
</p>
|
423
470
|
<div id="method-i-generate_work_source" class="dyn-source">
|
424
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
471
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 76</span>
|
425
472
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_work</span>
|
426
473
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:work_generate</span>, <span class="ruby-value">:hash</span>)[<span class="ruby-value">:work</span>]
|
427
474
|
<span class="ruby-keyword">end</span></pre>
|
@@ -440,7 +487,32 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
440
487
|
|
441
488
|
|
442
489
|
<div class="description">
|
443
|
-
|
490
|
+
<p>Returns Array of Hashes containing information about a chain of
|
491
|
+
send/receive blocks, starting from this block.</p>
|
492
|
+
|
493
|
+
<h4 id="method-i-history-label-Arguments">Arguments</h4>
|
494
|
+
<dl class="rdoc-list label-list"><dt><code>limit:</code>
|
495
|
+
<dd>
|
496
|
+
<p>Maximum number of send/receive block hashes to return in the chain (default
|
497
|
+
is 1000)</p>
|
498
|
+
</dd></dl>
|
499
|
+
|
500
|
+
<h4 id="method-i-history-label-Example">Example</h4>
|
501
|
+
|
502
|
+
<pre><code>block.history(limit: 1)
|
503
|
+
</code></pre>
|
504
|
+
|
505
|
+
<h4 id="method-i-history-label-Example+response">Example response</h4>
|
506
|
+
|
507
|
+
<pre><code>[
|
508
|
+
{
|
509
|
+
:account=>"xrb_3x7cjioqahgs5ppheys6prpqtb4rdknked83chf97bot1unrbdkaux37t31b",
|
510
|
+
:amount=>539834279601145558517940224,
|
511
|
+
:hash=>"36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E",
|
512
|
+
:type=>"send"
|
513
|
+
}
|
514
|
+
]
|
515
|
+
</code></pre>
|
444
516
|
</div>
|
445
517
|
|
446
518
|
|
@@ -458,7 +530,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
458
530
|
|
459
531
|
</p>
|
460
532
|
<div id="method-i-history_source" class="dyn-source">
|
461
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
533
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 102</span>
|
462
534
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">history</span>(<span class="ruby-value">limit:</span> <span class="ruby-value">1000</span>)
|
463
535
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:history</span>, <span class="ruby-value">:hash</span>, <span class="ruby-value">count:</span> <span class="ruby-identifier">limit</span>)[<span class="ruby-value">:history</span>]
|
464
536
|
<span class="ruby-keyword">end</span></pre>
|
@@ -477,7 +549,10 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
477
549
|
|
478
550
|
|
479
551
|
<div class="description">
|
480
|
-
|
552
|
+
<p>Returns the block hash</p>
|
553
|
+
|
554
|
+
<pre><code>block.id #=> "FBF8B0E..."
|
555
|
+
</code></pre>
|
481
556
|
</div>
|
482
557
|
|
483
558
|
|
@@ -495,7 +570,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
495
570
|
|
496
571
|
</p>
|
497
572
|
<div id="method-i-id_source" class="dyn-source">
|
498
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
573
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 109</span>
|
499
574
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">id</span>
|
500
575
|
<span class="ruby-ivar">@block</span>
|
501
576
|
<span class="ruby-keyword">end</span></pre>
|
@@ -514,7 +589,26 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
514
589
|
|
515
590
|
|
516
591
|
<div class="description">
|
517
|
-
|
592
|
+
<p>Returns a Hash of information about the block.</p>
|
593
|
+
|
594
|
+
<h4 id="method-i-info-label-Arguments">Arguments</h4>
|
595
|
+
<dl class="rdoc-list label-list"><dt><code>allow_unchecked:</code>
|
596
|
+
<dd>
|
597
|
+
<p>Boolean (default is <code>false</code>). If <code>true</code>, information
|
598
|
+
can be returned about blocks that are unchecked (unverified).</p>
|
599
|
+
</dd></dl>
|
600
|
+
|
601
|
+
<h4 id="method-i-info-label-Example+response">Example response</h4>
|
602
|
+
|
603
|
+
<pre><code>{
|
604
|
+
:type=>"send",
|
605
|
+
:previous=>"FBF8B0E6623A31AB528EBD839EEAA91CAFD25C12294C46754E45FD017F7939EB",
|
606
|
+
:destination=>"xrb_3x7cjioqahgs5ppheys6prpqtb4rdknked83chf97bot1unrbdkaux37t31b",
|
607
|
+
:balance=>"00000000000000000000000000000000",
|
608
|
+
:work=>"44cc24b60705083a",
|
609
|
+
:signature=>"42ADFEFE7C3FFF188AE92A202F8A5734DE91779C454613E446EEC93D001D6C953E9FD16730AF32C891791BA8EDAECEB059A213E2FE1EEB7ADF9D5D0815464D06"
|
610
|
+
}
|
611
|
+
</code></pre>
|
518
612
|
</div>
|
519
613
|
|
520
614
|
|
@@ -532,7 +626,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
532
626
|
|
533
627
|
</p>
|
534
628
|
<div id="method-i-info_source" class="dyn-source">
|
535
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
629
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 130</span>
|
536
630
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">info</span>(<span class="ruby-value">allow_unchecked:</span> <span class="ruby-keyword">false</span>)
|
537
631
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">allow_unchecked</span>
|
538
632
|
<span class="ruby-comment"># TODO not actually sure what this response looks like when it's not an unchecked block, assuming its blank</span>
|
@@ -561,7 +655,10 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
561
655
|
|
562
656
|
|
563
657
|
<div class="description">
|
564
|
-
|
658
|
+
<p>Returns boolean signalling if work is valid for the block.</p>
|
659
|
+
|
660
|
+
<pre><code>block.is_valid_work?("2bf29ef00786a6bc") # => true
|
661
|
+
</code></pre>
|
565
662
|
</div>
|
566
663
|
|
567
664
|
|
@@ -579,7 +676,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
579
676
|
|
580
677
|
</p>
|
581
678
|
<div id="method-i-is_valid_work-3F_source" class="dyn-source">
|
582
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
679
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 147</span>
|
583
680
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">is_valid_work?</span>(<span class="ruby-identifier">work</span>)
|
584
681
|
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:work_validate</span>, <span class="ruby-value">:hash</span>, <span class="ruby-value">work:</span> <span class="ruby-identifier">work</span>)
|
585
682
|
<span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">response</span>[<span class="ruby-value">:valid</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
@@ -599,7 +696,10 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
599
696
|
|
600
697
|
|
601
698
|
<div class="description">
|
602
|
-
|
699
|
+
<p>Returns boolean <code>true</code> if the block is a pending block.</p>
|
700
|
+
|
701
|
+
<pre><code>block.pending? #=> false
|
702
|
+
</code></pre>
|
603
703
|
</div>
|
604
704
|
|
605
705
|
|
@@ -617,7 +717,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
617
717
|
|
618
718
|
</p>
|
619
719
|
<div id="method-i-pending-3F_source" class="dyn-source">
|
620
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
720
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 180</span>
|
621
721
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pending?</span>
|
622
722
|
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:pending_exists</span>, <span class="ruby-value">:hash</span>)
|
623
723
|
<span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">response</span>[<span class="ruby-value">:exists</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
@@ -644,6 +744,43 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
644
744
|
|
645
745
|
|
646
746
|
|
747
|
+
<div class="aka">
|
748
|
+
Alias for: <a href="Block.html#method-i-publish">publish</a>
|
749
|
+
</div>
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
</div>
|
754
|
+
|
755
|
+
<div class="method">
|
756
|
+
<div class="title method-title" id="method-i-publish">
|
757
|
+
|
758
|
+
<b>publish</b>()
|
759
|
+
|
760
|
+
<a href="../../classes/Nanook/Block.html#method-i-publish" name="method-i-publish" class="permalink">Link</a>
|
761
|
+
</div>
|
762
|
+
|
763
|
+
|
764
|
+
<div class="description">
|
765
|
+
<p>Publish the block to the nano network.</p>
|
766
|
+
|
767
|
+
<p>Note, if block has previously been published, use <a
|
768
|
+
href="Block.html#method-i-republish">republish</a> instead.</p>
|
769
|
+
|
770
|
+
<p>Returns the block hash, or false.</p>
|
771
|
+
|
772
|
+
<pre><code>block.publish # => "FBF8B0E..."
|
773
|
+
</code></pre>
|
774
|
+
</div>
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
<div class="aka">
|
779
|
+
Also aliased as: <a href="Block.html#method-i-process">process</a>
|
780
|
+
</div>
|
781
|
+
|
782
|
+
|
783
|
+
|
647
784
|
|
648
785
|
|
649
786
|
|
@@ -651,12 +788,13 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
651
788
|
|
652
789
|
<p class="source-link">
|
653
790
|
Source:
|
654
|
-
<a href="javascript:toggleSource('method-i-
|
791
|
+
<a href="javascript:toggleSource('method-i-publish_source')" id="l_method-i-publish_source">show</a>
|
655
792
|
|
656
793
|
</p>
|
657
|
-
<div id="method-i-
|
658
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
659
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">
|
794
|
+
<div id="method-i-publish_source" class="dyn-source">
|
795
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 192</span>
|
796
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">publish</span>
|
797
|
+
<span class="ruby-comment"># TODO I think this can return false or error or something?</span>
|
660
798
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:process</span>, <span class="ruby-value">:block</span>)[<span class="ruby-value">:hash</span>]
|
661
799
|
<span class="ruby-keyword">end</span></pre>
|
662
800
|
</div>
|
@@ -674,7 +812,20 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
674
812
|
|
675
813
|
|
676
814
|
<div class="description">
|
677
|
-
|
815
|
+
<p>Republish blocks starting at this block up the account chain back to the
|
816
|
+
nano network.</p>
|
817
|
+
|
818
|
+
<p>Returns an Array of block hashes that were republished.</p>
|
819
|
+
|
820
|
+
<h4 id="method-i-republish-label-Example">Example</h4>
|
821
|
+
|
822
|
+
<pre><code>block.republish
|
823
|
+
</code></pre>
|
824
|
+
|
825
|
+
<h4 id="method-i-republish-label-Example+response">Example response</h4>
|
826
|
+
|
827
|
+
<pre><code>["36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E"]
|
828
|
+
</code></pre>
|
678
829
|
</div>
|
679
830
|
|
680
831
|
|
@@ -692,7 +843,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
692
843
|
|
693
844
|
</p>
|
694
845
|
<div id="method-i-republish_source" class="dyn-source">
|
695
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
846
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 163</span>
|
696
847
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">republish</span>(<span class="ruby-value">destinations:</span><span class="ruby-keyword">nil</span>, <span class="ruby-value">sources:</span><span class="ruby-keyword">nil</span>)
|
697
848
|
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">destinations</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">sources</span>.<span class="ruby-identifier">nil?</span>
|
698
849
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"You must provide either destinations or sources but not both"</span>)
|
@@ -721,7 +872,26 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
721
872
|
|
722
873
|
|
723
874
|
<div class="description">
|
724
|
-
|
875
|
+
<p>Returns an Array of block hashes in the account chain ending at this block.</p>
|
876
|
+
|
877
|
+
<p>See also <a href="Block.html#method-i-chain">chain</a>.</p>
|
878
|
+
|
879
|
+
<h4 id="method-i-successors-label-Arguments">Arguments</h4>
|
880
|
+
<dl class="rdoc-list label-list"><dt><code>limit:</code>
|
881
|
+
<dd>
|
882
|
+
<p>Maximum number of send/receive block hashes to return in the chain (default
|
883
|
+
is 1000)</p>
|
884
|
+
</dd></dl>
|
885
|
+
|
886
|
+
<h4 id="method-i-successors-label-Example">Example</h4>
|
887
|
+
|
888
|
+
<pre><code>block.successors
|
889
|
+
</code></pre>
|
890
|
+
|
891
|
+
<h4 id="method-i-successors-label-Example+response">Example response</h4>
|
892
|
+
|
893
|
+
<pre><code>["36A0FB717368BA8CF8D255B63DC207771EABC6C6FFC22A7F455EC2209464897E"]
|
894
|
+
</code></pre>
|
725
895
|
</div>
|
726
896
|
|
727
897
|
|
@@ -739,7 +909,7 @@ block = Nanook::Block.new(rpc_conn, "991CF19...")
|
|
739
909
|
|
740
910
|
</p>
|
741
911
|
<div id="method-i-successors_source" class="dyn-source">
|
742
|
-
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line
|
912
|
+
<pre><span class="ruby-comment"># File lib/nanook/block.rb, line 215</span>
|
743
913
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">successors</span>(<span class="ruby-value">limit:</span> <span class="ruby-value">1000</span>)
|
744
914
|
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:successors</span>, <span class="ruby-value">:block</span>, <span class="ruby-value">count:</span> <span class="ruby-identifier">limit</span>)[<span class="ruby-value">:blocks</span>]
|
745
915
|
<span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-constant">Array</span>)
|