nanook 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/nanook/version.rb +1 -1
  4. data/nanook.gemspec +1 -1
  5. metadata +1 -185
  6. data/docs/0.7.0/apple-touch-icon.png +0 -0
  7. data/docs/0.7.0/classes/Nanook.html +0 -572
  8. data/docs/0.7.0/classes/Nanook/Account.html +0 -909
  9. data/docs/0.7.0/classes/Nanook/Block.html +0 -717
  10. data/docs/0.7.0/classes/Nanook/Error.html +0 -84
  11. data/docs/0.7.0/classes/Nanook/Key.html +0 -253
  12. data/docs/0.7.0/classes/Nanook/Node.html +0 -657
  13. data/docs/0.7.0/classes/Nanook/Rpc.html +0 -247
  14. data/docs/0.7.0/classes/Nanook/Util.html +0 -197
  15. data/docs/0.7.0/classes/Nanook/Wallet.html +0 -986
  16. data/docs/0.7.0/classes/Nanook/WalletAccount.html +0 -446
  17. data/docs/0.7.0/classes/Nanook/WorkPeer.html +0 -294
  18. data/docs/0.7.0/created.rid +0 -14
  19. data/docs/0.7.0/css/github.css +0 -123
  20. data/docs/0.7.0/css/main.css +0 -374
  21. data/docs/0.7.0/css/panel.css +0 -360
  22. data/docs/0.7.0/css/reset.css +0 -48
  23. data/docs/0.7.0/favicon.ico +0 -0
  24. data/docs/0.7.0/files/README_md.html +0 -418
  25. data/docs/0.7.0/files/lib/nanook/account_rb.html +0 -89
  26. data/docs/0.7.0/files/lib/nanook/block_rb.html +0 -89
  27. data/docs/0.7.0/files/lib/nanook/error_rb.html +0 -89
  28. data/docs/0.7.0/files/lib/nanook/key_rb.html +0 -89
  29. data/docs/0.7.0/files/lib/nanook/node_rb.html +0 -89
  30. data/docs/0.7.0/files/lib/nanook/rpc_rb.html +0 -99
  31. data/docs/0.7.0/files/lib/nanook/util_rb.html +0 -89
  32. data/docs/0.7.0/files/lib/nanook/version_rb.html +0 -84
  33. data/docs/0.7.0/files/lib/nanook/wallet_account_rb.html +0 -89
  34. data/docs/0.7.0/files/lib/nanook/wallet_rb.html +0 -89
  35. data/docs/0.7.0/files/lib/nanook/work_peer_rb.html +0 -89
  36. data/docs/0.7.0/files/lib/nanook_rb.html +0 -94
  37. data/docs/0.7.0/i/arrow-down.svg +0 -8
  38. data/docs/0.7.0/i/arrow-right.svg +0 -8
  39. data/docs/0.7.0/i/search.svg +0 -12
  40. data/docs/0.7.0/i/tree_bg.svg +0 -8
  41. data/docs/0.7.0/index.html +0 -11
  42. data/docs/0.7.0/js/highlight.pack.js +0 -1
  43. data/docs/0.7.0/js/jquery-1.3.2.min.js +0 -19
  44. data/docs/0.7.0/js/main.js +0 -25
  45. data/docs/0.7.0/js/navigation.js +0 -142
  46. data/docs/0.7.0/js/search_index.js +0 -1
  47. data/docs/0.7.0/js/searchdoc.js +0 -465
  48. data/docs/0.7.0/js/searcher.js +0 -229
  49. data/docs/0.7.0/panel/index.html +0 -47
  50. data/docs/0.7.0/panel/links.html +0 -32
  51. data/docs/0.7.0/panel/tree.js +0 -1
  52. data/docs/0.8.0/apple-touch-icon.png +0 -0
  53. data/docs/0.8.0/classes/Nanook.html +0 -621
  54. data/docs/0.8.0/classes/Nanook/Account.html +0 -971
  55. data/docs/0.8.0/classes/Nanook/Block.html +0 -759
  56. data/docs/0.8.0/classes/Nanook/Error.html +0 -84
  57. data/docs/0.8.0/classes/Nanook/Key.html +0 -295
  58. data/docs/0.8.0/classes/Nanook/Node.html +0 -657
  59. data/docs/0.8.0/classes/Nanook/Rpc.html +0 -247
  60. data/docs/0.8.0/classes/Nanook/Util.html +0 -264
  61. data/docs/0.8.0/classes/Nanook/Wallet.html +0 -1056
  62. data/docs/0.8.0/classes/Nanook/WalletAccount.html +0 -582
  63. data/docs/0.8.0/classes/Nanook/WorkPeer.html +0 -294
  64. data/docs/0.8.0/created.rid +0 -14
  65. data/docs/0.8.0/css/github.css +0 -123
  66. data/docs/0.8.0/css/main.css +0 -374
  67. data/docs/0.8.0/css/panel.css +0 -360
  68. data/docs/0.8.0/css/reset.css +0 -48
  69. data/docs/0.8.0/favicon.ico +0 -0
  70. data/docs/0.8.0/files/README_md.html +0 -423
  71. data/docs/0.8.0/files/lib/nanook/account_rb.html +0 -89
  72. data/docs/0.8.0/files/lib/nanook/block_rb.html +0 -89
  73. data/docs/0.8.0/files/lib/nanook/error_rb.html +0 -89
  74. data/docs/0.8.0/files/lib/nanook/key_rb.html +0 -89
  75. data/docs/0.8.0/files/lib/nanook/node_rb.html +0 -89
  76. data/docs/0.8.0/files/lib/nanook/rpc_rb.html +0 -99
  77. data/docs/0.8.0/files/lib/nanook/util_rb.html +0 -97
  78. data/docs/0.8.0/files/lib/nanook/version_rb.html +0 -84
  79. data/docs/0.8.0/files/lib/nanook/wallet_account_rb.html +0 -89
  80. data/docs/0.8.0/files/lib/nanook/wallet_rb.html +0 -89
  81. data/docs/0.8.0/files/lib/nanook/work_peer_rb.html +0 -89
  82. data/docs/0.8.0/files/lib/nanook_rb.html +0 -94
  83. data/docs/0.8.0/i/arrow-down.svg +0 -8
  84. data/docs/0.8.0/i/arrow-right.svg +0 -8
  85. data/docs/0.8.0/i/search.svg +0 -12
  86. data/docs/0.8.0/i/tree_bg.svg +0 -8
  87. data/docs/0.8.0/index.html +0 -11
  88. data/docs/0.8.0/js/highlight.pack.js +0 -1
  89. data/docs/0.8.0/js/jquery-1.3.2.min.js +0 -19
  90. data/docs/0.8.0/js/main.js +0 -25
  91. data/docs/0.8.0/js/navigation.js +0 -142
  92. data/docs/0.8.0/js/search_index.js +0 -1
  93. data/docs/0.8.0/js/searchdoc.js +0 -465
  94. data/docs/0.8.0/js/searcher.js +0 -229
  95. data/docs/0.8.0/panel/index.html +0 -47
  96. data/docs/0.8.0/panel/links.html +0 -32
  97. data/docs/0.8.0/panel/tree.js +0 -1
  98. data/docs/1.0.0/apple-touch-icon.png +0 -0
  99. data/docs/1.0.0/classes/Nanook.html +0 -621
  100. data/docs/1.0.0/classes/Nanook/Account.html +0 -989
  101. data/docs/1.0.0/classes/Nanook/Block.html +0 -929
  102. data/docs/1.0.0/classes/Nanook/Error.html +0 -84
  103. data/docs/1.0.0/classes/Nanook/Key.html +0 -295
  104. data/docs/1.0.0/classes/Nanook/Node.html +0 -657
  105. data/docs/1.0.0/classes/Nanook/Rpc.html +0 -247
  106. data/docs/1.0.0/classes/Nanook/Util.html +0 -264
  107. data/docs/1.0.0/classes/Nanook/Wallet.html +0 -1084
  108. data/docs/1.0.0/classes/Nanook/WalletAccount.html +0 -582
  109. data/docs/1.0.0/classes/Nanook/WorkPeer.html +0 -294
  110. data/docs/1.0.0/created.rid +0 -14
  111. data/docs/1.0.0/css/github.css +0 -123
  112. data/docs/1.0.0/css/main.css +0 -374
  113. data/docs/1.0.0/css/panel.css +0 -360
  114. data/docs/1.0.0/css/reset.css +0 -48
  115. data/docs/1.0.0/favicon.ico +0 -0
  116. data/docs/1.0.0/files/README_md.html +0 -443
  117. data/docs/1.0.0/files/lib/nanook/account_rb.html +0 -89
  118. data/docs/1.0.0/files/lib/nanook/block_rb.html +0 -89
  119. data/docs/1.0.0/files/lib/nanook/error_rb.html +0 -89
  120. data/docs/1.0.0/files/lib/nanook/key_rb.html +0 -89
  121. data/docs/1.0.0/files/lib/nanook/node_rb.html +0 -89
  122. data/docs/1.0.0/files/lib/nanook/rpc_rb.html +0 -99
  123. data/docs/1.0.0/files/lib/nanook/util_rb.html +0 -97
  124. data/docs/1.0.0/files/lib/nanook/version_rb.html +0 -84
  125. data/docs/1.0.0/files/lib/nanook/wallet_account_rb.html +0 -89
  126. data/docs/1.0.0/files/lib/nanook/wallet_rb.html +0 -89
  127. data/docs/1.0.0/files/lib/nanook/work_peer_rb.html +0 -89
  128. data/docs/1.0.0/files/lib/nanook_rb.html +0 -94
  129. data/docs/1.0.0/i/arrow-down.svg +0 -8
  130. data/docs/1.0.0/i/arrow-right.svg +0 -8
  131. data/docs/1.0.0/i/search.svg +0 -12
  132. data/docs/1.0.0/i/tree_bg.svg +0 -8
  133. data/docs/1.0.0/index.html +0 -11
  134. data/docs/1.0.0/js/highlight.pack.js +0 -1
  135. data/docs/1.0.0/js/jquery-1.3.2.min.js +0 -19
  136. data/docs/1.0.0/js/main.js +0 -25
  137. data/docs/1.0.0/js/navigation.js +0 -142
  138. data/docs/1.0.0/js/search_index.js +0 -1
  139. data/docs/1.0.0/js/searchdoc.js +0 -465
  140. data/docs/1.0.0/js/searcher.js +0 -229
  141. data/docs/1.0.0/panel/index.html +0 -47
  142. data/docs/1.0.0/panel/links.html +0 -32
  143. data/docs/1.0.0/panel/tree.js +0 -1
  144. data/docs/apple-touch-icon.png +0 -0
  145. data/docs/classes/Nanook.html +0 -572
  146. data/docs/classes/Nanook/Account.html +0 -907
  147. data/docs/classes/Nanook/Block.html +0 -717
  148. data/docs/classes/Nanook/Error.html +0 -84
  149. data/docs/classes/Nanook/Key.html +0 -253
  150. data/docs/classes/Nanook/Node.html +0 -657
  151. data/docs/classes/Nanook/Rpc.html +0 -247
  152. data/docs/classes/Nanook/Util.html +0 -197
  153. data/docs/classes/Nanook/Wallet.html +0 -778
  154. data/docs/classes/Nanook/WalletAccount.html +0 -447
  155. data/docs/classes/Nanook/WorkPeer.html +0 -294
  156. data/docs/created.rid +0 -14
  157. data/docs/css/github.css +0 -123
  158. data/docs/css/main.css +0 -374
  159. data/docs/css/panel.css +0 -360
  160. data/docs/css/reset.css +0 -48
  161. data/docs/favicon.ico +0 -0
  162. data/docs/files/README_md.html +0 -408
  163. data/docs/files/lib/nanook/account_rb.html +0 -89
  164. data/docs/files/lib/nanook/block_rb.html +0 -89
  165. data/docs/files/lib/nanook/error_rb.html +0 -89
  166. data/docs/files/lib/nanook/key_rb.html +0 -89
  167. data/docs/files/lib/nanook/node_rb.html +0 -89
  168. data/docs/files/lib/nanook/rpc_rb.html +0 -99
  169. data/docs/files/lib/nanook/util_rb.html +0 -89
  170. data/docs/files/lib/nanook/version_rb.html +0 -84
  171. data/docs/files/lib/nanook/wallet_account_rb.html +0 -89
  172. data/docs/files/lib/nanook/wallet_rb.html +0 -89
  173. data/docs/files/lib/nanook/work_peer_rb.html +0 -89
  174. data/docs/files/lib/nanook_rb.html +0 -94
  175. data/docs/i/arrow-down.svg +0 -8
  176. data/docs/i/arrow-right.svg +0 -8
  177. data/docs/i/search.svg +0 -12
  178. data/docs/i/tree_bg.svg +0 -8
  179. data/docs/index.html +0 -11
  180. data/docs/js/highlight.pack.js +0 -1
  181. data/docs/js/jquery-1.3.2.min.js +0 -19
  182. data/docs/js/main.js +0 -25
  183. data/docs/js/navigation.js +0 -142
  184. data/docs/js/search_index.js +0 -1
  185. data/docs/js/searchdoc.js +0 -465
  186. data/docs/js/searcher.js +0 -229
  187. data/docs/panel/index.html +0 -47
  188. data/docs/panel/links.html +0 -32
  189. data/docs/panel/tree.js +0 -1
@@ -1,1084 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Nanook::Wallet</title>
5
- <meta charset="UTF-8" />
6
- <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
7
- <link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
8
- <link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
9
- <script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
10
- <script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
11
- <script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
12
-
13
-
14
- <meta property="og:title" value="Nanook::Wallet">
15
-
16
-
17
-
18
- <meta name="description" content="The Nanook::Wallet class lets you manage your nano wallets, as well as some account-specific things like making and receiving payments.">
19
- <meta property="og:description" content="The Nanook::Wallet class lets you manage your nano wallets, as well as some account-specific things like making and receiving payments.">
20
-
21
-
22
- <meta name="keywords" content="Nanook::Wallet class">
23
-
24
- <meta name="keywords" content="new, account, accounts, balance, create, destroy, export, contains?, id, pay, receive, locked?, unlock, change_password">
25
-
26
- </head>
27
-
28
- <body>
29
- <div class="banner">
30
-
31
- <h1>
32
- <span class="type">Class</span>
33
- Nanook::Wallet
34
-
35
- <span class="parent">&lt;
36
-
37
- Object
38
-
39
- </span>
40
-
41
- </h1>
42
- <ul class="files">
43
-
44
- <li><a href="../../files/lib/nanook/wallet_rb.html">lib/nanook/wallet.rb</a></li>
45
-
46
- </ul>
47
- </div>
48
- <div id="bodyContent">
49
- <div id="content">
50
-
51
- <div class="description">
52
-
53
- <p>The <code>Nanook::Wallet</code> class lets you manage your nano wallets, as
54
- well as some account-specific things like making and receiving payments.</p>
55
-
56
- <p>Your wallets each have a seed, which is a 32-byte uppercase hex string that
57
- looks like this:</p>
58
-
59
- <pre><code>000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F
60
- </code></pre>
61
-
62
- <p>You can think of this string as your API key to the nano network. The
63
- person who knows it can do all read and write actions against the wallet
64
- and all accounts inside the wallet from anywhere on the nano network, not
65
- just on the node you created the wallet on. <strong>Make sure this key is
66
- always secret and safe</strong>. Do not commit your seed into source
67
- control.</p>
68
-
69
- <h3 id="class-Nanook::Wallet-label-Initializing">Initializing</h3>
70
-
71
- <p>Initialize this class through the convenient <a
72
- href="../Nanook.html#method-i-wallet">Nanook#wallet</a> method:</p>
73
-
74
- <pre><code>nanook = Nanook.new
75
- wallet = nanook.wallet(wallet_seed)
76
- </code></pre>
77
-
78
- <p>Or compose the longhand way like this:</p>
79
-
80
- <pre><code>rpc_conn = Nanook::Rpc.new
81
- wallet = Nanook::Wallet.new(rpc_conn, wallet_seed)
82
- </code></pre>
83
-
84
- </div>
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
- <!-- Method ref -->
100
- <div class="sectiontitle">Methods</div>
101
- <dl class="methods">
102
-
103
- <dt>A</dt>
104
- <dd>
105
- <ul>
106
-
107
-
108
- <li>
109
- <a href="#method-i-account">account</a>,
110
- </li>
111
-
112
-
113
- <li>
114
- <a href="#method-i-accounts">accounts</a>
115
- </li>
116
-
117
- </ul>
118
- </dd>
119
-
120
- <dt>B</dt>
121
- <dd>
122
- <ul>
123
-
124
-
125
- <li>
126
- <a href="#method-i-balance">balance</a>
127
- </li>
128
-
129
- </ul>
130
- </dd>
131
-
132
- <dt>C</dt>
133
- <dd>
134
- <ul>
135
-
136
-
137
- <li>
138
- <a href="#method-i-change_password">change_password</a>,
139
- </li>
140
-
141
-
142
- <li>
143
- <a href="#method-i-contains-3F">contains?</a>,
144
- </li>
145
-
146
-
147
- <li>
148
- <a href="#method-i-create">create</a>
149
- </li>
150
-
151
- </ul>
152
- </dd>
153
-
154
- <dt>D</dt>
155
- <dd>
156
- <ul>
157
-
158
-
159
- <li>
160
- <a href="#method-i-destroy">destroy</a>
161
- </li>
162
-
163
- </ul>
164
- </dd>
165
-
166
- <dt>E</dt>
167
- <dd>
168
- <ul>
169
-
170
-
171
- <li>
172
- <a href="#method-i-export">export</a>
173
- </li>
174
-
175
- </ul>
176
- </dd>
177
-
178
- <dt>I</dt>
179
- <dd>
180
- <ul>
181
-
182
-
183
- <li>
184
- <a href="#method-i-id">id</a>
185
- </li>
186
-
187
- </ul>
188
- </dd>
189
-
190
- <dt>L</dt>
191
- <dd>
192
- <ul>
193
-
194
-
195
- <li>
196
- <a href="#method-i-locked-3F">locked?</a>
197
- </li>
198
-
199
- </ul>
200
- </dd>
201
-
202
- <dt>N</dt>
203
- <dd>
204
- <ul>
205
-
206
-
207
- <li>
208
- <a href="#method-c-new">new</a>
209
- </li>
210
-
211
- </ul>
212
- </dd>
213
-
214
- <dt>P</dt>
215
- <dd>
216
- <ul>
217
-
218
-
219
- <li>
220
- <a href="#method-i-pay">pay</a>
221
- </li>
222
-
223
- </ul>
224
- </dd>
225
-
226
- <dt>R</dt>
227
- <dd>
228
- <ul>
229
-
230
-
231
- <li>
232
- <a href="#method-i-receive">receive</a>
233
- </li>
234
-
235
- </ul>
236
- </dd>
237
-
238
- <dt>U</dt>
239
- <dd>
240
- <ul>
241
-
242
-
243
- <li>
244
- <a href="#method-i-unlock">unlock</a>
245
- </li>
246
-
247
- </ul>
248
- </dd>
249
-
250
- </dl>
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
- <!-- Methods -->
270
-
271
- <div class="sectiontitle">Class Public methods</div>
272
-
273
- <div class="method">
274
- <div class="title method-title" id="method-c-new">
275
-
276
- <b>new</b>(rpc, wallet)
277
-
278
- <a href="../../classes/Nanook/Wallet.html#method-c-new" name="method-c-new" class="permalink">Link</a>
279
- </div>
280
-
281
-
282
- <div class="description">
283
-
284
- </div>
285
-
286
-
287
-
288
-
289
-
290
-
291
-
292
-
293
- <div class="sourcecode">
294
-
295
- <p class="source-link">
296
- Source:
297
- <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
298
-
299
- </p>
300
- <div id="method-c-new_source" class="dyn-source">
301
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 31</span>
302
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">rpc</span>, <span class="ruby-identifier">wallet</span>)
303
- <span class="ruby-ivar">@rpc</span> = <span class="ruby-identifier">rpc</span>
304
- <span class="ruby-ivar">@wallet</span> = <span class="ruby-identifier">wallet</span>
305
- <span class="ruby-keyword">end</span></pre>
306
- </div>
307
- </div>
308
-
309
- </div>
310
-
311
-
312
-
313
- <div class="sectiontitle">Instance Public methods</div>
314
-
315
- <div class="method">
316
- <div class="title method-title" id="method-i-account">
317
-
318
- <b>account</b>(account=nil)
319
-
320
- <a href="../../classes/Nanook/Wallet.html#method-i-account" name="method-i-account" class="permalink">Link</a>
321
- </div>
322
-
323
-
324
- <div class="description">
325
- <p>A convenient method that returns an account in your wallet, allowing you to
326
- perform all the actions in <a
327
- href="WalletAccount.html">Nanook::WalletAccount</a> on it.</p>
328
-
329
- <pre><code>wallet.account(&quot;xrb_...&quot;) #=&gt; Nanook::WalletAccount instance
330
- </code></pre>
331
-
332
- <p>See <a href="WalletAccount.html">Nanook::WalletAccount</a>.</p>
333
-
334
- <p>Will throw an ArgumentError if the wallet does not contain the account.</p>
335
-
336
- <h4 id="method-i-account-label-Arguments">Arguments</h4>
337
- <dl class="rdoc-list label-list"><dt><code>account</code>
338
- <dd>
339
- <p>Optional String of an account (starting with
340
- <code>&quot;xrb...&quot;</code>) to start working with. Must be an account
341
- within the wallet. When no account is given, the instance returned only
342
- allows you to call <code>create</code> on it, to create a new account.
343
- Otherwise, you must pass an account string for all other methods.</p>
344
- </dd></dl>
345
-
346
- <h4 id="method-i-account-label-Examples">Examples</h4>
347
-
348
- <pre><code>wallet.account.create # Creates an account in the wallet and returns a Nanook::WalletAccount
349
- wallet.account(account_id) # Returns a Nanook::WalletAccount for the account
350
- </code></pre>
351
- </div>
352
-
353
-
354
-
355
-
356
-
357
-
358
-
359
-
360
- <div class="sourcecode">
361
-
362
- <p class="source-link">
363
- Source:
364
- <a href="javascript:toggleSource('method-i-account_source')" id="l_method-i-account_source">show</a>
365
-
366
- </p>
367
- <div id="method-i-account_source" class="dyn-source">
368
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 57</span>
369
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">account</span>(<span class="ruby-identifier">account</span>=<span class="ruby-keyword">nil</span>)
370
- <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">WalletAccount</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@rpc</span>, <span class="ruby-ivar">@wallet</span>, <span class="ruby-identifier">account</span>)
371
- <span class="ruby-keyword">end</span></pre>
372
- </div>
373
- </div>
374
-
375
- </div>
376
-
377
- <div class="method">
378
- <div class="title method-title" id="method-i-accounts">
379
-
380
- <b>accounts</b>()
381
-
382
- <a href="../../classes/Nanook/Wallet.html#method-i-accounts" name="method-i-accounts" class="permalink">Link</a>
383
- </div>
384
-
385
-
386
- <div class="description">
387
- <p>Returns an Array with Strings of all account ids in the wallet.</p>
388
-
389
- <h4 id="method-i-accounts-label-Example+response">Example response</h4>
390
-
391
- <pre><code>[
392
- &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;,
393
- &quot;xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx&quot;
394
- ]
395
- </code></pre>
396
- </div>
397
-
398
-
399
-
400
-
401
-
402
-
403
-
404
-
405
- <div class="sourcecode">
406
-
407
- <p class="source-link">
408
- Source:
409
- <a href="javascript:toggleSource('method-i-accounts_source')" id="l_method-i-accounts_source">show</a>
410
-
411
- </p>
412
- <div id="method-i-accounts_source" class="dyn-source">
413
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 69</span>
414
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accounts</span>
415
- <span class="ruby-identifier">wallet_required!</span>
416
- <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:account_list</span>)[<span class="ruby-value">:accounts</span>]
417
- <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>)
418
- <span class="ruby-keyword">end</span></pre>
419
- </div>
420
- </div>
421
-
422
- </div>
423
-
424
- <div class="method">
425
- <div class="title method-title" id="method-i-balance">
426
-
427
- <b>balance</b>(account_break_down: false, unit: Nanook::WalletAccount::DEFAULT_UNIT)
428
-
429
- <a href="../../classes/Nanook/Wallet.html#method-i-balance" name="method-i-balance" class="permalink">Link</a>
430
- </div>
431
-
432
-
433
- <div class="description">
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
- &quot;balance&quot;=&gt;5,
461
- &quot;pending&quot;=&gt;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
- &quot;balance&quot;=&gt;5000000000000000000000000000000,
474
- &quot;pending&quot;=&gt;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
- &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;=&gt;{
487
- &quot;balance&quot;=&gt;2.5,
488
- &quot;pending&quot;=&gt;1
489
- },
490
- &quot;xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx&quot;=&gt;{
491
- &quot;balance&quot;=&gt;51.4,
492
- &quot;pending&quot;=&gt;0
493
- },
494
- }
495
- </code></pre>
496
- </div>
497
-
498
-
499
-
500
-
501
-
502
-
503
-
504
-
505
- <div class="sourcecode">
506
-
507
- <p class="source-link">
508
- Source:
509
- <a href="javascript:toggleSource('method-i-balance_source')" id="l_method-i-balance_source">show</a>
510
-
511
- </p>
512
- <div id="method-i-balance_source" class="dyn-source">
513
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 126</span>
514
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">balance</span>(<span class="ruby-value">account_break_down:</span> <span class="ruby-keyword">false</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>)
515
- <span class="ruby-identifier">wallet_required!</span>
516
-
517
- <span class="ruby-keyword">unless</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">UNITS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">unit</span>)
518
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Unsupported unit: #{unit}&quot;</span>)
519
- <span class="ruby-keyword">end</span>
520
-
521
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">account_break_down</span>
522
- <span class="ruby-keyword">return</span> <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">rpc</span>(<span class="ruby-value">:wallet_balances</span>)[<span class="ruby-value">:balances</span>], <span class="ruby-constant">Hash</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
523
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">unit</span> <span class="ruby-operator">==</span> <span class="ruby-value">:nano</span>
524
- <span class="ruby-identifier">r</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">account</span>, <span class="ruby-identifier">balances</span><span class="ruby-operator">|</span>
525
- <span class="ruby-identifier">r</span>[<span class="ruby-identifier">account</span>][<span class="ruby-value">:balance</span>] = <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">raw_to_NANO</span>(<span class="ruby-identifier">r</span>[<span class="ruby-identifier">account</span>][<span class="ruby-value">:balance</span>])
526
- <span class="ruby-identifier">r</span>[<span class="ruby-identifier">account</span>][<span class="ruby-value">:pending</span>] = <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">raw_to_NANO</span>(<span class="ruby-identifier">r</span>[<span class="ruby-identifier">account</span>][<span class="ruby-value">:balapendingnce</span>])
527
- <span class="ruby-keyword">end</span>
528
- <span class="ruby-keyword">end</span>
529
- <span class="ruby-keyword">end</span>
530
- <span class="ruby-keyword">end</span>
531
-
532
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_balance_total</span>).<span class="ruby-identifier">tap</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
533
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">unit</span> <span class="ruby-operator">==</span> <span class="ruby-value">:nano</span>
534
- <span class="ruby-identifier">r</span>[<span class="ruby-value">:balance</span>] = <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">raw_to_NANO</span>(<span class="ruby-identifier">r</span>[<span class="ruby-value">:balance</span>])
535
- <span class="ruby-identifier">r</span>[<span class="ruby-value">:pending</span>] = <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">raw_to_NANO</span>(<span class="ruby-identifier">r</span>[<span class="ruby-value">:pending</span>])
536
- <span class="ruby-keyword">end</span>
537
- <span class="ruby-keyword">end</span>
538
- <span class="ruby-keyword">end</span></pre>
539
- </div>
540
- </div>
541
-
542
- </div>
543
-
544
- <div class="method">
545
- <div class="title method-title" id="method-i-change_password">
546
-
547
- <b>change_password</b>(password)
548
-
549
- <a href="../../classes/Nanook/Wallet.html#method-i-change_password" name="method-i-change_password" class="permalink">Link</a>
550
- </div>
551
-
552
-
553
- <div class="description">
554
- <p>Changes the password for a wallet. Returns a boolean to indicate if the
555
- action was successful.</p>
556
-
557
- <h4 id="method-i-change_password-label-Example+response">Example response</h4>
558
-
559
- <pre><code>true
560
- </code></pre>
561
- </div>
562
-
563
-
564
-
565
-
566
-
567
-
568
-
569
-
570
- <div class="sourcecode">
571
-
572
- <p class="source-link">
573
- Source:
574
- <a href="javascript:toggleSource('method-i-change_password_source')" id="l_method-i-change_password_source">show</a>
575
-
576
- </p>
577
- <div id="method-i-change_password_source" class="dyn-source">
578
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 325</span>
579
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_password</span>(<span class="ruby-identifier">password</span>)
580
- <span class="ruby-identifier">wallet_required!</span>
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>
582
- <span class="ruby-keyword">end</span></pre>
583
- </div>
584
- </div>
585
-
586
- </div>
587
-
588
- <div class="method">
589
- <div class="title method-title" id="method-i-contains-3F">
590
-
591
- <b>contains?</b>(account)
592
-
593
- <a href="../../classes/Nanook/Wallet.html#method-i-contains-3F" name="method-i-contains-3F" class="permalink">Link</a>
594
- </div>
595
-
596
-
597
- <div class="description">
598
- <p>Returns boolean indicating if the wallet contains an account.</p>
599
-
600
- <h4 id="method-i-contains-3F-label-Arguments">Arguments</h4>
601
- <dl class="rdoc-list label-list"><dt><code>account</code>
602
- <dd>
603
- <p>String account id (will start with <code>&quot;xrb_...&quot;</code>)</p>
604
- </dd></dl>
605
-
606
- <h4 id="method-i-contains-3F-label-Example+response">Example response</h4>
607
-
608
- <pre><code>true
609
- </code></pre>
610
- </div>
611
-
612
-
613
-
614
-
615
-
616
-
617
-
618
-
619
- <div class="sourcecode">
620
-
621
- <p class="source-link">
622
- Source:
623
- <a href="javascript:toggleSource('method-i-contains-3F_source')" id="l_method-i-contains-3F_source">show</a>
624
-
625
- </p>
626
- <div id="method-i-contains-3F_source" class="dyn-source">
627
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 208</span>
628
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contains?</span>(<span class="ruby-identifier">account</span>)
629
- <span class="ruby-identifier">wallet_required!</span>
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>)
631
- <span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">response</span>[<span class="ruby-value">:exists</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
632
- <span class="ruby-keyword">end</span></pre>
633
- </div>
634
- </div>
635
-
636
- </div>
637
-
638
- <div class="method">
639
- <div class="title method-title" id="method-i-create">
640
-
641
- <b>create</b>()
642
-
643
- <a href="../../classes/Nanook/Wallet.html#method-i-create" name="method-i-create" class="permalink">Link</a>
644
- </div>
645
-
646
-
647
- <div class="description">
648
- <p>Creates a new wallet.</p>
649
-
650
- <pre><code>Nanook.new.wallet.create
651
- </code></pre>
652
-
653
- <h4 id="method-i-create-label-Very+important">Very important</h4>
654
-
655
- <p><strong>Please read this.</strong> The response of this method is a wallet
656
- seed. A seed is a 32-byte uppercase hex string. You can think of this
657
- string as your API key to the nano network. The person who knows it can do
658
- all read and write actions against the wallet and all accounts inside the
659
- wallet from anywhere on the nano network, not just on the node you created
660
- the wallet on.</p>
661
-
662
- <p>If you intend for your wallet to contain funds, then make sure that you
663
- consider the seed that is returned as the key to your funds and store it
664
- somewhere secret and safe. Only transmit the seed over secure (SSH or SSL)
665
- networks and do not store it where it is able to be easily comprised by a
666
- hacker, which includes your personal computer.</p>
667
-
668
- <h4 id="method-i-create-label-Example+response-3A">Example response:</h4>
669
-
670
- <pre><code>&quot;CC2C9846A44DB6F0363F647D12B957794AD937F59498D4E35C172C81E2888650&quot;
671
- </code></pre>
672
- </div>
673
-
674
-
675
-
676
-
677
-
678
-
679
-
680
-
681
- <div class="sourcecode">
682
-
683
- <p class="source-link">
684
- Source:
685
- <a href="javascript:toggleSource('method-i-create_source')" id="l_method-i-create_source">show</a>
686
-
687
- </p>
688
- <div id="method-i-create_source" class="dyn-source">
689
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 175</span>
690
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create</span>
691
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_create</span>)[<span class="ruby-value">:wallet</span>]
692
- <span class="ruby-keyword">end</span></pre>
693
- </div>
694
- </div>
695
-
696
- </div>
697
-
698
- <div class="method">
699
- <div class="title method-title" id="method-i-destroy">
700
-
701
- <b>destroy</b>()
702
-
703
- <a href="../../classes/Nanook/Wallet.html#method-i-destroy" name="method-i-destroy" class="permalink">Link</a>
704
- </div>
705
-
706
-
707
- <div class="description">
708
- <p>Destroy the wallet. Returns a boolean indicating whether the action was
709
- successful or not.</p>
710
-
711
- <h4 id="method-i-destroy-label-Example+Response">Example Response</h4>
712
-
713
- <pre><code>true
714
- </code></pre>
715
- </div>
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
- <div class="sourcecode">
725
-
726
- <p class="source-link">
727
- Source:
728
- <a href="javascript:toggleSource('method-i-destroy_source')" id="l_method-i-destroy_source">show</a>
729
-
730
- </p>
731
- <div id="method-i-destroy_source" class="dyn-source">
732
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 184</span>
733
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">destroy</span>
734
- <span class="ruby-identifier">wallet_required!</span>
735
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_destroy</span>)
736
- <span class="ruby-keyword">true</span>
737
- <span class="ruby-keyword">end</span></pre>
738
- </div>
739
- </div>
740
-
741
- </div>
742
-
743
- <div class="method">
744
- <div class="title method-title" id="method-i-export">
745
-
746
- <b>export</b>()
747
-
748
- <a href="../../classes/Nanook/Wallet.html#method-i-export" name="method-i-export" class="permalink">Link</a>
749
- </div>
750
-
751
-
752
- <div class="description">
753
- <p>Generates a String containing a JSON representation of your wallet.</p>
754
-
755
- <h4 id="method-i-export-label-Example+response">Example response</h4>
756
-
757
- <pre><code>&quot;{\n \&quot;0000000000000000000000000000000000000000000000000000000000000000\&quot;: \&quot;0000000000000000000000000000000000000000000000000000000000000003\&quot;,\n \&quot;0000000000000000000000000000000000000000000000000000000000000001\&quot;: \&quot;C3A176FC3B90113277BFC91F55128FC9A1F1B6166A73E7446927CFFCA4C2C9D9\&quot;,\n \&quot;0000000000000000000000000000000000000000000000000000000000000002\&quot;: \&quot;3E58EC805B99C52B4715598BD332C234A1FBF1780577137E18F53B9B7F85F04B\&quot;,\n \&quot;0000000000000000000000000000000000000000000000000000000000000003\&quot;: \&quot;5FF8021122F3DEE0E4EC4241D35A3F41DEF63CCF6ADA66AF235DE857718498CD\&quot;,\n \&quot;0000000000000000000000000000000000000000000000000000000000000004\&quot;: \&quot;A30E0A32ED41C8607AA9212843392E853FCBCB4E7CB194E35C94F07F91DE59EF\&quot;,\n \&quot;0000000000000000000000000000000000000000000000000000000000000005\&quot;: \&quot;E707002E84143AA5F030A6DB8DD0C0480F2FFA75AB1FFD657EC22B5AA8E395D5\&quot;,\n \&quot;0000000000000000000000000000000000000000000000000000000000000006\&quot;: \&quot;0000000000000000000000000000000000000000000000000000000000000001\&quot;,\n \&quot;8646C0423160DEAEAA64034F9C6858F7A5C8A329E73E825A5B16814F6CCAFFE3\&quot;: \&quot;0000000000000000000000000000000000000000000000000000000100000000\&quot;\n}\n&quot;
758
- </code></pre>
759
- </div>
760
-
761
-
762
-
763
-
764
-
765
-
766
-
767
-
768
- <div class="sourcecode">
769
-
770
- <p class="source-link">
771
- Source:
772
- <a href="javascript:toggleSource('method-i-export_source')" id="l_method-i-export_source">show</a>
773
-
774
- </p>
775
- <div id="method-i-export_source" class="dyn-source">
776
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 195</span>
777
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">export</span>
778
- <span class="ruby-identifier">wallet_required!</span>
779
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_export</span>)[<span class="ruby-value">:json</span>]
780
- <span class="ruby-keyword">end</span></pre>
781
- </div>
782
- </div>
783
-
784
- </div>
785
-
786
- <div class="method">
787
- <div class="title method-title" id="method-i-id">
788
-
789
- <b>id</b>()
790
-
791
- <a href="../../classes/Nanook/Wallet.html#method-i-id" name="method-i-id" class="permalink">Link</a>
792
- </div>
793
-
794
-
795
- <div class="description">
796
-
797
- </div>
798
-
799
-
800
-
801
-
802
-
803
-
804
-
805
-
806
- <div class="sourcecode">
807
-
808
- <p class="source-link">
809
- Source:
810
- <a href="javascript:toggleSource('method-i-id_source')" id="l_method-i-id_source">show</a>
811
-
812
- </p>
813
- <div id="method-i-id_source" class="dyn-source">
814
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 214</span>
815
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">id</span>
816
- <span class="ruby-ivar">@wallet</span>
817
- <span class="ruby-keyword">end</span></pre>
818
- </div>
819
- </div>
820
-
821
- </div>
822
-
823
- <div class="method">
824
- <div class="title method-title" id="method-i-locked-3F">
825
-
826
- <b>locked?</b>()
827
-
828
- <a href="../../classes/Nanook/Wallet.html#method-i-locked-3F" name="method-i-locked-3F" class="permalink">Link</a>
829
- </div>
830
-
831
-
832
- <div class="description">
833
- <p>Returns a boolean to indicate if the wallet is locked.</p>
834
-
835
- <h4 id="method-i-locked-3F-label-Example+response">Example response</h4>
836
-
837
- <pre><code>true
838
- </code></pre>
839
- </div>
840
-
841
-
842
-
843
-
844
-
845
-
846
-
847
-
848
- <div class="sourcecode">
849
-
850
- <p class="source-link">
851
- Source:
852
- <a href="javascript:toggleSource('method-i-locked-3F_source')" id="l_method-i-locked-3F_source">show</a>
853
-
854
- </p>
855
- <div id="method-i-locked-3F_source" class="dyn-source">
856
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 302</span>
857
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">locked?</span>
858
- <span class="ruby-identifier">wallet_required!</span>
859
- <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_locked</span>)
860
- <span class="ruby-operator">!</span><span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">response</span>[<span class="ruby-value">:locked</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
861
- <span class="ruby-keyword">end</span></pre>
862
- </div>
863
- </div>
864
-
865
- </div>
866
-
867
- <div class="method">
868
- <div class="title method-title" id="method-i-pay">
869
-
870
- <b>pay</b>(from:, to:, amount:, unit: Nanook::WalletAccount::DEFAULT_UNIT, id:)
871
-
872
- <a href="../../classes/Nanook/Wallet.html#method-i-pay" name="method-i-pay" class="permalink">Link</a>
873
- </div>
874
-
875
-
876
- <div class="description">
877
- <p>Make a payment from an account in your wallet to another account on the
878
- nano network. Returns a <em>send</em> block hash if successful, or an error
879
- String if unsuccessful.</p>
880
-
881
- <h4 id="method-i-pay-label-Arguments">Arguments</h4>
882
- <dl class="rdoc-list label-list"><dt><code>from:</code>
883
- <dd>
884
- <p>String account id of an account in your wallet</p>
885
- </dd><dt><code>to:</code>
886
- <dd>
887
- <p>String account id of the recipient of your payment</p>
888
- </dd><dt><code>amount:</code>
889
- <dd>
890
- <p>Can be either an Integer or Float.</p>
891
- </dd><dt><code>unit:</code>
892
- <dd>
893
- <p>Symbol (default is <code>:nano</code>). Represents the unit that
894
- <code>amount</code> is in. Must be either <code>:nano</code> or
895
- <code>:raw</code>. (Note: this method interprets <code>:nano</code> as
896
- NANO, which is technically Mnano See <a
897
- href="https://nano.org/en/faq#what-are-nano-units-">What are Nano’s
898
- Units</a>)</p>
899
- </dd><dt><code>id:</code>
900
- <dd>
901
- <p>String. Must be unique per payment. It serves an important purpose; it
902
- allows you to make the same call multiple times with the same
903
- <code>id</code> and be reassured that you will only ever send that nano
904
- payment once.</p>
905
- </dd></dl>
906
-
907
- <p>Note, there may be a delay in receiving a response due to Proof of Work
908
- being done. From the <a
909
- href="https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol#account-create">Nano
910
- RPC</a>:</p>
911
-
912
- <p><em>Proof of Work is precomputed for one transaction in the background. If
913
- it has been a while since your last transaction it will send instantly, the
914
- next one will need to wait for Proof of Work to be generated.</em></p>
915
-
916
- <h4 id="method-i-pay-label-Examples">Examples</h4>
917
-
918
- <pre><code>wallet.pay(from: &quot;xrb_...&quot;, to: &quot;xrb_...&quot;, amount: 1.1, id: &quot;myUniqueId123&quot;)
919
- wallet.pay(from: &quot;xrb_...&quot;, to: &quot;xrb_...&quot;, amount: 54000000000000, unit: :raw, id: &quot;myUniqueId123&quot;)
920
- </code></pre>
921
-
922
- <h4 id="method-i-pay-label-Example+responses">Example responses</h4>
923
-
924
- <pre><code>&quot;718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2&quot;
925
- </code></pre>
926
-
927
- <p>Or:</p>
928
-
929
- <pre><code>&quot;Account not found&quot;
930
- </code></pre>
931
- </div>
932
-
933
-
934
-
935
-
936
-
937
-
938
-
939
-
940
- <div class="sourcecode">
941
-
942
- <p class="source-link">
943
- Source:
944
- <a href="javascript:toggleSource('method-i-pay_source')" id="l_method-i-pay_source">show</a>
945
-
946
- </p>
947
- <div id="method-i-pay_source" class="dyn-source">
948
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 255</span>
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>)
950
- <span class="ruby-identifier">wallet_required!</span>
951
- <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">from</span>)
952
- <span class="ruby-identifier">account</span>(<span class="ruby-identifier">from</span>).<span class="ruby-identifier">pay</span>(<span class="ruby-value">to:</span> <span class="ruby-identifier">to</span>, <span class="ruby-value">amount:</span> <span class="ruby-identifier">amount</span>, <span class="ruby-value">unit:</span> <span class="ruby-identifier">unit</span>, <span class="ruby-value">id:</span> <span class="ruby-identifier">id</span>)
953
- <span class="ruby-keyword">end</span></pre>
954
- </div>
955
- </div>
956
-
957
- </div>
958
-
959
- <div class="method">
960
- <div class="title method-title" id="method-i-receive">
961
-
962
- <b>receive</b>(block=nil, into:)
963
-
964
- <a href="../../classes/Nanook/Wallet.html#method-i-receive" name="method-i-receive" class="permalink">Link</a>
965
- </div>
966
-
967
-
968
- <div class="description">
969
- <p>Receives a pending payment into an account in the wallet.</p>
970
-
971
- <p>When called with no <code>block</code> argument, the latest pending payment
972
- for the account will be received.</p>
973
-
974
- <p>Returns a <em>receive</em> block hash if a receive was successful, or
975
- <code>false</code> if there were no pending payments to receive.</p>
976
-
977
- <p>You can also receive a specific pending block if you know it by passing the
978
- block has in as an argument.</p>
979
-
980
- <h4 id="method-i-receive-label-Arguments">Arguments</h4>
981
- <dl class="rdoc-list label-list"><dt><code>block</code>
982
- <dd>
983
- <p>Optional block hash of pending payment. If not provided, the latest pending
984
- payment will be received</p>
985
- </dd><dt><code>into:</code>
986
- <dd>
987
- <p>String account id of account in your wallet to receive the payment into</p>
988
- </dd></dl>
989
-
990
- <h4 id="method-i-receive-label-Examples">Examples</h4>
991
-
992
- <pre><code>wallet.receive(into: &quot;xrb...&quot;)
993
- wallet.receive(&quot;718CC21...&quot;, into: &quot;xrb...&quot;)
994
- </code></pre>
995
-
996
- <h4 id="method-i-receive-label-Example+responses">Example responses</h4>
997
-
998
- <pre><code>&quot;718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2&quot;
999
- </code></pre>
1000
-
1001
- <p>Or:</p>
1002
-
1003
- <pre><code>false
1004
- </code></pre>
1005
- </div>
1006
-
1007
-
1008
-
1009
-
1010
-
1011
-
1012
-
1013
-
1014
- <div class="sourcecode">
1015
-
1016
- <p class="source-link">
1017
- Source:
1018
- <a href="javascript:toggleSource('method-i-receive_source')" id="l_method-i-receive_source">show</a>
1019
-
1020
- </p>
1021
- <div id="method-i-receive_source" class="dyn-source">
1022
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 291</span>
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>)
1024
- <span class="ruby-identifier">wallet_required!</span>
1025
- <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">into</span>)
1026
- <span class="ruby-identifier">account</span>(<span class="ruby-identifier">into</span>).<span class="ruby-identifier">receive</span>(<span class="ruby-identifier">block</span>)
1027
- <span class="ruby-keyword">end</span></pre>
1028
- </div>
1029
- </div>
1030
-
1031
- </div>
1032
-
1033
- <div class="method">
1034
- <div class="title method-title" id="method-i-unlock">
1035
-
1036
- <b>unlock</b>(password)
1037
-
1038
- <a href="../../classes/Nanook/Wallet.html#method-i-unlock" name="method-i-unlock" class="permalink">Link</a>
1039
- </div>
1040
-
1041
-
1042
- <div class="description">
1043
- <p>Unlocks a previously locked wallet. Returns a boolean to indicate if the
1044
- action was successful.</p>
1045
-
1046
- <h4 id="method-i-unlock-label-Example+response">Example response</h4>
1047
-
1048
- <pre><code>true
1049
- </code></pre>
1050
- </div>
1051
-
1052
-
1053
-
1054
-
1055
-
1056
-
1057
-
1058
-
1059
- <div class="sourcecode">
1060
-
1061
- <p class="source-link">
1062
- Source:
1063
- <a href="javascript:toggleSource('method-i-unlock_source')" id="l_method-i-unlock_source">show</a>
1064
-
1065
- </p>
1066
- <div id="method-i-unlock_source" class="dyn-source">
1067
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 314</span>
1068
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unlock</span>(<span class="ruby-identifier">password</span>)
1069
- <span class="ruby-identifier">wallet_required!</span>
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>
1071
- <span class="ruby-keyword">end</span></pre>
1072
- </div>
1073
- </div>
1074
-
1075
- </div>
1076
-
1077
-
1078
-
1079
-
1080
- </div>
1081
-
1082
- </div>
1083
- </body>
1084
- </html>