-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
140 changed files
with
862 additions
and
918 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 |
---|---|---|
|
@@ -19,7 +19,7 @@ async def main(): | |
.set_picture("https://example.com/avatar.png") \ | ||
.set_banner("https://example.com/banner.png") \ | ||
.set_nip05("[email protected]") \ | ||
.set_lud16("yuki@getalby.com") | ||
.set_lud16("pay@yukikishimoto.com") | ||
|
||
print(f"Setting profile metadata for {keys.public_key().to_bech32()}...") | ||
print(metadata.as_json()) | ||
|
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 |
---|---|---|
|
@@ -45,7 +45,7 @@ async function main() { | |
.picture("https://example.com/avatar.png") | ||
.banner("https://example.com/banner.png") | ||
.nip05("[email protected]") | ||
.lud16("yuki@getalby.com"); | ||
.lud16("pay@yukikishimoto.com"); | ||
|
||
await client.setMetadata(metadata); | ||
|
||
|
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 |
---|---|---|
|
@@ -32,7 +32,7 @@ async function main() { | |
.picture("https://example.com/avatar.png") | ||
.banner("https://example.com/banner.png") | ||
.nip05("[email protected]") | ||
.lud16("yuki@getalby.com"); | ||
.lud16("pay@yukikishimoto.com"); | ||
|
||
await client.setMetadata(metadata); | ||
|
||
|
@@ -57,4 +57,4 @@ async function main() { | |
await client.sendEventBuilder(builder); | ||
} | ||
|
||
main(); | ||
main(); |
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,3 +1,15 @@ | ||
test: | ||
cd nostr && just test | ||
cd nostr-sdk && just test | ||
test: rust python js kotlin | ||
|
||
rust: | ||
cd rust && cargo build | ||
|
||
python: | ||
cd python && just test | ||
|
||
js: | ||
cd js && npm i | ||
node js/index.js | ||
|
||
kotlin: | ||
cd kotlin && just test | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
book/snippets/nostr-sdk/rust/Cargo.toml → book/snippets/rust/Cargo.toml
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "snippets-nostr-sdk-rust" | ||
name = "snippets-rust" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
.../snippets/nostr/rust/src/event/builder.rs → book/snippets/rust/src/event/builder.rs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use nostr::prelude::*; | ||
use nostr_sdk::prelude::*; | ||
|
||
pub fn event() -> Result<()> { | ||
let keys = Keys::generate(); | ||
|
2 changes: 1 addition & 1 deletion
2
book/snippets/nostr/rust/src/event/json.rs → book/snippets/rust/src/event/json.rs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use nostr::prelude::*; | ||
use nostr_sdk::prelude::*; | ||
|
||
pub fn event() -> Result<()> { | ||
// Deserialize from json | ||
|
File renamed without changes.
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,28 @@ | ||
// ANCHOR: all | ||
use nostr_sdk::prelude::*; | ||
|
||
pub async fn hello() -> Result<()> { | ||
// ANCHOR: keys | ||
let keys: Keys = Keys::generate(); | ||
// ANCHOR_END: keys | ||
|
||
// ANCHOR: client | ||
let client = Client::new(keys); | ||
// ANCHOR_END: client | ||
|
||
// ANCHOR: connect | ||
client.add_relay("wss://relay.damus.io").await?; | ||
client.add_read_relay("wss://relay.nostr.info").await?; | ||
|
||
client.connect().await; | ||
// ANCHOR_END: connect | ||
|
||
// ANCHOR: publish | ||
let builder = EventBuilder::text_note("Hello, rust-nostr!", []); | ||
client.send_event_builder(builder).await?; | ||
// ANCHOR_END: publish | ||
|
||
Ok(()) | ||
} | ||
|
||
// ANCHOR_END: all |
2 changes: 1 addition & 1 deletion
2
book/snippets/nostr/rust/src/keys.rs → book/snippets/rust/src/keys.rs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use nostr::prelude::*; | ||
use nostr_sdk::prelude::*; | ||
|
||
// ANCHOR: generate | ||
pub fn generate() -> Result<()> { | ||
|
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...snippets/nostr/rust/src/messages/relay.rs → book/snippets/rust/src/messages/relay.rs
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
2 changes: 1 addition & 1 deletion
2
book/snippets/nostr/rust/src/nip01.rs → book/snippets/rust/src/nip01.rs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use nostr::prelude::*; | ||
use nostr_sdk::prelude::*; | ||
|
||
pub fn nip01() -> Result<()> { | ||
let keys = Keys::generate(); | ||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
book/snippets/nostr/rust/src/nip44.rs → book/snippets/rust/src/nip44.rs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use nostr::prelude::*; | ||
use nostr_sdk::prelude::*; | ||
|
||
pub fn run() -> Result<()> { | ||
let keys = Keys::generate(); | ||
|
2 changes: 1 addition & 1 deletion
2
book/snippets/nostr/rust/src/nip59.rs → book/snippets/rust/src/nip59.rs
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use nostr::prelude::*; | ||
use nostr_sdk::prelude::*; | ||
|
||
pub async fn run() -> Result<()> { | ||
// Sender keys | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
Oops, something went wrong.