Skip to content

Commit 264bcfe

Browse files
author
T. Ismael Verdugo
committed
feat: adds whilte listed addresses endpoint
1 parent ea10b65 commit 264bcfe

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.cryptomarket.sdk.models;
2+
3+
/**
4+
* Whitelisted address
5+
*/
6+
public class WhitelistedAddress {
7+
/** Name of the whitelist item */
8+
private String name;
9+
10+
/** Currency code */
11+
private String currency;
12+
13+
/** Code of the currency of the hosting network */
14+
private String network;
15+
16+
/** Address for deposits */
17+
private String address;
18+
19+
public String getName() {
20+
return name;
21+
}
22+
23+
public void setName(String name) {
24+
this.name = name;
25+
}
26+
27+
public String getCurrency() {
28+
return currency;
29+
}
30+
31+
public void setCurrency(String currency) {
32+
this.currency = currency;
33+
}
34+
35+
public String getNetwork() {
36+
return network;
37+
}
38+
39+
public void setNetwork(String network) {
40+
this.network = network;
41+
}
42+
43+
public String getAddress() {
44+
return address;
45+
}
46+
47+
public void setAddress(String address) {
48+
this.address = address;
49+
}
50+
51+
@Override
52+
public String toString() {
53+
return "WhitelistedAddress [name=" + name + ", currency=" + currency + ", network=" + network + ", address="
54+
+ address + "]";
55+
}
56+
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.cryptomarket.sdk.models.TickerPrice;
4848
import com.cryptomarket.sdk.models.Trade;
4949
import com.cryptomarket.sdk.models.Transaction;
50+
import com.cryptomarket.sdk.models.WhitelistedAddress;
5051

5152
/**
5253
* Rest Client Interface for cryptomarket API V3.
@@ -1169,6 +1170,18 @@ public List<Trade> getSpotTradesHistory(ParamsBuilder paramsBuilder)
11691170
*/
11701171
public Balance getWalletBalance(String currency) throws CryptomarketSDKException;
11711172

1173+
/**
1174+
* Gets the list of whitelisted addresses
1175+
* <p>
1176+
* Requires the "Payment information" API key Access Right
1177+
* <p>
1178+
* https://api.exchange.cryptomkt.com/#get-whitelisted-addresses
1179+
*
1180+
* @return the list of white listed addresses
1181+
* @throws CryptomarketSDKException
1182+
*/
1183+
public List<WhitelistedAddress> getWhitelistedAddresses() throws CryptomarketSDKException;
1184+
11721185
/**
11731186
* Get the current addresses of the user
11741187
* <p>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import com.cryptomarket.sdk.models.TickerPrice;
5252
import com.cryptomarket.sdk.models.Trade;
5353
import com.cryptomarket.sdk.models.Transaction;
54+
import com.cryptomarket.sdk.models.WhitelistedAddress;
5455
import com.cryptomarket.sdk.requests.OrderListRequest;
5556
import com.cryptomarket.sdk.requests.WithdrawRequest;
5657

@@ -766,6 +767,12 @@ public Balance getWalletBalance(String currency) throws CryptomarketSDKException
766767
return getWalletBalanceByCurrency(currency);
767768
}
768769

770+
@Override
771+
public List<WhitelistedAddress> getWhitelistedAddresses() throws CryptomarketSDKException {
772+
String jsonResponse = httpClient.get("wallet/crypto/address/white-list", null);
773+
return adapter.listFromJson(jsonResponse, WhitelistedAddress.class);
774+
}
775+
769776
@Override
770777
public List<Address> getDepositCryptoAddresses(String currency, String networkCode) throws CryptomarketSDKException {
771778
Map<String, String> params = new ParamsBuilder()

0 commit comments

Comments
 (0)