File tree Expand file tree Collapse file tree 3 files changed +22
-29
lines changed
etherscan-sample/src/main/java/jfyg/etherscan/helloetherescan
etherscanapi/src/main/java/jfyg Expand file tree Collapse file tree 3 files changed +22
-29
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,18 @@ class SampleActivity : AppCompatActivity() {
3535 stat.getEtherStatistics()
3636 .observeOn(AndroidSchedulers .mainThread())
3737 .subscribeBy(
38- onSuccess = { Log .d(TAG , " The current price of Ether in Btc: ${it.ethUsd} " ) },
38+ onSuccess = { Log .d(TAG , " The current price of Ether in Usd: ${it.ethUsd} " ) },
39+ onError = { Log .d(TAG , " error receiving stat" ) })
40+
41+
42+ // account MultiBalance test
43+ account.getMultiBalance(listOf (
44+ " 0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413" ,
45+ " 0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413" ,
46+ " 0x4e83362442b8d1bec281594cea3050c8eb01311c" ))
47+ .observeOn(AndroidSchedulers .mainThread())
48+ .subscribeBy(
49+ onSuccess = { Log .d(TAG , " The current balance in account 2 is: ${it[1 ].balance} " ) },
3950 onError = { Log .d(TAG , " error receiving stat" ) })
4051
4152
Original file line number Diff line number Diff line change @@ -7,20 +7,7 @@ import jfyg.data.ERC20Token
77import jfyg.data.Tx
88import jfyg.data.TxsInternal
99import jfyg.network.queries.ApiQuery
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
10+ import jfyg.utils.*
2411
2512/* *
2613 * https://etherscan.io/apis#accounts
@@ -51,7 +38,7 @@ class Accounts : AccountsContract {
5138 Single <List <Balance >> = query.accountMultiBalance(
5239 ACCOUNT ,
5340 BALANCE_MULTI ,
54- QueryUtils . retrieveList(addresses),
41+ retrieveList(addresses),
5542 LATEST ).map { it.result }
5643
5744 /* *
Original file line number Diff line number Diff line change 11package jfyg.utils
22
33/* *
4- * Utilities that may be used to provide successful Queries
4+ * Retrieve a list of mulitple items
55 */
6- internal object QueryUtils {
7- /* *
8- * Retrieve a list of mulitple items
9- */
10- fun retrieveList (listItems : List <String >? ): String {
6+ internal fun retrieveList (listItems : List <String >? ): String {
117
12- var getList = " "
8+ var getList = " "
139
14- for (item in listItems!! ) {
15- getList + = item + " ,"
16- }
17-
18- return getList.dropLast(1 )
10+ for (item in listItems!! ) {
11+ getList + = item + " ,"
1912 }
20- }
13+
14+ return getList.dropLast(1 )
15+ }
You can’t perform that action at this time.
0 commit comments