@@ -7,8 +7,20 @@ import jfyg.data.ERC20Token
7
7
import jfyg.data.Tx
8
8
import jfyg.data.TxsInternal
9
9
import jfyg.network.queries.ApiQuery
10
- import jfyg.utils.Const
11
10
import jfyg.utils.QueryUtils
11
+ import jfyg.utils.ACCOUNT
12
+ import jfyg.utils.ASC
13
+ import jfyg.utils.BALANCE
14
+ import jfyg.utils.BALANCE_MULTI
15
+ import jfyg.utils.BLOCKS
16
+ import jfyg.utils.END_BLOCK
17
+ import jfyg.utils.GENERIC_PUBLIC_ADDRESS
18
+ import jfyg.utils.GET_MINED_BLOCKS
19
+ import jfyg.utils.LATEST
20
+ import jfyg.utils.START_BLOCK
21
+ import jfyg.utils.TOKEN_TX
22
+ import jfyg.utils.TX_LIST
23
+ import jfyg.utils.TX_LIST_INTERNAL
12
24
13
25
/* *
14
26
* https://etherscan.io/apis#accounts
@@ -17,76 +29,77 @@ class Accounts : AccountsContract {
17
29
18
30
private val query = ApiQuery ()
19
31
private val genericNetworkQuery = query.accountBalance(
20
- Const . ACCOUNT ,
21
- Const . BALANCE ,
22
- Const . GENERIC_PUBLIC_ADDRESS ,
23
- Const . LATEST )
32
+ ACCOUNT ,
33
+ BALANCE ,
34
+ GENERIC_PUBLIC_ADDRESS ,
35
+ LATEST )
24
36
25
37
/* *
26
38
* Get Ether Balance for a single Address
27
39
*/
28
- override fun getBalance (address : String? ):
40
+ override fun getBalance (address : String ):
29
41
Single <Double > = query.accountBalance(
30
- Const . ACCOUNT ,
31
- Const . BALANCE ,
42
+ ACCOUNT ,
43
+ BALANCE ,
32
44
address,
33
- Const . LATEST ).map { it.result?.toDouble() }
45
+ LATEST ).map { it.result?.toDouble() }
34
46
35
47
/* *
36
48
* Get Ether Balance for multiple Addresses in a single call
37
49
*/
38
- override fun getMultiBalance (addresses : List <String >? ):
50
+ override fun getMultiBalance (addresses : List <String >):
39
51
Single <List <Balance >> = query.accountMultiBalance(
40
- Const . ACCOUNT ,
41
- Const . BALANCE_MULTI ,
52
+ ACCOUNT ,
53
+ BALANCE_MULTI ,
42
54
QueryUtils .retrieveList(addresses),
43
- Const . LATEST ).map { it.result }
55
+ LATEST ).map { it.result }
44
56
45
57
/* *
46
58
* Get list of blocks mined by address
47
59
*/
48
- override fun getBlocks (address : String? ):
60
+ override fun getBlocks (address : String ):
49
61
Single <List <BlockAccount >> = query.accountBlock(
50
- Const . ACCOUNT ,
51
- Const . GET_MINED_BLOCKS ,
62
+ ACCOUNT ,
63
+ GET_MINED_BLOCKS ,
52
64
address,
53
- Const . BLOCKS ).map { it.result }
65
+ BLOCKS ).map { it.result }
54
66
55
67
/* *
56
68
* Get a list of 'Normal' Transactions By Address
57
69
*/
58
- override fun getTransactions (address : String? ):
59
- Single <List <Tx >> = query.accountTxs(Const .ACCOUNT ,
60
- Const .TX_LIST ,
70
+ override fun getTransactions (address : String ):
71
+ Single <List <Tx >> = query.accountTxs(
72
+ ACCOUNT ,
73
+ TX_LIST ,
61
74
address,
62
- Const . START_BLOCK ,
63
- Const . END_BLOCK ,
64
- Const . ASC ).map { it.result }
75
+ START_BLOCK ,
76
+ END_BLOCK ,
77
+ ASC ).map { it.result }
65
78
66
79
/* *
67
80
* [BETA] Get a list of "ERC20 - Token Transfer Events" by Address
68
81
*/
69
- override fun getERC20Tokens (address : String? ):
82
+ override fun getERC20Tokens (address : String ):
70
83
Single <List <ERC20Token >> = query.accountERC20Txs(
71
- Const . ACCOUNT ,
72
- Const . TOKEN_TX ,
84
+ ACCOUNT ,
85
+ TOKEN_TX ,
73
86
address,
74
- Const . START_BLOCK ,
75
- Const . END_BLOCK ,
76
- Const . ASC ).map { it.result }
87
+ START_BLOCK ,
88
+ END_BLOCK ,
89
+ ASC ).map { it.result }
77
90
78
91
79
92
/* *
80
93
* [BETA] Get a list of 'Internal' Transactions by Address
81
94
*/
82
- override fun getInternalTransactions (address : String? ):
95
+ override fun getInternalTransactions (address : String ):
83
96
Single <List <TxsInternal >> = query.accountInternalTxs(
84
- Const . ACCOUNT ,
85
- Const . TX_LIST_INTERNAL ,
97
+ ACCOUNT ,
98
+ TX_LIST_INTERNAL ,
86
99
address,
87
- Const . START_BLOCK ,
88
- Const . END_BLOCK ,
89
- Const . ASC ).map { it.result }
100
+ START_BLOCK ,
101
+ END_BLOCK ,
102
+ ASC ).map { it.result }
90
103
91
104
/* *
92
105
* Return network status
0 commit comments