lnd_ruby_sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,585 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Lightning::Stub
8
+
9
+ &mdash; Documentation by YARD 0.9.19
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Lightning::Stub";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Lightning.html" title="Lightning (module)">Lightning</a></span></span>
41
+ &raquo;
42
+ <span class="title">Stub</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Lightning::Stub
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dl>
78
+ <dt>Included in:</dt>
79
+ <dd><span class='object_link'><a href="../Lightning.html" title="Lightning (module)">Lightning</a></span>, <span class='object_link'><a href="Invoice.html" title="Lightning::Invoice (class)">Invoice</a></span></dd>
80
+ </dl>
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/lightning/stub.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+ <h2>Overview</h2><div class="docstring">
92
+ <div class="discussion">
93
+
94
+ <p>When this module is included in another class, we have access to the
95
+ pre-generated stub (client) and can use it to communicate with the gRPC
96
+ api.</p>
97
+
98
+
99
+ </div>
100
+ </div>
101
+ <div class="tags">
102
+
103
+ <p class="tag_title">Since:</p>
104
+ <ul class="since">
105
+
106
+ <li>
107
+
108
+
109
+
110
+
111
+
112
+ <div class='inline'>
113
+ <p>0.1.0</p>
114
+ </div>
115
+
116
+ </li>
117
+
118
+ </ul>
119
+
120
+ </div>
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+ <h2>
129
+ Instance Method Summary
130
+ <small><a href="#" class="summary_toggle">collapse</a></small>
131
+ </h2>
132
+
133
+ <ul class="summary">
134
+
135
+ <li class="public ">
136
+ <span class="summary_signature">
137
+
138
+ <a href="#credentials-instance_method" title="#credentials (instance method)">#<strong>credentials</strong> &#x21d2; GRPC::Core::ChannelCredentials </a>
139
+
140
+
141
+
142
+ </span>
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>Get SSL credentials from the tls.cert file generated by LND.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#macaroon-instance_method" title="#macaroon (instance method)">#<strong>macaroon</strong> &#x21d2; Binary </a>
163
+
164
+
165
+
166
+ </span>
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ <span class="summary_desc"><div class='inline'>
177
+ <p>Macaroon files works like cookies and are used to authenticate with LND
178
+ gRPC.</p>
179
+ </div></span>
180
+
181
+ </li>
182
+
183
+
184
+ <li class="public ">
185
+ <span class="summary_signature">
186
+
187
+ <a href="#return_res-instance_method" title="#return_res (instance method)">#<strong>return_res</strong>(response) &#x21d2; Object </a>
188
+
189
+
190
+
191
+ </span>
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ <span class="summary_desc"><div class='inline'>
202
+ <p>A placeholder function added temporary so that we easly can manipulate the
203
+ response of all request in the future in case we feel that&#39;s necessary.</p>
204
+ </div></span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#stub-instance_method" title="#stub (instance method)">#<strong>stub</strong> &#x21d2; Lnrpc::Lightning::Stub </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+ <span class="summary_desc"><div class='inline'>
227
+ <p>On the client side, the client has a local object known as stub (for other
228
+ languages, the preferred term is client) that implements the same methods
229
+ as the service.</p>
230
+ </div></span>
231
+
232
+ </li>
233
+
234
+
235
+ </ul>
236
+
237
+
238
+
239
+
240
+ <div id="instance_method_details" class="method_details_list">
241
+ <h2>Instance Method Details</h2>
242
+
243
+
244
+ <div class="method_details first">
245
+ <h3 class="signature first" id="credentials-instance_method">
246
+
247
+ #<strong>credentials</strong> &#x21d2; <tt>GRPC::Core::ChannelCredentials</tt>
248
+
249
+
250
+
251
+
252
+
253
+ </h3><div class="docstring">
254
+ <div class="discussion">
255
+
256
+ <p>Get SSL credentials from the tls.cert file generated by LND. This file is
257
+ normally generated by LND and will be created by default at ~/.lnd/tls.cert
258
+ on the server running your LND node. We will use it to establish a secured
259
+ connection between your app and the node/server.</p>
260
+
261
+
262
+ </div>
263
+ </div>
264
+ <div class="tags">
265
+
266
+ <p class="tag_title">Returns:</p>
267
+ <ul class="return">
268
+
269
+ <li>
270
+
271
+
272
+ <span class='type'>(<tt>GRPC::Core::ChannelCredentials</tt>)</span>
273
+
274
+
275
+
276
+ </li>
277
+
278
+ </ul>
279
+ <p class="tag_title">Since:</p>
280
+ <ul class="since">
281
+
282
+ <li>
283
+
284
+
285
+
286
+
287
+
288
+ <div class='inline'>
289
+ <p>0.1.0</p>
290
+ </div>
291
+
292
+ </li>
293
+
294
+ </ul>
295
+
296
+ </div><table class="source_code">
297
+ <tr>
298
+ <td>
299
+ <pre class="lines">
300
+
301
+
302
+ 51
303
+ 52
304
+ 53
305
+ 54
306
+ 55
307
+ 56
308
+ 57</pre>
309
+ </td>
310
+ <td>
311
+ <pre class="code"><span class="info file"># File 'lib/lightning/stub.rb', line 51</span>
312
+
313
+ <span class='kw'>def</span> <span class='id identifier rubyid_credentials'>credentials</span>
314
+ <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GRPC_SSL_CIPHER_SUITES</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>=</span>
315
+ <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>GRPC_SSL_CIPHER_SUITES</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>HIGH+ECDSA</span><span class='tstring_end'>&#39;</span></span>
316
+
317
+ <span class='id identifier rubyid_certificate'>certificate</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>~/.lnd/tls.cert</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
318
+ <span class='const'>GRPC</span><span class='op'>::</span><span class='const'>Core</span><span class='op'>::</span><span class='const'>ChannelCredentials</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_certificate'>certificate</span><span class='rparen'>)</span>
319
+ <span class='kw'>end</span></pre>
320
+ </td>
321
+ </tr>
322
+ </table>
323
+ </div>
324
+
325
+ <div class="method_details ">
326
+ <h3 class="signature " id="macaroon-instance_method">
327
+
328
+ #<strong>macaroon</strong> &#x21d2; <tt>Binary</tt>
329
+
330
+
331
+
332
+
333
+
334
+ </h3><div class="docstring">
335
+ <div class="discussion">
336
+
337
+ <p>Macaroon files works like cookies and are used to authenticate with LND
338
+ gRPC. By default, when lnd starts, it creates three files which contain
339
+ macaroons: a file called admin.macaroon, which contains a macaroon with no
340
+ caveats, a file called readonly.macaroon, which is the same macaroon but
341
+ with an additional caveat, that permits only methods that don&#39;t change
342
+ the state of lnd, and invoice.macaroon, which only has access to invoice
343
+ related methods. You can learn more about LND macaroons at: <a
344
+ href="http://tiny.cc/1nuc5y">tiny.cc/1nuc5y</a></p>
345
+
346
+
347
+ </div>
348
+ </div>
349
+ <div class="tags">
350
+
351
+ <p class="tag_title">Returns:</p>
352
+ <ul class="return">
353
+
354
+ <li>
355
+
356
+
357
+ <span class='type'>(<tt>Binary</tt>)</span>
358
+
359
+
360
+
361
+ </li>
362
+
363
+ </ul>
364
+ <p class="tag_title">Since:</p>
365
+ <ul class="since">
366
+
367
+ <li>
368
+
369
+
370
+
371
+
372
+
373
+ <div class='inline'>
374
+ <p>0.1.0</p>
375
+ </div>
376
+
377
+ </li>
378
+
379
+ </ul>
380
+
381
+ </div><table class="source_code">
382
+ <tr>
383
+ <td>
384
+ <pre class="lines">
385
+
386
+
387
+ 36
388
+ 37
389
+ 38
390
+ 39
391
+ 40
392
+ 41
393
+ 42</pre>
394
+ </td>
395
+ <td>
396
+ <pre class="code"><span class="info file"># File 'lib/lightning/stub.rb', line 36</span>
397
+
398
+ <span class='kw'>def</span> <span class='id identifier rubyid_macaroon'>macaroon</span>
399
+ <span class='id identifier rubyid_macaroon_binary'>macaroon_binary</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span>
400
+ <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
401
+ <span class='rparen'>)</span>
402
+
403
+ <span class='id identifier rubyid_macaroon_binary'>macaroon_binary</span><span class='period'>.</span><span class='id identifier rubyid_each_byte'>each_byte</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_rjust'>rjust</span><span class='lparen'>(</span><span class='int'>2</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
404
+ <span class='kw'>end</span></pre>
405
+ </td>
406
+ </tr>
407
+ </table>
408
+ </div>
409
+
410
+ <div class="method_details ">
411
+ <h3 class="signature " id="return_res-instance_method">
412
+
413
+ #<strong>return_res</strong>(response) &#x21d2; <tt>Object</tt>
414
+
415
+
416
+
417
+
418
+
419
+ </h3><div class="docstring">
420
+ <div class="discussion">
421
+
422
+ <p>A placeholder function added temporary so that we easly can manipulate the
423
+ response of all request in the future in case we feel that&#39;s necessary.</p>
424
+
425
+
426
+ </div>
427
+ </div>
428
+ <div class="tags">
429
+
430
+ <p class="tag_title">Returns:</p>
431
+ <ul class="return">
432
+
433
+ <li>
434
+
435
+
436
+ <span class='type'></span>
437
+
438
+
439
+
440
+
441
+ <div class='inline'>
442
+ <p>gRPC response</p>
443
+ </div>
444
+
445
+ </li>
446
+
447
+ </ul>
448
+ <p class="tag_title">Since:</p>
449
+ <ul class="since">
450
+
451
+ <li>
452
+
453
+
454
+
455
+
456
+
457
+ <div class='inline'>
458
+ <p>0.1.0</p>
459
+ </div>
460
+
461
+ </li>
462
+
463
+ </ul>
464
+
465
+ </div><table class="source_code">
466
+ <tr>
467
+ <td>
468
+ <pre class="lines">
469
+
470
+
471
+ 64
472
+ 65
473
+ 66</pre>
474
+ </td>
475
+ <td>
476
+ <pre class="code"><span class="info file"># File 'lib/lightning/stub.rb', line 64</span>
477
+
478
+ <span class='kw'>def</span> <span class='id identifier rubyid_return_res'>return_res</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
479
+ <span class='id identifier rubyid_response'>response</span>
480
+ <span class='kw'>end</span></pre>
481
+ </td>
482
+ </tr>
483
+ </table>
484
+ </div>
485
+
486
+ <div class="method_details ">
487
+ <h3 class="signature " id="stub-instance_method">
488
+
489
+ #<strong>stub</strong> &#x21d2; <tt>Lnrpc::Lightning::Stub</tt>
490
+
491
+
492
+
493
+
494
+
495
+ </h3><div class="docstring">
496
+ <div class="discussion">
497
+
498
+ <p>On the client side, the client has a local object known as stub (for other
499
+ languages, the preferred term is client) that implements the same methods
500
+ as the service. The client can then just call those methods on the local
501
+ object, wrapping the parameters for the call in the appropriate protocol
502
+ buffer message type - gRPC looks after sending the request(s) to the server
503
+ and returning the server&#39;s protocol buffer response(s). Read more about
504
+ stubs at: <a href="http://tiny.cc/nwuc5y">tiny.cc/nwuc5y</a>. We&#39;re
505
+ using a pre-generated stub created with inspiration from the tutorial at:
506
+ <a
507
+ href="https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/ruby.md">github.com/lightningnetwork/lnd/blob/master/docs/grpc/ruby.md</a></p>
508
+
509
+
510
+ </div>
511
+ </div>
512
+ <div class="tags">
513
+
514
+ <p class="tag_title">Returns:</p>
515
+ <ul class="return">
516
+
517
+ <li>
518
+
519
+
520
+ <span class='type'>(<tt>Lnrpc::Lightning::Stub</tt>)</span>
521
+
522
+
523
+
524
+ </li>
525
+
526
+ </ul>
527
+ <p class="tag_title">Since:</p>
528
+ <ul class="since">
529
+
530
+ <li>
531
+
532
+
533
+
534
+
535
+
536
+ <div class='inline'>
537
+ <p>0.1.0</p>
538
+ </div>
539
+
540
+ </li>
541
+
542
+ </ul>
543
+
544
+ </div><table class="source_code">
545
+ <tr>
546
+ <td>
547
+ <pre class="lines">
548
+
549
+
550
+ 18
551
+ 19
552
+ 20
553
+ 21
554
+ 22
555
+ 23
556
+ 24</pre>
557
+ </td>
558
+ <td>
559
+ <pre class="code"><span class="info file"># File 'lib/lightning/stub.rb', line 18</span>
560
+
561
+ <span class='kw'>def</span> <span class='id identifier rubyid_stub'>stub</span>
562
+ <span class='const'>Lnrpc</span><span class='op'>::</span><span class='const'>Lightning</span><span class='op'>::</span><span class='const'>Stub</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
563
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>127.0.0.1:10009</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
564
+ <span class='id identifier rubyid_credentials'>credentials</span><span class='comma'>,</span>
565
+ <span class='label'>interceptors:</span> <span class='lbracket'>[</span><span class='const'>MacaroonInterceptor</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_macaroon'>macaroon</span><span class='rparen'>)</span><span class='rbracket'>]</span>
566
+ <span class='rparen'>)</span>
567
+ <span class='kw'>end</span></pre>
568
+ </td>
569
+ </tr>
570
+ </table>
571
+ </div>
572
+
573
+ </div>
574
+
575
+ </div>
576
+
577
+ <div id="footer">
578
+ Generated on Thu Apr 18 02:03:15 2019 by
579
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
580
+ 0.9.19 (ruby-2.3.1).
581
+ </div>
582
+
583
+ </div>
584
+ </body>
585
+ </html>