Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GoodforGod/java-etherscan-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0
Choose a base ref
...
head repository: GoodforGod/java-etherscan-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 14 commits
  • 50 files changed
  • 3 contributors

Commits on Sep 24, 2023

  1. Contract creation API

    Blackmorse committed Sep 24, 2023
    Copy the full SHA
    333cfe4 View commit details

Commits on Sep 29, 2023

  1. Formatting

    Blackmorse committed Sep 29, 2023
    Copy the full SHA
    234cce4 View commit details

Commits on Oct 1, 2023

  1. filtering out empty env

    Blackmorse committed Oct 1, 2023
    Copy the full SHA
    64540b8 View commit details

Commits on Oct 4, 2023

  1. Fix codestyle

    Blackmorse committed Oct 4, 2023
    Copy the full SHA
    06464f8 View commit details

Commits on Oct 5, 2023

  1. Merge pull request #27 from Blackmorse/contract_creation

    Contract creation API
    GoodforGod authored Oct 5, 2023
    Copy the full SHA
    3b1af9d View commit details
  2. [2.1.0-SNAPSHOT]

    EtherScanAPI.Builder#withRetryOnLimitReach added
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    3a87ca8 View commit details
  3. [2.1.0-SNAPSHOT]

    build.gradle updated for new CI
    CONTRIBUTING.md added
    README.md updated
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    3405883 View commit details
  4. [2.1.0-SNAPSHOT]

    CI updated
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    40059f4 View commit details
  5. [2.1.0-SNAPSHOT]

    Javadoc fixed
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    519c26a View commit details
  6. [2.1.0-SNAPSHOT]

    Method renamed
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    b6e9ba5 View commit details
  7. [2.1.0-SNAPSHOT]

    Method renamed
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    c855695 View commit details
  8. [2.1.0-SNAPSHOT]

    CI updated
    GoodforGod committed Oct 5, 2023
    Copy the full SHA
    3a252b4 View commit details
  9. Merge pull request #28 from GoodforGod/dev

    [2.1.0]
    GoodforGod authored Oct 5, 2023
    Copy the full SHA
    1195075 View commit details

Commits on Jan 15, 2024

  1. [2.1.0-SNAPSHOT]

    README.md updated
    GoodforGod committed Jan 15, 2024
    Copy the full SHA
    3de7b24 View commit details
Showing with 648 additions and 214 deletions.
  1. +49 −0 .github/workflows/publish-release.yml
  2. +44 −0 .github/workflows/publish-snapshot.yml
  3. +19 −15 .github/workflows/{gradle.yml → pull-request.yml}
  4. +23 −0 CONTRIBUTING.md
  5. +14 −13 README.md
  6. +0 −1 _config.yml
  7. +40 −8 build.gradle
  8. +1 −1 gradle.properties
  9. BIN gradle/wrapper/gradle-wrapper.jar
  10. +2 −1 gradle/wrapper/gradle-wrapper.properties
  11. +14 −4 gradlew
  12. +9 −6 gradlew.bat
  13. +5 −7 src/main/java/io/goodforgod/api/etherscan/AccountAPIProvider.java
  14. +45 −6 src/main/java/io/goodforgod/api/etherscan/BasicProvider.java
  15. +4 −8 src/main/java/io/goodforgod/api/etherscan/BlockAPIProvider.java
  16. +11 −0 src/main/java/io/goodforgod/api/etherscan/ContractAPI.java
  17. +33 −2 src/main/java/io/goodforgod/api/etherscan/ContractAPIProvider.java
  18. +12 −1 src/main/java/io/goodforgod/api/etherscan/EthScanAPIBuilder.java
  19. +11 −0 src/main/java/io/goodforgod/api/etherscan/EtherScanAPI.java
  20. +10 −9 src/main/java/io/goodforgod/api/etherscan/EtherScanAPIProvider.java
  21. +3 −2 src/main/java/io/goodforgod/api/etherscan/GasTrackerAPIProvider.java
  22. +3 −2 src/main/java/io/goodforgod/api/etherscan/LogsAPIProvider.java
  23. +3 −2 src/main/java/io/goodforgod/api/etherscan/ProxyAPIProvider.java
  24. +3 −0 src/main/java/io/goodforgod/api/etherscan/StatisticAPI.java
  25. +3 −2 src/main/java/io/goodforgod/api/etherscan/StatisticAPIProvider.java
  26. +3 −2 src/main/java/io/goodforgod/api/etherscan/TransactionAPIProvider.java
  27. +5 −5 src/main/java/io/goodforgod/api/etherscan/manager/RequestQueueManager.java
  28. +1 −1 src/main/java/io/goodforgod/api/etherscan/model/Abi.java
  29. +1 −1 src/main/java/io/goodforgod/api/etherscan/model/Balance.java
  30. +1 −1 src/main/java/io/goodforgod/api/etherscan/model/Block.java
  31. +4 −4 src/main/java/io/goodforgod/api/etherscan/model/BlockUncle.java
  32. +86 −0 src/main/java/io/goodforgod/api/etherscan/model/ContractCreation.java
  33. +4 −4 src/main/java/io/goodforgod/api/etherscan/model/EthSupply.java
  34. +9 −9 src/main/java/io/goodforgod/api/etherscan/model/Log.java
  35. +2 −2 src/main/java/io/goodforgod/api/etherscan/model/Price.java
  36. +1 −1 src/main/java/io/goodforgod/api/etherscan/model/Status.java
  37. +1 −1 src/main/java/io/goodforgod/api/etherscan/model/TokenBalance.java
  38. +9 −9 src/main/java/io/goodforgod/api/etherscan/model/Tx.java
  39. +11 −11 src/main/java/io/goodforgod/api/etherscan/model/TxErc1155.java
  40. +10 −10 src/main/java/io/goodforgod/api/etherscan/model/TxErc20.java
  41. +11 −11 src/main/java/io/goodforgod/api/etherscan/model/TxErc721.java
  42. +9 −9 src/main/java/io/goodforgod/api/etherscan/model/TxInternal.java
  43. +18 −18 src/main/java/io/goodforgod/api/etherscan/model/proxy/BlockProxy.java
  44. +11 −11 src/main/java/io/goodforgod/api/etherscan/model/proxy/ReceiptProxy.java
  45. +14 −14 src/main/java/io/goodforgod/api/etherscan/model/proxy/TxProxy.java
  46. +3 −0 src/main/java/io/goodforgod/api/etherscan/model/response/ContractCreationResponseTO.java
  47. +20 −0 src/main/java/io/goodforgod/api/etherscan/model/response/ContractCreationTO.java
  48. +4 −0 src/main/java/io/goodforgod/api/etherscan/util/BasicUtils.java
  49. +3 −0 src/test/java/io/goodforgod/api/etherscan/ApiRunner.java
  50. +46 −0 src/test/java/io/goodforgod/api/etherscan/contract/ContractApiTests.java
49 changes: 49 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI Master

on:
release:
types: [ published ]

jobs:
publish-release:
runs-on: ubuntu-latest
name: Publish Release

steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

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

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

- name: SonarQube
run: './gradlew sonar --info'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Publish Release to GitHub Packages
run: './gradlew publishMavenJavaPublicationToGitHubPackagesRepository'
env:
RELEASE_VERSION: ${{ github.ref_name }}
GITHUB_TOKEN: ${{ secrets.OSS_GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSS_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSS_SIGNING_PASSWORD }}

- name: Publish Release to OSSRH
run: './gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository'
env:
RELEASE_VERSION: ${{ github.ref_name }}
OSS_USERNAME: ${{ secrets.OSS_USERNAME }}
OSS_PASSWORD: ${{ secrets.OSS_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSS_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSS_SIGNING_PASSWORD }}
44 changes: 44 additions & 0 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI Dev

on:
push:
paths:
- '**/workflows/*.yml'
- '**/java/**'
- '*.java'
- '*.gradle'
- '*.properties'
branches:
- dev

jobs:
publish-snapshot:
runs-on: ubuntu-latest
name: Publish Snapshot

steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'

- name: Code Style
run: './gradlew spotlessCheck'

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

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

- name: Publish Snapshot
run: './gradlew publish'
env:
OSS_USERNAME: ${{ secrets.OSS_USERNAME }}
OSS_PASSWORD: ${{ secrets.OSS_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSS_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSS_SIGNING_PASSWORD }}
34 changes: 19 additions & 15 deletions .github/workflows/gradle.yml → .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Java CI
name: CI Pull Request

on:
push:
branches:
- master
pull_request:
branches:
- master
@@ -15,37 +12,44 @@ jobs:
strategy:
matrix:
java: [ '11', '17' ]
name: Java ${{ matrix.java }} setup
name: Java ${{ matrix.java }} Pull Request setup

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v1

uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'

- name: Build
run: ./gradlew classes
- name: Code Style
run: './gradlew spotlessCheck'

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

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

- name: Test
if: matrix.java == '17'
run: ./gradlew test jacocoTestReport
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
- name: SonarQube
if: matrix.java == '17'
run: ./gradlew sonarqube
run: './gradlew sonar --info'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contributing Code or Documentation Guide

## Running Tests

The new code should contain tests that check new behavior.

Run tests `./gradlew test` to check that code works as behavior.

## Code Style

The code base should remain clean, following industry best practices for organization, javadoc and style, as much as possible.

To run the Code Style check use `./gradlew spotlessCheck`.

If check found any errors, you can apply Code Style by running `./gradlew spotlessApply`

## Creating a pull request

Once you are satisfied with your changes:

- Commit changes to the local branch you created.
- Push that branch with changes to the corresponding remote branch on GitHub
- Submit a [pull request](https://help.github.com/articles/creating-a-pull-request) to `dev` branch.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Java EtherScan API

[![Minimum required Java version](https://img.shields.io/badge/Java-1.8%2B-blue?logo=openjdk)](https://openjdk.org/projects/jdk8/)
[![GitHub Action](https://github.com/goodforgod/java-etherscan-api/workflows/Java%20CI/badge.svg)](https://github.com/GoodforGod/java-etherscan-api/actions?query=workflow%3A%22Java+CI%22)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/java-etherscan-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/java-etherscan-api)
[![Java CI](https://github.com/GoodforGod/java-etherscan-api/workflows/CI%20Master/badge.svg)](https://github.com/GoodforGod/java-etherscan-api/actions?query=workflow%3ACI+Master)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=coverage)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api&metric=ncloc)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)
@@ -14,15 +15,15 @@ Library supports EtherScan *API* for all available *Ethereum Networks* for *ethe

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

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

@@ -48,7 +49,7 @@ API support all Ethereum [default networks](https://docs.etherscan.io/getting-st
- [Sepolia](https://api-sepolia.etherscan.io/)

```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
EtherScanAPI apiGoerli = EtherScanAPI.builder().withNetwork(EthNetworks.GORLI).build();
EtherScanAPI apiSepolia = EtherScanAPI.builder().withNetwork(EthNetworks.SEPOLIA).build();
```
@@ -96,30 +97,30 @@ Below are examples for each API category.

**Get Ether Balance for a single Address**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Balance balance = api.account().balance("0x8d4426f94e42f721C7116E81d6688cd935cB3b4F");
```

### Block API

**Get uncles block for block height**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Optional<UncleBlock> uncles = api.block().uncles(200000);
```

### Contract API
**Request contract ABI from [verified codes](https://etherscan.io/contractsVerified)**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Abi abi = api.contract().contractAbi("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413");
```

### Logs API

**Get event logs for single topic**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
LogQuery query = LogQuery.builder("0x33990122638b9132ca29c723bdf037f1a891a70c")
.withTopic("0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545")
.build();
@@ -128,7 +129,7 @@ List<Log> logs = api.logs().logs(query);

**Get event logs for 3 topics with respectful operations**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
LogQuery query = LogQuery.builder("0x33990122638b9132ca29c723bdf037f1a891a70c")
.withBlockFrom(379224)
.withBlockTo(400000)
@@ -147,29 +148,29 @@ List<Log> logs = api.logs().logs(query);

**Get tx details with proxy endpoint**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Optional<TxProxy> tx = api.proxy().tx("0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1");
```

**Get block info with proxy endpoint**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Optional<BlockProxy> block = api.proxy().block(15215);
```

### Stats API

**Statistic about last price**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Price price = api.stats().priceLast();
```

### Transaction API

**Request receipt status for tx**
```java
EtherScanAPI api = EtherScanAPI.build();
EtherScanAPI api = EtherScanAPI.builder().build();
Optional<Boolean> status = api.txs().receiptStatus("0x513c1ba0bebf66436b5fed86ab668452b7805593c05073eb2d51d3a52f480a76");
```

1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

Loading