Closed LNBIG-COM closed 4 years ago
This is awesome! I've been wanting to do this cleanup for a while, so huge thanks for making a huge improvement to this library!
I'll give it a code review and will hopefully have this in a new release shortly.
Awesome work! New release incoming.
Hello!
Here is big update of
lnd-async
I tested it in my projects - everything works as previous version but here many improvements:
Now the
lnd-async
has all proto files of LND. The LND has many sub-servers (now there 8 sub-servers - https://github.com/lightningnetwork/lnd/releases/tag/v0.6-beta -> Sub-Servers) and each sub-server has own API. Before your module had only therpc.proto
file and onlylnrpc
package was supported. Now it has all current proto files and full supporting of API methods of all sub-servers!Now this repository has scripts (Unix) for developer to copy all lnd proto files from lnd's repository to your directories (with directory struct keeping) and remaking from theirs full structure streamed and callback methods (nodejs files). So if a new lnd server released - there only
./util-scripts/run-all.sh /where/root/of/lnd-repository
and voila! You have new supported API!Now there no need to comment
import "google..."
lines - i addedprotobufjs
dependency (it already was as dependency for@grpc/proto-loader
so package will not add more dependencies) which has these proto files for same goals (https://github.com/protobufjs/protobuf.js/blob/master/google/README.md)lnrpc
package methods can be called as before, example:client.sendToRoute({})
but any methods of lnrpc and other packages can be called now asclient.ServiceName.thisCamelCaseStyleToo()
For example:
Because some methods have the same names in other services this prompted me to implement this method of calling
I separated a loading of proto files and a creation of service objects for each client. And added a cache. So now proto files are loaded only once and client stubs are created from ready-loaded package definition. The acceleration is very noticeable when connections to many nodes are created asynchronously, like mine.