@waku/core 0.0.8 → 0.0.10

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/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [@waku/core@0.0.10] - 2023-01-25
11
+
12
+ ### Changed
13
+
14
+ - Ping Relay messages are now set as ephemeral.
15
+
16
+ ### Fixed
17
+
18
+ - Moved `@chai` and `@fast-check` to `devDependencies` list.
19
+
20
+ ## [@waku/core@0.0.9] - 2023-01-18
21
+
22
+ ### Changed
23
+
24
+ - Removed `/vac/waku/relay/2.0.0-beta2` from `WakuRelay` protocols.
25
+ - Moved `@chai` and `@fast-check` to `dependencies` list.
26
+ - Remove peer exchange from protocols to expect in `waitForRemotePeer` by default.
27
+
28
+ ### Fixed
29
+
30
+ - Documentation links.
31
+
10
32
  ## [@waku/core@0.0.8] - 2022-12-19
11
33
 
12
34
  ### Fixed
@@ -634,7 +656,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
634
656
  - [ReactJS Chat App example](./examples/web-chat).
635
657
  - [Typedoc Documentation](https://js-waku.wakuconnect.dev/).
636
658
 
637
- [unreleased]: https://github.com/status-im/js-waku/compare/@waku/core@0.0.8...HEAD
659
+ [unreleased]: https://github.com/status-im/js-waku/compare/@waku/core@0.0.10...HEAD
660
+ [@waku/core@0.0.10]: https://github.com/waku-org/js-waku/compare/@waku/core@0.0.9...@waku/core@0.0.10
661
+ [@waku/core@0.0.9]: https://github.com/waku-org/js-waku/compare/@waku/core@0.0.8...@waku/core@0.0.9
638
662
  [@waku/core@0.0.8]: https://github.com/waku-org/js-waku/compare/@waku/core@0.0.7...@waku/core@0.0.8
639
663
  [@waku/core@0.0.7]: https://github.com/waku-org/js-waku/compare/@waku/core@0.0.6...@waku/core@0.0.7
640
664
  [@waku/core@0.0.6]: https://github.com/waku-org/js-waku/compare/@waku/core@0.0.5...@waku/core@0.0.6
package/bundle/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { c as commonjsGlobal, a as aspromise, b as base64$5, e as eventemitter, f as float, i as inquire_1, u as utf8$6, p as pool_1, g as getAugmentedNamespace, d as debug, F as FilterRPC$1, P as PushRPC$1, h as PushResponse, H as HistoryRPC$1, j as PagingInfo, k as HistoryResponse, l as getDefaultExportFromCjs } from './peer_exchange-df95c3a7.js';
2
- import { createEncoder } from './lib/message/version_0.js';
3
- export { DecodedMessage, createDecoder, createEncoder } from './lib/message/version_0.js';
4
- import { TopicOnlyDecoder } from './lib/message/topic_only_message.js';
2
+ import { c as createEncoder, v as version_0 } from './version_0-862a05e0.js';
3
+ export { D as DecodedMessage, a as createDecoder, c as createEncoder } from './version_0-862a05e0.js';
4
+ import { t as topic_only_message, T as TopicOnlyDecoder } from './topic_only_message-b1eddea1.js';
5
5
 
6
6
  /**
7
7
  * DefaultPubSubTopic is the default gossipsub topic to use for Waku.
@@ -24116,12 +24116,12 @@ function decodeWaku2(byte) {
24116
24116
 
24117
24117
  const log$8 = debug("waku:enr");
24118
24118
  class ENR extends Map {
24119
- constructor(kvs = {}, seq = BigInt(1), signature = null) {
24119
+ constructor(kvs = {}, seq = BigInt(1), signature) {
24120
24120
  super(Object.entries(kvs));
24121
24121
  this.seq = seq;
24122
24122
  this.signature = signature;
24123
24123
  }
24124
- static async create(kvs = {}, seq = BigInt(1), signature = null) {
24124
+ static async create(kvs = {}, seq = BigInt(1), signature) {
24125
24125
  const enr = new ENR(kvs, seq, signature);
24126
24126
  try {
24127
24127
  const publicKey = enr.publicKey;
@@ -24198,7 +24198,7 @@ class ENR extends Map {
24198
24198
  return ENR.decode(fromString$1(encoded.slice(4), "base64url"));
24199
24199
  }
24200
24200
  set(k, v) {
24201
- this.signature = null;
24201
+ this.signature = undefined;
24202
24202
  this.seq++;
24203
24203
  return super.set(k, v);
24204
24204
  }
@@ -25957,6 +25957,83 @@ function pipe(first, ...rest) {
25957
25957
  const PeerExchangeCodec = "/vac/waku/peer-exchange/2.0.0-alpha1";
25958
25958
  debug("waku:peer-exchange");
25959
25959
 
25960
+ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
25961
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
25962
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
25963
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
25964
+ };
25965
+ var _EventEmitter_listeners;
25966
+ /**
25967
+ * Adds types to the EventTarget class. Hopefully this won't be necessary forever.
25968
+ *
25969
+ * https://github.com/microsoft/TypeScript/issues/28357
25970
+ * https://github.com/microsoft/TypeScript/issues/43477
25971
+ * https://github.com/microsoft/TypeScript/issues/299
25972
+ * etc
25973
+ */
25974
+ class EventEmitter extends EventTarget {
25975
+ constructor() {
25976
+ super(...arguments);
25977
+ _EventEmitter_listeners.set(this, new Map());
25978
+ }
25979
+ listenerCount(type) {
25980
+ const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(type);
25981
+ if (listeners == null) {
25982
+ return 0;
25983
+ }
25984
+ return listeners.length;
25985
+ }
25986
+ addEventListener(type, listener, options) {
25987
+ super.addEventListener(type, listener, options);
25988
+ let list = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(type);
25989
+ if (list == null) {
25990
+ list = [];
25991
+ __classPrivateFieldGet(this, _EventEmitter_listeners, "f").set(type, list);
25992
+ }
25993
+ list.push({
25994
+ callback: listener,
25995
+ once: (options !== true && options !== false && options?.once) ?? false
25996
+ });
25997
+ }
25998
+ removeEventListener(type, listener, options) {
25999
+ super.removeEventListener(type.toString(), listener ?? null, options);
26000
+ let list = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(type);
26001
+ if (list == null) {
26002
+ return;
26003
+ }
26004
+ list = list.filter(({ callback }) => callback !== listener);
26005
+ __classPrivateFieldGet(this, _EventEmitter_listeners, "f").set(type, list);
26006
+ }
26007
+ dispatchEvent(event) {
26008
+ const result = super.dispatchEvent(event);
26009
+ let list = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(event.type);
26010
+ if (list == null) {
26011
+ return result;
26012
+ }
26013
+ list = list.filter(({ once }) => !once);
26014
+ __classPrivateFieldGet(this, _EventEmitter_listeners, "f").set(event.type, list);
26015
+ return result;
26016
+ }
26017
+ }
26018
+ _EventEmitter_listeners = new WeakMap();
26019
+ /**
26020
+ * CustomEvent is a standard event but it's not supported by node.
26021
+ *
26022
+ * Remove this when https://github.com/nodejs/node/issues/40678 is closed.
26023
+ *
26024
+ * Ref: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent
26025
+ */
26026
+ class CustomEventPolyfill extends Event {
26027
+ constructor(message, data) {
26028
+ super(message, data);
26029
+ // @ts-expect-error could be undefined
26030
+ this.detail = data?.detail;
26031
+ }
26032
+ }
26033
+ const CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill;
26034
+
26035
+ debug("waku:peer-exchange-discovery");
26036
+
25960
26037
  function groupByContentTopic(values) {
25961
26038
  const groupedDecoders = new Map();
25962
26039
  values.forEach((value) => {
@@ -26681,7 +26758,7 @@ function wakuFilter(init = {}) {
26681
26758
  return (components) => new Filter(components, init);
26682
26759
  }
26683
26760
 
26684
- var index$3 = /*#__PURE__*/Object.freeze({
26761
+ var index$4 = /*#__PURE__*/Object.freeze({
26685
26762
  __proto__: null,
26686
26763
  FilterCodec: FilterCodec,
26687
26764
  wakuFilter: wakuFilter
@@ -26794,7 +26871,7 @@ function wakuLightPush(init = {}) {
26794
26871
  return (components) => new LightPush(components, init);
26795
26872
  }
26796
26873
 
26797
- var index$2 = /*#__PURE__*/Object.freeze({
26874
+ var index$3 = /*#__PURE__*/Object.freeze({
26798
26875
  __proto__: null,
26799
26876
  LightPushCodec: LightPushCodec,
26800
26877
  get PushResponse () { return PushResponse; },
@@ -26804,10 +26881,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
26804
26881
  /**
26805
26882
  * RelayCodec is the libp2p identifier for the waku relay protocol
26806
26883
  */
26807
- const RelayCodecs = [
26808
- "/vac/waku/relay/2.0.0-beta2",
26809
- "/vac/waku/relay/2.0.0",
26810
- ];
26884
+ const RelayCodecs = ["/vac/waku/relay/2.0.0"];
26811
26885
  const RelayPingContentTopic = "/relay-ping/1/ping/null";
26812
26886
 
26813
26887
  function number(n) {
@@ -27400,7 +27474,7 @@ function wakuStore(init = {}) {
27400
27474
  return (components) => new Store(components, init);
27401
27475
  }
27402
27476
 
27403
- var index$1 = /*#__PURE__*/Object.freeze({
27477
+ var index$2 = /*#__PURE__*/Object.freeze({
27404
27478
  __proto__: null,
27405
27479
  StoreCodec: StoreCodec,
27406
27480
  DefaultPageSize: DefaultPageSize,
@@ -27540,7 +27614,7 @@ class WakuNode {
27540
27614
  }
27541
27615
  const relay = this.relay;
27542
27616
  if (relay && relayPeriodSecs !== 0) {
27543
- const encoder = createEncoder(RelayPingContentTopic);
27617
+ const encoder = createEncoder(RelayPingContentTopic, true);
27544
27618
  this.relayKeepAliveTimers[peerIdStr] = setInterval(() => {
27545
27619
  log$3("Sending Waku Relay ping message");
27546
27620
  relay
@@ -27591,6 +27665,12 @@ var waku = /*#__PURE__*/Object.freeze({
27591
27665
  WakuNode: WakuNode
27592
27666
  });
27593
27667
 
27668
+ var index$1 = /*#__PURE__*/Object.freeze({
27669
+ __proto__: null,
27670
+ version_0: version_0,
27671
+ topic_only_message: topic_only_message
27672
+ });
27673
+
27594
27674
  const codes = {
27595
27675
  ERR_SIGNATURE_NOT_VALID: 'ERR_SIGNATURE_NOT_VALID'
27596
27676
  };
@@ -29697,81 +29777,6 @@ function createTopology(init) {
29697
29777
  return new TopologyImpl(init);
29698
29778
  }
29699
29779
 
29700
- var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
29701
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29702
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
29703
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
29704
- };
29705
- var _EventEmitter_listeners;
29706
- /**
29707
- * Adds types to the EventTarget class. Hopefully this won't be necessary forever.
29708
- *
29709
- * https://github.com/microsoft/TypeScript/issues/28357
29710
- * https://github.com/microsoft/TypeScript/issues/43477
29711
- * https://github.com/microsoft/TypeScript/issues/299
29712
- * etc
29713
- */
29714
- class EventEmitter extends EventTarget {
29715
- constructor() {
29716
- super(...arguments);
29717
- _EventEmitter_listeners.set(this, new Map());
29718
- }
29719
- listenerCount(type) {
29720
- const listeners = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(type);
29721
- if (listeners == null) {
29722
- return 0;
29723
- }
29724
- return listeners.length;
29725
- }
29726
- addEventListener(type, listener, options) {
29727
- super.addEventListener(type, listener, options);
29728
- let list = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(type);
29729
- if (list == null) {
29730
- list = [];
29731
- __classPrivateFieldGet(this, _EventEmitter_listeners, "f").set(type, list);
29732
- }
29733
- list.push({
29734
- callback: listener,
29735
- once: (options !== true && options !== false && options?.once) ?? false
29736
- });
29737
- }
29738
- removeEventListener(type, listener, options) {
29739
- super.removeEventListener(type.toString(), listener ?? null, options);
29740
- let list = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(type);
29741
- if (list == null) {
29742
- return;
29743
- }
29744
- list = list.filter(({ callback }) => callback !== listener);
29745
- __classPrivateFieldGet(this, _EventEmitter_listeners, "f").set(type, list);
29746
- }
29747
- dispatchEvent(event) {
29748
- const result = super.dispatchEvent(event);
29749
- let list = __classPrivateFieldGet(this, _EventEmitter_listeners, "f").get(event.type);
29750
- if (list == null) {
29751
- return result;
29752
- }
29753
- list = list.filter(({ once }) => !once);
29754
- __classPrivateFieldGet(this, _EventEmitter_listeners, "f").set(event.type, list);
29755
- return result;
29756
- }
29757
- }
29758
- _EventEmitter_listeners = new WeakMap();
29759
- /**
29760
- * CustomEvent is a standard event but it's not supported by node.
29761
- *
29762
- * Remove this when https://github.com/nodejs/node/issues/40678 is closed.
29763
- *
29764
- * Ref: https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent
29765
- */
29766
- class CustomEventPolyfill extends Event {
29767
- constructor(message, data) {
29768
- super(message, data);
29769
- // @ts-expect-error could be undefined
29770
- this.detail = data?.detail;
29771
- }
29772
- }
29773
- const CustomEvent = globalThis.CustomEvent ?? CustomEventPolyfill;
29774
-
29775
29780
  class MessageCache {
29776
29781
  /**
29777
29782
  * Holds history of messages in timebounded history arrays
@@ -39313,8 +39318,8 @@ const log = debug("waku:wait-for-remote-peer");
39313
39318
  /**
39314
39319
  * Wait for a remote peer to be ready given the passed protocols.
39315
39320
  * Must be used after attempting to connect to nodes, using
39316
- * {@link index.waku.WakuNode.dial} or a bootstrap method with
39317
- * {@link lib/create_waku.createLightNode}.
39321
+ * {@link @waku/core.WakuNode.dial} or a bootstrap method with
39322
+ * {@link @waku/create.createLightNode}.
39318
39323
  *
39319
39324
  * If the passed protocols is a GossipSub protocol, then it resolves only once
39320
39325
  * a peer is in a mesh, to help ensure that other peers will send and receive
@@ -39418,10 +39423,7 @@ function getEnabledProtocols(waku) {
39418
39423
  if (waku.lightPush) {
39419
39424
  protocols.push(Protocols.LightPush);
39420
39425
  }
39421
- if (waku.peerExchange) {
39422
- protocols.push(Protocols.PeerExchange);
39423
- }
39424
39426
  return protocols;
39425
39427
  }
39426
39428
 
39427
- export { DefaultPubSubTopic, DefaultUserAgent, LightPushCodec, PageDirection, StoreCodec, WakuNode, createCursor, waitForRemotePeer, waku, wakuFilter, wakuLightPush, wakuRelay, wakuStore, index$3 as waku_filter, index$2 as waku_light_push, index as waku_relay, index$1 as waku_store };
39429
+ export { DefaultPubSubTopic, DefaultUserAgent, LightPushCodec, PageDirection, StoreCodec, WakuNode, createCursor, index$1 as message, waitForRemotePeer, waku, wakuFilter, wakuLightPush, wakuRelay, wakuStore, index$4 as waku_filter, index$3 as waku_light_push, index as waku_relay, index$2 as waku_store };
@@ -1,33 +1,2 @@
1
- import { d as debug, T as TopicOnlyMessage$1 } from '../../peer_exchange-df95c3a7.js';
2
-
3
- const log = debug("waku:message:topic-only");
4
- class TopicOnlyMessage {
5
- constructor(proto) {
6
- this.proto = proto;
7
- }
8
- get contentTopic() {
9
- return this.proto.contentTopic ?? "";
10
- }
11
- }
12
- class TopicOnlyDecoder {
13
- constructor() {
14
- this.contentTopic = "";
15
- }
16
- fromWireToProtoObj(bytes) {
17
- const protoMessage = TopicOnlyMessage$1.decode(bytes);
18
- log("Message decoded", protoMessage);
19
- return Promise.resolve({
20
- contentTopic: protoMessage.contentTopic,
21
- payload: undefined,
22
- rateLimitProof: undefined,
23
- timestamp: undefined,
24
- version: undefined,
25
- ephemeral: undefined,
26
- });
27
- }
28
- async fromProtoObj(proto) {
29
- return new TopicOnlyMessage(proto);
30
- }
31
- }
32
-
33
- export { TopicOnlyDecoder, TopicOnlyMessage };
1
+ import '../../peer_exchange-df95c3a7.js';
2
+ export { T as TopicOnlyDecoder, a as TopicOnlyMessage } from '../../topic_only_message-b1eddea1.js';
@@ -1,133 +1,2 @@
1
- import { d as debug, W as WakuMessage } from '../../peer_exchange-df95c3a7.js';
2
1
  export { m as proto } from '../../peer_exchange-df95c3a7.js';
3
-
4
- const log = debug("waku:message:version-0");
5
- const OneMillion = BigInt(1000000);
6
- const Version = 0;
7
- class DecodedMessage {
8
- constructor(proto) {
9
- this.proto = proto;
10
- }
11
- get _rawPayload() {
12
- if (this.proto.payload) {
13
- return new Uint8Array(this.proto.payload);
14
- }
15
- return;
16
- }
17
- get ephemeral() {
18
- return Boolean(this.proto.ephemeral);
19
- }
20
- get payload() {
21
- return this._rawPayload;
22
- }
23
- get contentTopic() {
24
- return this.proto.contentTopic;
25
- }
26
- get _rawTimestamp() {
27
- return this.proto.timestamp;
28
- }
29
- get timestamp() {
30
- // In the case we receive a value that is bigger than JS's max number,
31
- // we catch the error and return undefined.
32
- try {
33
- if (this.proto.timestamp) {
34
- // nanoseconds 10^-9 to milliseconds 10^-3
35
- const timestamp = this.proto.timestamp / OneMillion;
36
- return new Date(Number(timestamp));
37
- }
38
- if (this.proto.timestampDeprecated) {
39
- return new Date(this.proto.timestampDeprecated * 1000);
40
- }
41
- }
42
- catch (e) {
43
- return;
44
- }
45
- return;
46
- }
47
- get version() {
48
- // https://github.com/status-im/js-waku/issues/921
49
- return this.proto.version ?? 0;
50
- }
51
- get rateLimitProof() {
52
- return this.proto.rateLimitProof;
53
- }
54
- }
55
- class Encoder {
56
- constructor(contentTopic, ephemeral = false) {
57
- this.contentTopic = contentTopic;
58
- this.ephemeral = ephemeral;
59
- }
60
- async toWire(message$1) {
61
- return WakuMessage.encode(await this.toProtoObj(message$1));
62
- }
63
- async toProtoObj(message) {
64
- const timestamp = message.timestamp ?? new Date();
65
- return {
66
- payload: message.payload,
67
- version: Version,
68
- contentTopic: this.contentTopic,
69
- timestamp: BigInt(timestamp.valueOf()) * OneMillion,
70
- rateLimitProof: message.rateLimitProof,
71
- ephemeral: this.ephemeral,
72
- };
73
- }
74
- }
75
- /**
76
- * Creates an encoder that encode messages without Waku level encryption or signature.
77
- *
78
- * An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
79
- * format to be sent over the Waku network. The resulting encoder can then be
80
- * pass to { @link @waku/interfaces.LightPush.push } or
81
- * { @link @waku/interfaces.Relay.send } to automatically encode outgoing
82
- * messages.
83
- *
84
- * @param contentTopic The content topic to set on outgoing messages.
85
- * @param ephemeral An optional flag to mark message as ephemeral, ie, not to be stored by Waku Store nodes.
86
- */
87
- function createEncoder(contentTopic, ephemeral = false) {
88
- return new Encoder(contentTopic, ephemeral);
89
- }
90
- class Decoder {
91
- constructor(contentTopic) {
92
- this.contentTopic = contentTopic;
93
- }
94
- fromWireToProtoObj(bytes) {
95
- const protoMessage = WakuMessage.decode(bytes);
96
- log("Message decoded", protoMessage);
97
- return Promise.resolve({
98
- payload: protoMessage.payload ?? undefined,
99
- contentTopic: protoMessage.contentTopic ?? undefined,
100
- version: protoMessage.version ?? undefined,
101
- timestamp: protoMessage.timestamp ?? undefined,
102
- rateLimitProof: protoMessage.rateLimitProof ?? undefined,
103
- ephemeral: protoMessage.ephemeral ?? false,
104
- });
105
- }
106
- async fromProtoObj(proto) {
107
- // https://github.com/status-im/js-waku/issues/921
108
- if (proto.version === undefined) {
109
- proto.version = 0;
110
- }
111
- if (proto.version !== Version) {
112
- log("Failed to decode due to incorrect version, expected:", Version, ", actual:", proto.version);
113
- return Promise.resolve(undefined);
114
- }
115
- return new DecodedMessage(proto);
116
- }
117
- }
118
- /**
119
- * Creates an decoder that decode messages without Waku level encryption.
120
- *
121
- * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
122
- * format when received from the Waku network. The resulting decoder can then be
123
- * pass to { @link @waku/interfaces.Filter.subscribe } or
124
- * { @link @waku/interfaces.Relay.subscribe } to automatically decode incoming
125
- * messages.
126
- *
127
- * @param contentTopic The resulting decoder will only decode messages with this content topic.
128
- */
129
- function createDecoder(contentTopic) {
130
- return new Decoder(contentTopic);
131
- }
132
-
133
- export { DecodedMessage, Decoder, Encoder, Version, createDecoder, createEncoder };
2
+ export { D as DecodedMessage, b as Decoder, E as Encoder, V as Version, a as createDecoder, c as createEncoder } from '../../version_0-862a05e0.js';
@@ -0,0 +1,39 @@
1
+ import { d as debug, T as TopicOnlyMessage$1 } from './peer_exchange-df95c3a7.js';
2
+
3
+ const log = debug("waku:message:topic-only");
4
+ class TopicOnlyMessage {
5
+ constructor(proto) {
6
+ this.proto = proto;
7
+ }
8
+ get contentTopic() {
9
+ return this.proto.contentTopic ?? "";
10
+ }
11
+ }
12
+ class TopicOnlyDecoder {
13
+ constructor() {
14
+ this.contentTopic = "";
15
+ }
16
+ fromWireToProtoObj(bytes) {
17
+ const protoMessage = TopicOnlyMessage$1.decode(bytes);
18
+ log("Message decoded", protoMessage);
19
+ return Promise.resolve({
20
+ contentTopic: protoMessage.contentTopic,
21
+ payload: undefined,
22
+ rateLimitProof: undefined,
23
+ timestamp: undefined,
24
+ version: undefined,
25
+ ephemeral: undefined,
26
+ });
27
+ }
28
+ async fromProtoObj(proto) {
29
+ return new TopicOnlyMessage(proto);
30
+ }
31
+ }
32
+
33
+ var topic_only_message = /*#__PURE__*/Object.freeze({
34
+ __proto__: null,
35
+ TopicOnlyMessage: TopicOnlyMessage,
36
+ TopicOnlyDecoder: TopicOnlyDecoder
37
+ });
38
+
39
+ export { TopicOnlyDecoder as T, TopicOnlyMessage as a, topic_only_message as t };
@@ -0,0 +1,143 @@
1
+ import { d as debug, W as WakuMessage, m as message } from './peer_exchange-df95c3a7.js';
2
+
3
+ const log = debug("waku:message:version-0");
4
+ const OneMillion = BigInt(1000000);
5
+ const Version = 0;
6
+ class DecodedMessage {
7
+ constructor(proto) {
8
+ this.proto = proto;
9
+ }
10
+ get _rawPayload() {
11
+ if (this.proto.payload) {
12
+ return new Uint8Array(this.proto.payload);
13
+ }
14
+ return;
15
+ }
16
+ get ephemeral() {
17
+ return Boolean(this.proto.ephemeral);
18
+ }
19
+ get payload() {
20
+ return this._rawPayload;
21
+ }
22
+ get contentTopic() {
23
+ return this.proto.contentTopic;
24
+ }
25
+ get _rawTimestamp() {
26
+ return this.proto.timestamp;
27
+ }
28
+ get timestamp() {
29
+ // In the case we receive a value that is bigger than JS's max number,
30
+ // we catch the error and return undefined.
31
+ try {
32
+ if (this.proto.timestamp) {
33
+ // nanoseconds 10^-9 to milliseconds 10^-3
34
+ const timestamp = this.proto.timestamp / OneMillion;
35
+ return new Date(Number(timestamp));
36
+ }
37
+ if (this.proto.timestampDeprecated) {
38
+ return new Date(this.proto.timestampDeprecated * 1000);
39
+ }
40
+ }
41
+ catch (e) {
42
+ return;
43
+ }
44
+ return;
45
+ }
46
+ get version() {
47
+ // https://github.com/status-im/js-waku/issues/921
48
+ return this.proto.version ?? 0;
49
+ }
50
+ get rateLimitProof() {
51
+ return this.proto.rateLimitProof;
52
+ }
53
+ }
54
+ class Encoder {
55
+ constructor(contentTopic, ephemeral = false) {
56
+ this.contentTopic = contentTopic;
57
+ this.ephemeral = ephemeral;
58
+ }
59
+ async toWire(message$1) {
60
+ return WakuMessage.encode(await this.toProtoObj(message$1));
61
+ }
62
+ async toProtoObj(message) {
63
+ const timestamp = message.timestamp ?? new Date();
64
+ return {
65
+ payload: message.payload,
66
+ version: Version,
67
+ contentTopic: this.contentTopic,
68
+ timestamp: BigInt(timestamp.valueOf()) * OneMillion,
69
+ rateLimitProof: message.rateLimitProof,
70
+ ephemeral: this.ephemeral,
71
+ };
72
+ }
73
+ }
74
+ /**
75
+ * Creates an encoder that encode messages without Waku level encryption or signature.
76
+ *
77
+ * An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
78
+ * format to be sent over the Waku network. The resulting encoder can then be
79
+ * pass to { @link @waku/interfaces.LightPush.push } or
80
+ * { @link @waku/interfaces.Relay.send } to automatically encode outgoing
81
+ * messages.
82
+ *
83
+ * @param contentTopic The content topic to set on outgoing messages.
84
+ * @param ephemeral An optional flag to mark message as ephemeral, ie, not to be stored by Waku Store nodes.
85
+ */
86
+ function createEncoder(contentTopic, ephemeral = false) {
87
+ return new Encoder(contentTopic, ephemeral);
88
+ }
89
+ class Decoder {
90
+ constructor(contentTopic) {
91
+ this.contentTopic = contentTopic;
92
+ }
93
+ fromWireToProtoObj(bytes) {
94
+ const protoMessage = WakuMessage.decode(bytes);
95
+ log("Message decoded", protoMessage);
96
+ return Promise.resolve({
97
+ payload: protoMessage.payload ?? undefined,
98
+ contentTopic: protoMessage.contentTopic ?? undefined,
99
+ version: protoMessage.version ?? undefined,
100
+ timestamp: protoMessage.timestamp ?? undefined,
101
+ rateLimitProof: protoMessage.rateLimitProof ?? undefined,
102
+ ephemeral: protoMessage.ephemeral ?? false,
103
+ });
104
+ }
105
+ async fromProtoObj(proto) {
106
+ // https://github.com/status-im/js-waku/issues/921
107
+ if (proto.version === undefined) {
108
+ proto.version = 0;
109
+ }
110
+ if (proto.version !== Version) {
111
+ log("Failed to decode due to incorrect version, expected:", Version, ", actual:", proto.version);
112
+ return Promise.resolve(undefined);
113
+ }
114
+ return new DecodedMessage(proto);
115
+ }
116
+ }
117
+ /**
118
+ * Creates an decoder that decode messages without Waku level encryption.
119
+ *
120
+ * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
121
+ * format when received from the Waku network. The resulting decoder can then be
122
+ * pass to { @link @waku/interfaces.Filter.subscribe } or
123
+ * { @link @waku/interfaces.Relay.subscribe } to automatically decode incoming
124
+ * messages.
125
+ *
126
+ * @param contentTopic The resulting decoder will only decode messages with this content topic.
127
+ */
128
+ function createDecoder(contentTopic) {
129
+ return new Decoder(contentTopic);
130
+ }
131
+
132
+ var version_0 = /*#__PURE__*/Object.freeze({
133
+ __proto__: null,
134
+ Version: Version,
135
+ proto: message,
136
+ DecodedMessage: DecodedMessage,
137
+ Encoder: Encoder,
138
+ createEncoder: createEncoder,
139
+ Decoder: Decoder,
140
+ createDecoder: createDecoder
141
+ });
142
+
143
+ export { DecodedMessage as D, Encoder as E, Version as V, createDecoder as a, Decoder as b, createEncoder as c, version_0 as v };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  export { DefaultPubSubTopic } from "./lib/constants.js";
2
2
  export { DefaultUserAgent } from "./lib/waku.js";
3
3
  export { createEncoder, createDecoder, DecodedMessage, } from "./lib/message/version_0.js";
4
+ export * as message from "./lib/message/index.js";
4
5
  export * as waku from "./lib/waku.js";
5
- export { WakuNode } from "./lib/waku.js";
6
+ export { WakuNode, WakuOptions } from "./lib/waku.js";
6
7
  export * as waku_filter from "./lib/filter/index.js";
7
8
  export { wakuFilter } from "./lib/filter/index.js";
8
9
  export * as waku_light_push from "./lib/light_push/index.js";
9
10
  export { wakuLightPush, LightPushCodec } from "./lib/light_push/index.js";
10
11
  export * as waku_relay from "./lib/relay/index.js";
11
- export { wakuRelay } from "./lib/relay/index.js";
12
+ export { wakuRelay, RelayCreateOptions } from "./lib/relay/index.js";
12
13
  export * as waku_store from "./lib/store/index.js";
13
14
  export { PageDirection, wakuStore, StoreCodec, createCursor, } from "./lib/store/index.js";
14
15
  export { waitForRemotePeer } from "./lib/wait_for_remote_peer.js";
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { DefaultPubSubTopic } from "./lib/constants.js";
2
2
  export { DefaultUserAgent } from "./lib/waku.js";
3
3
  export { createEncoder, createDecoder, DecodedMessage, } from "./lib/message/version_0.js";
4
+ export * as message from "./lib/message/index.js";
4
5
  export * as waku from "./lib/waku.js";
5
6
  export { WakuNode } from "./lib/waku.js";
6
7
  export * as waku_filter from "./lib/filter/index.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EACL,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAElD,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAe,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,WAAW,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,eAAe,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAsB,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * as version_0 from "./version_0.js";
2
+ export * as topic_only_message from "./topic_only_message.js";
@@ -0,0 +1,3 @@
1
+ export * as version_0 from "./version_0.js";
2
+ export * as topic_only_message from "./topic_only_message.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import type { IDecodedMessage, IDecoder, IProtoMessage } from "@waku/interfaces";
2
- import { proto_topic_only_message as proto } from "@waku/proto";
2
+ import { TopicOnlyMessage as ProtoTopicOnlyMessage } from "@waku/proto";
3
3
  export declare class TopicOnlyMessage implements IDecodedMessage {
4
4
  private proto;
5
5
  payload: undefined;
6
6
  rateLimitProof: undefined;
7
7
  timestamp: undefined;
8
8
  ephemeral: undefined;
9
- constructor(proto: proto.TopicOnlyMessage);
9
+ constructor(proto: ProtoTopicOnlyMessage);
10
10
  get contentTopic(): string;
11
11
  }
12
12
  export declare class TopicOnlyDecoder implements IDecoder<TopicOnlyMessage> {
@@ -1,4 +1,4 @@
1
- import { proto_topic_only_message as proto } from "@waku/proto";
1
+ import { TopicOnlyMessage as ProtoTopicOnlyMessage } from "@waku/proto";
2
2
  import debug from "debug";
3
3
  const log = debug("waku:message:topic-only");
4
4
  export class TopicOnlyMessage {
@@ -14,7 +14,7 @@ export class TopicOnlyDecoder {
14
14
  this.contentTopic = "";
15
15
  }
16
16
  fromWireToProtoObj(bytes) {
17
- const protoMessage = proto.TopicOnlyMessage.decode(bytes);
17
+ const protoMessage = ProtoTopicOnlyMessage.decode(bytes);
18
18
  log("Message decoded", protoMessage);
19
19
  return Promise.resolve({
20
20
  contentTopic: protoMessage.contentTopic,
@@ -1 +1 @@
1
- {"version":3,"file":"topic_only_message.js","sourceRoot":"","sources":["../../../src/lib/message/topic_only_message.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,IAAI,KAAK,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAG,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAE7C,MAAM,OAAO,gBAAgB;IAM3B,YAAoB,KAA6B;QAA7B,UAAK,GAAL,KAAK,CAAwB;IAAG,CAAC;IAErD,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,gBAAgB;IAA7B;QACS,iBAAY,GAAG,EAAE,CAAC;IAoB3B,CAAC;IAlBC,kBAAkB,CAAC,KAAiB;QAClC,MAAM,YAAY,GAAG,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1D,GAAG,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,YAAY,EAAE,YAAY,CAAC,YAAY;YACvC,OAAO,EAAE,SAAS;YAClB,cAAc,EAAE,SAAS;YACzB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;SACrB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,KAAoB;QAEpB,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF"}
1
+ {"version":3,"file":"topic_only_message.js","sourceRoot":"","sources":["../../../src/lib/message/topic_only_message.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAG,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAE7C,MAAM,OAAO,gBAAgB;IAM3B,YAAoB,KAA4B;QAA5B,UAAK,GAAL,KAAK,CAAuB;IAAG,CAAC;IAEpD,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,gBAAgB;IAA7B;QACS,iBAAY,GAAG,EAAE,CAAC;IAoB3B,CAAC;IAlBC,kBAAkB,CAAC,KAAiB;QAClC,MAAM,YAAY,GAAG,qBAAqB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzD,GAAG,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,YAAY,EAAE,YAAY,CAAC,YAAY;YACvC,OAAO,EAAE,SAAS;YAClB,cAAc,EAAE,SAAS;YACzB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;SACrB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,KAAoB;QAEpB,OAAO,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -3,10 +3,7 @@ export const minute = 60 * second;
3
3
  /**
4
4
  * RelayCodec is the libp2p identifier for the waku relay protocol
5
5
  */
6
- export const RelayCodecs = [
7
- "/vac/waku/relay/2.0.0-beta2",
8
- "/vac/waku/relay/2.0.0",
9
- ];
6
+ export const RelayCodecs = ["/vac/waku/relay/2.0.0"];
10
7
  export const RelayPingContentTopic = "/relay-ping/1/ping/null";
11
8
  /**
12
9
  * RelayGossipFactor affects how many peers we will emit gossip to at each heartbeat.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/relay/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC;AAC3B,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,6BAA6B;IAC7B,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,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,MAAM,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC"}
@@ -5,7 +5,7 @@ export declare type Observer<T extends IDecodedMessage> = {
5
5
  decoder: IDecoder<T>;
6
6
  callback: Callback<T>;
7
7
  };
8
- export declare type CreateOptions = {
8
+ export interface RelayCreateOptions extends GossipsubOpts {
9
9
  /**
10
10
  * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.
11
11
  *
@@ -20,5 +20,5 @@ export declare type CreateOptions = {
20
20
  * @default {@link DefaultPubSubTopic}
21
21
  */
22
22
  pubSubTopic?: string;
23
- } & GossipsubOpts;
24
- export declare function wakuRelay(init?: Partial<CreateOptions>): (components: GossipSubComponents) => IRelay;
23
+ }
24
+ export declare function wakuRelay(init?: Partial<RelayCreateOptions>): (components: GossipSubComponents) => IRelay;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/relay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,GAIV,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAUpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAwBhC;;;;;GAKG;AACH,MAAM,KAAM,SAAQ,SAAS;IAW3B,YACE,UAA+B,EAC/B,OAAgC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AI,GAAG,EAAE;oBACP,QAAQ,CAAC,GAAG,CAAC,CAAC;iBACf;qBAAM;oBACL,GAAG,CAAC,8BAA8B,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;iBAChE;YACH,CAAC,CAAC,CACH,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY,CAAC,KAAgB;QAC3B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;;AA9Ha,gBAAU,GAAW,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAiI9D,KAAK,CAAC,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAE3E,MAAM,UAAU,SAAS,CACvB,OAAoC,EAAE;IAEtC,OAAO,CAAC,UAA+B,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAC1E,CAAC"}
@@ -3,8 +3,8 @@ import { Protocols } from "@waku/interfaces";
3
3
  /**
4
4
  * Wait for a remote peer to be ready given the passed protocols.
5
5
  * Must be used after attempting to connect to nodes, using
6
- * {@link index.waku.WakuNode.dial} or a bootstrap method with
7
- * {@link lib/create_waku.createLightNode}.
6
+ * {@link @waku/core.WakuNode.dial} or a bootstrap method with
7
+ * {@link @waku/create.createLightNode}.
8
8
  *
9
9
  * If the passed protocols is a GossipSub protocol, then it resolves only once
10
10
  * a peer is in a mesh, to help ensure that other peers will send and receive
@@ -9,8 +9,8 @@ const log = debug("waku:wait-for-remote-peer");
9
9
  /**
10
10
  * Wait for a remote peer to be ready given the passed protocols.
11
11
  * Must be used after attempting to connect to nodes, using
12
- * {@link index.waku.WakuNode.dial} or a bootstrap method with
13
- * {@link lib/create_waku.createLightNode}.
12
+ * {@link @waku/core.WakuNode.dial} or a bootstrap method with
13
+ * {@link @waku/create.createLightNode}.
14
14
  *
15
15
  * If the passed protocols is a GossipSub protocol, then it resolves only once
16
16
  * a peer is in a mesh, to help ensure that other peers will send and receive
@@ -114,9 +114,6 @@ function getEnabledProtocols(waku) {
114
114
  if (waku.lightPush) {
115
115
  protocols.push(Protocols.LightPush);
116
116
  }
117
- if (waku.peerExchange) {
118
- protocols.push(Protocols.PeerExchange);
119
- }
120
117
  return protocols;
121
118
  }
122
119
  //# sourceMappingURL=wait_for_remote_peer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wait_for_remote_peer.js","sourceRoot":"","sources":["../../src/lib/wait_for_remote_peer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,GAAG,GAAG,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAU,EACV,SAAuB,EACvB,SAAkB;IAElB,SAAS,GAAG,SAAS,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAEnD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAG,EAAE,CAAC;IAEpB,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACvC,IAAI,CAAC,IAAI,C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CAAC;AACvE,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAU;IACrC,MAAM,SAAS,GAAG,EAAE,CAAC;IAErB,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAClC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,IAAI,IAAI,CAAC,SAAS,EAAE;QAClB,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;KACrC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/lib/waku.js CHANGED
@@ -137,7 +137,7 @@ export class WakuNode {
137
137
  }
138
138
  const relay = this.relay;
139
139
  if (relay && relayPeriodSecs !== 0) {
140
- const encoder = createEncoder(RelayPingContentTopic);
140
+ const encoder = createEncoder(RelayPingContentTopic, true);
141
141
  this.relayKeepAliveTimers[peerIdStr] = setInterval(() => {
142
142
  log("Sending Waku Relay ping message");
143
143
  relay
@@ -1 +1 @@
1
- {"version":3,"file":"waku.js","sourceRoot":"","sources":["../../src/lib/waku.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,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AC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC;SAC5C,EAAE;YACD,aAAa,CAAC,KAAK,CAAC,CAAC;SACtB;QAED,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;IACjC,CAAC;CACF;AAED,SAAS,OAAO,CAAC,MAAc;IAC7B,IAAI,MAAM,EAAE;QACV,IAAI;YACF,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAChC,cAAc,CAAC,WAAW,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAClE,CAAC;YACF,qEAAqE;YACrE,oCAAoC;SACrC;QAAC,OAAO,CAAC,EAAE,GAAE;KACf;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waku/core",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "TypeScript implementation of the Waku v2 protocol",
5
5
  "types": "./dist/index.d.ts",
6
6
  "module": "./dist/index.js",
@@ -111,13 +111,12 @@
111
111
  "@types/chai": "^4.2.15",
112
112
  "@types/debug": "^4.1.7",
113
113
  "@types/mocha": "^9.1.0",
114
- "@types/node": "^17.0.6",
114
+ "@types/node": "^18.11.17",
115
115
  "@types/tail": "^2.0.0",
116
116
  "@types/uuid": "^8.3.0",
117
117
  "@typescript-eslint/eslint-plugin": "^5.8.1",
118
118
  "@typescript-eslint/parser": "^5.8.1",
119
119
  "app-root-path": "^3.0.0",
120
- "chai": "^4.3.4",
121
120
  "cspell": "^6.17.0",
122
121
  "eslint": "^8.6.0",
123
122
  "eslint-config-prettier": "^8.3.0",
@@ -125,7 +124,6 @@
125
124
  "eslint-plugin-functional": "^4.0.2",
126
125
  "eslint-plugin-import": "^2.25.3",
127
126
  "eslint-plugin-prettier": "^4.0.0",
128
- "fast-check": "^2.14.0",
129
127
  "gh-pages": "^3.2.3",
130
128
  "ignore-loader": "^0.1.2",
131
129
  "isomorphic-fetch": "^3.0.0",
@@ -136,6 +134,8 @@
136
134
  "karma-mocha": "^2.0.1",
137
135
  "karma-webpack": "^5.0.0",
138
136
  "mocha": "^9.1.3",
137
+ "chai": "^4.3.4",
138
+ "fast-check": "^2.14.0",
139
139
  "npm-run-all": "^4.1.5",
140
140
  "p-timeout": "^6.0.0",
141
141
  "portfinder": "^1.0.28",
package/src/index.ts CHANGED
@@ -6,9 +6,10 @@ export {
6
6
  createDecoder,
7
7
  DecodedMessage,
8
8
  } from "./lib/message/version_0.js";
9
+ export * as message from "./lib/message/index.js";
9
10
 
10
11
  export * as waku from "./lib/waku.js";
11
- export { WakuNode } from "./lib/waku.js";
12
+ export { WakuNode, WakuOptions } from "./lib/waku.js";
12
13
 
13
14
  export * as waku_filter from "./lib/filter/index.js";
14
15
  export { wakuFilter } from "./lib/filter/index.js";
@@ -17,7 +18,7 @@ export * as waku_light_push from "./lib/light_push/index.js";
17
18
  export { wakuLightPush, LightPushCodec } from "./lib/light_push/index.js";
18
19
 
19
20
  export * as waku_relay from "./lib/relay/index.js";
20
- export { wakuRelay } from "./lib/relay/index.js";
21
+ export { wakuRelay, RelayCreateOptions } from "./lib/relay/index.js";
21
22
 
22
23
  export * as waku_store from "./lib/store/index.js";
23
24
  export {
@@ -0,0 +1,2 @@
1
+ export * as version_0 from "./version_0.js";
2
+ export * as topic_only_message from "./topic_only_message.js";
@@ -3,7 +3,7 @@ import type {
3
3
  IDecoder,
4
4
  IProtoMessage,
5
5
  } from "@waku/interfaces";
6
- import { proto_topic_only_message as proto } from "@waku/proto";
6
+ import { TopicOnlyMessage as ProtoTopicOnlyMessage } from "@waku/proto";
7
7
  import debug from "debug";
8
8
 
9
9
  const log = debug("waku:message:topic-only");
@@ -14,7 +14,7 @@ export class TopicOnlyMessage implements IDecodedMessage {
14
14
  public timestamp: undefined;
15
15
  public ephemeral: undefined;
16
16
 
17
- constructor(private proto: proto.TopicOnlyMessage) {}
17
+ constructor(private proto: ProtoTopicOnlyMessage) {}
18
18
 
19
19
  get contentTopic(): string {
20
20
  return this.proto.contentTopic ?? "";
@@ -25,7 +25,7 @@ export class TopicOnlyDecoder implements IDecoder<TopicOnlyMessage> {
25
25
  public contentTopic = "";
26
26
 
27
27
  fromWireToProtoObj(bytes: Uint8Array): Promise<IProtoMessage | undefined> {
28
- const protoMessage = proto.TopicOnlyMessage.decode(bytes);
28
+ const protoMessage = ProtoTopicOnlyMessage.decode(bytes);
29
29
  log("Message decoded", protoMessage);
30
30
  return Promise.resolve({
31
31
  contentTopic: protoMessage.contentTopic,
@@ -4,10 +4,7 @@ export const minute = 60 * second;
4
4
  /**
5
5
  * RelayCodec is the libp2p identifier for the waku relay protocol
6
6
  */
7
- export const RelayCodecs = [
8
- "/vac/waku/relay/2.0.0-beta2",
9
- "/vac/waku/relay/2.0.0",
10
- ];
7
+ export const RelayCodecs = ["/vac/waku/relay/2.0.0"];
11
8
 
12
9
  export const RelayPingContentTopic = "/relay-ping/1/ping/null";
13
10
 
@@ -30,7 +30,7 @@ export type Observer<T extends IDecodedMessage> = {
30
30
  callback: Callback<T>;
31
31
  };
32
32
 
33
- export type CreateOptions = {
33
+ export interface RelayCreateOptions extends GossipsubOpts {
34
34
  /**
35
35
  * The PubSub Topic to use. Defaults to {@link DefaultPubSubTopic}.
36
36
  *
@@ -45,7 +45,7 @@ export type CreateOptions = {
45
45
  * @default {@link DefaultPubSubTopic}
46
46
  */
47
47
  pubSubTopic?: string;
48
- } & GossipsubOpts;
48
+ }
49
49
 
50
50
  /**
51
51
  * Implements the [Waku v2 Relay protocol](https://rfc.vac.dev/spec/11/).
@@ -66,7 +66,7 @@ class Relay extends GossipSub implements IRelay {
66
66
 
67
67
  constructor(
68
68
  components: GossipSubComponents,
69
- options?: Partial<CreateOptions>
69
+ options?: Partial<RelayCreateOptions>
70
70
  ) {
71
71
  options = Object.assign(options ?? {}, {
72
72
  // Ensure that no signature is included nor expected in the messages.
@@ -188,7 +188,7 @@ class Relay extends GossipSub implements IRelay {
188
188
  Relay.multicodec = constants.RelayCodecs[constants.RelayCodecs.length - 1];
189
189
 
190
190
  export function wakuRelay(
191
- init: Partial<CreateOptions> = {}
191
+ init: Partial<RelayCreateOptions> = {}
192
192
  ): (components: GossipSubComponents) => IRelay {
193
193
  return (components: GossipSubComponents) => new Relay(components, init);
194
194
  }
@@ -14,8 +14,8 @@ const log = debug("waku:wait-for-remote-peer");
14
14
  /**
15
15
  * Wait for a remote peer to be ready given the passed protocols.
16
16
  * Must be used after attempting to connect to nodes, using
17
- * {@link index.waku.WakuNode.dial} or a bootstrap method with
18
- * {@link lib/create_waku.createLightNode}.
17
+ * {@link @waku/core.WakuNode.dial} or a bootstrap method with
18
+ * {@link @waku/create.createLightNode}.
19
19
  *
20
20
  * If the passed protocols is a GossipSub protocol, then it resolves only once
21
21
  * a peer is in a mesh, to help ensure that other peers will send and receive
@@ -155,9 +155,6 @@ function getEnabledProtocols(waku: Waku): Protocols[] {
155
155
  if (waku.lightPush) {
156
156
  protocols.push(Protocols.LightPush);
157
157
  }
158
- if (waku.peerExchange) {
159
- protocols.push(Protocols.PeerExchange);
160
- }
161
158
 
162
159
  return protocols;
163
160
  }
package/src/lib/waku.ts CHANGED
@@ -234,7 +234,7 @@ export class WakuNode implements Waku {
234
234
 
235
235
  const relay = this.relay;
236
236
  if (relay && relayPeriodSecs !== 0) {
237
- const encoder = createEncoder(RelayPingContentTopic);
237
+ const encoder = createEncoder(RelayPingContentTopic, true);
238
238
  this.relayKeepAliveTimers[peerIdStr] = setInterval(() => {
239
239
  log("Sending Waku Relay ping message");
240
240
  relay