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.
- checksums.yaml +7 -0
- data/.codeclimate.yml +3 -0
- data/.gitattributes +2 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +9 -0
- data/.yardopts +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Lightning.html +855 -0
- data/docs/Lightning/Invoice.html +448 -0
- data/docs/Lightning/Node.html +121 -0
- data/docs/Lightning/Stub.html +585 -0
- data/docs/LightningSDK.html +549 -0
- data/docs/_index.html +107 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +122 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +122 -0
- data/docs/js/app.js +303 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +91 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/lightning/invoices.rb +96 -0
- data/lib/lightning/node.rb +16 -0
- data/lib/lightning/stub.rb +62 -0
- data/lib/lightning/version.rb +5 -0
- data/lib/lnd_ruby_sdk.rb +24 -0
- data/lnd_ruby_sdk.gemspec +34 -0
- data/node_modules/.yarn-integrity +10 -0
- data/vendor/macaroon_interceptor.rb +18 -0
- data/vendor/rpc.proto +2367 -0
- data/vendor/rpc_pb.rb +864 -0
- data/vendor/rpc_services_pb.rb +375 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d8853f4078c8d47d32c2644b34793ce09c794dcf
|
4
|
+
data.tar.gz: bacd448730a80af98e4b97d2e25c51d1af731103
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4bc0b4d3faf334d311358ae7ac60da7f48b7089b63014969b0d87995d7cc439757cd141c23163e7dadfec27edebbcf3c2be3c3c67c7d7406642f40647b97a1fa
|
7
|
+
data.tar.gz: 2ae8e5edc05dbe3b206566fc74b66dcc697bf0f90042f9a53d317d760ba3bcf5b7f8097a1648f2af9950cc153f7971685a4842c7af021f7ed8f8cba9d9f122d0
|
data/.codeclimate.yml
ADDED
data/.gitattributes
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--output-dir docs/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lnd_ruby_sdk (0.1.0)
|
5
|
+
grpc
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
google-protobuf (3.7.1)
|
13
|
+
googleapis-common-protos-types (1.0.4)
|
14
|
+
google-protobuf (~> 3.0)
|
15
|
+
grpc (1.19.0)
|
16
|
+
google-protobuf (~> 3.1)
|
17
|
+
googleapis-common-protos-types (~> 1.0.0)
|
18
|
+
jaro_winkler (1.5.2)
|
19
|
+
parallel (1.17.0)
|
20
|
+
parser (2.6.2.1)
|
21
|
+
ast (~> 2.4.0)
|
22
|
+
psych (3.1.0)
|
23
|
+
rainbow (3.0.0)
|
24
|
+
rake (10.5.0)
|
25
|
+
rspec (3.8.0)
|
26
|
+
rspec-core (~> 3.8.0)
|
27
|
+
rspec-expectations (~> 3.8.0)
|
28
|
+
rspec-mocks (~> 3.8.0)
|
29
|
+
rspec-core (3.8.0)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-expectations (3.8.2)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.8.0)
|
34
|
+
rspec-mocks (3.8.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.8.0)
|
37
|
+
rspec-support (3.8.0)
|
38
|
+
rubocop (0.67.2)
|
39
|
+
jaro_winkler (~> 1.5.1)
|
40
|
+
parallel (~> 1.10)
|
41
|
+
parser (>= 2.5, != 2.5.1.1)
|
42
|
+
psych (>= 3.1.0)
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
44
|
+
ruby-progressbar (~> 1.7)
|
45
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
46
|
+
rubocop-performance (1.1.0)
|
47
|
+
rubocop (>= 0.67.0)
|
48
|
+
ruby-progressbar (1.10.0)
|
49
|
+
unicode-display_width (1.5.0)
|
50
|
+
yard (0.9.19)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
bundler (~> 1.16)
|
57
|
+
lnd_ruby_sdk!
|
58
|
+
rake (~> 10.0)
|
59
|
+
rspec (~> 3.0)
|
60
|
+
rubocop (~> 0.67.2)
|
61
|
+
rubocop-performance (~> 1.1.0)
|
62
|
+
yard (>= 0.9.11)
|
63
|
+
|
64
|
+
BUNDLED WITH
|
65
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Rasmus
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# LND SDK for Lightning Network (BTC) nodes
|
2
|
+
|
3
|
+
[](https://travis-ci.org/lnpay/lnd_ruby_sdk) [](https://codeclimate.com/github/lnpay/lnd_ruby_sdk)
|
4
|
+
|
5
|
+
This is a SDK for ruby applications that can help you communicate with your Lightning Network node. There is still a lot to do before this gem can be used by others, but I will try to update it and create a stable version as soon as possible. If you would like to help, check out the Contributing section below.
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
This SDK requires that you're running a Lightning Node on the same host as the script is running. It also requires that you are using the default paths for your macaroon file `~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon` and certificate `~/.lnd/tls.cert`. Custom paths & configurations will be added in a future version.
|
10
|
+
|
11
|
+
This SDK **does not** work with other servers than [LND](https://github.com/lightningnetwork/lnd). If your node is running on [c-lightning](https://github.com/ElementsProject/lightning), it wont work.
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```
|
18
|
+
gem 'lnd_ruby_sdk'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ bundle install
|
25
|
+
```
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
```
|
30
|
+
$ gem install lnd_ruby_sdk
|
31
|
+
```
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
TODO: Write usage instructions here
|
36
|
+
|
37
|
+
## Documentation
|
38
|
+
SDK documentation and all available commands can be found at [https://lnpay.github.io/lnd_ruby_sdk/Lightning.html](https://lnpay.github.io/lnd_ruby_sdk/Lightning.html)
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
A good way to start would be by running `rake spec` to check out the list of `Pending` tests.
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/lnpay/lnd_ruby_sdk.
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'lnd_ruby_sdk'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require 'pry'
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/Lightning.html
ADDED
@@ -0,0 +1,855 @@
|
|
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
|
8
|
+
|
9
|
+
— 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";
|
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 (L)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Lightning</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
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/lnd_ruby_sdk.rb<span class="defines">,<br />
|
82
|
+
lib/lightning/node.rb,<br /> lib/lightning/stub.rb,<br /> lib/lightning/version.rb,<br /> lib/lightning/invoices.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
|
91
|
+
<p>Namespace for classes and modules that handle communication with your LND
|
92
|
+
node</p>
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
<div class="tags">
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>
|
103
|
+
Constant Summary
|
104
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
105
|
+
</h2>
|
106
|
+
|
107
|
+
<dl class="constants">
|
108
|
+
|
109
|
+
<dt id="VERSION-constant" class="">VERSION =
|
110
|
+
<div class="docstring">
|
111
|
+
<div class="discussion">
|
112
|
+
|
113
|
+
<p>Current SDK version number.</p>
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
<div class="tags">
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</dt>
|
123
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
124
|
+
|
125
|
+
</dl>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<h2>Class Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
132
|
+
<ul class="summary">
|
133
|
+
|
134
|
+
<li class="public ">
|
135
|
+
<span class="summary_signature">
|
136
|
+
|
137
|
+
<a href="#config-class_method" title="config (class method)">.<strong>config</strong> ⇒ Object </a>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</span>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<span class="summary_desc"><div class='inline'>
|
155
|
+
<p>Returns the value of attribute config.</p>
|
156
|
+
</div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<h2>
|
168
|
+
Class Method Summary
|
169
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
170
|
+
</h2>
|
171
|
+
|
172
|
+
<ul class="summary">
|
173
|
+
|
174
|
+
<li class="public ">
|
175
|
+
<span class="summary_signature">
|
176
|
+
|
177
|
+
<a href="#addinvoice-class_method" title="addinvoice (class method)">.<strong>addinvoice</strong>(**args) ⇒ Lnrpc::AddInvoiceResponse </a>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</span>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<span class="summary_desc"><div class='inline'>
|
192
|
+
<p>Add a new invoice, expressing intent for a future payment.</p>
|
193
|
+
</div></span>
|
194
|
+
|
195
|
+
</li>
|
196
|
+
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#decodepayreq-class_method" title="decodepayreq (class method)">.<strong>decodepayreq</strong>(pay_req) ⇒ Lnrpc::PayReq </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
216
|
+
<p>DecodePayReq takes an encoded payment request string and attempts to decode
|
217
|
+
it, returning a full description of the conditions encoded within the
|
218
|
+
payment request.</p>
|
219
|
+
</div></span>
|
220
|
+
|
221
|
+
</li>
|
222
|
+
|
223
|
+
|
224
|
+
<li class="public ">
|
225
|
+
<span class="summary_signature">
|
226
|
+
|
227
|
+
<a href="#getinfo-class_method" title="getinfo (class method)">.<strong>getinfo</strong> ⇒ Lnrpc::GetInfoResponse </a>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</span>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'>
|
242
|
+
<p>Returns general information concerning the lightning node including
|
243
|
+
it's identity pubkey, alias, the chains it is connected to, and
|
244
|
+
information concerning the number of open+pending channels.</p>
|
245
|
+
</div></span>
|
246
|
+
|
247
|
+
</li>
|
248
|
+
|
249
|
+
|
250
|
+
<li class="public ">
|
251
|
+
<span class="summary_signature">
|
252
|
+
|
253
|
+
<a href="#listinvoices-class_method" title="listinvoices (class method)">.<strong>listinvoices</strong>(**args) ⇒ Lnrpc::ListInvoiceResponse </a>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
</span>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
<span class="summary_desc"><div class='inline'>
|
268
|
+
<p>This command enables the retrieval of all invoices currently stored within
|
269
|
+
the database.</p>
|
270
|
+
</div></span>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
</ul>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<div id="class_attr_details" class="attr_details">
|
280
|
+
<h2>Class Attribute Details</h2>
|
281
|
+
|
282
|
+
|
283
|
+
<span id="config=-class_method"></span>
|
284
|
+
<div class="method_details first">
|
285
|
+
<h3 class="signature first" id="config-class_method">
|
286
|
+
|
287
|
+
.<strong>config</strong> ⇒ <tt>Object</tt>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</h3><div class="docstring">
|
294
|
+
<div class="discussion">
|
295
|
+
|
296
|
+
<p>Returns the value of attribute config</p>
|
297
|
+
|
298
|
+
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
<div class="tags">
|
302
|
+
|
303
|
+
|
304
|
+
</div><table class="source_code">
|
305
|
+
<tr>
|
306
|
+
<td>
|
307
|
+
<pre class="lines">
|
308
|
+
|
309
|
+
|
310
|
+
15
|
311
|
+
16
|
312
|
+
17</pre>
|
313
|
+
</td>
|
314
|
+
<td>
|
315
|
+
<pre class="code"><span class="info file"># File 'lib/lnd_ruby_sdk.rb', line 15</span>
|
316
|
+
|
317
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_config'>config</span>
|
318
|
+
<span class='ivar'>@config</span>
|
319
|
+
<span class='kw'>end</span></pre>
|
320
|
+
</td>
|
321
|
+
</tr>
|
322
|
+
</table>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
|
328
|
+
<div id="class_method_details" class="method_details_list">
|
329
|
+
<h2>Class Method Details</h2>
|
330
|
+
|
331
|
+
|
332
|
+
<div class="method_details first">
|
333
|
+
<h3 class="signature first" id="addinvoice-class_method">
|
334
|
+
|
335
|
+
.<strong>addinvoice</strong>(**args) ⇒ <tt>Lnrpc::AddInvoiceResponse</tt>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</h3><div class="docstring">
|
342
|
+
<div class="discussion">
|
343
|
+
|
344
|
+
<p>Add a new invoice, expressing intent for a future payment. Invoices without
|
345
|
+
an amount can be created by not supplying any parameters or providing an
|
346
|
+
amount of 0. These invoices allow the payee to specify the amount of
|
347
|
+
satoshis they wish to send.</p>
|
348
|
+
|
349
|
+
|
350
|
+
</div>
|
351
|
+
</div>
|
352
|
+
<div class="tags">
|
353
|
+
|
354
|
+
<div class="examples">
|
355
|
+
<p class="tag_title">Examples:</p>
|
356
|
+
|
357
|
+
|
358
|
+
<p class="example_title"><div class='inline'>
|
359
|
+
<p>Create a new invoice</p>
|
360
|
+
</div></p>
|
361
|
+
|
362
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="Lightning (module)">Lightning</a></span></span><span class='period'>.</span><span class='id identifier rubyid_addinvoice'>addinvoice</span><span class='lparen'>(</span><span class='label'>amt:</span> <span class='int'>500</span><span class='comma'>,</span> <span class='label'>memo:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1x Cappuccino</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></code></pre>
|
363
|
+
|
364
|
+
</div>
|
365
|
+
<p class="tag_title">Parameters:</p>
|
366
|
+
<ul class="param">
|
367
|
+
|
368
|
+
<li>
|
369
|
+
|
370
|
+
<span class='name'>args</span>
|
371
|
+
|
372
|
+
|
373
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
—
|
378
|
+
<div class='inline'>
|
379
|
+
<p>a customizable set of options</p>
|
380
|
+
</div>
|
381
|
+
|
382
|
+
</li>
|
383
|
+
|
384
|
+
</ul>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
<p class="tag_title">Options Hash (<tt>**args</tt>):</p>
|
390
|
+
<ul class="option">
|
391
|
+
|
392
|
+
<li>
|
393
|
+
<span class="name">:amt</span>
|
394
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
395
|
+
<span class="default">
|
396
|
+
|
397
|
+
— default:
|
398
|
+
<tt>0</tt>
|
399
|
+
|
400
|
+
</span>
|
401
|
+
|
402
|
+
— <div class='inline'>
|
403
|
+
<p>Amount in satoshis</p>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
|
408
|
+
<li>
|
409
|
+
<span class="name">:expiry</span>
|
410
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
411
|
+
<span class="default">
|
412
|
+
|
413
|
+
— default:
|
414
|
+
<tt>3600</tt>
|
415
|
+
|
416
|
+
</span>
|
417
|
+
|
418
|
+
— <div class='inline'>
|
419
|
+
<p>Payment request expiry time in seconds.</p>
|
420
|
+
</div>
|
421
|
+
|
422
|
+
</li>
|
423
|
+
|
424
|
+
<li>
|
425
|
+
<span class="name">:memo</span>
|
426
|
+
<span class="type">(<tt>String</tt>)</span>
|
427
|
+
<span class="default">
|
428
|
+
|
429
|
+
— default:
|
430
|
+
<tt>''</tt>
|
431
|
+
|
432
|
+
</span>
|
433
|
+
|
434
|
+
— <div class='inline'>
|
435
|
+
<p>An optional memo to attach along with the invoice. Used for record keeping
|
436
|
+
purposes for the invoices creator, and will also be set in the description
|
437
|
+
field of the encoded payment request if the description_hash field is not
|
438
|
+
being used.</p>
|
439
|
+
</div>
|
440
|
+
|
441
|
+
</li>
|
442
|
+
|
443
|
+
</ul>
|
444
|
+
|
445
|
+
|
446
|
+
<p class="tag_title">Returns:</p>
|
447
|
+
<ul class="return">
|
448
|
+
|
449
|
+
<li>
|
450
|
+
|
451
|
+
|
452
|
+
<span class='type'>(<tt>Lnrpc::AddInvoiceResponse</tt>)</span>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
</li>
|
457
|
+
|
458
|
+
</ul>
|
459
|
+
|
460
|
+
</div><table class="source_code">
|
461
|
+
<tr>
|
462
|
+
<td>
|
463
|
+
<pre class="lines">
|
464
|
+
|
465
|
+
|
466
|
+
25
|
467
|
+
26
|
468
|
+
27
|
469
|
+
28
|
470
|
+
29
|
471
|
+
30
|
472
|
+
31
|
473
|
+
32
|
474
|
+
33</pre>
|
475
|
+
</td>
|
476
|
+
<td>
|
477
|
+
<pre class="code"><span class="info file"># File 'lib/lightning/invoices.rb', line 25</span>
|
478
|
+
|
479
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_addinvoice'>addinvoice</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
480
|
+
<span class='id identifier rubyid_amt'>amt</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:amt</span><span class='rbracket'>]</span>
|
481
|
+
<span class='id identifier rubyid_expiry'>expiry</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:expiry</span><span class='rbracket'>]</span>
|
482
|
+
<span class='id identifier rubyid_memo'>memo</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:memo</span><span class='rbracket'>]</span>
|
483
|
+
|
484
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_add_invoice'>add_invoice</span><span class='lparen'>(</span>
|
485
|
+
<span class='const'>Lnrpc</span><span class='op'>::</span><span class='const'>Invoice</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='label'>value:</span> <span class='id identifier rubyid_amt'>amt</span><span class='comma'>,</span> <span class='label'>expiry:</span> <span class='id identifier rubyid_expiry'>expiry</span><span class='comma'>,</span> <span class='label'>memo:</span> <span class='id identifier rubyid_memo'>memo</span><span class='rparen'>)</span>
|
486
|
+
<span class='rparen'>)</span>
|
487
|
+
<span class='kw'>end</span></pre>
|
488
|
+
</td>
|
489
|
+
</tr>
|
490
|
+
</table>
|
491
|
+
</div>
|
492
|
+
|
493
|
+
<div class="method_details ">
|
494
|
+
<h3 class="signature " id="decodepayreq-class_method">
|
495
|
+
|
496
|
+
.<strong>decodepayreq</strong>(pay_req) ⇒ <tt>Lnrpc::PayReq</tt>
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
</h3><div class="docstring">
|
503
|
+
<div class="discussion">
|
504
|
+
|
505
|
+
<p>DecodePayReq takes an encoded payment request string and attempts to decode
|
506
|
+
it, returning a full description of the conditions encoded within the
|
507
|
+
payment request.</p>
|
508
|
+
|
509
|
+
|
510
|
+
</div>
|
511
|
+
</div>
|
512
|
+
<div class="tags">
|
513
|
+
|
514
|
+
<div class="examples">
|
515
|
+
<p class="tag_title">Examples:</p>
|
516
|
+
|
517
|
+
|
518
|
+
<p class="example_title"><div class='inline'>
|
519
|
+
<p>Decode a payment request</p>
|
520
|
+
</div></p>
|
521
|
+
|
522
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="Lightning (module)">Lightning</a></span></span><span class='period'>.</span><span class='id identifier rubyid_decodepayreq'>decodepayreq</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>lnbc5u1pwt0...qxht38d</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span></code></pre>
|
523
|
+
|
524
|
+
</div>
|
525
|
+
<p class="tag_title">Parameters:</p>
|
526
|
+
<ul class="param">
|
527
|
+
|
528
|
+
<li>
|
529
|
+
|
530
|
+
<span class='name'>pay_req</span>
|
531
|
+
|
532
|
+
|
533
|
+
<span class='type'>(<tt>String</tt>)</span>
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
—
|
538
|
+
<div class='inline'>
|
539
|
+
<p>The payment request string to be decoded</p>
|
540
|
+
</div>
|
541
|
+
|
542
|
+
</li>
|
543
|
+
|
544
|
+
</ul>
|
545
|
+
|
546
|
+
<p class="tag_title">Returns:</p>
|
547
|
+
<ul class="return">
|
548
|
+
|
549
|
+
<li>
|
550
|
+
|
551
|
+
|
552
|
+
<span class='type'>(<tt>Lnrpc::PayReq</tt>)</span>
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
</li>
|
557
|
+
|
558
|
+
</ul>
|
559
|
+
|
560
|
+
</div><table class="source_code">
|
561
|
+
<tr>
|
562
|
+
<td>
|
563
|
+
<pre class="lines">
|
564
|
+
|
565
|
+
|
566
|
+
45
|
567
|
+
46
|
568
|
+
47
|
569
|
+
48</pre>
|
570
|
+
</td>
|
571
|
+
<td>
|
572
|
+
<pre class="code"><span class="info file"># File 'lib/lightning/invoices.rb', line 45</span>
|
573
|
+
|
574
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_decodepayreq'>decodepayreq</span><span class='lparen'>(</span><span class='id identifier rubyid_pay_req'>pay_req</span><span class='rparen'>)</span>
|
575
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>pay_req:</span> <span class='id identifier rubyid_pay_req'>pay_req</span> <span class='rbrace'>}</span>
|
576
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_decode_pay_req'>decode_pay_req</span><span class='lparen'>(</span><span class='const'>Lnrpc</span><span class='op'>::</span><span class='const'>PayReqString</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
577
|
+
<span class='kw'>end</span></pre>
|
578
|
+
</td>
|
579
|
+
</tr>
|
580
|
+
</table>
|
581
|
+
</div>
|
582
|
+
|
583
|
+
<div class="method_details ">
|
584
|
+
<h3 class="signature " id="getinfo-class_method">
|
585
|
+
|
586
|
+
.<strong>getinfo</strong> ⇒ <tt>Lnrpc::GetInfoResponse</tt>
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
</h3><div class="docstring">
|
593
|
+
<div class="discussion">
|
594
|
+
|
595
|
+
<p>Returns general information concerning the lightning node including
|
596
|
+
it's identity pubkey, alias, the chains it is connected to, and
|
597
|
+
information concerning the number of open+pending channels.</p>
|
598
|
+
|
599
|
+
|
600
|
+
</div>
|
601
|
+
</div>
|
602
|
+
<div class="tags">
|
603
|
+
|
604
|
+
<div class="examples">
|
605
|
+
<p class="tag_title">Examples:</p>
|
606
|
+
|
607
|
+
|
608
|
+
<p class="example_title"><div class='inline'>
|
609
|
+
<p>Receive node info</p>
|
610
|
+
</div></p>
|
611
|
+
|
612
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="Lightning (module)">Lightning</a></span></span><span class='period'>.</span><span class='id identifier rubyid_getinfo'>getinfo</span></code></pre>
|
613
|
+
|
614
|
+
</div>
|
615
|
+
|
616
|
+
<p class="tag_title">Returns:</p>
|
617
|
+
<ul class="return">
|
618
|
+
|
619
|
+
<li>
|
620
|
+
|
621
|
+
|
622
|
+
<span class='type'>(<tt>Lnrpc::GetInfoResponse</tt>)</span>
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
</li>
|
627
|
+
|
628
|
+
</ul>
|
629
|
+
|
630
|
+
</div><table class="source_code">
|
631
|
+
<tr>
|
632
|
+
<td>
|
633
|
+
<pre class="lines">
|
634
|
+
|
635
|
+
|
636
|
+
12
|
637
|
+
13
|
638
|
+
14</pre>
|
639
|
+
</td>
|
640
|
+
<td>
|
641
|
+
<pre class="code"><span class="info file"># File 'lib/lightning/node.rb', line 12</span>
|
642
|
+
|
643
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_getinfo'>getinfo</span>
|
644
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_get_info'>get_info</span><span class='lparen'>(</span><span class='const'>Lnrpc</span><span class='op'>::</span><span class='const'>GetInfoRequest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='rparen'>)</span>
|
645
|
+
<span class='kw'>end</span></pre>
|
646
|
+
</td>
|
647
|
+
</tr>
|
648
|
+
</table>
|
649
|
+
</div>
|
650
|
+
|
651
|
+
<div class="method_details ">
|
652
|
+
<h3 class="signature " id="listinvoices-class_method">
|
653
|
+
|
654
|
+
.<strong>listinvoices</strong>(**args) ⇒ <tt>Lnrpc::ListInvoiceResponse</tt>
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
</h3><div class="docstring">
|
661
|
+
<div class="discussion">
|
662
|
+
|
663
|
+
<p>This command enables the retrieval of all invoices currently stored within
|
664
|
+
the database. It has full support for paginationed responses, allowing
|
665
|
+
users to query for specific invoices through their add_index. This can be
|
666
|
+
done by using either the first_index_offset or last_index_offset fields
|
667
|
+
included in the response as the index_offset of the next request. The
|
668
|
+
reversed flag is set by default in order to paginate backwards. If you wish
|
669
|
+
to paginate forwards, you must explicitly set the flag to false. If none of
|
670
|
+
the parameters are specified, then the last 100 invoices will be returned.
|
671
|
+
For example: if you have 200 invoices, “listinvoices” will return the last
|
672
|
+
100 created. If you wish to retrieve the previous 100, the
|
673
|
+
first_offset_index of the response can be used as the index_offset of the
|
674
|
+
next listinvoices request.</p>
|
675
|
+
|
676
|
+
|
677
|
+
</div>
|
678
|
+
</div>
|
679
|
+
<div class="tags">
|
680
|
+
|
681
|
+
<div class="examples">
|
682
|
+
<p class="tag_title">Examples:</p>
|
683
|
+
|
684
|
+
|
685
|
+
<p class="example_title"><div class='inline'>
|
686
|
+
<p>List all invoices</p>
|
687
|
+
</div></p>
|
688
|
+
|
689
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="" title="Lightning (module)">Lightning</a></span></span><span class='period'>.</span><span class='id identifier rubyid_listinvoices'>listinvoices</span></code></pre>
|
690
|
+
|
691
|
+
</div>
|
692
|
+
<p class="tag_title">Parameters:</p>
|
693
|
+
<ul class="param">
|
694
|
+
|
695
|
+
<li>
|
696
|
+
|
697
|
+
<span class='name'>args</span>
|
698
|
+
|
699
|
+
|
700
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
—
|
705
|
+
<div class='inline'>
|
706
|
+
<p>a customizable set of options</p>
|
707
|
+
</div>
|
708
|
+
|
709
|
+
</li>
|
710
|
+
|
711
|
+
</ul>
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
<p class="tag_title">Options Hash (<tt>**args</tt>):</p>
|
717
|
+
<ul class="option">
|
718
|
+
|
719
|
+
<li>
|
720
|
+
<span class="name">:num_max_invoices</span>
|
721
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
722
|
+
<span class="default">
|
723
|
+
|
724
|
+
— default:
|
725
|
+
<tt>100</tt>
|
726
|
+
|
727
|
+
</span>
|
728
|
+
|
729
|
+
— <div class='inline'>
|
730
|
+
<p>The max number of invoices to return in the response to this query.</p>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
</li>
|
734
|
+
|
735
|
+
<li>
|
736
|
+
<span class="name">:index_offset</span>
|
737
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
738
|
+
<span class="default">
|
739
|
+
|
740
|
+
— default:
|
741
|
+
<tt>0</tt>
|
742
|
+
|
743
|
+
</span>
|
744
|
+
|
745
|
+
— <div class='inline'>
|
746
|
+
<p>The index of an invoice that will be used as either the start or end of a
|
747
|
+
query to determine which invoices should be returned in the response.</p>
|
748
|
+
</div>
|
749
|
+
|
750
|
+
</li>
|
751
|
+
|
752
|
+
<li>
|
753
|
+
<span class="name">:pending_only</span>
|
754
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
755
|
+
<span class="default">
|
756
|
+
|
757
|
+
— default:
|
758
|
+
<tt>false</tt>
|
759
|
+
|
760
|
+
</span>
|
761
|
+
|
762
|
+
— <div class='inline'>
|
763
|
+
<p>If set, only unsettled invoices will be returned in the response.</p>
|
764
|
+
</div>
|
765
|
+
|
766
|
+
</li>
|
767
|
+
|
768
|
+
<li>
|
769
|
+
<span class="name">:reversed</span>
|
770
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
771
|
+
<span class="default">
|
772
|
+
|
773
|
+
— default:
|
774
|
+
<tt>false</tt>
|
775
|
+
|
776
|
+
</span>
|
777
|
+
|
778
|
+
— <div class='inline'>
|
779
|
+
<p>If set, the invoices returned will result from seeking backwards from the
|
780
|
+
specified index offset. This can be used to paginate backwards.</p>
|
781
|
+
</div>
|
782
|
+
|
783
|
+
</li>
|
784
|
+
|
785
|
+
</ul>
|
786
|
+
|
787
|
+
|
788
|
+
<p class="tag_title">Returns:</p>
|
789
|
+
<ul class="return">
|
790
|
+
|
791
|
+
<li>
|
792
|
+
|
793
|
+
|
794
|
+
<span class='type'>(<tt>Lnrpc::ListInvoiceResponse</tt>)</span>
|
795
|
+
|
796
|
+
|
797
|
+
|
798
|
+
</li>
|
799
|
+
|
800
|
+
</ul>
|
801
|
+
|
802
|
+
</div><table class="source_code">
|
803
|
+
<tr>
|
804
|
+
<td>
|
805
|
+
<pre class="lines">
|
806
|
+
|
807
|
+
|
808
|
+
82
|
809
|
+
83
|
810
|
+
84
|
811
|
+
85
|
812
|
+
86
|
813
|
+
87
|
814
|
+
88
|
815
|
+
89
|
816
|
+
90
|
817
|
+
91
|
818
|
+
92
|
819
|
+
93
|
820
|
+
94</pre>
|
821
|
+
</td>
|
822
|
+
<td>
|
823
|
+
<pre class="code"><span class="info file"># File 'lib/lightning/invoices.rb', line 82</span>
|
824
|
+
|
825
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_listinvoices'>listinvoices</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
826
|
+
<span class='id identifier rubyid_num_max_invoices'>num_max_invoices</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:num_max_invoices</span><span class='rbracket'>]</span>
|
827
|
+
<span class='id identifier rubyid_index_offset'>index_offset</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:index_offset</span><span class='rbracket'>]</span>
|
828
|
+
<span class='id identifier rubyid_pending_only'>pending_only</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:pending_only</span><span class='rbracket'>]</span>
|
829
|
+
<span class='id identifier rubyid_reversed'>reversed</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='symbol'>:reversed</span><span class='rbracket'>]</span>
|
830
|
+
|
831
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_list_invoices'>list_invoices</span><span class='lparen'>(</span>
|
832
|
+
<span class='const'>Lnrpc</span><span class='op'>::</span><span class='const'>ListInvoiceRequest</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
833
|
+
<span class='label'>num_max_invoices:</span> <span class='id identifier rubyid_num_max_invoices'>num_max_invoices</span><span class='comma'>,</span> <span class='label'>index_offset:</span> <span class='id identifier rubyid_index_offset'>index_offset</span><span class='comma'>,</span>
|
834
|
+
<span class='label'>pending_only:</span> <span class='id identifier rubyid_pending_only'>pending_only</span><span class='comma'>,</span> <span class='label'>reversed:</span> <span class='id identifier rubyid_reversed'>reversed</span>
|
835
|
+
<span class='rparen'>)</span>
|
836
|
+
<span class='rparen'>)</span>
|
837
|
+
<span class='kw'>end</span></pre>
|
838
|
+
</td>
|
839
|
+
</tr>
|
840
|
+
</table>
|
841
|
+
</div>
|
842
|
+
|
843
|
+
</div>
|
844
|
+
|
845
|
+
</div>
|
846
|
+
|
847
|
+
<div id="footer">
|
848
|
+
Generated on Thu Apr 18 11:54:40 2019 by
|
849
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
850
|
+
0.9.19 (ruby-2.3.1).
|
851
|
+
</div>
|
852
|
+
|
853
|
+
</div>
|
854
|
+
</body>
|
855
|
+
</html>
|