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,1056 +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, change_seed, 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-change_seed">change_seed</a>,
144
- </li>
145
-
146
-
147
- <li>
148
- <a href="#method-i-contains-3F">contains?</a>,
149
- </li>
150
-
151
-
152
- <li>
153
- <a href="#method-i-create">create</a>
154
- </li>
155
-
156
- </ul>
157
- </dd>
158
-
159
- <dt>D</dt>
160
- <dd>
161
- <ul>
162
-
163
-
164
- <li>
165
- <a href="#method-i-destroy">destroy</a>
166
- </li>
167
-
168
- </ul>
169
- </dd>
170
-
171
- <dt>E</dt>
172
- <dd>
173
- <ul>
174
-
175
-
176
- <li>
177
- <a href="#method-i-export">export</a>
178
- </li>
179
-
180
- </ul>
181
- </dd>
182
-
183
- <dt>I</dt>
184
- <dd>
185
- <ul>
186
-
187
-
188
- <li>
189
- <a href="#method-i-id">id</a>
190
- </li>
191
-
192
- </ul>
193
- </dd>
194
-
195
- <dt>L</dt>
196
- <dd>
197
- <ul>
198
-
199
-
200
- <li>
201
- <a href="#method-i-locked-3F">locked?</a>
202
- </li>
203
-
204
- </ul>
205
- </dd>
206
-
207
- <dt>N</dt>
208
- <dd>
209
- <ul>
210
-
211
-
212
- <li>
213
- <a href="#method-c-new">new</a>
214
- </li>
215
-
216
- </ul>
217
- </dd>
218
-
219
- <dt>P</dt>
220
- <dd>
221
- <ul>
222
-
223
-
224
- <li>
225
- <a href="#method-i-pay">pay</a>
226
- </li>
227
-
228
- </ul>
229
- </dd>
230
-
231
- <dt>R</dt>
232
- <dd>
233
- <ul>
234
-
235
-
236
- <li>
237
- <a href="#method-i-receive">receive</a>
238
- </li>
239
-
240
- </ul>
241
- </dd>
242
-
243
- <dt>U</dt>
244
- <dd>
245
- <ul>
246
-
247
-
248
- <li>
249
- <a href="#method-i-unlock">unlock</a>
250
- </li>
251
-
252
- </ul>
253
- </dd>
254
-
255
- </dl>
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
- <!-- Methods -->
275
-
276
- <div class="sectiontitle">Class Public methods</div>
277
-
278
- <div class="method">
279
- <div class="title method-title" id="method-c-new">
280
-
281
- <b>new</b>(rpc, wallet)
282
-
283
- <a href="../../classes/Nanook/Wallet.html#method-c-new" name="method-c-new" class="permalink">Link</a>
284
- </div>
285
-
286
-
287
- <div class="description">
288
-
289
- </div>
290
-
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
- <div class="sourcecode">
299
-
300
- <p class="source-link">
301
- Source:
302
- <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
303
-
304
- </p>
305
- <div id="method-c-new_source" class="dyn-source">
306
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 31</span>
307
- <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>)
308
- <span class="ruby-ivar">@rpc</span> = <span class="ruby-identifier">rpc</span>
309
- <span class="ruby-ivar">@wallet</span> = <span class="ruby-identifier">wallet</span>
310
- <span class="ruby-keyword">end</span></pre>
311
- </div>
312
- </div>
313
-
314
- </div>
315
-
316
-
317
-
318
- <div class="sectiontitle">Instance Public methods</div>
319
-
320
- <div class="method">
321
- <div class="title method-title" id="method-i-account">
322
-
323
- <b>account</b>(account=nil)
324
-
325
- <a href="../../classes/Nanook/Wallet.html#method-i-account" name="method-i-account" class="permalink">Link</a>
326
- </div>
327
-
328
-
329
- <div class="description">
330
- <p>A convenient method that returns an account in your wallet, allowing you to
331
- perform all the actions in <a
332
- href="WalletAccount.html">Nanook::WalletAccount</a> on it.</p>
333
-
334
- <pre><code>wallet.account(&quot;xrb_...&quot;) #=&gt; Nanook::WalletAccount instance
335
- </code></pre>
336
-
337
- <p>See <a href="WalletAccount.html">Nanook::WalletAccount</a>.</p>
338
-
339
- <p>Will throw an ArgumentError if the wallet does not contain the account.</p>
340
-
341
- <h4 id="method-i-account-label-Arguments">Arguments</h4>
342
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>account</code></td><td>
343
- <p>Optional String of an account (starting with
344
- <code>&quot;xrb...&quot;</code>) to start working with. Must be an account
345
- within the wallet. When no account is given, the instance returned only
346
- allows you to call <code>create</code> on it, to create a new account.
347
- Otherwise, you must pass an account string for all other methods.</p>
348
- </td></tr></tbody></table>
349
-
350
- <h4 id="method-i-account-label-Examples">Examples</h4>
351
-
352
- <pre><code>wallet.account.create # Creates an account in the wallet and returns a Nanook::WalletAccount
353
- wallet.account(account_id) # Returns a Nanook::WalletAccount for the account
354
- </code></pre>
355
- </div>
356
-
357
-
358
-
359
-
360
-
361
-
362
-
363
-
364
- <div class="sourcecode">
365
-
366
- <p class="source-link">
367
- Source:
368
- <a href="javascript:toggleSource('method-i-account_source')" id="l_method-i-account_source">show</a>
369
-
370
- </p>
371
- <div id="method-i-account_source" class="dyn-source">
372
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 57</span>
373
- <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>)
374
- <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>)
375
- <span class="ruby-keyword">end</span></pre>
376
- </div>
377
- </div>
378
-
379
- </div>
380
-
381
- <div class="method">
382
- <div class="title method-title" id="method-i-accounts">
383
-
384
- <b>accounts</b>()
385
-
386
- <a href="../../classes/Nanook/Wallet.html#method-i-accounts" name="method-i-accounts" class="permalink">Link</a>
387
- </div>
388
-
389
-
390
- <div class="description">
391
- <p>Returns an Array with Strings of all account ids in the wallet.</p>
392
-
393
- <h4 id="method-i-accounts-label-Example+response">Example response</h4>
394
-
395
- <pre><code>[
396
- &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;,
397
- &quot;xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx&quot;
398
- ]
399
- </code></pre>
400
- </div>
401
-
402
-
403
-
404
-
405
-
406
-
407
-
408
-
409
- <div class="sourcecode">
410
-
411
- <p class="source-link">
412
- Source:
413
- <a href="javascript:toggleSource('method-i-accounts_source')" id="l_method-i-accounts_source">show</a>
414
-
415
- </p>
416
- <div id="method-i-accounts_source" class="dyn-source">
417
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 69</span>
418
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accounts</span>
419
- <span class="ruby-identifier">wallet_required!</span>
420
- <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>]
421
- <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>)
422
- <span class="ruby-keyword">end</span></pre>
423
- </div>
424
- </div>
425
-
426
- </div>
427
-
428
- <div class="method">
429
- <div class="title method-title" id="method-i-balance">
430
-
431
- <b>balance</b>(account_break_down: false, unit: Nanook::WalletAccount::DEFAULT_UNIT)
432
-
433
- <a href="../../classes/Nanook/Wallet.html#method-i-balance" name="method-i-balance" class="permalink">Link</a>
434
- </div>
435
-
436
-
437
- <div class="description">
438
-
439
- </div>
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
- <div class="sourcecode">
449
-
450
- <p class="source-link">
451
- Source:
452
- <a href="javascript:toggleSource('method-i-balance_source')" id="l_method-i-balance_source">show</a>
453
-
454
- </p>
455
- <div id="method-i-balance_source" class="dyn-source">
456
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 126</span>
457
- <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>)
458
- <span class="ruby-identifier">wallet_required!</span>
459
-
460
- <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>)
461
- <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>)
462
- <span class="ruby-keyword">end</span>
463
-
464
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">account_break_down</span>
465
- <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>
466
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">unit</span> <span class="ruby-operator">==</span> <span class="ruby-value">:nano</span>
467
- <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>
468
- <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>])
469
- <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>])
470
- <span class="ruby-keyword">end</span>
471
- <span class="ruby-keyword">end</span>
472
- <span class="ruby-keyword">end</span>
473
- <span class="ruby-keyword">end</span>
474
-
475
- <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>
476
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">unit</span> <span class="ruby-operator">==</span> <span class="ruby-value">:nano</span>
477
- <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>])
478
- <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>])
479
- <span class="ruby-keyword">end</span>
480
- <span class="ruby-keyword">end</span>
481
- <span class="ruby-keyword">end</span></pre>
482
- </div>
483
- </div>
484
-
485
- </div>
486
-
487
- <div class="method">
488
- <div class="title method-title" id="method-i-change_password">
489
-
490
- <b>change_password</b>(password)
491
-
492
- <a href="../../classes/Nanook/Wallet.html#method-i-change_password" name="method-i-change_password" class="permalink">Link</a>
493
- </div>
494
-
495
-
496
- <div class="description">
497
- <p>Changes the password for a wallet. Returns a boolean to indicate if the
498
- action was successful.</p>
499
-
500
- <h4 id="method-i-change_password-label-Example+response">Example response</h4>
501
-
502
- <pre><code>true
503
- </code></pre>
504
- </div>
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
- <div class="sourcecode">
514
-
515
- <p class="source-link">
516
- Source:
517
- <a href="javascript:toggleSource('method-i-change_password_source')" id="l_method-i-change_password_source">show</a>
518
-
519
- </p>
520
- <div id="method-i-change_password_source" class="dyn-source">
521
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 329</span>
522
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_password</span>(<span class="ruby-identifier">password</span>)
523
- <span class="ruby-identifier">wallet_required!</span>
524
- <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>
525
- <span class="ruby-keyword">end</span></pre>
526
- </div>
527
- </div>
528
-
529
- </div>
530
-
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
- <div class="method">
569
- <div class="title method-title" id="method-i-contains-3F">
570
-
571
- <b>contains?</b>(account)
572
-
573
- <a href="../../classes/Nanook/Wallet.html#method-i-contains-3F" name="method-i-contains-3F" class="permalink">Link</a>
574
- </div>
575
-
576
-
577
- <div class="description">
578
- <p>Returns boolean indicating if the wallet contains an account.</p>
579
-
580
- <h4 id="method-i-contains-3F-label-Arguments">Arguments</h4>
581
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>account</code></td><td>
582
- <p>String account id (will start with <code>&quot;xrb_...&quot;</code>)</p>
583
- </td></tr></tbody></table>
584
-
585
- <h4 id="method-i-contains-3F-label-Example+response">Example response</h4>
586
-
587
- <pre><code>true
588
- </code></pre>
589
- </div>
590
-
591
-
592
-
593
-
594
-
595
-
596
-
597
-
598
- <div class="sourcecode">
599
-
600
- <p class="source-link">
601
- Source:
602
- <a href="javascript:toggleSource('method-i-contains-3F_source')" id="l_method-i-contains-3F_source">show</a>
603
-
604
- </p>
605
- <div id="method-i-contains-3F_source" class="dyn-source">
606
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 212</span>
607
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contains?</span>(<span class="ruby-identifier">account</span>)
608
- <span class="ruby-identifier">wallet_required!</span>
609
- <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>)
610
- <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>
611
- <span class="ruby-keyword">end</span></pre>
612
- </div>
613
- </div>
614
-
615
- </div>
616
-
617
- <div class="method">
618
- <div class="title method-title" id="method-i-create">
619
-
620
- <b>create</b>()
621
-
622
- <a href="../../classes/Nanook/Wallet.html#method-i-create" name="method-i-create" class="permalink">Link</a>
623
- </div>
624
-
625
-
626
- <div class="description">
627
- <p>Creates a new wallet.</p>
628
-
629
- <pre><code>Nanook.new.wallet.create
630
- </code></pre>
631
-
632
- <h4 id="method-i-create-label-Very+important">Very important</h4>
633
-
634
- <p><strong>Please read this.</strong> The response of this method is a wallet
635
- seed. A seed is a 32-byte uppercase hex string. You can think of this
636
- string as your API key to the nano network. The person who knows it can do
637
- all read and write actions against the wallet and all accounts inside the
638
- wallet from anywhere on the nano network, not just on the node you created
639
- the wallet on.</p>
640
-
641
- <p>If you intend for your wallet to contain funds, then make sure that you
642
- consider the seed that is returned as the key to your funds and store it
643
- somewhere secret and safe. Only transmit the seed over secure (SSH or SSL)
644
- networks and do not store it where it is able to be easily comprised by a
645
- hacker, which includes your personal computer.</p>
646
-
647
- <h4 id="method-i-create-label-Example+response-3A">Example response:</h4>
648
-
649
- <pre><code>&quot;CC2C9846A44DB6F0363F647D12B957794AD937F59498D4E35C172C81E2888650&quot;
650
- </code></pre>
651
- </div>
652
-
653
-
654
-
655
-
656
-
657
-
658
-
659
-
660
- <div class="sourcecode">
661
-
662
- <p class="source-link">
663
- Source:
664
- <a href="javascript:toggleSource('method-i-create_source')" id="l_method-i-create_source">show</a>
665
-
666
- </p>
667
- <div id="method-i-create_source" class="dyn-source">
668
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 179</span>
669
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create</span>
670
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_create</span>)[<span class="ruby-value">:wallet</span>]
671
- <span class="ruby-keyword">end</span></pre>
672
- </div>
673
- </div>
674
-
675
- </div>
676
-
677
- <div class="method">
678
- <div class="title method-title" id="method-i-destroy">
679
-
680
- <b>destroy</b>()
681
-
682
- <a href="../../classes/Nanook/Wallet.html#method-i-destroy" name="method-i-destroy" class="permalink">Link</a>
683
- </div>
684
-
685
-
686
- <div class="description">
687
- <p>Destroy the wallet. Returns a boolean indicating whether the action was
688
- successful or not.</p>
689
-
690
- <h4 id="method-i-destroy-label-Example+Response">Example Response</h4>
691
-
692
- <pre><code>true
693
- </code></pre>
694
- </div>
695
-
696
-
697
-
698
-
699
-
700
-
701
-
702
-
703
- <div class="sourcecode">
704
-
705
- <p class="source-link">
706
- Source:
707
- <a href="javascript:toggleSource('method-i-destroy_source')" id="l_method-i-destroy_source">show</a>
708
-
709
- </p>
710
- <div id="method-i-destroy_source" class="dyn-source">
711
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 188</span>
712
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">destroy</span>
713
- <span class="ruby-identifier">wallet_required!</span>
714
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_destroy</span>)
715
- <span class="ruby-keyword">true</span>
716
- <span class="ruby-keyword">end</span></pre>
717
- </div>
718
- </div>
719
-
720
- </div>
721
-
722
- <div class="method">
723
- <div class="title method-title" id="method-i-export">
724
-
725
- <b>export</b>()
726
-
727
- <a href="../../classes/Nanook/Wallet.html#method-i-export" name="method-i-export" class="permalink">Link</a>
728
- </div>
729
-
730
-
731
- <div class="description">
732
- <p>Generates a String containing a JSON representation of your wallet.</p>
733
-
734
- <h4 id="method-i-export-label-Example+response">Example response</h4>
735
-
736
- <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;
737
- </code></pre>
738
- </div>
739
-
740
-
741
-
742
-
743
-
744
-
745
-
746
-
747
- <div class="sourcecode">
748
-
749
- <p class="source-link">
750
- Source:
751
- <a href="javascript:toggleSource('method-i-export_source')" id="l_method-i-export_source">show</a>
752
-
753
- </p>
754
- <div id="method-i-export_source" class="dyn-source">
755
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 199</span>
756
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">export</span>
757
- <span class="ruby-identifier">wallet_required!</span>
758
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_export</span>)[<span class="ruby-value">:json</span>]
759
- <span class="ruby-keyword">end</span></pre>
760
- </div>
761
- </div>
762
-
763
- </div>
764
-
765
- <div class="method">
766
- <div class="title method-title" id="method-i-id">
767
-
768
- <b>id</b>()
769
-
770
- <a href="../../classes/Nanook/Wallet.html#method-i-id" name="method-i-id" class="permalink">Link</a>
771
- </div>
772
-
773
-
774
- <div class="description">
775
-
776
- </div>
777
-
778
-
779
-
780
-
781
-
782
-
783
-
784
-
785
- <div class="sourcecode">
786
-
787
- <p class="source-link">
788
- Source:
789
- <a href="javascript:toggleSource('method-i-id_source')" id="l_method-i-id_source">show</a>
790
-
791
- </p>
792
- <div id="method-i-id_source" class="dyn-source">
793
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 218</span>
794
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">id</span>
795
- <span class="ruby-ivar">@wallet</span>
796
- <span class="ruby-keyword">end</span></pre>
797
- </div>
798
- </div>
799
-
800
- </div>
801
-
802
- <div class="method">
803
- <div class="title method-title" id="method-i-locked-3F">
804
-
805
- <b>locked?</b>()
806
-
807
- <a href="../../classes/Nanook/Wallet.html#method-i-locked-3F" name="method-i-locked-3F" class="permalink">Link</a>
808
- </div>
809
-
810
-
811
- <div class="description">
812
- <p>Returns a boolean to indicate if the wallet is locked.</p>
813
-
814
- <h4 id="method-i-locked-3F-label-Example+response">Example response</h4>
815
-
816
- <pre><code>true
817
- </code></pre>
818
- </div>
819
-
820
-
821
-
822
-
823
-
824
-
825
-
826
-
827
- <div class="sourcecode">
828
-
829
- <p class="source-link">
830
- Source:
831
- <a href="javascript:toggleSource('method-i-locked-3F_source')" id="l_method-i-locked-3F_source">show</a>
832
-
833
- </p>
834
- <div id="method-i-locked-3F_source" class="dyn-source">
835
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 306</span>
836
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">locked?</span>
837
- <span class="ruby-identifier">wallet_required!</span>
838
- <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_locked</span>)
839
- <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>
840
- <span class="ruby-keyword">end</span></pre>
841
- </div>
842
- </div>
843
-
844
- </div>
845
-
846
- <div class="method">
847
- <div class="title method-title" id="method-i-pay">
848
-
849
- <b>pay</b>(from:, to:, amount:, unit: Nanook::WalletAccount::DEFAULT_UNIT, id:)
850
-
851
- <a href="../../classes/Nanook/Wallet.html#method-i-pay" name="method-i-pay" class="permalink">Link</a>
852
- </div>
853
-
854
-
855
- <div class="description">
856
- <p>Make a payment from an account in your wallet to another account on the
857
- nano network. Returns a <em>send</em> block hash if successful, or an error
858
- String if unsuccessful.</p>
859
-
860
- <h4 id="method-i-pay-label-Arguments">Arguments</h4>
861
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>from:</code></td><td>
862
- <p>String account id of an account in your wallet</p>
863
- </td></tr><tr><td class='label'><code>to:</code></td><td>
864
- <p>String account id of the recipient of your payment</p>
865
- </td></tr><tr><td class='label'><code>amount:</code></td><td>
866
- <p>Can be either an Integer or Float.</p>
867
- </td></tr><tr><td class='label'><code>unit:</code></td><td>
868
- <p>Symbol (default is <code>:nano</code>). Represents the unit that
869
- <code>amount</code> is in. Must be either <code>:nano</code> or
870
- <code>:raw</code>. (Note: this method interprets <code>:nano</code> as
871
- NANO, which is technically Mnano See <a
872
- href="https://nano.org/en/faq#what-are-nano-units-">What are Nano’s
873
- Units</a>)</p>
874
- </td></tr><tr><td class='label'><code>id:</code></td><td>
875
- <p>String. Must be unique per payment. It serves an important purpose; it
876
- allows you to make the same call multiple times with the same
877
- <code>id</code> and be reassured that you will only ever send that nano
878
- payment once.</p>
879
- </td></tr></tbody></table>
880
-
881
- <p>Note, there may be a delay in receiving a response due to Proof of Work
882
- being done. From the <a
883
- href="https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol#account-create">Nano
884
- RPC</a>:</p>
885
-
886
- <p><em>Proof of Work is precomputed for one transaction in the background. If
887
- it has been a while since your last transaction it will send instantly, the
888
- next one will need to wait for Proof of Work to be generated.</em></p>
889
-
890
- <h4 id="method-i-pay-label-Examples">Examples</h4>
891
-
892
- <pre><code>wallet.pay(from: &quot;xrb_...&quot;, to: &quot;xrb_...&quot;, amount: 1.1, id: &quot;myUniqueId123&quot;)
893
- wallet.pay(from: &quot;xrb_...&quot;, to: &quot;xrb_...&quot;, amount: 54000000000000, unit: :raw, id: &quot;myUniqueId123&quot;)
894
- </code></pre>
895
-
896
- <h4 id="method-i-pay-label-Example+responses">Example responses</h4>
897
-
898
- <pre><code>&quot;718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2&quot;
899
- </code></pre>
900
-
901
- <p>Or:</p>
902
-
903
- <pre><code>&quot;Account not found&quot;
904
- </code></pre>
905
- </div>
906
-
907
-
908
-
909
-
910
-
911
-
912
-
913
-
914
- <div class="sourcecode">
915
-
916
- <p class="source-link">
917
- Source:
918
- <a href="javascript:toggleSource('method-i-pay_source')" id="l_method-i-pay_source">show</a>
919
-
920
- </p>
921
- <div id="method-i-pay_source" class="dyn-source">
922
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 259</span>
923
- <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
- <span class="ruby-identifier">wallet_required!</span>
925
- <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">from</span>)
926
- <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>)
927
- <span class="ruby-keyword">end</span></pre>
928
- </div>
929
- </div>
930
-
931
- </div>
932
-
933
- <div class="method">
934
- <div class="title method-title" id="method-i-receive">
935
-
936
- <b>receive</b>(block=nil, into:)
937
-
938
- <a href="../../classes/Nanook/Wallet.html#method-i-receive" name="method-i-receive" class="permalink">Link</a>
939
- </div>
940
-
941
-
942
- <div class="description">
943
- <p>Receives a pending payment into an account in the wallet.</p>
944
-
945
- <p>When called with no <code>block</code> argument, the latest pending payment
946
- for the account will be received.</p>
947
-
948
- <p>Returns a <em>receive</em> block hash if a receive was successful, or
949
- <code>false</code> if there were no pending payments to receive.</p>
950
-
951
- <p>You can also receive a specific pending block if you know it by passing the
952
- block has in as an argument.</p>
953
-
954
- <h4 id="method-i-receive-label-Arguments">Arguments</h4>
955
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>block</code></td><td>
956
- <p>Optional block hash of pending payment. If not provided, the latest pending
957
- payment will be received</p>
958
- </td></tr><tr><td class='label'><code>into:</code></td><td>
959
- <p>String account id of account in your wallet to receive the payment into</p>
960
- </td></tr></tbody></table>
961
-
962
- <h4 id="method-i-receive-label-Examples">Examples</h4>
963
-
964
- <pre><code>wallet.receive(into: &quot;xrb...&quot;)
965
- wallet.receive(&quot;718CC21...&quot;, into: &quot;xrb...&quot;)
966
- </code></pre>
967
-
968
- <h4 id="method-i-receive-label-Example+responses">Example responses</h4>
969
-
970
- <pre><code>&quot;718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2&quot;
971
- </code></pre>
972
-
973
- <p>Or:</p>
974
-
975
- <pre><code>false
976
- </code></pre>
977
- </div>
978
-
979
-
980
-
981
-
982
-
983
-
984
-
985
-
986
- <div class="sourcecode">
987
-
988
- <p class="source-link">
989
- Source:
990
- <a href="javascript:toggleSource('method-i-receive_source')" id="l_method-i-receive_source">show</a>
991
-
992
- </p>
993
- <div id="method-i-receive_source" class="dyn-source">
994
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 295</span>
995
- <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
- <span class="ruby-identifier">wallet_required!</span>
997
- <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">into</span>)
998
- <span class="ruby-identifier">account</span>(<span class="ruby-identifier">into</span>).<span class="ruby-identifier">receive</span>(<span class="ruby-identifier">block</span>)
999
- <span class="ruby-keyword">end</span></pre>
1000
- </div>
1001
- </div>
1002
-
1003
- </div>
1004
-
1005
- <div class="method">
1006
- <div class="title method-title" id="method-i-unlock">
1007
-
1008
- <b>unlock</b>(password)
1009
-
1010
- <a href="../../classes/Nanook/Wallet.html#method-i-unlock" name="method-i-unlock" class="permalink">Link</a>
1011
- </div>
1012
-
1013
-
1014
- <div class="description">
1015
- <p>Unlocks a previously locked wallet. Returns a boolean to indicate if the
1016
- action was successful.</p>
1017
-
1018
- <h4 id="method-i-unlock-label-Example+response">Example response</h4>
1019
-
1020
- <pre><code>true
1021
- </code></pre>
1022
- </div>
1023
-
1024
-
1025
-
1026
-
1027
-
1028
-
1029
-
1030
-
1031
- <div class="sourcecode">
1032
-
1033
- <p class="source-link">
1034
- Source:
1035
- <a href="javascript:toggleSource('method-i-unlock_source')" id="l_method-i-unlock_source">show</a>
1036
-
1037
- </p>
1038
- <div id="method-i-unlock_source" class="dyn-source">
1039
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 318</span>
1040
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unlock</span>(<span class="ruby-identifier">password</span>)
1041
- <span class="ruby-identifier">wallet_required!</span>
1042
- <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>
1043
- <span class="ruby-keyword">end</span></pre>
1044
- </div>
1045
- </div>
1046
-
1047
- </div>
1048
-
1049
-
1050
-
1051
-
1052
- </div>
1053
-
1054
- </div>
1055
- </body>
1056
- </html>