use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use nostr_sdk::prelude::*; #[tokio::main] async fn main() -> Result<()> { let cur_keys: Keys = Keys::generate(); let my_keys = Keys::from_sk_str("41c0b042b0c34a3eea15d94b3e2ebba00d5d66d1660404c2ea4cebe419c637a3")?; let cur_b32_pk: String = cur_keys.public_key().to_bech32()?; println!("Your current Bech32 PubKey: {} ! enjoy your stay!!", cur_b32_pk); let relay = Client::new(&my_keys); let proxy = Some(SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::LOCALHOST, 9050))); let client = Client::new(&cur_keys); println!("Dear user, please Execute PATCH.sh accordingly. =)"); client.add_relay("wss://relay.damus.io", None).await?; client.add_relay("wss://relay.nostr.info", proxy).await?; client.add_relay( "ws://jgqaglhautb4k6e6i2g34jakxiemqp6z4wynlirltuukgkft2xuglmqd.onion", proxy, ).await?; println!("[+] Default relays added!"); client.connect().await; println!("[+] Connected to subscrubted relays!"); let metadata = Metadata::new() .name("Nikhil Aryal") .display_name("|| Prof. - Xadk3!#0000 ||") .about("https://is.gd/gh_xadke") .picture(Url::parse("https://i.postimg.cc/mgCZgXQ3/MOSHED-2023-3-6-21-5-48.gif")?) .banner(Url::parse("https://raw.githubusercontent.com/prof-xadk3/prof-xadk3.github.io/main/.well-known/.real-eyes.realize.real-lies%7Ez.sh/ezgif-5-71714e8ace.webp")?) .nip05("profxadke@member.cash") .lud16("prof-xadk3@getalby.com"); client.set_metadata(metadata).await?; client.publish_text_note("Greetz! from NostrLand!", &[]).await?; let event_id = EventId::from_bech32("note00000000000000000000000000000000000000000000000000000000000")?; let public_key = XOnlyPublicKey::from_bech32("npub15mf4j4qu5z2g7mhyyan0cx40ra9stnkrp93s0we55f74tlv550nqxht82x")?; let event: Event = EventBuilder::new_reaction(event_id, public_key, "💜").to_event(&my_keys)?; client.send_event_to("wss://relay.damus.io", event).await?; Ok(()) }