Skip to content

Commit

Permalink
js: remove NostrLibrary struct and keep only git_hash_version func
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Jan 9, 2025
1 parent c867091 commit cbea9f9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
* nostr: update `ClientMessage::neg_open` signature ([Yuki Kishimoto])
* nostr: remove `ClientMessage::neg_open_deprecated` ([Yuki Kishimoto])
* pool: change `Relay::connect` method signature ([Yuki Kishimoto])
* ffi: remove `NostrLibrary` struct and keep only `git_hash_version` func ([Yuki Kishimoto])
* ffi: remove embedded tor client ([Yuki Kishimoto])
* ffi: change `UnsignedEvent::tags` output ([Yuki Kishimoto])
* ffi: convert `ImageDimensions` in a `Record` ([Yuki Kishimoto])
* ffi: convert `Contact` to a `Record` ([Yuki Kishimoto])
* bindings: remove `profile` module ([Yuki Kishimoto])
* bindings: remove `NostrLibrary` struct and keep only `git_hash_version` func ([Yuki Kishimoto])
* bindings: cleanup `Relay` methods ([Yuki Kishimoto])
* bindings: cleanup `NostrDatabase` methods ([Yuki Kishimoto])
* bindings: remove `Timestamp::to_human_datetime` ([Yuki Kishimoto])
Expand Down
17 changes: 3 additions & 14 deletions bindings/nostr-sdk-js/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,7 @@ pub fn start() {
console_error_panic_hook::set_once();
}

#[wasm_bindgen(js_name = NostrLibrary)]
pub struct JsNostrLibrary;

#[wasm_bindgen(js_class = NostrLibrary)]
impl JsNostrLibrary {
#[wasm_bindgen(constructor)]
pub fn new() -> Self {
Self
}

#[wasm_bindgen(js_name = gitHashVersion)]
pub fn git_hash_version(&self) -> Option<String> {
option_env!("GIT_HASH").map(|v| v.to_string())
}
#[wasm_bindgen(js_name = gitHashVersion)]
pub fn git_hash_version() -> Option<String> {
option_env!("GIT_HASH").map(|v| v.to_string())
}
4 changes: 2 additions & 2 deletions bindings/nostr-sdk-js/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tracing_subscriber::registry::*;
use wasm_bindgen::prelude::*;

use crate::error::{into_err, Result};
use crate::JsNostrLibrary;
use crate::git_hash_version;

#[wasm_bindgen(js_name = LogLevel)]
pub struct JsLogLevel {
Expand Down Expand Up @@ -60,7 +60,7 @@ pub fn init_logger(level: JsLogLevel) -> Result<()> {
tracing::info!("Wasm logger initialized");

// Log git hash (defined at compile time)
match JsNostrLibrary::new().git_hash_version() {
match git_hash_version() {
Some(hash) => tracing::info!("Git hash: {hash}"),
None => tracing::warn!("Git hash not defined!"),
};
Expand Down

0 comments on commit cbea9f9

Please sign in to comment.