-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
28 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ async fn main() -> Result<()> { | |
.picture(Url::parse("https://example.com/avatar.png")?) | ||
.banner(Url::parse("https://example.com/banner.png")?) | ||
.nip05("[email protected]") | ||
.lud16("yuki@stacker.news"); | ||
.lud16("yuki@getalby.com"); | ||
// Update metadata | ||
client.set_metadata(metadata).await?; | ||
|
@@ -80,11 +80,22 @@ async fn main() -> Result<()> { | |
// Publish a POW text note | ||
client.publish_pow_text_note("My first POW text note from Nostr SDK!", &[], 20).await?; | ||
// Send custom event | ||
let event_id = EventId::from_bech32("note1z3lwphdc7gdf6n0y4vaaa0x7ck778kg638lk0nqv2yd343qda78sf69t6r")?; | ||
let public_key = XOnlyPublicKey::from_bech32("npub14rnkcwkw0q5lnmjye7ffxvy7yxscyjl3u4mrr5qxsks76zctmz3qvuftjz")?; | ||
let event: Event = EventBuilder::new_reaction(event_id, public_key, "🧡").to_event(&my_keys)?; | ||
// Send custom event to all relays | ||
// client.send_event(event).await?; | ||
// Send custom event to a specific previously added relay | ||
client.send_event_to("wss://relay.damus.io", event).await?; | ||
// Handle notifications | ||
loop { | ||
let mut notifications = client.notifications(); | ||
while let Ok(notification) = notifications.recv().await { | ||
println!("{:?}", notification); | ||
println!("{notification:?}"); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ fn main() -> Result<()> { | |
.picture(Url::parse("https://example.com/avatar.png")?) | ||
.banner(Url::parse("https://example.com/banner.png")?) | ||
.nip05("[email protected]") | ||
.lud16("yuki@stacker.news"); | ||
.lud16("yuki@getalby.com"); | ||
let event: Event = EventBuilder::set_metadata(metadata)?.to_event(&my_keys)?; | ||
|
@@ -69,6 +69,18 @@ fn main() -> Result<()> { | |
|
||
More examples can be found in the [examples](https://github.com/rust-nostr/nostr/tree/master/crates/nostr/examples) directory. | ||
|
||
## WASM | ||
|
||
This crate supports the `wasm32` targets. | ||
|
||
On macOS you need to install `llvm`: | ||
|
||
```shell | ||
brew install llvm | ||
LLVM_PATH=$(brew --prefix llvm) | ||
AR="${LLVM_PATH}/bin/llvm-ar" CC="${LLVM_PATH}/bin/clang" cargo build --target wasm32-unknown-unknown | ||
``` | ||
|
||
## Crate Feature Flags | ||
|
||
The following crate feature flags are available: | ||
|
@@ -87,18 +99,6 @@ The following crate feature flags are available: | |
| `nip19` | Yes | Enable NIP-19: bech32-encoded entities | | ||
| `nip26` | Yes | Enable NIP-26: Delegated Event Signing | | ||
|
||
## WASM | ||
|
||
This crate supports the `wasm32` targets. | ||
|
||
On macOS you need to install `llvm`: | ||
|
||
```shell | ||
brew install llvm | ||
LLVM_PATH=$(brew --prefix llvm) | ||
AR="${LLVM_PATH}/bin/llvm-ar" CC="${LLVM_PATH}/bin/clang" cargo build --target wasm32-unknown-unknown | ||
``` | ||
|
||
## Supported NIPs | ||
|
||
| Supported | NIP | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ fn main() -> Result<()> { | |
.picture(Url::parse("https://example.com/avatar.png")?) | ||
.banner(Url::parse("https://example.com/banner.png")?) | ||
.nip05("[email protected]") | ||
.lud16("yuki@stacker.news"); | ||
.lud16("yuki@getalby.com"); | ||
|
||
let event: Event = EventBuilder::set_metadata(metadata)?.to_event(&my_keys)?; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,7 +154,7 @@ impl EventBuilder { | |
/// .about("Description") | ||
/// .picture(Url::parse("https://example.com/avatar.png").unwrap()) | ||
/// .nip05("[email protected]") | ||
/// .lud16("yuki@stacker.news"); | ||
/// .lud16("yuki@getalby.com"); | ||
/// | ||
/// let builder = EventBuilder::set_metadata(metadata).unwrap(); | ||
/// ``` | ||
|