Skip to content

Commit 412f6d0

Browse files
committed
Merge branch 'dev'
2 parents 4387a5b + b123e74 commit 412f6d0

File tree

65 files changed

+2930
-539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2930
-539
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ project build.gradle
2424
```groovy
2525
2626
ext {
27-
minterBlockchainSDK = "0.4.0"
27+
minterBlockchainSDK = "0.5.0"
2828
}
2929
3030
dependencies {

RELEASE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Release notes
22

3+
## 0.5.0
4+
- BREAKING:
5+
- New api methods, some fields are removed/partly moved to another place due blockchain api has been changed.
6+
- Fixed conversion from double to BigDecimal - now only through the string. Don't do this: `new BigDecimal(0.1d)` - it leads too much garbage
7+
- Added support for new types of transaction:
8+
- Create multisig address (transaction for creating multisignature address)
9+
- Multisend (single transaction for sending coins to multiple addresses)
10+
- Edit candidate (transaction for editing existing candidate)
11+
- Added missing endpoints and repositories
12+
- More tests (still without mocks. Soon...)
13+
14+
315
## 0.4.0
416
- BREAKING:
517
- Added Min/MaxValueToBuy to Sell/SellAll/Buy coin model and it's all required

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) by MinterTeam. 2018
2+
* Copyright (C) by MinterTeam. 2019
33
* @link <a href="https://github.com/MinterTeam">Org Github</a>
44
* @link <a href="https://github.com/edwardstock">Maintainer Github</a>
55
*
@@ -58,14 +58,14 @@ apply plugin: 'com.jfrog.bintray'
5858

5959

6060
group = 'network.minter.android'
61-
version = '0.4.0'
61+
version = '0.5.0'
6262

6363
ext {
6464
minterMinSdk = 16
6565
minterMaxSdk = 28
6666
minterBuildTools = "28.0.3"
6767
minterLibSupport = "28.0.0"
68-
minterCoreVers = "0.2.1"
68+
minterCoreVers = "0.2.2"
6969

7070

7171
buildArtifactName = project.name

scripts

src/androidTest/java/network/minter/blockchain/models/BaseApiTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.junit.Before;
3333

3434
import network.minter.core.MinterSDK;
35+
import network.minter.core.internal.exceptions.NativeLoadException;
3536
import network.minter.core.internal.log.Mint;
3637
import network.minter.core.internal.log.StdLogger;
3738

@@ -42,7 +43,11 @@
4243
public class BaseApiTest {
4344

4445
static {
45-
MinterSDK.initialize();
46+
try {
47+
MinterSDK.initialize();
48+
} catch (NativeLoadException e) {
49+
e.printStackTrace();
50+
}
4651
//noinspection ConstantConditions
4752
Mint.brew(new StdLogger());
4853
}

src/main/java/network/minter/blockchain/MinterBlockChainApi.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,22 @@
3333
import javax.annotation.Nonnull;
3434

3535
import network.minter.blockchain.repo.BlockChainAccountRepository;
36+
import network.minter.blockchain.repo.BlockChainBlockRepository;
37+
import network.minter.blockchain.repo.BlockChainCandidateRepository;
3638
import network.minter.blockchain.repo.BlockChainCoinRepository;
39+
import network.minter.blockchain.repo.BlockChainEventRepository;
40+
import network.minter.blockchain.repo.BlockChainStatusRepository;
3741
import network.minter.blockchain.repo.BlockChainTransactionRepository;
3842
import network.minter.core.crypto.BytesData;
3943
import network.minter.core.crypto.MinterAddress;
4044
import network.minter.core.crypto.MinterHash;
45+
import network.minter.core.crypto.MinterPublicKey;
4146
import network.minter.core.internal.api.ApiService;
4247
import network.minter.core.internal.api.converters.BigIntegerDeserializer;
4348
import network.minter.core.internal.api.converters.BytesDataDeserializer;
4449
import network.minter.core.internal.api.converters.MinterAddressDeserializer;
4550
import network.minter.core.internal.api.converters.MinterHashDeserializer;
51+
import network.minter.core.internal.api.converters.MinterPublicKeyDeserializer;
4652
import network.minter.core.internal.log.Mint;
4753
import network.minter.core.internal.log.TimberLogger;
4854
import okhttp3.logging.HttpLoggingInterceptor;
@@ -58,6 +64,10 @@ public class MinterBlockChainApi {
5864
private BlockChainAccountRepository mAccountRepository;
5965
private BlockChainCoinRepository mCoinRepository;
6066
private BlockChainTransactionRepository mTransactionRepository;
67+
private BlockChainBlockRepository mBlockRepository;
68+
private BlockChainCandidateRepository mBlockChainCandidateRepository;
69+
private BlockChainStatusRepository mStatusRepository;
70+
private BlockChainEventRepository mEventRepository;
6171

6272
private MinterBlockChainApi() {
6373
this(BASE_NODE_URL);
@@ -93,6 +103,10 @@ public static void initialize(boolean debug) {
93103
initialize(BASE_NODE_URL, debug, new TimberLogger());
94104
}
95105

106+
public static void initialize(String baseNodeApiUrl) {
107+
initialize(baseNodeApiUrl, false, new TimberLogger());
108+
}
109+
96110
public static MinterBlockChainApi getInstance() {
97111
return INSTANCE;
98112
}
@@ -103,10 +117,43 @@ public GsonBuilder getGsonBuilder() {
103117
out.registerTypeAdapter(MinterHash.class, new MinterHashDeserializer());
104118
out.registerTypeAdapter(BigInteger.class, new BigIntegerDeserializer());
105119
out.registerTypeAdapter(BytesData.class, new BytesDataDeserializer());
120+
out.registerTypeAdapter(MinterPublicKey.class, new MinterPublicKeyDeserializer());
106121

107122
return out;
108123
}
109124

125+
public BlockChainEventRepository event() {
126+
if (mEventRepository == null) {
127+
mEventRepository = new BlockChainEventRepository(mApiService);
128+
}
129+
130+
return mEventRepository;
131+
}
132+
133+
public BlockChainStatusRepository status() {
134+
if (mStatusRepository == null) {
135+
mStatusRepository = new BlockChainStatusRepository(mApiService);
136+
}
137+
138+
return mStatusRepository;
139+
}
140+
141+
public BlockChainCandidateRepository candidate() {
142+
if (mBlockChainCandidateRepository == null) {
143+
mBlockChainCandidateRepository = new BlockChainCandidateRepository(mApiService);
144+
}
145+
146+
return mBlockChainCandidateRepository;
147+
}
148+
149+
public BlockChainBlockRepository block() {
150+
if (mBlockRepository == null) {
151+
mBlockRepository = new BlockChainBlockRepository(mApiService);
152+
}
153+
154+
return mBlockRepository;
155+
}
156+
110157
public BlockChainAccountRepository account() {
111158
if (mAccountRepository == null) {
112159
mAccountRepository = new BlockChainAccountRepository(mApiService);

src/main/java/network/minter/blockchain/api/BlockChainAccountEndpoint.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) by MinterTeam. 2018
2+
* Copyright (C) by MinterTeam. 2019
33
* @link <a href="https://github.com/MinterTeam">Org Github</a>
44
* @link <a href="https://github.com/edwardstock">Maintainer Github</a>
55
*
@@ -26,17 +26,14 @@
2626

2727
package network.minter.blockchain.api;
2828

29-
import java.util.Map;
30-
3129
import network.minter.blockchain.models.BCResult;
3230
import network.minter.blockchain.models.Balance;
3331
import network.minter.blockchain.models.CountableData;
3432
import network.minter.blockchain.models.TransactionSendResult;
3533
import retrofit2.Call;
36-
import retrofit2.http.Body;
3734
import retrofit2.http.GET;
38-
import retrofit2.http.POST;
3935
import retrofit2.http.Path;
36+
import retrofit2.http.Query;
4037

4138
/**
4239
* minter-android-blockchain. 2018
@@ -49,24 +46,24 @@ public interface BlockChainAccountEndpoint {
4946
* @param address Address of an account
5047
* @return
5148
*/
52-
@GET("/api/balance/{address}")
49+
@GET("/balance/{address}")
5350
Call<BCResult<Balance>> getBalance(@Path("address") String address);
5451

5552
/**
5653
* Returns count of outgoing transactions from given account
5754
* @param address Address of an account
5855
* @return
5956
*/
60-
@GET("/api/transactionCount/{address}")
57+
@GET("/transactionCount/{address}")
6158
Call<BCResult<CountableData>> getTransactionCount(@Path("address") String address);
6259

6360
/**
6461
* Broadcasts transaction onto Minter network
6562
* @param data
6663
* @return
6764
*/
68-
@POST("/api/sendTransaction")
69-
Call<BCResult<TransactionSendResult>> sendTransaction(@Body Map<String, String> data);
65+
@GET("/send_transaction")
66+
Call<BCResult<TransactionSendResult>> sendTransaction(@Query("tx") String signedTxHash);
7067

7168

7269
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package network.minter.blockchain.api;
2+
3+
import network.minter.blockchain.models.BCResult;
4+
import network.minter.blockchain.models.BlockInfo;
5+
import retrofit2.Call;
6+
import retrofit2.http.GET;
7+
import retrofit2.http.Query;
8+
9+
/**
10+
* minter-android-blockchain. 2019
11+
* @author Eduard Maximovich [edward.vstock@gmail.com]
12+
*/
13+
public interface BlockChainBlockEndpoint {
14+
15+
@GET("/block")
16+
Call<BCResult<BlockInfo>> getByHeight(@Query("height") long height);
17+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package network.minter.blockchain.api;
2+
3+
import java.util.List;
4+
5+
import network.minter.blockchain.models.BCResult;
6+
import network.minter.blockchain.models.CandidateItem;
7+
import network.minter.blockchain.models.CandidateStatus;
8+
import retrofit2.Call;
9+
import retrofit2.http.GET;
10+
import retrofit2.http.Query;
11+
12+
/**
13+
* minter-android-blockchain. 2019
14+
* @author Eduard Maximovich [edward.vstock@gmail.com]
15+
*/
16+
public interface BlockChainCandidateEndpoint {
17+
18+
@GET("/candidate")
19+
Call<BCResult<CandidateItem>> getCandidate(@Query("pubkey") String pubKey);
20+
21+
@GET("/candidate")
22+
Call<BCResult<CandidateItem>> getCandidate(@Query("pubkey") String pubKey, long blockHeight);
23+
24+
@GET("/candidates")
25+
Call<BCResult<List<CandidateStatus>>> getCandidates(@Query("height") long blockHeight);
26+
}

src/main/java/network/minter/blockchain/api/BlockChainCoinEndpoint.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) by MinterTeam. 2018
2+
* Copyright (C) by MinterTeam. 2019
33
* @link <a href="https://github.com/MinterTeam">Org Github</a>
44
* @link <a href="https://github.com/edwardstock">Maintainer Github</a>
55
*
@@ -47,7 +47,7 @@ public interface BlockChainCoinEndpoint {
4747
* @param coin Coin Symbol (min: 3, max 10 chars)
4848
* @return Coin information pojo
4949
*/
50-
@GET("/api/coinInfo/{symbol}")
50+
@GET("/coin_info")
5151
Call<BCResult<Coin>> getCoinInformation(@Query("symbol") String coin);
5252

5353
/**
@@ -58,7 +58,7 @@ public interface BlockChainCoinEndpoint {
5858
* @param coinToBuy coin to convert to
5959
* @return
6060
*/
61-
@GET("/api/estimateCoinSell")
61+
@GET("/estimate_coin_sell")
6262
Call<BCResult<ExchangeSellValue>> getCoinExchangeCurrencyToSell(
6363
@Query("coin_to_sell") String coinToSell,
6464
@Query("value_to_sell") String valueToSell,
@@ -73,7 +73,7 @@ Call<BCResult<ExchangeSellValue>> getCoinExchangeCurrencyToSell(
7373
* @param coinToBuy coin to convert to
7474
* @return
7575
*/
76-
@GET("/api/estimateCoinBuy")
76+
@GET("/estimate_coin_buy")
7777
Call<BCResult<ExchangeBuyValue>> getCoinExchangeCurrencyToBuy(
7878
@Query("coin_to_sell") String coinToSell,
7979
@Query("value_to_buy") String valueToBuy,

0 commit comments

Comments
 (0)