├── docker ├── parser │ ├── __init__.py │ ├── grpc.py │ └── rest.py ├── 9-rebuild-image.sh ├── 2-serve-locally.sh ├── Gemfile ├── 3-build-html.sh ├── split-projects.sh ├── 1-render-markdown.sh ├── lib │ ├── multilang.rb │ ├── nesting_unique_head.rb │ ├── toc_data.rb │ ├── unique_head.rb │ └── monokai_sublime_slate.rb ├── Dockerfile ├── config.rb ├── install_proto.sh ├── Gemfile.lock ├── update.sh └── render.py ├── source ├── .gitignore ├── javascripts │ ├── all.js │ ├── all_nosearch.js │ ├── app │ │ ├── _search.js │ │ ├── _toc.js │ │ └── _lang.js │ └── lib │ │ ├── _jquery.highlight.js │ │ ├── _energize.js │ │ └── _imagesloaded.min.js ├── fonts │ ├── slate.eot │ ├── slate.ttf │ ├── slate.woff │ ├── slate.woff2 │ └── slate.svg ├── images │ └── navbar.png ├── stylesheets │ ├── _icon-font.scss │ ├── print.css.scss │ ├── _rtl.scss │ ├── _variables.scss │ ├── _normalize.scss │ └── screen.css.scss ├── includes │ └── _errors.md └── layouts │ └── layout.erb ├── templates ├── javascript │ ├── simple_rpc.html │ ├── streaming_response.html │ └── bidirectional.html ├── python │ ├── simple_response.html │ ├── streaming_response.html │ ├── simple_request.html │ └── streaming_request.html ├── grpc │ ├── shell.md │ ├── enum.md │ ├── message.md │ ├── request.md │ ├── response.md │ ├── lnd_python.md │ ├── other_python.md │ ├── other_javascript.md │ └── lnd_javascript.md ├── taro_header.md ├── faraday_header.md ├── loop_header.md ├── pool_header.md ├── rest │ ├── enum.md │ ├── property.md │ ├── response.md │ ├── lnd_shell.md │ ├── request.md │ ├── other_shell.md │ ├── other_javascript.md │ ├── other_python.md │ ├── lnd_python.md │ └── lnd_javascript.md ├── lnd_header.md ├── loop_footer.md ├── pool_footer.md ├── faraday_footer.md ├── taro_footer.md ├── lnd_footer.md ├── lnd_rest.md ├── faraday_rest.md ├── faraday_grpc.md ├── taro_rest.md ├── taro_grpc.md ├── lnd_grpc.md ├── loop_rest.md ├── loop_grpc.md ├── pool_rest.md └── pool_grpc.md ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── .gitignore ├── LICENSE └── README.md /docker/parser/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/.gitignore: -------------------------------------------------------------------------------- 1 | *.html.md 2 | -------------------------------------------------------------------------------- /source/javascripts/all.js: -------------------------------------------------------------------------------- 1 | //= require ./all_nosearch 2 | //= require ./app/_search 3 | -------------------------------------------------------------------------------- /source/fonts/slate.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightninglabs/lightning-api/HEAD/source/fonts/slate.eot -------------------------------------------------------------------------------- /source/fonts/slate.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightninglabs/lightning-api/HEAD/source/fonts/slate.ttf -------------------------------------------------------------------------------- /source/fonts/slate.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightninglabs/lightning-api/HEAD/source/fonts/slate.woff -------------------------------------------------------------------------------- /source/fonts/slate.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightninglabs/lightning-api/HEAD/source/fonts/slate.woff2 -------------------------------------------------------------------------------- /source/images/navbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lightninglabs/lightning-api/HEAD/source/images/navbar.png -------------------------------------------------------------------------------- /templates/javascript/simple_rpc.html: -------------------------------------------------------------------------------- 1 | {{ method.serviceJS }}.{{ method.nameJS }}(request, function(err, response) { 2 | console.log(response); 3 | }); 4 | -------------------------------------------------------------------------------- /docker/9-rebuild-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | docker build \ 6 | -t guggero/lightning-api \ 7 | docker/ 8 | 9 | docker push guggero/lightning-api 10 | -------------------------------------------------------------------------------- /templates/python/simple_response.html: -------------------------------------------------------------------------------- 1 | >>> response = stub.{{ method.name }}(request{% if method.service != 'WalletUnlocker' %}, metadata=[('macaroon', macaroon)]{% endif %}) 2 | >>> print(response) 3 | -------------------------------------------------------------------------------- /templates/python/streaming_response.html: -------------------------------------------------------------------------------- 1 | >>> for response in stub.{{ method.name }}(request{% if method.streamingRequest %}_iterable{% endif %}{% if method.service != 'WalletUnlocker' %}, metadata=[('macaroon', macaroon)]{% endif %}): 2 | print(response) 3 | -------------------------------------------------------------------------------- /docker/2-serve-locally.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | docker pull guggero/lightning-api 6 | 7 | docker run \ 8 | --rm \ 9 | -p 4567:4567 \ 10 | -v $PWD/source:/tmp/work/source \ 11 | guggero/lightning-api \ 12 | bundle exec middleman server 13 | -------------------------------------------------------------------------------- /templates/python/simple_request.html: -------------------------------------------------------------------------------- 1 | >>> request = {{ method.packageName }}.{{ method.requestMessage.shortName }}({% if method.requestMessage.params | 2 | length == 0 %}){% else %}{% for param in method.requestMessage.params %} 3 | {{ param.name }}=<{{ param.type }}>,{% endfor %} 4 | ){% endif %} 5 | -------------------------------------------------------------------------------- /templates/grpc/shell.md: -------------------------------------------------------------------------------- 1 | ```shell 2 | {% if method.subcommand and method.commandInfo %}{% for description in method.commandInfo.description %} 3 | # {{ description }}{% endfor %} 4 | 5 | $ {{ method.commandInfo.usage }} 6 | {% for option in method.commandInfo.options %} 7 | # {{ option }}{% endfor %}{% endif %} 8 | ``` 9 | -------------------------------------------------------------------------------- /templates/taro_header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Taro API Reference 3 | 4 | language_tabs: 5 | - shell 6 | - python 7 | - javascript 8 | 9 | toc_footers: 10 | - Contact Us 11 | - Powered by Slate 12 | 13 | search: true 14 | --- 15 | -------------------------------------------------------------------------------- /templates/faraday_header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Faraday API Reference 3 | 4 | language_tabs: 5 | - shell 6 | - python 7 | - javascript 8 | 9 | toc_footers: 10 | - Contact Us 11 | - Powered by Slate 12 | 13 | search: true 14 | --- 15 | -------------------------------------------------------------------------------- /templates/grpc/enum.md: -------------------------------------------------------------------------------- 1 | ### {{ enum.name }} 2 | {{ enum.description }} 3 | {% if enum.options | length == 0 %} 4 | This enum has no values. 5 | {% else %} 6 | Name | Value | Description 7 | ---- | ----- | ----------- {% for option in enum.options %} 8 | {{ option.name }} | {{ option.value }} | {{ option.description }} {% endfor %} {% endif %} 9 | -------------------------------------------------------------------------------- /templates/loop_header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Lightning Loop API Reference 3 | 4 | language_tabs: 5 | - shell 6 | - python 7 | - javascript 8 | 9 | toc_footers: 10 | - Contact Us 11 | - Powered by Slate 12 | 13 | search: true 14 | --- 15 | -------------------------------------------------------------------------------- /templates/pool_header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Lightning Pool API Reference 3 | 4 | language_tabs: 5 | - shell 6 | - python 7 | - javascript 8 | 9 | toc_footers: 10 | - Contact Us 11 | - Powered by Slate 12 | 13 | search: true 14 | --- 15 | -------------------------------------------------------------------------------- /templates/rest/enum.md: -------------------------------------------------------------------------------- 1 | ### {{ enum.name }} 2 | {{ enum.description }} 3 | {% if enum.options | length == 0 %} 4 | This enum has no values. 5 | {% else %} 6 | Name | Value | Description 7 | ---- | ----- | ----------- {% for option in enum.options %} 8 | {{ option.name }} | {{ option.value }} | {{ option.description }} {% endfor %} {% endif %} 9 | -------------------------------------------------------------------------------- /docker/Gemfile: -------------------------------------------------------------------------------- 1 | ruby '>=2.6.0' 2 | source 'https://rubygems.org' 3 | 4 | # Middleman 5 | gem 'middleman', '~> 4.4' 6 | gem 'middleman-syntax', '~> 3.2' 7 | gem 'middleman-autoprefixer', '~> 3.0' 8 | gem 'middleman-sprockets', '~> 4.1' 9 | gem 'rouge', '~> 3.21' 10 | gem 'redcarpet', '~> 3.5.0' 11 | gem 'nokogiri', '~> 1.13.10' 12 | gem 'sass' 13 | gem 'webrick' 14 | -------------------------------------------------------------------------------- /templates/lnd_header.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: LND API Reference 3 | 4 | language_tabs: 5 | - shell 6 | - python 7 | - javascript 8 | 9 | toc_footers: 10 | - Developer site 11 | - Contact Us 12 | - Powered by Slate 13 | 14 | search: true 15 | --- 16 | -------------------------------------------------------------------------------- /templates/javascript/streaming_response.html: -------------------------------------------------------------------------------- 1 | let call = {{ method.serviceJS }}.{{ method.nameJS }}(request); 2 | call.on('data', function(response) { 3 | // A response was received from the server. 4 | console.log(response); 5 | }); 6 | call.on('status', function(status) { 7 | // The current status of the stream. 8 | }); 9 | call.on('end', function() { 10 | // The server has closed the stream. 11 | }); 12 | -------------------------------------------------------------------------------- /templates/rest/property.md: -------------------------------------------------------------------------------- 1 | ### {{ property.name }} 2 | {% if property.params|length == 0 %} 3 | This property has no parameters. 4 | {% else %} 5 | Field | Type | Description 6 | ----- | ---- | ----------- {% for param in property.params %} 7 | {{ param.name }} | {% if param.link is defined %}[{{ param.type }}](#{{ param.link }}){% else %}{{ param.type }}{% endif %} | {{ param.description }}{% endfor %} 8 | {% endif %} 9 | -------------------------------------------------------------------------------- /templates/javascript/bidirectional.html: -------------------------------------------------------------------------------- 1 | let call = {{ method.serviceJS }}.{{ method.nameJS }}({}); 2 | call.on('data', function(response) { 3 | // A response was received from the server. 4 | console.log(response); 5 | }); 6 | call.on('status', function(status) { 7 | // The current status of the stream. 8 | }); 9 | call.on('end', function() { 10 | // The server has closed the stream. 11 | }); 12 | call.write(request); 13 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | !!!!! STOP AND READ !!!!! 2 | 3 | If the dropdown above says "base fork: lord/master", you are submitting your change to ALL USERS OF SLATE, not just your company. This is probably not what you want. Click "base fork" to change it to the right place. 4 | 5 | If you're actually trying to submit a change to upstream Slate, please submit to our dev branch, PRs sent to the master branch are generally rejected. 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | coverage 6 | InstalledFiles 7 | lib/bundler/man 8 | pkg 9 | rdoc 10 | spec/reports 11 | test/tmp 12 | test/version_tmp 13 | tmp 14 | *.DS_STORE 15 | build/ 16 | vendor/ 17 | .cache 18 | .vagrant 19 | .sass-cache 20 | 21 | # YARD artifacts 22 | .yardoc 23 | _yardoc 24 | doc/ 25 | .idea/ 26 | 27 | *.swp 28 | 29 | # Go 30 | src/ 31 | 32 | # Python 33 | __pycache__/ 34 | *.pyc 35 | -------------------------------------------------------------------------------- /templates/grpc/message.md: -------------------------------------------------------------------------------- 1 | ### {{ messageName }} 2 | {{ message.description }} 3 | {% if message.params | length == 0 %} 4 | This message has no parameters. 5 | {% else %} 6 | Parameter | Type | Description 7 | --------- | ---- | ----------- {% for param in message.params %} 8 | {{ param.name }} | {% if param.link is defined %}[{{ param.type }}](#{{ param.link }}){% else %}{{ param.type }}{% endif %} | {{ param.description }} {% endfor %} {% endif %} 9 | -------------------------------------------------------------------------------- /templates/rest/response.md: -------------------------------------------------------------------------------- 1 | ### Response {% if endpoint.isStreaming %}(streaming){% endif %} 2 | {% if endpoint.responseParams|length == 0 %} 3 | This response has no parameters. 4 | {% else %} 5 | Field | Type | Description 6 | ----- | ---- | ----------- {% for param in endpoint.responseParams %} 7 | {{ param.name }} | {% if param.link is defined %}[{{ param.type }}](#{{ param.link }}){% else %}{{ param.type }}{% endif %} | {{ param.description }} {% endfor %} {% endif %} 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | If this is a question or feature request, make sure to: 2 | 3 | - [ ] The title starts with `Question:` or `Feature:`. 4 | 5 | If this is an bug report, not a question, make sure to: 6 | 7 | - [ ] I'm not running Windows (which is unsupported), or if I am, I can confirm this issue appears on another platform, or Vagrant. 8 | - [ ] This issue appears in the latest `dev` branch. 9 | - [ ] I've included my browser and Ruby version in this issue. 10 | -------------------------------------------------------------------------------- /source/javascripts/all_nosearch.js: -------------------------------------------------------------------------------- 1 | //= require ./lib/_energize 2 | //= require ./app/_toc 3 | //= require ./app/_lang 4 | 5 | $(function() { 6 | loadToc($('#toc'), '.toc-link', '.toc-list-h2', 10); 7 | setupLanguages($('body').data('languages')); 8 | $('.content').imagesLoaded( function() { 9 | window.recacheHeights(); 10 | window.refreshToc(); 11 | }); 12 | }); 13 | 14 | window.onpopstate = function() { 15 | activateLanguage(getLanguageFromQueryString()); 16 | }; 17 | -------------------------------------------------------------------------------- /templates/loop_footer.md: -------------------------------------------------------------------------------- 1 | # Other API References 2 | 3 | This is the gRPC and REST API reference for the `loopd` daemon. There are separate API reference documents for the 4 | following daemons: 5 | 6 | - [LND API Reference](https://api.lightning.community/) 7 | - [Faraday API Reference](https://api.lightning.community/faraday.html) 8 | - [Lightning Pool API Reference](https://lightning.engineering/poolapi/) 9 | - [Taro API Reference](https://lightning.engineering/taroapi/) 10 | 11 |


12 | -------------------------------------------------------------------------------- /templates/pool_footer.md: -------------------------------------------------------------------------------- 1 | # Other API References 2 | 3 | This is the gRPC and REST API reference for the `pool` daemon. There are separate API reference documents for the 4 | following daemons: 5 | 6 | - [LND API Reference](https://api.lightning.community/) 7 | - [Lightning Loop API Reference](https://lightning.engineering/loopapi/) 8 | - [Faraday API Reference](https://api.lightning.community/faraday.html) 9 | - [Taro API Reference](https://lightning.engineering/taroapi/) 10 | 11 |


12 | -------------------------------------------------------------------------------- /templates/faraday_footer.md: -------------------------------------------------------------------------------- 1 | # Other API References 2 | 3 | This is the gRPC and REST API reference for the `faraday` daemon. There are separate API reference documents for the 4 | following daemons: 5 | 6 | - [LND API Reference](https://api.lightning.community/) 7 | - [Lightning Loop API Reference](https://lightning.engineering/loopapi/) 8 | - [Lightning Pool API Reference](https://lightning.engineering/poolapi/) 9 | - [Taro API Reference](https://lightning.engineering/taroapi/) 10 | 11 |


12 | -------------------------------------------------------------------------------- /docker/3-build-html.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | docker pull guggero/lightning-api 6 | 7 | SCRIPT_DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" 8 | 9 | docker run \ 10 | --rm \ 11 | -v $PWD/build:/tmp/work/build \ 12 | -v $PWD/source:/tmp/work/source \ 13 | guggero/lightning-api \ 14 | bundle exec middleman build --verbose --clean 15 | 16 | echo "Docker built as root, need to give file permissions back to the user" 17 | sudo chown -R $USER build 18 | $SCRIPT_DIR/split-projects.sh 19 | -------------------------------------------------------------------------------- /templates/taro_footer.md: -------------------------------------------------------------------------------- 1 | # Other API References 2 | 3 | This is the gRPC and REST API reference for the `taro` daemon. There are separate API reference documents for the 4 | following daemons: 5 | 6 | - [LND API Reference](https://api.lightning.community/) 7 | - [Lightning Loop API Reference](https://lightning.engineering/loopapi/) 8 | - [Faraday API Reference](https://api.lightning.community/faraday.html) 9 | - [Lightning Pool API Reference](https://lightning.engineering/poolapi/) 10 | 11 |


12 | -------------------------------------------------------------------------------- /templates/lnd_footer.md: -------------------------------------------------------------------------------- 1 | # Other API References 2 | 3 | This is the gRPC and REST API reference for the `lnd` daemon. There are separate API reference documents for the 4 | following daemons: 5 | 6 | - [Lightning Loop API Reference](https://lightning.engineering/loopapi/) 7 | - [Faraday API Reference](https://api.lightning.community/faraday.html) 8 | - [Lightning Pool API Reference](https://lightning.engineering/poolapi/) 9 | - [Taro API Reference](https://lightning.engineering/taroapi/) 10 | 11 |


12 | -------------------------------------------------------------------------------- /docker/split-projects.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | rm -rf build/loop build/lnd build/faraday build/pool build/taro 6 | cp -r build/all build/loop 7 | cp -r build/all build/faraday 8 | cp -r build/all build/pool 9 | cp -r build/all build/taro 10 | mv build/all build/lnd 11 | cp build/loop/loop.html build/loop/index.html 12 | cp build/lnd/lnd.html build/lnd/index.html 13 | cp build/faraday/faraday.html build/faraday/index.html 14 | cp build/pool/pool.html build/pool/index.html 15 | cp build/taro/taro.html build/taro/index.html 16 | -------------------------------------------------------------------------------- /docker/1-render-markdown.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e -x 4 | 5 | docker pull guggero/lightning-api 6 | 7 | docker run \ 8 | --rm \ 9 | -e WS_ENABLED \ 10 | -e LND_FORK \ 11 | -e LND_COMMIT \ 12 | -e LOOP_FORK \ 13 | -e LOOP_COMMIT \ 14 | -e FARADAY_FORK \ 15 | -e FARADAY_COMMIT \ 16 | -e POOL_FORK \ 17 | -e POOL_COMMIT \ 18 | -e TARO_FORK \ 19 | -e TARO_COMMIT \ 20 | -v $PWD/build:/tmp/work/build \ 21 | -v $PWD/templates:/tmp/work/templates \ 22 | -v $PWD/source:/tmp/work/source \ 23 | guggero/lightning-api \ 24 | ./update.sh 25 | -------------------------------------------------------------------------------- /templates/rest/lnd_shell.md: -------------------------------------------------------------------------------- 1 | ```shell 2 | $ MACAROON_HEADER="Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 $LND_DIR/data/chain/bitcoin/regtest/admin.macaroon)" 3 | $ curl -X {{ endpoint.type }} --cacert $LND_DIR/tls.cert --header "$MACAROON_HEADER" https://localhost:{{ restport }}{{ endpoint.path }} {% if endpoint.type == "POST" %} \ 4 | -d '{ {% for param in endpoint.requestParams %}"{{ param.name }}":<{{ param.type }}>,{% endfor %} }' {% endif %} 5 | { {% for param in endpoint.responseParams %} 6 | "{{ param.name }}": <{{ param.type }}>, {% endfor %} 7 | } 8 | ``` 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008-2013 Concur Technologies, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | not use this file except in compliance with the License. You may obtain 5 | a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | License for the specific language governing permissions and limitations 13 | under the License. -------------------------------------------------------------------------------- /templates/rest/request.md: -------------------------------------------------------------------------------- 1 | ### {{ endpoint.type }} {{ endpoint.path }} 2 | {{ endpoint.summary }}{% if endpoint.description|length > 0 %} 3 | 4 | {{ endpoint.description }}{% endif %} 5 | 6 | {% if endpoint.requestParams|length == 0 %} 7 | This request has no parameters. 8 | {% else %} 9 | Field | Type | Placement | Description 10 | ----- | ---- | --------- | ----------- {% for param in endpoint.requestParams %} 11 | {{ param.name }} | {% if param.link is defined %}[{{ param.type }}](#{{ param.link }}){% else %}{{ param.type }}{% endif %} | {{ param.placement }} | {{ param.description }}{% endfor %} 12 | {% endif %} 13 | -------------------------------------------------------------------------------- /docker/lib/multilang.rb: -------------------------------------------------------------------------------- 1 | module Multilang 2 | def block_code(code, full_lang_name) 3 | if full_lang_name 4 | parts = full_lang_name.split('--') 5 | rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified 6 | super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match| 7 | match + " tab-" + full_lang_name 8 | end 9 | else 10 | super(code, full_lang_name) 11 | end 12 | end 13 | end 14 | 15 | require 'middleman-core/renderers/redcarpet' 16 | Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang 17 | -------------------------------------------------------------------------------- /templates/rest/other_shell.md: -------------------------------------------------------------------------------- 1 | ```shell 2 | $ MACAROON_HEADER="Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 ${% filter upper %}{{ component }}{% endfilter %}_DIR/regtest/{{ component }}.macaroon)" 3 | $ curl -X {{ endpoint.type }} --cacert ${% filter upper %}{{ component }}{% endfilter %}_DIR/tls.cert --header "$MACAROON_HEADER" https:://localhost:{{ restport }}{{ endpoint.path }}{% if endpoint.type == "POST" %} -d '{ \{% for param in endpoint.requestParams %} 4 | "{{ param.name }}":<{{ param.type }}>, \{% endfor %} 5 | }'{% endif %} 6 | { {% for param in endpoint.responseParams %} 7 | "{{ param.name }}": <{{ param.type }}>, {% endfor %} 8 | } 9 | ``` 10 | -------------------------------------------------------------------------------- /templates/grpc/request.md: -------------------------------------------------------------------------------- 1 | ### gRPC Request: [{{ method.requestFullType }} {% if method.streamingRequest %}(Streaming){% endif %}]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{method.requestMessage.file}}#L{{method.requestMessage.line}}) 2 | {{ method.requestMessage.description }} 3 | {% if method.requestMessage.params|length == 0 %} 4 | This request has no parameters. 5 | {% else %} 6 | Parameter | Type | Description 7 | --------- | ---- | ----------- {% for param in method.requestMessage.params %} 8 | {{ param.name }} | {% if param.link is defined %}[{{ param.type }}](#{{ param.link }}){% else %}{{ param.type }}{% endif %} | {{ param.description }} {% endfor %} {% endif %} 9 | -------------------------------------------------------------------------------- /templates/grpc/response.md: -------------------------------------------------------------------------------- 1 | ### gRPC Response: [{{ method.responseFullType }} {% if method.streamingResponse %}(Streaming){% endif %}]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{method.responseMessage.file}}#L{{method.responseMessage.line}}) 2 | {{ method.responseMessage.description }} 3 | {% if method.responseMessage.params | length == 0 %} 4 | This response has no parameters. 5 | {% else %} 6 | Parameter | Type | Description 7 | --------- | ---- | ----------- {% for param in method.responseMessage.params %} 8 | {{ param.name }} | {% if param.link is defined %}[{{ param.type }}](#{{ param.link }}){% else %}{{ param.type }}{% endif %} | {{ param.description }} {% endfor %} {% endif %} 9 | -------------------------------------------------------------------------------- /templates/python/streaming_request.html: -------------------------------------------------------------------------------- 1 | # Define a generator that returns an Iterable of {{ method.requestMessage.name }} objects. 2 | >>> def request_generator(): 3 | # Initialization code here. 4 | while True: 5 | # Parameters here can be set as arguments to the generator. 6 | request = {{ method.packageName }}.{{ method.requestMessage.shortName }}({% if 7 | method.requestMessage.params | length == 0 %}){% else %}{% for param in method.requestMessage.params %} 8 | {{ param.name }}=<{{ param.type }}>,{% endfor %} 9 | ){% endif %} 10 | yield request 11 | # Do things between iterations here. 12 | >>> request_iterable = request_generator() 13 | -------------------------------------------------------------------------------- /docker/lib/nesting_unique_head.rb: -------------------------------------------------------------------------------- 1 | # Nested unique header generation 2 | require 'middleman-core/renderers/redcarpet' 3 | 4 | class NestingUniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML 5 | def initialize 6 | super 7 | @@headers_history = {} if !defined?(@@headers_history) 8 | end 9 | 10 | def header(text, header_level) 11 | friendly_text = text.gsub(/<[^>]*>/,"").parameterize 12 | @@headers_history[header_level] = text.parameterize 13 | 14 | if header_level > 1 15 | for i in (header_level - 1).downto(1) 16 | friendly_text.prepend("#{@@headers_history[i]}-") if @@headers_history.key?(i) 17 | end 18 | end 19 | 20 | return "#{text}" 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /docker/lib/toc_data.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | 3 | def toc_data(page_content) 4 | html_doc = Nokogiri::HTML::DocumentFragment.parse(page_content) 5 | 6 | # get a flat list of headers 7 | headers = [] 8 | html_doc.css('h1, h2, h3').each do |header| 9 | headers.push({ 10 | id: header.attribute('id').to_s, 11 | content: header.children, 12 | title: header.children.to_s.gsub(/<[^>]*>/, ''), 13 | level: header.name[1].to_i, 14 | children: [] 15 | }) 16 | end 17 | 18 | [3,2].each do |header_level| 19 | header_to_nest = nil 20 | headers = headers.reject do |header| 21 | if header[:level] == header_level 22 | header_to_nest[:children].push header if header_to_nest 23 | true 24 | else 25 | header_to_nest = header if header[:level] < header_level 26 | false 27 | end 28 | end 29 | end 30 | headers 31 | end 32 | -------------------------------------------------------------------------------- /docker/lib/unique_head.rb: -------------------------------------------------------------------------------- 1 | # Unique header generation 2 | require 'middleman-core/renderers/redcarpet' 3 | require 'digest' 4 | class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML 5 | def initialize 6 | super 7 | @head_count = {} 8 | end 9 | def header(text, header_level) 10 | friendly_text = text.gsub(/<[^>]*>/,"").parameterize 11 | if friendly_text.strip.length == 0 12 | # Looks like parameterize removed the whole thing! It removes many unicode 13 | # characters like Chinese and Russian. To get a unique URL, let's just 14 | # URI escape the whole header 15 | friendly_text = Digest::SHA1.hexdigest(text)[0,10] 16 | end 17 | @head_count[friendly_text] ||= 0 18 | @head_count[friendly_text] += 1 19 | if @head_count[friendly_text] > 1 20 | friendly_text += "-#{@head_count[friendly_text]}" 21 | end 22 | return "#{text}" 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /source/stylesheets/_icon-font.scss: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'slate'; 3 | src:font-url('slate.eot?-syv14m'); 4 | src:font-url('slate.eot?#iefix-syv14m') format('embedded-opentype'), 5 | font-url('slate.woff2?-syv14m') format('woff2'), 6 | font-url('slate.woff?-syv14m') format('woff'), 7 | font-url('slate.ttf?-syv14m') format('truetype'), 8 | font-url('slate.svg?-syv14m#slate') format('svg'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | 13 | %icon { 14 | font-family: 'slate'; 15 | speak: none; 16 | font-style: normal; 17 | font-weight: normal; 18 | font-variant: normal; 19 | text-transform: none; 20 | line-height: 1; 21 | } 22 | 23 | %icon-exclamation-sign { 24 | @extend %icon; 25 | content: "\e600"; 26 | } 27 | %icon-info-sign { 28 | @extend %icon; 29 | content: "\e602"; 30 | } 31 | %icon-ok-sign { 32 | @extend %icon; 33 | content: "\e606"; 34 | } 35 | %icon-search { 36 | @extend %icon; 37 | content: "\e607"; 38 | } 39 | -------------------------------------------------------------------------------- /templates/rest/other_javascript.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | const fs = require('fs'); 3 | const request = require('request'); 4 | const macaroon = fs.readFileSync('{% filter upper %}{{ component }}{% endfilter %}_DIR/regtest/{{ component }}.macaroon').toString('hex');{% if endpoint.type == 'POST' %} 5 | let requestBody = { {% for param in endpoint.requestParams %} 6 | {{ param.name }}: <{{ param.type }}>,{% endfor %} 7 | };{% endif %} 8 | let options = { 9 | url: 'https://localhost:{{ restport }}{{ endpoint.path }}', 10 | // Work-around for self-signed certificates. 11 | rejectUnauthorized: false, 12 | json: true, 13 | headers: { 14 | 'Grpc-Metadata-macaroon': macaroon 15 | },{% if endpoint.type == 'POST' %} 16 | form: JSON.stringify(requestBody){% endif %} 17 | }; 18 | request.{{ endpoint.type|lower }}(options, function(error, response, body) { 19 | console.log(body); 20 | }); 21 | // Console output: 22 | // { {% for param in endpoint.responseParams %} 23 | // "{{ param.name }}": <{{ param.type }}>, {% endfor %} 24 | // } 25 | ``` 26 | -------------------------------------------------------------------------------- /templates/rest/other_python.md: -------------------------------------------------------------------------------- 1 | ```python 2 | >>> import base64, json, requests 3 | >>> url = 'https://localhost:{{ restport }}{{ endpoint.path }}' 4 | >>> cert_path = '{% filter upper %}{{ component }}{% endfilter %}_DIR/tls.cert' 5 | >>> macaroon = codecs.encode(open('{% filter upper %}{{ component }}{% endfilter %}_DIR/regtest/{{ component }}.macaroon', 'rb').read(), 'hex') 6 | >>> headers = {'Grpc-Metadata-macaroon': macaroon}{% if endpoint.type == 'POST' %} 7 | >>> data = { {% for param in endpoint.requestParams %} 8 | '{{ param.name }}': {% if param.type == 'byte' %}base64.b64encode(<{{ param.type }}>).decode(){% else %}<{{ param.type }}>{% endif %}, {% endfor %} 9 | }{% endif %} 10 | >>> r = requests.{{ endpoint.type|lower }}(url, verify=cert_path{% if endpoint.isStreaming %}, stream=True{% endif %}{% if endpoint.type == 'POST' %}, data=json.dumps(data){% endif %}){% if endpoint.isStreaming %} 11 | >>> for raw_response in r.iter_lines(): 12 | >>> json_response = json.loads(raw_response) 13 | >>> print(json_response){% else %} 14 | >>> print(r.json()){% endif %} 15 | { {% for param in endpoint.responseParams %} 16 | "{{ param.name }}": <{{ param.type }}>, {% endfor %} 17 | } 18 | ``` 19 | -------------------------------------------------------------------------------- /source/includes/_errors.md: -------------------------------------------------------------------------------- 1 | # Errors 2 | 3 | 6 | 7 | The Kittn API uses the following error codes: 8 | 9 | 10 | Error Code | Meaning 11 | ---------- | ------- 12 | 400 | Bad Request -- Your request is invalid. 13 | 401 | Unauthorized -- Your API key is wrong. 14 | 403 | Forbidden -- The kitten requested is hidden for administrators only. 15 | 404 | Not Found -- The specified kitten could not be found. 16 | 405 | Method Not Allowed -- You tried to access a kitten with an invalid method. 17 | 406 | Not Acceptable -- You requested a format that isn't json. 18 | 410 | Gone -- The kitten requested has been removed from our servers. 19 | 418 | I'm a teapot. 20 | 429 | Too Many Requests -- You're requesting too many kittens! Slow down! 21 | 500 | Internal Server Error -- We had a problem with our server. Try again later. 22 | 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. 23 | -------------------------------------------------------------------------------- /templates/rest/lnd_python.md: -------------------------------------------------------------------------------- 1 | ```python 2 | >>> import base64, codecs, json, requests 3 | >>> url = 'https://localhost:{{ restport }}{{ endpoint.path }}' 4 | >>> cert_path = 'LND_DIR/tls.cert'{% if endpoint.service != 'WalletUnlocker' %} 5 | >>> macaroon = codecs.encode(open('LND_DIR/data/chain/bitcoin/regtest/admin.macaroon', 'rb').read(), 'hex') 6 | >>> headers = {'Grpc-Metadata-macaroon': macaroon}{% endif %}{% if endpoint.type == 'POST' %} 7 | >>> data = { {% for param in endpoint.requestParams %} 8 | '{{ param.name }}': {% if param.type == 'byte' %}base64.b64encode(<{{ param.type }}>).decode(){% else %}<{{ param.type }}>{% endif %}, {% endfor %} 9 | }{% endif %} 10 | >>> r = requests.{{ endpoint.type|lower }}(url{% if endpoint.service != 'WalletUnlocker' %}, headers=headers{% endif %}, verify=cert_path{% if endpoint.isStreaming %}, stream=True{% endif %}{% if endpoint.type == 'POST' %}, data=json.dumps(data){% endif %}){% if endpoint.isStreaming %} 11 | >>> for raw_response in r.iter_lines(): 12 | >>> json_response = json.loads(raw_response) 13 | >>> print(json_response){% else %} 14 | >>> print(r.json()){% endif %} 15 | { {% for param in endpoint.responseParams %} 16 | "{{ param.name }}": <{{ param.type }}>, {% endfor %} 17 | } 18 | ``` 19 | -------------------------------------------------------------------------------- /templates/grpc/lnd_python.md: -------------------------------------------------------------------------------- 1 | ```python 2 | >>> import codecs, grpc, os 3 | >>> # Generate the following 2 modules by compiling the {{ rpcdir }}/{{ method.fileName }} with the grpcio-tools. 4 | >>> # See https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/python.md for instructions. 5 | >>> import {{ method.stubFileName }}_pb2 as {{ method.packageName }}, {{ method.stubFileName }}_pb2_grpc as {{ method.stubFileName }}stub{% if method.service != 'WalletUnlocker' %} 6 | >>> macaroon = codecs.encode(open('LND_DIR/data/chain/bitcoin/regtest/admin.macaroon', 'rb').read(), 'hex'){% endif %} 7 | >>> os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA' 8 | >>> cert = open('LND_DIR/tls.cert', 'rb').read() 9 | >>> ssl_creds = grpc.ssl_channel_credentials(cert) 10 | >>> channel = grpc.secure_channel('localhost:{{ grpcport }}', ssl_creds) 11 | >>> stub = {{ method.stubFileName }}stub.{{ method.service }}Stub(channel){% if method.streamingRequest %} 12 | {% include 'python/streaming_request.html' %}{% else %} 13 | {% include 'python/simple_request.html' %}{% endif %}{% if method.streamingResponse %} 14 | {% include 'python/streaming_response.html' %}{% else %} 15 | {% include 'python/simple_response.html' %}{% endif %} 16 | { {% for param in method.responseMessage.params %} 17 | "{{ param.name }}": <{{ param.type }}>,{% endfor %} 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /templates/grpc/other_python.md: -------------------------------------------------------------------------------- 1 | ```python 2 | >>> import codecs, grpc, os 3 | >>> # Generate the following 2 modules by compiling the {{ rpcdir }}/{{ method.fileName }} with the grpcio-tools. 4 | >>> # See https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/python.md for instructions. 5 | >>> import {{ method.stubFileName }}_pb2 as {{ method.packageName }}, {{ method.stubFileName }}_pb2_grpc as {{ method.stubFileName }}stub 6 | >>> macaroon = codecs.encode(open('{% filter upper %}{{ component }}{% endfilter %}_DIR/regtest/{{ component }}.macaroon', 'rb').read(), 'hex') 7 | >>> os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA' 8 | >>> cert = open('{% filter upper %}{{ component }}{% endfilter %}_DIR/tls.cert', 'rb').read() 9 | >>> ssl_creds = grpc.ssl_channel_credentials(cert) 10 | >>> channel = grpc.secure_channel('localhost:{{ grpcport }}', ssl_creds) 11 | >>> stub = {{ method.stubFileName }}stub.{{ method.service }}Stub(channel){% if method.streamingRequest %} 12 | {% include 'python/streaming_request.html' %}{% else %} 13 | {% include 'python/simple_request.html' %}{% endif %}{% if method.streamingResponse %} 14 | {% include 'python/streaming_response.html' %}{% else %} 15 | {% include 'python/simple_response.html' %}{% endif %} 16 | { {% for param in method.responseMessage.params %} 17 | "{{ param.name }}": <{{ param.type }}>,{% endfor %} 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.18-bullseye 2 | 3 | # Install all required packages. We need Ruby >= 2.3.1 and Python >= 2.7.0. 4 | RUN apt-get -y update \ 5 | && apt-get -y install \ 6 | ruby-full \ 7 | zlib1g-dev \ 8 | python3 \ 9 | python3-pip \ 10 | git \ 11 | build-essential \ 12 | rsync \ 13 | nodejs \ 14 | && rm -rf /var/lib/apt/lists/* 15 | 16 | RUN gem install bundler \ 17 | && pip3 install Jinja2 18 | 19 | RUN mkdir /tmp/work && cd /tmp/work 20 | WORKDIR /tmp/work 21 | 22 | COPY config.rb Gemfile Gemfile.lock /tmp/work/ 23 | RUN bundle config set path 'vendor/bundle' \ 24 | && bundle install 25 | 26 | COPY install_proto.sh /tmp/work/ 27 | RUN /tmp/work/install_proto.sh 28 | 29 | # Compile both projects to have most dependencies and build steps cached. 30 | RUN git clone https://github.com/lightningnetwork/lnd /tmp/lnd \ 31 | && cd /tmp/lnd \ 32 | && make \ 33 | && git clone https://github.com/lightninglabs/loop /tmp/loop \ 34 | && cd /tmp/loop \ 35 | && make \ 36 | && git clone https://github.com/lightninglabs/faraday /tmp/faraday \ 37 | && cd /tmp/faraday \ 38 | && make \ 39 | && git clone https://github.com/lightninglabs/pool /tmp/pool \ 40 | && cd /tmp/pool \ 41 | && make \ 42 | && git clone https://github.com/lightninglabs/taro /tmp/taro \ 43 | && cd /tmp/taro \ 44 | && make 45 | 46 | # Copy the rest of the files last so changes won't trigger a full rebuild of the image. 47 | COPY . /tmp/work 48 | -------------------------------------------------------------------------------- /templates/grpc/other_javascript.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | const fs = require('fs'); 3 | const grpc = require('@grpc/grpc-js'); 4 | const protoLoader = require('@grpc/proto-loader'); 5 | const loaderOptions = { 6 | keepCase: true, 7 | longs: String, 8 | enums: String, 9 | defaults: true, 10 | oneofs: true 11 | }; 12 | const packageDefinition = protoLoader.loadSync('{{ method.fileName }}', loaderOptions); 13 | const {{ method.packageName }} = grpc.loadPackageDefinition(packageDefinition).{{ method.packageName }}; 14 | const macaroon = fs.readFileSync("{% filter upper %}{{ component }}{% endfilter %}_DIR/regtest/{{ component }}.macaroon").toString('hex'); 15 | process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'; 16 | const lndCert = fs.readFileSync('{% filter upper %}{{ component }}{% endfilter %}_DIR/tls.cert'); 17 | const sslCreds = grpc.credentials.createSsl(lndCert); 18 | const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) { 19 | let metadata = new grpc.Metadata(); 20 | metadata.add('macaroon', macaroon); 21 | callback(null, metadata); 22 | }); 23 | let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds); 24 | const {{ method.serviceJS }} = new {{ method.packageName }}.{{ method.service }}('localhost:{{ grpcport }}', creds); 25 | let request = {% if method.requestMessage.params|length == 0 %}{}{% else %}{ {% for param in method.requestMessage.params %} 26 | {{ param.name }}: <{{ param.type }}>, {% endfor %} 27 | };{% endif %}{% if not method.streamingRequest and not method.streamingResponse %} 28 | {% include 'javascript/simple_rpc.html' %}{% elif not method.streamingRequest and method.streamingResponse %} 29 | {% include 'javascript/streaming_response.html' %}{% else %} 30 | {% include 'javascript/bidirectional.html' %}{% endif %} 31 | // Console output: 32 | // { {% for param in method.responseMessage.params %} 33 | // "{{ param.name }}": <{{ param.type }}>,{% endfor %} 34 | // } 35 | ``` 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lightning Network Daemon API Documentation Site 2 | API Documentation for the Lightning Network Daemon, powered by 3 | [Slate](https://github.com/lord/slate) 4 | 5 | # THIS PROJECT IS NO LONGER USED AND IS ARCHIVED! 6 | 7 | The [`lnd` API documentation](https://api.lightning.community) is now being 8 | generated by the new [`lightning-api-ng` 9 | project](https://github.com/lightninglabs/lightning-api-ng). 10 | 11 | ## Overview 12 | 13 | This repository contains functionality for programmatically pulling API 14 | information from `lncli -h` and `rpc.proto` on the lnd Github, using a Python 15 | script and Jinja2 template to output Slate markdown, which itself generates the 16 | fully rendered static site. 17 | 18 | Pay special attention to the files inside the `templates` directory. They contain 19 | the Jinja2 templates fed into the Python script, holding the basic format and 20 | introductory information for the site. 21 | 22 | ## Running the site locally 23 | 24 | **Important**: You need to run all commands from the root directory! 25 | 26 | ### Prerequisites 27 | 28 | You're going to need: 29 | - **Docker CE** installed 30 | 31 | ### Building the docker image 32 | 33 | This step is only necessary if a file inside the `docker/` folder was changed. 34 | To just run everything, you can skip this step as the scripts will just use the 35 | image `guggero/lightning-api` from Docker Hub. 36 | 37 | ```shell script 38 | ./docker/9-rebuild-image.sh 39 | ``` 40 | 41 | ### Regenerating the markdown from the proto files 42 | 43 | This step will check out the latest sources, copy the `*.proto` files and then 44 | regenerate the documentation markdown. 45 | 46 | ```shell script 47 | ./docker/1-render-markdown.sh 48 | ``` 49 | 50 | You should now see updated `*.html.md` files in the `sources` folder. 51 | 52 | ### Running locally 53 | 54 | To verify everything was updated/generated correctly, a local server can be spun 55 | up with the following command: 56 | 57 | ```shell script 58 | ./docker/2-serve-locally.sh 59 | ``` 60 | 61 | You can now see the docs at `http://localhost:4567`. 62 | -------------------------------------------------------------------------------- /docker/config.rb: -------------------------------------------------------------------------------- 1 | # Unique header generation 2 | require './lib/unique_head.rb' 3 | 4 | # Markdown 5 | set :markdown_engine, :redcarpet 6 | set :markdown, 7 | fenced_code_blocks: true, 8 | smartypants: true, 9 | disable_indented_code_blocks: true, 10 | prettify: true, 11 | strikethrough: true, 12 | tables: true, 13 | with_toc_data: true, 14 | no_intra_emphasis: true, 15 | renderer: UniqueHeadCounter 16 | 17 | # Assets 18 | set :css_dir, 'stylesheets' 19 | set :js_dir, 'javascripts' 20 | set :images_dir, 'images' 21 | set :fonts_dir, 'fonts' 22 | 23 | # Activate the syntax highlighter 24 | activate :syntax 25 | ready do 26 | require './lib/monokai_sublime_slate.rb' 27 | require './lib/multilang.rb' 28 | end 29 | 30 | activate :sprockets 31 | 32 | activate :autoprefixer do |config| 33 | config.browsers = ['last 2 version', 'Firefox ESR'] 34 | config.cascade = false 35 | config.inline = true 36 | end 37 | 38 | # Github pages require relative links 39 | activate :relative_assets 40 | set :relative_links, true 41 | 42 | # Build Configuration 43 | configure :build do 44 | # We do want to hash woff and woff2 as there's a bug where woff2 will use 45 | # woff asset hash which breaks things. Trying to use a combination of ignore and 46 | # rewrite_ignore does not work as it conflicts weirdly with relative_assets. Disabling 47 | # the .woff2 extension only does not work as .woff will still activate it so have to 48 | # have both. See https://github.com/slatedocs/slate/issues/1171 for more details. 49 | activate :asset_hash, :exts => app.config[:asset_extensions] - %w[.woff .woff2] 50 | # If you're having trouble with Middleman hanging, commenting 51 | # out the following two lines has been known to help 52 | activate :minify_css 53 | activate :minify_javascript 54 | # activate :gzip 55 | end 56 | 57 | # Deploy Configuration 58 | # If you want Middleman to listen on a different port, you can set that below 59 | set :port, 4567 60 | 61 | set :build_dir, "build/all" 62 | set :index_file, "lnd.html" 63 | 64 | helpers do 65 | require './lib/toc_data.rb' 66 | end 67 | -------------------------------------------------------------------------------- /templates/grpc/lnd_javascript.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | const fs = require('fs'); 3 | const grpc = require('@grpc/grpc-js'); 4 | const protoLoader = require('@grpc/proto-loader'); 5 | const loaderOptions = { 6 | keepCase: true, 7 | longs: String, 8 | enums: String, 9 | defaults: true, 10 | oneofs: true 11 | }; 12 | {% if method.fileName == 'lightning.proto' %}const packageDefinition = protoLoader.loadSync('{{ method.fileName }}', loaderOptions);{% endif %}{% if method.fileName != 'lightning.proto' %}const packageDefinition = protoLoader.loadSync(['lightning.proto', '{{ method.fileName }}'], loaderOptions);{% endif %} 13 | const {{ method.packageName }} = grpc.loadPackageDefinition(packageDefinition).{{ method.packageName }}; 14 | const macaroon = fs.readFileSync("LND_DIR/data/chain/bitcoin/regtest/admin.macaroon").toString('hex'); 15 | process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA'; 16 | const lndCert = fs.readFileSync('LND_DIR/tls.cert'); 17 | const sslCreds = grpc.credentials.createSsl(lndCert);{% if method.service == 'WalletUnlocker' %} 18 | const {{ method.serviceJS }} = new {{ method.packageName }}.{{ method.service }}('localhost:{{ grpcport }}', sslCreds);{% else %} 19 | const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) { 20 | let metadata = new grpc.Metadata(); 21 | metadata.add('macaroon', macaroon); 22 | callback(null, metadata); 23 | }); 24 | let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds); 25 | let {{ method.serviceJS }} = new {{ method.packageName }}.{{ method.service }}('localhost:{{ grpcport }}', creds);{% endif %} 26 | let request = {% if method.requestMessage.params|length == 0 %}{};{% else %}{ {% for param in method.requestMessage.params %} 27 | {{ param.name }}: <{{ param.type }}>, {% endfor %} 28 | };{% endif %} {% if not method.streamingRequest and not method.streamingResponse %} 29 | {% include 'javascript/simple_rpc.html' %}{% elif not method.streamingRequest and method.streamingResponse %} 30 | {% include 'javascript/streaming_response.html' %}{% else %} 31 | {% include 'javascript/bidirectional.html' %}{% endif %} 32 | // Console output: 33 | // { {% for param in method.responseMessage.params %} 34 | // "{{ param.name }}": <{{ param.type }}>,{% endfor %} 35 | // } 36 | ``` 37 | -------------------------------------------------------------------------------- /templates/rest/lnd_javascript.md: -------------------------------------------------------------------------------- 1 | ```javascript 2 | const fs = require('fs'); 3 | const request = require('request');{% if endpoint.service != 'WalletUnlocker' %} 4 | const macaroon = fs.readFileSync('LND_DIR/data/chain/bitcoin/regtest/admin.macaroon').toString('hex');{% endif %}{% if endpoint.type == 'POST' %} 5 | let requestBody = { {% for param in endpoint.requestParams %} 6 | {{ param.name }}: <{{ param.type }}>,{% endfor %} 7 | }{% endif %} 8 | let options = { 9 | url: 'https://localhost:{{ restport }}{{ endpoint.path }}', 10 | // Work-around for self-signed certificates. 11 | rejectUnauthorized: false, 12 | json: true, {% if endpoint.service != 'WalletUnlocker' %} 13 | headers: { 14 | 'Grpc-Metadata-macaroon': macaroon, 15 | },{% endif %}{% if endpoint.type == 'POST' %} 16 | form: JSON.stringify(requestBody),{% endif %} 17 | } 18 | request.{{ endpoint.type|lower }}(options, function(error, response, body) { 19 | console.log(body); 20 | }); 21 | // Console output: 22 | // { {% for param in endpoint.responseParams %} 23 | // "{{ param.name }}": <{{ param.type }}>, {% endfor %} 24 | // }{% if endpoint.isStreaming and endpoint.wsEnabled %} 25 | 26 | 27 | 28 | // -------------------------- 29 | // Example with websockets: 30 | // -------------------------- 31 | const WebSocket = require('ws'); 32 | const fs = require('fs'); 33 | const macaroon = fs.readFileSync('LND_DIR/data/chain/bitcoin/regtest/admin.macaroon').toString('hex'); 34 | let ws = new WebSocket('wss://localhost:{{ restport }}{{ endpoint.path }}?method={{ endpoint.type }}', { 35 | // Work-around for self-signed certificates. 36 | rejectUnauthorized: false, 37 | headers: { 38 | 'Grpc-Metadata-Macaroon': macaroon, 39 | }, 40 | }); 41 | let requestBody = { {% for param in endpoint.requestParams %} 42 | {{ param.name }}: <{{ param.type }}>,{% endfor %} 43 | } 44 | ws.on('open', function() { 45 | ws.send(JSON.stringify(requestBody)); 46 | }); 47 | ws.on('error', function(err) { 48 | console.log('Error: ' + err); 49 | }); 50 | ws.on('message', function(body) { 51 | console.log(body); 52 | }); 53 | // Console output (repeated for every message in the stream): 54 | // { {% for param in endpoint.responseParams %} 55 | // "{{ param.name }}": <{{ param.type }}>, {% endfor %} 56 | // } 57 | 58 | {% endif %} 59 | ``` 60 | -------------------------------------------------------------------------------- /docker/install_proto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Abort on error (-e) and print commands (-v). 4 | set -ev 5 | 6 | # See README.md in lnrpc why we need these specific versions/commits. 7 | PROTOC_VERSION=3.4.0 8 | GENPROTO_VERSION="20e1ac93f88cf06d2b1defb90b9e9e126c7dfff6" 9 | GRPC_GATEWAY_VERSION="v1.14.3" 10 | DOC_GENERATOR_VERSION="v1.3.2" 11 | 12 | # This script is specific to Travis CI so we only need to support linux x64. 13 | PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" 14 | PROTOC_DL_CACHE_DIR="${DOWNLOAD_CACHE:-/tmp/download_cache}/protoc" 15 | 16 | # install_protoc copies the cached protoc binary to the $PATH or downloads it 17 | # if no cached version is found. 18 | install_protoc() { 19 | if [ -f "${PROTOC_DL_CACHE_DIR}/bin/protoc" ]; then 20 | echo "Using cached version of protoc" 21 | else 22 | wget -O /tmp/protoc.zip $PROTOC_URL 23 | mkdir -p "${PROTOC_DL_CACHE_DIR}" 24 | unzip -o /tmp/protoc.zip -d "${PROTOC_DL_CACHE_DIR}" 25 | chmod -R a+rx "${PROTOC_DL_CACHE_DIR}/" 26 | fi 27 | cp "${PROTOC_DL_CACHE_DIR}/bin/protoc" /usr/local/bin 28 | cp -r "${PROTOC_DL_CACHE_DIR}/include" /usr/local 29 | } 30 | 31 | # install_genproto downloads the Golang protobuf generator that converts the 32 | # .proto files into Go interface stubs. 33 | install_genproto() { 34 | local install_path="$GOPATH/src/google.golang.org/genproto" 35 | if [ ! -d "$install_path" ]; then 36 | git clone https://github.com/google/go-genproto "$install_path" 37 | fi 38 | pushd "$install_path" 39 | git reset --hard $GENPROTO_VERSION 40 | popd 41 | } 42 | 43 | # install_grpc_gateway downloads and installs the gRPC gateway that converts 44 | # .proto files into REST gateway code. 45 | install_grpc_gateway() { 46 | local install_path="$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway" 47 | if [ ! -d "$install_path" ]; then 48 | git clone https://github.com/grpc-ecosystem/grpc-gateway "$install_path" 49 | fi 50 | pushd "$install_path" 51 | git reset --hard $GRPC_GATEWAY_VERSION 52 | GO111MODULE=on go install ./protoc-gen-grpc-gateway ./protoc-gen-swagger 53 | popd 54 | } 55 | 56 | # install_doc_generator downloads and installs the protoc to markdown 57 | # generator. 58 | install_doc_generator() { 59 | local install_path="$GOPATH/src/github.com/pseudomuto/protoc-gen-doc" 60 | if [ ! -d "$install_path" ]; then 61 | git clone https://github.com/pseudomuto/protoc-gen-doc "$install_path" 62 | fi 63 | pushd "$install_path" 64 | git reset --hard $DOC_GENERATOR_VERSION 65 | GO111MODULE=on go install ./... 66 | popd 67 | } 68 | 69 | install_protoc 70 | install_genproto 71 | install_grpc_gateway 72 | install_doc_generator -------------------------------------------------------------------------------- /source/javascripts/app/_search.js: -------------------------------------------------------------------------------- 1 | //= require ../lib/_lunr 2 | //= require ../lib/_jquery 3 | //= require ../lib/_jquery.highlight 4 | ;(function () { 5 | 'use strict'; 6 | 7 | var content, searchResults; 8 | var highlightOpts = { element: 'span', className: 'search-highlight' }; 9 | var searchDelay = 0; 10 | var timeoutHandle = 0; 11 | 12 | var index = new lunr.Index(); 13 | 14 | index.ref('id'); 15 | index.field('title', { boost: 10 }); 16 | index.field('body'); 17 | index.pipeline.add(lunr.trimmer, lunr.stopWordFilter); 18 | 19 | $(populate); 20 | $(bind); 21 | 22 | function populate() { 23 | $('h1, h2').each(function() { 24 | var title = $(this); 25 | var body = title.nextUntil('h1, h2'); 26 | index.add({ 27 | id: title.prop('id'), 28 | title: title.text(), 29 | body: body.text() 30 | }); 31 | }); 32 | 33 | determineSearchDelay(); 34 | } 35 | function determineSearchDelay() { 36 | if(index.tokenStore.length>5000) { 37 | searchDelay = 300; 38 | } 39 | } 40 | 41 | function bind() { 42 | content = $('.content'); 43 | searchResults = $('.search-results'); 44 | 45 | $('#input-search').on('keyup',function(e) { 46 | var wait = function() { 47 | return function(executingFunction, waitTime){ 48 | clearTimeout(timeoutHandle); 49 | timeoutHandle = setTimeout(executingFunction, waitTime); 50 | }; 51 | }(); 52 | wait(function(){ 53 | search(e); 54 | }, searchDelay ); 55 | }); 56 | } 57 | 58 | function search(event) { 59 | 60 | var searchInput = $('#input-search')[0]; 61 | 62 | unhighlight(); 63 | searchResults.addClass('visible'); 64 | 65 | // ESC clears the field 66 | if (event.keyCode === 27) searchInput.value = ''; 67 | 68 | if (searchInput.value) { 69 | var results = index.search(searchInput.value).filter(function(r) { 70 | return r.score > 0.0001; 71 | }); 72 | 73 | if (results.length) { 74 | searchResults.empty(); 75 | $.each(results, function (index, result) { 76 | var elem = document.getElementById(result.ref); 77 | searchResults.append("
  • " + $(elem).text() + "
  • "); 78 | }); 79 | highlight.call(searchInput); 80 | } else { 81 | searchResults.html('
  • '); 82 | $('.search-results li').text('No Results Found for "' + searchInput.value + '"'); 83 | } 84 | } else { 85 | unhighlight(); 86 | searchResults.removeClass('visible'); 87 | } 88 | } 89 | 90 | function highlight() { 91 | if (this.value) content.highlight(this.value, highlightOpts); 92 | } 93 | 94 | function unhighlight() { 95 | content.unhighlight(highlightOpts); 96 | } 97 | })(); 98 | 99 | -------------------------------------------------------------------------------- /templates/lnd_rest.md: -------------------------------------------------------------------------------- 1 | # LND REST API Reference 2 | 3 | Welcome to the REST API reference documentation for LND, the Lightning Network 4 | Daemon. 5 | 6 | This site features the API documentation for Python and JavaScript, along with 7 | barebones examples using `curl`, for HTTP requests. It is intended for those who 8 | already understand how to work with LND. If this is your first time or you need 9 | a refresher, you may consider perusing our LND developer site featuring a 10 | tutorial, resources and guides at [dev.lightning.community](https://dev.lightning.community). 11 | 12 | The examples to the right assume that the there is a local `lnd` instance 13 | running and listening for REST connections on port {{ restport }}. `LND_DIR` will be used 14 | as a placeholder to denote the base directory of the `lnd` instance. By default, 15 | this is `~/.lnd` on Linux and `~/Library/Application Support/Lnd` on macOS. 16 | 17 | At the time of writing this documentation, two things are needed in order to 18 | make an HTTP request to an `lnd` instance: a TLS/SSL connection and a macaroon 19 | used for RPC authentication. The examples to the right will show how these can 20 | be used in order to make a successful, secure, and authenticated HTTP request. 21 | 22 | The original `*.swagger.js` files from which the gRPC documentation was generated 23 | can be found here: 24 | 25 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 26 | {% endfor %} 27 | 28 | **NOTE**: The `byte` field type must be set as the base64 encoded string 29 | representation of a raw byte array. Also, any time this must be used in a URL path 30 | (ie. `/v1/abc/xyz/{payment_hash}`) the base64 string must be encoded using a 31 | [URL and Filename Safe Alphabet](https://tools.ietf.org/html/rfc4648#section-5). This means you must replace `+` with `-`, 32 | `/` with `_`, and keep the trailing `=` as is. Url encoding (ie. `%2F`) will not work. 33 | 34 | 35 | This is the reference for the **REST API**. Alternatively, there is also a [gRPC 36 | API which is documented here](#lnd-grpc-api-reference). 37 | 38 | This documentation was 39 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 40 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 41 | 42 | {% for basePath, endpoints in endpoints.items() %} 43 | ## {{ basePath }} 44 | {% for endpoint in endpoints %} 45 | 46 | {% include 'rest/lnd_shell.md' %} 47 | {% include 'rest/lnd_python.md' %} 48 | {% include 'rest/lnd_javascript.md' %} 49 | 50 | {% include 'rest/request.md' %} 51 | {% include 'rest/response.md' %} 52 | 53 | {% endfor %} 54 | {% endfor %} 55 | 56 | # REST Messages 57 | {% for property in properties %} 58 | {% include 'rest/property.md' %} 59 | {% endfor %} 60 | 61 | # REST Enums 62 | {% for enum in enums %} 63 | {% include 'rest/enum.md' %} 64 | {% endfor %} 65 | -------------------------------------------------------------------------------- /source/fonts/slate.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /templates/faraday_rest.md: -------------------------------------------------------------------------------- 1 | # Faraday REST API Reference 2 | 3 | Welcome to the gRPC API reference documentation for Faraday. 4 | 5 | Faraday is an external service intended to be run in conjunction with the [lnd](https://github.com/lightningnetwork/lnd) 6 | implementation of the [Lightning Network](https://lightning.network). It queries LND for information about its existing 7 | channels and provides channel close recommendations if channels are under-performing. 8 | 9 | This site features the API documentation for shell script (CLI), Python and 10 | JavaScript clients in order to communicate with a local `faraday` instance through 11 | gRPC. 12 | 13 | The examples to the right assume that the there is a local `faraday` instance 14 | running and listening for REST connections on port {{ restport }}. `FARADAY_DIR` 15 | will be used as a placeholder to denote the base directory of the `faraday` 16 | instance. By default, this is `~/.faraday` on Linux and 17 | `~/Library/Application Support/Faraday` on macOS. 18 | 19 | At the time of writing this documentation, two things are needed in order to 20 | make an HTTP request to an `faraday` instance: a TLS/SSL connection and a 21 | macaroon used for RPC authentication. The examples to the right will show how 22 | these can be used in order to make a successful, secure, and authenticated HTTP 23 | request. 24 | 25 | The original `*.swagger.js` files from which the gRPC documentation was generated 26 | can be found here: 27 | 28 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 29 | {% endfor %} 30 | 31 | **NOTE**: The `byte` field type must be set as the base64 encoded string 32 | representation of a raw byte array. Also, any time this must be used in a URL path 33 | (ie. `/v1/abc/xyz/{payment_hash}`) the base64 string must be encoded using a 34 | [URL and Filename Safe Alphabet](https://tools.ietf.org/html/rfc4648#section-5). This means you must replace `+` with `-`, 35 | `/` with `_`, and keep the trailing `=` as is. Url encoding (ie. `%2F`) will not work. 36 | 37 | 38 | This is the reference for the **REST API**. Alternatively, there is also a [gRPC 39 | API which is documented here](#faraday-grpc-api-reference). 40 | 41 | This documentation was 42 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 43 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 44 | 45 | {% for basePath, endpoints in endpoints.items() %} 46 | ## {{ basePath }} 47 | {% for endpoint in endpoints %} 48 | 49 | {% include 'rest/other_shell.md' %} 50 | {% include 'rest/other_python.md' %} 51 | {% include 'rest/other_javascript.md' %} 52 | 53 | {% include 'rest/request.md' %} 54 | {% include 'rest/response.md' %} 55 | 56 | {% endfor %} 57 | {% endfor %} 58 | 59 | # REST Messages 60 | {% for property in properties %} 61 | {% include 'rest/property.md' %} 62 | {% endfor %} 63 | 64 | # REST Enums 65 | {% for enum in enums %} 66 | {% include 'rest/enum.md' %} 67 | {% endfor %} 68 | -------------------------------------------------------------------------------- /templates/faraday_grpc.md: -------------------------------------------------------------------------------- 1 | # Faraday gRPC API Reference 2 | 3 | Welcome to the gRPC API reference documentation for Faraday. 4 | 5 | Faraday is an external service intended to be run in conjunction with the [lnd](https://github.com/lightningnetwork/lnd) 6 | implementation of the [Lightning Network](https://lightning.network). It queries LND for information about its existing 7 | channels and provides channel close recommendations if channels are under-performing. 8 | 9 | This site features the documentation for `frcli` (CLI), and the API documentation 10 | for Python and JavaScript clients in order to communicate with a local `faraday` 11 | instance through gRPC. 12 | 13 | The examples to the right assume that the there is a local `faraday` instance 14 | running and listening for gRPC connections on port {{ grpcport }}. `FARADAY_DIR` 15 | will be used as a placeholder to denote the base directory of the `faraday` 16 | instance. By default, this is `~/.faraday` on Linux and 17 | `~/Library/Application Support/Faraday` on macOS. 18 | 19 | At the time of writing this documentation, two things are needed in order to 20 | make a gRPC request to a `faraday` instance: a TLS/SSL connection and a macaroon 21 | used for RPC authentication. The examples to the right will show how these can 22 | be used in order to make a successful, secure, and authenticated gRPC request. 23 | 24 | The original `*.proto` files from which the gRPC documentation was generated 25 | can be found here: 26 | 27 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 28 | {% endfor %} 29 | 30 | 31 | This is the reference for the **gRPC API**. Alternatively, there is also a [REST 32 | API which is documented here](#faraday-rest-api-reference). 33 | 34 | This documentation was 35 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 36 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 37 | 38 | {% for service in services %} 39 | # Service _{{ service.name }}_ 40 | 41 | {% for method in service_methods[service.name].methods %} 42 | ## {{ method.fullName }} 43 | 44 | {% if not method.streamingRequest and not method.streamingResponse %} 45 | #### Unary RPC 46 | {% elif not method.streamingRequest and method.streamingResponse %} 47 | #### Server-streaming RPC 48 | {% elif method.streamingRequest and not method.streamingResponse %} 49 | #### Client-streaming RPC 50 | {% elif method.streamingRequest and method.streamingResponse %} 51 | #### Bidirectional-streaming RPC 52 | {% endif %} 53 | 54 | {{ method.description }} 55 | 56 | {% include 'grpc/shell.md' %} 57 | {% include 'grpc/other_python.md' %} 58 | {% include 'grpc/other_javascript.md' %} 59 | 60 | {% include 'grpc/request.md' %} 61 | {% include 'grpc/response.md' %} 62 | {% endfor %} 63 | {% endfor %} 64 | 65 | # gRPC Messages 66 | {% for messageName, message in messages.items() %} 67 | {% include 'grpc/message.md' %} 68 | {% endfor %} 69 | 70 | # gRPC Enums 71 | {% for enum in enums %} 72 | {% include 'grpc/enum.md' %} 73 | {% endfor %} 74 | -------------------------------------------------------------------------------- /templates/taro_rest.md: -------------------------------------------------------------------------------- 1 | # Taro REST API Reference 2 | 3 | Welcome to the gRPC API reference documentation for Taro. 4 | 5 | The Taro Daemon `tarod` implements the [Taro 6 | protocol](https://github.com/Roasbeef/bips/blob/bip-taro/bip-taro.mediawiki) for 7 | issuing assets on the Bitcoin blockchain. Taro leverages Taproot transactions to 8 | commit to newly created assets and their transfers in an efficient and scalable 9 | manner. Multiple assets can be created and transferred in a single bitcoin UTXO, 10 | while witness data is transacted and kept off-chain. 11 | 12 | **Features**: 13 | 14 | - Mint assets 15 | - Send and receive assets 16 | - Export and import Taro proofs 17 | - Create and manage profiles 18 | 19 | This site features the API documentation for shell script (CLI), Python and 20 | JavaScript clients in order to communicate with a local `tarod` instance through 21 | gRPC. 22 | 23 | The examples to the right assume that the there is a local `tarod` instance 24 | running and listening for REST connections on port {{ restport }}. `TARO_DIR` 25 | will be used as a placeholder to denote the base directory of the `tarod` 26 | instance. By default, this is `~/.taro` on Linux and 27 | `~/Library/Application Support/Taro` on macOS. 28 | 29 | At the time of writing this documentation, two things are needed in order to 30 | make an HTTP request to an `tarod` instance: a TLS/SSL connection and a 31 | macaroon used for RPC authentication. The examples to the right will show how 32 | these can be used in order to make a successful, secure, and authenticated HTTP 33 | request. 34 | 35 | The original `*.swagger.js` files from which the gRPC documentation was generated 36 | can be found here: 37 | 38 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 39 | {% endfor %} 40 | 41 | **NOTE**: The `byte` field type must be set as the base64 encoded string 42 | representation of a raw byte array. Also, any time this must be used in a URL path 43 | (ie. `/v1/abc/xyz/{payment_hash}`) the base64 string must be encoded using a 44 | [URL and Filename Safe Alphabet](https://tools.ietf.org/html/rfc4648#section-5). This means you must replace `+` with `-`, 45 | `/` with `_`, and keep the trailing `=` as is. Url encoding (ie. `%2F`) will not work. 46 | 47 | 48 | This is the reference for the **REST API**. Alternatively, there is also a [gRPC 49 | API which is documented here](#taro-grpc-api-reference). 50 | 51 | This documentation was 52 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 53 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 54 | 55 | {% for basePath, endpoints in endpoints.items() %} 56 | ## {{ basePath }} 57 | {% for endpoint in endpoints %} 58 | 59 | {% include 'rest/other_shell.md' %} 60 | {% include 'rest/other_python.md' %} 61 | {% include 'rest/other_javascript.md' %} 62 | 63 | {% include 'rest/request.md' %} 64 | {% include 'rest/response.md' %} 65 | 66 | {% endfor %} 67 | {% endfor %} 68 | 69 | # REST Messages 70 | {% for property in properties %} 71 | {% include 'rest/property.md' %} 72 | {% endfor %} 73 | 74 | # REST Enums 75 | {% for enum in enums %} 76 | {% include 'rest/enum.md' %} 77 | {% endfor %} 78 | -------------------------------------------------------------------------------- /templates/taro_grpc.md: -------------------------------------------------------------------------------- 1 | # Taro gRPC API Reference 2 | 3 | Welcome to the gRPC API reference documentation for Taro. 4 | 5 | The Taro Daemon `tarod` implements the [Taro 6 | protocol](https://github.com/Roasbeef/bips/blob/bip-taro/bip-taro.mediawiki) for 7 | issuing assets on the Bitcoin blockchain. Taro leverages Taproot transactions to 8 | commit to newly created assets and their transfers in an efficient and scalable 9 | manner. Multiple assets can be created and transferred in a single bitcoin UTXO, 10 | while witness data is transacted and kept off-chain. 11 | 12 | **Features**: 13 | 14 | - Mint assets 15 | - Send and receive assets 16 | - Export and import Taro proofs 17 | - Create and manage profiles 18 | 19 | This site features the documentation for pool (CLI), and the API documentation 20 | for Python and JavaScript clients in order to communicate with a local `tarod` 21 | instance through gRPC. 22 | 23 | The examples to the right assume that the there is a local `tarod` instance 24 | running and listening for gRPC connections on port {{ grpcport }}. `TARO_DIR` 25 | will be used as a placeholder to denote the base directory of the `tarod` 26 | instance. By default, this is `~/.taro` on Linux and 27 | `~/Library/Application Support/Taro` on macOS. 28 | 29 | At the time of writing this documentation, two things are needed in order to 30 | make a gRPC request to a `tarod` instance: a TLS/SSL connection and a macaroon 31 | used for RPC authentication. The examples to the right will show how these can 32 | be used in order to make a successful, secure, and authenticated gRPC request. 33 | 34 | The original `*.proto` files from which the gRPC documentation was generated 35 | can be found here: 36 | 37 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 38 | {% endfor %} 39 | 40 | 41 | This is the reference for the **gRPC API**. Alternatively, there is also a [REST 42 | API which is documented here](#taro-rest-api-reference). 43 | 44 | This documentation was 45 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 46 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 47 | 48 | {% for service in services %} 49 | # Service _{{ service.name }}_ 50 | 51 | {% for method in service_methods[service.name].methods %} 52 | ## {{ method.fullName }} 53 | 54 | {% if not method.streamingRequest and not method.streamingResponse %} 55 | #### Unary RPC 56 | {% elif not method.streamingRequest and method.streamingResponse %} 57 | #### Server-streaming RPC 58 | {% elif method.streamingRequest and not method.streamingResponse %} 59 | #### Client-streaming RPC 60 | {% elif method.streamingRequest and method.streamingResponse %} 61 | #### Bidirectional-streaming RPC 62 | {% endif %} 63 | 64 | {{ method.description }} 65 | 66 | {% include 'grpc/shell.md' %} 67 | {% include 'grpc/other_python.md' %} 68 | {% include 'grpc/other_javascript.md' %} 69 | 70 | {% include 'grpc/request.md' %} 71 | {% include 'grpc/response.md' %} 72 | {% endfor %} 73 | {% endfor %} 74 | 75 | # gRPC Messages 76 | {% for messageName, message in messages.items() %} 77 | {% include 'grpc/message.md' %} 78 | {% endfor %} 79 | 80 | # gRPC Enums 81 | {% for enum in enums %} 82 | {% include 'grpc/enum.md' %} 83 | {% endfor %} 84 | -------------------------------------------------------------------------------- /source/stylesheets/print.css.scss: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | @import 'normalize'; 3 | @import 'variables'; 4 | @import 'icon-font'; 5 | 6 | /* 7 | Copyright 2008-2013 Concur Technologies, Inc. 8 | 9 | Licensed under the Apache License, Version 2.0 (the "License"); you may 10 | not use this file except in compliance with the License. You may obtain 11 | a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | License for the specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | $print-color: #999; 23 | $print-color-light: #ccc; 24 | $print-font-size: 12px; 25 | 26 | body { 27 | @extend %default-font; 28 | } 29 | 30 | .tocify, .toc-footer, .lang-selector, .search, #nav-button { 31 | display: none; 32 | } 33 | 34 | .tocify-wrapper>img { 35 | margin: 0 auto; 36 | display: block; 37 | } 38 | 39 | .content { 40 | font-size: 12px; 41 | 42 | pre, code { 43 | @extend %code-font; 44 | @extend %break-words; 45 | border: 1px solid $print-color; 46 | border-radius: 5px; 47 | font-size: 0.8em; 48 | } 49 | 50 | pre { 51 | code { 52 | border: 0; 53 | } 54 | } 55 | 56 | pre { 57 | padding: 1.3em; 58 | } 59 | 60 | code { 61 | padding: 0.2em; 62 | } 63 | 64 | table { 65 | border: 1px solid $print-color; 66 | tr { 67 | border-bottom: 1px solid $print-color; 68 | } 69 | td,th { 70 | padding: 0.7em; 71 | } 72 | } 73 | 74 | p { 75 | line-height: 1.5; 76 | } 77 | 78 | a { 79 | text-decoration: none; 80 | color: #000; 81 | } 82 | 83 | h1 { 84 | @extend %header-font; 85 | font-size: 2.5em; 86 | padding-top: 0.5em; 87 | padding-bottom: 0.5em; 88 | margin-top: 1em; 89 | margin-bottom: $h1-margin-bottom; 90 | border: 2px solid $print-color-light; 91 | border-width: 2px 0; 92 | text-align: center; 93 | } 94 | 95 | h2 { 96 | @extend %header-font; 97 | font-size: 1.8em; 98 | margin-top: 2em; 99 | border-top: 2px solid $print-color-light; 100 | padding-top: 0.8em; 101 | } 102 | 103 | h1+h2, h1+div+h2 { 104 | border-top: none; 105 | padding-top: 0; 106 | margin-top: 0; 107 | } 108 | 109 | h3, h4 { 110 | @extend %header-font; 111 | font-size: 0.8em; 112 | margin-top: 1.5em; 113 | margin-bottom: 0.8em; 114 | text-transform: uppercase; 115 | } 116 | 117 | h5, h6 { 118 | text-transform: uppercase; 119 | } 120 | 121 | aside { 122 | padding: 1em; 123 | border: 1px solid $print-color-light; 124 | border-radius: 5px; 125 | margin-top: 1.5em; 126 | margin-bottom: 1.5em; 127 | line-height: 1.6; 128 | } 129 | 130 | aside:before { 131 | vertical-align: middle; 132 | padding-right: 0.5em; 133 | font-size: 14px; 134 | } 135 | 136 | aside.notice:before { 137 | @extend %icon-info-sign; 138 | } 139 | 140 | aside.warning:before { 141 | @extend %icon-exclamation-sign; 142 | } 143 | 144 | aside.success:before { 145 | @extend %icon-ok-sign; 146 | } 147 | } -------------------------------------------------------------------------------- /templates/lnd_grpc.md: -------------------------------------------------------------------------------- 1 | # LND gRPC API Reference 2 | 3 | Welcome to the gRPC API reference documentation for LND, the Lightning Network 4 | Daemon. 5 | 6 | This site features the API documentation for lncli (CLI), [Python](https:///dev.lightning.community/guides/python-grpc/), 7 | and [JavaScript](https://dev.lightning.community/guides/javascript-grpc/) in 8 | order to communicate with a local `lnd` instance through gRPC. It is intended 9 | for those who already understand how to work with LND. If this is your first 10 | time or you need a refresher, you may consider perusing our LND developer site 11 | featuring a tutorial, resources and guides at [dev.lightning.community](https://dev.lightning.community). 12 | 13 | The examples to the right assume that the there is a local `lnd` instance 14 | running and listening for gRPC connections on port {{ grpcport }}. `LND_DIR` will be used 15 | as a placeholder to denote the base directory of the `lnd` instance. By default, 16 | this is `~/.lnd` on Linux and `~/Library/Application Support/Lnd` on macOS. 17 | 18 | At the time of writing this documentation, two things are needed in order to 19 | make a gRPC request to an `lnd` instance: a TLS/SSL connection and a macaroon 20 | used for RPC authentication. The examples to the right will show how these can 21 | be used in order to make a successful, secure, and authenticated gRPC request. 22 | 23 | The original `*.proto` files from which the gRPC documentation was generated 24 | can be found here: 25 | 26 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 27 | {% endfor %} 28 | 29 | 30 | This is the reference for the **gRPC API**. Alternatively, there is also a [REST 31 | API which is documented here](#lnd-rest-api-reference). 32 | 33 | This documentation was 34 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 35 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 36 | 37 | ## Experimental services 38 | 39 | The following RPCs/services are currently considered to be experimental. This means 40 | they are subject to change in the future. They also need to be enabled with a 41 | compile-time flag to be active (they are active in the official release binaries). 42 | 43 | {% for ex in experimental %}- [Service _{{ ex.service }}_](#service-{{ ex.service|lower }}) (file `{{ ex.file }}`) 44 | {% endfor %} 45 | 46 | {% for service in services %} 47 | # Service _{{ service.name }}_ 48 | 49 | {% for method in service_methods[service.name].methods %} 50 | ## {{ method.name }} 51 | 52 | {% if not method.streamingRequest and not method.streamingResponse %} 53 | #### Unary RPC 54 | {% elif not method.streamingRequest and method.streamingResponse %} 55 | #### Server-streaming RPC 56 | {% elif method.streamingRequest and not method.streamingResponse %} 57 | #### Client-streaming RPC 58 | {% elif method.streamingRequest and method.streamingResponse %} 59 | #### Bidirectional-streaming RPC 60 | {% endif %} 61 | 62 | {{ method.description }} 63 | 64 | {% include 'grpc/shell.md' %} 65 | {% include 'grpc/lnd_python.md' %} 66 | {% include 'grpc/lnd_javascript.md' %} 67 | 68 | {% include 'grpc/request.md' %} 69 | {% include 'grpc/response.md' %} 70 | {% endfor %} 71 | {% endfor %} 72 | 73 | # gRPC Messages 74 | {% for messageName, message in messages.items() %} 75 | {% include 'grpc/message.md' %} 76 | {% endfor %} 77 | 78 | # gRPC Enums 79 | {% for enum in enums %} 80 | {% include 'grpc/enum.md' %} 81 | {% endfor %} 82 | -------------------------------------------------------------------------------- /templates/loop_rest.md: -------------------------------------------------------------------------------- 1 | # Loop REST API Reference 2 | 3 | Welcome to the REST API reference documentation for Lightning Loop. 4 | 5 | Lightning Loop is a non-custodial service offered by Lightning Labs to bridge 6 | on-chain and off-chain Bitcoin using submarine swaps. This repository is home to 7 | the Loop client and depends on the Lightning Network daemon lnd. All of lnd’s 8 | supported chain backends are fully supported when using the Loop client: 9 | Neutrino, Bitcoin Core, and btcd. 10 | 11 | The service can be used in various situations: 12 | 13 | * Acquiring inbound channel liquidity from arbitrary nodes on the Lightning 14 | network 15 | * Depositing funds to a Bitcoin on-chain address without closing active 16 | channels 17 | * Paying to on-chain fallback addresses in the case of insufficient route 18 | liquidity 19 | * Refilling depleted channels with funds from cold-wallets or exchange 20 | withdrawals 21 | * Servicing off-chain Lightning withdrawals using on-chain payments, with no 22 | funds in channels required 23 | * As a failsafe payment method that can be used when channel liquidity along a 24 | route is insufficient 25 | 26 | This site features the API documentation for shell script (CLI), Python and 27 | JavaScript clients in order to communicate with a local `loopd` instance through 28 | gRPC. 29 | 30 | The examples to the right assume that the there is a local `loopd` instance 31 | running and listening for REST connections on port {{ restport }}. `LOOP_DIR` 32 | will be used as a placeholder to denote the base directory of the `loopd` 33 | instance. By default, this is `~/.loop` on Linux and 34 | `~/Library/Application Support/Loop` on macOS. 35 | 36 | At the time of writing this documentation, two things are needed in order to 37 | make an HTTP request to an `loopd` instance: a TLS/SSL connection and a 38 | macaroon used for RPC authentication. The examples to the right will show how 39 | these can be used in order to make a successful, secure, and authenticated HTTP 40 | request. 41 | 42 | The original `*.swagger.js` files from which the gRPC documentation was generated 43 | can be found here: 44 | 45 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 46 | {% endfor %} 47 | 48 | **NOTE**: The `byte` field type must be set as the base64 encoded string 49 | representation of a raw byte array. Also, any time this must be used in a URL path 50 | (ie. `/v1/abc/xyz/{payment_hash}`) the base64 string must be encoded using a 51 | [URL and Filename Safe Alphabet](https://tools.ietf.org/html/rfc4648#section-5). This means you must replace `+` with `-`, 52 | `/` with `_`, and keep the trailing `=` as is. Url encoding (ie. `%2F`) will not work. 53 | 54 | 55 | This is the reference for the **REST API**. Alternatively, there is also a [gRPC 56 | API which is documented here](#loop-grpc-api-reference). 57 | 58 | This documentation was 59 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 60 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 61 | 62 | {% for basePath, endpoints in endpoints.items() %} 63 | ## {{ basePath }} 64 | {% for endpoint in endpoints %} 65 | 66 | {% include 'rest/other_shell.md' %} 67 | {% include 'rest/other_python.md' %} 68 | {% include 'rest/other_javascript.md' %} 69 | 70 | {% include 'rest/request.md' %} 71 | {% include 'rest/response.md' %} 72 | 73 | {% endfor %} 74 | {% endfor %} 75 | 76 | # REST Messages 77 | {% for property in properties %} 78 | {% include 'rest/property.md' %} 79 | {% endfor %} 80 | 81 | # REST Enums 82 | {% for enum in enums %} 83 | {% include 'rest/enum.md' %} 84 | {% endfor %} 85 | -------------------------------------------------------------------------------- /source/stylesheets/_rtl.scss: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // RTL Styles Variables 3 | //////////////////////////////////////////////////////////////////////////////// 4 | 5 | $default: auto; 6 | 7 | //////////////////////////////////////////////////////////////////////////////// 8 | // TABLE OF CONTENTS 9 | //////////////////////////////////////////////////////////////////////////////// 10 | 11 | #toc>ul>li>a>span { 12 | float: left; 13 | } 14 | 15 | .toc-wrapper { 16 | transition: right 0.3s ease-in-out !important; 17 | left: $default !important; 18 | #{right}: 0; 19 | } 20 | 21 | .toc-h2 { 22 | padding-#{right}: $nav-padding + $nav-indent; 23 | } 24 | 25 | #nav-button { 26 | #{right}: 0; 27 | transition: right 0.3s ease-in-out; 28 | &.open { 29 | right: $nav-width 30 | } 31 | } 32 | 33 | //////////////////////////////////////////////////////////////////////////////// 34 | // PAGE LAYOUT AND CODE SAMPLE BACKGROUND 35 | //////////////////////////////////////////////////////////////////////////////// 36 | .page-wrapper { 37 | margin-#{left}: $default !important; 38 | margin-#{right}: $nav-width; 39 | .dark-box { 40 | #{right}: $default; 41 | #{left}: 0; 42 | } 43 | } 44 | 45 | .lang-selector { 46 | width: $default !important; 47 | a { 48 | float: right; 49 | } 50 | } 51 | 52 | //////////////////////////////////////////////////////////////////////////////// 53 | // CODE SAMPLE STYLES 54 | //////////////////////////////////////////////////////////////////////////////// 55 | .content { 56 | &>h1, 57 | &>h2, 58 | &>h3, 59 | &>h4, 60 | &>h5, 61 | &>h6, 62 | &>p, 63 | &>table, 64 | &>ul, 65 | &>ol, 66 | &>aside, 67 | &>dl { 68 | margin-#{left}: $examples-width; 69 | margin-#{right}: $default !important; 70 | } 71 | &>ul, 72 | &>ol { 73 | padding-#{right}: $main-padding + 15px; 74 | } 75 | table { 76 | th, 77 | td { 78 | text-align: right; 79 | } 80 | } 81 | dd { 82 | margin-#{right}: 15px; 83 | } 84 | aside { 85 | aside:before { 86 | padding-#{left}: 0.5em; 87 | } 88 | .search-highlight { 89 | background: linear-gradient(to top right, #F7E633 0%, #F1D32F 100%); 90 | } 91 | } 92 | pre, 93 | blockquote { 94 | float: left !important; 95 | clear: left !important; 96 | } 97 | } 98 | 99 | //////////////////////////////////////////////////////////////////////////////// 100 | // TYPOGRAPHY 101 | //////////////////////////////////////////////////////////////////////////////// 102 | h1, 103 | h2, 104 | h3, 105 | h4, 106 | h5, 107 | h6, 108 | p, 109 | aside { 110 | text-align: right; 111 | direction: rtl; 112 | } 113 | 114 | .toc-wrapper { 115 | text-align: right; 116 | direction: rtl; 117 | font-weight: 100 !important; 118 | } 119 | 120 | 121 | //////////////////////////////////////////////////////////////////////////////// 122 | // RESPONSIVE DESIGN 123 | //////////////////////////////////////////////////////////////////////////////// 124 | @media (max-width: $tablet-width) { 125 | .toc-wrapper { 126 | #{right}: -$nav-width; 127 | &.open { 128 | #{right}: 0; 129 | } 130 | } 131 | .page-wrapper { 132 | margin-#{right}: 0; 133 | } 134 | } 135 | 136 | @media (max-width: $phone-width) { 137 | %left-col { 138 | margin-#{left}: 0; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /templates/loop_grpc.md: -------------------------------------------------------------------------------- 1 | # Loop gRPC API Reference 2 | 3 | Welcome to the gRPC API reference documentation for Lightning Loop. 4 | 5 | Lightning Loop is a non-custodial service offered by Lightning Labs to bridge 6 | on-chain and off-chain Bitcoin using submarine swaps. This repository is home to 7 | the Loop client and depends on the Lightning Network daemon lnd. All of lnd’s 8 | supported chain backends are fully supported when using the Loop client: 9 | Neutrino, Bitcoin Core, and btcd. 10 | 11 | The service can be used in various situations: 12 | 13 | * Acquiring inbound channel liquidity from arbitrary nodes on the Lightning 14 | network 15 | * Depositing funds to a Bitcoin on-chain address without closing active 16 | channels 17 | * Paying to on-chain fallback addresses in the case of insufficient route 18 | liquidity 19 | * Refilling depleted channels with funds from cold-wallets or exchange 20 | withdrawals 21 | * Servicing off-chain Lightning withdrawals using on-chain payments, with no 22 | funds in channels required 23 | * As a failsafe payment method that can be used when channel liquidity along a 24 | route is insufficient 25 | 26 | This site features the documentation for loop (CLI), and the API documentation 27 | for Python and JavaScript clients in order to communicate with a local `loopd` 28 | instance through gRPC. 29 | 30 | The examples to the right assume that the there is a local `loopd` instance 31 | running and listening for gRPC connections on port {{ grpcport }}. `LOOP_DIR` 32 | will be used as a placeholder to denote the base directory of the `loopd` 33 | instance. By default, this is `~/.loop` on Linux and 34 | `~/Library/Application Support/Loop` on macOS. 35 | 36 | At the time of writing this documentation, two things are needed in order to 37 | make a gRPC request to a `loopd` instance: a TLS/SSL connection and a macaroon 38 | used for RPC authentication. The examples to the right will show how these can 39 | be used in order to make a successful, secure, and authenticated gRPC request. 40 | 41 | The original `*.proto` files from which the gRPC documentation was generated 42 | can be found here: 43 | 44 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 45 | {% endfor %} 46 | 47 | 48 | This is the reference for the **gRPC API**. Alternatively, there is also a [REST 49 | API which is documented here](#loop-rest-api-reference). 50 | 51 | This documentation was 52 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 53 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 54 | 55 | {% for service in services %} 56 | # Service _{{ service.name }}_ 57 | 58 | {% for method in service_methods[service.name].methods %} 59 | ## {{ method.fullName }} 60 | 61 | {% if not method.streamingRequest and not method.streamingResponse %} 62 | #### Unary RPC 63 | {% elif not method.streamingRequest and method.streamingResponse %} 64 | #### Server-streaming RPC 65 | {% elif method.streamingRequest and not method.streamingResponse %} 66 | #### Client-streaming RPC 67 | {% elif method.streamingRequest and method.streamingResponse %} 68 | #### Bidirectional-streaming RPC 69 | {% endif %} 70 | 71 | {{ method.description }} 72 | 73 | {% include 'grpc/shell.md' %} 74 | {% include 'grpc/other_python.md' %} 75 | {% include 'grpc/other_javascript.md' %} 76 | 77 | {% include 'grpc/request.md' %} 78 | {% include 'grpc/response.md' %} 79 | {% endfor %} 80 | {% endfor %} 81 | 82 | # gRPC Messages 83 | {% for messageName, message in messages.items() %} 84 | {% include 'grpc/message.md' %} 85 | {% endfor %} 86 | 87 | # gRPC Enums 88 | {% for enum in enums %} 89 | {% include 'grpc/enum.md' %} 90 | {% endfor %} 91 | -------------------------------------------------------------------------------- /templates/pool_rest.md: -------------------------------------------------------------------------------- 1 | # Pool REST API Reference 2 | 3 | Welcome to the REST API reference documentation for Lightning Pool. 4 | 5 | Lightning Pool is a non-custodial batched uniform clearing-price auction for 6 | Lightning Channel Lease (LCL). A LCL packages up inbound (or outbound!) channel 7 | liquidity (ability to send/receive funds) as a fixed incoming asset (earning 8 | interest over time) with a maturity date expressed in blocks. The maturity date 9 | of each of the channels is enforced by Bitcoin contracts, ensuring that the 10 | funds of the maker (the party that sold the channel) can't be swept until the 11 | maturity height. All cleared orders (purchased channels) are cleared in a 12 | single batched on-chain transaction. 13 | 14 | This repository is home to the Pool client and depends on the Lightning Network 15 | daemon lnd. All of lnd’s supported chain backends are fully supported when 16 | using the Pool client: Neutrino, Bitcoin Core, and btcd. 17 | 18 | The service can be used in various situations: 19 | 20 | * Bootstrapping new users with side car channels 21 | * Bootstrapping new services to Lightning 22 | * Demand fueled routing node channel selection 23 | * Allowing users to instantly receive with a wallet 24 | 25 | This site features the API documentation for shell script (CLI), Python and 26 | JavaScript clients in order to communicate with a local `poold` instance through 27 | gRPC. 28 | 29 | The examples to the right assume that the there is a local `poold` instance 30 | running and listening for REST connections on port {{ restport }}. `POOL_DIR` 31 | will be used as a placeholder to denote the base directory of the `poold` 32 | instance. By default, this is `~/.pool` on Linux and 33 | `~/Library/Application Support/Pool` on macOS. 34 | 35 | At the time of writing this documentation, two things are needed in order to 36 | make an HTTP request to an `poold` instance: a TLS/SSL connection and a 37 | macaroon used for RPC authentication. The examples to the right will show how 38 | these can be used in order to make a successful, secure, and authenticated HTTP 39 | request. 40 | 41 | The original `*.swagger.js` files from which the gRPC documentation was generated 42 | can be found here: 43 | 44 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 45 | {% endfor %} 46 | 47 | **NOTE**: The `byte` field type must be set as the base64 encoded string 48 | representation of a raw byte array. Also, any time this must be used in a URL path 49 | (ie. `/v1/abc/xyz/{payment_hash}`) the base64 string must be encoded using a 50 | [URL and Filename Safe Alphabet](https://tools.ietf.org/html/rfc4648#section-5). This means you must replace `+` with `-`, 51 | `/` with `_`, and keep the trailing `=` as is. Url encoding (ie. `%2F`) will not work. 52 | 53 | 54 | This is the reference for the **REST API**. Alternatively, there is also a [gRPC 55 | API which is documented here](#pool-grpc-api-reference). 56 | 57 | This documentation was 58 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 59 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 60 | 61 | {% for basePath, endpoints in endpoints.items() %} 62 | ## {{ basePath }} 63 | {% for endpoint in endpoints %} 64 | 65 | {% include 'rest/other_shell.md' %} 66 | {% include 'rest/other_python.md' %} 67 | {% include 'rest/other_javascript.md' %} 68 | 69 | {% include 'rest/request.md' %} 70 | {% include 'rest/response.md' %} 71 | 72 | {% endfor %} 73 | {% endfor %} 74 | 75 | # REST Messages 76 | {% for property in properties %} 77 | {% include 'rest/property.md' %} 78 | {% endfor %} 79 | 80 | # REST Enums 81 | {% for enum in enums %} 82 | {% include 'rest/enum.md' %} 83 | {% endfor %} 84 | -------------------------------------------------------------------------------- /templates/pool_grpc.md: -------------------------------------------------------------------------------- 1 | # Pool gRPC API Reference 2 | 3 | Welcome to the gRPC API reference documentation for Lightning Pool. 4 | 5 | Lightning Pool is a non-custodial batched uniform clearing-price auction for 6 | Lightning Channel Lease (LCL). A LCL packages up inbound (or outbound!) channel 7 | liquidity (ability to send/receive funds) as a fixed incoming asset (earning 8 | interest over time) with a maturity date expressed in blocks. The maturity date 9 | of each of the channels is enforced by Bitcoin contracts, ensuring that the 10 | funds of the maker (the party that sold the channel) can't be swept until the 11 | maturity height. All cleared orders (purchased channels) are cleared in a 12 | single batched on-chain transaction. 13 | 14 | This repository is home to the Pool client and depends on the Lightning Network 15 | daemon lnd. All of lnd’s supported chain backends are fully supported when 16 | using the Pool client: Neutrino, Bitcoin Core, and btcd. 17 | 18 | The service can be used in various situations: 19 | 20 | * Bootstrapping new users with side car channels 21 | * Bootstrapping new services to Lightning 22 | * Demand fueled routing node channel selection 23 | * Allowing users to instantly receive with a wallet 24 | 25 | This site features the documentation for pool (CLI), and the API documentation 26 | for Python and JavaScript clients in order to communicate with a local `poold` 27 | instance through gRPC. 28 | 29 | The examples to the right assume that the there is a local `poold` instance 30 | running and listening for gRPC connections on port {{ grpcport }}. `POOL_DIR` 31 | will be used as a placeholder to denote the base directory of the `poold` 32 | instance. By default, this is `~/.pool` on Linux and 33 | `~/Library/Application Support/Pool` on macOS. 34 | 35 | At the time of writing this documentation, two things are needed in order to 36 | make a gRPC request to a `pool` instance: a TLS/SSL connection and a macaroon 37 | used for RPC authentication. The examples to the right will show how these can 38 | be used in order to make a successful, secure, and authenticated gRPC request. 39 | 40 | The original `*.proto` files from which the gRPC documentation was generated 41 | can be found here: 42 | 43 | {% for file in files %}- [`{{ file }}`]({{ repoUrl }}/blob/{{ commit }}/{{ rpcdir }}/{{file}}) 44 | {% endfor %} 45 | 46 | 47 | This is the reference for the **gRPC API**. Alternatively, there is also a [REST 48 | API which is documented here](#pool-rest-api-reference). 49 | 50 | This documentation was 51 | [generated automatically](https://github.com/lightninglabs/lightning-api) against commit 52 | [`{{ commit }}`]({{ repoUrl }}/tree/{{ commit }}). 53 | 54 | {% for service in services %} 55 | # Service _{{ service.name }}_ 56 | 57 | {% for method in service_methods[service.name].methods %} 58 | ## {{ method.fullName }} 59 | 60 | {% if not method.streamingRequest and not method.streamingResponse %} 61 | #### Unary RPC 62 | {% elif not method.streamingRequest and method.streamingResponse %} 63 | #### Server-streaming RPC 64 | {% elif method.streamingRequest and not method.streamingResponse %} 65 | #### Client-streaming RPC 66 | {% elif method.streamingRequest and method.streamingResponse %} 67 | #### Bidirectional-streaming RPC 68 | {% endif %} 69 | 70 | {{ method.description }} 71 | 72 | {% include 'grpc/shell.md' %} 73 | {% include 'grpc/other_python.md' %} 74 | {% include 'grpc/other_javascript.md' %} 75 | 76 | {% include 'grpc/request.md' %} 77 | {% include 'grpc/response.md' %} 78 | {% endfor %} 79 | {% endfor %} 80 | 81 | # gRPC Messages 82 | {% for messageName, message in messages.items() %} 83 | {% include 'grpc/message.md' %} 84 | {% endfor %} 85 | 86 | # gRPC Enums 87 | {% for enum in enums %} 88 | {% include 'grpc/enum.md' %} 89 | {% endfor %} 90 | -------------------------------------------------------------------------------- /docker/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | activesupport (6.1.7.1) 5 | concurrent-ruby (~> 1.0, >= 1.0.2) 6 | i18n (>= 1.6, < 2) 7 | minitest (>= 5.1) 8 | tzinfo (~> 2.0) 9 | zeitwerk (~> 2.3) 10 | addressable (2.8.0) 11 | public_suffix (>= 2.0.2, < 5.0) 12 | autoprefixer-rails (10.2.5.0) 13 | execjs (< 2.8.0) 14 | backports (3.21.0) 15 | coffee-script (2.4.1) 16 | coffee-script-source 17 | execjs 18 | coffee-script-source (1.12.2) 19 | concurrent-ruby (1.1.10) 20 | contracts (0.13.0) 21 | dotenv (2.7.6) 22 | erubis (2.7.0) 23 | execjs (2.7.0) 24 | fast_blank (1.0.1) 25 | fastimage (2.2.5) 26 | ffi (1.15.4) 27 | haml (5.2.2) 28 | temple (>= 0.8.0) 29 | tilt 30 | hamster (3.0.0) 31 | concurrent-ruby (~> 1.0) 32 | hashie (3.6.0) 33 | i18n (1.6.0) 34 | concurrent-ruby (~> 1.0) 35 | kramdown (2.3.1) 36 | rexml 37 | listen (3.0.8) 38 | rb-fsevent (~> 0.9, >= 0.9.4) 39 | rb-inotify (~> 0.9, >= 0.9.7) 40 | memoist (0.16.2) 41 | middleman (4.4.2) 42 | coffee-script (~> 2.2) 43 | haml (>= 4.0.5) 44 | kramdown (>= 2.3.0) 45 | middleman-cli (= 4.4.2) 46 | middleman-core (= 4.4.2) 47 | middleman-autoprefixer (3.0.0) 48 | autoprefixer-rails (~> 10.0) 49 | middleman-core (>= 4.0.0) 50 | middleman-cli (4.4.2) 51 | thor (>= 0.17.0, < 2.0) 52 | middleman-core (4.4.2) 53 | activesupport (>= 6.1, < 7.0) 54 | addressable (~> 2.4) 55 | backports (~> 3.6) 56 | bundler (~> 2.0) 57 | contracts (~> 0.13.0) 58 | dotenv 59 | erubis 60 | execjs (~> 2.0) 61 | fast_blank 62 | fastimage (~> 2.0) 63 | hamster (~> 3.0) 64 | hashie (~> 3.4) 65 | i18n (~> 1.6.0) 66 | listen (~> 3.0.0) 67 | memoist (~> 0.14) 68 | padrino-helpers (~> 0.15.0) 69 | parallel 70 | rack (>= 1.4.5, < 3) 71 | sassc (~> 2.0) 72 | servolux 73 | tilt (~> 2.0.9) 74 | toml 75 | uglifier (~> 3.0) 76 | webrick 77 | middleman-sprockets (4.1.1) 78 | middleman-core (~> 4.0) 79 | sprockets (>= 3.0) 80 | middleman-syntax (3.2.0) 81 | middleman-core (>= 3.2) 82 | rouge (~> 3.2) 83 | mini_portile2 (2.8.0) 84 | minitest (5.17.0) 85 | nokogiri (1.13.10) 86 | mini_portile2 (~> 2.8.0) 87 | racc (~> 1.4) 88 | padrino-helpers (0.15.1) 89 | i18n (>= 0.6.7, < 2) 90 | padrino-support (= 0.15.1) 91 | tilt (>= 1.4.1, < 3) 92 | padrino-support (0.15.1) 93 | parallel (1.21.0) 94 | parslet (2.0.0) 95 | public_suffix (4.0.6) 96 | racc (1.6.1) 97 | rack (2.2.6.2) 98 | rb-fsevent (0.11.0) 99 | rb-inotify (0.10.1) 100 | ffi (~> 1.0) 101 | redcarpet (3.5.1) 102 | rexml (3.2.5) 103 | rouge (3.28.0) 104 | sass (3.7.4) 105 | sass-listen (~> 4.0.0) 106 | sass-listen (4.0.0) 107 | rb-fsevent (~> 0.9, >= 0.9.4) 108 | rb-inotify (~> 0.9, >= 0.9.7) 109 | sassc (2.4.0) 110 | ffi (~> 1.9) 111 | servolux (0.13.0) 112 | sprockets (3.7.2) 113 | concurrent-ruby (~> 1.0) 114 | rack (> 1, < 3) 115 | temple (0.8.2) 116 | thor (1.1.0) 117 | tilt (2.0.10) 118 | toml (0.3.0) 119 | parslet (>= 1.8.0, < 3.0.0) 120 | tzinfo (2.0.5) 121 | concurrent-ruby (~> 1.0) 122 | uglifier (3.2.0) 123 | execjs (>= 0.3.0, < 3) 124 | webrick (1.7.0) 125 | zeitwerk (2.6.6) 126 | 127 | PLATFORMS 128 | ruby 129 | 130 | DEPENDENCIES 131 | middleman (~> 4.4) 132 | middleman-autoprefixer (~> 3.0) 133 | middleman-sprockets (~> 4.1) 134 | middleman-syntax (~> 3.2) 135 | nokogiri (~> 1.13.10) 136 | redcarpet (~> 3.5.0) 137 | rouge (~> 3.21) 138 | sass 139 | webrick 140 | 141 | RUBY VERSION 142 | ruby 2.7.2p137 143 | 144 | BUNDLED WITH 145 | 2.2.22 -------------------------------------------------------------------------------- /docker/lib/monokai_sublime_slate.rb: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- # 2 | # frozen_string_literal: true 3 | 4 | # this is based on https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/monokai_sublime.rb 5 | # but without the added background, and changed styling for JSON keys to be soft_yellow instead of white 6 | 7 | module Rouge 8 | module Themes 9 | class MonokaiSublimeSlate < CSSTheme 10 | name 'monokai.sublime.slate' 11 | 12 | palette :black => '#000000' 13 | palette :bright_green => '#a6e22e' 14 | palette :bright_pink => '#f92672' 15 | palette :carmine => '#960050' 16 | palette :dark => '#49483e' 17 | palette :dark_grey => '#888888' 18 | palette :dark_red => '#aa0000' 19 | palette :dimgrey => '#75715e' 20 | palette :emperor => '#555555' 21 | palette :grey => '#999999' 22 | palette :light_grey => '#aaaaaa' 23 | palette :light_violet => '#ae81ff' 24 | palette :soft_cyan => '#66d9ef' 25 | palette :soft_yellow => '#e6db74' 26 | palette :very_dark => '#1e0010' 27 | palette :whitish => '#f8f8f2' 28 | palette :orange => '#f6aa11' 29 | palette :white => '#ffffff' 30 | 31 | style Generic::Heading, :fg => :grey 32 | style Literal::String::Regex, :fg => :orange 33 | style Generic::Output, :fg => :dark_grey 34 | style Generic::Prompt, :fg => :emperor 35 | style Generic::Strong, :bold => false 36 | style Generic::Subheading, :fg => :light_grey 37 | style Name::Builtin, :fg => :orange 38 | style Comment::Multiline, 39 | Comment::Preproc, 40 | Comment::Single, 41 | Comment::Special, 42 | Comment, :fg => :dimgrey 43 | style Error, 44 | Generic::Error, 45 | Generic::Traceback, :fg => :carmine 46 | style Generic::Deleted, 47 | Generic::Inserted, 48 | Generic::Emph, :fg => :dark 49 | style Keyword::Constant, 50 | Keyword::Declaration, 51 | Keyword::Reserved, 52 | Name::Constant, 53 | Keyword::Type, :fg => :soft_cyan 54 | style Literal::Number::Float, 55 | Literal::Number::Hex, 56 | Literal::Number::Integer::Long, 57 | Literal::Number::Integer, 58 | Literal::Number::Oct, 59 | Literal::Number, 60 | Literal::String::Char, 61 | Literal::String::Escape, 62 | Literal::String::Symbol, :fg => :light_violet 63 | style Literal::String::Doc, 64 | Literal::String::Double, 65 | Literal::String::Backtick, 66 | Literal::String::Heredoc, 67 | Literal::String::Interpol, 68 | Literal::String::Other, 69 | Literal::String::Single, 70 | Literal::String, :fg => :soft_yellow 71 | style Name::Attribute, 72 | Name::Class, 73 | Name::Decorator, 74 | Name::Exception, 75 | Name::Function, :fg => :bright_green 76 | style Name::Variable::Class, 77 | Name::Namespace, 78 | Name::Entity, 79 | Name::Builtin::Pseudo, 80 | Name::Variable::Global, 81 | Name::Variable::Instance, 82 | Name::Variable, 83 | Text::Whitespace, 84 | Text, 85 | Name, :fg => :white 86 | style Name::Label, :fg => :bright_pink 87 | style Operator::Word, 88 | Name::Tag, 89 | Keyword, 90 | Keyword::Namespace, 91 | Keyword::Pseudo, 92 | Operator, :fg => :bright_pink 93 | end 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /source/stylesheets/_variables.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2008-2013 Concur Technologies, Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | not use this file except in compliance with the License. You may obtain 6 | a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | License for the specific language governing permissions and limitations 14 | under the License. 15 | */ 16 | 17 | 18 | //////////////////////////////////////////////////////////////////////////////// 19 | // CUSTOMIZE SLATE 20 | //////////////////////////////////////////////////////////////////////////////// 21 | // Use these settings to help adjust the appearance of Slate 22 | 23 | 24 | // BACKGROUND COLORS 25 | //////////////////// 26 | $nav-bg: #2E3336 !default; 27 | $examples-bg: #2E3336 !default; 28 | $code-bg: #1E2224 !default; 29 | $code-annotation-bg: #191D1F !default; 30 | $nav-subitem-bg: #1E2224 !default; 31 | $nav-active-bg: #0F75D4 !default; 32 | $nav-active-parent-bg: #1E2224 !default; // parent links of the current section 33 | $lang-select-border: #000 !default; 34 | $lang-select-bg: #1E2224 !default; 35 | $lang-select-active-bg: $examples-bg !default; // feel free to change this to blue or something 36 | $lang-select-pressed-bg: #111 !default; // color of language tab bg when mouse is pressed 37 | $main-bg: #F3F7F9 !default; 38 | $aside-notice-bg: #8fbcd4 !default; 39 | $aside-warning-bg: #c97a7e !default; 40 | $aside-success-bg: #6ac174 !default; 41 | $search-notice-bg: #c97a7e !default; 42 | 43 | 44 | // TEXT COLORS 45 | //////////////////// 46 | $main-text: #333 !default; // main content text color 47 | $nav-text: #fff !default; 48 | $nav-active-text: #fff !default; 49 | $nav-active-parent-text: #fff !default; // parent links of the current section 50 | $lang-select-text: #fff !default; // color of unselected language tab text 51 | $lang-select-active-text: #fff !default; // color of selected language tab text 52 | $lang-select-pressed-text: #fff !default; // color of language tab text when mouse is pressed 53 | 54 | 55 | // SIZES 56 | //////////////////// 57 | $nav-width: 230px !default; // width of the navbar 58 | $examples-width: 50% !default; // portion of the screen taken up by code examples 59 | $logo-margin: 0px !default; // margin below logo 60 | $main-padding: 28px !default; // padding to left and right of content & examples 61 | $nav-padding: 15px !default; // padding to left and right of navbar 62 | $nav-v-padding: 10px !default; // padding used vertically around search boxes and results 63 | $nav-indent: 10px !default; // extra padding for ToC subitems 64 | $code-annotation-padding: 13px !default; // padding inside code annotations 65 | $h1-margin-bottom: 21px !default; // padding under the largest header tags 66 | $tablet-width: 930px !default; // min width before reverting to tablet size 67 | $phone-width: $tablet-width - $nav-width !default; // min width before reverting to mobile size 68 | 69 | 70 | // FONTS 71 | //////////////////// 72 | %default-font { 73 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 74 | font-size: 14px; 75 | } 76 | 77 | %header-font { 78 | @extend %default-font; 79 | font-weight: bold; 80 | } 81 | 82 | %code-font { 83 | font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, serif; 84 | font-size: 12px; 85 | line-height: 1.5; 86 | } 87 | 88 | 89 | // OTHER 90 | //////////////////// 91 | $nav-footer-border-color: #666 !default; 92 | $search-box-border-color: #666 !default; 93 | 94 | 95 | //////////////////////////////////////////////////////////////////////////////// 96 | // INTERNAL 97 | //////////////////////////////////////////////////////////////////////////////// 98 | // These settings are probably best left alone. 99 | 100 | %break-words { 101 | word-break: break-all; 102 | hyphens: auto; 103 | } 104 | -------------------------------------------------------------------------------- /source/javascripts/app/_toc.js: -------------------------------------------------------------------------------- 1 | //= require ../lib/_jquery 2 | //= require ../lib/_imagesloaded.min 3 | ;(function () { 4 | 'use strict'; 5 | 6 | var htmlPattern = /<[^>]*>/g; 7 | var loaded = false; 8 | 9 | var debounce = function(func, waitTime) { 10 | var timeout = false; 11 | return function() { 12 | if (timeout === false) { 13 | setTimeout(function() { 14 | func(); 15 | timeout = false; 16 | }, waitTime); 17 | timeout = true; 18 | } 19 | }; 20 | }; 21 | 22 | var closeToc = function() { 23 | $(".toc-wrapper").removeClass('open'); 24 | $("#nav-button").removeClass('open'); 25 | }; 26 | 27 | function loadToc($toc, tocLinkSelector, tocListSelector, scrollOffset) { 28 | var headerHeights = {}; 29 | var pageHeight = 0; 30 | var windowHeight = 0; 31 | var originalTitle = document.title; 32 | 33 | var recacheHeights = function() { 34 | headerHeights = {}; 35 | pageHeight = $(document).height(); 36 | windowHeight = $(window).height(); 37 | 38 | $toc.find(tocLinkSelector).each(function() { 39 | var targetId = $(this).attr('href'); 40 | if (targetId[0] === "#") { 41 | headerHeights[targetId] = $(targetId).offset().top; 42 | } 43 | }); 44 | }; 45 | 46 | var refreshToc = function() { 47 | var currentTop = $(document).scrollTop() + scrollOffset; 48 | 49 | if (currentTop + windowHeight >= pageHeight) { 50 | // at bottom of page, so just select last header by making currentTop very large 51 | // this fixes the problem where the last header won't ever show as active if its content 52 | // is shorter than the window height 53 | currentTop = pageHeight + 1000; 54 | } 55 | 56 | var best = null; 57 | for (var name in headerHeights) { 58 | if ((headerHeights[name] < currentTop && headerHeights[name] > headerHeights[best]) || best === null) { 59 | best = name; 60 | } 61 | } 62 | 63 | // Catch the initial load case 64 | if (currentTop == scrollOffset && !loaded) { 65 | best = window.location.hash; 66 | loaded = true; 67 | } 68 | 69 | var $best = $toc.find("[href='" + best + "']").first(); 70 | if (!$best.hasClass("active")) { 71 | // .active is applied to the ToC link we're currently on, and its parent