Skip to content

Commit e8f23a5

Browse files
authored
Merge pull request #17 from cryptomkt/fix/transaction-history-order-by
Fix/transaction history order by
2 parents 78f893d + 259bb01 commit e8f23a5

19 files changed

+594
-88
lines changed

src/main/java/com/cryptomarket/params/OrderBy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ public enum OrderBy {
77
/** sort by id */
88
ID("id"),
99
/** sort by update date */
10-
UPDATE_AT("updated_at");
10+
UPDATE_AT("updated_at"),
11+
/** sort by last activity */
12+
LAST_ACTIVITY_AT("last_activity_at");
1113

1214
private final String label;
1315

src/main/java/com/cryptomarket/params/ParamsBuilder.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ private ParamsBuilder addArg(String key, @Nullable Enum<?> arg) {
140140
return this;
141141
}
142142

143+
/**
144+
* Adds an arbitrary parameter
145+
*
146+
* @param key the name of the parameter
147+
* @param value the value of the parameter
148+
* @return The ParamsBuilder
149+
*/
150+
public ParamsBuilder parameter(String key, String value) {
151+
return addArg(key, value);
152+
}
153+
143154
/**
144155
* Adds a currencies param to the ParamBuilder.
145156
*
@@ -230,7 +241,6 @@ public ParamsBuilder by(@Nullable SortBy by) {
230241
return addArg(ArgNames.BY, by);
231242
}
232243

233-
234244
/**
235245
* Adds an order_by param to the ParamBuilder.
236246
*
@@ -903,4 +913,14 @@ public ParamsBuilder symbolList(List<String> symbols) {
903913
public ParamsBuilder currencyListOrAsterisc(@Nullable List<String> currencies) {
904914
return addListOrAsterisc(ArgNames.CURRENCIES, currencies);
905915
}
916+
917+
/**
918+
* Adds a group_transaction param to the ParamBuilder.
919+
*
920+
* @param status A SubAccountStatus type
921+
* @return The ParamsBuilder
922+
*/
923+
public ParamsBuilder GroupTransactions(Boolean asGroupTransactions) {
924+
return addArg(ArgNames.GROUP_TRANSACTIONS, asGroupTransactions);
925+
}
906926
}

src/main/java/com/cryptomarket/sdk/ArgNames.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,6 @@ public class ArgNames {
147147
public static final String EMAIL = "email";
148148
/** */
149149
public static final String STATUS = "status";
150+
/** */
151+
public static final String GROUP_TRANSACTIONS = "group_transactions";
150152
}

src/main/java/com/cryptomarket/sdk/HMAC.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ public Integer getWindow() {
2929
return window;
3030
}
3131

32+
public String getApiSecret() {
33+
return apiSecret;
34+
}
35+
36+
public String getApiKey() {
37+
return apiKey;
38+
}
39+
3240
public String getCredential(String method, String body, String url) {
3341
String timestamp = String.format("%d", System.currentTimeMillis());
3442
String message = new StringBuffer()
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package com.cryptomarket.sdk.models;
2+
3+
import com.squareup.moshi.Json;
4+
5+
public class CommitRisk {
6+
private Integer score;
7+
private String rbf;
8+
@Json(name = "low_fee")
9+
private String lowFee;
10+
11+
/**
12+
* Gets the risk score of the associated transaction. For more information see
13+
* the
14+
* api docs at
15+
* https://api.exchange.cryptomkt.com/#get-transactions-history.
16+
*
17+
* @return
18+
*/
19+
public Integer getScore() {
20+
return score;
21+
}
22+
23+
/**
24+
* Sets the risk score of the associated transaction
25+
*
26+
* @param score
27+
*/
28+
public void setScore(Integer score) {
29+
this.score = score;
30+
}
31+
32+
/**
33+
* Gets a flag indicating if the associated transaction can be replaced by an
34+
* aditional fee (replace-by-fee). For more information see the api docs at
35+
* https://api.exchange.cryptomkt.com/#get-transactions-history.
36+
*
37+
* @return
38+
*/
39+
public String getRbf() {
40+
return rbf;
41+
}
42+
43+
/**
44+
* Sets the replace-by-fee flag of the associated transaction
45+
*
46+
* @param rbf
47+
*/
48+
public void setRbf(String rbf) {
49+
this.rbf = rbf;
50+
}
51+
52+
/**
53+
* Gets a flag indicating whether the actual network fee is lower than the
54+
* estimated one.
55+
* For more information see the api docs at.
56+
* https://api.exchange.cryptomkt.com/#get-transactions-history
57+
*
58+
* @return
59+
*/
60+
public String getLowFee() {
61+
return lowFee;
62+
}
63+
64+
/**
65+
* Sets the low fee flag
66+
*
67+
* @param lowFee
68+
*/
69+
public void setLowFee(String lowFee) {
70+
this.lowFee = lowFee;
71+
}
72+
73+
@Override
74+
public String toString() {
75+
return "CommitRisk [source=" + score + ", rbg=" + rbf + ", lowFee=" + lowFee + "]";
76+
}
77+
}

src/main/java/com/cryptomarket/sdk/models/FeeRequest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ public class FeeRequest {
88
@Json(name = "network_code")
99
private String networkCode;
1010

11+
public FeeRequest(String currency, String amount) {
12+
this.currency = currency;
13+
this.amount = amount;
14+
}
15+
1116
public FeeRequest(String currency, String amount, String networkCode) {
1217
this.currency = currency;
1318
this.amount = amount;

src/main/java/com/cryptomarket/sdk/models/Network.java

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.cryptomarket.sdk.models;
22

3+
import java.util.Map;
4+
35
import com.squareup.moshi.Json;
46

57
/**
@@ -8,8 +10,6 @@
810
public class Network {
911
private String code;
1012
private String network;
11-
@Json(name = "is_ens_available")
12-
private Boolean ensAvailable;
1313
private String protocol;
1414
@Json(name = "default")
1515
private Boolean defaultNetwork;
@@ -41,6 +41,16 @@ public class Network {
4141
private String cryptoPaymentIdName;
4242
@Json(name = "crypto_explorer")
4343
private String cryptoExplorer;
44+
@Json(name = "network_name")
45+
private String networkName;
46+
@Json(name = "is_ens_available")
47+
private Boolean ensAvailable;
48+
@Json(name = "contract_address")
49+
private String contractAddress;
50+
@Json(name = "is_multichain")
51+
private Boolean multichain;
52+
@Json(name = "asset_id")
53+
private Map<String, String> assetId;
4454

4555
/**
4656
* Gets the network code
@@ -378,6 +388,76 @@ public void setCryptoExplorer(String cryptoExplorer) {
378388
this.cryptoExplorer = cryptoExplorer;
379389
}
380390

391+
/**
392+
* Gets the full network name of the network
393+
*
394+
* @return
395+
*/
396+
public String getNetworkName() {
397+
return networkName;
398+
}
399+
400+
/**
401+
* Sets the network name
402+
*
403+
* @param networkName
404+
*/
405+
public void setNetworkName(String networkName) {
406+
this.networkName = networkName;
407+
}
408+
409+
/**
410+
* Gets the contract address of the network
411+
*
412+
* @return
413+
*/
414+
public String getContractAddress() {
415+
return contractAddress;
416+
}
417+
418+
/**
419+
* Sets the contract address of the network
420+
*
421+
* @param contractAddress
422+
*/
423+
public void setContractAddress(String contractAddress) {
424+
this.contractAddress = contractAddress;
425+
}
426+
427+
/**
428+
* Get a flag indicating if the multichain is active for the network
429+
*
430+
* @return
431+
*/
432+
public Boolean getMultichain() {
433+
return multichain;
434+
}
435+
436+
/**
437+
* Sets the multichain flag of the network
438+
*
439+
* @param multichain
440+
*/
441+
public void setMultichain(Boolean multichain) {
442+
this.multichain = multichain;
443+
}
444+
445+
/**
446+
* Gets arbitrary data particular of the network
447+
* @return
448+
*/
449+
public Map<String, String> getAssetId() {
450+
return assetId;
451+
}
452+
453+
/**
454+
* Sets the asset id, extra data of the network
455+
* @param assetId
456+
*/
457+
public void setAssetId(Map<String, String> assetId) {
458+
this.assetId = assetId;
459+
}
460+
381461
@Override
382462
public String toString() {
383463
return "Network [code=" + code + ", network=" + network + ", ensAvailable=" + ensAvailable + ", protocol="

src/main/java/com/cryptomarket/sdk/models/Transaction.java

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ public class Transaction {
1717
private String createdAt;
1818
@Json(name = "updated_at")
1919
private String updatedAt;
20+
@Json(name = "last_activity_at")
21+
private String lastActivityAt;
2022
@Json(name = "native")
2123
private NativeTransaction nativeTransaction;
2224
@Json(name = "network_code")
2325
private String networkCode;
26+
@Json(name = "commit_risk")
27+
private CommitRisk commitRisk;
2428

2529
/**
2630
* Gets the transaction id
@@ -130,6 +134,24 @@ public void setUpdatedAt(String updatedAt) {
130134
this.updatedAt = updatedAt;
131135
}
132136

137+
/**
138+
* Gets the last activity of the transaction
139+
*
140+
* @return
141+
*/
142+
public String getLastActivityAt() {
143+
return lastActivityAt;
144+
}
145+
146+
/**
147+
* Sets the last activity of the transaction
148+
*
149+
* @param lastActivityAt
150+
*/
151+
public void setLastActivityAt(String lastActivityAt) {
152+
this.lastActivityAt = lastActivityAt;
153+
}
154+
133155
/**
134156
* Gets the native transaction
135157
*
@@ -166,10 +188,27 @@ public void setNetworkCode(String networkCode) {
166188
this.networkCode = networkCode;
167189
}
168190

191+
/**
192+
* Gets the commit risk of the transaction
193+
* @return
194+
*/
195+
public CommitRisk getCommitRisk() {
196+
return commitRisk;
197+
}
198+
199+
/**
200+
* Sets the commit rist of the transaction
201+
*
202+
* @param commitRisk
203+
*/
204+
public void setCommitRisk(CommitRisk commitRisk) {
205+
this.commitRisk = commitRisk;
206+
}
207+
169208
@Override
170209
public String toString() {
171210
return "Transaction [id=" + id + ", status=" + status + ", type=" + type + ", subtype=" + subtype + ", createdAt="
172-
+ createdAt + ", updatedAt=" + updatedAt + ", nativeTransaction=" + nativeTransaction + ", networkCode="
173-
+ networkCode + "]";
211+
+ createdAt + ", updatedAt=" + updatedAt + ", lastActivityAt=" + lastActivityAt + ", nativeTransaction="
212+
+ nativeTransaction + ", networkCode=" + networkCode + ", commitRisk=" + commitRisk + "]";
174213
}
175214
}

src/main/java/com/cryptomarket/sdk/rest/CloseableHttpClient.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ public interface CloseableHttpClient extends Closeable {
1111

1212
/**
1313
* Changes the user credentials used for authentication in calls
14-
* @param apiKey the user public key used in new calls
14+
*
15+
* @param apiKey the user public key used in new calls
1516
* @param apiSecret the user secret key used in new calls
1617
*/
1718
public void changeCredentials(String apiKey, String apiSecret);
1819

20+
/**
21+
* Changes the window used in authenticated calls
22+
*
23+
* @param window acceptable time between request and server execution
24+
*/
25+
public void changeWindow(Integer window);
26+
1927
/**
2028
* Does an http get without authentication
2129
*

0 commit comments

Comments
 (0)