Skip to content

Commit c226c83

Browse files
committed
optimizations
1 parent 241a436 commit c226c83

File tree

21 files changed

+95
-93
lines changed

21 files changed

+95
-93
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ etherscan android api is an android wrapper for the [etherscan api](https://ethe
99

1010
There are only a few [features](https://github.com/EbenezerGH/hello_etherscan/issues) left to add, however this version is completely safe to use.
1111

12+
##### Note: For RxJava Implementation use master branch [etherscan-coroutines](https://github.com/EbenezerGH/etherscan-android-api
13+
1214
## Getting Started
1315

1416
Add JitPack to your root build.gradle at the end of repositories
@@ -27,7 +29,7 @@ Add the dependency
2729

2830
```
2931
dependencies {
30-
implementation 'com.github.EbenezerGH:etherscan-android-api:v1.0.3'
32+
implementation 'com.github.EbenezerGH:etherscan-android-api:v1.5.0'
3133
}
3234
```
3335

@@ -39,7 +41,7 @@ ApiKey.takeOff.setApiKey("1I7CRNU2QIU253UBPFVB5UV2C2PBDURAIYZ")
3941

4042
Create an Instance of one of the reactive singles and access values by specifying thread and subscribing. [see [example implementation](https://github.com/EbenezerGH/etherscan-android-api/blob/master/etherscan-sample/src/main/java/jfyg/etherscan/helloetherescan/SampleActivity.kt)]
4143

42-
Currently Available: ``[accounts, contracts, transactions, blocks, stat]``
44+
Currently Available: ``[accountsApi, contractsApi, transactionsApi, blocksApi, statApi]``
4345

4446
Coming Soon: ``[eventLogs, geth, websockets, tokens]``
4547

etherscan-sample/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ android {
2525
dependencies {
2626
implementation fileTree(dir: 'libs', include: ['*.jar'])
2727

28-
2928
/**
3029
Because RxAndroid releases are few and far between, it is recommended you also
3130
explicitly depend on RxJava's latest version for bug fixes and new features.
@@ -39,7 +38,7 @@ dependencies {
3938
// google
4039
implementation 'com.android.support:appcompat-v7:26.1.0'
4140
implementation 'com.android.support:design:26.1.0'
42-
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
41+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
4342

4443
implementation project(':etherscanapi')
4544
}

etherscan-sample/src/main/java/jfyg/etherscan/helloetherescan/SampleActivity.kt

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import android.support.v7.app.AppCompatActivity
55
import android.util.Log
66
import io.reactivex.android.schedulers.AndroidSchedulers
77
import io.reactivex.rxkotlin.subscribeBy
8-
import jfyg.data.account.Accounts
9-
import jfyg.data.block.Blocks
10-
import jfyg.data.contract.Contracts
11-
import jfyg.data.stat.Stats
12-
import jfyg.data.transaction.Transactions
8+
import jfyg.data.account.AccountsApi
9+
import jfyg.data.block.BlocksApi
10+
import jfyg.data.contract.ContractsApi
11+
import jfyg.data.stat.StatsApi
12+
import jfyg.data.transaction.TransactionsApi
1313
import kotlinx.android.synthetic.main.activity_main.*
1414

1515

@@ -22,11 +22,11 @@ class SampleActivity : AppCompatActivity() {
2222
setSupportActionBar(toolbar)
2323

2424
//************************************************ Used To Test Singles returned from etherscanapi Module
25-
val stat = Stats()
26-
val account = Accounts()
27-
val contract = Contracts()
28-
val tx = Transactions()
29-
val blocks = Blocks()
25+
val stat = StatsApi()
26+
val account = AccountsApi()
27+
val contract = ContractsApi()
28+
val tx = TransactionsApi()
29+
val blocks = BlocksApi()
3030

3131

3232
fab.setOnClickListener {

etherscanapi/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ android {
1515

1616
buildTypes {
1717
release {
18-
minifyEnabled true
18+
minifyEnabled false
1919
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2020
}
2121
debug {
@@ -30,7 +30,7 @@ dependencies {
3030
implementation fileTree(include: ['*.jar'], dir: 'libs')
3131

3232
// kotlin
33-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$project.kotlin_version"
33+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10'
3434

3535
// rx
3636
implementation "io.reactivex.rxjava2:rxkotlin:$project.reactivex_rxjava2_rxkotlin_version"
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package jfyg.data
22

3-
data class Balance(val account: String? = null,
3+
data class Balance(val account: String,
44

5-
val balance: String? = null)
5+
val balance: String)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package jfyg.data
22

3-
data class BlockAccount(val blockNumber: String? = null,
3+
data class BlockAccount(val blockNumber: String,
44

5-
val timeStamp: String? = null,
5+
val timeStamp: String,
66

7-
val blockReward: String? = null)
7+
val blockReward: String)
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package jfyg.data
22

3-
data class BlockMined(val blockNumber: String? = null,
3+
data class BlockMined(val blockNumber: String,
44

5-
val timeStamp: String? = null,
5+
val timeStamp: String,
66

7-
val blockMiner: String? = null,
7+
val blockMiner: String,
88

9-
val blockReward: String? = null,
9+
val blockReward: String,
1010

1111
val uncles: List<Uncle> = emptyList())

etherscanapi/src/main/java/jfyg/data/ERC20Token.kt

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@ package jfyg.data
22

33
import com.google.gson.annotations.SerializedName
44

5-
data class ERC20Token(val blockNumber: String? = null,
5+
data class ERC20Token(val blockNumber: String,
66

7-
val timeStamp: String? = null,
7+
val timeStamp: String,
88

9-
val hash: String? = null,
9+
val hash: String,
1010

11-
val nonce: String? = null,
11+
val nonce: String,
1212

13-
val blockHash: String? = null,
13+
val blockHash: String,
1414

1515
@SerializedName("from")
16-
val transactionFrom: String? = null,
16+
val transactionFrom: String,
1717

18-
val contractAddress: String? = null,
18+
val contractAddress: String,
1919

2020
@SerializedName("to")
21-
val transactionTo: String? = null,
21+
val transactionTo: String,
2222

23-
val value: String? = null,
23+
val value: String,
2424

25-
val tokenName: String? = null,
25+
val tokenName: String,
2626

27-
val tokenSymbol: String? = null,
27+
val tokenSymbol: String,
2828

29-
val tokenDecimal: String? = null,
29+
val tokenDecimal: String,
3030

31-
val transactionIndex: String? = null,
31+
val transactionIndex: String,
3232

33-
val gas: String? = null,
33+
val gas: String,
3434

35-
val gasPrice: String? = null,
35+
val gasPrice: String,
3636

37-
val gasUsed: String? = null,
37+
val gasUsed: String,
3838

39-
val cumulativeGasUsed: String? = null,
39+
val cumulativeGasUsed: String,
4040

41-
val input: String? = null,
41+
val input: String,
4242

43-
val confirmations: String? = null)
43+
val confirmations: String)

etherscanapi/src/main/java/jfyg/data/StatPrice.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package jfyg.data
33
import com.google.gson.annotations.SerializedName
44

55
data class StatPrice(@SerializedName("ethbtc")
6-
val ethBtc: String? = null,
6+
val ethBtc: String,
77

88
@SerializedName("ethbtc_timestamp")
9-
val ethBtcTimestamp: String? = null,
9+
val ethBtcTimestamp: String,
1010

1111
@SerializedName("ethusd")
12-
val ethUsd: String? = null,
12+
val ethUsd: String,
1313

1414
@SerializedName("ethusd_timestamp")
15-
val ethUsdTimestamp: String? = null
15+
val ethUsdTimestamp: String
1616
)

etherscanapi/src/main/java/jfyg/data/Tx.kt

+18-18
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@ package jfyg.data
22

33
import com.google.gson.annotations.SerializedName
44

5-
data class Tx(val blockNumber: String? = null,
5+
data class Tx(val blockNumber: String,
66

7-
val timeStamp: String? = null,
7+
val timeStamp: String,
88

9-
val hash: String? = null,
9+
val hash: String,
1010

11-
val nonce: String? = null,
11+
val nonce: String,
1212

13-
val blockHash: String? = null,
13+
val blockHash: String,
1414

15-
val transactionIndex: String? = null,
15+
val transactionIndex: String,
1616

1717
@SerializedName("from")
18-
val transactionFrom: String? = null,
18+
val transactionFrom: String,
1919

2020
@SerializedName("to")
21-
val transactionTo: String? = null,
21+
val transactionTo: String,
2222

23-
val value: String? = null,
23+
val value: String,
2424

25-
val gas: String? = null,
25+
val gas: String,
2626

27-
val gasPrice: String? = null,
27+
val gasPrice: String,
2828

29-
val isError: String? = null,
29+
val isError: String,
3030

3131
@SerializedName("txreceipt_status")
32-
val receiptStatus: String? = null,
32+
val receiptStatus: String,
3333

34-
val input: String? = null,
34+
val input: String,
3535

36-
val contractAddress: String? = null,
36+
val contractAddress: String,
3737

38-
val cumulativeGasUsed: String? = null,
38+
val cumulativeGasUsed: String,
3939

40-
val gasUsed: String? = null,
40+
val gasUsed: String,
4141

42-
val confirmations: String? = null)
42+
val confirmations: String)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package jfyg.data
22

3-
data class TxExecutionStatus(val isError: String? = null,
3+
data class TxExecutionStatus(val isError: String,
44

5-
val errDescription: String? = null)
5+
val errDescription: String
6+
)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package jfyg.data
22

3-
data class TxReceiptStatus(val status: String? = null)
3+
data class TxReceiptStatus(val status: String)

etherscanapi/src/main/java/jfyg/data/TxsInternal.kt

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@ package jfyg.data
22

33
import com.google.gson.annotations.SerializedName
44

5-
data class TxsInternal(val blockNumber: String? = null,
5+
data class TxsInternal(val blockNumber: String,
66

7-
val timeStamp: String? = null,
7+
val timeStamp: String,
88

9-
val hash: String? = null,
9+
val hash: String,
1010

1111
@SerializedName("from")
12-
val transactionFrom: String? = null,
12+
val transactionFrom: String,
1313

1414
@SerializedName("to")
15-
val transactionTo: String? = null,
15+
val transactionTo: String,
1616

17-
val value: String? = null,
17+
val value: String,
1818

19-
val contactAddress: String? = null,
19+
val contactAddress: String,
2020

21-
val input: String? = null,
21+
val input: String,
2222

23-
val type: String? = null,
23+
val type: String,
2424

25-
val gas: String? = null,
25+
val gas: String,
2626

27-
val gasUsed: String? = null,
27+
val gasUsed: String,
2828

29-
val traceId: String? = null,
29+
val traceId: String,
3030

31-
val isError: String? = null,
31+
val isError: String,
3232

33-
val errCode: String? = null)
33+
val errCode: String)

etherscanapi/src/main/java/jfyg/data/Uncle.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package jfyg.data
22

33
import com.google.gson.annotations.SerializedName
44

5-
data class Uncle(val miner: String? = null,
5+
data class Uncle(val miner: String,
66

7-
val unclePosition: String? = null,
7+
val unclePosition: String,
88

99
@SerializedName("blockreward")
10-
val blockReward: String? = null)
10+
val blockReward: String)

etherscanapi/src/main/java/jfyg/data/account/Accounts.kt renamed to etherscanapi/src/main/java/jfyg/data/account/AccountsApi.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import jfyg.utils.*
1212
/**
1313
* https://etherscan.io/apis#accounts
1414
*/
15-
class Accounts : AccountsContract {
15+
class AccountsApi : AccountsContract {
1616

1717
private val query = ApiQuery()
1818
private val genericNetworkQuery = query.accountBalance(

etherscanapi/src/main/java/jfyg/data/block/Blocks.kt renamed to etherscanapi/src/main/java/jfyg/data/block/BlocksApi.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import jfyg.utils.GET_BLOCK_REWARD
1010
/**
1111
* https://etherscan.io/apis#blocks
1212
*/
13-
class Blocks : BlocksContract {
13+
class BlocksApi : BlocksContract {
1414
private val query = ApiQuery()
1515
private val genericNetworkQuery = query.blocksMined(
1616
BLOCK,

etherscanapi/src/main/java/jfyg/data/contract/Contracts.kt renamed to etherscanapi/src/main/java/jfyg/data/contract/ContractsApi.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import jfyg.utils.GET_ABI
1010
* Newly verified Contracts are synced to the API servers within 5 minutes or less
1111
* https://etherscan.io/apis#contracts
1212
*/
13-
class Contracts : ContractsContract {
13+
class ContractsApi : ContractsContract {
1414

1515
private val query = ApiQuery()
1616
private val abiQuery = query.contractABI(

etherscanapi/src/main/java/jfyg/data/stat/Stats.kt renamed to etherscanapi/src/main/java/jfyg/data/stat/StatsApi.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import jfyg.utils.STATS
1010
/**
1111
* https://etherscan.io/apis#stats
1212
*/
13-
class Stats : StatsContract {
13+
class StatsApi : StatsContract {
1414

1515
private val query = ApiQuery()
1616
private val supplyQuery = query.statSupply(STATS, ETH_SUPPLY)

0 commit comments

Comments
 (0)