{"id":19085032,"url":"https://github.com/dart-lightning/lndart.cln_grpc","last_synced_at":"2025-08-09T23:33:01.454Z","repository":{"id":37078992,"uuid":"487126912","full_name":"dart-lightning/lndart.cln_grpc","owner":"dart-lightning","description":"An experimental GRPC interface for core lightning written in dart","archived":false,"fork":false,"pushed_at":"2022-08-13T00:49:53.000Z","size":223,"stargazers_count":3,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T09:55:15.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dart-lightning.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-29T22:35:54.000Z","updated_at":"2024-12-25T00:08:00.000Z","dependencies_parsed_at":"2022-07-09T18:01:01.829Z","dependency_job_id":null,"html_url":"https://github.com/dart-lightning/lndart.cln_grpc","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dart-lightning/lndart.cln_grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dart-lightning%2Flndart.cln_grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dart-lightning%2Flndart.cln_grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dart-lightning%2Flndart.cln_grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dart-lightning%2Flndart.cln_grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dart-lightning","download_url":"https://codeload.github.com/dart-lightning/lndart.cln_grpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dart-lightning%2Flndart.cln_grpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269653714,"owners_count":24454315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T02:53:36.296Z","updated_at":"2025-08-09T23:33:01.350Z","avatar_url":"https://github.com/dart-lightning.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003elndart.cln_grpc\u003c/h1\u003e\n\n  \u003cimg src=\"https://github.com/dart-lightning/icons/raw/main/main/res/mipmap-xxxhdpi/ic_launcher.png\" /\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003e :dart: Dart GRPC client for core lightning :dart: \u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n   \u003cimg alt=\"GitHub Workflow Status\" src=\"https://img.shields.io/github/workflow/status/dart-lightning/lndart.cln_grpc/cln_grpc%20dart%20code%20sanity%20check?style=flat-square\"\u003e\n  \u003c/p\u003e\n\n  \u003ch4\u003e\n    \u003ca href=\"https://github.com/dart-lightning\"\u003eProject Homepage\u003c/a\u003e\n  \u003c/h4\u003e\n\u003c/div\u003e\n\n## Table of Content\n\n- Introduction\n- How to Use\n- How Contribute\n- License\n\n## Introduction\n\nA dart library which facilitates dart GRPC client for core lightning \n\n## Why cln_grpc?\n\ncln_grpc library is a GRPC wrapper with a generic interface which facilitates easy interaction with core lightning for dart and flutter. It can be used to direclty access core lightning node and to perform some operations on it such as calling rpc method supported by the GRPC interface.  \n\n\n## How to Use\n### How to connect to core lightning using cln_grpc\n\nTo connect to a grpc server we need port of server, host and server credentials\n\nHere in this library the only required parameter is path to certificates for authentification, and also provides some optional parameters such as \n\n- host(\"localhost\" by default): Where the server is running, this need to match what is declared inside the tls certificate\n- port(8001 by default): where the grpc server is running, specified as `grpc-port` in the core lightning option\n- authority(\"localhost\" by default)\n- channelcredentials: Options controlling TLS security settings on a ClientChannel.\n\n\nTo initiate the client and make a connection with the server we declare client like this:\n```dart\nvar client = GRPCClient(rootPath: \"\u003cpath_to_certificates\u003e\");\n```\n### How to call a method:\nThere are several ways to call a method \n1. call getinfo with a parse function\n```dart\n  var response = await client.getinfo(onDecode: (Map\u003cString, dynamc\u003e json) =\u003e json);\n  print('Response from server\\n$response');\n```\n2. generic call \u003cT, R\u003e with a parse function\n\nHere we need to serialize the request method in order to encode it from json to map\n```dart\nclass ListTransactionProxy extends Serializable {\n  ListtransactionsRequest proxy;\n\n  ListTransactionProxy(this.proxy);\n\n  factory ListTransactionProxy.build() =\u003e\n      ListTransactionProxy(ListtransactionsRequest());\n\n  @override\n  Map\u003cString, dynamic\u003e toJSON() =\u003e proxy.toProto3Json() as Map\u003cString, dynamic\u003e;\n\n  @override\n  T as\u003cT\u003e() =\u003e proxy as T;\n}\n```\nafter serializing the request we call the generic \"call\" method and provide some requires parameters as below\n```dart\n  var transactionList =\n      await client.call\u003cListTransactionProxy, ListtransactionsResponse\u003e(\n          method: \"listtransactions\", params: ListTransactionProxy.build());\n  print(\"Transactions of node\");\n  print(transactionList.transactions);\n```\n\n3. Direct acces to stub incase a method is not found implemented(skip the library architecture)\n```dart\n  var forwardsList=await client.stub.listForwards(ListforwardsRequest());\n  print(\"forwards of node\");\n  print(forwardsList.forwards);\n```\n### Close client connection:\nShutting down the grpc client connection is really easy calling the close method like this:\n```dart\n  client.close();\n```\n\n## How Contribute\n\n### Build system\n\nYou can use the make file to make sure that your code can pass the sanity code check of the CI:\n\nThe make file contains the following target:\n\n- `make`: formatting, analyze and compile the code;\n- `make fmt`: formatting and analyze the code;\n- `make check`: run the unit test (if any)\n\nRead out [Hacking guide](#TODO) to find and learn on how we manage the change request (Pull request) workflow.\n\n### Generation Code\n\nIn order to update the code client from the new proto file generated by core lightning, we need to copy the new file in the proton we need to generate some dart files from the protos, and use the following commands to update the dart code:\n\nRequirements:\n- Upgrade protobuf version equal or above [release 3.15.](https://github.com/protocolbuffers/protobuf/releases/tag/v3.15.0)\n- Add `protoc-gen-dart` in your path.\n- Or else use this command `protoc --dart_out=grpc:./lib/src/ --plugin=protoc-gen-dart=$HOME/.pub-cache/bin/protoc-gen-dart ./protos/primitives.proto ./protos/node.proto` with plugin flag to generate the `.pb.dart` files.\n\n\nHere are the steps to generate `.pb.dart` files:\n- Be on the root of the project.\n- Run this command `make gen` to generate the `.pb.dart` files for both `/primitives.proto` and `/node.proto`.\n- Rename `./lib/src/protos` to `./lib/src/generated`.\n\n## License\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://opensource.org/files/osi_keyhole_300X300_90ppi_0.png\" width=\"150\" height=\"150\"/\u003e\n\u003c/div\u003e\n\n```\nCopyright 2022 Vincenzo Palazzo \u003cvincenzopalazzodev@gmail.com\u003e. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above\n      copyright notice, this list of conditions and the following\n      disclaimer in the documentation and/or other materials provided\n      with the distribution.\n    * Neither the name of Google Inc. nor the names of its\n      contributors may be used to endorse or promote products derived\n      from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdart-lightning%2Flndart.cln_grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdart-lightning%2Flndart.cln_grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdart-lightning%2Flndart.cln_grpc/lists"}