expanded getAccountData

This commit is contained in:
pinpong 2017-11-06 21:21:43 +01:00
parent 836688139f
commit e0dc12681f
5 changed files with 27 additions and 15 deletions

View File

@ -479,7 +479,7 @@ public class IotaAPI extends IotaAPICore {
@SuppressWarnings("unchecked") GetBalancesAndFormatResponse newinputs = getInputs(seed, security, 0, 0, totalValue);
// If inputs with enough balance
return addRemainder(seed, security, newinputs.getInput(), bundle, tag, totalValue, remainder, signatureFragments);
return addRemainder(seed, security, newinputs.getInputs(), bundle, tag, totalValue, remainder, signatureFragments);
}
} else {
@ -724,7 +724,7 @@ public class IotaAPI extends IotaAPICore {
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());
return GetAccountDataResponse.create(gna.getAddresses(), gtr.getTransfers(), gbr.getInputs(), gbr.getTotalBalance(), stopWatch.getElapsedTimeMili());
}
/**

View File

@ -1,6 +1,7 @@
package jota.dto.response;
import jota.model.Bundle;
import jota.model.Input;
import java.util.List;
@ -11,16 +12,18 @@ public class GetAccountDataResponse extends AbstractResponse {
private List<String> addresses;
private Bundle[] transferBundle;
private List<Input> inputs;
private long balance;
/**
* Initializes a new instance of the GetAccountDataResponse class.
*/
public static GetAccountDataResponse create(List<String> addresses, Bundle[] transferBundle, long balance, long duration) {
public static GetAccountDataResponse create(List<String> addresses, Bundle[] transferBundle, List<Input> inputs, long balance, long duration) {
GetAccountDataResponse res = new GetAccountDataResponse();
res.addresses = addresses;
res.transferBundle = transferBundle;
res.inputs = inputs;
res.balance = balance;
res.setDuration(duration);
return res;
@ -44,6 +47,15 @@ public class GetAccountDataResponse extends AbstractResponse {
return transferBundle;
}
/**
* Gets the inputs.
*
* @return The inputs.
*/
public List<Input> getInput() {
return inputs;
}
/**
* Gets the balance.
*

View File

@ -9,16 +9,16 @@ import java.util.List;
**/
public class GetBalancesAndFormatResponse extends AbstractResponse {
private List<Input> input;
private List<Input> inputs;
private long totalBalance;
/**
* Initializes a new instance of the GetBalancesAndFormatResponse class.
*/
public static GetBalancesAndFormatResponse create(List<Input> inputs, long totalBalance2, long duration) {
public static GetBalancesAndFormatResponse create(List<Input> inputs, long totalBalance, long duration) {
GetBalancesAndFormatResponse res = new GetBalancesAndFormatResponse();
res.setInput(inputs);
res.setTotalBalance(totalBalance2);
res.inputs = inputs;
res.totalBalance = totalBalance;
res.setDuration(duration);
return res;
}
@ -28,8 +28,8 @@ public class GetBalancesAndFormatResponse extends AbstractResponse {
*
* @return The transactions.
*/
public List<Input> getInput() {
return input;
public List<Input> getInputs() {
return inputs;
}
/**
@ -37,8 +37,8 @@ public class GetBalancesAndFormatResponse extends AbstractResponse {
*
* @param input The input.
*/
public void setInput(List<Input> input) {
this.input = input;
public void setInputs(List<Input> input) {
this.inputs = inputs;
}
/**

View File

@ -15,6 +15,7 @@ public class GetTransferResponse extends AbstractResponse {
public static GetTransferResponse create(Bundle[] transferBundle, long duration) {
GetTransferResponse res = new GetTransferResponse();
res.transferBundle = transferBundle;
res.setDuration(duration);
return res;
}

View File

@ -117,8 +117,7 @@ public class IotaAPITest {
System.out.println(res);
assertThat(res, IsNull.notNullValue());
assertThat(res.getTotalBalance(), IsNull.notNullValue());
assertThat(res.getInput(), IsNull.notNullValue());
assertThat(res.getInputs(), IsNull.notNullValue());
}
@Test
@ -146,7 +145,7 @@ public class IotaAPITest {
GetBalancesAndFormatResponse rsp = iotaClient.getInputs(TEST_SEED1, 2, 0, 0, 100);
for (Input input : rsp.getInput()) {
for (Input input : rsp.getInputs()) {
inputlist.add(input);
}
transfers.add(new jota.model.Transfer(TEST_ADDRESS_WITHOUT_CHECKSUM_SECURITY_LEVEL_2, 0, TEST_MESSAGE, TEST_TAG));
@ -256,7 +255,7 @@ public class IotaAPITest {
GetBalancesAndFormatResponse rsp = iotaClient.getInputs(TEST_SEED1, 2, 0, 0, 100);
for (Input input : rsp.getInput()) {
for (Input input : rsp.getInputs()) {
inputlist.add(input);
}