Skip to content

Commit

Permalink
align with other projects
Browse files Browse the repository at this point in the history
  • Loading branch information
rvullriede committed Jun 7, 2023
1 parent 2398a9d commit 6c35935
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 45 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
30 changes: 30 additions & 0 deletions .github/workflows/maven-publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish release package to the Maven Central Repository
on:
release:
types: [ created ]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Install gpg secret key
run: |
# Install gpg secret key
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
# Verify gpg secret key
gpg --list-secret-keys --keyid-format LONG
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -P osslabz-release clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package
64 changes: 42 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,28 @@ buildNumber.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

# Eclipse m2e generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### NetBeans template
**/nbproject/private/
**/nbproject/Makefile-*.mk
**/nbproject/Package-*.bash
build/
nbbuild/
dist/
nbdist/
.nb-gradle/

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries
.idea

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
Expand Down Expand Up @@ -72,6 +68,9 @@ atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
Expand Down Expand Up @@ -146,4 +145,25 @@ local.properties
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project

.idea/
### Gradle template
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# lnd-rest-client

![GitHub](https://img.shields.io/github/license/osslabz/lnd-http-client)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/lnd-http-client/maven.yml?branch=main)
[![Maven Central](https://img.shields.io/maven-central/v/net.osslabz/lnd-http-client?label=Maven%20Central)](https://search.maven.org/artifact/net.osslabz/lnd-http-client)
![GitHub](https://img.shields.io/github/license/osslabz/lnd-rest-client)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/osslabz/lnd-rest-client/maven.yml?branch=main)
[![Maven Central](https://img.shields.io/maven-central/v/net.osslabz/lnd-rest-client?label=Maven%20Central)](https://search.maven.org/artifact/net.osslabz/lnd-rest-client)

lnd-http-client is a simple client to interact with [Lightning Network Daemon (LND)](https://github.com/lightningnetwork/lnd) via it's REST API.
Thanks to the [API's excellent documentation](https://lightning.engineering/api-docs/api/lnd/) the client is simply generated based on it's swagger
Expand All @@ -12,9 +12,9 @@ If you prefer LND's gRPC API please have a look at [LighntingJ](https://www.ligh

## Why this client?

This library mostly exists because when I needed such a library lighninj was't (yet) supported on Apple Silicon....
This library mostly exists because when I needed such a library [LighntingJ](https://www.lightningj.org/). wasn't (yet) supported on Apple Silicon....

Other advantages are
Other advantages are:

- it's very easy to review (which you should always do when you handle any valuable assets, crypto or otherwise)
- it supports good old HTTP/1.1 while gRPC is build on http/2. In a perfect world we would all have migrated to http/2 already but there might be
Expand All @@ -31,7 +31,7 @@ Other advantages are
<dependency>
<groupId>net.osslabz</groupId>
<artifactId>lnd-rest-client</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
</dependency>
```

Expand Down
80 changes: 64 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.osslabz</groupId>
<artifactId>lnd-rest-client</artifactId>
<version>1.0.1-SNAPSHOT</version>

<name>${project.groupId}:${project.artifactId}</name>
<description>This package decouples my bitcoin related libraries from the underlying implementation although it seems unlikely this will ever
change ;-)
</description>
<url>https://github.com/osslabz/bitcoin-commons</url>

<properties>
<osslabz.encoding>UTF-8</osslabz.encoding>
<osslabz.java.version>11</osslabz.java.version>
<osslabz.java.version>17</osslabz.java.version>

<project.build.sourceEncoding>${osslabz.encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${osslabz.encoding}</project.reporting.outputEncoding>
Expand All @@ -20,13 +26,13 @@

<project.build.outputTimestamp>2023-03-27T00:00:00Z</project.build.outputTimestamp>

<okhttp.version>4.9.3</okhttp.version>
<okhttp.version>4.10.0</okhttp.version>
</properties>

<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

Expand All @@ -40,9 +46,9 @@
</developers>

<scm>
<connection>scm:git:ssh://[email protected]/osslabz/lnd-http-client.git</connection>
<developerConnection>scm:git:ssh://[email protected]/osslabz/lnd-http-client.git</developerConnection>
<url>https://github.com/osslabz/lnd-http-client</url>
<connection>scm:git:ssh://[email protected]/osslabz/lnd-rest-client.git</connection>
<developerConnection>scm:git:ssh://[email protected]/osslabz/lnd-rest-client.git</developerConnection>
<url>https://github.com/osslabz/lnd-rest-client</url>
<tag>main</tag>
</scm>

Expand All @@ -59,9 +65,9 @@
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -90,7 +96,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
Expand All @@ -105,12 +111,20 @@
<version>2.0.7</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>


<!-- default logging impl for tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.6</version>
<version>1.4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -124,7 +138,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand Down Expand Up @@ -154,7 +168,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down Expand Up @@ -186,7 +200,7 @@
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.3.1</version>
<version>5.4.0</version>
<executions>
<execution>
<id>generate-sources-lnd-http-api-lightning</id>
Expand All @@ -203,6 +217,7 @@
<apiPackage>net.osslabz.lnd.api</apiPackage>
<configOptions>
<dateLibrary>java8</dateLibrary>
<useJakartaEe>true</useJakartaEe>
</configOptions>
<output>${project.build.directory}/generated-sources/openapi</output>
<generateApis>true</generateApis>
Expand All @@ -226,6 +241,7 @@
<apiPackage>net.osslabz.lnd.api</apiPackage>
<configOptions>
<dateLibrary>java8</dateLibrary>
<useJakartaEe>true</useJakartaEe>
</configOptions>
<output>${project.build.directory}/generated-sources/openapi</output>
<generateApis>true</generateApis>
Expand Down Expand Up @@ -262,7 +278,39 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.floverfelt</groupId>
<artifactId>find-and-replace-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>exec</id>
<phase>process-sources</phase>
<goals>
<goal>find-and-replace</goal>
</goals>
<configuration>
<!-- Possible replacementType values: file-contents, filenames, directory-names. To run for multiple types, pass the values as a CSV list. -->
<replacementType>file-contents</replacementType>
<baseDir>target/generated-sources</baseDir>
<findRegex>javax.annotation</findRegex>
<replaceValue>jakarta.annotation</replaceValue>
<recursive>true</recursive>
<fileMask>.java</fileMask>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
2 changes: 1 addition & 1 deletion src/main/java/net/osslabz/lnd/LnApiClientExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static void main(String[] args) throws Exception {
LndApiClient lndApiClient = new LndApiClient(lndHost, lndPort, lndCertPath, lndMacaroonPath, true);

LnrpcNetworkInfo lnrpcNetworkInfo = lndApiClient.getLightningApi().getNetworkInfo();

log.debug("network info: {}", lnrpcNetworkInfo);
}
}

0 comments on commit 6c35935

Please sign in to comment.