@waku/interfaces 0.0.3 → 0.0.5

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.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
2
2
  import type { Stream } from "@libp2p/interface-connection";
3
3
  import type { PeerId } from "@libp2p/interface-peer-id";
4
4
  import type { Peer } from "@libp2p/interface-peer-store";
5
+ import type { PeerStore } from "@libp2p/interface-peer-store";
5
6
  import type { Multiaddr } from "@multiformats/multiaddr";
6
7
  import type { Libp2p } from "libp2p";
7
8
  export declare enum Protocols {
@@ -11,9 +12,15 @@ export declare enum Protocols {
11
12
  Filter = "filter"
12
13
  }
13
14
  export interface PointToPointProtocol {
14
- libp2p: Libp2p;
15
+ peerStore: PeerStore;
15
16
  peers: () => Promise<Peer[]>;
16
17
  }
18
+ export interface Index {
19
+ digest?: Uint8Array;
20
+ receivedTime?: bigint;
21
+ senderTime?: bigint;
22
+ pubsubTopic?: string;
23
+ }
17
24
  export declare type ProtocolOptions = {
18
25
  pubSubTopic?: string;
19
26
  /**
@@ -56,6 +63,10 @@ export declare type StoreQueryOptions = {
56
63
  * Retrieve messages with a timestamp within the provided values.
57
64
  */
58
65
  timeFilter?: TimeFilter;
66
+ /**
67
+ * Cursor as an index to start a query from.
68
+ */
69
+ cursor?: Index;
59
70
  } & ProtocolOptions;
60
71
  export interface Store extends PointToPointProtocol {
61
72
  queryOrderedCallback: <T extends DecodedMessage>(decoders: Decoder<T>[], callback: (message: T) => Promise<void | boolean> | boolean | void, options?: StoreQueryOptions) => Promise<void>;
@@ -74,7 +85,6 @@ export interface Waku {
74
85
  filter?: Filter;
75
86
  lightPush?: LightPush;
76
87
  dial(peer: PeerId | Multiaddr, protocols?: Protocols[]): Promise<Stream>;
77
- addPeerToAddressBook(peerId: PeerId | string, multiaddrs: Multiaddr[] | string[]): void;
78
88
  start(): Promise<void>;
79
89
  stop(): Promise<void>;
80
90
  isStarted(): boolean;
@@ -116,6 +126,7 @@ export interface ProtoMessage {
116
126
  version: number | undefined;
117
127
  timestamp: bigint | undefined;
118
128
  rateLimitProof: RateLimitProof | undefined;
129
+ ephemeral: boolean | undefined;
119
130
  }
120
131
  /**
121
132
  * Interface for messages to encode and send.
@@ -127,6 +138,7 @@ export interface Message {
127
138
  }
128
139
  export interface Encoder {
129
140
  contentTopic: string;
141
+ ephemeral: boolean;
130
142
  toWire: (message: Message) => Promise<Uint8Array | undefined>;
131
143
  toProtoObj: (message: Message) => Promise<ProtoMessage | undefined>;
132
144
  }
@@ -135,6 +147,7 @@ export interface DecodedMessage {
135
147
  contentTopic: string | undefined;
136
148
  timestamp: Date | undefined;
137
149
  rateLimitProof: RateLimitProof | undefined;
150
+ ephemeral: boolean | undefined;
138
151
  }
139
152
  export interface Decoder<T extends DecodedMessage> {
140
153
  contentTopic: string;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,oCAAuB,CAAA;IACvB,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAiCD,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,oCAAuB,CAAA;IACvB,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB;AAuCD,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waku/interfaces",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Definition of Waku interfaces",
5
5
  "types": "./dist/index.d.ts",
6
6
  "module": "./dist/index.js",
@@ -48,12 +48,12 @@
48
48
  "node": ">=16"
49
49
  },
50
50
  "dependencies": {
51
- "@chainsafe/libp2p-gossipsub": "^4.1.1",
51
+ "@chainsafe/libp2p-gossipsub": "^5.2.1",
52
52
  "@libp2p/interface-connection": "^3.0.2",
53
53
  "@libp2p/interface-peer-id": "^1.0.5",
54
- "@libp2p/interface-peer-store": "^1.2.2",
54
+ "@libp2p/interface-peer-store": "^1.2.3",
55
55
  "@multiformats/multiaddr": "^11.0.6",
56
- "libp2p": "0.39.2"
56
+ "libp2p": "0.40.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@typescript-eslint/eslint-plugin": "^5.8.1",
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ import type { GossipSub } from "@chainsafe/libp2p-gossipsub";
2
2
  import type { Stream } from "@libp2p/interface-connection";
3
3
  import type { PeerId } from "@libp2p/interface-peer-id";
4
4
  import type { Peer } from "@libp2p/interface-peer-store";
5
+ import type { PeerStore } from "@libp2p/interface-peer-store";
5
6
  import type { Multiaddr } from "@multiformats/multiaddr";
6
7
  import type { Libp2p } from "libp2p";
7
8
 
@@ -13,9 +14,15 @@ export enum Protocols {
13
14
  }
14
15
 
15
16
  export interface PointToPointProtocol {
16
- libp2p: Libp2p;
17
+ peerStore: PeerStore;
17
18
  peers: () => Promise<Peer[]>;
18
19
  }
20
+ export interface Index {
21
+ digest?: Uint8Array;
22
+ receivedTime?: bigint;
23
+ senderTime?: bigint;
24
+ pubsubTopic?: string;
25
+ }
19
26
 
20
27
  export type ProtocolOptions = {
21
28
  pubSubTopic?: string;
@@ -73,6 +80,10 @@ export type StoreQueryOptions = {
73
80
  * Retrieve messages with a timestamp within the provided values.
74
81
  */
75
82
  timeFilter?: TimeFilter;
83
+ /**
84
+ * Cursor as an index to start a query from.
85
+ */
86
+ cursor?: Index;
76
87
  } & ProtocolOptions;
77
88
 
78
89
  export interface Store extends PointToPointProtocol {
@@ -112,11 +123,6 @@ export interface Waku {
112
123
 
113
124
  dial(peer: PeerId | Multiaddr, protocols?: Protocols[]): Promise<Stream>;
114
125
 
115
- addPeerToAddressBook(
116
- peerId: PeerId | string,
117
- multiaddrs: Multiaddr[] | string[]
118
- ): void;
119
-
120
126
  start(): Promise<void>;
121
127
 
122
128
  stop(): Promise<void>;
@@ -165,6 +171,7 @@ export interface ProtoMessage {
165
171
  version: number | undefined;
166
172
  timestamp: bigint | undefined;
167
173
  rateLimitProof: RateLimitProof | undefined;
174
+ ephemeral: boolean | undefined;
168
175
  }
169
176
 
170
177
  /**
@@ -178,6 +185,7 @@ export interface Message {
178
185
 
179
186
  export interface Encoder {
180
187
  contentTopic: string;
188
+ ephemeral: boolean;
181
189
  toWire: (message: Message) => Promise<Uint8Array | undefined>;
182
190
  toProtoObj: (message: Message) => Promise<ProtoMessage | undefined>;
183
191
  }
@@ -187,6 +195,7 @@ export interface DecodedMessage {
187
195
  contentTopic: string | undefined;
188
196
  timestamp: Date | undefined;
189
197
  rateLimitProof: RateLimitProof | undefined;
198
+ ephemeral: boolean | undefined;
190
199
  }
191
200
 
192
201
  export interface Decoder<T extends DecodedMessage> {