mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2026-10-04 05:26:59 +00:00
added findTransactionObjects
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user