Skip to content

Commit 789749c

Browse files
committed
Updated ScriptHashNamespace enum definition
1 parent 2d625f2 commit 789749c

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

rust/src/lib.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,17 +1771,8 @@ to_from_bytes!(NativeScript);
17711771
#[wasm_bindgen]
17721772
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
17731773
pub enum ScriptHashNamespace {
1774-
NativeScript,
1775-
PlutusScript,
1776-
}
1777-
1778-
impl ScriptHashNamespace {
1779-
pub fn scrip_hash_prefix(&self) -> u8 {
1780-
match self {
1781-
ScriptHashNamespace::NativeScript => 0 as u8,
1782-
ScriptHashNamespace::PlutusScript => 1 as u8,
1783-
}
1784-
}
1774+
NativeScript = 0,
1775+
PlutusScript = 1,
17851776
}
17861777

17871778
#[wasm_bindgen]
@@ -1790,7 +1781,7 @@ impl NativeScript {
17901781
pub fn hash(&self) -> ScriptHash {
17911782
let mut bytes = Vec::with_capacity(self.to_bytes().len() + 1);
17921783
bytes.extend_from_slice(&vec![
1793-
ScriptHashNamespace::NativeScript.scrip_hash_prefix(),
1784+
ScriptHashNamespace::NativeScript as u8,
17941785
]);
17951786
bytes.extend_from_slice(&self.to_bytes());
17961787
ScriptHash::from(blake2b224(bytes.as_ref()))

rust/src/plutus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl PlutusScript {
3535
pub fn hash(&self) -> ScriptHash {
3636
let mut bytes = Vec::with_capacity(self.0.len() + 1);
3737
bytes.extend_from_slice(&vec![
38-
ScriptHashNamespace::PlutusScript.scrip_hash_prefix(),
38+
ScriptHashNamespace::PlutusScript as u8,
3939
]);
4040
bytes.extend_from_slice(&self.0);
4141
ScriptHash::from(blake2b224(bytes.as_ref()))

0 commit comments

Comments
 (0)