-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `org.jetbrains.kotlinx:kotlinx-coroutines-core` dependency to `android` bindings * No longer spawn a thread when calling `handle_notifications` * Remove `AbortHandle` Signed-off-by: Yuki Kishimoto <yukikishimoto@protonmail.com>
- Loading branch information
Showing
38 changed files
with
1,352 additions
and
1,346 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
36 changes: 20 additions & 16 deletions
36
bindings/nostr-sdk-ffi/bindings-python/examples/blacklist.py
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,23 +1,27 @@ | ||
import asyncio | ||
from nostr_sdk import PublicKey, Client, Filter, Kind, init_logger, LogLevel | ||
from datetime import timedelta | ||
import time | ||
|
||
# Init logger | ||
init_logger(LogLevel.INFO) | ||
|
||
# Init client | ||
client = Client() | ||
client.add_relay("wss://relay.damus.io") | ||
client.add_relay("wss://nos.lol") | ||
client.connect() | ||
async def main(): | ||
# Init logger | ||
init_logger(LogLevel.INFO) | ||
|
||
muted_public_key = PublicKey.parse("npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft") | ||
other_public_key = PublicKey.parse("npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s") | ||
# Init client | ||
client = Client() | ||
await client.add_relays(["wss://relay.damus.io", "wss://nos.lol"]) | ||
await client.connect() | ||
|
||
# Mute public key | ||
client.mute_public_keys([muted_public_key]) | ||
muted_public_key = PublicKey.parse("npub1l2vyh47mk2p0qlsku7hg0vn29faehy9hy34ygaclpn66ukqp3afqutajft") | ||
other_public_key = PublicKey.parse("npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s") | ||
|
||
# Get events | ||
f = Filter().authors([muted_public_key, other_public_key]).kind(Kind(0)) | ||
events = client.get_events_of([f], timedelta(seconds=10)) | ||
print(f"Received {events.__len__()} events") | ||
# Mute public key | ||
await client.mute_public_keys([muted_public_key]) | ||
|
||
# Get events | ||
f = Filter().authors([muted_public_key, other_public_key]).kind(Kind(0)) | ||
events = await client.get_events_of([f], timedelta(seconds=10)) | ||
print(f"Received {events.__len__()} events") | ||
|
||
|
||
asyncio.run(main()) |
Oops, something went wrong.