Skip to content

Commit

Permalink
book: enhance hello.md with explanatory steps
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Nov 26, 2024
1 parent 24293c5 commit 3b974d3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion book/snippets/js/src/hello.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export async function hello() {

// ANCHOR: connect
await client.addRelay("wss://relay.damus.io")

await client.connect();
// ANCHOR_END: connect

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ suspend fun hello() {

// ANCHOR: connect
//client.addRelay("wss://relay.damus.io")

//client.connect()
// ANCHOR_END: connect

Expand Down
1 change: 0 additions & 1 deletion book/snippets/python/src/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ async def hello():

# ANCHOR: connect
await client.add_relay("wss://relay.damus.io")

await client.connect()
# ANCHOR_END: connect

Expand Down
1 change: 0 additions & 1 deletion book/snippets/rust/src/hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub async fn hello() -> Result<()> {

// ANCHOR: connect
client.add_relay("wss://relay.damus.io").await?;

client.connect().await;
// ANCHOR_END: connect

Expand Down
11 changes: 11 additions & 0 deletions book/src/sdk/hello.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Now that you’ve installed the SDK, it’s time to write your first nostr progr

### Generate random keys and construct the client

The first step is to generate random keys needed for the client and construct the client instance.

<custom-tabs category="lang">
<div slot="title">Rust</div>
<section>
Expand Down Expand Up @@ -58,6 +60,8 @@ TODO

### Add some relays and connect

Next, add some relays to your client and connect to them.

<custom-tabs category="lang">
<div slot="title">Rust</div>
<section>
Expand Down Expand Up @@ -113,6 +117,9 @@ TODO

### Publish a text note

Now that the client is constructed and the relays are connected,
build a text note with the [EventBuilder](event/builder.md) and publish it to relays.

<custom-tabs category="lang">
<div slot="title">Rust</div>
<section>
Expand Down Expand Up @@ -167,6 +174,8 @@ TODO

### Inspect the output

Published the event, you can inspect the output to ensure everything worked correctly.

<custom-tabs category="lang">
<div slot="title">Rust</div>
<section>
Expand Down Expand Up @@ -221,6 +230,8 @@ TODO

### Full example

Here’s the full example that includes all the steps from generating keys to inspecting the output.

<custom-tabs category="lang">
<div slot="title">Rust</div>
<section>
Expand Down

0 comments on commit 3b974d3

Please sign in to comment.