@solarpunkltd/swarm-chat-js 8.0.0 → 9.0.0

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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as ee, O as u, P as d, R as f, S as p, T as m, V as te, _ as ne, a as re, b as ie, c as h, d as g, f as _, g as v, h as y, i as ae, j as oe, k as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A, w as se, x as ce, y as j, z as M } from "./message-Dbh8qrpg.js";
2
- import { Bee as N, BeeResponseError as P, Identifier as F, PrivateKey as I, Topic as L } from "@ethersphere/bee-js";
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as ee, K as l, L as te, M as u, N as ne, O as d, P as f, R as p, S as m, T as h, U as g, V as _, W as v, _ as y, a as b, b as re, c as ie, d as x, f as ae, g as oe, h as se, i as ce, j as le, k as ue, l as S, m as de, n as C, o as fe, p as pe, q as me, r as he, s as w, t as T, u as E, v as D, w as O, x as k, y as A, z as j } from "./message-DQda4_Ge.js";
2
+ import { Bee as M, BeeResponseError as N, Identifier as P, PrivateKey as F, Topic as I } from "@ethersphere/bee-js";
3
3
  //#region src/events.ts
4
- var R = {
4
+ var L = {
5
5
  LOADING_INIT: "loadingInit",
6
6
  LOADING_PREVIOUS_MESSAGES: "loadingPreviousMessages",
7
7
  MESSAGE_RECEIVED: "messageReceived",
@@ -13,13 +13,13 @@ var R = {
13
13
  MESSAGE_SKIPPED: "messageSkipped",
14
14
  ERROR: "error"
15
15
  };
16
- function z(e) {
17
- return V(e, -1, e.ts);
16
+ function R(e) {
17
+ return B(e, -1, e.ts);
18
18
  }
19
- function B(e) {
20
- return V(e.msg, e.seq, e.at);
19
+ function z(e) {
20
+ return B(e.msg, e.seq, e.at);
21
21
  }
22
- function V(e, t, n) {
22
+ function B(e, t, n) {
23
23
  return {
24
24
  id: e.id,
25
25
  type: e.type,
@@ -32,7 +32,7 @@ function V(e, t, n) {
32
32
  signedMessage: e
33
33
  };
34
34
  }
35
- var H = class {
35
+ var V = class {
36
36
  constructor() {
37
37
  this.listeners = /* @__PURE__ */ new Map(), this.on = (e, t) => {
38
38
  this.listeners.set(e, [...this.listeners.get(e) ?? [], t]);
@@ -49,7 +49,7 @@ var H = class {
49
49
  console.error(`a listener for ${e} threw`, t);
50
50
  }
51
51
  }
52
- }, U = 2e4, W = class {
52
+ }, H = 2e4, U = class {
53
53
  constructor(e, t) {
54
54
  this.spacingMs = e, this.now = t, this.missedAt = /* @__PURE__ */ new Map();
55
55
  }
@@ -73,33 +73,33 @@ var H = class {
73
73
  expired(e, t) {
74
74
  return e > t || t - e >= this.spacingMs;
75
75
  }
76
- }, G = class extends Error {
76
+ }, W = class extends Error {
77
77
  constructor(e) {
78
78
  super("the feed head lookup did not answer in time", e), this.name = "HeadLookupTimeoutError";
79
79
  }
80
- }, K = class extends Error {
80
+ }, G = class extends Error {
81
81
  constructor(e, t) {
82
82
  super(`feed slot ${e} was served but could not be read`, t), this.index = e, this.name = "UnreadableSlotError";
83
83
  }
84
84
  };
85
- function q(e) {
86
- return e instanceof P && (e.status === 404 || e.status === 500);
85
+ function K(e) {
86
+ return e instanceof N && (e.status === 404 || e.status === 500);
87
87
  }
88
- async function J(e, t) {
88
+ async function q(e, t) {
89
89
  try {
90
90
  return await t();
91
91
  } catch (t) {
92
- if (q(t)) return null;
93
- throw t instanceof P ? t : new K(e, { cause: t });
92
+ if (K(t)) return null;
93
+ throw t instanceof N ? t : new G(e, { cause: t });
94
94
  }
95
95
  }
96
- function le(e, t, n, r, i = C) {
97
- let a = L.fromString(n), o = (n) => e.feed.makeReader(a, t, Y(n));
96
+ function ge(e, t, n, r, i = C) {
97
+ let a = I.fromString(n), o = (n) => e.feed.makeReader(a, t, J(n));
98
98
  return {
99
- readNote: (a) => J(a, async () => (await e.soc.makeReader(t, Y(r.slotReadMs)).download(D(n, i, a))).payload.toUint8Array()),
100
- readSlot: (e) => J(e, async () => (await o(r.slotReadMs).downloadPayload({ index: e })).payload.toUint8Array()),
99
+ readNote: (a) => q(a, async () => (await e.soc.makeReader(t, J(r.slotReadMs)).download(w(n, i, a))).payload.toUint8Array()),
100
+ readSlot: (e) => q(e, async () => (await o(r.slotReadMs).downloadPayload({ index: e })).payload.toUint8Array()),
101
101
  async readHead() {
102
- let n = Y(r.feedReadMs);
102
+ let n = J(r.feedReadMs);
103
103
  try {
104
104
  let { payload: r, feedIndex: i } = await e.feed.makeReader(a, t, n).downloadPayload();
105
105
  return {
@@ -107,34 +107,34 @@ function le(e, t, n, r, i = C) {
107
107
  payload: r.toUint8Array()
108
108
  };
109
109
  } catch (e) {
110
- if (q(e)) return null;
111
- throw n.signal?.aborted ? new G({ cause: e }) : e;
110
+ if (K(e)) return null;
111
+ throw n.signal?.aborted ? new W({ cause: e }) : e;
112
112
  }
113
113
  },
114
114
  async readFile(t) {
115
- return (await e.data.download(t, void 0, Y(r.feedReadMs))).toUint8Array();
115
+ return (await e.data.download(t, void 0, J(r.feedReadMs))).toUint8Array();
116
116
  }
117
117
  };
118
118
  }
119
- function Y(e) {
119
+ function J(e) {
120
120
  return { signal: AbortSignal.timeout(e) };
121
121
  }
122
- var ue = "0123456789abcdef".repeat(4);
123
- function de(e, t, n, r, i) {
124
- let a = new I(n), o = F.fromString(r);
122
+ var _e = "0123456789abcdef".repeat(4);
123
+ function ve(e, t, n, r, i) {
124
+ let a = new F(n), o = P.fromString(r);
125
125
  return async (n) => {
126
- await e.messaging.gsocSend(t, a, o, n, { deferred: !1 }, Y(i.writeMs));
126
+ await e.messaging.gsocSend(t, a, o, n, { deferred: !1 }, J(i.writeMs));
127
127
  };
128
128
  }
129
129
  //#endregion
130
130
  //#region src/follower.ts
131
- var X = {
131
+ var Y = {
132
132
  LIVE: "live",
133
133
  RECONNECTING: "reconnecting",
134
134
  STALLED: "stalled"
135
- }, fe = {
135
+ }, ye = {
136
136
  pollIntervalMs: 1e3,
137
- missingReadSpacingMs: U,
137
+ missingReadSpacingMs: H,
138
138
  maxSlotsPerPoll: 16,
139
139
  unservedPollsBeforeProbe: 3,
140
140
  unreadablePollsBeforeFailure: 3,
@@ -152,16 +152,16 @@ var X = {
152
152
  stallAfterMs: 8e3,
153
153
  random: Math.random,
154
154
  now: Date.now
155
- }, Z = class extends Error {
155
+ }, X = class extends Error {
156
156
  constructor(e) {
157
157
  super(`the gateway keeps answering feed slot ${e} with something that is not a chunk`), this.index = e, this.name = "UnreadableGatewayError";
158
158
  }
159
- }, pe = class {
159
+ }, be = class {
160
160
  constructor(e, t, n, r = {}, i = null) {
161
161
  this.source = e, this.topic = t, this.events = n, this.notes = i, this.next = 0, this.ceiling = null, this.nextNoteSlot = 0, this.lastNoteFoundAt = 0, this.unservedPolls = 0, this.nextProbeAt = 0, this.unreadablePolls = 0, this.gatewayFailures = 0, this.missed = /* @__PURE__ */ new Map(), this.timer = null, this.generation = 0, this.running = !1, this.status = null, this.settings = {
162
- ...fe,
162
+ ...ye,
163
163
  ...r
164
- }, this.pacer = new W(this.settings.missingReadSpacingMs, this.settings.now);
164
+ }, this.pacer = new U(this.settings.missingReadSpacingMs, this.settings.now);
165
165
  }
166
166
  get nextIndex() {
167
167
  return this.next;
@@ -223,7 +223,7 @@ var X = {
223
223
  try {
224
224
  t = await this.source.readSlot(e);
225
225
  } catch (e) {
226
- if (e instanceof K) return "unreadable";
226
+ if (e instanceof G) return "unreadable";
227
227
  throw e;
228
228
  }
229
229
  return t === null ? this.pacer.missed(e) : this.pacer.found(e), t;
@@ -247,7 +247,7 @@ var X = {
247
247
  this.unreadablePolls = 0;
248
248
  continue;
249
249
  }
250
- if (this.unreadablePolls >= this.settings.unreadablePollsBeforeFailure) throw new Z(n);
250
+ if (this.unreadablePolls >= this.settings.unreadablePollsBeforeFailure) throw new X(n);
251
251
  }
252
252
  return t;
253
253
  }
@@ -303,16 +303,16 @@ var X = {
303
303
  }
304
304
  }
305
305
  accept(e, t) {
306
- let n = A(t, e, this.topic);
306
+ let n = D(t, e, this.topic);
307
307
  n.ok ? (this.notes?.clock.observe(n.value.at, this.settings.now()), this.events.entry(n.value)) : this.events.skipped(e, n.reason, n.detail);
308
308
  }
309
309
  gatewayFailed(e) {
310
- this.gatewayFailures++, this.setStatus(X.RECONNECTING), this.events.error(e);
310
+ this.gatewayFailures++, this.setStatus(Y.RECONNECTING), this.events.error(e);
311
311
  }
312
312
  gatewayAnswered() {
313
313
  this.gatewayFailures = 0;
314
314
  let e = this.settings.now(), t = [...this.missed.values()].some((t) => e - t >= this.settings.stallAfterMs);
315
- this.setStatus(t ? X.STALLED : X.LIVE);
315
+ this.setStatus(t ? Y.STALLED : Y.LIVE);
316
316
  }
317
317
  backoffMs() {
318
318
  let { pollIntervalMs: e, backoffCapMs: t, random: n } = this.settings, r = Math.min(t, e * 2 ** this.gatewayFailures);
@@ -321,7 +321,7 @@ var X = {
321
321
  setStatus(e) {
322
322
  e !== this.status && (this.status = e, this.events.status(e));
323
323
  }
324
- }, me = 16, he = class {
324
+ }, xe = 16, Se = class {
325
325
  constructor(e, t, n, r = null) {
326
326
  this.source = e, this.topic = t, this.events = n, this.notes = r, this.older = null, this.loading = null;
327
327
  }
@@ -366,7 +366,7 @@ var X = {
366
366
  try {
367
367
  return await this.source.readHead();
368
368
  } catch (e) {
369
- if (e instanceof G) return this.events.error(e), null;
369
+ if (e instanceof W) return this.events.error(e), null;
370
370
  throw e;
371
371
  }
372
372
  }
@@ -381,30 +381,30 @@ var X = {
381
381
  async loadOlderOnce() {
382
382
  let e = this.older;
383
383
  if (e === null) return [];
384
- let t = await this.source.readFile(e.ref), n = j(t, this.topic, e);
384
+ let t = await this.source.readFile(e.ref), n = A(t, this.topic, e);
385
385
  if (!n.ok) throw this.older = null, Error(`history file ${e.ref} refused (${n.reason}): ${n.detail}`);
386
386
  return this.report(n.value.skipped), this.older = n.value.prev, n.value.rows;
387
387
  }
388
388
  async newestLink(e, t) {
389
389
  let n = t === void 0 ? e : e - 1;
390
390
  if (t !== void 0) {
391
- let n = A(t, e, this.topic);
391
+ let n = D(t, e, this.topic);
392
392
  if (n.ok) return n.value.history;
393
393
  }
394
- for (let t = n; t >= Math.max(0, e - me); t--) {
394
+ for (let t = n; t >= Math.max(0, e - xe); t--) {
395
395
  let e = await this.source.readSlot(t).catch((e) => {
396
- if (e instanceof K) return null;
396
+ if (e instanceof G) return null;
397
397
  throw e;
398
398
  });
399
399
  if (e === null) continue;
400
- let n = A(e, t, this.topic);
400
+ let n = D(e, t, this.topic);
401
401
  if (n.ok) return n.value.history;
402
402
  }
403
403
  return null;
404
404
  }
405
405
  async readFile(e) {
406
406
  try {
407
- let t = j(await this.source.readFile(e.ref), this.topic, e);
407
+ let t = A(await this.source.readFile(e.ref), this.topic, e);
408
408
  return t.ok ? (this.report(t.value.skipped), this.older = t.value.prev, t.value.rows) : (this.events.error(/* @__PURE__ */ Error(`history file ${e.ref} refused (${t.reason}): ${t.detail}`)), "refused");
409
409
  } catch (t) {
410
410
  return this.events.error(t), this.older = e, null;
@@ -413,18 +413,18 @@ var X = {
413
413
  report(e) {
414
414
  e > 0 && this.events.skipped(e);
415
415
  }
416
- }, ge = {
416
+ }, Ce = {
417
417
  slotMs: C,
418
- heartbeatMs: O,
418
+ heartbeatMs: T,
419
419
  marginMs: 1e3,
420
420
  scanBatch: 4,
421
421
  clockLimitMs: 3e5,
422
- missingReadSpacingMs: U
422
+ missingReadSpacingMs: H
423
423
  };
424
- function _e(e) {
424
+ function we(e) {
425
425
  return typeof e.readNote == "function";
426
426
  }
427
- var ve = class {
427
+ var Te = class {
428
428
  constructor(e) {
429
429
  this.limitMs = e, this.aheadAtMost = Infinity, this.trusted = !0;
430
430
  }
@@ -441,21 +441,21 @@ var ve = class {
441
441
  let e = Number.isFinite(this.aheadAtMost), t = this.trusted || !e ? Math.min(0, this.aheadAtMost) : this.aheadAtMost;
442
442
  return Math.max(-this.limitMs, Math.min(this.limitMs, t));
443
443
  }
444
- }, ye = class {
444
+ }, Z = class {
445
445
  constructor(e, t, n) {
446
446
  this.source = e, this.now = n, this.counts = {
447
447
  found: 0,
448
448
  empty: 0
449
449
  }, this.settings = {
450
- ...ge,
450
+ ...Ce,
451
451
  ...t
452
- }, this.clock = new ve(this.settings.clockLimitMs), this.pacer = new W(this.settings.missingReadSpacingMs, n);
452
+ }, this.clock = new Te(this.settings.clockLimitMs), this.pacer = new U(this.settings.missingReadSpacingMs, n);
453
453
  }
454
454
  lastReadableSlot(e = this.now()) {
455
- return k(e - this.settings.marginMs - this.clock.ms, this.settings.slotMs) - 1;
455
+ return E(e - this.settings.marginMs - this.clock.ms, this.settings.slotMs) - 1;
456
456
  }
457
457
  readableAt(e) {
458
- return x(e, this.settings.slotMs) + this.settings.marginMs + this.clock.ms;
458
+ return S(e, this.settings.slotMs) + this.settings.marginMs + this.clock.ms;
459
459
  }
460
460
  get lookBackSlots() {
461
461
  return Math.ceil(this.settings.heartbeatMs / this.settings.slotMs) + 2;
@@ -469,10 +469,10 @@ var ve = class {
469
469
  try {
470
470
  t = await this.source.readNote(e), t === null && this.pacer.missed(e);
471
471
  } catch (e) {
472
- if (!(e instanceof K)) throw e;
472
+ if (!(e instanceof G)) throw e;
473
473
  t = null;
474
474
  }
475
- let n = t === null ? null : g(t);
475
+ let n = t === null ? null : x(t);
476
476
  return n === null ? (this.counts.empty++, null) : (this.counts.found++, this.clock.observe(n.writtenAt, this.now()), n);
477
477
  }
478
478
  async scan(e, t) {
@@ -492,7 +492,7 @@ var ve = class {
492
492
  maxResends: 5,
493
493
  reactionWindowMs: 1e3,
494
494
  isLive: () => !0
495
- }, be = class {
495
+ }, Ee = class {
496
496
  constructor(e, t, n, r, i = Q) {
497
497
  this.key = e, this.profile = t, this.write = n, this.events = r, this.settings = i, this.outgoing = /* @__PURE__ */ new Map(), this.reactions = /* @__PURE__ */ new Map(), this.stopped = !1;
498
498
  }
@@ -500,10 +500,9 @@ var ve = class {
500
500
  return this.key.publicKey().address().toHex();
501
501
  }
502
502
  send(e) {
503
- let { message: t, bytes: n } = l(this.key, {
503
+ let { message: t, bytes: n } = u(this.key, {
504
504
  ...e,
505
- ...this.profile,
506
- own: !1
505
+ ...this.profile
507
506
  }), r = {
508
507
  message: t,
509
508
  bytes: n,
@@ -529,7 +528,7 @@ var ve = class {
529
528
  let i = this.reactions.get(r);
530
529
  this.reactions.delete(r), i && i.taps % 2 == 1 && !this.stopped && this.send({
531
530
  topic: e,
532
- type: u.REACTION,
531
+ type: d.REACTION,
533
532
  target: t,
534
533
  text: n
535
534
  });
@@ -580,26 +579,27 @@ var ve = class {
580
579
  clearTimer(e) {
581
580
  e.timer &&= (clearTimeout(e.timer), null);
582
581
  }
583
- }, xe = [
582
+ }, De = [
584
583
  1e3,
585
584
  2e3,
586
585
  4e3,
587
586
  8e3
588
- ], Se = 3;
587
+ ], Oe = 3;
589
588
  function $(e) {
590
589
  return (e.startsWith("0x") ? e.slice(2) : e).toLowerCase();
591
590
  }
592
- var Ce = class {
591
+ var ke = class {
593
592
  constructor(e, t = {}) {
594
- this.emitter = new H(), this.seen = /* @__PURE__ */ new Set(), this.status = null, this.generation = 0, this.running = !1, this.starting = null, this.openTimer = null, this.wakeOpen = null;
593
+ this.emitter = new V(), this.seen = /* @__PURE__ */ new Set(), this.status = null, this.generation = 0, this.running = !1, this.starting = null, this.openTimer = null, this.wakeOpen = null;
595
594
  let { user: n, infra: r } = e;
596
- this.key = new I($(n.privateKey)), this.topic = r.chatTopic, this.profile = {
595
+ this.key = new F($(n.privateKey)), this.topic = r.chatTopic, this.profile = {
597
596
  name: n.nickname,
598
597
  via: r.via,
599
- ...n.binding ? { idb: n.binding } : {}
600
- }, this.openRetryMs = t.openRetryMs ?? xe, this.senderSettings = {
598
+ ...n.binding ? { idb: n.binding } : {},
599
+ ...n.walletLink ? { wl: n.walletLink } : {}
600
+ }, this.openRetryMs = t.openRetryMs ?? De, this.senderSettings = {
601
601
  ...Q,
602
- isLive: () => this.status === X.LIVE,
602
+ isLive: () => this.status === Y.LIVE,
603
603
  ...t.sender
604
604
  };
605
605
  let i = {
@@ -611,28 +611,28 @@ var Ce = class {
611
611
  ...r.noteHeartbeatMs === void 0 ? {} : { heartbeatMs: r.noteHeartbeatMs },
612
612
  ...t.notes
613
613
  };
614
- this.source = t.source ?? le(new N(r.beeUrl), $(r.chatAddress), r.chatTopic, i, a.slotMs), this.write = t.write ?? de(new N(r.writeUrl ?? r.beeUrl), r.stamp ? $(r.stamp) : ue, $(r.gsocResourceId), r.gsocTopic, i);
614
+ this.source = t.source ?? ge(new M(r.beeUrl), $(r.chatAddress), r.chatTopic, i, a.slotMs), this.write = t.write ?? ve(new M(r.writeUrl ?? r.beeUrl), r.stamp ? $(r.stamp) : _e, $(r.gsocResourceId), r.gsocTopic, i);
615
615
  let o = t.follower?.now ?? (() => Date.now()), s = {
616
616
  pollIntervalMs: r.pollingInterval ?? 1e3,
617
617
  ...t.follower,
618
618
  now: o
619
619
  }, c = this.source;
620
- this.notes = _e(c) ? new ye(c, a, o) : null, this.follower = new pe(this.source, this.topic, {
620
+ this.notes = we(c) ? new Z(c, a, o) : null, this.follower = new be(this.source, this.topic, {
621
621
  entry: (e) => this.show(e),
622
- skipped: (e, t, n) => this.emitter.emit(R.MESSAGE_SKIPPED, {
622
+ skipped: (e, t, n) => this.emitter.emit(L.MESSAGE_SKIPPED, {
623
623
  index: e,
624
624
  reason: t,
625
625
  detail: n
626
626
  }),
627
627
  status: (e) => this.setStatus(e),
628
- error: (e) => this.emitter.emit(R.ERROR, e)
629
- }, s, this.notes), this.history = new he(this.source, this.topic, {
630
- skipped: (e) => this.emitter.emit(R.MESSAGE_SKIPPED, {
628
+ error: (e) => this.emitter.emit(L.ERROR, e)
629
+ }, s, this.notes), this.history = new Se(this.source, this.topic, {
630
+ skipped: (e) => this.emitter.emit(L.MESSAGE_SKIPPED, {
631
631
  index: -1,
632
632
  reason: "history-row",
633
633
  detail: `${e} rows of a history file`
634
634
  }),
635
- error: (e) => this.emitter.emit(R.ERROR, e)
635
+ error: (e) => this.emitter.emit(L.ERROR, e)
636
636
  }, this.notes), this.sender = this.makeSender();
637
637
  }
638
638
  getEmitter() {
@@ -656,11 +656,11 @@ var Ce = class {
656
656
  this.running = !1, this.generation++, this.openTimer &&= (clearTimeout(this.openTimer), null), this.wakeOpen?.(), this.follower.stop(), this.sender.stop();
657
657
  }
658
658
  async sendMessage(e, t, n) {
659
- if (t === u.REACTION) {
659
+ if (t === d.REACTION) {
660
660
  if (!n) throw Error("a reaction names the message it reacts to");
661
661
  return this.sender.react(this.topic, n, e), null;
662
662
  }
663
- return z(this.sender.send({
663
+ return R(this.sender.send({
664
664
  topic: this.topic,
665
665
  type: t,
666
666
  target: n ?? "",
@@ -671,12 +671,12 @@ var Ce = class {
671
671
  return this.sender.retry(typeof e == "string" ? e : e.id);
672
672
  }
673
673
  async fetchPreviousMessages() {
674
- this.emitter.emit(R.LOADING_PREVIOUS_MESSAGES, !0);
674
+ this.emitter.emit(L.LOADING_PREVIOUS_MESSAGES, !0);
675
675
  try {
676
676
  let e = this.generation, t = await this.history.loadOlder();
677
677
  return e === this.generation ? this.showRows(t) : [];
678
678
  } finally {
679
- this.emitter.emit(R.LOADING_PREVIOUS_MESSAGES, !1);
679
+ this.emitter.emit(L.LOADING_PREVIOUS_MESSAGES, !1);
680
680
  }
681
681
  }
682
682
  hasPreviousMessages() {
@@ -686,16 +686,16 @@ var Ce = class {
686
686
  return [...e].sort((e, t) => e.index >= 0 && t.index >= 0 ? e.index - t.index : e.index >= 0 || t.index >= 0 ? e.index >= 0 ? -1 : 1 : e.timestamp - t.timestamp);
687
687
  }
688
688
  async open(e) {
689
- this.emitter.emit(R.LOADING_INIT, !0);
689
+ this.emitter.emit(L.LOADING_INIT, !0);
690
690
  let t = 0;
691
691
  for (; e === this.generation;) try {
692
692
  let t = await this.history.open();
693
693
  if (e !== this.generation) return;
694
- this.showRows(t.rows), this.follower.start(t.startAt, t.notes), this.emitter.emit(R.LOADING_INIT, !1);
694
+ this.showRows(t.rows), this.follower.start(t.startAt, t.notes), this.emitter.emit(L.LOADING_INIT, !1);
695
695
  return;
696
696
  } catch (n) {
697
697
  if (e !== this.generation) return;
698
- t++, this.emitter.emit(R.ERROR, n), this.setStatus(X.RECONNECTING), t === Se && this.emitter.emit(R.CRITICAL_ERROR, n), await this.waitToOpen(this.openRetryMs[Math.min(t, this.openRetryMs.length) - 1] ?? 8e3);
698
+ t++, this.emitter.emit(L.ERROR, n), this.setStatus(Y.RECONNECTING), t === Oe && this.emitter.emit(L.CRITICAL_ERROR, n), await this.waitToOpen(this.openRetryMs[Math.min(t, this.openRetryMs.length) - 1] ?? 8e3);
699
699
  }
700
700
  }
701
701
  waitToOpen(e) {
@@ -708,31 +708,31 @@ var Ce = class {
708
708
  });
709
709
  }
710
710
  makeSender() {
711
- return new be(this.key, this.profile, this.write, {
712
- pending: (e) => this.emitter.emit(R.MESSAGE_REQUEST_INITIATED, z(e)),
713
- written: (e) => this.emitter.emit(R.MESSAGE_REQUEST_UPLOADED, z(e)),
711
+ return new Ee(this.key, this.profile, this.write, {
712
+ pending: (e) => this.emitter.emit(L.MESSAGE_REQUEST_INITIATED, R(e)),
713
+ written: (e) => this.emitter.emit(L.MESSAGE_REQUEST_UPLOADED, R(e)),
714
714
  failed: (e, t) => {
715
- this.emitter.emit(R.ERROR, t), this.emitter.emit(R.MESSAGE_REQUEST_ERROR, z(e));
715
+ this.emitter.emit(L.ERROR, t), this.emitter.emit(L.MESSAGE_REQUEST_ERROR, R(e));
716
716
  },
717
717
  confirmed: () => {}
718
718
  }, this.senderSettings);
719
719
  }
720
720
  show(e) {
721
- this.seen.has(e.seq) || (this.seen.add(e.seq), this.sender.confirm(e.msg), this.emitter.emit(R.MESSAGE_RECEIVED, B(e)));
721
+ this.seen.has(e.seq) || (this.seen.add(e.seq), this.sender.confirm(e.msg), this.emitter.emit(L.MESSAGE_RECEIVED, z(e)));
722
722
  }
723
723
  showRows(e) {
724
724
  let t = [];
725
725
  for (let n of e) {
726
726
  if (this.seen.has(n.seq)) continue;
727
727
  this.seen.add(n.seq), this.sender.confirm(n.msg);
728
- let e = B(n);
729
- t.push(e), this.emitter.emit(R.MESSAGE_RECEIVED, e);
728
+ let e = z(n);
729
+ t.push(e), this.emitter.emit(L.MESSAGE_RECEIVED, e);
730
730
  }
731
731
  return t;
732
732
  }
733
733
  setStatus(e) {
734
- e !== this.status && (this.status = e, this.emitter.emit(R.STATUS, e));
734
+ e !== this.status && (this.status = e, this.emitter.emit(L.STATUS, e));
735
735
  }
736
736
  };
737
737
  //#endregion
738
- export { M as CHAT_BINDING_TITLE, H as ChatEmitter, p as ChatMessageError, O as DEFAULT_NOTE_HEARTBEAT_MS, C as DEFAULT_NOTE_SLOT_MS, R as EVENTS, X as FeedStatus, G as HeadLookupTimeoutError, t as MAX_BINDING_CHARACTERS, T as MAX_ENTRY_BYTES, n as MAX_MESSAGE_BYTES, se as MAX_NAME_CHARACTERS, E as MAX_NOTE_BYTES, m as MAX_TEXT_CHARACTERS, i as MAX_TOPIC_CHARACTERS, r as MESSAGE_VERSION, u as MessageType, b as MessageVia, ae as NOTE_VERSION, ie as OWN_FEED_TOPIC_PREFIX, Ce as SwarmChat, Z as UnreadableGatewayError, K as UnreadableSlotError, te as chatBindingSchema, e as chatMessageSchema, o as checkChatBinding, oe as countCharacters, l as createChatMessage, ee as encodeChatMessage, re as encodeSlotNote, S as feedEntrySchema, d as hasValidSignature, y as historyFileSchema, v as historyLinkSchema, ne as historyRowSchema, a as newMessageId, w as noteAddress, D as noteIdentifier, h as noteIdentifierText, x as noteSlotEnd, k as noteSlotOf, ce as ownFeedTopic, s as parseChatMessage, A as parseFeedEntry, j as parseHistoryFile, g as parseSlotNote, c as signedBytes, _ as slotNoteSchema, f as verifyChatMessage };
738
+ export { o as CHAT_BINDING_TITLE, V as ChatEmitter, m as ChatMessageError, T as DEFAULT_NOTE_HEARTBEAT_MS, C as DEFAULT_NOTE_SLOT_MS, L as EVENTS, Y as FeedStatus, W as HeadLookupTimeoutError, l as MAX_BINDING_CHARACTERS, pe as MAX_ENTRY_BYTES, n as MAX_MESSAGE_BYTES, O as MAX_NAME_CHARACTERS, he as MAX_NOTE_BYTES, h as MAX_TEXT_CHARACTERS, i as MAX_TOPIC_CHARACTERS, t as MAX_WALLET_LINK_CHARACTERS, r as MESSAGE_VERSION, d as MessageType, ue as MessageVia, ce as NOTE_VERSION, re as OWN_FEED_TOPIC_PREFIX, ke as SwarmChat, X as UnreadableGatewayError, G as UnreadableSlotError, _ as WALLET_LINK_STATEMENT, s as WALLET_LINK_TITLE, me as chatBindingSchema, e as chatMessageSchema, ee as checkChatBinding, g as checkWalletLink, le as countCharacters, u as createChatMessage, ne as displayNameProblem, f as encodeChatMessage, b as encodeSlotNote, de as feedEntrySchema, a as hasValidSignature, se as historyFileSchema, oe as historyLinkSchema, y as historyRowSchema, c as newMessageId, fe as noteAddress, w as noteIdentifier, ie as noteIdentifierText, S as noteSlotEnd, E as noteSlotOf, k as ownFeedTopic, te as parseChatMessage, D as parseFeedEntry, A as parseHistoryFile, x as parseSlotNote, p as signedBytes, ae as slotNoteSchema, j as verifyChatMessage, v as walletLinkSchema };
@@ -26,6 +26,12 @@ export interface ChatIdentity {
26
26
  site: string;
27
27
  /** When the account says it signed, ISO 8601 UTC. */
28
28
  date: string;
29
+ /**
30
+ * The wallet the message's Swarm ID wallet link names, `0x` and 40 lowercase hex characters, present only when the
31
+ * message carries a link both the wallet and this account signed. A reader looks its ENS name up itself, and the
32
+ * fork's `resolveVerifiedEnsName` does that with both the reverse and the forward record.
33
+ */
34
+ wallet?: string;
29
35
  }
30
36
  export interface BindingOptions {
31
37
  /** The origin the reader runs on. When given, a binding for any other site is refused. */
@@ -13,11 +13,11 @@ export declare const historyLinkSchema: z.ZodObject<{
13
13
  }, z.core.$strict>;
14
14
  export type HistoryLink = z.infer<typeof historyLinkSchema>;
15
15
  export declare const feedEntrySchema: z.ZodObject<{
16
- v: z.ZodLiteral<8>;
16
+ v: z.ZodLiteral<9>;
17
17
  seq: z.ZodNumber;
18
18
  at: z.ZodNumber;
19
19
  msg: z.ZodObject<{
20
- v: z.ZodLiteral<8>;
20
+ v: z.ZodLiteral<9>;
21
21
  topic: z.ZodString;
22
22
  id: z.ZodString;
23
23
  type: z.ZodEnum<{
@@ -34,11 +34,15 @@ export declare const feedEntrySchema: z.ZodObject<{
34
34
  gateway: "gateway";
35
35
  "own-stamp": "own-stamp";
36
36
  }>;
37
- own: z.ZodBoolean;
38
37
  idb: z.ZodOptional<z.ZodObject<{
39
38
  msg: z.ZodString;
40
39
  sig: z.ZodString;
41
40
  }, z.core.$strict>>;
41
+ wl: z.ZodOptional<z.ZodObject<{
42
+ msg: z.ZodString;
43
+ wsig: z.ZodString;
44
+ asig: z.ZodString;
45
+ }, z.core.$strict>>;
42
46
  sig: z.ZodString;
43
47
  }, z.core.$strict>;
44
48
  history: z.ZodNullable<z.ZodObject<{
@@ -51,7 +55,7 @@ export declare const historyRowSchema: z.ZodObject<{
51
55
  seq: z.ZodNumber;
52
56
  at: z.ZodNumber;
53
57
  msg: z.ZodObject<{
54
- v: z.ZodLiteral<8>;
58
+ v: z.ZodLiteral<9>;
55
59
  topic: z.ZodString;
56
60
  id: z.ZodString;
57
61
  type: z.ZodEnum<{
@@ -68,18 +72,22 @@ export declare const historyRowSchema: z.ZodObject<{
68
72
  gateway: "gateway";
69
73
  "own-stamp": "own-stamp";
70
74
  }>;
71
- own: z.ZodBoolean;
72
75
  idb: z.ZodOptional<z.ZodObject<{
73
76
  msg: z.ZodString;
74
77
  sig: z.ZodString;
75
78
  }, z.core.$strict>>;
79
+ wl: z.ZodOptional<z.ZodObject<{
80
+ msg: z.ZodString;
81
+ wsig: z.ZodString;
82
+ asig: z.ZodString;
83
+ }, z.core.$strict>>;
76
84
  sig: z.ZodString;
77
85
  }, z.core.$strict>;
78
86
  }, z.core.$strict>;
79
87
  export type HistoryRow = z.infer<typeof historyRowSchema>;
80
88
  /** A row that fails its shape is left out and counted, so one bad row never hides the rest of the file. */
81
89
  export declare const historyFileSchema: z.ZodObject<{
82
- v: z.ZodLiteral<8>;
90
+ v: z.ZodLiteral<9>;
83
91
  topic: z.ZodString;
84
92
  fromSeq: z.ZodNumber;
85
93
  toSeq: z.ZodNumber;
@@ -1,5 +1,6 @@
1
1
  export * from './message.js';
2
2
  export * from './binding.js';
3
+ export * from './walletLink.js';
3
4
  export * from './ownFeed.js';
4
5
  export * from './entry.js';
5
6
  export * from './note.js';