sendTransfer return fix

This commit is contained in:
pinpong
2017-01-02 21:55:06 +01:00
parent 04cfb6debc
commit 29c5c26b0a
3 changed files with 31 additions and 11 deletions
+23 -3
View File
@@ -789,7 +789,7 @@ public class IotaAPIProxy {
* @method replayBundle
* @returns {object} analyzed Transaction objects
**/
public ReplayBundleResponse replayBundle(String transaction, int depth, int minWeightMagnitude) throws InvalidBundleException, InvalidSignatureException, ArgumentException {
public ReplayBundleResponse replayBundle(String transaction, int depth, int minWeightMagnitude) throws InvalidBundleException, ArgumentException, InvalidSignatureException {
List<String> bundleTrytes = new ArrayList<>();
@@ -801,8 +801,18 @@ public class IotaAPIProxy {
}
List<Transaction> trxs = sendTrytes(bundleTrytes.toArray(new String[bundleTrytes.size()]), depth, minWeightMagnitude);
return ReplayBundleResponse.create(trxs.get(0).getPersistence());
Boolean[] successful = new Boolean[trxs.size()];
for (int i = 0; i < trxs.size(); i++) {
final FindTransactionResponse response = findTransactionsByBundles(trxs.get(i).getBundle());
successful[i] = response.getHashes().length != 0;
}
return ReplayBundleResponse.create(successful);
}
/**
@@ -826,7 +836,17 @@ public class IotaAPIProxy {
List<String> trytes = prepareTransfers(seed, transfers, address, inputs == null ? null : Arrays.asList(inputs));
List<Transaction> trxs = sendTrytes(trytes.toArray(new String[trytes.size()]), depth, minWeightMagnitude);
return SendTransferResponse.create(trxs.get(0).getPersistence());
Boolean[] successful = new Boolean[trxs.size()];
for (int i = 0; i < trxs.size(); i++) {
final FindTransactionResponse response = findTransactionsByBundles(trxs.get(i).getBundle());
successful[i] = response.getHashes().length != 0;
}
return SendTransferResponse.create(successful);
}
/**
@@ -5,19 +5,19 @@ package jota.dto.response;
*/
public class ReplayBundleResponse extends AbstractResponse {
private Boolean successfully;
private Boolean[] successfully;
public static ReplayBundleResponse create(Boolean successfully) {
public static ReplayBundleResponse create(Boolean[] successfully) {
ReplayBundleResponse res = new ReplayBundleResponse();
res.successfully = successfully;
return res;
}
public Boolean getSuccessfully() {
public Boolean[] getSuccessfully() {
return successfully;
}
public void setSuccessfully(Boolean successfully) {
public void setSuccessfully(Boolean[] successfully) {
this.successfully = successfully;
}
@@ -5,19 +5,19 @@ package jota.dto.response;
*/
public class SendTransferResponse extends AbstractResponse {
private Boolean successfully;
private Boolean[] successfully;
public static SendTransferResponse create(Boolean successfully) {
public static SendTransferResponse create(Boolean[] successfully) {
SendTransferResponse res = new SendTransferResponse();
res.successfully = successfully;
return res;
}
public Boolean getSuccessfully() {
public Boolean[] getSuccessfully() {
return successfully;
}
public void setSuccessfully(Boolean successfully) {
public void setSuccessfully(Boolean[] successfully) {
this.successfully = successfully;
}