File tree 3 files changed +75
-0
lines changed
3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 8
8
" src" ,
9
9
" dist"
10
10
],
11
+ "types" : " src/index.d.ts" ,
11
12
"scripts" : {
12
13
"lint" : " aegir lint" ,
13
14
"release" : " aegir release" ,
Original file line number Diff line number Diff line change
1
+ // Type definitions for libp2p-gossipsub v0.2.3
2
+ // Project https://github.com/ChainSafe/gossipsub-js
3
+
4
+ /// <reference types="node"/>
5
+
6
+ import PeerInfo = require( 'peer-info' ) ;
7
+
8
+ export interface Registrar {
9
+ handle : Function ;
10
+ register ( topology : Object ) : string ;
11
+ unregister ( id : string ) : boolean ;
12
+ }
13
+
14
+ export interface IGossipMessage {
15
+ from : Buffer | string ;
16
+ data : Buffer ;
17
+ seqno : Buffer ;
18
+ topicIDs : string [ ] ;
19
+ }
20
+
21
+ export interface Options {
22
+ emitSelf ?: boolean ,
23
+ gossipIncoming ?: boolean ,
24
+ fallbackToFloodsub ?: boolean ,
25
+ }
26
+
27
+ import * as Events from "events" ;
28
+
29
+ interface GossipSub extends Events . EventEmitter { }
30
+
31
+ declare class GossipSub {
32
+ constructor ( peerInfo : PeerInfo , registrar : Registrar , options : Options ) ;
33
+ publish ( topic : string , data : Buffer ) : Promise < void > ;
34
+ start ( ) : Promise < void > ;
35
+ stop ( ) : Promise < void > ;
36
+ subscribe ( topic : string ) : void ;
37
+ unsubscribe ( topic : string ) : void ;
38
+ validate ( message : IGossipMessage ) : Promise < boolean > ;
39
+ _emitMessage ( topics : string [ ] , message : IGossipMessage ) : void ;
40
+ getTopics ( ) : string [ ] ;
41
+ _publish ( messages : IGossipMessage [ ] ) : void ;
42
+ }
43
+
44
+ export default GossipSub ;
Original file line number Diff line number Diff line change
1
+
2
+ {
3
+ "compilerOptions" : {
4
+ "module" : " commonjs" ,
5
+ "lib" : [
6
+ " es6"
7
+ ],
8
+ "target" : " ES5" ,
9
+ "noImplicitAny" : false ,
10
+ "noImplicitThis" : true ,
11
+ "strictFunctionTypes" : true ,
12
+ "strictNullChecks" : true ,
13
+ "esModuleInterop" : true ,
14
+ "resolveJsonModule" : true ,
15
+ "allowJs" : true ,
16
+ "checkJs" : true ,
17
+ "baseUrl" : " ." ,
18
+ },
19
+ "types" : [
20
+ " node" ,
21
+ " mocha" ,
22
+ " chai"
23
+ ],
24
+ "noEmit" : true ,
25
+ "forceConsistentCasingInFileNames" : true
26
+ },
27
+ " files" : [
28
+ " ./src/index.d.ts"
29
+ ]
30
+ }
You can’t perform that action at this time.
0 commit comments