joule-extension
joule-extension copied to clipboard
Switch to gRPC API
The HTTP REST API has too many issues, swap out the library with a .proto
-typed gRPC implementation.
Another option here is utilizing gRPC web. You'd get identical interaction as you would using node, but callable in the browser, as it works around the requirements of trailing http/2 headers that regular grpc has.
Thanks for dropping in @Roasbeef! I did look at grpc-web
, but I'm hesitant to use it due to the need for a proxy server. It's already enough of a pain for users to setup lnd, I'd had to ask them to have to setup Envoy as well. While it could be an optional sort of thing, I'd then be stuck supporting both HTTP and gRPC libs, which sounds like a testing nightmare.
I think at the moment, I'm going to keep this on hold until the tech matures a little more. But if you think it's easier than I'm making it out to be, let me know.
Hey there, nice work! I would suggest getting in touch with https://github.com/alexbosworth/ln-service which also use grpc with lnd and plan to integrate with c-lightning.
I've had the good fortune of being able to talk to Alex this week. While I really like the look of his API, I want to make the onboarding process for the extension as easy as possible, and would hate to ask users to have to setup yet another server on the machine they're hosting the node on. Going to try to limit myself to what LND (and C-Lightning, in the future) come with out-of-the-box.
The proxy server would be on the lnd
end and could possibly be hidden behind a build flag, or regular command line flag. I don't think a finalized Go implementation in the main gRPC lib has landed yet though, so we'd likely hold off on adding something until it stabilized a bit more.
What are the major issues you had with the REST interface btw? We've updated the set of API docs for the REST interface to better indicate what's a string, and what's an int32, etc.
Awesome, I look forward to seeing the proxy server make it into master.
Great to hear about the improved docs. Been opening issues on the problems I've found with the HTTP rest API, the only majour outstanding ones I have right now are missing sign & verify and dropping falsy values. The latter I can get around by adding in defaults where I know they might get dropped, but the former I obviously can't work around. Haven't had any issues outside of that though,
As an aside, I planned on splitting out lnd-http
into its own Node module. You don't happen to know of any other implementations of REST API libraries, do you? Maybe I'd be better off contributing to one of those.