Skip to content

Commit

Permalink
lnlambda: add new package for lnlambda handling
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Jul 16, 2022
1 parent 07968fa commit 972ce76
Show file tree
Hide file tree
Showing 20 changed files with 464 additions and 7 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build_common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: core lightning common sanity Check

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, beta, dev]
flavor: [release]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: sdk ${{ matrix.sdk }} and os ${{ matrix.os }}
run: |
cd packages/cln_common
dart pub get
dart format --set-exit-if-changed .
dart analyze
29 changes: 29 additions & 0 deletions .github/workflows/build_lnlambda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: core lightning lnlambda sanity Check

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
sdk: [stable, beta, dev]
flavor: [release]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: sdk ${{ matrix.sdk }} and os ${{ matrix.os }}
run: |
cd packages/lnlambda
dart pub get
dart format --set-exit-if-changed .
dart analyze
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,24 @@ ci_check_rpc:
ci_check_plugin:
$(CC) run plugin_test --no-select

ci_check_common:
$(CC) run common_test --no-select

ci_check_lnlambda:
$(CC) run lnlambda_test --no-select

ci_fmt_rpc:
$(CC) run rpc_analyze --no-select

ci_fmt_plugin:
$(CC) run plugin_analyze --no-select

ci_fmt_common:
$(CC) run common_analyze --no-select

ci_fmt_lnlambda:
$(CC) run lnlambda_analyze --no-select

ci_coverage_rpc:
$(CC) run rpc_test_coverage --no-select

Expand All @@ -42,15 +54,25 @@ check_rpc: ci_fmt_rpc ci_check_rpc

check_plugin: ci_fmt_plugin ci_check_plugin

check_common: ci_fmt_common ci_check_common

check_lnlambda: ci_fmt_lnlambda ci_check_lnlambda

changelog_rpc:
cd packages/rpc && $(CC_CHANGELOG)

changelog_plugin:
cd packages/rpc && $(CC_CHANGELOG)

changelog: changelog_rpc changelog_plugin
changelog_lnlambda:
cd packages/rpc && $(CC_CHANGELOG)

changelog_cln_common:
cd packages/cln_common && $(CC_CHANGELOG)

changelog: changelog_rpc changelog_plugin changelog_cln_common changelog_lnlambda

ci: dep ci_check_rpc check_plugin
ci: dep ci_check_rpc check_plugin check_common check_lnlambda

clean:
$(CC) clean
7 changes: 6 additions & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ services:
build:
context: ../
dockerfile: ./docker/Dockerfile.integration_test
depends_on:
- lnlambda
volumes:
- ./sandbox/:/workdir
- ../:/workdir/code
- ../:/workdir/code
lnlambda:
image: vincenzopalazzo/lnlambda:v0.0.1
network_mode: "host"
10 changes: 10 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ scripts:
run: melos exec -c 1 --scope="cln_common" -- "dart format --set-exit-if-changed . && dart analyze . --fatal-infos"
description: Run dart analyzer in a specific package.

lnlambda_analyze:
run: melos exec -c 1 --scope="lnlambda" -- "dart format --set-exit-if-changed . && dart analyze . --fatal-infos"
description: Run dart analyzer in a specific package.

plugin_test:
description: Run tests in a specific package.
run: melos exec --concurrency=2 --scope="cln_plugin" -- "dart pub get && dart pub run test"
Expand All @@ -36,6 +40,12 @@ scripts:
env:
MELOS_TEST: true

lnlambda_test:
description: Run tests in a specific package.
run: melos exec --concurrency=2 --scope="lnlambda" -- "dart pub get && dart pub run test"
env:
MELOS_TEST: true

rpc_test:
description: Run tests in a specific package.
run: melos exec --concurrency=2 --scope="rpc" -- "dart pub get && dart pub run test"
Expand Down
4 changes: 0 additions & 4 deletions packages/cln_common/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ include: package:lints/recommended.yaml
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

Expand Down
10 changes: 10 additions & 0 deletions packages/lnlambda/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Files and directories created by pub.
.dart_tool/
.packages

# Conventional directory for build outputs.
build/

# Omit committing pubspec.lock for library packages; see
# https://dart.dev/guides/libraries/private-files#pubspeclock.
pubspec.lock
3 changes: 3 additions & 0 deletions packages/lnlambda/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
25 changes: 25 additions & 0 deletions packages/lnlambda/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CC=dart
FMT=format
ARGS="--help"
PROBLEM=

default: fmt examples

dep:
$(CC) pub get

fmt:
$(CC) $(FMT) .
$(CC) analyze .

examples:
$(CC) compile exe example/lnlambda_example.dart -o lnlambda_example

gen:
$(CC) run build_runner build

clean:
rm lib/src/**/*.g.dart

check:
$(CC) test
84 changes: 84 additions & 0 deletions packages/lnlambda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<div align="center">
<h1>lndart.cln_common</h1>

<img src="https://github.com/dart-lightning/icons/raw/main/main/res/mipmap-xxxhdpi/ic_launcher.png" />

<p>
<strong> :dart: minimal interface to run lnlambda function with dart. :dart: </strong>
</p>

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

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

<p>
<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>
</div>

## Table of Content

- Introduction
- How to use
- How to contribute
- License

## Introduction

Proposed solution for the package fragmentation across different package and application that used a basic package like building blocks.

## How to Use

```dart
import 'package:clightning.dart/clightning_rpc.dart';
Future<void> main() async { }
```

## 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.
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.
34 changes: 34 additions & 0 deletions packages/lnlambda/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

analyzer:
exclude:
- "lib/src/model/*.g.dart"

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
16 changes: 16 additions & 0 deletions packages/lnlambda/changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"package_name": "plugin",
"version": "v0.0.1",
"api": {
"name": "github",
"repository": "dart-lightning/lndart.clightning",
"branch": "main"
},
"generation_method": {
"name": "header",
"header_filter": true
},
"serialization_method": {
"name": "md"
}
}
14 changes: 14 additions & 0 deletions packages/lnlambda/example/lnlambda_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:cln_common/cln_common.dart';
import 'package:lnlambda/lnlambda.dart';

void main() {
var client = LNLambdaClient(
nodeID:
"028fe59bd7bbe3982699535e7e43b305c69099fbdd9902b1af5875a121fdb9a3dc",
host: "52.55.124.1:19735",
rune:
"iuFSqODmg91rS57iKParjK0NUb7weqyksEmqruSapW89MyZtZXRob2RebGlzdHxtZXRob2ReZ2V0fG1ldGhvZD1zdW1tYXJ5Jm1ldGhvZC9nZXRzaGFyZWRzZWNyZXQmbWV0aG9kL2xpc3RkYXRhc3RvcmU=",
lambdaServer: "http://ec2-52-55-124-1.compute-1.amazonaws.com:9002");
var response = client.simpleCall("getinfo", params: {});
LogManager.getInstance.debug("Response from lambda $response");
}
8 changes: 8 additions & 0 deletions packages/lnlambda/lib/lnlambda.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// Support for doing something awesome.
///
/// More dartdocs go here.
library lnlambda;

export 'src/lnlambda_base.dart';

// TODO: Export any libraries intended for clients of this package.
Loading

0 comments on commit 972ce76

Please sign in to comment.