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::Wallet class">
|
23
23
|
|
24
|
-
<meta name="keywords" content="new, account, accounts, balance,
|
24
|
+
<meta name="keywords" content="new, account, accounts, balance, create, destroy, export, contains?, id, pay, receive, locked?, unlock, change_password">
|
25
25
|
|
26
26
|
</head>
|
27
27
|
|
@@ -139,11 +139,6 @@ wallet = Nanook::Wallet.new(rpc_conn, wallet_seed)
|
|
139
139
|
</li>
|
140
140
|
|
141
141
|
|
142
|
-
<li>
|
143
|
-
<a href="#method-i-change_seed">change_seed</a>,
|
144
|
-
</li>
|
145
|
-
|
146
|
-
|
147
142
|
<li>
|
148
143
|
<a href="#method-i-contains-3F">contains?</a>,
|
149
144
|
</li>
|
@@ -339,13 +334,14 @@ href="WalletAccount.html">Nanook::WalletAccount</a> on it.</p>
|
|
339
334
|
<p>Will throw an ArgumentError if the wallet does not contain the account.</p>
|
340
335
|
|
341
336
|
<h4 id="method-i-account-label-Arguments">Arguments</h4>
|
342
|
-
<
|
337
|
+
<dl class="rdoc-list label-list"><dt><code>account</code>
|
338
|
+
<dd>
|
343
339
|
<p>Optional String of an account (starting with
|
344
340
|
<code>"xrb..."</code>) to start working with. Must be an account
|
345
341
|
within the wallet. When no account is given, the instance returned only
|
346
342
|
allows you to call <code>create</code> on it, to create a new account.
|
347
343
|
Otherwise, you must pass an account string for all other methods.</p>
|
348
|
-
</
|
344
|
+
</dd></dl>
|
349
345
|
|
350
346
|
<h4 id="method-i-account-label-Examples">Examples</h4>
|
351
347
|
|
@@ -435,7 +431,68 @@ wallet.account(account_id) # Returns a Nanook::WalletAccount for the account
|
|
435
431
|
|
436
432
|
|
437
433
|
<div class="description">
|
438
|
-
|
434
|
+
<p>Returns a Hash containing the balance of all accounts in the wallet,
|
435
|
+
optionally breaking the balances down by account.</p>
|
436
|
+
|
437
|
+
<h4 id="method-i-balance-label-Arguments">Arguments</h4>
|
438
|
+
<dl class="rdoc-list label-list"><dt><code>account_break_down:</code>
|
439
|
+
<dd>
|
440
|
+
<p>Boolean (default is <code>false</code>). When <code>true</code> the
|
441
|
+
response will contain balances per account.</p>
|
442
|
+
</dd><dt><code>unit:</code>
|
443
|
+
<dd>
|
444
|
+
<p>Symbol (default is <code>:nano</code>) Represents the unit that the
|
445
|
+
balances will be returned in. Must be either <code>:nano</code> or
|
446
|
+
<code>:raw</code>. (Note: this method interprets <code>:nano</code> as
|
447
|
+
NANO, which is technically Mnano See <a
|
448
|
+
href="https://nano.org/en/faq#what-are-nano-units-">What are Nano’s
|
449
|
+
Units</a>)</p>
|
450
|
+
</dd></dl>
|
451
|
+
|
452
|
+
<h4 id="method-i-balance-label-Examples">Examples</h4>
|
453
|
+
|
454
|
+
<pre><code>wallet.balance
|
455
|
+
</code></pre>
|
456
|
+
|
457
|
+
<p>Example response:</p>
|
458
|
+
|
459
|
+
<pre><code>{
|
460
|
+
"balance"=>5,
|
461
|
+
"pending"=>0.001
|
462
|
+
}
|
463
|
+
</code></pre>
|
464
|
+
|
465
|
+
<p>Asking for the balances to be returned in raw instead of NANO.</p>
|
466
|
+
|
467
|
+
<pre><code>wallet.balance(unit: :raw)
|
468
|
+
</code></pre>
|
469
|
+
|
470
|
+
<p>Example response:</p>
|
471
|
+
|
472
|
+
<pre><code>{
|
473
|
+
"balance"=>5000000000000000000000000000000,
|
474
|
+
"pending"=>1000000000000000000000000000
|
475
|
+
}
|
476
|
+
</code></pre>
|
477
|
+
|
478
|
+
<p>Asking for totals to be broken down by account:</p>
|
479
|
+
|
480
|
+
<pre><code>wallet.balance(account_break_down: true)
|
481
|
+
</code></pre>
|
482
|
+
|
483
|
+
<p>Example response:</p>
|
484
|
+
|
485
|
+
<pre><code>{
|
486
|
+
"xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000"=>{
|
487
|
+
"balance"=>2.5,
|
488
|
+
"pending"=>1
|
489
|
+
},
|
490
|
+
"xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx"=>{
|
491
|
+
"balance"=>51.4,
|
492
|
+
"pending"=>0
|
493
|
+
},
|
494
|
+
}
|
495
|
+
</code></pre>
|
439
496
|
</div>
|
440
497
|
|
441
498
|
|
@@ -518,7 +575,7 @@ action was successful.</p>
|
|
518
575
|
|
519
576
|
</p>
|
520
577
|
<div id="method-i-change_password_source" class="dyn-source">
|
521
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
578
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 325</span>
|
522
579
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_password</span>(<span class="ruby-identifier">password</span>)
|
523
580
|
<span class="ruby-identifier">wallet_required!</span>
|
524
581
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:password_change</span>, <span class="ruby-value">password:</span> <span class="ruby-identifier">password</span>)[<span class="ruby-value">:changed</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
@@ -528,43 +585,6 @@ action was successful.</p>
|
|
528
585
|
|
529
586
|
</div>
|
530
587
|
|
531
|
-
<div class="method">
|
532
|
-
<div class="title method-title" id="method-i-change_seed">
|
533
|
-
|
534
|
-
<b>change_seed</b>(seed)
|
535
|
-
|
536
|
-
<a href="../../classes/Nanook/Wallet.html#method-i-change_seed" name="method-i-change_seed" class="permalink">Link</a>
|
537
|
-
</div>
|
538
|
-
|
539
|
-
|
540
|
-
<div class="description">
|
541
|
-
|
542
|
-
</div>
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
<div class="sourcecode">
|
552
|
-
|
553
|
-
<p class="source-link">
|
554
|
-
Source:
|
555
|
-
<a href="javascript:toggleSource('method-i-change_seed_source')" id="l_method-i-change_seed_source">show</a>
|
556
|
-
|
557
|
-
</p>
|
558
|
-
<div id="method-i-change_seed_source" class="dyn-source">
|
559
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 152</span>
|
560
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_seed</span>(<span class="ruby-identifier">seed</span>)
|
561
|
-
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_change_seed</span>).<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:success</span>)
|
562
|
-
<span class="ruby-keyword">end</span></pre>
|
563
|
-
</div>
|
564
|
-
</div>
|
565
|
-
|
566
|
-
</div>
|
567
|
-
|
568
588
|
<div class="method">
|
569
589
|
<div class="title method-title" id="method-i-contains-3F">
|
570
590
|
|
@@ -578,9 +598,10 @@ action was successful.</p>
|
|
578
598
|
<p>Returns boolean indicating if the wallet contains an account.</p>
|
579
599
|
|
580
600
|
<h4 id="method-i-contains-3F-label-Arguments">Arguments</h4>
|
581
|
-
<
|
601
|
+
<dl class="rdoc-list label-list"><dt><code>account</code>
|
602
|
+
<dd>
|
582
603
|
<p>String account id (will start with <code>"xrb_..."</code>)</p>
|
583
|
-
</
|
604
|
+
</dd></dl>
|
584
605
|
|
585
606
|
<h4 id="method-i-contains-3F-label-Example+response">Example response</h4>
|
586
607
|
|
@@ -603,7 +624,7 @@ action was successful.</p>
|
|
603
624
|
|
604
625
|
</p>
|
605
626
|
<div id="method-i-contains-3F_source" class="dyn-source">
|
606
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
627
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 208</span>
|
607
628
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contains?</span>(<span class="ruby-identifier">account</span>)
|
608
629
|
<span class="ruby-identifier">wallet_required!</span>
|
609
630
|
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_contains</span>, <span class="ruby-value">account:</span> <span class="ruby-identifier">account</span>)
|
@@ -665,7 +686,7 @@ hacker, which includes your personal computer.</p>
|
|
665
686
|
|
666
687
|
</p>
|
667
688
|
<div id="method-i-create_source" class="dyn-source">
|
668
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
689
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 175</span>
|
669
690
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create</span>
|
670
691
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_create</span>)[<span class="ruby-value">:wallet</span>]
|
671
692
|
<span class="ruby-keyword">end</span></pre>
|
@@ -708,7 +729,7 @@ successful or not.</p>
|
|
708
729
|
|
709
730
|
</p>
|
710
731
|
<div id="method-i-destroy_source" class="dyn-source">
|
711
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
732
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 184</span>
|
712
733
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">destroy</span>
|
713
734
|
<span class="ruby-identifier">wallet_required!</span>
|
714
735
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_destroy</span>)
|
@@ -752,7 +773,7 @@ successful or not.</p>
|
|
752
773
|
|
753
774
|
</p>
|
754
775
|
<div id="method-i-export_source" class="dyn-source">
|
755
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
776
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 195</span>
|
756
777
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">export</span>
|
757
778
|
<span class="ruby-identifier">wallet_required!</span>
|
758
779
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_export</span>)[<span class="ruby-value">:json</span>]
|
@@ -790,7 +811,7 @@ successful or not.</p>
|
|
790
811
|
|
791
812
|
</p>
|
792
813
|
<div id="method-i-id_source" class="dyn-source">
|
793
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
814
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 214</span>
|
794
815
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">id</span>
|
795
816
|
<span class="ruby-ivar">@wallet</span>
|
796
817
|
<span class="ruby-keyword">end</span></pre>
|
@@ -832,7 +853,7 @@ successful or not.</p>
|
|
832
853
|
|
833
854
|
</p>
|
834
855
|
<div id="method-i-locked-3F_source" class="dyn-source">
|
835
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
856
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 302</span>
|
836
857
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">locked?</span>
|
837
858
|
<span class="ruby-identifier">wallet_required!</span>
|
838
859
|
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_locked</span>)
|
@@ -858,25 +879,30 @@ nano network. Returns a <em>send</em> block hash if successful, or an error
|
|
858
879
|
String if unsuccessful.</p>
|
859
880
|
|
860
881
|
<h4 id="method-i-pay-label-Arguments">Arguments</h4>
|
861
|
-
<
|
882
|
+
<dl class="rdoc-list label-list"><dt><code>from:</code>
|
883
|
+
<dd>
|
862
884
|
<p>String account id of an account in your wallet</p>
|
863
|
-
</
|
885
|
+
</dd><dt><code>to:</code>
|
886
|
+
<dd>
|
864
887
|
<p>String account id of the recipient of your payment</p>
|
865
|
-
</
|
888
|
+
</dd><dt><code>amount:</code>
|
889
|
+
<dd>
|
866
890
|
<p>Can be either an Integer or Float.</p>
|
867
|
-
</
|
891
|
+
</dd><dt><code>unit:</code>
|
892
|
+
<dd>
|
868
893
|
<p>Symbol (default is <code>:nano</code>). Represents the unit that
|
869
894
|
<code>amount</code> is in. Must be either <code>:nano</code> or
|
870
895
|
<code>:raw</code>. (Note: this method interprets <code>:nano</code> as
|
871
896
|
NANO, which is technically Mnano See <a
|
872
897
|
href="https://nano.org/en/faq#what-are-nano-units-">What are Nano’s
|
873
898
|
Units</a>)</p>
|
874
|
-
</
|
899
|
+
</dd><dt><code>id:</code>
|
900
|
+
<dd>
|
875
901
|
<p>String. Must be unique per payment. It serves an important purpose; it
|
876
902
|
allows you to make the same call multiple times with the same
|
877
903
|
<code>id</code> and be reassured that you will only ever send that nano
|
878
904
|
payment once.</p>
|
879
|
-
</
|
905
|
+
</dd></dl>
|
880
906
|
|
881
907
|
<p>Note, there may be a delay in receiving a response due to Proof of Work
|
882
908
|
being done. From the <a
|
@@ -919,7 +945,7 @@ wallet.pay(from: "xrb_...", to: "xrb_...", amount: 540000000
|
|
919
945
|
|
920
946
|
</p>
|
921
947
|
<div id="method-i-pay_source" class="dyn-source">
|
922
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
948
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 255</span>
|
923
949
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pay</span>(<span class="ruby-value">from:</span>, <span class="ruby-value">to:</span>, <span class="ruby-value">amount:</span>, <span class="ruby-value">unit:</span> <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">WalletAccount</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_UNIT</span>, <span class="ruby-value">id:</span>)
|
924
950
|
<span class="ruby-identifier">wallet_required!</span>
|
925
951
|
<span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">from</span>)
|
@@ -952,12 +978,14 @@ for the account will be received.</p>
|
|
952
978
|
block has in as an argument.</p>
|
953
979
|
|
954
980
|
<h4 id="method-i-receive-label-Arguments">Arguments</h4>
|
955
|
-
<
|
981
|
+
<dl class="rdoc-list label-list"><dt><code>block</code>
|
982
|
+
<dd>
|
956
983
|
<p>Optional block hash of pending payment. If not provided, the latest pending
|
957
984
|
payment will be received</p>
|
958
|
-
</
|
985
|
+
</dd><dt><code>into:</code>
|
986
|
+
<dd>
|
959
987
|
<p>String account id of account in your wallet to receive the payment into</p>
|
960
|
-
</
|
988
|
+
</dd></dl>
|
961
989
|
|
962
990
|
<h4 id="method-i-receive-label-Examples">Examples</h4>
|
963
991
|
|
@@ -991,7 +1019,7 @@ wallet.receive("718CC21...", into: "xrb...")
|
|
991
1019
|
|
992
1020
|
</p>
|
993
1021
|
<div id="method-i-receive_source" class="dyn-source">
|
994
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
1022
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 291</span>
|
995
1023
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">receive</span>(<span class="ruby-identifier">block</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-value">into:</span>)
|
996
1024
|
<span class="ruby-identifier">wallet_required!</span>
|
997
1025
|
<span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">into</span>)
|
@@ -1036,7 +1064,7 @@ action was successful.</p>
|
|
1036
1064
|
|
1037
1065
|
</p>
|
1038
1066
|
<div id="method-i-unlock_source" class="dyn-source">
|
1039
|
-
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line
|
1067
|
+
<pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 314</span>
|
1040
1068
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unlock</span>(<span class="ruby-identifier">password</span>)
|
1041
1069
|
<span class="ruby-identifier">wallet_required!</span>
|
1042
1070
|
<span class="ruby-identifier">rpc</span>(<span class="ruby-value">:password_enter</span>, <span class="ruby-value">password:</span> <span class="ruby-identifier">password</span>)[<span class="ruby-value">:valid</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
data/docs/1.0.0/created.rid
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
Thu, 15 Mar 2018
|
2
|
-
README.md Thu, 15 Mar 2018
|
3
|
-
lib/nanook.rb Thu, 15 Mar 2018
|
4
|
-
lib/nanook/account.rb Thu, 15 Mar 2018
|
5
|
-
lib/nanook/block.rb Thu, 15 Mar 2018
|
1
|
+
Thu, 15 Mar 2018 20:32:29 +1300
|
2
|
+
README.md Thu, 15 Mar 2018 20:30:29 +1300
|
3
|
+
lib/nanook.rb Thu, 15 Mar 2018 09:39:38 +1300
|
4
|
+
lib/nanook/account.rb Thu, 15 Mar 2018 12:18:46 +1300
|
5
|
+
lib/nanook/block.rb Thu, 15 Mar 2018 18:01:20 +1300
|
6
6
|
lib/nanook/error.rb Tue, 06 Mar 2018 18:08:17 +1300
|
7
|
-
lib/nanook/key.rb Thu, 15 Mar 2018
|
8
|
-
lib/nanook/node.rb Thu, 15 Mar 2018
|
9
|
-
lib/nanook/rpc.rb Thu, 15 Mar 2018
|
10
|
-
lib/nanook/util.rb Thu, 15 Mar 2018
|
11
|
-
lib/nanook/version.rb Thu, 15 Mar 2018
|
12
|
-
lib/nanook/wallet.rb Thu, 15 Mar 2018
|
13
|
-
lib/nanook/wallet_account.rb Thu, 15 Mar 2018
|
14
|
-
lib/nanook/work_peer.rb Thu, 15 Mar 2018
|
7
|
+
lib/nanook/key.rb Thu, 15 Mar 2018 09:39:38 +1300
|
8
|
+
lib/nanook/node.rb Thu, 15 Mar 2018 09:39:38 +1300
|
9
|
+
lib/nanook/rpc.rb Thu, 15 Mar 2018 09:39:38 +1300
|
10
|
+
lib/nanook/util.rb Thu, 15 Mar 2018 09:39:38 +1300
|
11
|
+
lib/nanook/version.rb Thu, 15 Mar 2018 20:30:29 +1300
|
12
|
+
lib/nanook/wallet.rb Thu, 15 Mar 2018 20:32:24 +1300
|
13
|
+
lib/nanook/wallet_account.rb Thu, 15 Mar 2018 09:39:38 +1300
|
14
|
+
lib/nanook/work_peer.rb Thu, 15 Mar 2018 09:39:38 +1300
|
@@ -24,7 +24,7 @@
|
|
24
24
|
README.md
|
25
25
|
|
26
26
|
</li>
|
27
|
-
<li>Last modified: 2018-03-15
|
27
|
+
<li>Last modified: 2018-03-15 20:30:29 +1300</li>
|
28
28
|
</ul>
|
29
29
|
</div>
|
30
30
|
|
@@ -100,7 +100,7 @@ src="https://circleci.com/gh/lukes/nanook/tree/master.svg?style=shield"></a></p>
|
|
100
100
|
|
101
101
|
<h3 id="label-Sending+a+payment">Sending a payment</h3>
|
102
102
|
|
103
|
-
<p>
|
103
|
+
<p>To send a payment from an account in a wallet:</p>
|
104
104
|
|
105
105
|
<pre><code>account = Nanook.new.wallet(wallet_id).account(account_id)
|
106
106
|
account.pay(to: recipient_account_id, amount: 0.2, id: unique_id)
|
@@ -126,8 +126,12 @@ the same id, the second request won't send any additional Nano.</p>
|
|
126
126
|
</blockquote>
|
127
127
|
|
128
128
|
<p>The unit of the <code>amount</code> is NANO (which is currently technically
|
129
|
-
|
130
|
-
|
129
|
+
Mnano — see <a href="https://nano.org/en/faq#what-are-nano-units-">What are
|
130
|
+
Nano’s Units</a>). You can pass an amount of raw instead by adding the
|
131
|
+
<code>unit: :raw</code> argument:</p>
|
132
|
+
|
133
|
+
<pre><code>account.pay(to: recipient_account_id, amount: 999, unit: :raw, id: unique_id)
|
134
|
+
</code></pre>
|
131
135
|
|
132
136
|
<p>Note, there may be a delay in receiving a response due to Proof of Work
|
133
137
|
being done. From the <a
|
@@ -172,6 +176,12 @@ wallet.receive(block_id, into: account_id)
|
|
172
176
|
|
173
177
|
<h2 id="label-All+commands">All commands</h2>
|
174
178
|
|
179
|
+
<p>Below is a quick reference list of commands. See the <a
|
180
|
+
href="https://lukes.github.io/nanook/1.0.0/">full Nanook documentation</a>
|
181
|
+
for a searchable detailed description of every class and method, what the
|
182
|
+
arguments mean, and example responses (Tip: expand the
|
183
|
+
“<strong>Nanook</strong> < Object” item in the sidebar).</p>
|
184
|
+
|
175
185
|
<h3 id="label-Wallets">Wallets</h3>
|
176
186
|
|
177
187
|
<p>See the <a
|
@@ -188,11 +198,6 @@ method and example responses.</p>
|
|
188
198
|
|
189
199
|
<pre><code>wallet = Nanook.new.wallet(wallet_id)
|
190
200
|
|
191
|
-
wallet.export
|
192
|
-
wallet.locked?
|
193
|
-
wallet.unlock(password)
|
194
|
-
wallet.change_password(password)
|
195
|
-
|
196
201
|
wallet.balance
|
197
202
|
wallet.balance(account_break_down: true)
|
198
203
|
wallet.balance(unit: :raw)
|
@@ -205,6 +210,11 @@ wallet.account.create
|
|
205
210
|
wallet.accounts
|
206
211
|
wallet.contains?(account_id)
|
207
212
|
|
213
|
+
wallet.export
|
214
|
+
wallet.locked?
|
215
|
+
wallet.unlock(password)
|
216
|
+
wallet.change_password(password)
|
217
|
+
|
208
218
|
wallet.destroy
|
209
219
|
</code></pre>
|
210
220
|
|
@@ -219,6 +229,15 @@ wallet.destroy
|
|
219
229
|
|
220
230
|
<pre><code>account = Nanook.new.wallet(wallet_id).account(account_id)
|
221
231
|
|
232
|
+
account.balance
|
233
|
+
account.balance(unit: :raw)
|
234
|
+
account.pay(to: recipient_account_id, amount: 2, id: unique_id)
|
235
|
+
account.pay(to: recipient_account_id, amount: 2, unit: :raw, id: unique_id)
|
236
|
+
account.pending
|
237
|
+
account.pending(limit: 1)
|
238
|
+
account.receive
|
239
|
+
account.receive(pending_block_id)
|
240
|
+
|
222
241
|
account.exists?
|
223
242
|
account.info
|
224
243
|
account.info(detailed: true)
|
@@ -231,15 +250,6 @@ account.delegators
|
|
231
250
|
account.representative
|
232
251
|
account.weight
|
233
252
|
|
234
|
-
account.balance
|
235
|
-
account.balance(unit: :raw)
|
236
|
-
account.pay(to: recipient_account_id, amount: 2, id: unique_id)
|
237
|
-
account.pay(to: recipient_account_id, amount: 2, unit: :raw, id: unique_id)
|
238
|
-
account.pending
|
239
|
-
account.pending(limit: 1)
|
240
|
-
account.receive
|
241
|
-
account.receive(pending_block_id)
|
242
|
-
|
243
253
|
account.destroy
|
244
254
|
</code></pre>
|
245
255
|
|
@@ -252,6 +262,11 @@ method and example responses.</p>
|
|
252
262
|
|
253
263
|
<pre><code>account = Nanook.new.account(account_id)
|
254
264
|
|
265
|
+
account.balance
|
266
|
+
account.balance(unit: :raw)
|
267
|
+
account.pending
|
268
|
+
account.pending(limit: 1)
|
269
|
+
|
255
270
|
account.exists?
|
256
271
|
account.info
|
257
272
|
account.info(detailed: true)
|
@@ -263,15 +278,15 @@ account.public_key
|
|
263
278
|
account.delegators
|
264
279
|
account.representative
|
265
280
|
account.weight
|
266
|
-
|
267
|
-
account.balance
|
268
|
-
account.balance(unit: :raw)
|
269
|
-
account.pending
|
270
|
-
account.pending(limit: 1)
|
271
281
|
</code></pre>
|
272
282
|
|
273
283
|
<h3 id="label-Blocks">Blocks</h3>
|
274
284
|
|
285
|
+
<p>See the <a
|
286
|
+
href="https://lukes.github.io/nanook/1.0.0/classes/Nanook/Block.html">full
|
287
|
+
documentation for Nanook::Block</a> for a detailed description of each
|
288
|
+
method and example responses.</p>
|
289
|
+
|
275
290
|
<pre><code>block = Nanook.new.block(block_id)
|
276
291
|
|
277
292
|
block.info # Verified blocks in the ledger
|
@@ -362,6 +377,11 @@ are even better.</p>
|
|
362
377
|
<pre><code>bundle exec rspec spec
|
363
378
|
</code></pre>
|
364
379
|
|
380
|
+
<p>To update rdoc documentation:</p>
|
381
|
+
|
382
|
+
<pre><code>bundle exec rake rerdoc
|
383
|
+
</code></pre>
|
384
|
+
|
365
385
|
<h2 id="label-License">License</h2>
|
366
386
|
|
367
387
|
<p>The gem is available as open source under the terms of the <a
|