@openclaw/nostr 2026.7.2-beta.7 → 2026.7.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/dist/{channel-O6-jXoT5.js → .setup/channel-B4SX7Iq6.mjs} +554 -877
  2. package/dist/{config-schema-CelPzg1N.js → .setup/config-schema-DIiXiBKr.mjs} +1 -1
  3. package/dist/.setup/inbound-direct-dm-runtime-EdLLVtkh.mjs +2 -0
  4. package/dist/{setup-adapter-BjKmSwdW.js → .setup/setup-adapter-DEU3o8MF.mjs} +1 -31
  5. package/dist/.setup/setup-plugin-api-DzlCumkz.mjs +2 -0
  6. package/dist/.setup/setup-plugin-api-csfJrRxD.mjs +111 -0
  7. package/dist/{setup-surface-BJCFpe02.js → .setup/setup-surface-DWa6-9ku.mjs} +70 -41
  8. package/dist/api.js +72 -61
  9. package/dist/channel-plugin-api.js +1 -1
  10. package/dist/doctor-contract-api.js +3 -2
  11. package/dist/setup-api.js +1 -1
  12. package/dist/setup-entry.js +2 -1
  13. package/dist/setup-plugin-api.js +1 -112
  14. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js +28 -59
  15. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +3 -3
  16. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +7 -44
  17. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +2 -2
  18. package/node_modules/nostr-tools/lib/cjs/core.js +1 -17
  19. package/node_modules/nostr-tools/lib/cjs/core.js.map +3 -3
  20. package/node_modules/nostr-tools/lib/cjs/filter.js.map +1 -1
  21. package/node_modules/nostr-tools/lib/cjs/index.js +130 -172
  22. package/node_modules/nostr-tools/lib/cjs/index.js.map +4 -4
  23. package/node_modules/nostr-tools/lib/cjs/kinds.js +1 -17
  24. package/node_modules/nostr-tools/lib/cjs/kinds.js.map +3 -3
  25. package/node_modules/nostr-tools/lib/cjs/nip04.js.map +1 -1
  26. package/node_modules/nostr-tools/lib/cjs/nip10.js +5 -20
  27. package/node_modules/nostr-tools/lib/cjs/nip10.js.map +3 -3
  28. package/node_modules/nostr-tools/lib/cjs/nip13.js.map +1 -1
  29. package/node_modules/nostr-tools/lib/cjs/nip17.js +23 -30
  30. package/node_modules/nostr-tools/lib/cjs/nip17.js.map +4 -4
  31. package/node_modules/nostr-tools/lib/cjs/nip18.js +14 -21
  32. package/node_modules/nostr-tools/lib/cjs/nip18.js.map +4 -4
  33. package/node_modules/nostr-tools/lib/cjs/nip19.js.map +1 -1
  34. package/node_modules/nostr-tools/lib/cjs/nip21.js.map +1 -1
  35. package/node_modules/nostr-tools/lib/cjs/nip22.js +7 -22
  36. package/node_modules/nostr-tools/lib/cjs/nip22.js.map +3 -3
  37. package/node_modules/nostr-tools/lib/cjs/nip25.js +14 -21
  38. package/node_modules/nostr-tools/lib/cjs/nip25.js.map +4 -4
  39. package/node_modules/nostr-tools/lib/cjs/nip27.js.map +1 -1
  40. package/node_modules/nostr-tools/lib/cjs/nip28.js +14 -21
  41. package/node_modules/nostr-tools/lib/cjs/nip28.js.map +4 -4
  42. package/node_modules/nostr-tools/lib/cjs/nip29.js.map +1 -1
  43. package/node_modules/nostr-tools/lib/cjs/nip30.js.map +2 -2
  44. package/node_modules/nostr-tools/lib/cjs/nip42.js.map +2 -2
  45. package/node_modules/nostr-tools/lib/cjs/nip44.js.map +1 -1
  46. package/node_modules/nostr-tools/lib/cjs/nip45.js +9 -22
  47. package/node_modules/nostr-tools/lib/cjs/nip45.js.map +4 -4
  48. package/node_modules/nostr-tools/lib/cjs/nip46.js +70 -111
  49. package/node_modules/nostr-tools/lib/cjs/nip46.js.map +4 -4
  50. package/node_modules/nostr-tools/lib/cjs/nip47.js +18 -25
  51. package/node_modules/nostr-tools/lib/cjs/nip47.js.map +4 -4
  52. package/node_modules/nostr-tools/lib/cjs/nip57.js +16 -23
  53. package/node_modules/nostr-tools/lib/cjs/nip57.js.map +4 -4
  54. package/node_modules/nostr-tools/lib/cjs/nip58.js.map +2 -2
  55. package/node_modules/nostr-tools/lib/cjs/nip59.js +7 -16
  56. package/node_modules/nostr-tools/lib/cjs/nip59.js.map +3 -3
  57. package/node_modules/nostr-tools/lib/cjs/nip75.js.map +1 -1
  58. package/node_modules/nostr-tools/lib/cjs/nip94.js.map +1 -1
  59. package/node_modules/nostr-tools/lib/cjs/nip98.js +16 -23
  60. package/node_modules/nostr-tools/lib/cjs/nip98.js.map +4 -4
  61. package/node_modules/nostr-tools/lib/cjs/nip99.js.map +2 -2
  62. package/node_modules/nostr-tools/lib/cjs/nipb0.js +17 -38
  63. package/node_modules/nostr-tools/lib/cjs/nipb0.js.map +4 -4
  64. package/node_modules/nostr-tools/lib/cjs/nipb7.js +7 -13
  65. package/node_modules/nostr-tools/lib/cjs/nipb7.js.map +2 -2
  66. package/node_modules/nostr-tools/lib/cjs/pool.js +61 -102
  67. package/node_modules/nostr-tools/lib/cjs/pool.js.map +4 -4
  68. package/node_modules/nostr-tools/lib/cjs/pure.js +14 -21
  69. package/node_modules/nostr-tools/lib/cjs/pure.js.map +4 -4
  70. package/node_modules/nostr-tools/lib/cjs/references.js.map +1 -1
  71. package/node_modules/nostr-tools/lib/cjs/relay.js +42 -86
  72. package/node_modules/nostr-tools/lib/cjs/relay.js.map +4 -4
  73. package/node_modules/nostr-tools/lib/cjs/signer.js +14 -21
  74. package/node_modules/nostr-tools/lib/cjs/signer.js.map +4 -4
  75. package/node_modules/nostr-tools/lib/cjs/utils.js +0 -10
  76. package/node_modules/nostr-tools/lib/cjs/utils.js.map +2 -2
  77. package/node_modules/nostr-tools/lib/cjs/wasm.js +2 -16
  78. package/node_modules/nostr-tools/lib/cjs/wasm.js.map +4 -4
  79. package/node_modules/nostr-tools/lib/esm/abstract-pool.js +28 -59
  80. package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +3 -3
  81. package/node_modules/nostr-tools/lib/esm/abstract-relay.js +7 -44
  82. package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +2 -2
  83. package/node_modules/nostr-tools/lib/esm/core.js +1 -15
  84. package/node_modules/nostr-tools/lib/esm/core.js.map +3 -3
  85. package/node_modules/nostr-tools/lib/esm/filter.js.map +1 -1
  86. package/node_modules/nostr-tools/lib/esm/index.js +80 -122
  87. package/node_modules/nostr-tools/lib/esm/index.js.map +4 -4
  88. package/node_modules/nostr-tools/lib/esm/kinds.js +1 -17
  89. package/node_modules/nostr-tools/lib/esm/kinds.js.map +3 -3
  90. package/node_modules/nostr-tools/lib/esm/nip04.js.map +1 -1
  91. package/node_modules/nostr-tools/lib/esm/nip10.js +5 -18
  92. package/node_modules/nostr-tools/lib/esm/nip10.js.map +3 -3
  93. package/node_modules/nostr-tools/lib/esm/nip13.js.map +1 -1
  94. package/node_modules/nostr-tools/lib/esm/nip17.js +8 -15
  95. package/node_modules/nostr-tools/lib/esm/nip17.js.map +4 -4
  96. package/node_modules/nostr-tools/lib/esm/nip18.js +8 -15
  97. package/node_modules/nostr-tools/lib/esm/nip18.js.map +4 -4
  98. package/node_modules/nostr-tools/lib/esm/nip19.js.map +1 -1
  99. package/node_modules/nostr-tools/lib/esm/nip21.js.map +1 -1
  100. package/node_modules/nostr-tools/lib/esm/nip22.js +7 -20
  101. package/node_modules/nostr-tools/lib/esm/nip22.js.map +3 -3
  102. package/node_modules/nostr-tools/lib/esm/nip25.js +8 -15
  103. package/node_modules/nostr-tools/lib/esm/nip25.js.map +4 -4
  104. package/node_modules/nostr-tools/lib/esm/nip27.js.map +1 -1
  105. package/node_modules/nostr-tools/lib/esm/nip28.js +8 -15
  106. package/node_modules/nostr-tools/lib/esm/nip28.js.map +4 -4
  107. package/node_modules/nostr-tools/lib/esm/nip29.js.map +1 -1
  108. package/node_modules/nostr-tools/lib/esm/nip30.js.map +2 -2
  109. package/node_modules/nostr-tools/lib/esm/nip42.js.map +2 -2
  110. package/node_modules/nostr-tools/lib/esm/nip44.js.map +1 -1
  111. package/node_modules/nostr-tools/lib/esm/nip45.js +10 -23
  112. package/node_modules/nostr-tools/lib/esm/nip45.js.map +4 -4
  113. package/node_modules/nostr-tools/lib/esm/nip46.js +54 -95
  114. package/node_modules/nostr-tools/lib/esm/nip46.js.map +4 -4
  115. package/node_modules/nostr-tools/lib/esm/nip47.js +8 -15
  116. package/node_modules/nostr-tools/lib/esm/nip47.js.map +4 -4
  117. package/node_modules/nostr-tools/lib/esm/nip57.js +10 -17
  118. package/node_modules/nostr-tools/lib/esm/nip57.js.map +4 -4
  119. package/node_modules/nostr-tools/lib/esm/nip58.js.map +2 -2
  120. package/node_modules/nostr-tools/lib/esm/nip59.js +1 -10
  121. package/node_modules/nostr-tools/lib/esm/nip59.js.map +3 -3
  122. package/node_modules/nostr-tools/lib/esm/nip75.js.map +1 -1
  123. package/node_modules/nostr-tools/lib/esm/nip94.js.map +1 -1
  124. package/node_modules/nostr-tools/lib/esm/nip98.js +8 -15
  125. package/node_modules/nostr-tools/lib/esm/nip98.js.map +4 -4
  126. package/node_modules/nostr-tools/lib/esm/nip99.js.map +2 -2
  127. package/node_modules/nostr-tools/lib/esm/nipb0.js +18 -39
  128. package/node_modules/nostr-tools/lib/esm/nipb0.js.map +4 -4
  129. package/node_modules/nostr-tools/lib/esm/nipb7.js +7 -13
  130. package/node_modules/nostr-tools/lib/esm/nipb7.js.map +2 -2
  131. package/node_modules/nostr-tools/lib/esm/pool.js +54 -95
  132. package/node_modules/nostr-tools/lib/esm/pool.js.map +4 -4
  133. package/node_modules/nostr-tools/lib/esm/pure.js +8 -15
  134. package/node_modules/nostr-tools/lib/esm/pure.js.map +4 -4
  135. package/node_modules/nostr-tools/lib/esm/references.js.map +1 -1
  136. package/node_modules/nostr-tools/lib/esm/relay.js +36 -80
  137. package/node_modules/nostr-tools/lib/esm/relay.js.map +4 -4
  138. package/node_modules/nostr-tools/lib/esm/signer.js +8 -15
  139. package/node_modules/nostr-tools/lib/esm/signer.js.map +4 -4
  140. package/node_modules/nostr-tools/lib/esm/utils.js +0 -10
  141. package/node_modules/nostr-tools/lib/esm/utils.js.map +2 -2
  142. package/node_modules/nostr-tools/lib/esm/wasm.js +3 -17
  143. package/node_modules/nostr-tools/lib/esm/wasm.js.map +4 -4
  144. package/node_modules/nostr-tools/lib/nostr.bundle.js +77 -121
  145. package/node_modules/nostr-tools/lib/nostr.bundle.js.map +4 -4
  146. package/node_modules/nostr-tools/lib/types/abstract-pool.d.ts +4 -7
  147. package/node_modules/nostr-tools/lib/types/abstract-relay.d.ts +2 -7
  148. package/node_modules/nostr-tools/lib/types/helpers.d.ts +2 -0
  149. package/node_modules/nostr-tools/lib/types/kinds.d.ts +0 -2
  150. package/node_modules/nostr-tools/lib/types/nipb0.d.ts +1 -0
  151. package/node_modules/nostr-tools/lib/types/nipb7.d.ts +1 -0
  152. package/node_modules/nostr-tools/lib/types/relay.d.ts +2 -2
  153. package/node_modules/nostr-tools/lib/types/utils.d.ts +0 -4
  154. package/node_modules/nostr-tools/package.json +1 -1
  155. package/openclaw.plugin.json +5 -0
  156. package/package.json +15 -41
  157. package/dist/inbound-direct-dm-runtime-DHn9NoYN.js +0 -2
  158. package/node_modules/nostr-tools/lib/types/nipb0.test.d.ts +0 -1
  159. /package/dist/{state-account-id-CvBZ9s6P.js → .setup/state-account-id-CvBZ9s6P.mjs} +0 -0
@@ -2,41 +2,6 @@
2
2
  import { schnorr } from "@noble/curves/secp256k1.js";
3
3
  import { bytesToHex as bytesToHex2, hexToBytes as hexToBytes2 } from "@noble/hashes/utils.js";
4
4
 
5
- // utils.ts
6
- import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
7
- var utf8Decoder = new TextDecoder("utf-8");
8
- var utf8Encoder = new TextEncoder();
9
- function normalizeURL(url) {
10
- try {
11
- if (url.indexOf("://") === -1)
12
- url = "wss://" + url;
13
- let p = new URL(url);
14
- if (p.protocol === "http:")
15
- p.protocol = "ws:";
16
- else if (p.protocol === "https:")
17
- p.protocol = "wss:";
18
- p.pathname = p.pathname.replace(/\/+/g, "/");
19
- if (p.pathname.endsWith("/"))
20
- p.pathname = p.pathname.slice(0, -1);
21
- if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
22
- p.port = "";
23
- p.searchParams.sort();
24
- p.hash = "";
25
- return p.toString();
26
- } catch (e) {
27
- throw new Error(`Invalid URL: ${url}`);
28
- }
29
- }
30
- function isHex32(input) {
31
- for (let i2 = 0; i2 < 64; i2++) {
32
- let cc = input.charCodeAt(i2);
33
- if (isNaN(cc) || cc < 48 || cc > 102 || cc > 57 && cc < 97) {
34
- return false;
35
- }
36
- }
37
- return true;
38
- }
39
-
40
5
  // core.ts
41
6
  var verifiedSymbol = Symbol("verified");
42
7
  var isRecord = (obj) => obj instanceof Object;
@@ -51,7 +16,7 @@ function validateEvent(event) {
51
16
  return false;
52
17
  if (typeof event.pubkey !== "string")
53
18
  return false;
54
- if (!isHex32(event.pubkey))
19
+ if (!event.pubkey.match(/^[a-f0-9]{64}$/))
55
20
  return false;
56
21
  if (!Array.isArray(event.tags))
57
22
  return false;
@@ -69,6 +34,34 @@ function validateEvent(event) {
69
34
 
70
35
  // pure.ts
71
36
  import { sha256 } from "@noble/hashes/sha2.js";
37
+
38
+ // utils.ts
39
+ import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
40
+ var utf8Decoder = new TextDecoder("utf-8");
41
+ var utf8Encoder = new TextEncoder();
42
+ function normalizeURL(url) {
43
+ try {
44
+ if (url.indexOf("://") === -1)
45
+ url = "wss://" + url;
46
+ let p = new URL(url);
47
+ if (p.protocol === "http:")
48
+ p.protocol = "ws:";
49
+ else if (p.protocol === "https:")
50
+ p.protocol = "wss:";
51
+ p.pathname = p.pathname.replace(/\/+/g, "/");
52
+ if (p.pathname.endsWith("/"))
53
+ p.pathname = p.pathname.slice(0, -1);
54
+ if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
55
+ p.port = "";
56
+ p.searchParams.sort();
57
+ p.hash = "";
58
+ return p.toString();
59
+ } catch (e) {
60
+ throw new Error(`Invalid URL: ${url}`);
61
+ }
62
+ }
63
+
64
+ // pure.ts
72
65
  var JS = class {
73
66
  generateSecretKey() {
74
67
  return schnorr.utils.randomSecretKey();
@@ -210,14 +203,12 @@ var AbstractRelay = class {
210
203
  openSubs = /* @__PURE__ */ new Map();
211
204
  enablePing;
212
205
  enableReconnect;
213
- idleTimeout = 0;
214
206
  idleSince = Date.now();
215
207
  ongoingOperations = 0;
216
208
  reconnectTimeoutHandle;
217
209
  pingIntervalHandle;
218
210
  reconnectAttempts = 0;
219
211
  skipReconnection = false;
220
- idleTimeoutHandle;
221
212
  connectionPromise;
222
213
  openCountRequests = /* @__PURE__ */ new Map();
223
214
  openEventPublishes = /* @__PURE__ */ new Map();
@@ -233,8 +224,6 @@ var AbstractRelay = class {
233
224
  this._WebSocket = opts.websocketImplementation || WebSocket;
234
225
  this.enablePing = opts.enablePing;
235
226
  this.enableReconnect = opts.enableReconnect || false;
236
- if (opts.idleTimeout)
237
- this.idleTimeout = opts.idleTimeout;
238
227
  }
239
228
  static async connect(url, opts) {
240
229
  const relay = new AbstractRelay(url, opts);
@@ -258,22 +247,6 @@ var AbstractRelay = class {
258
247
  get connected() {
259
248
  return this._connected;
260
249
  }
261
- clearIdleTimeout() {
262
- if (this.idleTimeoutHandle) {
263
- clearTimeout(this.idleTimeoutHandle);
264
- this.idleTimeoutHandle = void 0;
265
- }
266
- }
267
- scheduleIdleClose() {
268
- this.clearIdleTimeout();
269
- if (this.idleTimeout > 0) {
270
- this.idleTimeoutHandle = setTimeout(() => {
271
- if (this.ongoingOperations === 0 && this.idleSince) {
272
- this.close();
273
- }
274
- }, this.idleTimeout);
275
- }
276
- }
277
250
  async reconnect() {
278
251
  const backoff = this.resubscribeBackoff[Math.min(this.reconnectAttempts, this.resubscribeBackoff.length - 1)];
279
252
  this.reconnectAttempts++;
@@ -285,11 +258,6 @@ var AbstractRelay = class {
285
258
  }, backoff);
286
259
  }
287
260
  handleHardClose(reason) {
288
- if (this.ws) {
289
- this.ws.onopen = null;
290
- this.ws.onerror = null;
291
- this.ws.onclose = null;
292
- }
293
261
  if (this.pingIntervalHandle) {
294
262
  clearInterval(this.pingIntervalHandle);
295
263
  this.pingIntervalHandle = void 0;
@@ -297,7 +265,6 @@ var AbstractRelay = class {
297
265
  this._connected = false;
298
266
  this.connectionPromise = void 0;
299
267
  this.idleSince = void 0;
300
- this.clearIdleTimeout();
301
268
  if (this.enableReconnect && !this.skipReconnection) {
302
269
  this.reconnect();
303
270
  } else {
@@ -320,6 +287,7 @@ var AbstractRelay = class {
320
287
  if (this.reconnectAttempts === 0) {
321
288
  this.skipReconnection = true;
322
289
  }
290
+ this.onclose?.();
323
291
  this.handleHardClose("relay connection timed out");
324
292
  }, opts.timeout);
325
293
  }
@@ -365,6 +333,7 @@ var AbstractRelay = class {
365
333
  if (this.reconnectAttempts === 0) {
366
334
  this.skipReconnection = true;
367
335
  }
336
+ this.onclose?.();
368
337
  this.handleHardClose("relay connection failed");
369
338
  };
370
339
  this.ws.onclose = (ev) => {
@@ -453,7 +422,6 @@ var AbstractRelay = class {
453
422
  }
454
423
  async publish(event) {
455
424
  this.idleSince = void 0;
456
- this.clearIdleTimeout();
457
425
  this.ongoingOperations++;
458
426
  const ret = new Promise((resolve, reject) => {
459
427
  const timeout = setTimeout(() => {
@@ -475,10 +443,8 @@ var AbstractRelay = class {
475
443
  }
476
444
  }
477
445
  this.ongoingOperations--;
478
- if (this.ongoingOperations === 0) {
446
+ if (this.ongoingOperations === 0)
479
447
  this.idleSince = Date.now();
480
- this.scheduleIdleClose();
481
- }
482
448
  return ret;
483
449
  }
484
450
  async count(filters, params) {
@@ -504,7 +470,6 @@ var AbstractRelay = class {
504
470
  subscribe(filters, params) {
505
471
  if (params.label !== "<forced-ping>") {
506
472
  this.idleSince = void 0;
507
- this.clearIdleTimeout();
508
473
  this.ongoingOperations++;
509
474
  }
510
475
  const sub = this.prepareSubscription(filters, params);
@@ -533,17 +498,10 @@ var AbstractRelay = class {
533
498
  }
534
499
  this.closeAllSubscriptions("relay connection closed by us");
535
500
  this._connected = false;
536
- this.connectionPromise = void 0;
537
501
  this.idleSince = void 0;
538
- this.clearIdleTimeout();
539
502
  this.onclose?.();
540
- if (this.ws) {
541
- this.ws.onopen = null;
542
- this.ws.onerror = null;
543
- this.ws.onclose = null;
544
- if (this.ws.readyState !== this._WebSocket.CLOSING && this.ws.readyState !== this._WebSocket.CLOSED) {
545
- this.ws.close();
546
- }
503
+ if (this.ws?.readyState === this._WebSocket.OPEN) {
504
+ this.ws?.close();
547
505
  }
548
506
  }
549
507
  _onmessage(ev) {
@@ -570,7 +528,7 @@ var AbstractRelay = class {
570
528
  case "EVENT": {
571
529
  const so = this.openSubs.get(data[1]);
572
530
  const event = data[2];
573
- if (matchFilters(so.filters, event) && this.verifyEvent(event, this.url)) {
531
+ if (this.verifyEvent(event) && matchFilters(so.filters, event)) {
574
532
  so.onevent(event);
575
533
  } else {
576
534
  so.oninvalidevent?.(event);
@@ -718,14 +676,18 @@ var Subscription = class {
718
676
  }
719
677
  this.relay.openSubs.delete(this.id);
720
678
  this.relay.ongoingOperations--;
721
- if (this.relay.ongoingOperations === 0) {
679
+ if (this.relay.ongoingOperations === 0)
722
680
  this.relay.idleSince = Date.now();
723
- this.relay.scheduleIdleClose();
724
- }
725
681
  this.onclose?.(reason);
726
682
  }
727
683
  };
728
684
 
685
+ // helpers.ts
686
+ var alwaysTrue = (t) => {
687
+ t[verifiedSymbol] = true;
688
+ return true;
689
+ };
690
+
729
691
  // nip45.ts
730
692
  import { sha256 as sha2562 } from "@noble/hashes/sha2.js";
731
693
  import { bytesToHex as bytesToHex3 } from "@noble/hashes/utils.js";
@@ -752,7 +714,7 @@ function newHll() {
752
714
  return new Uint8Array(M);
753
715
  }
754
716
  function hllDecode(hex) {
755
- if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-f]+$/.test(hex))
717
+ if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-fA-F]+$/.test(hex))
756
718
  return void 0;
757
719
  const registers = new Uint8Array(M);
758
720
  for (let i2 = 0; i2 < M; i2++) {
@@ -791,8 +753,8 @@ var AbstractSimplePool = class {
791
753
  verifyEvent;
792
754
  enablePing;
793
755
  enableReconnect;
794
- idleTimeout = 2e4;
795
756
  automaticallyAuth;
757
+ trustedRelayURLs = /* @__PURE__ */ new Set();
796
758
  onRelayConnectionFailure;
797
759
  onRelayConnectionSuccess;
798
760
  allowConnectingToRelay;
@@ -803,8 +765,6 @@ var AbstractSimplePool = class {
803
765
  this._WebSocket = opts.websocketImplementation;
804
766
  this.enablePing = opts.enablePing;
805
767
  this.enableReconnect = opts.enableReconnect || false;
806
- if (opts.idleTimeout)
807
- this.idleTimeout = opts.idleTimeout;
808
768
  this.automaticallyAuth = opts.automaticallyAuth;
809
769
  this.onRelayConnectionFailure = opts.onRelayConnectionFailure;
810
770
  this.onRelayConnectionSuccess = opts.onRelayConnectionSuccess;
@@ -816,11 +776,10 @@ var AbstractSimplePool = class {
816
776
  let relay = this.relays.get(url);
817
777
  if (!relay) {
818
778
  relay = new AbstractRelay(url, {
819
- verifyEvent: this.verifyEvent,
779
+ verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent,
820
780
  websocketImplementation: this._WebSocket,
821
781
  enablePing: this.enablePing,
822
- enableReconnect: this.enableReconnect,
823
- idleTimeout: this.idleTimeout
782
+ enableReconnect: this.enableReconnect
824
783
  });
825
784
  relay.onclose = () => {
826
785
  this.relays.delete(url);
@@ -900,11 +859,11 @@ var AbstractSimplePool = class {
900
859
  }
901
860
  };
902
861
  const closesReceived = [];
903
- let handleClose = (i2, url, reason) => {
862
+ let handleClose = (i2, reason) => {
904
863
  if (closesReceived[i2])
905
864
  return;
906
865
  handleEose(i2);
907
- closesReceived[i2] = { url, reason };
866
+ closesReceived[i2] = reason;
908
867
  if (closesReceived.filter((a) => a).length === groupedRequests.length) {
909
868
  params.onclose?.(closesReceived);
910
869
  handleClose = () => {
@@ -922,7 +881,7 @@ var AbstractSimplePool = class {
922
881
  const allOpened = Promise.all(
923
882
  groupedRequests.map(async ({ url, filters }, i2) => {
924
883
  if (this.allowConnectingToRelay?.(url, ["read", filters]) === false) {
925
- handleClose(i2, url, "connection skipped by allowConnectingToRelay");
884
+ handleClose(i2, "connection skipped by allowConnectingToRelay");
926
885
  return;
927
886
  }
928
887
  let relay;
@@ -933,7 +892,7 @@ var AbstractSimplePool = class {
933
892
  });
934
893
  } catch (err) {
935
894
  this.onRelayConnectionFailure?.(url);
936
- handleClose(i2, url, err?.message || String(err));
895
+ handleClose(i2, err?.message || String(err));
937
896
  return;
938
897
  }
939
898
  this.onRelayConnectionSuccess?.(url);
@@ -947,17 +906,17 @@ var AbstractSimplePool = class {
947
906
  ...params,
948
907
  oneose: () => handleEose(i2),
949
908
  onclose: (reason2) => {
950
- handleClose(i2, url, reason2);
909
+ handleClose(i2, reason2);
951
910
  },
952
911
  alreadyHaveEvent: localAlreadyHaveEventHandler,
953
912
  eoseTimeout: params.maxWait,
954
913
  abort: params.abort
955
914
  });
956
915
  }).catch((err) => {
957
- handleClose(i2, url, `auth was required and attempted, but failed with: ${err}`);
916
+ handleClose(i2, `auth was required and attempted, but failed with: ${err}`);
958
917
  });
959
918
  } else {
960
- handleClose(i2, url, reason);
919
+ handleClose(i2, reason);
961
920
  }
962
921
  },
963
922
  alreadyHaveEvent: localAlreadyHaveEventHandler,
@@ -985,7 +944,7 @@ var AbstractSimplePool = class {
985
944
  if (subcloser)
986
945
  subcloser.close(reason);
987
946
  else
988
- params.onclose?.(relays.map((url) => ({ url, reason })));
947
+ params.onclose?.(relays.map((_) => reason));
989
948
  }
990
949
  });
991
950
  return subcloser;