diff --git a/crates/nostr-sdk/Cargo.toml b/crates/nostr-sdk/Cargo.toml index 8d67884ed..5757c8266 100644 --- a/crates/nostr-sdk/Cargo.toml +++ b/crates/nostr-sdk/Cargo.toml @@ -94,5 +94,9 @@ required-features = ["all-nips"] [[example]] name = "negentropy" +[[example]] +name = "nip47" +required-features = ["nip47"] + [[example]] name = "nip65" \ No newline at end of file diff --git a/crates/nostr-sdk/examples/nip47.rs b/crates/nostr-sdk/examples/nip47.rs index b23818514..fa2449a5c 100644 --- a/crates/nostr-sdk/examples/nip47.rs +++ b/crates/nostr-sdk/examples/nip47.rs @@ -36,11 +36,7 @@ async fn main() -> Result<()> { }; let encrypted = nip04::encrypt(&nwc_uri.secret, &nwc_uri.public_key, req.as_json()).unwrap(); - let p_tag = Tag::PublicKey { - public_key: nwc_uri.public_key, - relay_url: None, - alias: None, - }; + let p_tag = Tag::public_key(nwc_uri.public_key); let req_event = EventBuilder::new(Kind::WalletConnectRequest, encrypted, [p_tag]) .to_event(&Keys::new(nwc_uri.secret)) @@ -60,7 +56,7 @@ async fn main() -> Result<()> { .handle_notifications(|notification| async { if let RelayPoolNotification::Event { event, .. } = notification { let decrypt_res = - nip04::decrypt(&nwc_uri.secret, &nwc_uri.public_key, event.content).unwrap(); + nip04::decrypt(&nwc_uri.secret, &nwc_uri.public_key, &event.content).unwrap(); println!("{:?}", decrypt_res); let nip47_res = nip47::Response::from_json(decrypt_res).unwrap();