Search in sources :

Example 1 with MerkleTreeBranchLink

use of io.nem.symbol.sdk.model.state.MerkleTreeBranchLink in project nem2-sdk-java by nemtech.

the class MerkleMapper method toMerkleTreeBranch.

private MerkleTreeBranch toMerkleTreeBranch(Object dto, MerkleTreeNodeType type) {
    MerkleTreeBranchDTO branch = getJsonHelper().convert(dto, MerkleTreeBranchDTO.class);
    List<MerkleTreeBranchLink> links = branch.getLinks().stream().map(link -> new MerkleTreeBranchLink(link.getBit(), link.getLink())).collect(Collectors.toList());
    return new MerkleTreeBranch(type, branch.getPath(), branch.getEncodedPath(), branch.getLinkMask(), links, branch.getBranchHash());
}
Also used : MerkleStateInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.MerkleStateInfoDTO) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) MerkleTreeBranchDTO(io.nem.symbol.sdk.openapi.vertx.model.MerkleTreeBranchDTO) List(java.util.List) MerkleTreeNodeType(io.nem.symbol.sdk.model.state.MerkleTreeNodeType) MerkleTree(io.nem.symbol.sdk.model.state.MerkleTree) MerkleTreeBranch(io.nem.symbol.sdk.model.state.MerkleTreeBranch) JsonHelper(io.nem.symbol.sdk.model.transaction.JsonHelper) MerkleTreeLeaf(io.nem.symbol.sdk.model.state.MerkleTreeLeaf) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MerkleTreeBranchLink(io.nem.symbol.sdk.model.state.MerkleTreeBranchLink) MerkleTreeLeafDTO(io.nem.symbol.sdk.openapi.vertx.model.MerkleTreeLeafDTO) MerkleTreeBranchLink(io.nem.symbol.sdk.model.state.MerkleTreeBranchLink) MerkleTreeBranchDTO(io.nem.symbol.sdk.openapi.vertx.model.MerkleTreeBranchDTO) MerkleTreeBranch(io.nem.symbol.sdk.model.state.MerkleTreeBranch)

Example 2 with MerkleTreeBranchLink

use of io.nem.symbol.sdk.model.state.MerkleTreeBranchLink in project nem2-sdk-java by nemtech.

the class MerkleMapper method toMerkleTreeBranch.

private io.nem.symbol.sdk.model.state.MerkleTreeBranch toMerkleTreeBranch(Object dto, MerkleTreeNodeType type) {
    MerkleTreeBranchDTO branch = getJsonHelper().convert(dto, MerkleTreeBranchDTO.class);
    List<MerkleTreeBranchLink> links = branch.getLinks().stream().map(link -> new MerkleTreeBranchLink(link.getBit(), link.getLink())).collect(Collectors.toList());
    return new io.nem.symbol.sdk.model.state.MerkleTreeBranch(type, branch.getPath(), branch.getEncodedPath(), branch.getLinkMask(), links, branch.getBranchHash());
}
Also used : MerkleTreeBranchDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleTreeBranchDTO) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) MerkleStateInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleStateInfoDTO) List(java.util.List) MerkleTreeNodeType(io.nem.symbol.sdk.model.state.MerkleTreeNodeType) MerkleTree(io.nem.symbol.sdk.model.state.MerkleTree) MerkleTreeBranch(io.nem.symbol.sdk.model.state.MerkleTreeBranch) JsonHelper(io.nem.symbol.sdk.model.transaction.JsonHelper) MerkleTreeLeaf(io.nem.symbol.sdk.model.state.MerkleTreeLeaf) MerkleStateInfo(io.nem.symbol.sdk.model.blockchain.MerkleStateInfo) MerkleTreeBranchLink(io.nem.symbol.sdk.model.state.MerkleTreeBranchLink) MerkleTreeLeafDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleTreeLeafDTO) MerkleTreeBranchLink(io.nem.symbol.sdk.model.state.MerkleTreeBranchLink) MerkleTreeBranchDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleTreeBranchDTO) MerkleTreeBranch(io.nem.symbol.sdk.model.state.MerkleTreeBranch)

Aggregations

MerkleStateInfo (io.nem.symbol.sdk.model.blockchain.MerkleStateInfo)2 MerkleTree (io.nem.symbol.sdk.model.state.MerkleTree)2 MerkleTreeBranch (io.nem.symbol.sdk.model.state.MerkleTreeBranch)2 MerkleTreeBranchLink (io.nem.symbol.sdk.model.state.MerkleTreeBranchLink)2 MerkleTreeLeaf (io.nem.symbol.sdk.model.state.MerkleTreeLeaf)2 MerkleTreeNodeType (io.nem.symbol.sdk.model.state.MerkleTreeNodeType)2 JsonHelper (io.nem.symbol.sdk.model.transaction.JsonHelper)2 List (java.util.List)2 Objects (java.util.Objects)2 Collectors (java.util.stream.Collectors)2 MerkleStateInfoDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleStateInfoDTO)1 MerkleTreeBranchDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleTreeBranchDTO)1 MerkleTreeLeafDTO (io.nem.symbol.sdk.openapi.okhttp_gson.model.MerkleTreeLeafDTO)1 MerkleStateInfoDTO (io.nem.symbol.sdk.openapi.vertx.model.MerkleStateInfoDTO)1 MerkleTreeBranchDTO (io.nem.symbol.sdk.openapi.vertx.model.MerkleTreeBranchDTO)1 MerkleTreeLeafDTO (io.nem.symbol.sdk.openapi.vertx.model.MerkleTreeLeafDTO)1