Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit ccc17a3

Browse files
authored
Merge pull request #5 from Crypto-APIs/CRYPTOAPIS-JAVA-SDK-308-status-code
Cryptoapis java sdk 308 status code
2 parents 53b7389 + 3d7c410 commit ccc17a3

File tree

7 files changed

+80
-53
lines changed

7 files changed

+80
-53
lines changed

README.md

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -946,30 +946,30 @@ System.out.println(res.getResponse());
946946
### Exchanges - Services/Methods
947947

948948

949-
| ExchangeRatesService | MetadataService | OHLCVService | QuotesService | TradesService |
950-
| -------------------- | ---------------- | ----------------- | ----------------- | --------------------- |
951-
| getSpecificRate | getExchangesList | getPeriodsList | getLatestData | getLatestData |
952-
| getCurrentRate | getAssetsList | getLatestData | getHistoricalData | getHistoricalData |
953-
| | getSymbolsList | getHistoricalData | | getLatestDataBySymbol |
954-
955-
956-
### Ethereum - Services/Methods
957-
958-
959-
| AddressService | BlockchainService | BlockService | ContractService | PaymentService | TokenService | TransactionService | WebhookService |
960-
| ------------------ | ----------------- | -------------- | --------------- | ---------------- | -------------------- | ------------------- | --------------------- |
961-
| getAddressInfo | getBlockchainInfo | getBlock x2 | estimateGasSC | createPFPvt | getTokenBalance | getTx x3 | createNewBlockWh |
962-
| generateNewAddress | | getLatestBlock | deploySC | createPFPwd | transferPvt | getPendingTxs | createAddressWh |
963-
| generateAccount | | | | deletePF | transferPwd | getQueuedTxs | createConfirmedTxWh |
964-
| getTxsByAddress | | | | listPayments | getTokensByAddress | getTxByIdxAndLimit | createTokenWh |
965-
| getNonce | | | | listPastPayments | getTokenTxsByAddress | createTxKeyStore | createTXPoolWh |
966-
| | | | | | | createTxKeyStoreAll | deleteWebhook |
967-
| | | | | | | createTxPvt | listWebhooks |
968-
| | | | | | | createTxPvtAll | |
969-
| | | | | | | getRawTxBody | |
970-
| | | | | | | estimateGasLimit | |
971-
| | | | | | | broadcastSignedTx | |
972-
| | | | | | | getGasFees | |
949+
| ExchangeRatesService | MetadataService | OHLCVService | QuotesService | TradesService | OrderBookService |
950+
| -------------------- | ---------------- | ----------------- | ----------------- | --------------------- | --------------------- |
951+
| getSpecificRate | getExchangesList | getPeriodsList | getLatestData | getLatestData | getSnapshotBySymbolId |
952+
| getCurrentRate | getAssetsList | getLatestData | getHistoricalData | getHistoricalData | |
953+
| | getSymbolsList | getHistoricalData | | getLatestDataBySymbol | |
954+
955+
956+
### Ethereum, Ethereum Classic - Services/Methods
957+
958+
959+
| AddressService | BlockchainService | BlockService | ContractService | PaymentService | TokenService | TransactionService | WebhookService |
960+
| ------------------ | ----------------- | -------------- | --------------- | ---------------- | ------------------------------- | ------------------- | --------------------- |
961+
| getAddressInfo | getBlockchainInfo | getBlock x2 | estimateGasSC | createPFPvt | getTokenBalance | getTx x3 | createNewBlockWh |
962+
| generateNewAddress | | getLatestBlock | deploySC | createPFPwd | transferPvt | getPendingTxs | createAddressWh |
963+
| generateAccount | | | | deletePF | transferPwd | getQueuedTxs | createConfirmedTxWh |
964+
| getTxsByAddress | | | | listPayments | getTokensByAddress (Ethereum) | getTxByIdxAndLimit | createTokenWh |
965+
| getNonce | | | | listPastPayments | getTokenTxsByAddress (Ethereum) | createTxKeyStore | createTXPoolWh |
966+
| | | | | | getTotalSupplyAndDecimals | createTxKeyStoreAll | deleteWebhook |
967+
| | | | | | getAllTokens (Ethereum) | createTxPvt | listWebhooks |
968+
| | | | | | | createTxPvtAll | |
969+
| | | | | | | getRawTxBody | |
970+
| | | | | | | estimateGasLimit | |
971+
| | | | | | | broadcastSignedTx | |
972+
| | | | | | | getGasFees | |
973973

974974
975975
### Bitcoin, Litecoin, Bitcoin_Cash, Dogecoin - Services/Methods
@@ -982,17 +982,32 @@ System.out.println(res.getResponse());
982982
| generateNewAddress | | | listPayments | getUnconfirmedTxs | listWallets | createConfirmedTxWh |
983983
| getTxsByAddress | | | listPastPayments | decodeTx | listHDWallets | deleteWebhook |
984984
| | | | | createTx | getWallet | listWebhooks |
985-
| | | | | signTx | getHDWallet | |
985+
| | | | | signTx | getHDWallet | deleteAllWebhooks |
986986
| | | | | sendTx | addAddressToWallet | |
987987
| | | | | newTx | generateAddressWallet | |
988988
| | | | | getFees | generateAddressHDWallet | |
989989
| | | | | newTxWithHDWallet | removeAddress | |
990-
| | | | | | deleteWallet | |
990+
| | | | | refundTx | deleteWallet | |
991991
| | | | | | deleteHDWallet | |
992992
| | | | | | createExtendedKey | |
993993
| | | | | | getXpubReceiveAddresses | |
994994
| | | | | | getXpubChangeAddresses | |
995-
995+
996+
### Bitcoin / Omni Layer
997+
998+
999+
| AddressService | NodeInfoService | TransactionService |
1000+
| ---------------------- | ----------------- | -------------- |
1001+
| getAddress | getNodeInfo | createTransaction x2 |
1002+
| getAddressTransactions | | signTransaction |
1003+
| | | sendTransaction |
1004+
| | | createSignAndSendTransaction x2 |
1005+
| | | createHDWalletTransaction x2 |
1006+
| | | getTransactionById |
1007+
| | | getTransactionsByBlockHeight x2 |
1008+
| | | getTransactionsByPropertyId x2 |
1009+
| | | getUnconfirmedTransactions x2 |
1010+
| | | |
9961011
9971012
### Query Params
9981013

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>io.cryptoapis</groupId>
55
<artifactId>cryptoapis-java-client</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.2.3</version>
7+
<version>1.2.5</version>
88
<url>http://maven.apache.org</url>
99

1010
<licenses>
@@ -190,7 +190,7 @@
190190
<properties>
191191
<java.version>1.8</java.version>
192192
<project.name>cryptoapis-java-client</project.name>
193-
<project.version>1.2.3</project.version>
193+
<project.version>1.2.5</project.version>
194194
</properties>
195195

196196
</project>

src/main/java/io/cryptoapis/abstractServices/AbstractWebhookService.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ protected ApiResponse createTransactionConfirmationsWh(String webhookUrl, String
4646
}
4747

4848
protected ApiResponse deleteWebhook(String whUuid) {
49-
return Utils.deleteUnit(whUuid, url, endpointConfig);
49+
String endpoint = String.format("/%s", whUuid);
50+
51+
return Utils.deleteUnit(endpoint, url, endpointConfig);
5052
}
5153

5254
protected ApiResponse deleteAllWebhooks() {
53-
return Utils.deleteUnit(DELETE_ALL_URL, url, endpointConfig);
55+
String endpoint = String.format("/%s", DELETE_ALL_URL);
56+
57+
return Utils.deleteUnit(endpoint, url, endpointConfig);
5458
}
5559

5660
protected ApiResponse listWebhooks(Map<String, String> params) {

src/main/java/io/cryptoapis/blockchains/bitcoin_based/services/AddressService.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import java.util.Map;
1313

1414
public class AddressService extends AbstractServicesConfig {
15-
private static final String PATH = "/{0}/bc/{1}/{2}/address/{3}";
15+
private static final String PATH = "/{0}/bc/{1}/{2}/address{3}";
1616

1717
public AddressService(EndpointConfig endpointConfig) {
1818
super(endpointConfig);
@@ -24,11 +24,12 @@ protected String getPath() {
2424
}
2525

2626
public ApiResponse getAddressInfo(String address) {
27-
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, address), HttpsRequestsEnum.GET.name(), endpointConfig, null);
27+
String endpoint = String.format("/%s" , address);
28+
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.GET.name(), endpointConfig, null);
2829
}
2930

3031
public ApiResponse getMultisigAddressInfo(String address, Map<String, String> params) {
31-
String endpoint = String.format("%s/multisig", address);
32+
String endpoint = String.format("/%s/multisig", address);
3233

3334
Pair<String, ApiError> pair = Utils.setQueryParams(params);
3435
if (pair.getValue() != null) {
@@ -43,7 +44,7 @@ public ApiResponse generateNewAddress() {
4344
}
4445

4546
public ApiResponse getTxsByAddress(String address, Map<String, String> params) {
46-
String endpoint = String.format("%s/transactions", address);
47+
String endpoint = String.format("/%s/transactions", address);
4748

4849
Pair<String, ApiError> pair = Utils.setQueryParams(params);
4950
if (pair.getValue() != null) {

src/main/java/io/cryptoapis/blockchains/bitcoin_based/services/PaymentService.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.apache.commons.lang.StringUtils;
1111

1212
public class PaymentService extends AbstractServicesConfig {
13-
private static final String PATH = "/{0}/bc/{1}/{2}/payments/{3}";
13+
private static final String PATH = "/{0}/bc/{1}/{2}/payments{3}";
1414

1515
protected PaymentService(EndpointConfig endpointConfig) {
1616
super(endpointConfig);
@@ -28,15 +28,17 @@ public ApiResponse createPFPwd(String from, String to, String callback, String w
2828
}
2929

3030
public ApiResponse deletePF(String paymentID) {
31-
return Utils.deleteUnit(paymentID, url, endpointConfig);
31+
String endpoint = String.format("/%s" , paymentID);
32+
33+
return Utils.deleteUnit(endpoint, url, endpointConfig);
3234
}
3335

3436
public ApiResponse listPayments() {
3537
return getPayments(StringUtils.EMPTY);
3638
}
3739

3840
public ApiResponse listPastPayments() {
39-
return getPayments("history");
41+
return getPayments("/history");
4042
}
4143

4244
private Payment createPF(String from, String to, String callback, String walletName, String password, Integer confirmations, Double fee) {

src/main/java/io/cryptoapis/blockchains/bitcoin_based/services/WalletService.java

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class WalletService extends AbstractServicesConfig {
1717

18-
private static final String PATH = "/{0}/bc/{1}/{2}/wallets/{3}";
18+
private static final String PATH = "/{0}/bc/{1}/{2}/wallets{3}";
1919

2020
public WalletService(EndpointConfig endpointConfig) {
2121
super(endpointConfig);
@@ -30,7 +30,7 @@ protected String getPath() {
3030

3131

3232
public ApiResponse importAddressAsWallet(String walletName, String privateKey, String password, String address) {
33-
String endpoint = String.format("%s/import", HD);
33+
String endpoint = String.format("/%s/import", HD);
3434
ImportAddress importAddress = ImportAddress.importAddressAsWallet(walletName, privateKey, password, address);
3535

3636
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
@@ -46,8 +46,9 @@ public ApiResponse createWallet(List<String> addresses, String walletName) {
4646

4747
public ApiResponse createHDWallet(String walletName, int addressCount, String password) {
4848
HDWallet hdWallet = HDWallet.createHDWallet(walletName, addressCount, password);
49+
String endpoint = String.format("/%s", HD);
4950

50-
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, HD), HttpsRequestsEnum.POST.name(), endpointConfig,
51+
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
5152
hdWallet.toString());
5253
}
5354

@@ -57,7 +58,9 @@ public ApiResponse listWallets() {
5758
}
5859

5960
public ApiResponse listHDWallets() {
60-
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, HD), HttpsRequestsEnum.GET.name(), endpointConfig,
61+
String endpoint = String.format("/%s", HD);
62+
63+
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.GET.name(), endpointConfig,
6164
null);
6265
}
6366

@@ -72,7 +75,7 @@ public ApiResponse getHDWallet(String hdWalletName) {
7275
public ApiResponse addAddressToWallet(List<String> addresses, String walletName) {
7376
Wallet wallet = Wallet.createWallet(addresses, walletName);
7477

75-
String endpoint = String.format("%s/addresses", walletName);
78+
String endpoint = String.format("/%s/addresses", walletName);
7679
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
7780
wallet.toString());
7881
}
@@ -88,7 +91,7 @@ public ApiResponse generateAddressHDWallet(String hdWalletName, int addressCount
8891
}
8992

9093
public ApiResponse removeAddress(String walletName, String address) {
91-
String endpoint = String.format("%s/address/%s", walletName, address);
94+
String endpoint = String.format("/%s/address/%s", walletName, address);
9295
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.DELETE.name(), endpointConfig,
9396
null);
9497
}
@@ -98,44 +101,46 @@ public ApiResponse deleteWallet(String wallletName) {
98101
}
99102

100103
public ApiResponse deleteHDWallet(String hdWallletName) {
101-
String endpoint = String.format("%s/%s", HD, hdWallletName);
104+
String endpoint = String.format("/%s/%s", HD, hdWallletName);
102105
return deleteWallets(endpoint);
103106
}
104107

105108
public ApiResponse createExtendedKey(String password) {
106-
String endpoint = String.format("%s/xpub", HD);
109+
String endpoint = String.format("/%s/xpub", HD);
107110
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
108111
XpubAddresses.createExtendedKey(password).toString());
109112
}
110113

111114
public ApiResponse getXpubReceiveAddresses(String xpub, int from, int to) {
112-
String endpoint = String.format("%s/xpub/addresses/receive", HD);
115+
String endpoint = String.format("/%s/xpub/addresses/receive", HD);
113116
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
114117
XpubAddresses.getXpubAddresses(xpub, from, to).toString());
115118
}
116119

117120
public ApiResponse getXpubChangeAddresses(String xpub, int from, int to) {
118-
String endpoint = String.format("%s/xpub/addresses/change", HD);
121+
String endpoint = String.format("/%s/xpub/addresses/change", HD);
119122
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
120123
XpubAddresses.getXpubAddresses(xpub, from, to).toString());
121124
}
122125

123126
private ApiResponse getWallet(String walletName, boolean isHD) {
124-
String endpoint = isHD ? String.format("%s/%s", HD, walletName) : String.format("%s", walletName);
127+
String endpoint = isHD ? String.format("/%s/%s", HD, walletName) : String.format("/%s", walletName);
125128
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.GET.name(), endpointConfig,
126129
null);
127130
}
128131

129132
private ApiResponse generateAddress(String walletName, boolean isHD, String body) {
130133
final String generateEndpoint = "addresses/generate";
131134

132-
String endpoint = isHD ? String.format("%s/%s/%s", HD, walletName, generateEndpoint) : String.format("%s/%s", walletName, generateEndpoint);
135+
String endpoint = isHD ? String.format("/%s/%s/%s", HD, walletName, generateEndpoint) : String.format("/%s/%s", walletName, generateEndpoint);
133136
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.POST.name(), endpointConfig,
134137
body);
135138
}
136139

137140
private ApiResponse deleteWallets(String path) {
138-
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, path), HttpsRequestsEnum.DELETE.name(), endpointConfig,
141+
String endpoint = String.format("/%s", path);
142+
143+
return WebServices.httpsRequest(WebServices.formatUrl(url, endpointConfig, endpoint), HttpsRequestsEnum.DELETE.name(), endpointConfig,
139144
null);
140145
}
141146
}

0 commit comments

Comments
 (0)