diff --git a/src/main/java/jota/IotaAPIProxy.java b/src/main/java/jota/IotaAPIProxy.java index 6ac88d2..6dceab3 100644 --- a/src/main/java/jota/IotaAPIProxy.java +++ b/src/main/java/jota/IotaAPIProxy.java @@ -285,7 +285,7 @@ public class IotaAPIProxy { * @param {array} trytes * @param {int} depth * @param {int} minWeightMagnitude - * @return + * @return */ public List sendTrytes(final String trytes, final int minWeightMagnitude) { @@ -627,6 +627,30 @@ public class IotaAPIProxy { return null; //IotaAPIUtils.getBundle(transaction); } + /** + * Replays a transfer by doing Proof of Work again + * + * @method replayBundle + * @param {string} tail + * @param {int} depth + * @param {int} minWeightMagnitude + * @param {function} callback + * @returns {object} analyzed Transaction objects + **/ + public List replayTransfer(String transaction, int depth, int minWeightMagnitude) { + + List bundleTrytes = new ArrayList<>(); + + GetBundleResponse bundle = getBundle(transaction); + + for (Transaction element : bundle.getTransactions()) { + + bundleTrytes.add(IotaAPIUtils.transactionTrytes(element)); + } + + return sendTrytes(bundleTrytes, minWeightMagnitude); + } + /** * Wrapper function for getNodeInfo and getInclusionStates *