Skip to content

Commit 234cce4

Browse files
committed
Formatting
1 parent 333cfe4 commit 234cce4

File tree

7 files changed

+28
-20
lines changed

7 files changed

+28
-20
lines changed

Diff for: src/main/java/io/goodforgod/api/etherscan/AccountAPIProvider.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public List<Balance> balances(@NotNull List<String> addresses) throws EtherScanE
9595
final List<List<String>> addressesAsBatches = BasicUtils.partition(addresses, 20);
9696

9797
for (final List<String> batch : addressesAsBatches) {
98-
final String urlParams = ACT_BALANCE_MULTI_ACTION + TAG_LATEST_PARAM + ADDRESS_PARAM + BasicUtils.toAddressParam(batch);
98+
final String urlParams = ACT_BALANCE_MULTI_ACTION + TAG_LATEST_PARAM + ADDRESS_PARAM
99+
+ BasicUtils.toAddressParam(batch);
99100
final BalanceResponseTO response = getRequest(urlParams, BalanceResponseTO.class);
100101
if (response.getStatus() != 1) {
101102
throw new EtherScanResponseException(response);

Diff for: src/main/java/io/goodforgod/api/etherscan/ContractAPI.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
import io.goodforgod.api.etherscan.error.EtherScanException;
44
import io.goodforgod.api.etherscan.model.Abi;
55
import io.goodforgod.api.etherscan.model.ContractCreation;
6-
import org.jetbrains.annotations.NotNull;
7-
86
import java.util.List;
7+
import org.jetbrains.annotations.NotNull;
98

109
/**
1110
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/contracts">...</a>
@@ -27,6 +26,7 @@ public interface ContractAPI {
2726

2827
/**
2928
* Returns a contract's deployer address and transaction hash it was created, up to 5 at a time.
29+
*
3030
* @param contractAddresses - list of addresses to fetch
3131
* @throws EtherScanException parent exception class
3232
*/

Diff for: src/main/java/io/goodforgod/api/etherscan/ContractAPIProvider.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import io.goodforgod.api.etherscan.model.response.ContractCreationResponseTO;
1010
import io.goodforgod.api.etherscan.model.response.StringResponseTO;
1111
import io.goodforgod.api.etherscan.util.BasicUtils;
12-
import org.jetbrains.annotations.NotNull;
13-
1412
import java.util.List;
1513
import java.util.stream.Collectors;
14+
import org.jetbrains.annotations.NotNull;
1615

1716
/**
1817
* Contract API Implementation
@@ -60,7 +59,8 @@ public Abi contractAbi(@NotNull String address) throws EtherScanException {
6059
@Override
6160
public List<ContractCreation> contractCreation(@NotNull List<String> contractAddresses) throws EtherScanException {
6261
BasicUtils.validateAddresses(contractAddresses);
63-
final String urlParam = ACT_CONTRACT_CREATION + ACT_CONTRACT_ADDRESSES_PARAM + BasicUtils.toAddressParam(contractAddresses);
62+
final String urlParam = ACT_CONTRACT_CREATION + ACT_CONTRACT_ADDRESSES_PARAM
63+
+ BasicUtils.toAddressParam(contractAddresses);
6464
final ContractCreationResponseTO response = getRequest(urlParam, ContractCreationResponseTO.class);
6565
if (response.getStatus() != 1 && response.getMessage().startsWith("NOTOK")) {
6666
throw new EtherScanResponseException(response);
@@ -71,7 +71,7 @@ public List<ContractCreation> contractCreation(@NotNull List<String> contractAdd
7171
.withContractCreator(to.getContractCreator())
7272
.withContractAddress(to.getContractAddress())
7373
.withTxHash(to.getTxHash())
74-
.build()
75-
).collect(Collectors.toList());
74+
.build())
75+
.collect(Collectors.toList());
7676
}
7777
}

Diff for: src/main/java/io/goodforgod/api/etherscan/StatisticAPI.java

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
public interface StatisticAPI {
1616

1717
/**
18+
* ERC20 token total Supply
19+
* <a href=
20+
* "https://docs.etherscan.io/api-endpoints/tokens#get-erc20-token-totalsupply-by-contractaddress">EtherScan<a>
1821
* Returns the current amount of an ERC-20 token in circulation.
1922
*
2023
* @param contract contract address

Diff for: src/main/java/io/goodforgod/api/etherscan/model/ContractCreation.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.Objects;
44

55
public class ContractCreation {
6+
67
private final String contractAddress;
78
private final String contractCreator;
89
private final String txHash;
@@ -27,10 +28,13 @@ public String getTxHash() {
2728

2829
@Override
2930
public boolean equals(Object o) {
30-
if (this == o) return true;
31-
if (o == null || getClass() != o.getClass()) return false;
31+
if (this == o)
32+
return true;
33+
if (o == null || getClass() != o.getClass())
34+
return false;
3235
ContractCreation that = (ContractCreation) o;
33-
return Objects.equals(contractAddress, that.contractAddress) && Objects.equals(contractCreator, that.contractCreator) && Objects.equals(txHash, that.txHash);
36+
return Objects.equals(contractAddress, that.contractAddress) && Objects.equals(contractCreator, that.contractCreator)
37+
&& Objects.equals(txHash, that.txHash);
3438
}
3539

3640
@Override
@@ -52,6 +56,7 @@ public static ContractCreationBuilder builder() {
5256
}
5357

5458
public static final class ContractCreationBuilder {
59+
5560
private String contractAddress;
5661
private String contractCreator;
5762
private String txHash;
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
package io.goodforgod.api.etherscan.model.response;
22

3-
public class ContractCreationResponseTO extends BaseListResponseTO<ContractCreationTO> {
4-
}
3+
public class ContractCreationResponseTO extends BaseListResponseTO<ContractCreationTO> {}

Diff for: src/test/java/io/goodforgod/api/etherscan/contract/ContractApiTests.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
import io.goodforgod.api.etherscan.error.EtherScanInvalidAddressException;
55
import io.goodforgod.api.etherscan.model.Abi;
66
import io.goodforgod.api.etherscan.model.ContractCreation;
7-
import org.junit.jupiter.api.Test;
8-
97
import java.util.Arrays;
108
import java.util.Collections;
119
import java.util.List;
10+
import org.junit.jupiter.api.Test;
1211

1312
/**
1413
* @author GoodforGod
@@ -45,8 +44,8 @@ void correctParamWithEmptyExpectedResult() {
4544

4645
@Test
4746
void correctContractCreation() {
48-
List<ContractCreation> contractCreations =
49-
getApi().contract().contractCreation(Collections.singletonList("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413"));
47+
List<ContractCreation> contractCreations = getApi().contract()
48+
.contractCreation(Collections.singletonList("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413"));
5049

5150
assertEquals(1, contractCreations.size());
5251
ContractCreation contractCreation = contractCreations.get(0);
@@ -58,8 +57,8 @@ void correctContractCreation() {
5857

5958
@Test
6059
void correctMultipleContractCreation() {
61-
List<ContractCreation> contractCreations =
62-
getApi().contract().contractCreation(Arrays.asList("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413", "0x5EaC95ad5b287cF44E058dCf694419333b796123"));
60+
List<ContractCreation> contractCreations = getApi().contract().contractCreation(
61+
Arrays.asList("0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413", "0x5EaC95ad5b287cF44E058dCf694419333b796123"));
6362
assertEquals(2, contractCreations.size());
6463

6564
ContractCreation contractCreation1 = ContractCreation.builder()
@@ -81,6 +80,7 @@ void correctMultipleContractCreation() {
8180
@Test
8281
void contractCreationInvalidParamWithError() {
8382
assertThrows(EtherScanInvalidAddressException.class,
84-
() -> getApi().contract().contractCreation(Collections.singletonList("0xBBbc244D798123fDe783fCc1C72d3Bb8C189414")));
83+
() -> getApi().contract()
84+
.contractCreation(Collections.singletonList("0xBBbc244D798123fDe783fCc1C72d3Bb8C189414")));
8585
}
8686
}

0 commit comments

Comments
 (0)