Skip to content

Commit

Permalink
WASM: expose the native asset identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
andiflabs committed Dec 2, 2024
1 parent eed9226 commit aab7abe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ironfish-rust-wasm/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ impl AssetIdentifier {
self.0.as_bytes().to_vec()
}

#[wasm_bindgen(getter)]
pub fn native() -> Self {
Self(ironfish::assets::asset_identifier::NATIVE_ASSET)
}

#[wasm_bindgen(getter, js_name = assetGenerator)]
pub fn asset_generator(&self) -> ExtendedPoint {
self.0.asset_generator().into()
Expand Down Expand Up @@ -208,5 +213,15 @@ mod tests {
let id = AssetIdentifier::deserialize(&serialization[..]).unwrap();
assert_eq!(id.serialize(), serialization);
}

#[test]
#[wasm_bindgen_test]
fn native() {
let id = AssetIdentifier::native();
assert_eq!(
id.serialize(),
hex!("51f33a2f14f92735e562dc658a5639279ddca3d5079a6d1242b2a588a9cbf44c")
);
}
}
}

0 comments on commit aab7abe

Please sign in to comment.