use of io.nem.symbol.sdk.model.blockchain.MerkleStateInfo in project nem2-sdk-java by nemtech.
the class MerkleMapper method toMerkleStateInfo.
public MerkleStateInfo toMerkleStateInfo(MerkleStateInfoDTO dto) {
MerkleTreeLeaf leaf = dto.getTree().stream().map(this::toLeaf).filter(Objects::nonNull).findFirst().orElse(null);
List<MerkleTreeBranch> branches = dto.getTree().stream().map(this::toBranch).filter(Objects::nonNull).collect(Collectors.toList());
MerkleTree tree = new MerkleTree(branches, leaf);
return new MerkleStateInfo(dto.getRaw(), tree);
}
use of io.nem.symbol.sdk.model.blockchain.MerkleStateInfo in project nem2-sdk-java by nemtech.
the class MosaicRepositoryOkHttpImplTest method getMetadataMerkle.
@Test
public void getMetadataMerkle() throws Exception {
MosaicId mosaicId = MapperUtils.toMosaicId("481110499");
mockRemoteCall(new MerkleStateInfoDTO().raw("abc"));
MerkleStateInfo merkle = repository.getMosaicMerkle(mosaicId).toFuture().get();
Assertions.assertEquals("abc", merkle.getRaw());
}
use of io.nem.symbol.sdk.model.blockchain.MerkleStateInfo in project nem2-sdk-java by nemtech.
the class MultisigRepositoryOkHttpImplTest method getMultisigAccountInfoMerkle.
@Test
public void getMultisigAccountInfoMerkle() throws Exception {
mockRemoteCall(new MerkleStateInfoDTO().raw("abc"));
MerkleStateInfo merkle = repository.getMultisigAccountInfoMerkle(Address.generateRandom(this.networkType)).toFuture().get();
Assertions.assertEquals("abc", merkle.getRaw());
}
use of io.nem.symbol.sdk.model.blockchain.MerkleStateInfo in project nem2-sdk-java by nemtech.
the class MerkleMapperOkHttpTest method testDtoToModelMapping.
@ParameterizedTest
@MethodSource("merkleJsonFiles")
void testDtoToModelMapping(String jsonFilename) {
String json = TestHelperOkHttp.loadResource(jsonFilename);
MerkleMapper merkleMapper = new MerkleMapper(jsonHelper);
MerkleStateInfoDTO dto = jsonHelper.parse(json, MerkleStateInfoDTO.class);
MerkleStateInfo merkleStateInfo = merkleMapper.toMerkleStateInfo(dto);
Assertions.assertFalse(merkleStateInfo.getTree().getBranches().isEmpty());
Assertions.assertNotNull(merkleStateInfo.getTree().getLeaf());
}
use of io.nem.symbol.sdk.model.blockchain.MerkleStateInfo in project nem2-sdk-java by nemtech.
the class RestrictionAccountRepositoryOkHttpImplTest method getAccountRestrictionsMerkle.
@Test
public void getAccountRestrictionsMerkle() throws Exception {
Address address = Address.generateRandom(this.networkType);
mockRemoteCall(new MerkleStateInfoDTO().raw("abc"));
MerkleStateInfo merkle = repository.getAccountRestrictionsMerkle(address).toFuture().get();
Assertions.assertEquals("abc", merkle.getRaw());
}
Aggregations