@waku/core 0.0.1 → 0.0.3
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 +9 -0
- package/bundle/{index-691c0be6.js → index-a67d7136.js} +1 -1
- package/bundle/{index-0a4bdddc.js → index-f7e049ad.js} +1 -1
- package/bundle/index.js +24853 -3555
- package/bundle/lib/peer_discovery_static_list.js +18 -4
- package/bundle/lib/predefined_bootstrap_nodes.js +1 -1
- package/bundle/lib/wait_for_remote_peer.js +2 -3
- package/bundle/lib/waku_message/topic_only_message.js +2 -3
- package/bundle/lib/waku_message/version_0.js +317 -4
- package/bundle/{message-e2db79d7.js → message-049c8b67.js} +861 -2
- package/bundle/{topic_only_message-34f36fa6.js → topic_only_message-5ad3a869.js} +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/waku_filter/index.d.ts +2 -2
- package/dist/lib/waku_filter/index.js.map +1 -1
- package/dist/lib/waku_message/version_0.d.ts +3 -2
- package/dist/lib/waku_message/version_0.js +2 -1
- package/dist/lib/waku_message/version_0.js.map +1 -1
- package/dist/lib/waku_relay/index.d.ts +4 -3
- package/dist/lib/waku_relay/index.js.map +1 -1
- package/dist/lib/waku_store/index.d.ts +4 -4
- package/package.json +4 -123
- package/src/index.ts +0 -10
- package/src/lib/waku_filter/index.ts +4 -3
- package/src/lib/waku_message/version_0.ts +5 -3
- package/src/lib/waku_relay/index.ts +4 -3
- package/src/lib/waku_store/index.ts +5 -5
- package/bundle/crypto-8551d579.js +0 -2585
- package/bundle/crypto-b00764b7.js +0 -1772
- package/bundle/enr-564d4a51.js +0 -20785
- package/bundle/enr-9fc5eed8.js +0 -20786
- package/bundle/enr-f6e82a53.js +0 -20785
- package/bundle/events-fcbda4dc.js +0 -76
- package/bundle/index-02d21809.js +0 -20
- package/bundle/index-2ae915be.js +0 -1854
- package/bundle/index-a013a259.js +0 -20
- package/bundle/index-ba42b4fc.js +0 -862
- package/bundle/lib/enr.js +0 -8
- package/bundle/lib/peer_discovery_dns.js +0 -5018
- package/bundle/lib/utils.js +0 -1
- package/bundle/lib/waku_message/version_1.js +0 -463
- package/bundle/multiaddr_to_peer_info-c406b1e1.js +0 -19
- package/bundle/multiaddr_to_peer_info-fd1de516.js +0 -19
- package/bundle/utils-9a3221f2.js +0 -815
- package/bundle/version_0-e6fe440c.js +0 -317
- package/dist/lib/crypto.d.ts +0 -34
- package/dist/lib/crypto.js +0 -79
- package/dist/lib/crypto.js.map +0 -1
- package/dist/lib/enr/constants.d.ts +0 -4
- package/dist/lib/enr/constants.js +0 -8
- package/dist/lib/enr/constants.js.map +0 -1
- package/dist/lib/enr/enr.d.ts +0 -90
- package/dist/lib/enr/enr.js +0 -432
- package/dist/lib/enr/enr.js.map +0 -1
- package/dist/lib/enr/index.d.ts +0 -5
- package/dist/lib/enr/index.js +0 -6
- package/dist/lib/enr/index.js.map +0 -1
- package/dist/lib/enr/keypair/index.d.ts +0 -8
- package/dist/lib/enr/keypair/index.js +0 -53
- package/dist/lib/enr/keypair/index.js.map +0 -1
- package/dist/lib/enr/keypair/secp256k1.d.ts +0 -13
- package/dist/lib/enr/keypair/secp256k1.js +0 -57
- package/dist/lib/enr/keypair/secp256k1.js.map +0 -1
- package/dist/lib/enr/keypair/types.d.ts +0 -13
- package/dist/lib/enr/keypair/types.js +0 -7
- package/dist/lib/enr/keypair/types.js.map +0 -1
- package/dist/lib/enr/multiaddr_from_fields.d.ts +0 -2
- package/dist/lib/enr/multiaddr_from_fields.js +0 -8
- package/dist/lib/enr/multiaddr_from_fields.js.map +0 -1
- package/dist/lib/enr/multiaddrs_codec.d.ts +0 -3
- package/dist/lib/enr/multiaddrs_codec.js +0 -32
- package/dist/lib/enr/multiaddrs_codec.js.map +0 -1
- package/dist/lib/enr/types.d.ts +0 -8
- package/dist/lib/enr/types.js +0 -3
- package/dist/lib/enr/types.js.map +0 -1
- package/dist/lib/enr/v4.d.ts +0 -3
- package/dist/lib/enr/v4.js +0 -14
- package/dist/lib/enr/v4.js.map +0 -1
- package/dist/lib/enr/waku2_codec.d.ts +0 -8
- package/dist/lib/enr/waku2_codec.js +0 -36
- package/dist/lib/enr/waku2_codec.js.map +0 -1
- package/dist/lib/peer_discovery_dns/dns.d.ts +0 -48
- package/dist/lib/peer_discovery_dns/dns.js +0 -158
- package/dist/lib/peer_discovery_dns/dns.js.map +0 -1
- package/dist/lib/peer_discovery_dns/dns_over_https.d.ts +0 -32
- package/dist/lib/peer_discovery_dns/dns_over_https.js +0 -87
- package/dist/lib/peer_discovery_dns/dns_over_https.js.map +0 -1
- package/dist/lib/peer_discovery_dns/enrtree.d.ts +0 -33
- package/dist/lib/peer_discovery_dns/enrtree.js +0 -76
- package/dist/lib/peer_discovery_dns/enrtree.js.map +0 -1
- package/dist/lib/peer_discovery_dns/fetch_nodes.d.ts +0 -14
- package/dist/lib/peer_discovery_dns/fetch_nodes.js +0 -133
- package/dist/lib/peer_discovery_dns/fetch_nodes.js.map +0 -1
- package/dist/lib/peer_discovery_dns/index.d.ts +0 -30
- package/dist/lib/peer_discovery_dns/index.js +0 -54
- package/dist/lib/peer_discovery_dns/index.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -22
- package/dist/lib/utils.js +0 -40
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/waku_message/constants.d.ts +0 -12
- package/dist/lib/waku_message/constants.js +0 -10
- package/dist/lib/waku_message/constants.js.map +0 -1
- package/dist/lib/waku_message/ecies.d.ts +0 -17
- package/dist/lib/waku_message/ecies.js +0 -126
- package/dist/lib/waku_message/ecies.js.map +0 -1
- package/dist/lib/waku_message/symmetric.d.ts +0 -3
- package/dist/lib/waku_message/symmetric.js +0 -18
- package/dist/lib/waku_message/symmetric.js.map +0 -1
- package/dist/lib/waku_message/version_1.d.ts +0 -93
- package/dist/lib/waku_message/version_1.js +0 -325
- package/dist/lib/waku_message/version_1.js.map +0 -1
- package/src/lib/crypto.ts +0 -100
- package/src/lib/enr/constants.ts +0 -10
- package/src/lib/enr/enr.ts +0 -516
- package/src/lib/enr/index.ts +0 -5
- package/src/lib/enr/keypair/index.ts +0 -76
- package/src/lib/enr/keypair/secp256k1.ts +0 -69
- package/src/lib/enr/keypair/types.ts +0 -14
- package/src/lib/enr/multiaddr_from_fields.ts +0 -18
- package/src/lib/enr/multiaddrs_codec.ts +0 -50
- package/src/lib/enr/types.ts +0 -11
- package/src/lib/enr/v4.ts +0 -22
- package/src/lib/enr/waku2_codec.ts +0 -39
- package/src/lib/peer_discovery_dns/dns.ts +0 -223
- package/src/lib/peer_discovery_dns/dns_over_https.ts +0 -98
- package/src/lib/peer_discovery_dns/enrtree.ts +0 -123
- package/src/lib/peer_discovery_dns/fetch_nodes.ts +0 -180
- package/src/lib/peer_discovery_dns/index.ts +0 -84
- package/src/lib/utils.ts +0 -50
- package/src/lib/waku_message/constants.ts +0 -10
- package/src/lib/waku_message/ecies.ts +0 -194
- package/src/lib/waku_message/symmetric.ts +0 -33
- package/src/lib/waku_message/version_1.ts +0 -457
@@ -1,5 +1,5 @@
|
|
1
1
|
import { d as debug } from './browser-1e1a2f27.js';
|
2
|
-
import { m as message,
|
2
|
+
import { m as message, j as encodeMessage, k as decodeMessage } from './message-049c8b67.js';
|
3
3
|
|
4
4
|
/* eslint-disable import/export */
|
5
5
|
var TopicOnlyMessage$1;
|
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
export { DefaultPubSubTopic } from "./lib/constants";
|
2
|
-
export { generatePrivateKey, generateSymmetricKey, getPublicKey, } from "./lib/crypto";
|
3
|
-
export * as enr from "./lib/enr";
|
4
|
-
export * as utils from "./lib/utils";
|
5
2
|
export * as proto_message from "./proto/message";
|
6
3
|
export * as proto_topic_only_message from "./proto/topic_only_message";
|
7
4
|
export * as waku from "./lib/waku";
|
package/dist/index.js
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
export { DefaultPubSubTopic } from "./lib/constants.js";
|
2
|
-
export { generatePrivateKey, generateSymmetricKey, getPublicKey, } from "./lib/crypto.js";
|
3
|
-
export * as enr from "./lib/enr/index.js";
|
4
|
-
export * as utils from "./lib/utils.js";
|
5
2
|
export * as proto_message from "./proto/message.js";
|
6
3
|
export * as proto_topic_only_message from "./proto/topic_only_message.js";
|
7
4
|
export * as waku from "./lib/waku.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,iBAAiB,CAAC;AAErD,OAAO,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,wBAAwB,MAAM,4BAA4B,CAAC;AAEvE,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { Peer } from "@libp2p/interface-peer-store";
|
2
|
-
import type { Callback, Decoder, Filter,
|
2
|
+
import type { Callback, DecodedMessage, Decoder, Filter, ProtocolOptions } from "@waku/interfaces";
|
3
3
|
import type { Libp2p } from "libp2p";
|
4
4
|
import { ContentFilter } from "./filter_rpc";
|
5
5
|
export { ContentFilter };
|
@@ -35,7 +35,7 @@ export declare class WakuFilter implements Filter {
|
|
35
35
|
* @param opts The FilterSubscriptionOpts used to narrow which messages are returned, and which peer to connect to.
|
36
36
|
* @returns Unsubscribe function that can be used to end the subscription.
|
37
37
|
*/
|
38
|
-
subscribe<T extends
|
38
|
+
subscribe<T extends DecodedMessage>(decoders: Decoder<T>[], callback: Callback<T>, opts?: ProtocolOptions): Promise<UnsubscribeFunction>;
|
39
39
|
private onRequest;
|
40
40
|
private pushMessages;
|
41
41
|
private addCallback;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/waku_filter/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/waku_filter/index.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAiB,SAAS,EAAE,MAAM,cAAc,CAAC;AAGxD,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAE1D,MAAM,GAAG,GAAG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AC,EACb,MAAM,CACP,CAAC;QACF,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAC;SAC7D;QACD,OAAO,GAAG,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,OAAO,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,gBAAgB,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import type { Decoder, Encoder, Message, ProtoMessage, RateLimitProof } from "@waku/interfaces";
|
1
|
+
import type { DecodedMessage, Decoder, Encoder, Message, ProtoMessage, RateLimitProof } from "@waku/interfaces";
|
2
2
|
import * as proto from "../../proto/message";
|
3
3
|
export declare const Version = 0;
|
4
|
-
export
|
4
|
+
export { proto };
|
5
|
+
export declare class MessageV0 implements DecodedMessage {
|
5
6
|
protected proto: proto.WakuMessage;
|
6
7
|
constructor(proto: proto.WakuMessage);
|
7
8
|
get _rawPayload(): Uint8Array | undefined;
|
@@ -3,6 +3,7 @@ import * as proto from "../../proto/message.js";
|
|
3
3
|
const log = debug("waku:message:version-0");
|
4
4
|
const OneMillion = BigInt(1000000);
|
5
5
|
export const Version = 0;
|
6
|
+
export { proto };
|
6
7
|
export class MessageV0 {
|
7
8
|
constructor(proto) {
|
8
9
|
this.proto = proto;
|
@@ -60,7 +61,7 @@ export class EncoderV0 {
|
|
60
61
|
return {
|
61
62
|
payload: message.payload,
|
62
63
|
version: Version,
|
63
|
-
contentTopic:
|
64
|
+
contentTopic: this.contentTopic,
|
64
65
|
timestamp: BigInt(timestamp.valueOf()) * OneMillion,
|
65
66
|
rateLimitProof: message.rateLimitProof,
|
66
67
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version_0.js","sourceRoot":"","sources":["../../../src/lib/waku_message/version_0.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"version_0.js","sourceRoot":"","sources":["../../../src/lib/waku_message/version_0.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAE7C,MAAM,GAAG,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAS,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,MAAM,OAAO,SAAS;IACpB,YAAsB,KAAwB;QAAxB,UAAK,GAAL,KAAK,CAAmB;IAAG,CAAC;IAElD,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE;YACtB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC3C;QACD,OAAO;IACT,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;IACjC,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IAED,IAAI,SAAS;QACX,sEAAsE;QACtE,2CAA2C;QAC3C,IAAI;YACF,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;gBACxB,0CAA0C;gBAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,UAAU,CAAC;gBACpD,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;aACpC;YAED,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE;gBAClC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E,YAAY,CAAC,OAAO,IAAI,SAAS;YAC1C,YAAY,EAAE,YAAY,CAAC,YAAY,IAAI,SAAS;YACpD,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,SAAS;YAC1C,SAAS,EAAE,YAAY,CAAC,SAAS,IAAI,SAAS;YAC9C,cAAc,EAAE,YAAY,CAAC,cAAc,IAAI,SAAS;SACzD,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAmB;QACpC,kDAAkD;QAClD,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;YAC/B,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;SACnB;QAED,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,EAAE;YAC7B,GAAG,CACD,sDAAsD,EACtD,OAAO,EACP,WAAW,EACX,KAAK,CAAC,OAAO,CACd,CAAC;YACF,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACnC;QAED,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { GossipSub, GossipsubOpts } from "@chainsafe/libp2p-gossipsub";
|
2
2
|
import { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/dist/src/types";
|
3
3
|
import type { Callback, Decoder, Encoder, Message, Relay, SendResult } from "@waku/interfaces";
|
4
|
-
|
4
|
+
import { DecodedMessage } from "@waku/interfaces";
|
5
|
+
export declare type Observer<T extends DecodedMessage> = {
|
5
6
|
decoder: Decoder<T>;
|
6
7
|
callback: Callback<T>;
|
7
8
|
};
|
@@ -29,7 +30,7 @@ export declare type CreateOptions = {
|
|
29
30
|
*/
|
30
31
|
export declare class WakuRelay extends GossipSub implements Relay {
|
31
32
|
pubSubTopic: string;
|
32
|
-
defaultDecoder: Decoder<
|
33
|
+
defaultDecoder: Decoder<DecodedMessage>;
|
33
34
|
static multicodec: string;
|
34
35
|
/**
|
35
36
|
* observers called when receiving new message.
|
@@ -54,7 +55,7 @@ export declare class WakuRelay extends GossipSub implements Relay {
|
|
54
55
|
*
|
55
56
|
* @returns Function to delete the observer
|
56
57
|
*/
|
57
|
-
addObserver<T extends
|
58
|
+
addObserver<T extends DecodedMessage>(decoder: Decoder<T>, callback: Callback<T>): () => void;
|
58
59
|
/**
|
59
60
|
* Subscribe to a pubsub topic and start emitting Waku messages to observers.
|
60
61
|
*
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/waku_relay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,GAGV,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/waku_relay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,GAGV,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAUpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAwBhC;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IAWtC,YAAY,OAAgC;QAC1C,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE;YACrC,qEAAqE;YACrE,qBAAqB,EAAE,eAAe,CAAC,YAAY;YACnD,kBAAkB,EAAE,KAAK;SAC1B,CAAC,CAAC;QACH,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC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C/B,CAAC;IAED,YAAY,CAAC,KAAgB;QAC3B,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;;AA9Ha,oBAAU,GAAW,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAiI9D,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { PeerId } from "@libp2p/interface-peer-id";
|
2
2
|
import { Peer } from "@libp2p/interface-peer-store";
|
3
|
-
import {
|
3
|
+
import { DecodedMessage, Decoder } from "@waku/interfaces";
|
4
4
|
import { Libp2p } from "libp2p";
|
5
5
|
import { PageDirection } from "./history_rpc";
|
6
6
|
export declare const StoreCodec = "/vac/waku/store/2.0.0-beta4";
|
@@ -79,7 +79,7 @@ export declare class WakuStore {
|
|
79
79
|
* or if an error is encountered when processing the reply,
|
80
80
|
* or if two decoders with the same content topic are passed.
|
81
81
|
*/
|
82
|
-
queryOrderedCallback<T extends
|
82
|
+
queryOrderedCallback<T extends DecodedMessage>(decoders: Decoder<T>[], callback: (message: T) => Promise<void | boolean> | boolean | void, options?: QueryOptions): Promise<void>;
|
83
83
|
/**
|
84
84
|
* Do a query to a Waku Store to retrieve historical/missed messages.
|
85
85
|
*
|
@@ -98,7 +98,7 @@ export declare class WakuStore {
|
|
98
98
|
* or if an error is encountered when processing the reply,
|
99
99
|
* or if two decoders with the same content topic are passed.
|
100
100
|
*/
|
101
|
-
queryCallbackOnPromise<T extends
|
101
|
+
queryCallbackOnPromise<T extends DecodedMessage>(decoders: Decoder<T>[], callback: (message: Promise<T | undefined>) => Promise<void | boolean> | boolean | void, options?: QueryOptions): Promise<void>;
|
102
102
|
/**
|
103
103
|
* Do a query to a Waku Store to retrieve historical/missed messages.
|
104
104
|
*
|
@@ -116,7 +116,7 @@ export declare class WakuStore {
|
|
116
116
|
* or if an error is encountered when processing the reply,
|
117
117
|
* or if two decoders with the same content topic are passed.
|
118
118
|
*/
|
119
|
-
queryGenerator<T extends
|
119
|
+
queryGenerator<T extends DecodedMessage>(decoders: Decoder<T>[], options?: QueryOptions): AsyncGenerator<Promise<T | undefined>[]>;
|
120
120
|
/**
|
121
121
|
* Returns known peers from the address book (`libp2p.peerStore`) that support
|
122
122
|
* store protocol. Waku may or may not be currently connected to these peers.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@waku/core",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.3",
|
4
4
|
"description": "TypeScript implementation of the Waku v2 protocol",
|
5
5
|
"types": "./dist/index.d.ts",
|
6
6
|
"module": "./dist/index.js",
|
@@ -9,14 +9,6 @@
|
|
9
9
|
"types": "./dist/index.d.ts",
|
10
10
|
"import": "./dist/index.js"
|
11
11
|
},
|
12
|
-
"./lib/enr": {
|
13
|
-
"types": "./dist/lib/enr/index.d.ts",
|
14
|
-
"import": "./dist/lib/enr/index.js"
|
15
|
-
},
|
16
|
-
"./lib/peer_discovery_dns": {
|
17
|
-
"types": "./dist/lib/peer_discovery_dns/index.d.ts",
|
18
|
-
"import": "./dist/lib/peer_discovery_dns/index.js"
|
19
|
-
},
|
20
12
|
"./lib/peer_discovery_static_list": {
|
21
13
|
"types": "./dist/lib/peer_discovery_static_list.d.ts",
|
22
14
|
"import": "./dist/lib/peer_discovery_static_list.js"
|
@@ -25,10 +17,6 @@
|
|
25
17
|
"types": "./dist/lib/predefined_bootstrap_nodes.d.ts",
|
26
18
|
"import": "./dist/lib/predefined_bootstrap_nodes.js"
|
27
19
|
},
|
28
|
-
"./lib/utils": {
|
29
|
-
"types": "./dist/lib/utils.d.ts",
|
30
|
-
"import": "./dist/lib/utils.js"
|
31
|
-
},
|
32
20
|
"./lib/wait_for_remote_peer": {
|
33
21
|
"types": "./dist/lib/wait_for_remote_peer.d.ts",
|
34
22
|
"import": "./dist/lib/wait_for_remote_peer.js"
|
@@ -37,10 +25,6 @@
|
|
37
25
|
"types": "./dist/lib/waku_message/version_0.d.ts",
|
38
26
|
"import": "./dist/lib/waku_message/version_0.js"
|
39
27
|
},
|
40
|
-
"./lib/waku_message/version_1": {
|
41
|
-
"types": "./dist/lib/waku_message/version_1.d.ts",
|
42
|
-
"import": "./dist/lib/waku_message/version_1.js"
|
43
|
-
},
|
44
28
|
"./lib/waku_message/topic_only_message": {
|
45
29
|
"types": "./dist/lib/waku_message/topic_only_message.d.ts",
|
46
30
|
"import": "./dist/lib/waku_message/topic_only_message.js"
|
@@ -96,20 +80,14 @@
|
|
96
80
|
"watch:test": "mocha --watch",
|
97
81
|
"prepublish": "npm run build",
|
98
82
|
"deploy": "node ci/deploy.js",
|
99
|
-
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
100
|
-
"release": "semantic-release"
|
101
|
-
},
|
102
|
-
"browser": {
|
103
|
-
"crypto": false
|
83
|
+
"reset-hard": "git clean -dfx -e .idea && git reset --hard && npm i && npm run build"
|
104
84
|
},
|
105
85
|
"engines": {
|
106
86
|
"node": ">=16"
|
107
87
|
},
|
108
88
|
"dependencies": {
|
89
|
+
"@waku/byte-utils": "*",
|
109
90
|
"@chainsafe/libp2p-gossipsub": "^4.1.1",
|
110
|
-
"@chainsafe/libp2p-noise": "^8.0.1",
|
111
|
-
"@ethersproject/rlp": "^5.5.0",
|
112
|
-
"@libp2p/crypto": "^1.0.4",
|
113
91
|
"@libp2p/interface-connection": "3.0.1",
|
114
92
|
"@libp2p/interface-peer-discovery": "^1.0.0",
|
115
93
|
"@libp2p/interface-peer-id": "^1.0.2",
|
@@ -117,37 +95,24 @@
|
|
117
95
|
"@libp2p/interface-peer-store": "^1.0.0",
|
118
96
|
"@libp2p/interface-pubsub": "^2.0.1",
|
119
97
|
"@libp2p/interfaces": "^3.0.2",
|
120
|
-
"@libp2p/mplex": "^5.1.1",
|
121
98
|
"@libp2p/peer-id": "^1.1.10",
|
122
|
-
"@libp2p/websockets": "^3.0.3",
|
123
99
|
"@multiformats/multiaddr": "^11.0.6",
|
124
|
-
"@noble/secp256k1": "^1.3.4",
|
125
100
|
"@waku/interfaces": "*",
|
126
101
|
"debug": "^4.3.4",
|
127
|
-
"dns-query": "^0.11.2",
|
128
|
-
"hi-base32": "^0.5.1",
|
129
102
|
"it-all": "^1.0.6",
|
130
103
|
"it-length-prefixed": "^8.0.2",
|
131
104
|
"it-pipe": "^2.0.4",
|
132
|
-
"js-sha3": "^0.8.0",
|
133
105
|
"libp2p": "0.38.0",
|
134
106
|
"p-event": "^5.0.1",
|
135
107
|
"protons-runtime": "^3.1.0",
|
136
108
|
"uint8arraylist": "^2.3.2",
|
137
|
-
"uint8arrays": "^
|
109
|
+
"uint8arrays": "^4.0.2",
|
138
110
|
"uuid": "^8.3.2"
|
139
111
|
},
|
140
112
|
"devDependencies": {
|
141
|
-
"@libp2p/peer-id-factory": "^1.0.15",
|
142
113
|
"@rollup/plugin-commonjs": "^22.0.0",
|
143
114
|
"@rollup/plugin-json": "^4.1.0",
|
144
115
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
145
|
-
"@semantic-release/changelog": "^6.0.1",
|
146
|
-
"@semantic-release/commit-analyzer": "^9.0.2",
|
147
|
-
"@semantic-release/git": "^10.0.1",
|
148
|
-
"@semantic-release/github": "^8.0.6",
|
149
|
-
"@semantic-release/npm": "^9.0.1",
|
150
|
-
"@semantic-release/release-notes-generator": "^10.0.3",
|
151
116
|
"@types/app-root-path": "^1.2.4",
|
152
117
|
"@types/chai": "^4.2.15",
|
153
118
|
"@types/debug": "^4.1.7",
|
@@ -185,95 +150,11 @@
|
|
185
150
|
"protons": "^5.1.0",
|
186
151
|
"puppeteer": "^13.0.1",
|
187
152
|
"rollup": "^2.75.0",
|
188
|
-
"semantic-release": "^19.0.5",
|
189
|
-
"semantic-release-monorepo": "^7.0.5",
|
190
153
|
"tail": "^2.2.0",
|
191
154
|
"ts-loader": "^9.3.1",
|
192
155
|
"ts-node": "^10.9.1",
|
193
156
|
"typescript": "^4.6.3"
|
194
157
|
},
|
195
|
-
"release": {
|
196
|
-
"branches": [
|
197
|
-
"master"
|
198
|
-
],
|
199
|
-
"extends": "semantic-release-monorepo",
|
200
|
-
"plugins": [
|
201
|
-
[
|
202
|
-
"@semantic-release/commit-analyzer",
|
203
|
-
{
|
204
|
-
"preset": "conventionalcommits",
|
205
|
-
"releaseRules": [
|
206
|
-
{
|
207
|
-
"breaking": true,
|
208
|
-
"release": "patch"
|
209
|
-
},
|
210
|
-
{
|
211
|
-
"revert": true,
|
212
|
-
"release": "patch"
|
213
|
-
},
|
214
|
-
{
|
215
|
-
"type": "feat",
|
216
|
-
"release": "patch"
|
217
|
-
},
|
218
|
-
{
|
219
|
-
"type": "fix",
|
220
|
-
"release": "patch"
|
221
|
-
},
|
222
|
-
{
|
223
|
-
"type": "doc",
|
224
|
-
"release": "patch"
|
225
|
-
},
|
226
|
-
{
|
227
|
-
"type": "test",
|
228
|
-
"release": "patch"
|
229
|
-
},
|
230
|
-
{
|
231
|
-
"scope": "deps",
|
232
|
-
"release": "patch"
|
233
|
-
},
|
234
|
-
{
|
235
|
-
"scope": "no-release",
|
236
|
-
"release": false
|
237
|
-
}
|
238
|
-
]
|
239
|
-
}
|
240
|
-
],
|
241
|
-
[
|
242
|
-
"@semantic-release/release-notes-generator",
|
243
|
-
{
|
244
|
-
"preset": "conventionalcommits",
|
245
|
-
"presetConfig": {
|
246
|
-
"types": [
|
247
|
-
{
|
248
|
-
"type": "feat",
|
249
|
-
"section": "Features"
|
250
|
-
},
|
251
|
-
{
|
252
|
-
"type": "fix",
|
253
|
-
"section": "Bug Fixes"
|
254
|
-
},
|
255
|
-
{
|
256
|
-
"type": "chore",
|
257
|
-
"section": "Trivial Changes"
|
258
|
-
},
|
259
|
-
{
|
260
|
-
"type": "doc",
|
261
|
-
"section": "Documentation"
|
262
|
-
},
|
263
|
-
{
|
264
|
-
"type": "test",
|
265
|
-
"section": "Tests"
|
266
|
-
}
|
267
|
-
]
|
268
|
-
}
|
269
|
-
}
|
270
|
-
],
|
271
|
-
"@semantic-release/changelog",
|
272
|
-
"@semantic-release/npm",
|
273
|
-
"@semantic-release/github",
|
274
|
-
"@semantic-release/git"
|
275
|
-
]
|
276
|
-
},
|
277
158
|
"typedoc": {
|
278
159
|
"entryPoint": "./src/index.ts"
|
279
160
|
},
|
package/src/index.ts
CHANGED
@@ -1,15 +1,5 @@
|
|
1
1
|
export { DefaultPubSubTopic } from "./lib/constants";
|
2
2
|
|
3
|
-
export {
|
4
|
-
generatePrivateKey,
|
5
|
-
generateSymmetricKey,
|
6
|
-
getPublicKey,
|
7
|
-
} from "./lib/crypto";
|
8
|
-
|
9
|
-
export * as enr from "./lib/enr";
|
10
|
-
|
11
|
-
export * as utils from "./lib/utils";
|
12
|
-
|
13
3
|
export * as proto_message from "./proto/message";
|
14
4
|
export * as proto_topic_only_message from "./proto/topic_only_message";
|
15
5
|
|
@@ -4,6 +4,7 @@ import type { Peer } from "@libp2p/interface-peer-store";
|
|
4
4
|
import type { IncomingStreamData } from "@libp2p/interface-registrar";
|
5
5
|
import type {
|
6
6
|
Callback,
|
7
|
+
DecodedMessage,
|
7
8
|
Decoder,
|
8
9
|
Filter,
|
9
10
|
Message,
|
@@ -77,7 +78,7 @@ export class WakuFilter implements Filter {
|
|
77
78
|
* @param opts The FilterSubscriptionOpts used to narrow which messages are returned, and which peer to connect to.
|
78
79
|
* @returns Unsubscribe function that can be used to end the subscription.
|
79
80
|
*/
|
80
|
-
async subscribe<T extends
|
81
|
+
async subscribe<T extends DecodedMessage>(
|
81
82
|
decoders: Decoder<T>[],
|
82
83
|
callback: Callback<T>,
|
83
84
|
opts?: ProtocolOptions
|
@@ -211,7 +212,7 @@ export class WakuFilter implements Filter {
|
|
211
212
|
this.subscriptions.delete(requestId);
|
212
213
|
}
|
213
214
|
|
214
|
-
private addDecoders<T extends
|
215
|
+
private addDecoders<T extends DecodedMessage>(
|
215
216
|
decoders: Map<string, Array<Decoder<T>>>
|
216
217
|
): void {
|
217
218
|
decoders.forEach((decoders, contentTopic) => {
|
@@ -224,7 +225,7 @@ export class WakuFilter implements Filter {
|
|
224
225
|
});
|
225
226
|
}
|
226
227
|
|
227
|
-
private deleteDecoders<T extends
|
228
|
+
private deleteDecoders<T extends DecodedMessage>(
|
228
229
|
decoders: Map<string, Array<Decoder<T>>>
|
229
230
|
): void {
|
230
231
|
decoders.forEach((decoders, contentTopic) => {
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import type {
|
2
|
+
DecodedMessage,
|
2
3
|
Decoder,
|
3
4
|
Encoder,
|
4
5
|
Message,
|
@@ -10,11 +11,12 @@ import debug from "debug";
|
|
10
11
|
import * as proto from "../../proto/message";
|
11
12
|
|
12
13
|
const log = debug("waku:message:version-0");
|
13
|
-
|
14
14
|
const OneMillion = BigInt(1_000_000);
|
15
|
+
|
15
16
|
export const Version = 0;
|
17
|
+
export { proto };
|
16
18
|
|
17
|
-
export class MessageV0 implements
|
19
|
+
export class MessageV0 implements DecodedMessage {
|
18
20
|
constructor(protected proto: proto.WakuMessage) {}
|
19
21
|
|
20
22
|
get _rawPayload(): Uint8Array | undefined {
|
@@ -78,7 +80,7 @@ export class EncoderV0 implements Encoder {
|
|
78
80
|
return {
|
79
81
|
payload: message.payload,
|
80
82
|
version: Version,
|
81
|
-
contentTopic:
|
83
|
+
contentTopic: this.contentTopic,
|
82
84
|
timestamp: BigInt(timestamp.valueOf()) * OneMillion,
|
83
85
|
rateLimitProof: message.rateLimitProof,
|
84
86
|
};
|
@@ -16,6 +16,7 @@ import type {
|
|
16
16
|
Relay,
|
17
17
|
SendResult,
|
18
18
|
} from "@waku/interfaces";
|
19
|
+
import { DecodedMessage } from "@waku/interfaces";
|
19
20
|
import debug from "debug";
|
20
21
|
|
21
22
|
import { DefaultPubSubTopic } from "../constants";
|
@@ -26,7 +27,7 @@ import * as constants from "./constants";
|
|
26
27
|
|
27
28
|
const log = debug("waku:relay");
|
28
29
|
|
29
|
-
export type Observer<T extends
|
30
|
+
export type Observer<T extends DecodedMessage> = {
|
30
31
|
decoder: Decoder<T>;
|
31
32
|
callback: Callback<T>;
|
32
33
|
};
|
@@ -56,7 +57,7 @@ export type CreateOptions = {
|
|
56
57
|
*/
|
57
58
|
export class WakuRelay extends GossipSub implements Relay {
|
58
59
|
pubSubTopic: string;
|
59
|
-
defaultDecoder: Decoder<
|
60
|
+
defaultDecoder: Decoder<DecodedMessage>;
|
60
61
|
public static multicodec: string = constants.RelayCodecs[0];
|
61
62
|
|
62
63
|
/**
|
@@ -114,7 +115,7 @@ export class WakuRelay extends GossipSub implements Relay {
|
|
114
115
|
*
|
115
116
|
* @returns Function to delete the observer
|
116
117
|
*/
|
117
|
-
addObserver<T extends
|
118
|
+
addObserver<T extends DecodedMessage>(
|
118
119
|
decoder: Decoder<T>,
|
119
120
|
callback: Callback<T>
|
120
121
|
): () => void {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { Connection } from "@libp2p/interface-connection";
|
2
2
|
import type { PeerId } from "@libp2p/interface-peer-id";
|
3
3
|
import { Peer } from "@libp2p/interface-peer-store";
|
4
|
-
import {
|
4
|
+
import { DecodedMessage, Decoder } from "@waku/interfaces";
|
5
5
|
import debug from "debug";
|
6
6
|
import all from "it-all";
|
7
7
|
import * as lp from "it-length-prefixed";
|
@@ -106,7 +106,7 @@ export class WakuStore {
|
|
106
106
|
* or if an error is encountered when processing the reply,
|
107
107
|
* or if two decoders with the same content topic are passed.
|
108
108
|
*/
|
109
|
-
async queryOrderedCallback<T extends
|
109
|
+
async queryOrderedCallback<T extends DecodedMessage>(
|
110
110
|
decoders: Decoder<T>[],
|
111
111
|
callback: (message: T) => Promise<void | boolean> | boolean | void,
|
112
112
|
options?: QueryOptions
|
@@ -155,7 +155,7 @@ export class WakuStore {
|
|
155
155
|
* or if an error is encountered when processing the reply,
|
156
156
|
* or if two decoders with the same content topic are passed.
|
157
157
|
*/
|
158
|
-
async queryCallbackOnPromise<T extends
|
158
|
+
async queryCallbackOnPromise<T extends DecodedMessage>(
|
159
159
|
decoders: Decoder<T>[],
|
160
160
|
callback: (
|
161
161
|
message: Promise<T | undefined>
|
@@ -193,7 +193,7 @@ export class WakuStore {
|
|
193
193
|
* or if an error is encountered when processing the reply,
|
194
194
|
* or if two decoders with the same content topic are passed.
|
195
195
|
*/
|
196
|
-
async *queryGenerator<T extends
|
196
|
+
async *queryGenerator<T extends DecodedMessage>(
|
197
197
|
decoders: Decoder<T>[],
|
198
198
|
options?: QueryOptions
|
199
199
|
): AsyncGenerator<Promise<T | undefined>[]> {
|
@@ -266,7 +266,7 @@ export class WakuStore {
|
|
266
266
|
}
|
267
267
|
}
|
268
268
|
|
269
|
-
async function* paginate<T extends
|
269
|
+
async function* paginate<T extends DecodedMessage>(
|
270
270
|
connection: Connection,
|
271
271
|
protocol: string,
|
272
272
|
queryOpts: Params,
|