Skip to content

Commit 2969dc1

Browse files
authored
Merge pull request GoodforGod#12 from GoodforGod/dev
[1.1.1]
2 parents 5030e1c + cd2aad3 commit 2969dc1

24 files changed

+217
-167
lines changed

.github/workflows/gradle.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ on:
44
push:
55
branches:
66
- master
7-
schedule:
8-
- cron: "0 12 1 * *"
97
pull_request:
108
branches:
11-
- master
12-
- dev
9+
- master
10+
- dev
1311

1412
jobs:
1513
build:
@@ -20,21 +18,26 @@ jobs:
2018
name: Java ${{ matrix.java }} setup
2119

2220
steps:
23-
- uses: actions/checkout@v1
24-
- name: Set up JDK
25-
uses: actions/setup-java@v1
26-
27-
with:
28-
java-version: ${{ matrix.java }}
29-
30-
- name: Build with Gradle
31-
run: ./gradlew build jacocoTestReport
32-
env:
33-
API_KEY: ${{ secrets.API_KEY }}
34-
35-
- name: Analyze with SonarQube
36-
run: ./gradlew sonarqube
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40-
API_KEY: ${{ secrets.API_KEY }}
21+
- uses: actions/checkout@v1
22+
- name: Set up JDK
23+
uses: actions/setup-java@v1
24+
25+
with:
26+
java-version: ${{ matrix.java }}
27+
28+
- name: Build
29+
run: ./gradlew classes
30+
31+
- name: Codestyle
32+
run: ./gradlew spotlessCheck
33+
34+
- name: Test
35+
run: ./gradlew test jacocoTestReport
36+
env:
37+
API_KEY: ${{ secrets.API_KEY }}
38+
39+
- name: SonarQube
40+
run: ./gradlew sonarqube
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

README.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@
1111
Library supports all available EtherScan *API* calls for all available *Ethereum Networks* for *etherscan.io*
1212

1313
## Dependency :rocket:
14+
15+
**Gradle**
16+
```groovy
17+
dependencies {
18+
compile "com.github.goodforgod:java-etherscan-api:1.1.1"
19+
}
20+
```
21+
1422
**Maven**
1523
```xml
1624
<dependency>
1725
<groupId>com.github.goodforgod</groupId>
1826
<artifactId>java-etherscan-api</artifactId>
19-
<version>1.1.0</version>
27+
<version>1.1.1</version>
2028
</dependency>
2129
```
2230

23-
**Gradle**
24-
```groovy
25-
dependencies {
26-
compile 'com.github.goodforgod:java-etherscan-api:1.1.0'
27-
}
28-
```
29-
3031
## Content
3132
- [Ethereum Networks](#mainnet-and-testnets)
3233
- [Custom HttpClient](#custom-httpclient)
@@ -42,6 +43,7 @@ dependencies {
4243
- [Version History](#version-history)
4344

4445
## Mainnet and Testnets
46+
4547
API support Ethereum: *[MAINNET](https://etherscan.io),
4648
[ROPSTEN](https://ropsten.etherscan.io),
4749
[KOVAN](https://kovan.etherscan.io),
@@ -88,14 +90,18 @@ EtherScanApi api = new EtherScanApi("YourApiKey");
8890
Below are examples for each API category.
8991

9092
### Account Api
93+
9194
**Get Ether Balance for a single Address**
95+
9296
```java
9397
EtherScanApi api = new EtherScanApi();
9498
Balance balance = api.account().balance("0x8d4426f94e42f721C7116E81d6688cd935cB3b4F");
9599
```
96100

97101
### Block Api
102+
98103
**Get uncles block for block height**
104+
99105
```java
100106
EtherScanApi api = new EtherScanApi();
101107
Optional<UncleBlock> uncles = api.block().uncles(200000);
@@ -109,7 +115,9 @@ Abi abi = api.contract().contractAbi("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413
109115
```
110116

111117
### Logs Api
118+
112119
**Get event logs for single topic**
120+
113121
```java
114122
EtherScanApi api = new EtherScanApi();
115123
LogQuery query = LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c")
@@ -119,6 +127,7 @@ List<Log> logs = api.logs().logs(query);
119127
```
120128

121129
**Get event logs for 3 topics with respectful operations**
130+
122131
```java
123132
EtherScanApi api = new EtherScanApi();
124133
LogQuery query = LogQueryBuilder.with("0x33990122638b9132ca29c723bdf037f1a891a70c", 379224, 400000)
@@ -134,47 +143,45 @@ List<Log> logs = api.logs().logs(query);
134143
```
135144

136145
### Proxy Api
146+
137147
**Get tx detailds with proxy endpoint**
148+
138149
```java
139150
EtherScanApi api = new EtherScanApi(EthNetwork.MAINNET);
140151
Optional<TxProxy> tx = api.proxy().tx("0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1");
141152
```
142153

143154
**Get block info with proxy endpoint**
155+
144156
```java
145157
EtherScanApi api = new EtherScanApi(EthNetwork.MAINNET);
146158
Optional<BlockProxy> block = api.proxy().block(15215);
147159
```
148160

149161
### Stats Api
162+
150163
**Statistic about last price**
164+
151165
```java
152166
EtherScanApi api = new EtherScanApi();
153167
Price price = api.stats().lastPrice();
154168
```
155169

156170
### Transaction Api
171+
157172
**Request receipt status for tx**
173+
158174
```java
159175
EtherScanApi api = new EtherScanApi();
160176
Optional<Boolean> status = api.txs().receiptStatus("0x513c1ba0bebf66436b5fed86ab668452b7805593c05073eb2d51d3a52f480a76");
161177
```
162178

163179
### Token Api
180+
164181
You can read about token API [here](https://etherscan.io/apis#tokens)
165182

166183
Token API methods migrated to [Account](#account-api) & [Stats](#stats-api) respectfully.
167184

168-
## Version History
169-
170-
**1.1.0** - Improved error handling, QueueManager improved, Gradle 6.7 instead of Maven, GitHub CI, Sonarcloud analyzer, dependencies updated.
171-
172-
**1.0.2** - Minor http client improvements.
173-
174-
**1.0.1** - Gorli & TOBALABA networks support.
175-
176-
**1.0.0** - Initial project with all API functionality, for all available networks, with tests coverage for all cases.
177-
178185
## License
179186

180187
This project licensed under the MIT - see the [LICENSE](LICENSE) file for details.

build.gradle

Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,57 @@
11
plugins {
2-
id 'jacoco'
3-
id 'java-library'
4-
id 'maven-publish'
2+
id "jacoco"
3+
id "java-library"
4+
id "maven-publish"
55

6-
id 'org.sonarqube' version '3.1.1'
7-
id 'com.diffplug.spotless' version '5.11.0'
6+
id "org.sonarqube" version "3.3"
7+
id "com.diffplug.spotless" version "5.14.3"
88
}
99

1010
repositories {
1111
mavenLocal()
1212
mavenCentral()
13-
jcenter()
1413
}
1514

1615
group = groupId
1716
version = artifactVersion
1817

19-
sourceCompatibility = 1.8
20-
targetCompatibility = 1.8
18+
sourceCompatibility = JavaVersion.VERSION_1_8
19+
targetCompatibility = JavaVersion.VERSION_1_8
2120

2221
spotless {
2322
java {
24-
encoding 'UTF-8'
23+
encoding "UTF-8"
2524
removeUnusedImports()
2625
eclipse().configFile "${projectDir}/config/codestyle.xml"
2726
}
2827
}
2928

3029
sonarqube {
3130
properties {
32-
property 'sonar.host.url', 'https://sonarcloud.io'
33-
property 'sonar.organization', 'goodforgod'
34-
property 'sonar.projectKey', 'GoodforGod_java-etherscan-api'
31+
property "sonar.host.url", "https://sonarcloud.io"
32+
property "sonar.organization", "goodforgod"
33+
property "sonar.projectKey", "GoodforGod_java-etherscan-api"
3534
}
3635
}
3736

3837
dependencies {
39-
implementation 'org.jetbrains:annotations:20.1.0'
40-
implementation 'com.google.code.gson:gson:2.8.6'
38+
implementation "org.jetbrains:annotations:22.0.0"
39+
implementation "com.google.code.gson:gson:2.8.8"
4140

42-
testImplementation 'junit:junit:4.13.1'
41+
testImplementation "junit:junit:4.13.1"
4342
}
4443

4544
test {
46-
failFast = true
47-
4845
useJUnit()
4946
testLogging {
50-
events "passed", "skipped", "failed"
51-
exceptionFormat "full"
47+
events("passed", "skipped", "failed")
48+
exceptionFormat("full")
5249
}
53-
}
5450

55-
tasks.withType(JavaCompile) {
56-
options.encoding = 'UTF-8'
57-
options.incremental = true
58-
options.fork = true
59-
}
60-
61-
tasks.withType(Test) {
62-
reports.html.enabled = false
63-
reports.junitXml.enabled = false
64-
}
65-
66-
java {
67-
withJavadocJar()
68-
withSourcesJar()
51+
reports {
52+
html.enabled(false)
53+
junitXml.enabled(false)
54+
}
6955
}
7056

7157
publishing {
@@ -74,27 +60,27 @@ publishing {
7460
from components.java
7561

7662
pom {
77-
name = 'Java Etherscan API'
78-
url = 'https://github.com/GoodforGod/java-etherscan-api'
79-
description = 'Library is a wrapper for EtherScan API.'
63+
name = "Java Etherscan API"
64+
url = "https://github.com/GoodforGod/java-etherscan-api"
65+
description = "Library is a wrapper for EtherScan API."
8066

8167
license {
82-
name = 'MIT License'
83-
url = 'https://github.com/GoodforGod/java-etherscan-api/blob/master/LICENSE'
84-
distribution = 'repo'
68+
name = "MIT License"
69+
url = "https://github.com/GoodforGod/java-etherscan-api/blob/master/LICENSE"
70+
distribution = "repo"
8571
}
8672

8773
developer {
88-
id = 'GoodforGod'
89-
name = 'Anton Kurako'
90-
email = 'goodforgod.dev@gmail.com'
91-
url = 'https://github.com/GoodforGod'
74+
id = "GoodforGod"
75+
name = "Anton Kurako"
76+
email = "goodforgod.dev@gmail.com"
77+
url = "https://github.com/GoodforGod"
9278
}
9379

9480
scm {
95-
connection = 'scm:git:git://github.com/GoodforGod/java-etherscan-api.git'
96-
developerConnection = 'scm:git:ssh://GoodforGod/java-etherscan-api.git'
97-
url = 'https://github.com/GoodforGod/java-etherscan-api/tree/master'
81+
connection = "scm:git:git://github.com/GoodforGod/java-etherscan-api.git"
82+
developerConnection = "scm:git:ssh://GoodforGod/java-etherscan-api.git"
83+
url = "https://github.com/GoodforGod/java-etherscan-api/tree/master"
9884
}
9985
}
10086
}
@@ -103,7 +89,7 @@ publishing {
10389
maven {
10490
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
10591
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
106-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
92+
url = version.endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl
10793
credentials {
10894
username System.getenv("OSS_USERNAME")
10995
password System.getenv("OSS_PASSWORD")
@@ -112,6 +98,17 @@ publishing {
11298
}
11399
}
114100

101+
java {
102+
withJavadocJar()
103+
withSourcesJar()
104+
}
105+
106+
tasks.withType(JavaCompile) {
107+
options.encoding("UTF-8")
108+
options.incremental(true)
109+
options.fork = true
110+
}
111+
115112
check.dependsOn jacocoTestReport
116113
jacocoTestReport {
117114
reports {
@@ -120,16 +117,16 @@ jacocoTestReport {
120117
}
121118
}
122119

120+
javadoc {
121+
options.encoding = "UTF-8"
122+
if (JavaVersion.current().isJava9Compatible()) {
123+
options.addBooleanOption("html5", true)
124+
}
125+
}
126+
123127
if (project.hasProperty("signing.keyId")) {
124-
apply plugin: 'signing'
128+
apply plugin: "signing"
125129
signing {
126130
sign publishing.publications.mavenJava
127131
}
128132
}
129-
130-
javadoc {
131-
options.encoding = "UTF-8"
132-
if (JavaVersion.current().isJava9Compatible()) {
133-
options.addBooleanOption('html5', true)
134-
}
135-
}

config/codestyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
7575
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
7676
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
77-
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
77+
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="100"/>
7878
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
7979
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
8080
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>

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=1.1.0
3+
artifactVersion=1.1.1
44
buildNumber=1
55

66

gradle/wrapper/gradle-wrapper.jar

333 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy