use of io.nem.symbol.sdk.api.ReceiptRepository in project nem2-sdk-java by nemtech.
the class ReceiptRepositoryTransactionSearchIntegrationTest method assertRecipientType.
List<TransactionStatement> assertRecipientType(RepositoryType type, List<ReceiptType> receiptTypes) {
ReceiptRepository receiptRepository = getReceiptRepository(type);
PaginationStreamer<TransactionStatement, TransactionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.transactions(receiptRepository);
List<TransactionStatement> transactionStatements = get(streamer.search(new TransactionStatementSearchCriteria().receiptTypes(receiptTypes)).toList().toObservable());
transactionStatements.forEach(s -> Assertions.assertTrue(s.getReceipts().stream().anyMatch(r -> (receiptTypes.contains(r.getType())))));
return transactionStatements;
}
use of io.nem.symbol.sdk.api.ReceiptRepository in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method getMerkleReceiptsFromAddresses.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleReceiptsFromAddresses(RepositoryType type) {
Pair<Account, NamespaceId> testAccount = helper().getTestAccount(type);
helper().basicSendMosaicFromNemesis(type, testAccount.getRight());
BlockRepository blockRepository = getBlockRepository(type);
ReceiptRepository receiptRepository = getRepositoryFactory(type).createReceiptRepository();
PaginationStreamer<AddressResolutionStatement, ResolutionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.addresses(receiptRepository);
List<AddressResolutionStatement> list = get(streamer.search(new ResolutionStatementSearchCriteria()).take(5).toList().toObservable());
Assertions.assertFalse(list.isEmpty());
list.forEach(s -> {
String hash = s.generateHash(getNetworkType());
MerkleProofInfo merkleProofInfo = get(blockRepository.getMerkleReceipts(s.getHeight(), hash));
Assertions.assertFalse(merkleProofInfo.getMerklePath().isEmpty());
});
}
use of io.nem.symbol.sdk.api.ReceiptRepository in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method getMerkleReceiptsFromTransactions.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleReceiptsFromTransactions(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
ReceiptRepository receiptRepository = getRepositoryFactory(type).createReceiptRepository();
PaginationStreamer<TransactionStatement, TransactionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.transactions(receiptRepository);
List<TransactionStatement> list = get(streamer.search(new TransactionStatementSearchCriteria()).take(5).toList().toObservable());
System.out.println(list.size());
list.forEach(s -> {
String hash = s.generateHash();
System.out.println(hash);
System.out.println(s.getHeight());
MerkleProofInfo merkleProofInfo = get(blockRepository.getMerkleReceipts(s.getHeight(), hash));
System.out.println(toJson(merkleProofInfo));
});
}
use of io.nem.symbol.sdk.api.ReceiptRepository in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method getMerkleReceiptsFromMosaics.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void getMerkleReceiptsFromMosaics(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
ReceiptRepository receiptRepository = getRepositoryFactory(type).createReceiptRepository();
PaginationStreamer<MosaicResolutionStatement, ResolutionStatementSearchCriteria> streamer = ReceiptPaginationStreamer.mosaics(receiptRepository);
List<MosaicResolutionStatement> list = get(streamer.search(new ResolutionStatementSearchCriteria()).take(5).toList().toObservable());
Assertions.assertFalse(list.isEmpty());
list.forEach(s -> {
String hash = s.generateHash(getNetworkType());
MerkleProofInfo merkleProofInfo = get(blockRepository.getMerkleReceipts(s.getHeight(), hash));
Assertions.assertFalse(merkleProofInfo.getMerklePath().isEmpty());
});
}
Aggregations