diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index 9f66667..9303170 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -35,20 +35,20 @@
shade
+
+
+
+ *:*
+
+ META-INF/*.SF
+ META-INF/*.DSA
+ META-INF/*.RSA
+
+
+
+
-
-
-
- *:*
-
- META-INF/*.SF
- META-INF/*.DSA
- META-INF/*.RSA
-
-
-
-
maven-surefire-plugin
@@ -66,6 +66,7 @@
maven-source-plugin
+ 3.0.1
attach-sources
@@ -84,6 +85,11 @@
jar
+
+ private
+ true
+ -Xdoclint:none
+
diff --git a/src/main/java/jota/IotaAPI.java b/src/main/java/jota/IotaAPI.java
index feecdd9..1b7967a 100644
--- a/src/main/java/jota/IotaAPI.java
+++ b/src/main/java/jota/IotaAPI.java
@@ -706,6 +706,53 @@ public class IotaAPI extends IotaAPICore {
return GetBundleResponse.create(bundle.getTransactions(), stopWatch.getElapsedTimeMili());
}
+ /**
+ * Similar to getTransfers, just that it returns additional account data
+ *
+ * @param seed Tryte-encoded seed. It should be noted that this seed is not transferred.
+ * @param security The Security level of private key / seed.
+ * @param start Starting key index.
+ * @param end Ending key index.
+ * @param inclusionStates If true, it gets the inclusion states of the transfers.
+ * @param threshold Min balance required.
+ * @throws InvalidBundleException is thrown if an invalid bundle was found or provided.
+ * @throws ArgumentException is thrown when an invalid argument is provided.
+ * @throws InvalidSignatureException is thrown when an invalid signature is encountered.
+ * @throws InvalidTrytesException is thrown when invalid trytes is provided.
+ * @throws InvalidSecurityLevelException is thrown when the specified security level is not valid.
+ * @throws InvalidAddressException is thrown when the specified address is not an valid address.
+ * @throws NoInclusionStatesException when it not possible to get a inclusion state.
+ * @throws NoNodeInfoException is thrown when its not possible to get node info.
+ */
+ public GetAccountDataResponse getAccountData(String seed, int security, int start, int end, boolean inclusionStates, long threshold)
+ throws InvalidBundleException, ArgumentException, InvalidSignatureException,
+ InvalidTrytesException, InvalidSecurityLevelException, InvalidAddressException, NoInclusionStatesException, NoNodeInfoException {
+
+
+ StopWatch stopWatch = new StopWatch();
+
+ // validate seed
+ if ((!InputValidator.isValidSeed(seed))) {
+ throw new IllegalStateException("Invalid Seed");
+ }
+
+ if (security < 1 || security > 3) {
+ throw new InvalidSecurityLevelException();
+ }
+
+ // If start value bigger than end, return error
+ // or if difference between end and start is bigger than 500 keys
+ if (start > end || end > (start + 500)) {
+ throw new IllegalStateException("Invalid inputs provided");
+ }
+
+ GetNewAddressResponse gna = getNewAddress(seed, security, 0, true, 0, true);
+ GetTransferResponse gtr = getTransfers(seed, security, start, end, inclusionStates);
+ GetBalancesAndFormatResponse gbr = getInputs(seed, security, start, end, threshold);
+
+ return GetAccountDataResponse.create(gna.getAddresses(), gtr.getTransfers(), gbr.getTotalBalance(), stopWatch.getElapsedTimeMili());
+ }
+
/**
* Replays a transfer by doing Proof of Work again.
*
diff --git a/src/main/java/jota/dto/response/GetAccountDataResponse.java b/src/main/java/jota/dto/response/GetAccountDataResponse.java
new file mode 100644
index 0000000..27ee80a
--- /dev/null
+++ b/src/main/java/jota/dto/response/GetAccountDataResponse.java
@@ -0,0 +1,55 @@
+package jota.dto.response;
+
+import jota.model.Bundle;
+
+import java.util.List;
+
+/**
+ * Response of api request 'getAccountData'.
+ **/
+public class GetAccountDataResponse extends AbstractResponse {
+
+ private List addresses;
+ private Bundle[] transferBundle;
+ private long balance;
+
+
+ /**
+ * Initializes a new instance of the GetAccountDataResponse class.
+ */
+ public static GetAccountDataResponse create(List addresses, Bundle[] transferBundle, long balance, long duration) {
+ GetAccountDataResponse res = new GetAccountDataResponse();
+ res.addresses = addresses;
+ res.transferBundle = transferBundle;
+ res.balance = balance;
+ res.setDuration(duration);
+ return res;
+ }
+
+ /**
+ * Gets the addresses.
+ *
+ * @return The addresses.
+ */
+ public List getAddresses() {
+ return addresses;
+ }
+
+ /**
+ * Gets the transfers.
+ *
+ * @return The transfers.
+ */
+ public Bundle[] getTransfers() {
+ return transferBundle;
+ }
+
+ /**
+ * Gets the balance.
+ *
+ * @return The balance.
+ */
+ public long getBalance() {
+ return balance;
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/jota/IotaAPITest.java b/src/test/java/jota/IotaAPITest.java
index e00b3a1..ba3a6ea 100644
--- a/src/test/java/jota/IotaAPITest.java
+++ b/src/test/java/jota/IotaAPITest.java
@@ -103,7 +103,7 @@ public class IotaAPITest {
@Test
public void shouldCreate100Addresses() throws InvalidSecurityLevelException, InvalidAddressException {
- GetNewAddressResponse res = iotaClient.getNewAddress(TEST_SEED1, 2, 0, false, 100, false);
+ GetNewAddressResponse res = iotaClient.getNewAddress(TEST_SEED1, 2, 0, false, 100, false);
assertEquals(res.getAddresses().size(), 100);
}
@@ -130,6 +130,12 @@ public class IotaAPITest {
assertThat(ftr, IsNull.notNullValue());
}
+ @Test
+ public void shouldGetAccountData() throws NoInclusionStatesException, InvalidTrytesException, NoNodeInfoException, ArgumentException, InvalidBundleException, InvalidSecurityLevelException, InvalidAddressException, InvalidSignatureException {
+ GetAccountDataResponse gad = iotaClient.getAccountData(TEST_SEED1, 2, 0, 0, true, 100);
+ assertThat(gad, IsNull.notNullValue());
+ }
+
@Test(expected = IllegalAccessError.class)
public void shouldNotGetBundle() throws InvalidBundleException, ArgumentException, InvalidSignatureException {
GetBundleResponse gbr = iotaClient.getBundle("SADASD");