Repository: ergoplatform/sigma-rust (language: rust)

Issue:
Implement From Base16EncodedBytes for ErgoTree
Reason: to get base16-encoded serialized bytes. Consider adding `ErgoTree::as_base16_bytes()`.


Discussion / hints:

Fix patch:
diff --git a/bindings/ergo-lib-wasm/src/ergo_tree.rs b/bindings/ergo-lib-wasm/src/ergo_tree.rs
index 63a39c79d..9c79737a6 100644
--- a/bindings/ergo-lib-wasm/src/ergo_tree.rs
+++ b/bindings/ergo-lib-wasm/src/ergo_tree.rs
@@ -33,4 +33,9 @@ impl ErgoTree {
     pub fn to_bytes(&self) -> Vec<u8> {
         self.0.sigma_serialize_bytes()
     }
+
+    /// Returns Base16-encoded serialized bytes
+    pub fn to_base16_bytes(&self) -> String {
+        self.0.to_base16_bytes()
+    }
 }
diff --git a/ergo-lib/CHANGELOG.md b/ergo-lib/CHANGELOG.md
index b53411733..a356811b4 100644
--- a/ergo-lib/CHANGELOG.md
+++ b/ergo-lib/CHANGELOG.md
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 
 <!-- next-header -->
 ## [Unreleased] - ReleaseDate
+
+### Added 
+- ErgoScript compiler pipeline draft (`ergoscript-compiler` crate) and added a feature(default) "compiler" in `ergo-lib` with compiler exposed via `Contract::compile(source)`;
+- `ErgoTree:to_base16_bytes()` returns Base16-encoded serialized bytes;
+
+
+### Changed
+- Extract Ergotree IR with serialization from `ergo-lib` crate into `ergotree-ir` crate;
+- Extract ErgoTree IR interpreter from `ergo-lib` crate into `ergotree-interpreter` crate;
+
+
 ## [0.5.1] - 2021-02-17
 
 ### Added 
diff --git a/ergotree-ir/src/ergo_tree.rs b/ergotree-ir/src/ergo_tree.rs
index 237b8a8e8..c4eec9e41 100644
--- a/ergotree-ir/src/ergo_tree.rs
+++ b/ergotree-ir/src/ergo_tree.rs
@@ -142,6 +142,12 @@ impl ErgoTree {
         let tree = format!("{:#?}", self);
         tree
     }
+
+    /// Returns Base16-encoded serialized bytes
+    pub fn to_base16_bytes(&self) -> String {
+        let bytes = self.sigma_serialize_bytes();
+        base16::encode_lower(&bytes)
+    }
 }
 
 impl From<Expr> for ErgoTree {


Test patch: