diff --git a/src/main/java/jota/IotaAPIProxy.java b/src/main/java/jota/IotaAPIProxy.java index b3541e8..c5f65ad 100644 --- a/src/main/java/jota/IotaAPIProxy.java +++ b/src/main/java/jota/IotaAPIProxy.java @@ -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 bundleTrytes = new ArrayList<>(); @@ -801,8 +801,18 @@ public class IotaAPIProxy { } List 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 trytes = prepareTransfers(seed, transfers, address, inputs == null ? null : Arrays.asList(inputs)); List 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); } /** diff --git a/src/main/java/jota/dto/response/ReplayBundleResponse.java b/src/main/java/jota/dto/response/ReplayBundleResponse.java index 75bad71..f163d33 100644 --- a/src/main/java/jota/dto/response/ReplayBundleResponse.java +++ b/src/main/java/jota/dto/response/ReplayBundleResponse.java @@ -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; } diff --git a/src/main/java/jota/dto/response/SendTransferResponse.java b/src/main/java/jota/dto/response/SendTransferResponse.java index 4eafeca..62e2a23 100644 --- a/src/main/java/jota/dto/response/SendTransferResponse.java +++ b/src/main/java/jota/dto/response/SendTransferResponse.java @@ -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; }