We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e386949 commit 8f822b9Copy full SHA for 8f822b9
crates/ibc-types-core-commitment/src/prefix.rs
@@ -1,4 +1,5 @@
1
use crate::prelude::*;
2
+use crate::MerklePath;
3
4
use crate::Error;
5
@@ -10,6 +11,18 @@ pub struct MerklePrefix {
10
11
pub key_prefix: Vec<u8>,
12
}
13
14
+impl MerklePrefix {
15
+ /// apply the prefix to the supplied paths
16
+ pub fn apply(&self, paths: Vec<String>) -> MerklePath {
17
+ let commitment_str =
18
+ core::str::from_utf8(&self.key_prefix).expect("commitment prefix is not valid utf-8");
19
+ let mut key_path: Vec<String> = vec![format!("{commitment_str:?}")];
20
+ key_path.append(paths.clone().as_mut());
21
+
22
+ MerklePath { key_path }
23
+ }
24
+}
25
26
impl TypeUrl for MerklePrefix {
27
const TYPE_URL: &'static str = "/ibc.core.commitment.v1.MerklePrefix";
28
0 commit comments