Skip to content

Commit 1503e9b

Browse files
authored
Merge pull request #34 from GoodforGod/dev
[3.0.0]
2 parents 3de7b24 + 03b70d3 commit 1503e9b

File tree

69 files changed

+1110
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1110
-431
lines changed

.github/workflows/master.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI Master
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: 0 0 * * 0
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
java: [ '11' ]
16+
name: Master Java ${{ matrix.java }} action
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up JDK
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: ${{ matrix.java }}
24+
distribution: 'adopt'
25+
26+
- name: Build
27+
run: './gradlew classes'
28+
29+
- name: Test
30+
run: './gradlew test jacocoTestReport'
31+
env:
32+
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
33+
34+
- name: SonarQube
35+
if: matrix.java == '17'
36+
run: './gradlew sonar --info'
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/publish-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Master
1+
name: Release
22

33
on:
44
release:
@@ -23,7 +23,7 @@ jobs:
2323
- name: Test
2424
run: './gradlew test jacocoTestReport'
2525
env:
26-
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
26+
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_PUBLISH }}
2727

2828
- name: SonarQube
2929
run: './gradlew sonar --info'

.github/workflows/publish-snapshot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Dev
1+
name: Snapshot
22

33
on:
44
push:
@@ -33,7 +33,7 @@ jobs:
3333
- name: Test
3434
run: './gradlew test jacocoTestReport'
3535
env:
36-
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
36+
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_PUBLISH }}
3737

3838
- name: Publish Snapshot
3939
run: './gradlew publish'

.github/workflows/pull-request.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
java: [ '11', '17' ]
15-
name: Java ${{ matrix.java }} Pull Request setup
14+
java: [ '11' ]
15+
name: Pull Request Java ${{ matrix.java }} action
1616

1717
steps:
1818
- uses: actions/checkout@v3
@@ -29,23 +29,9 @@ jobs:
2929
run: './gradlew classes'
3030

3131
- name: Test
32-
if: matrix.java == '11'
3332
run: './gradlew test jacocoTestReport'
3433
env:
35-
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_1 }}
36-
37-
- name: Test
38-
if: matrix.java == '17'
39-
run: './gradlew test jacocoTestReport'
40-
env:
41-
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
42-
43-
- name: Test Report
44-
if: matrix.java == '17'
45-
uses: EnricoMi/publish-unit-test-result-action@v2
46-
with:
47-
files: |
48-
**/test-results/**/*.xml
34+
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
4935

5036
- name: SonarQube
5137
if: matrix.java == '17'

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ Library supports EtherScan *API* for all available *Ethereum Networks* for *ethe
1515

1616
**Gradle**
1717
```groovy
18-
implementation "com.github.goodforgod:java-etherscan-api:2.1.0"
18+
implementation "com.github.goodforgod:java-etherscan-api:3.0.0"
1919
```
2020

2121
**Maven**
2222
```xml
2323
<dependency>
2424
<groupId>com.github.goodforgod</groupId>
2525
<artifactId>java-etherscan-api</artifactId>
26-
<version>2.1.0</version>
26+
<version>3.0.0</version>
2727
</dependency>
2828
```
2929

@@ -76,6 +76,14 @@ EtherScanAPI api = EtherScanAPI.builder()
7676
.build();
7777
```
7878

79+
Also you can use Java 11+ HttpClient:
80+
```java
81+
Supplier<EthHttpClient> ethHttpClientSupplier = () -> new JdkEthHttpClient();
82+
EtherScanAPI api = EtherScanAPI.builder()
83+
.withHttpClient(supplier)
84+
.build();
85+
```
86+
7987
## API Examples
8088

8189
You can read about all API methods on [Etherscan](https://docs.etherscan.io/api-endpoints/accounts)
@@ -149,7 +157,7 @@ List<Log> logs = api.logs().logs(query);
149157
**Get tx details with proxy endpoint**
150158
```java
151159
EtherScanAPI api = EtherScanAPI.builder().build();
152-
Optional<TxProxy> tx = api.proxy().tx("0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1");
160+
Optional<TxProxy> tx = api.proxy().tx("0x1e2910a263.0.08d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1");
153161
```
154162

155163
**Get block info with proxy endpoint**

build.gradle

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ plugins {
33
id "java-library"
44
id "maven-publish"
55

6-
id "org.sonarqube" version "4.3.0.3225"
6+
id "org.sonarqube" version "6.3.1.5724"
77
id "com.diffplug.spotless" version "6.19.0"
8-
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
8+
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
99
}
1010

1111
repositories {
@@ -17,16 +17,16 @@ group = groupId
1717
var ver = System.getenv().getOrDefault("RELEASE_VERSION", artifactVersion)
1818
version = ver.startsWith("v") ? ver.substring(1) : ver
1919

20-
sourceCompatibility = JavaVersion.VERSION_1_8
21-
targetCompatibility = JavaVersion.VERSION_1_8
20+
sourceCompatibility = JavaVersion.VERSION_11
21+
targetCompatibility = JavaVersion.VERSION_11
2222

2323
dependencies {
24-
compileOnly "org.jetbrains:annotations:23.0.0"
24+
compileOnly "org.jetbrains:annotations:24.0.1"
2525
implementation "io.goodforgod:gson-configuration:2.0.0"
2626

27-
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.3"
28-
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.3"
29-
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.3"
27+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.4"
28+
testImplementation "org.junit.jupiter:junit-jupiter-api:5.11.4"
29+
testImplementation "org.junit.jupiter:junit-jupiter-params:5.11.4"
3030
}
3131

3232
test {
@@ -35,7 +35,7 @@ test {
3535
testLogging {
3636
events("passed", "skipped", "failed")
3737
exceptionFormat("full")
38-
showStandardStreams(false)
38+
showStandardStreams(true)
3939
}
4040

4141
reports {
@@ -71,8 +71,8 @@ nexusPublishing {
7171
sonatype {
7272
username = System.getenv("OSS_USERNAME")
7373
password = System.getenv("OSS_PASSWORD")
74-
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
75-
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
74+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
75+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
7676
}
7777
}
7878
}
@@ -110,8 +110,8 @@ publishing {
110110
}
111111
repositories {
112112
maven {
113-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
114-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
113+
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/"
114+
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
115115
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
116116
credentials {
117117
username System.getenv("OSS_USERNAME")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
groupId=com.github.goodforgod
22
artifactId=java-etherscan-api
3-
artifactVersion=2.1.0-SNAPSHOT
3+
artifactVersion=3.0.0-SNAPSHOT
44

55

66
##### GRADLE #####

gradle/wrapper/gradle-wrapper.jar

-17.4 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
8385
# This is normally unused
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
88+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9090

9191
# Use the maximum available, or set MAX_FD != -1 to use that value.
9292
MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117+
CLASSPATH="\\\"\\\""
118118

119119

120120
# Determine the Java command to use to start the JVM.
@@ -133,26 +133,29 @@ location of your Java installation."
133133
fi
134134
else
135135
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
136+
if ! command -v java >/dev/null 2>&1
137+
then
138+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137139
138140
Please set the JAVA_HOME variable in your environment to match the
139141
location of your Java installation."
142+
fi
140143
fi
141144

142145
# Increase the maximum file descriptors if we can.
143146
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144147
case $MAX_FD in #(
145148
max*)
146149
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147-
# shellcheck disable=SC3045
150+
# shellcheck disable=SC2039,SC3045
148151
MAX_FD=$( ulimit -H -n ) ||
149152
warn "Could not query maximum file descriptor limit"
150153
esac
151154
case $MAX_FD in #(
152155
'' | soft) :;; #(
153156
*)
154157
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155-
# shellcheck disable=SC3045
158+
# shellcheck disable=SC2039,SC3045
156159
ulimit -n "$MAX_FD" ||
157160
warn "Could not set maximum file descriptor limit to $MAX_FD"
158161
esac
@@ -197,16 +200,20 @@ if "$cygwin" || "$msys" ; then
197200
done
198201
fi
199202

200-
# Collect all arguments for the java command;
201-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202-
# shell script including quotes and variable substitutions, so put them in
203-
# double quotes to make sure that they get re-expanded; and
204-
# * put everything else in single quotes, so that it's not re-expanded.
203+
204+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206+
207+
# Collect all arguments for the java command:
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209+
# and any embedded shellness will be escaped.
210+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211+
# treated as '${Hostname}' itself on the command line.
205212

206213
set -- \
207214
"-Dorg.gradle.appname=$APP_BASE_NAME" \
208215
-classpath "$CLASSPATH" \
209-
org.gradle.wrapper.GradleWrapperMain \
216+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
210217
"$@"
211218

212219
# Stop when "xargs" is not available.

0 commit comments

Comments
 (0)