lightninglabs / lightning-api Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
Using: https://api.lightning.community/rest/index.html
returning XML error. No problems accessing GRPC documentation.
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
}
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
(I'm sorry, too busy, didn't have time to check dev
branch)
The definitions section is empty on the REST API docs currently online: https://api.lightning.community/rest/index.html#definitions. This breaks a lot of links to types, making it a lot tougher to know what to pass / what you get back from endpoints.
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?
I can't seem to find it..
(First mentioned in: https://github.com/lightningnetwork/lnd/issues/2180)
the response of openChannel and openChannelSync is not as described.
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
print "opening channel with bob:"
response = stub.OpenChannelSync(request, metadata=[('macaroon'), macaroon)])
print "response:",response
opening channel with bob:
response: {
"funding_txid_bytes": <bytes>,
"funding_txid_str": <string>,
"output_index": <uint32>,
}
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)])
To reproduce:
Removing "routerrpc-" from the query string works: https://api.lightning.community/#resolveholdforwardaction but it references an entry under "gRPC Enums".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.