Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI Master

on:
push:
branches:
- master
schedule:
- cron: 0 0 * * 0

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11' ]
name: Master Java ${{ matrix.java }} action

steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'

- name: Build
run: './gradlew classes'

- name: Test
run: './gradlew test jacocoTestReport'
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}

- name: SonarQube
if: matrix.java == '17'
run: './gradlew sonar --info'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Master
name: Release

on:
release:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Test
run: './gradlew test jacocoTestReport'
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_PUBLISH }}

- name: SonarQube
run: './gradlew sonar --info'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Dev
name: Snapshot

on:
push:
Expand Down Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Test
run: './gradlew test jacocoTestReport'
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_PUBLISH }}

- name: Publish Snapshot
run: './gradlew publish'
Expand Down
20 changes: 3 additions & 17 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11', '17' ]
name: Java ${{ matrix.java }} Pull Request setup
java: [ '11' ]
name: Pull Request Java ${{ matrix.java }} action

steps:
- uses: actions/checkout@v3
Expand All @@ -29,23 +29,9 @@ jobs:
run: './gradlew classes'

- name: Test
if: matrix.java == '11'
run: './gradlew test jacocoTestReport'
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_1 }}

- name: Test
if: matrix.java == '17'
run: './gradlew test jacocoTestReport'
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_2 }}

- name: Test Report
if: matrix.java == '17'
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: |
**/test-results/**/*.xml
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}

- name: SonarQube
if: matrix.java == '17'
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ Library supports EtherScan *API* for all available *Ethereum Networks* for *ethe

**Gradle**
```groovy
implementation "com.github.goodforgod:java-etherscan-api:2.1.0"
implementation "com.github.goodforgod:java-etherscan-api:3.0.0"
```

**Maven**
```xml
<dependency>
<groupId>com.github.goodforgod</groupId>
<artifactId>java-etherscan-api</artifactId>
<version>2.1.0</version>
<version>3.0.0</version>
</dependency>
```

Expand Down Expand Up @@ -76,6 +76,14 @@ EtherScanAPI api = EtherScanAPI.builder()
.build();
```

Also you can use Java 11+ HttpClient:
```java
Supplier<EthHttpClient> ethHttpClientSupplier = () -> new JdkEthHttpClient();
EtherScanAPI api = EtherScanAPI.builder()
.withHttpClient(supplier)
.build();
```

## API Examples

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

**Get block info with proxy endpoint**
Expand Down
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ plugins {
id "java-library"
id "maven-publish"

id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "6.3.1.5724"
id "com.diffplug.spotless" version "6.19.0"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
}

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

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

dependencies {
compileOnly "org.jetbrains:annotations:23.0.0"
compileOnly "org.jetbrains:annotations:24.0.1"
implementation "io.goodforgod:gson-configuration:2.0.0"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.3"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.3"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.3"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.4"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.11.4"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.11.4"
}

test {
Expand All @@ -35,7 +35,7 @@ test {
testLogging {
events("passed", "skipped", "failed")
exceptionFormat("full")
showStandardStreams(false)
showStandardStreams(true)
}

reports {
Expand Down Expand Up @@ -71,8 +71,8 @@ nexusPublishing {
sonatype {
username = System.getenv("OSS_USERNAME")
password = System.getenv("OSS_PASSWORD")
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
Expand Down Expand Up @@ -110,8 +110,8 @@ publishing {
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/"
def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username System.getenv("OSS_USERNAME")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
groupId=com.github.goodforgod
artifactId=java-etherscan-api
artifactVersion=2.1.0-SNAPSHOT
artifactVersion=3.0.0-SNAPSHOT


##### GRADLE #####
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
37 changes: 22 additions & 15 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading