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,247 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Nanook::Rpc</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::Rpc">
15
-
16
-
17
-
18
- <meta name="keywords" content="Nanook::Rpc class">
19
-
20
- <meta name="keywords" content="new, call">
21
-
22
- </head>
23
-
24
- <body>
25
- <div class="banner">
26
-
27
- <h1>
28
- <span class="type">Class</span>
29
- Nanook::Rpc
30
-
31
- <span class="parent">&lt;
32
-
33
- Object
34
-
35
- </span>
36
-
37
- </h1>
38
- <ul class="files">
39
-
40
- <li><a href="../../files/lib/nanook/rpc_rb.html">lib/nanook/rpc.rb</a></li>
41
-
42
- </ul>
43
- </div>
44
- <div id="bodyContent">
45
- <div id="content">
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
- <!-- Method ref -->
61
- <div class="sectiontitle">Methods</div>
62
- <dl class="methods">
63
-
64
- <dt>C</dt>
65
- <dd>
66
- <ul>
67
-
68
-
69
- <li>
70
- <a href="#method-i-call">call</a>
71
- </li>
72
-
73
- </ul>
74
- </dd>
75
-
76
- <dt>N</dt>
77
- <dd>
78
- <ul>
79
-
80
-
81
- <li>
82
- <a href="#method-c-new">new</a>
83
- </li>
84
-
85
- </ul>
86
- </dd>
87
-
88
- </dl>
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
- <!-- Section constants -->
103
- <div class="sectiontitle">Constants</div>
104
- <table border='0' cellpadding='5'>
105
-
106
- <tr valign='top'>
107
- <td class="attr-name">DEFAULT_TIMEOUT</td>
108
- <td>=</td>
109
- <td class="attr-value">500</td>
110
- </tr>
111
-
112
- <tr valign='top'>
113
- <td>&nbsp;</td>
114
- <td colspan="2" class="attr-desc"></td>
115
- </tr>
116
-
117
-
118
- <tr valign='top'>
119
- <td class="attr-name">DEFAULT_URI</td>
120
- <td>=</td>
121
- <td class="attr-value">&quot;http://localhost:7076&quot;</td>
122
- </tr>
123
-
124
- <tr valign='top'>
125
- <td>&nbsp;</td>
126
- <td colspan="2" class="attr-desc"></td>
127
- </tr>
128
-
129
-
130
- </table>
131
-
132
-
133
-
134
-
135
-
136
-
137
- <!-- Methods -->
138
-
139
- <div class="sectiontitle">Class Public methods</div>
140
-
141
- <div class="method">
142
- <div class="title method-title" id="method-c-new">
143
-
144
- <b>new</b>(uri=DEFAULT_URI, timeout:DEFAULT_TIMEOUT)
145
-
146
- <a href="../../classes/Nanook/Rpc.html#method-c-new" name="method-c-new" class="permalink">Link</a>
147
- </div>
148
-
149
-
150
- <div class="description">
151
-
152
- </div>
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
- <div class="sourcecode">
162
-
163
- <p class="source-link">
164
- Source:
165
- <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
166
-
167
- </p>
168
- <div id="method-c-new_source" class="dyn-source">
169
- <pre><span class="ruby-comment"># File lib/nanook/rpc.rb, line 10</span>
170
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-constant">DEFAULT_URI</span>, <span class="ruby-value">timeout:</span><span class="ruby-constant">DEFAULT_TIMEOUT</span>)
171
- <span class="ruby-identifier">rpc_server</span> = <span class="ruby-constant">URI</span>(<span class="ruby-identifier">uri</span>)
172
-
173
- <span class="ruby-keyword">unless</span> [<span class="ruby-string">&#39;http&#39;</span>, <span class="ruby-string">&#39;https&#39;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">scheme</span>)
174
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;URI must have http or https in it. Was given: #{uri}&quot;</span>)
175
- <span class="ruby-keyword">end</span>
176
-
177
- <span class="ruby-ivar">@http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">port</span>)
178
- <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">read_timeout</span> = <span class="ruby-identifier">timeout</span>
179
- <span class="ruby-ivar">@request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rpc_server</span>.<span class="ruby-identifier">request_uri</span>, {<span class="ruby-string">&quot;user-agent&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-string">&quot;Ruby nanook gem&quot;</span>})
180
- <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-string">&quot;application/json&quot;</span>
181
- <span class="ruby-keyword">end</span></pre>
182
- </div>
183
- </div>
184
-
185
- </div>
186
-
187
-
188
-
189
- <div class="sectiontitle">Instance Public methods</div>
190
-
191
- <div class="method">
192
- <div class="title method-title" id="method-i-call">
193
-
194
- <b>call</b>(action, params={})
195
-
196
- <a href="../../classes/Nanook/Rpc.html#method-i-call" name="method-i-call" class="permalink">Link</a>
197
- </div>
198
-
199
-
200
- <div class="description">
201
-
202
- </div>
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
- <div class="sourcecode">
212
-
213
- <p class="source-link">
214
- Source:
215
- <a href="javascript:toggleSource('method-i-call_source')" id="l_method-i-call_source">show</a>
216
-
217
- </p>
218
- <div id="method-i-call_source" class="dyn-source">
219
- <pre><span class="ruby-comment"># File lib/nanook/rpc.rb, line 23</span>
220
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">call</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">params</span>={})
221
- <span class="ruby-comment"># Stringify param values</span>
222
- <span class="ruby-identifier">params</span> = <span class="ruby-constant">Hash</span>[<span class="ruby-identifier">params</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>] }]
223
-
224
- <span class="ruby-ivar">@request</span>.<span class="ruby-identifier">body</span> = { <span class="ruby-value">action:</span> <span class="ruby-identifier">action</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">params</span>).<span class="ruby-identifier">to_json</span>
225
-
226
- <span class="ruby-identifier">response</span> = <span class="ruby-ivar">@http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-ivar">@request</span>)
227
-
228
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span>)
229
- <span class="ruby-identifier">hash</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
230
- <span class="ruby-identifier">process_hash</span>(<span class="ruby-identifier">hash</span>)
231
- <span class="ruby-keyword">else</span>
232
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Encountered net/http error #{response.code}: #{response.class.name}&quot;</span>)
233
- <span class="ruby-keyword">end</span>
234
- <span class="ruby-keyword">end</span></pre>
235
- </div>
236
- </div>
237
-
238
- </div>
239
-
240
-
241
-
242
-
243
- </div>
244
-
245
- </div>
246
- </body>
247
- </html>
@@ -1,197 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Nanook::Util</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::Util">
15
-
16
-
17
-
18
- <meta name="keywords" content="Nanook::Util class">
19
-
20
- <meta name="keywords" content="NANO_to_raw, coerce_empty_string_to_type">
21
-
22
- </head>
23
-
24
- <body>
25
- <div class="banner">
26
-
27
- <h1>
28
- <span class="type">Class</span>
29
- Nanook::Util
30
-
31
- <span class="parent">&lt;
32
-
33
- Object
34
-
35
- </span>
36
-
37
- </h1>
38
- <ul class="files">
39
-
40
- <li><a href="../../files/lib/nanook/util_rb.html">lib/nanook/util.rb</a></li>
41
-
42
- </ul>
43
- </div>
44
- <div id="bodyContent">
45
- <div id="content">
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
- <!-- Method ref -->
61
- <div class="sectiontitle">Methods</div>
62
- <dl class="methods">
63
-
64
- <dt>N</dt>
65
- <dd>
66
- <ul>
67
-
68
-
69
- <li>
70
- <a href="#method-c-NANO_to_raw">NANO_to_raw</a>
71
- </li>
72
-
73
- </ul>
74
- </dd>
75
-
76
- <dt>C</dt>
77
- <dd>
78
- <ul>
79
-
80
-
81
- <li>
82
- <a href="#method-c-coerce_empty_string_to_type">coerce_empty_string_to_type</a>
83
- </li>
84
-
85
- </ul>
86
- </dd>
87
-
88
- </dl>
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
- <!-- Methods -->
108
-
109
- <div class="sectiontitle">Class Public methods</div>
110
-
111
- <div class="method">
112
- <div class="title method-title" id="method-c-NANO_to_raw">
113
-
114
- <b>NANO_to_raw</b>(nano)
115
-
116
- <a href="../../classes/Nanook/Util.html#method-c-NANO_to_raw" name="method-c-NANO_to_raw" class="permalink">Link</a>
117
- </div>
118
-
119
-
120
- <div class="description">
121
-
122
- </div>
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
- <div class="sourcecode">
132
-
133
- <p class="source-link">
134
- Source:
135
- <a href="javascript:toggleSource('method-c-NANO_to_raw_source')" id="l_method-c-NANO_to_raw_source">show</a>
136
-
137
- </p>
138
- <div id="method-c-NANO_to_raw_source" class="dyn-source">
139
- <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 4</span>
140
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-constant">NANO_to_raw</span>(<span class="ruby-identifier ruby-title">nano</span>)
141
- <span class="ruby-identifier">nano</span> <span class="ruby-operator">*</span> (<span class="ruby-value">10</span><span class="ruby-operator">**</span><span class="ruby-value">30</span>)
142
- <span class="ruby-keyword">end</span></pre>
143
- </div>
144
- </div>
145
-
146
- </div>
147
-
148
- <div class="method">
149
- <div class="title method-title" id="method-c-coerce_empty_string_to_type">
150
-
151
- <b>coerce_empty_string_to_type</b>(response, type)
152
-
153
- <a href="../../classes/Nanook/Util.html#method-c-coerce_empty_string_to_type" name="method-c-coerce_empty_string_to_type" class="permalink">Link</a>
154
- </div>
155
-
156
-
157
- <div class="description">
158
-
159
- </div>
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
- <div class="sourcecode">
169
-
170
- <p class="source-link">
171
- Source:
172
- <a href="javascript:toggleSource('method-c-coerce_empty_string_to_type_source')" id="l_method-c-coerce_empty_string_to_type_source">show</a>
173
-
174
- </p>
175
- <div id="method-c-coerce_empty_string_to_type_source" class="dyn-source">
176
- <pre><span class="ruby-comment"># File lib/nanook/util.rb, line 8</span>
177
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">type</span>)
178
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;&quot;</span>
179
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">new</span>
180
- <span class="ruby-keyword">end</span>
181
-
182
- <span class="ruby-identifier">response</span>
183
- <span class="ruby-keyword">end</span></pre>
184
- </div>
185
- </div>
186
-
187
- </div>
188
-
189
-
190
-
191
-
192
-
193
- </div>
194
-
195
- </div>
196
- </body>
197
- </html>
@@ -1,986 +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?, 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>L</dt>
179
- <dd>
180
- <ul>
181
-
182
-
183
- <li>
184
- <a href="#method-i-locked-3F">locked?</a>
185
- </li>
186
-
187
- </ul>
188
- </dd>
189
-
190
- <dt>N</dt>
191
- <dd>
192
- <ul>
193
-
194
-
195
- <li>
196
- <a href="#method-c-new">new</a>
197
- </li>
198
-
199
- </ul>
200
- </dd>
201
-
202
- <dt>P</dt>
203
- <dd>
204
- <ul>
205
-
206
-
207
- <li>
208
- <a href="#method-i-pay">pay</a>
209
- </li>
210
-
211
- </ul>
212
- </dd>
213
-
214
- <dt>R</dt>
215
- <dd>
216
- <ul>
217
-
218
-
219
- <li>
220
- <a href="#method-i-receive">receive</a>
221
- </li>
222
-
223
- </ul>
224
- </dd>
225
-
226
- <dt>U</dt>
227
- <dd>
228
- <ul>
229
-
230
-
231
- <li>
232
- <a href="#method-i-unlock">unlock</a>
233
- </li>
234
-
235
- </ul>
236
- </dd>
237
-
238
- </dl>
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
- <!-- Methods -->
258
-
259
- <div class="sectiontitle">Class Public methods</div>
260
-
261
- <div class="method">
262
- <div class="title method-title" id="method-c-new">
263
-
264
- <b>new</b>(rpc, wallet)
265
-
266
- <a href="../../classes/Nanook/Wallet.html#method-c-new" name="method-c-new" class="permalink">Link</a>
267
- </div>
268
-
269
-
270
- <div class="description">
271
-
272
- </div>
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
- <div class="sourcecode">
282
-
283
- <p class="source-link">
284
- Source:
285
- <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
286
-
287
- </p>
288
- <div id="method-c-new_source" class="dyn-source">
289
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 31</span>
290
- <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>)
291
- <span class="ruby-ivar">@rpc</span> = <span class="ruby-identifier">rpc</span>
292
- <span class="ruby-ivar">@wallet</span> = <span class="ruby-identifier">wallet</span>
293
- <span class="ruby-keyword">end</span></pre>
294
- </div>
295
- </div>
296
-
297
- </div>
298
-
299
-
300
-
301
- <div class="sectiontitle">Instance Public methods</div>
302
-
303
- <div class="method">
304
- <div class="title method-title" id="method-i-account">
305
-
306
- <b>account</b>(account=nil)
307
-
308
- <a href="../../classes/Nanook/Wallet.html#method-i-account" name="method-i-account" class="permalink">Link</a>
309
- </div>
310
-
311
-
312
- <div class="description">
313
- <p>A convenient method that returns an account in your wallet, allowing you to
314
- perform all the actions in <a
315
- href="WalletAccount.html">Nanook::WalletAccount</a> on it.</p>
316
-
317
- <pre><code>wallet.account(&quot;xrb_...&quot;) #=&gt; Nanook::WalletAccount instance
318
- </code></pre>
319
-
320
- <p>See <a href="WalletAccount.html">Nanook::WalletAccount</a>.</p>
321
-
322
- <h4 id="method-i-account-label-Arguments">Arguments</h4>
323
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>account</code></td><td>
324
- <p>Optional String of an account (starting with
325
- <code>&quot;xrb...&quot;</code>) to start working with. Must be an account
326
- within the wallet. When no account is given, the instance returned only
327
- allows you to call <code>create</code> on it, to create a new account.
328
- Otherwise, you must pass an account string for all other methods.</p>
329
- </td></tr></tbody></table>
330
-
331
- <h4 id="method-i-account-label-Examples">Examples</h4>
332
-
333
- <pre><code>wallet.account.create # Creates an account in the wallet and returns a Nanook::WalletAccount
334
- wallet.account(account_id) # Returns a Nanook::WalletAccount for the account
335
- </code></pre>
336
- </div>
337
-
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
- <div class="sourcecode">
346
-
347
- <p class="source-link">
348
- Source:
349
- <a href="javascript:toggleSource('method-i-account_source')" id="l_method-i-account_source">show</a>
350
-
351
- </p>
352
- <div id="method-i-account_source" class="dyn-source">
353
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 55</span>
354
- <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>)
355
- <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>)
356
- <span class="ruby-keyword">end</span></pre>
357
- </div>
358
- </div>
359
-
360
- </div>
361
-
362
- <div class="method">
363
- <div class="title method-title" id="method-i-accounts">
364
-
365
- <b>accounts</b>()
366
-
367
- <a href="../../classes/Nanook/Wallet.html#method-i-accounts" name="method-i-accounts" class="permalink">Link</a>
368
- </div>
369
-
370
-
371
- <div class="description">
372
- <p>Returns an Array with Strings of all account ids in the wallet.</p>
373
-
374
- <h4 id="method-i-accounts-label-Example+response">Example response</h4>
375
-
376
- <pre><code>[
377
- &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;,
378
- &quot;xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx&quot;
379
- ]
380
- </code></pre>
381
- </div>
382
-
383
-
384
-
385
-
386
-
387
-
388
-
389
-
390
- <div class="sourcecode">
391
-
392
- <p class="source-link">
393
- Source:
394
- <a href="javascript:toggleSource('method-i-accounts_source')" id="l_method-i-accounts_source">show</a>
395
-
396
- </p>
397
- <div id="method-i-accounts_source" class="dyn-source">
398
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 67</span>
399
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accounts</span>
400
- <span class="ruby-identifier">wallet_required!</span>
401
- <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>]
402
- <span class="ruby-constant">Nanook</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">coerce_empty_string_to_type</span>(<span class="ruby-identifier">response</span>, <span class="ruby-constant">Array</span>)
403
- <span class="ruby-keyword">end</span></pre>
404
- </div>
405
- </div>
406
-
407
- </div>
408
-
409
- <div class="method">
410
- <div class="title method-title" id="method-i-balance">
411
-
412
- <b>balance</b>(account_break_down: false)
413
-
414
- <a href="../../classes/Nanook/Wallet.html#method-i-balance" name="method-i-balance" class="permalink">Link</a>
415
- </div>
416
-
417
-
418
- <div class="description">
419
- <p>Returns a Hash containing the balance of all accounts in the wallet,
420
- optionally breaking the balances down by account.</p>
421
-
422
- <h4 id="method-i-balance-label-Arguments">Arguments</h4>
423
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>account_break_down:</code></td><td>
424
- <p>Boolean (default is false). When <code>true</code> the response will
425
- contain balances per account.</p>
426
- </td></tr></tbody></table>
427
-
428
- <h4 id="method-i-balance-label-Examples">Examples</h4>
429
-
430
- <p>Simple use:</p>
431
-
432
- <pre><code>wallet.balance
433
- </code></pre>
434
-
435
- <p>Example response:</p>
436
-
437
- <pre><code>{
438
- &quot;balance&quot;=&gt;5000000000000000,
439
- &quot;pending&quot;=&gt;10000000000000
440
- }
441
- </code></pre>
442
-
443
- <p>Asking for totals to be broken down by account:</p>
444
-
445
- <pre><code>wallet.balance(account_break_down: true)
446
- </code></pre>
447
-
448
- <p>Example response:</p>
449
-
450
- <pre><code>{
451
- &quot;xrb_3e3j5tkog48pnny9dmfzj1r16pg8t1e76dz5tmac6iq689wyjfpi00000000&quot;=&gt;{
452
- &quot;balance&quot;=&gt;2500000000000000,
453
- &quot;pending&quot;=&gt;10000000000000
454
- },
455
- &quot;xrb_1e5aqegc1jb7qe964u4adzmcezyo6o146zb8hm6dft8tkp79za3sxwjym5rx&quot;=&gt;{
456
- &quot;balance&quot;=&gt;2500000000000000,
457
- &quot;pending&quot;=&gt;0
458
- },
459
- }
460
- </code></pre>
461
- </div>
462
-
463
-
464
-
465
-
466
-
467
-
468
-
469
-
470
- <div class="sourcecode">
471
-
472
- <p class="source-link">
473
- Source:
474
- <a href="javascript:toggleSource('method-i-balance_source')" id="l_method-i-balance_source">show</a>
475
-
476
- </p>
477
- <div id="method-i-balance_source" class="dyn-source">
478
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 110</span>
479
- <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>)
480
- <span class="ruby-identifier">wallet_required!</span>
481
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">account_break_down</span>
482
- <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>)
483
- <span class="ruby-keyword">else</span>
484
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_balance_total</span>)
485
- <span class="ruby-keyword">end</span>
486
- <span class="ruby-keyword">end</span></pre>
487
- </div>
488
- </div>
489
-
490
- </div>
491
-
492
- <div class="method">
493
- <div class="title method-title" id="method-i-change_password">
494
-
495
- <b>change_password</b>(password)
496
-
497
- <a href="../../classes/Nanook/Wallet.html#method-i-change_password" name="method-i-change_password" class="permalink">Link</a>
498
- </div>
499
-
500
-
501
- <div class="description">
502
- <p>Changes the password for a wallet. Returns a boolean to indicate if the
503
- action was successful.</p>
504
-
505
- <h4 id="method-i-change_password-label-Example+response">Example response</h4>
506
-
507
- <pre><code>true
508
- </code></pre>
509
- </div>
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
- <div class="sourcecode">
519
-
520
- <p class="source-link">
521
- Source:
522
- <a href="javascript:toggleSource('method-i-change_password_source')" id="l_method-i-change_password_source">show</a>
523
-
524
- </p>
525
- <div id="method-i-change_password_source" class="dyn-source">
526
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 284</span>
527
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">change_password</span>(<span class="ruby-identifier">password</span>)
528
- <span class="ruby-identifier">wallet_required!</span>
529
- <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>
530
- <span class="ruby-keyword">end</span></pre>
531
- </div>
532
- </div>
533
-
534
- </div>
535
-
536
- <div class="method">
537
- <div class="title method-title" id="method-i-contains-3F">
538
-
539
- <b>contains?</b>(account)
540
-
541
- <a href="../../classes/Nanook/Wallet.html#method-i-contains-3F" name="method-i-contains-3F" class="permalink">Link</a>
542
- </div>
543
-
544
-
545
- <div class="description">
546
- <p>Returns boolean indicating if the wallet contains an account.</p>
547
-
548
- <h4 id="method-i-contains-3F-label-Arguments">Arguments</h4>
549
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>account</code></td><td>
550
- <p>String account id (will start with <code>&quot;xrb_...&quot;</code>)</p>
551
- </td></tr></tbody></table>
552
-
553
- <h4 id="method-i-contains-3F-label-Example+response">Example response</h4>
554
-
555
- <pre><code>true
556
- </code></pre>
557
- </div>
558
-
559
-
560
-
561
-
562
-
563
-
564
-
565
-
566
- <div class="sourcecode">
567
-
568
- <p class="source-link">
569
- Source:
570
- <a href="javascript:toggleSource('method-i-contains-3F_source')" id="l_method-i-contains-3F_source">show</a>
571
-
572
- </p>
573
- <div id="method-i-contains-3F_source" class="dyn-source">
574
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 178</span>
575
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contains?</span>(<span class="ruby-identifier">account</span>)
576
- <span class="ruby-identifier">wallet_required!</span>
577
- <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>)
578
- <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>
579
- <span class="ruby-keyword">end</span></pre>
580
- </div>
581
- </div>
582
-
583
- </div>
584
-
585
- <div class="method">
586
- <div class="title method-title" id="method-i-create">
587
-
588
- <b>create</b>()
589
-
590
- <a href="../../classes/Nanook/Wallet.html#method-i-create" name="method-i-create" class="permalink">Link</a>
591
- </div>
592
-
593
-
594
- <div class="description">
595
- <p>Creates a new wallet. This is the only method in <a
596
- href="Wallet.html">Nanook::Wallet</a> that doesn&#39;t expect a wallet seed
597
- to be passed in as an argument.</p>
598
-
599
- <p>To create a new wallet:</p>
600
-
601
- <pre><code>Nanook.new.wallet.create
602
- </code></pre>
603
-
604
- <h4 id="method-i-create-label-Very+important">Very important</h4>
605
-
606
- <p><strong>Please read this.</strong> The response of this method is a wallet
607
- seed. A seed is a 32-byte uppercase hex string. You can think of this
608
- string as your API key to the nano network. The person who knows it can do
609
- all read and write actions against the wallet and all accounts inside the
610
- wallet from anywhere on the nano network, not just on the node you created
611
- the wallet on.</p>
612
-
613
- <p>If you intend for your wallet to contain funds, then make sure that you
614
- consider the seed that is returned as the key to your funds and store it
615
- somewhere secret and safe. Do not transmit the seed over insecure (non-SSH
616
- or SSL) networks or store it where it is able to be easily comprised by a
617
- hacker, which includes your personal computer.</p>
618
-
619
- <h4 id="method-i-create-label-Example+response-3A">Example response:</h4>
620
-
621
- <pre><code>&quot;CC2C9846A44DB6F0363F647D12B957794AD937F59498D4E35C172C81E2888650&quot;
622
- </code></pre>
623
- </div>
624
-
625
-
626
-
627
-
628
-
629
-
630
-
631
-
632
- <div class="sourcecode">
633
-
634
- <p class="source-link">
635
- Source:
636
- <a href="javascript:toggleSource('method-i-create_source')" id="l_method-i-create_source">show</a>
637
-
638
- </p>
639
- <div id="method-i-create_source" class="dyn-source">
640
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 145</span>
641
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create</span>
642
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_create</span>)[<span class="ruby-value">:wallet</span>]
643
- <span class="ruby-keyword">end</span></pre>
644
- </div>
645
- </div>
646
-
647
- </div>
648
-
649
- <div class="method">
650
- <div class="title method-title" id="method-i-destroy">
651
-
652
- <b>destroy</b>()
653
-
654
- <a href="../../classes/Nanook/Wallet.html#method-i-destroy" name="method-i-destroy" class="permalink">Link</a>
655
- </div>
656
-
657
-
658
- <div class="description">
659
- <p>Destroy the wallet. Returns a boolean indicating whether the action was
660
- successful or not.</p>
661
-
662
- <h4 id="method-i-destroy-label-Example+Response">Example Response</h4>
663
-
664
- <pre><code>true
665
- </code></pre>
666
- </div>
667
-
668
-
669
-
670
-
671
-
672
-
673
-
674
-
675
- <div class="sourcecode">
676
-
677
- <p class="source-link">
678
- Source:
679
- <a href="javascript:toggleSource('method-i-destroy_source')" id="l_method-i-destroy_source">show</a>
680
-
681
- </p>
682
- <div id="method-i-destroy_source" class="dyn-source">
683
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 154</span>
684
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">destroy</span>
685
- <span class="ruby-identifier">wallet_required!</span>
686
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_destroy</span>)
687
- <span class="ruby-keyword">true</span>
688
- <span class="ruby-keyword">end</span></pre>
689
- </div>
690
- </div>
691
-
692
- </div>
693
-
694
- <div class="method">
695
- <div class="title method-title" id="method-i-export">
696
-
697
- <b>export</b>()
698
-
699
- <a href="../../classes/Nanook/Wallet.html#method-i-export" name="method-i-export" class="permalink">Link</a>
700
- </div>
701
-
702
-
703
- <div class="description">
704
- <p>Generates a String containing a JSON representation of your wallet.</p>
705
-
706
- <h4 id="method-i-export-label-Example+response">Example response</h4>
707
-
708
- <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;
709
- </code></pre>
710
- </div>
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
-
719
- <div class="sourcecode">
720
-
721
- <p class="source-link">
722
- Source:
723
- <a href="javascript:toggleSource('method-i-export_source')" id="l_method-i-export_source">show</a>
724
-
725
- </p>
726
- <div id="method-i-export_source" class="dyn-source">
727
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 165</span>
728
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">export</span>
729
- <span class="ruby-identifier">wallet_required!</span>
730
- <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_export</span>)[<span class="ruby-value">:json</span>]
731
- <span class="ruby-keyword">end</span></pre>
732
- </div>
733
- </div>
734
-
735
- </div>
736
-
737
- <div class="method">
738
- <div class="title method-title" id="method-i-locked-3F">
739
-
740
- <b>locked?</b>()
741
-
742
- <a href="../../classes/Nanook/Wallet.html#method-i-locked-3F" name="method-i-locked-3F" class="permalink">Link</a>
743
- </div>
744
-
745
-
746
- <div class="description">
747
- <p>Returns a boolean to indicate if the wallet is locked.</p>
748
-
749
- <h4 id="method-i-locked-3F-label-Example+response">Example response</h4>
750
-
751
- <pre><code>true
752
- </code></pre>
753
- </div>
754
-
755
-
756
-
757
-
758
-
759
-
760
-
761
-
762
- <div class="sourcecode">
763
-
764
- <p class="source-link">
765
- Source:
766
- <a href="javascript:toggleSource('method-i-locked-3F_source')" id="l_method-i-locked-3F_source">show</a>
767
-
768
- </p>
769
- <div id="method-i-locked-3F_source" class="dyn-source">
770
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 261</span>
771
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">locked?</span>
772
- <span class="ruby-identifier">wallet_required!</span>
773
- <span class="ruby-identifier">response</span> = <span class="ruby-identifier">rpc</span>(<span class="ruby-value">:wallet_locked</span>)
774
- <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>
775
- <span class="ruby-keyword">end</span></pre>
776
- </div>
777
- </div>
778
-
779
- </div>
780
-
781
- <div class="method">
782
- <div class="title method-title" id="method-i-pay">
783
-
784
- <b>pay</b>(from:, to:, amount:, id:)
785
-
786
- <a href="../../classes/Nanook/Wallet.html#method-i-pay" name="method-i-pay" class="permalink">Link</a>
787
- </div>
788
-
789
-
790
- <div class="description">
791
- <p>Make a payment from an account in your wallet to another account on the
792
- nano network. Returns a <em>send</em> block hash if successful, or an error
793
- String if unsuccessful.</p>
794
-
795
- <h4 id="method-i-pay-label-Arguments">Arguments</h4>
796
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>from:</code></td><td>
797
- <p>String account id of an account in your wallet</p>
798
- </td></tr><tr><td class='label'><code>to:</code></td><td>
799
- <p>String account id of the recipient of your payment</p>
800
- </td></tr><tr><td class='label'><code>amount:</code></td><td>
801
- <p>Can be either an Integer or Float. Unit is NANO (which is currently
802
- technically 1Mnano - see <a
803
- href="https://nano.org/en/faq#what-are-nano-units-">What are Nano’s
804
- Units</a>).</p>
805
- </td></tr><tr><td class='label'><code>id:</code></td><td>
806
- <p>String. Must be unique per payment. It serves an important purpose; it
807
- allows you to make the same call multiple times with the same
808
- <code>id</code> and be reassured that you will only ever send that nano
809
- payment once.</p>
810
- </td></tr></tbody></table>
811
-
812
- <p>Note, there may be a delay in receiving a response due to Proof of Work
813
- being done. From the <a
814
- href="https://github.com/nanocurrency/raiblocks/wiki/RPC-protocol#account-create">Nano
815
- RPC</a>:</p>
816
-
817
- <p><em>Proof of Work is precomputed for one transaction in the background. If
818
- it has been a while since your last transaction it will send instantly, the
819
- next one will need to wait for Proof of Work to be generated.</em></p>
820
-
821
- <h4 id="method-i-pay-label-Example">Example</h4>
822
-
823
- <pre><code>wallet.pay(from: &quot;xrb_...&quot;, to: &quot;xrb_...&quot;, amount: 0.001, id: &quot;myUniqueId123&quot;)
824
- </code></pre>
825
-
826
- <h4 id="method-i-pay-label-Example+responses">Example responses</h4>
827
-
828
- <pre><code>&quot;718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2&quot;
829
- </code></pre>
830
-
831
- <p>Or:</p>
832
-
833
- <pre><code>&quot;Account not found&quot;
834
- </code></pre>
835
- </div>
836
-
837
-
838
-
839
-
840
-
841
-
842
-
843
-
844
- <div class="sourcecode">
845
-
846
- <p class="source-link">
847
- Source:
848
- <a href="javascript:toggleSource('method-i-pay_source')" id="l_method-i-pay_source">show</a>
849
-
850
- </p>
851
- <div id="method-i-pay_source" class="dyn-source">
852
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 214</span>
853
- <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">id:</span>)
854
- <span class="ruby-identifier">wallet_required!</span>
855
- <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">from</span>)
856
- <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">id:</span> <span class="ruby-identifier">id</span>)
857
- <span class="ruby-keyword">end</span></pre>
858
- </div>
859
- </div>
860
-
861
- </div>
862
-
863
- <div class="method">
864
- <div class="title method-title" id="method-i-receive">
865
-
866
- <b>receive</b>(block=nil, into:)
867
-
868
- <a href="../../classes/Nanook/Wallet.html#method-i-receive" name="method-i-receive" class="permalink">Link</a>
869
- </div>
870
-
871
-
872
- <div class="description">
873
- <p>Receives a pending payment into an account in the wallet.</p>
874
-
875
- <p>When called with no <code>block</code> argument, the latest pending payment
876
- for the account will be received.</p>
877
-
878
- <p>Returns a <em>receive</em> block hash if a receive was successful, or
879
- <code>false</code> if there were no pending payments to receive.</p>
880
-
881
- <p>You can also receive a specific pending block if you know it by passing the
882
- block has in as an argument.</p>
883
-
884
- <h4 id="method-i-receive-label-Arguments">Arguments</h4>
885
- <table class="rdoc-list label-list"><tbody><tr><td class='label'><code>block</code></td><td>
886
- <p>Optional block hash of pending payment. If not provided, the latest pending
887
- payment will be received</p>
888
- </td></tr><tr><td class='label'><code>into:</code></td><td>
889
- <p>String account id of account in your wallet to receive the payment into</p>
890
- </td></tr></tbody></table>
891
-
892
- <h4 id="method-i-receive-label-Examples">Examples</h4>
893
-
894
- <pre><code>wallet.receive(into: &quot;xrb...&quot;)
895
- wallet.receive(&quot;718CC21...&quot;, into: &quot;xrb...&quot;)
896
- </code></pre>
897
-
898
- <h4 id="method-i-receive-label-Example+responses">Example responses</h4>
899
-
900
- <pre><code>&quot;718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2&quot;
901
- </code></pre>
902
-
903
- <p>Or:</p>
904
-
905
- <pre><code>false
906
- </code></pre>
907
- </div>
908
-
909
-
910
-
911
-
912
-
913
-
914
-
915
-
916
- <div class="sourcecode">
917
-
918
- <p class="source-link">
919
- Source:
920
- <a href="javascript:toggleSource('method-i-receive_source')" id="l_method-i-receive_source">show</a>
921
-
922
- </p>
923
- <div id="method-i-receive_source" class="dyn-source">
924
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 250</span>
925
- <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>)
926
- <span class="ruby-identifier">wallet_required!</span>
927
- <span class="ruby-identifier">validate_wallet_contains_account!</span>(<span class="ruby-identifier">into</span>)
928
- <span class="ruby-identifier">account</span>(<span class="ruby-identifier">into</span>).<span class="ruby-identifier">receive</span>(<span class="ruby-identifier">block</span>)
929
- <span class="ruby-keyword">end</span></pre>
930
- </div>
931
- </div>
932
-
933
- </div>
934
-
935
- <div class="method">
936
- <div class="title method-title" id="method-i-unlock">
937
-
938
- <b>unlock</b>(password)
939
-
940
- <a href="../../classes/Nanook/Wallet.html#method-i-unlock" name="method-i-unlock" class="permalink">Link</a>
941
- </div>
942
-
943
-
944
- <div class="description">
945
- <p>Unlocks a previously locked wallet. Returns a boolean to indicate if the
946
- action was successful.</p>
947
-
948
- <h4 id="method-i-unlock-label-Example+response">Example response</h4>
949
-
950
- <pre><code>true
951
- </code></pre>
952
- </div>
953
-
954
-
955
-
956
-
957
-
958
-
959
-
960
-
961
- <div class="sourcecode">
962
-
963
- <p class="source-link">
964
- Source:
965
- <a href="javascript:toggleSource('method-i-unlock_source')" id="l_method-i-unlock_source">show</a>
966
-
967
- </p>
968
- <div id="method-i-unlock_source" class="dyn-source">
969
- <pre><span class="ruby-comment"># File lib/nanook/wallet.rb, line 273</span>
970
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unlock</span>(<span class="ruby-identifier">password</span>)
971
- <span class="ruby-identifier">wallet_required!</span>
972
- <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>
973
- <span class="ruby-keyword">end</span></pre>
974
- </div>
975
- </div>
976
-
977
- </div>
978
-
979
-
980
-
981
-
982
- </div>
983
-
984
- </div>
985
- </body>
986
- </html>