-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yuki Kishimoto <[email protected]>
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// ANCHOR: full | ||
import {Keys, Client, EventBuilder, NostrSigner} from "@rust-nostr/nostr-sdk"; | ||
|
||
export async function hello() { | ||
// ANCHOR: client | ||
let keys: Keys = Keys.generate(); | ||
let signer = NostrSigner.keys(keys); | ||
let client = new Client(signer); | ||
// ANCHOR_END: client | ||
|
||
// ANCHOR: connect | ||
await client.addRelay("wss://relay.damus.io") | ||
|
||
await client.connect(); | ||
// ANCHOR_END: connect | ||
|
||
// ANCHOR: publish | ||
let builder = EventBuilder.textNote("Hello, rust-nostr!", []); | ||
await client.sendEventBuilder(builder); | ||
// ANCHOR_END: publish | ||
} | ||
// ANCHOR_END: full |
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