Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit47e04a8

Browse files
committed
[2.0.0-SNAPSHOT]
EthSupply for StatisticAPI#supplyTotal addedJavadoc fixed
1 parent25751ab commit47e04a8

21 files changed

+250
-73
lines changed

‎src/main/java/io/goodforgod/api/etherscan/AccountAPI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importorg.jetbrains.annotations.NotNull;
77

88
/**
9-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#accounts">...</a>
9+
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/accounts">...</a>
1010
*
1111
* @author GoodforGod
1212
* @since 28.10.2018

‎src/main/java/io/goodforgod/api/etherscan/AccountAPIProvider.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public Balance balance(String address) throws EtherScanException {
6464
if (response.getStatus() !=1)
6565
thrownewEtherScanResponseException(response);
6666

67-
returnnewBalance(address,newWei(newBigInteger(response.getResult())));
67+
returnnewBalance(address,Wei.ofWei(newBigInteger(response.getResult())));
6868
}
6969

7070
@NotNull
@@ -78,7 +78,7 @@ public TokenBalance balance(String address, String contract) throws EtherScanExc
7878
if (response.getStatus() !=1)
7979
thrownewEtherScanResponseException(response);
8080

81-
returnnewTokenBalance(address,newWei(newBigInteger(response.getResult())),contract);
81+
returnnewTokenBalance(address,Wei.ofWei(newBigInteger(response.getResult())),contract);
8282
}
8383

8484
@NotNull
@@ -101,7 +101,7 @@ public List<Balance> balances(List<String> addresses) throws EtherScanException
101101

102102
if (!BasicUtils.isEmpty(response.getResult()))
103103
balances.addAll(response.getResult().stream()
104-
.map(r ->newBalance(r.getAccount(),newWei(newBigInteger(r.getBalance()))))
104+
.map(r ->newBalance(r.getAccount(),Wei.ofWei(newBigInteger(r.getBalance()))))
105105
.collect(Collectors.toList()));
106106
}
107107

‎src/main/java/io/goodforgod/api/etherscan/BlockAPI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importorg.jetbrains.annotations.NotNull;
77

88
/**
9-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#blocks">...</a>
9+
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/blocks">...</a>
1010
*
1111
* @author GoodforGod
1212
* @since 30.10.2018

‎src/main/java/io/goodforgod/api/etherscan/ContractAPI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importorg.jetbrains.annotations.NotNull;
66

77
/**
8-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#contracts">...</a>
8+
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/contracts">...</a>
99
*
1010
* @author GoodforGod
1111
* @since 28.10.2018

‎src/main/java/io/goodforgod/api/etherscan/LogsAPI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importorg.jetbrains.annotations.NotNull;
88

99
/**
10-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#logs">...</a>
10+
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/logs">...</a>
1111
*
1212
* @author GoodforGod
1313
* @since 30.10.2018

‎src/main/java/io/goodforgod/api/etherscan/ProxyAPI.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
importorg.jetbrains.annotations.NotNull;
1111

1212
/**
13-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#proxy">...</a>
13+
* EtherScan - API Descriptions
14+
* <a href="https://docs.etherscan.io/api-endpoints/geth-parity-proxy">...</a>
1415
*
1516
* @author GoodforGod
1617
* @since 30.10.2018

‎src/main/java/io/goodforgod/api/etherscan/ProxyAPIProvider.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ public Optional<String> storageAt(String address, long position) throws EtherSca
208208
publicWeigasPrice()throwsEtherScanException {
209209
finalStringProxyTOresponse =getRequest(ACT_GASPRICE_PARAM,StringProxyTO.class);
210210
return (BasicUtils.isEmpty(response.getResult()))
211-
?newWei(0)
212-
:newWei(BasicUtils.parseHex(response.getResult()));
211+
?Wei.ofWei(0)
212+
:Wei.ofWei(BasicUtils.parseHex(response.getResult()));
213213
}
214214

215215
@NotNull
@@ -227,7 +227,7 @@ public Wei gasEstimated(String hexData) throws EtherScanException {
227227
finalStringurlParams =ACT_ESTIMATEGAS_PARAM +DATA_PARAM +hexData +GAS_PARAM +"2000000000000000";
228228
finalStringProxyTOresponse =getRequest(urlParams,StringProxyTO.class);
229229
return (BasicUtils.isEmpty(response.getResult()))
230-
?newWei(0)
231-
:newWei(BasicUtils.parseHex(response.getResult()));
230+
?Wei.ofWei(0)
231+
:Wei.ofWei(BasicUtils.parseHex(response.getResult()));
232232
}
233233
}
Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
packageio.goodforgod.api.etherscan;
22

33
importio.goodforgod.api.etherscan.error.EtherScanException;
4+
importio.goodforgod.api.etherscan.model.EthSupply;
45
importio.goodforgod.api.etherscan.model.Price;
5-
importio.goodforgod.api.etherscan.model.Supply;
6-
importjava.math.BigInteger;
6+
importio.goodforgod.api.etherscan.model.Wei;
77
importorg.jetbrains.annotations.NotNull;
88

99
/**
10-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#stats">...</a>
10+
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/stats-1">...</a>
1111
*
1212
* @author GoodforGod
1313
* @since 30.10.2018
@@ -16,22 +16,35 @@ public interface StatisticAPI {
1616

1717
/**
1818
* ERC20 token total Supply
19-
*
19+
* <a href=
20+
* "https://docs.etherscan.io/api-endpoints/tokens#get-erc20-token-totalsupply-by-contractaddress">EtherScan<a>
21+
*
2022
* @param contract contract address
2123
* @return token supply for specified contract
2224
* @throws EtherScanException parent exception class
2325
*/
2426
@NotNull
25-
BigIntegersupply(Stringcontract)throwsEtherScanException;
27+
Weisupply(Stringcontract)throwsEtherScanException;
2628

2729
/**
28-
* Eth total supply
30+
* Returns the current amount of Ether in circulation excluding ETH2 Staking rewards and EIP1559
31+
* burnt fees.
2932
*
3033
* @return total ETH supply for moment
3134
* @throws EtherScanException parent exception class
3235
*/
3336
@NotNull
34-
Supplysupply()throwsEtherScanException;
37+
Weisupply()throwsEtherScanException;
38+
39+
/**
40+
* Returns the current amount of Ether in circulation, ETH2 Staking rewards, EIP1559 burnt fees, and
41+
* total withdrawn ETH from the beacon chain.
42+
*
43+
* @return total ETH supply for moment
44+
* @throws EtherScanException parent exception class
45+
*/
46+
@NotNull
47+
EthSupplysupplyTotal()throwsEtherScanException;
3548

3649
/**
3750
* Eth last USD and BTC price
@@ -40,5 +53,5 @@ public interface StatisticAPI {
4053
* @throws EtherScanException parent exception class
4154
*/
4255
@NotNull
43-
PricelastPrice()throwsEtherScanException;
56+
PricepriceLast()throwsEtherScanException;
4457
}

‎src/main/java/io/goodforgod/api/etherscan/StatisticAPIProvider.java‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
importio.goodforgod.api.etherscan.error.EtherScanResponseException;
55
importio.goodforgod.api.etherscan.http.EthHttpClient;
66
importio.goodforgod.api.etherscan.manager.RequestQueueManager;
7+
importio.goodforgod.api.etherscan.model.EthSupply;
78
importio.goodforgod.api.etherscan.model.Price;
8-
importio.goodforgod.api.etherscan.model.Supply;
9+
importio.goodforgod.api.etherscan.model.Wei;
10+
importio.goodforgod.api.etherscan.model.response.EthSupplyResponseTO;
911
importio.goodforgod.api.etherscan.model.response.PriceResponseTO;
1012
importio.goodforgod.api.etherscan.model.response.StringResponseTO;
1113
importio.goodforgod.api.etherscan.util.BasicUtils;
@@ -22,6 +24,7 @@
2224
finalclassStatisticAPIProviderextendsBasicProviderimplementsStatisticAPI {
2325

2426
privatestaticfinalStringACT_SUPPLY_PARAM =ACT_PREFIX +"ethsupply";
27+
privatestaticfinalStringACT_SUPPLY2_PARAM =ACT_PREFIX +"ethsupply2";
2528
privatestaticfinalStringACT_TOKEN_SUPPLY_PARAM =ACT_PREFIX +"tokensupply";
2629
privatestaticfinalStringACT_LASTPRICE_PARAM =ACT_PREFIX +"ethprice";
2730

@@ -36,30 +39,39 @@ final class StatisticAPIProvider extends BasicProvider implements StatisticAPI {
3639

3740
@NotNull
3841
@Override
39-
publicSupplysupply()throwsEtherScanException {
42+
publicWeisupply()throwsEtherScanException {
4043
finalStringResponseTOresponse =getRequest(ACT_SUPPLY_PARAM,StringResponseTO.class);
4144
if (response.getStatus() !=1)
4245
thrownewEtherScanResponseException(response);
4346

44-
returnnewSupply(newBigInteger(response.getResult()));
47+
returnWei.ofWei(newBigInteger(response.getResult()));
48+
}
49+
50+
@Override
51+
public@NotNullEthSupplysupplyTotal()throwsEtherScanException {
52+
finalEthSupplyResponseTOresponse =getRequest(ACT_SUPPLY2_PARAM,EthSupplyResponseTO.class);
53+
if (response.getStatus() !=1)
54+
thrownewEtherScanResponseException(response);
55+
56+
returnresponse.getResult();
4557
}
4658

4759
@NotNull
4860
@Override
49-
publicBigIntegersupply(Stringcontract)throwsEtherScanException {
61+
publicWeisupply(Stringcontract)throwsEtherScanException {
5062
BasicUtils.validateAddress(contract);
5163

5264
finalStringurlParams =ACT_TOKEN_SUPPLY_PARAM +CONTRACT_ADDRESS_PARAM +contract;
5365
finalStringResponseTOresponse =getRequest(urlParams,StringResponseTO.class);
5466
if (response.getStatus() !=1)
5567
thrownewEtherScanResponseException(response);
5668

57-
returnnewBigInteger(response.getResult());
69+
returnWei.ofWei(newBigInteger(response.getResult()));
5870
}
5971

6072
@NotNull
6173
@Override
62-
publicPricelastPrice()throwsEtherScanException {
74+
publicPricepriceLast()throwsEtherScanException {
6375
finalPriceResponseTOresponse =getRequest(ACT_LASTPRICE_PARAM,PriceResponseTO.class);
6476
if (response.getStatus() !=1)
6577
thrownewEtherScanResponseException(response);

‎src/main/java/io/goodforgod/api/etherscan/TransactionAPI.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importorg.jetbrains.annotations.NotNull;
77

88
/**
9-
* EtherScan - API Descriptions <a href="https://etherscan.io/apis#transactions">...</a>
9+
* EtherScan - API Descriptions <a href="https://docs.etherscan.io/api-endpoints/stats">...</a>
1010
*
1111
* @author GoodforGod
1212
* @since 30.10.2018

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp