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

Commit1f76be1

Browse files
committed
Account provider in progress
1 parent13b9f09 commit1f76be1

File tree

8 files changed

+270
-12
lines changed

8 files changed

+270
-12
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
packageio.api.core;
2+
3+
/**
4+
* ! NO DESCRIPTION !
5+
*
6+
* @author GoodforGod
7+
* @since 28.10.2018
8+
*/
9+
publicabstractclassBasicProvider {
10+
11+
protectedfinalStringurl;
12+
13+
publicBasicProvider(finalStringmodule,
14+
finalStringapiKey) {
15+
this.url ="https://api.etherscan.io/api?module=" +module +"&apikey=" +apiKey +"&action=";
16+
}
17+
18+
19+
}

‎src/main/java/io/api/core/account/AccountProvider.java‎

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
packageio.api.core.account;
2+
3+
importio.api.model.Balance;
4+
importio.api.model.Transaction;
5+
6+
importjava.util.List;
7+
importjava.util.Optional;
8+
9+
/**
10+
* EtherScan - API Descriptions
11+
* https://etherscan.io/apis#accounts
12+
*
13+
* @author GoodforGod
14+
* @since 28.10.2018
15+
*/
16+
publicinterfaceIAccountProvider {
17+
18+
Optional<Balance>balance(Stringaddress);
19+
20+
/**
21+
* Maximum 20 address for batch request
22+
* If address > 20, then there will be more than 1 request
23+
*/
24+
List<Balance>balances(List<String>addresses);
25+
26+
/** All transactions */
27+
List<Transaction>transactions(Stringaddress);
28+
/** Only last 10000 transactions */
29+
List<Transaction>transactions(Stringaddress,intstartBlock);
30+
/** Only last 10000 transactions */
31+
List<Transaction>transactions(Stringaddress,intstartBlock,intendBlock);
32+
33+
/** All internal transactions */
34+
List<Transaction>transactionsInternal(Stringaddress);
35+
/** Only last 10000 transactions */
36+
List<Transaction>transactionsInternal(Stringaddress,intstartBlock);
37+
/** Only last 10000 transactions */
38+
List<Transaction>transactionsInternal(Stringaddress,intstartBlock,intendBlock);
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
packageio.api.core.account.impl;
2+
3+
importio.api.core.BasicProvider;
4+
5+
/**
6+
* ! NO DESCRIPTION !
7+
*
8+
* @author GoodforGod
9+
* @since 28.10.2018
10+
*/
11+
publicclassAccountProviderextendsBasicProvider {
12+
13+
publicAccountProvider(finalStringapiKey) {
14+
super("account",apiKey);
15+
}
16+
}

‎src/main/java/io/api/core/contract/ContractProvider.java‎renamed to ‎src/main/java/io/api/core/contract/IContractProvider.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
* @author GoodforGod
77
* @since 28.10.2018
88
*/
9-
publicclassContractProvider {
9+
publicinterfaceIContractProvider {
1010

1111
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
packageio.api.core.contract.impl;
2+
3+
importio.api.core.BasicProvider;
4+
importio.api.core.contract.IContractProvider;
5+
6+
/**
7+
* ! NO DESCRIPTION !
8+
*
9+
* @author GoodforGod
10+
* @since 28.10.2018
11+
*/
12+
publicclassContractProviderextendsBasicProviderimplementsIContractProvider {
13+
14+
publicContractProvider(finalStringapiKey) {
15+
super("contract",apiKey);
16+
}
17+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
packageio.api.model;
2+
3+
/**
4+
* ! NO DESCRIPTION !
5+
*
6+
* @author GoodforGod
7+
* @since 28.10.2018
8+
*/
9+
publicclassBalance {
10+
11+
/** Balance in Wei */
12+
privatefinallongbalance;
13+
privatefinalStringaddress;
14+
15+
publicBalance(finalStringaddress,
16+
finallongbalance) {
17+
this.address =address;
18+
this.balance =balance;
19+
}
20+
21+
publicStringgetAddress() {
22+
returnaddress;
23+
}
24+
25+
publiclonggetWei() {
26+
returnbalance;
27+
}
28+
29+
publicdoublegetKwei() {
30+
returnbalance /1000;
31+
}
32+
33+
publicdoublegetMwei() {
34+
returnbalance /1000000;
35+
}
36+
37+
publicdoublegetGwei() {
38+
returnbalance /1000000000;
39+
}
40+
41+
publicdoublegetEther() {
42+
returnbalance /1000000000000000L;
43+
}
44+
45+
@Override
46+
publicbooleanequals(Objecto) {
47+
if (this ==o)returntrue;
48+
if (o ==null ||getClass() !=o.getClass())returnfalse;
49+
50+
Balancebalance1 = (Balance)o;
51+
52+
if (Double.compare(balance1.balance,balance) !=0)returnfalse;
53+
returnaddress.equals(balance1.address);
54+
}
55+
56+
@Override
57+
publicinthashCode() {
58+
intresult;
59+
longtemp;
60+
result =address.hashCode();
61+
temp =Double.doubleToLongBits(balance);
62+
result =31 *result + (int) (temp ^ (temp >>>32));
63+
returnresult;
64+
}
65+
66+
@Override
67+
publicStringtoString() {
68+
return"Balance{" +
69+
"address='" +address +'\'' +
70+
", balance=" +balance +
71+
'}';
72+
}
73+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
packageio.api.model;
2+
3+
/**
4+
* ! NO DESCRIPTION !
5+
*
6+
* @author GoodforGod
7+
* @since 28.10.2018
8+
*/
9+
publicclassTransaction {
10+
11+
privateStringblockNumber;
12+
privateStringblockHash;
13+
privateStringtimeStamp;
14+
privateStringhash;
15+
privateStringnonce;
16+
privateStringconfirmations;
17+
18+
privateStringtxreceipt_status;
19+
privateStringtransactionIndex;
20+
privateStringfrom;
21+
privateStringto;
22+
privateStringvalue;
23+
24+
privateStringgas;
25+
privateStringgasPrice;
26+
privateStringgasUsed;
27+
privateStringcumulativeGasUsed;
28+
privatebooleanisError;
29+
privateStringinput;
30+
privateStringcontractAddress;
31+
32+
//<editor-fold desc="Getters">
33+
publicStringgetBlockNumber() {
34+
returnblockNumber;
35+
}
36+
37+
publicStringgetBlockHash() {
38+
returnblockHash;
39+
}
40+
41+
publicStringgetTimeStamp() {
42+
returntimeStamp;
43+
}
44+
45+
publicStringgetHash() {
46+
returnhash;
47+
}
48+
49+
publicStringgetNonce() {
50+
returnnonce;
51+
}
52+
53+
publicStringgetConfirmations() {
54+
returnconfirmations;
55+
}
56+
57+
publicStringgetTxreceipt_status() {
58+
returntxreceipt_status;
59+
}
60+
61+
publicStringgetTransactionIndex() {
62+
returntransactionIndex;
63+
}
64+
65+
publicStringgetFrom() {
66+
returnfrom;
67+
}
68+
69+
publicStringgetTo() {
70+
returnto;
71+
}
72+
73+
publicStringgetValue() {
74+
returnvalue;
75+
}
76+
77+
publicStringgetGas() {
78+
returngas;
79+
}
80+
81+
publicStringgetGasPrice() {
82+
returngasPrice;
83+
}
84+
85+
publicStringgetGasUsed() {
86+
returngasUsed;
87+
}
88+
89+
publicStringgetCumulativeGasUsed() {
90+
returncumulativeGasUsed;
91+
}
92+
93+
publicbooleangetIsError() {
94+
returnisError;
95+
}
96+
97+
publicStringgetInput() {
98+
returninput;
99+
}
100+
101+
publicStringgetContractAddress() {
102+
returncontractAddress;
103+
}
104+
//</editor-fold>
105+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp