added findTransactionObjects

This commit is contained in:
pinpong
2016-12-22 18:47:41 +01:00
parent 96fed0bf78
commit 6a7a015ec6
2 changed files with 16 additions and 7 deletions
+11 -7
View File
@@ -309,13 +309,7 @@ public class IotaAPIProxy {
}
return trx;
}
public List<Transaction> findAndGetTxs(final String addresses) {
final FindTransactionResponse res = findTransactionsByAddresses(addresses);
return getTransactionsObjects(res.getHashes());
}
/**
* Wrapper function for getTrytes and transactionObjects
* gets the trytes and transaction object from a list of transaction hashes
@@ -326,7 +320,7 @@ public class IotaAPIProxy {
* @returns {function} callback
* @returns {object} success
**/
public List<Transaction> getTransactionsObjects(String ... hashes) {
public List<Transaction> getTransactionsObjects(String[] hashes) {
if (!InputValidator.isArrayOfHashes(hashes)) {
throw new IllegalStateException("Not an Array of Hashes: " + Arrays.toString(hashes));
@@ -342,6 +336,16 @@ public class IotaAPIProxy {
return trxs;
}
public List<Transaction> findTransactionObjects(String[] input) {
FindTransactionResponse ftr = findTransactions(input, null, null, null);
if (ftr == null || ftr.getHashes() == null)
return null;
// get the transaction objects of the transactions
return getTransactionsObjects(ftr.getHashes());
}
/**
* Prepares transfer by generating bundle, finding and signing inputs
*
+5
View File
@@ -175,4 +175,9 @@ public class IotaAPIProxyTest {
GetInclusionStateResponse res = proxy.getLatestInclusion(new String[]{TEST_HASH});
assertThat(res.getStates(), IsNull.notNullValue());
}
@Test
public void shouldFindTransactionObjects() {
assertThat(proxy.findTransactionObjects(new String[]{TEST_ADDRESS_WITH_CHECKSUM}), IsNull.notNullValue());
}
}