diff --git a/README.md b/README.md
index bc0475a..f3d91bc 100644
--- a/README.md
+++ b/README.md
@@ -13,18 +13,18 @@ Use the codes below to add WavesJ as a dependency for your project.
com.wavesplatform
wavesj
- 1.0.4
+ 1.1.0
```
##### Gradle:
```
-compile group: 'com.wavesplatform', name: 'wavesj', version: '1.0.4'
+compile group: 'com.wavesplatform', name: 'wavesj', version: '1.1.0'
```
##### SBT:
```
-libraryDependencies += "com.wavesplatform" % "wavesj" % "1.0.4"
+libraryDependencies += "com.wavesplatform" % "wavesj" % "1.1.0"
```
[This library's page at Maven Central](https://mvnrepository.com/artifact/com.wavesplatform/wavesj)
diff --git a/pom.xml b/pom.xml
index 4dc8122..037e25c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.wavesplatform
wavesj
- 1.0.4
+ 1.1.0
jar
@@ -182,7 +182,7 @@
com.wavesplatform
waves-transactions
- 1.0.5
+ 1.0.6
diff --git a/src/main/java/com/wavesplatform/wavesj/AssetBalance.java b/src/main/java/com/wavesplatform/wavesj/AssetBalance.java
index a45d07e..7b93d88 100644
--- a/src/main/java/com/wavesplatform/wavesj/AssetBalance.java
+++ b/src/main/java/com/wavesplatform/wavesj/AssetBalance.java
@@ -10,13 +10,13 @@
@SuppressWarnings("unused")
public class AssetBalance {
- public final AssetId assetId;
- public final long balance;
- public final boolean reissuable;
- public final long minSponsoredAssetFee;
- public final long sponsorBalance;
- public final long quantity;
- public final Transaction issueTransaction;
+ private final AssetId assetId;
+ private final long balance;
+ private final boolean reissuable;
+ private final long minSponsoredAssetFee;
+ private final long sponsorBalance;
+ private final long quantity;
+ private final Transaction issueTransaction;
@JsonCreator
public AssetBalance(@JsonProperty("assetId") AssetId assetId,
diff --git a/src/main/java/com/wavesplatform/wavesj/Balance.java b/src/main/java/com/wavesplatform/wavesj/Balance.java
index a43361e..946fb20 100644
--- a/src/main/java/com/wavesplatform/wavesj/Balance.java
+++ b/src/main/java/com/wavesplatform/wavesj/Balance.java
@@ -1,7 +1,7 @@
package com.wavesplatform.wavesj;
import com.fasterxml.jackson.annotation.JsonProperty;
-import im.mak.waves.transactions.account.Address;
+import com.wavesplatform.transactions.account.Address;
import java.util.Objects;
diff --git a/src/main/java/com/wavesplatform/wavesj/Node.java b/src/main/java/com/wavesplatform/wavesj/Node.java
index d2a796c..f382408 100644
--- a/src/main/java/com/wavesplatform/wavesj/Node.java
+++ b/src/main/java/com/wavesplatform/wavesj/Node.java
@@ -106,16 +106,28 @@ public long getBalance(Address address, int confirmations) throws IOException, N
}
public List getBalances(List addresses) throws IOException, NodeException {
- RequestBuilder request = get("/addresses/balance");
- addresses.forEach(address -> request.addParameter("address", address.toString()));
- return asType(request, TypeRef.BALANCES);
+ ObjectNode jsonBody = JSON_MAPPER.createObjectNode();
+ ArrayNode jsonAddresses = jsonBody.putArray("addresses");
+ addresses.forEach(address -> jsonAddresses.add(address.toString()));
+
+ StringEntity body = new StringEntity(JSON_MAPPER.writeValueAsString(jsonBody), StandardCharsets.UTF_8);
+
+ return asType(post("/addresses/balance")
+ .addHeader("Content-Type", "application/json")
+ .setEntity(body), TypeRef.BALANCES);
}
public List getBalances(List addresses, int height) throws IOException, NodeException {
- RequestBuilder request = get("/addresses/balance");
- addresses.forEach(address -> request.addParameter("address", address.toString()));
- request.addParameter("height", String.valueOf(height));
- return asType(request, TypeRef.BALANCES);
+ ObjectNode jsonBody = JSON_MAPPER.createObjectNode();
+ ArrayNode jsonAddresses = jsonBody.putArray("addresses");
+ addresses.forEach(address -> jsonAddresses.add(address.toString()));
+
+ jsonBody.put("height", height);
+ StringEntity body = new StringEntity(JSON_MAPPER.writeValueAsString(jsonBody), StandardCharsets.UTF_8);
+
+ return asType(post("/addresses/balance")
+ .addHeader("Content-Type", "application/json")
+ .setEntity(body), TypeRef.BALANCES);
}
public BalanceDetails getBalanceDetails(Address address) throws IOException, NodeException {
@@ -527,30 +539,30 @@ public ScriptInfo compileScript(String source) throws IOException, NodeException
// HTTP REQUESTS
//===============
- private RequestBuilder get(String path) {
+ protected RequestBuilder get(String path) {
return RequestBuilder.get(uri.resolve(path));
}
- private RequestBuilder post(String path) {
+ protected RequestBuilder post(String path) {
return RequestBuilder.post(uri.resolve(path));
}
- private HttpResponse exec(HttpUriRequest request) throws IOException, NodeException {
+ protected HttpResponse exec(HttpUriRequest request) throws IOException, NodeException {
HttpResponse r = client.execute(request);
if (r.getStatusLine().getStatusCode() != HttpStatus.SC_OK)
throw mapper.readValue(r.getEntity().getContent(), NodeException.class);
return r;
}
- private InputStream asInputStream(RequestBuilder request) throws IOException, NodeException {
+ protected InputStream asInputStream(RequestBuilder request) throws IOException, NodeException {
return exec(request.build()).getEntity().getContent();
}
- private T asType(RequestBuilder request, TypeReference reference) throws IOException, NodeException {
+ protected T asType(RequestBuilder request, TypeReference reference) throws IOException, NodeException {
return mapper.readValue(asInputStream(request), reference);
}
- private JsonNode asJson(RequestBuilder request) throws IOException, NodeException {
+ protected JsonNode asJson(RequestBuilder request) throws IOException, NodeException {
return JSON_MAPPER.readTree(asInputStream(request));
}