Giter Club home page Giter Club logo

lightning-api's Issues

Fix API Documentation typos

(First mentioned in: https://github.com/lightningnetwork/lnd/issues/2180)

Background

the response of openChannel and openChannelSync is not as described.

environment

lnd version 0.5.0-beta commit=a3edcf9cd537ea37a502efc91d262e7017a99e6b
Linux 4.15.0-38-generic #41-Ubuntu 2018 x86_64 x86_64 x86_64 GNU/Linux
btcd version 0.12.0-beta

Steps to reproduce

print "opening channel with bob:"
response = stub.OpenChannelSync(request, metadata=[('macaroon'), macaroon)])
print "response:",response

Expected behaviour

opening channel with bob:
response: { 
    "funding_txid_bytes": <bytes>,
    "funding_txid_str": <string>,
    "output_index": <uint32>,
}

Actual behaviour

opening channel with bob:
response: funding_txid_bytes: "\366\312\323\014\245d\232\313\013\004\001P\245\341<\002\216\017I\203\214j>ub\364~\255\301e\2275"

In fact, only funding_txid_bytes or funding_txid_str can be set at once (set as a oneof as mentioned by roasbeef), and output_index is not set unless different from 0. This should be mentioned in the documentation.

Additionally, there are multiple typos regarding the (recurring) line:

>>> response = stub.NewAddress(request, metadata=[('macaroon'), macaroon)])

There are always mismatching parenthesis when mentioning metadata[...]. This happens accross the documentation. Not a big issue but still one. Should be changed to:

metadata=[('macaroon', macaroon)])

Feature: make it clear which fields are required, which fields are optional, which are alternative.

  • Some fields are required.
  • Some fields are optional.
  • Some fields are alternative, for example, if the whole invoice is specified, other fields are duplicate, confusing, alternative.
var requestBody = { 
  payment_request: "lnbc100n1.........",
};

I tried making sense what * or / mean but it’s unclear which is which.

https://api.lightning.community/rest/?javascript#v1-invoices

image

(I'm sorry, too busy, didn't have time to check dev branch)

Question: python render.py crashes

ruby 2.4.2
firefox 56 (linux)

python render.py crashes because rpc.json that I have is different from what render.py expects.

Traceback (most recent call last):
  File "render.py", line 393, in <module>
    render()
  File "render.py", line 352, in render
    rpc_methods = json_proto_to_rpc_dict()
  File "render.py", line 129, in json_proto_to_rpc_dict
    file_services = data[0]['file_services']
KeyError: 0

By changing the keys in render.py, I was able to regenerate the document.

Should I create a pull request?

Question: What is the encoding for ```custom_records``` returned by the invoices endpoint?

I'm trying to read the results of this call in python running on an Umbrel formatted Pi4

https://api.lightning.community/?python#v1-invoices

Without problem I'm decoding the output from running lncli and I can read the custom_records which just contain the URL and other details of the particular podcast which a key_send payment is linked to.

When I look at the response from the API, however, I can't figure out how to decode it and I get errors with all the usual methods. It looks like base64 but the specifics of getting it decoded have eluded me with errors like

Exception has occurred: UnicodeDecodeError
'utf-8' codec can't decode byte 0xd0 in position 1: invalid continuation byte

API:

        "custom_records": {
          "7629169": "eyJhY3Rpb24iOiJzdHJlYW0iLCJhcHBfbmFtZSI6IlBvZGZyaWVuZCIsInBvZGNhc3QiOiJCcmlhbm9mTG9uZG9uJ3MgRVhQRVJJTUVOVEFMIEZPUkVTVCBDSEFUUyIsInVybCI6Imh0dHBzOlwvXC93d3cuYnJpYW5vZmxvbmRvbi5tZVwvcG9kY2FzdDJcL2JyaWFucy1mb3Jlc3QtdGFsa3MtZXhwLnhtbCIsIml0ZW1JRCI6MjIwMTc1NTY3MywiZXBpc29kZV9ndWlkIjoiaHR0cHM6XC9cL2JyaWFub2Zsb25kb24ubWVcLz9wPTE5MjIiLCJ0cyI6NDE1fQ==",
          "5482373484": "eyGoxbL8wTHgbSFr6TqJzs/ukj1ZWyM8UUmRx9iImBA="
        },

CLI:

        "custom_records": {
          "7629169": "7b22616374696f6e223a2273747265616d222c226170705f6e616d65223a22506f64667269656e64222c22706f6463617374223a22427269616e6f664c6f6e646f6e2773204558504552494d454e54414c20464f52455354204348415453222c2275726c223a2268747470733a5c2f5c2f7777772e627269616e6f666c6f6e646f6e2e6d655c2f706f6463617374325c2f627269616e732d666f726573742d74616c6b732d6578702e786d6c222c226974656d4944223a323230313735353637332c22657069736f64655f67756964223a2268747470733a5c2f5c2f627269616e6f666c6f6e646f6e2e6d655c2f3f703d31393232222c227473223a3431357d",
          "5482373484": "7b21a8c5b2fcc131e06d216be93a89cecfee923d595b233c514991c7d8889810"
        },

And it should decode to this:

{
  "action": "stream",
  "app_name": "Podfriend",
  "podcast": "BrianofLondon's EXPERIMENTAL FOREST CHATS",
  "url": "https://www.brianoflondon.me/podcast2/brians-forest-talks-exp.xml",
  "itemID": 2201755673,
  "episode_guid": "https://brianoflondon.me/?p=1922",
  "ts": 235
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.