Skip to content

Commit

Permalink
docs: completed docs description and changelog configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo authored and swaptr committed Jul 16, 2022
1 parent 22e40ed commit 4c74796
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 92 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
- License

## Packages
The repository is managed as monorepo, and it contains the following packages:

This dart monorepo houses the following packages to develop fast and maintainable applications for interacting with core lightning.

| Package | Description | Version |
|----------------|-----------------------------------------------------------------|------------|
| cln_common | A package that provides common interface for the monorepo. | unreleased |
| clightning_rpc | A RPC wrapper around the core lightning API. | unreleased |
| cln_plugin | A library to write extensible plugin in dart for core lightning. | unreleased |
| [cln_common](packages/cln_common) | A package that provides common interface for the monorepo. | unreleased |
| [clightning_rpc](packages/rpc) | A RPC wrapper around the core lightning API. | ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/clightning_rpc?include_prereleases&style=flat-square) |
| [cln_plugin](packages/cln_plugin) | A library to write extensible plugin in dart for core lightning. | unreleased |

## How to contribute

Read our [Hacking guide](./docs/dev/MAINTAINERS.mdx)
Read our [Hacking guide](https://docs.page/dart-lightning/lndart.clightning/dev/MAINTAINERS)

## License

Expand Down
152 changes: 127 additions & 25 deletions packages/cln_common/README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,141 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
<div align="center">
<h1>lndart.cln_common</h1>

For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
<img src="https://github.com/dart-lightning/icons/raw/main/main/res/mipmap-xxxhdpi/ic_launcher.png" />

For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
<p>
<strong> :dart: cln_common provides all the utils and the interface used in the lndart.cln package and also the derivation of this package like plugins. :dart: </strong>
</p>
<h4>
<a href="https://github.com/dart-lightning">Project Homepage</a>
</h4>

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
<a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/dart-lightning/clightning.dart/Sanity%20Check?style=flat-square">
</a>

<a>
<img alt="Pub Popularity" src="https://img.shields.io/pub/popularity/cln_common?style=flat-square">
</a>

## Features
<a>
<img alt="Pub Points" src="https://img.shields.io/pub/points/cln_common?style=flat-square">
</a>

TODO: List what your package can do. Maybe include images, gifs, or videos.
</div>

## Getting started
## Table of Content

TODO: List prerequisites and provide or point to information on how to
start using the package.
- Introduction
- How to use
- How to contribute
- License

## Usage
## Introduction

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
Proposed solution for the package fragmentation across different package and application that used a basic package like building blocks.

## How to use

### How to use LogManager

We provide a logging manager that you can use in the following way

```dart
import "package:cln_common/cln_common.dart";
void main() {
LogManager.getInstance.debug("This is an awesome debug print");
}
```

### How to implement your own LightningClient

You can implement your own client that follow the rules of the cln.dart package with the following basic class

```dart
/// Client interface to create a (c-)lightning client
/// That can support different protocols.
abstract class LightningClient {
// Connect interface to initialize the client
// with the correct protocol.
LightningClient connect(String url);
Future<T> call<R extends Serializable, T>(
{required String method, required R params, T Function(Map)? onDecode});
// Generic method to call a method in (c-)lightning
Future<Map<String, dynamic>> simpleCall(String method,
{Map<String, dynamic> params = const {}});
void close();
}
```

In order to use our powerful client method `call` we input request need to follow the class rules

```dart
abstract class Serializable {
Map<String, dynamic> toJSON();
T as<T>() => this as T;
}
```

### How to create a valid JSON RPC 2.0

If you need to send you a JSON RPC 2.0 PRC 2.0 request or response you cann use the following class

```dart
const like = 'sample';
import "package:cln_common/cln_common.dart";
void main() {
var request = Request(id: 12, method: "method_name", params: {});
LogManager.getInstance.info("JSON 2.0 request ${request.toJson()}");
// you can build this map from a JSON string with dart built in tools
var responseStr = {
"id": 12,
"jsonrpc": "22",
"result": {}
};
var response = Response.fromJson(responseStr);
LogManager.getInstance.info("JSON 2.0 response ${response.toJson()}");
}
```

## Additional information
## How to contribute

Read our [Hacking guide](https://docs.page/dart-lightning/lndart.clightning/dev/MAINTAINERS)

## License

<div align="center">
<img src="https://opensource.org/files/osi_keyhole_300X300_90ppi_0.png" width="150" height="150"/>
</div>

```
Copyright 2022 Vincenzo Palazzo <[email protected]>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 changes: 16 additions & 0 deletions packages/cln_common/changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"package_name": "comm",
"version": "v0.0.1",
"api": {
"name": "github",
"repository": "dart-lightning/lndart.clightning",
"branch": "main"
},
"generation_method": {
"name": "semver-v2",
"header_filter": true
},
"serialization_method": {
"name": "md"
}
}
11 changes: 10 additions & 1 deletion packages/cln_common/example/cln_common_example.dart
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
void main() {}
import "package:cln_common/cln_common.dart";

void main() {
var request = Request(id: 12, method: "method_name", params: {});
LogManager.getInstance.info("JSON 2.0 request ${request.toJson()}");
// you can build this map from a JSON string with dart built in tools
var responseStr = {"id": 12, "jsonrpc": "22", "result": {}};
var response = Response.fromJson(responseStr);
LogManager.getInstance.info("JSON 2.0 response ${response.toJson()}");
}
5 changes: 5 additions & 0 deletions packages/cln_common/example/loggin_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "package:cln_common/cln_common.dart";

void main() {
LogManager.getInstance.debug("This is an awesome debug print");
}
5 changes: 2 additions & 3 deletions packages/cln_common/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cln_common
description: A starting point for Dart libraries or applications.
description: Proposed solution for the package fragmentation across different package and application that used a basic package like building blocks.
version: 0.0.1
# homepage: https://www.example.com
homepage: https://github.com/dart-lightning/lndart.clightning

environment:
sdk: '>=2.17.3 <3.0.0'
Expand All @@ -10,7 +10,6 @@ dependencies:
json_annotation: ^4.5.0
logger: ^1.0.0


dev_dependencies:
lints: ^2.0.0
test: ^1.16.0
Expand Down
50 changes: 23 additions & 27 deletions packages/cln_plugin/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
<div align="center">
<h1>lndart.clightning</h1>

Expand All @@ -19,34 +7,41 @@ and the Flutter guide for
<strong> :dart: dart library to develop custom plugins in dart for core lightning :dart: </strong>
</p>

<p>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/dart-lightning/clightning.dart/Sanity%20Check?style=flat-square">
</p>

<h4>
<a href="https://github.com/dart-lightning">Project Homepage</a>
</h4>
</div>

This package provides an easy and comprehensive interface to develop custom plugins for core lightning in the Dart programming environment. Plugins developed using this library conform to the JSON-RPCv2 specifications.

## Table of Content
<a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/dart-lightning/clightning.dart/Sanity%20Check?style=flat-square">
</a>

<a>
<img alt="Pub Popularity" src="https://img.shields.io/pub/popularity/cln_plugin?style=flat-square">
</a>

- Features
- Getting Started
<a>
<img alt="Pub Points" src="https://img.shields.io/pub/points/cln_plugin?style=flat-square">
</a>
</div>

## Table of Content
- Introduction
- How to use
- How to contribute
- License

## Features

TODO: List what your package can do. Maybe include images, gifs, or videos.
## Introduction
Dart package that provides an easy and comprehensive interface to develop custom plugins for core lightning in the Dart programming environment.

## Getting started

The simplest way to get started is to instantiate an object of the `Plugin` class.
```dart
var plugin = Plugin();
plugin.start();
void main() {
var plugin = Plugin();
plugin.start();
}
```
This object can then be used to expose the different methods that allow the plugin to register the following with the core lightning daemon:
- Option using the`registerOption()`.
Expand Down Expand Up @@ -94,9 +89,10 @@ void configurePlugin() {
Refer to the `/example` for more complete examples on how to use the library.

[This](https://github.com/dart-lightning/dart_plugin) is a template to easily create plugins for core lightning.

## How to contribute

Read our [Hacking Guide]().
Read our [Hacking guide](https://docs.page/dart-lightning/lndart.clightning/dev/MAINTAINERS)

## License

Expand Down
2 changes: 1 addition & 1 deletion packages/cln_plugin/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"branch": "main"
},
"generation_method": {
"name": "header",
"name": "semver-v2",
"header_filter": true
},
"serialization_method": {
Expand Down
6 changes: 3 additions & 3 deletions packages/cln_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: cln_plugin
description: A starting point for Dart libraries or applications.
version: 1.0.0
# homepage: https://www.example.com
description: Dart package that provides an easy and comprehensive interface to develop custom plugins for core lightning in the Dart programming environment.
version: 0.0.1
homepage: https://github.com/dart-lightning/lndart.clightning

environment:
sdk: '>=2.16.2 <3.0.0'
Expand Down
24 changes: 11 additions & 13 deletions packages/lnlambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@
<p>
<strong> :dart: minimal interface to run lnlambda function with dart. :dart: </strong>
</p>

<div>
<p>

<h4>
<a href="https://github.com/dart-lightning">Project Homepage</a>
</h4>

<a>
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/dart-lightning/clightning.dart/Sanity%20Check?style=flat-square">
</p>
</a>

<p>
<a>
<img alt="Pub Popularity" src="https://img.shields.io/pub/popularity/lnlambda?style=flat-square">
</p>
</a>

<p>
<a>
<img alt="Pub Points" src="https://img.shields.io/pub/points/lnlambda?style=flat-square">
</p>

<h4>
<a href="https://github.com/dart-lightning">Project Homepage</a>
</h4>
</div>
</a>
</div>

## Table of Content
Expand Down
Loading

0 comments on commit 4c74796

Please sign in to comment.