Skip to content

Commit aacf124

Browse files
author
Fmar
committed
Merge remote-tracking branch 'origin/master' into lnurl-zaps
# Conflicts: # packages/ndk/lib/domain_layer/usecases/cache_read/cache_read.dart # packages/ndk/lib/domain_layer/usecases/old_relay_manager.dart # packages/ndk/pubspec.yaml # packages/ndk/test/relays/relay_manager_test.dart # packages/ndk/test/usecases/cache_read_test.dart # packages/rust_verifier/.flutter-plugins-dependencies
2 parents ef70824 + d50203f commit aacf124

File tree

73 files changed

+396
-764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+396
-764
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1+
# Dart Nostr Development Kit (NDK)
2+
13
[![Build Status](https://github.com/relaystr/ndk/actions/workflows/tests.yaml/badge.svg?branch=master)](https://github.com/relaystr/ndk/actions?query=workflow%3A"tests"+branch%3Amaster)
24
[![Coverage](https://img.shields.io/codecov/c/github/relaystr/ndk?color=green)](https://codecov.io/github/relaystr/ndk)
35
[![Pub](https://img.shields.io/pub/v/ndk.svg)](https://pub.dev/packages/ndk)
46
[![License](https://img.shields.io/github/license/relaystr/ndk.svg)](LICENSE.txt)
57

6-
# Dart Nostr Development Kit (NDK)
7-
88
NDK (Nostr Development Kit) is a Dart library that enhances the Nostr development experience.\
99
NDK supplies you with high-level usecases like lists or metadata while still allowing you to use low-level queries enhanced with inbox/outbox (gossip) by default.\
1010
Our Target is to make it easy to build constrained Nostr clients, particularly for mobile devices.
1111

12-
# Monorepo Packages
12+
# Get started here ➡️ [pub.dev/packages/ndk](https://pub.dev/packages/ndk)
13+
14+
## Monorepo Packages
15+
16+
NDK ships in small packages to allow granular control of dependencies in your dart/flutter projects.
1317

14-
## [🔗 Dart Nostr Development Kit (NDK)](./packages/ndk/)
18+
### [🔗 Dart Nostr Development Kit (NDK)](./packages/ndk/)
1519

1620
Core package of the NDK. Go here for instructions on how to use the NDK. 📜
1721

18-
## [🔗 amber](./packages/amber/)
22+
### [🔗 amber](./packages/amber/)
1923

2024
Amber signer compatible with the NDK.
2125

22-
## [🔗 ObjectBox](./packages/objectbox/)
26+
### [🔗 ObjectBox](./packages/objectbox/)
2327

2428
ObjectBox database implementation.
2529

26-
## [🔗 rust verifier](./packages/rust_verifier/)
30+
### [🔗 rust verifier](./packages/rust_verifier/)
2731

2832
Event verifier written in Rust.
2933

30-
## [🔗 sample app](./packages/sample-app/)
34+
### [🔗 sample app](./packages/sample-app/)
3135

3236
example app using the NDK.

packages/amber/pubspec.lock

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
8+
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "72.0.0"
11+
version: "76.0.0"
1212
_macros:
1313
dependency: transitive
1414
description: dart
1515
source: sdk
16-
version: "0.3.2"
16+
version: "0.3.3"
1717
amberflutter:
1818
dependency: "direct main"
1919
description:
@@ -26,10 +26,10 @@ packages:
2626
dependency: transitive
2727
description:
2828
name: analyzer
29-
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
29+
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
3030
url: "https://pub.dev"
3131
source: hosted
32-
version: "6.7.0"
32+
version: "6.11.0"
3333
args:
3434
dependency: transitive
3535
description:
@@ -170,10 +170,10 @@ packages:
170170
dependency: transitive
171171
description:
172172
name: collection
173-
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
173+
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
174174
url: "https://pub.dev"
175175
source: hosted
176-
version: "1.18.0"
176+
version: "1.19.0"
177177
convert:
178178
dependency: transitive
179179
description:
@@ -371,18 +371,18 @@ packages:
371371
dependency: transitive
372372
description:
373373
name: leak_tracker
374-
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
374+
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
375375
url: "https://pub.dev"
376376
source: hosted
377-
version: "10.0.5"
377+
version: "10.0.7"
378378
leak_tracker_flutter_testing:
379379
dependency: transitive
380380
description:
381381
name: leak_tracker_flutter_testing
382-
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
382+
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
383383
url: "https://pub.dev"
384384
source: hosted
385-
version: "3.0.5"
385+
version: "3.0.8"
386386
leak_tracker_testing:
387387
dependency: transitive
388388
description:
@@ -419,10 +419,10 @@ packages:
419419
dependency: transitive
420420
description:
421421
name: macros
422-
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
422+
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
423423
url: "https://pub.dev"
424424
source: hosted
425-
version: "0.1.2-main.4"
425+
version: "0.1.3-main.0"
426426
matcher:
427427
dependency: transitive
428428
description:
@@ -586,7 +586,7 @@ packages:
586586
dependency: transitive
587587
description: flutter
588588
source: sdk
589-
version: "0.0.99"
589+
version: "0.0.0"
590590
source_gen:
591591
dependency: transitive
592592
description:
@@ -607,10 +607,10 @@ packages:
607607
dependency: transitive
608608
description:
609609
name: stack_trace
610-
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
610+
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
611611
url: "https://pub.dev"
612612
source: hosted
613-
version: "1.11.1"
613+
version: "1.12.0"
614614
stream_channel:
615615
dependency: transitive
616616
description:
@@ -631,10 +631,10 @@ packages:
631631
dependency: transitive
632632
description:
633633
name: string_scanner
634-
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
634+
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
635635
url: "https://pub.dev"
636636
source: hosted
637-
version: "1.2.0"
637+
version: "1.3.0"
638638
sync_http:
639639
dependency: transitive
640640
description:
@@ -655,10 +655,10 @@ packages:
655655
dependency: transitive
656656
description:
657657
name: test_api
658-
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
658+
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
659659
url: "https://pub.dev"
660660
source: hosted
661-
version: "0.7.2"
661+
version: "0.7.3"
662662
timing:
663663
dependency: transitive
664664
description:
@@ -687,10 +687,10 @@ packages:
687687
dependency: transitive
688688
description:
689689
name: vm_service
690-
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
690+
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
691691
url: "https://pub.dev"
692692
source: hosted
693-
version: "14.2.5"
693+
version: "14.3.0"
694694
watcher:
695695
dependency: transitive
696696
description:
@@ -727,10 +727,10 @@ packages:
727727
dependency: transitive
728728
description:
729729
name: webdriver
730-
sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
730+
sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8"
731731
url: "https://pub.dev"
732732
source: hosted
733-
version: "3.0.3"
733+
version: "3.0.4"
734734
yaml:
735735
dependency: transitive
736736
description:

packages/ndk/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
# Dart Nostr Development Kit (NDK)
2+
13
[![Build Status](https://github.com/relaystr/ndk/actions/workflows/tests.yaml/badge.svg?branch=master)](https://github.com/relaystr/ndk/actions?query=workflow%3A"tests"+branch%3Amaster)
24
[![Coverage](https://img.shields.io/codecov/c/github/relaystr/ndk?color=green)](https://codecov.io/github/relaystr/ndk)
35
[![Pub](https://img.shields.io/pub/v/ndk.svg)](https://pub.dev/packages/ndk)
46
[![License](https://img.shields.io/github/license/relaystr/ndk.svg)](LICENSE.txt)
57

6-
# Dart Nostr Development Kit (NDK)
7-
88
NDK (Nostr Development Kit) is a Dart library that enhances the Nostr development experience.\
99
NDK supplies you with high-level usecases like lists or metadata while still allowing you to use low-level queries enhanced with inbox/outbox (gossip) by default.\
1010
Our Target is to make it easy to build constrained Nostr clients, particularly for mobile devices.
@@ -96,7 +96,7 @@ import 'package:ndk_amber/ndk_amber.dart';
9696

9797
## Usage
9898

99-
> **more [examples 🔗](https://github.com/relaystr/ndk/tree/master/packages/ndk/example)**
99+
> **more [examples 🔗](https://pub.dev/packages/ndk/example)**
100100
101101
```dart
102102
import 'package:ndk/ndk.dart';
@@ -199,14 +199,14 @@ more details on <https://mikedilger.com/gossip-model/>
199199

200200
# Common terminology
201201

202-
| term | explanation | simmilar to |
203-
| ------------------- | -------------------------------------------------------- | --------------------------- |
204-
| **broadcastEvent** | push event to nostr network/relays | postEvent, publishEvent |
205-
| **JIT** | Just In Time, e.g. as it happens | - |
206-
| **query** | get data once and close the request | get request |
207-
| **subscription** | stream of events as they come in | stream of data |
208-
| **bootstrapRelays** | default relays to connect; Used to get Nip65 data | seed relays, initial relays |
209-
| **engine** | optimized network resolver for nostr requests | - |
202+
| term | explanation | simmilar to |
203+
| ------------------- | ------------------------------------------------- | --------------------------- |
204+
| **broadcastEvent** | push event to nostr network/relays | postEvent, publishEvent |
205+
| **JIT** | Just In Time, e.g. as it happens | - |
206+
| **query** | get data once and close the request | get request |
207+
| **subscription** | stream of events as they come in | stream of data |
208+
| **bootstrapRelays** | default relays to connect; Used to get Nip65 data | seed relays, initial relays |
209+
| **engine** | optimized network resolver for nostr requests | - |
210210

211211
$~~~~~~~~~~~$
212212

packages/ndk/example/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,18 @@ final ndk = Ndk(
5555
NdkConfig(
5656
eventVerifier: RustEventVerifier(),
5757
cache: MemCacheManager(),
58+
59+
// optional:
60+
logLevel: Logger.logLevels.debug,
61+
bootstrapRelays: ["wss://myrelay.example", "wss://myrelay2.example"],
62+
ignoreRelays: ['wss://bad.reputation']
63+
engine: NdkEngine.JIT,
64+
defaultQueryTimeout: Duration(seconds: 10),
65+
eventOutFilters: [MyEventFilter()],
5866
),
5967
);
6068
```
6169

62-
**Available configs:**
63-
64-
eventVerifier: `Bip340EventVerifier()` `RustEventVerifier()` \
65-
cache: `MemCacheManager()` \
66-
bootstrapRelays: `['wss://myrelay.example']` \
67-
engine: `NdkEngine.RELAY_SETS` `NdkEngine.JIT` \
68-
eventSigner: `Bip340EventSigner('nsec1...', 'npub1...')` \
69-
ignoreRelays: `['wss://bad.reputation']`
70-
7170
$~~~~~~~~~~~$
7271

7372
#### 2️⃣ Usecase

packages/ndk/example/basic_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'package:test/test.dart';
24
import 'package:ndk/ndk.dart';
35

packages/ndk/example/nwc/connect_get_info.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'dart:io';
24
import 'package:ndk/ndk.dart';
35

packages/ndk/example/nwc/get_balance.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'dart:io';
24

35
import 'package:ndk/ndk.dart';
4-
import 'package:ndk/shared/logger/logger.dart';
56
import 'package:logger/logger.dart' as lib_logger;
67

78
void main() async {

packages/ndk/example/nwc/list_transactions.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'dart:io';
24

3-
import 'package:ndk/domain_layer/usecases/nwc/consts/transaction_type.dart';
45
import 'package:ndk/ndk.dart';
5-
import 'package:test/test.dart';
66

77
void main() async {
88
// We use an empty bootstrap relay list,
@@ -16,9 +16,9 @@ void main() async {
1616
ListTransactionsResponse response =
1717
await ndk.nwc.listTransactions(connection, unpaid: false);
1818

19-
response.transactions.forEach((transaction) {
19+
for (final transaction in response.transactions) {
2020
print(
2121
"Transaction ${transaction.type} ${transaction.amountSat} sats ${transaction.description!}");
22-
});
22+
}
2323
await ndk.destroy();
2424
}

packages/ndk/example/nwc/make_invoice.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'dart:io';
24

35
import 'package:ndk/ndk.dart';

packages/ndk/example/nwc/notifications.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'dart:io';
24

35
import 'package:ndk/ndk.dart';
@@ -14,7 +16,6 @@ void main() async {
1416
await for (final notification in connection.notificationStream.stream) {
1517
print('notification ${notification.type} amount: ${notification.amount}');
1618
}
17-
;
1819

1920
ndk.destroy();
2021
}

0 commit comments

Comments
 (0)