use js_export_macro::js_export;
use miden_client::note::NoteLocation as NativeNoteLocation;
#[derive(Clone)]
#[js_export]
pub struct NoteLocation(NativeNoteLocation);
#[js_export]
impl NoteLocation {
#[js_export(js_name = "blockNum")]
pub fn block_num(&self) -> u32 {
self.0.block_num().as_u32()
}
#[js_export(js_name = "blockNoteTreeIndex")]
pub fn block_note_tree_index(&self) -> u16 {
self.0.block_note_tree_index()
}
}
impl From<NativeNoteLocation> for NoteLocation {
fn from(native_location: NativeNoteLocation) -> Self {
NoteLocation(native_location)
}
}
impl From<&NativeNoteLocation> for NoteLocation {
fn from(native_location: &NativeNoteLocation) -> Self {
NoteLocation(native_location.clone())
}
}