Skip to content

Commit

Permalink
Improve the encapsulation level for a business need (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKtrue authored and Warchant committed May 22, 2019
1 parent 78d7f30 commit 3093b09
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions client/src/main/java/jp/co/soramitsu/iroha/java/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,42 @@ public static String toHex(byte[] b) {
return DatatypeConverter.printHexBinary(b);
}

/**
* Get transaction hash hexstring
* @param transaction
* @return lowercase hexstring
*/
public String toHexHash(TransactionOuterClass.Transaction transaction) {
return DatatypeConverter.printHexBinary(hash(transaction)).toLowerCase();
}

/**
* Get query hash hexstring
* @param query
* @return lowercase hexstring
*/
public String toHexHash(Queries.Query query) {
return DatatypeConverter.printHexBinary(hash(query)).toLowerCase();
}

/**
* Get block_v1 hash hexstring
* @param block_v1
* @return lowercase hexstring
*/
public String toHexHash(Block_v1 block_v1) {
return DatatypeConverter.printHexBinary(hash(block_v1)).toLowerCase();
}

/**
* Get block hash hexstring
* @param block
* @return lowercase hexstring
*/
public String toHexHash(Block block) {
return DatatypeConverter.printHexBinary(hash(block)).toLowerCase();
}

public static Iterable<String> getProtoBatchHashesHex(
Iterable<TransactionOuterClass.Transaction> list) {
return StreamSupport.stream(list.spliterator(), false)
Expand Down

0 comments on commit 3093b09

Please sign in to comment.