From aab7abee7734912852db7c6726e8bcca3d33806b Mon Sep 17 00:00:00 2001 From: andrea Date: Tue, 26 Nov 2024 15:53:18 -0800 Subject: [PATCH] WASM: expose the native asset identifier --- ironfish-rust-wasm/src/assets.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ironfish-rust-wasm/src/assets.rs b/ironfish-rust-wasm/src/assets.rs index a863c44c9a..d74761d51b 100644 --- a/ironfish-rust-wasm/src/assets.rs +++ b/ironfish-rust-wasm/src/assets.rs @@ -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() @@ -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") + ); + } } }