Merge pull request #33 from polkadot-js/jg-libp2p-promise

libp2p 0.26 with promises
This commit is contained in:
Jaco Greeff 2019-08-26 12:38:16 +02:00 committed by GitHub
commit 7cb951ab9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 18 deletions

View File

@ -19,6 +19,6 @@
},
"devDependencies": {
"@babel/core": "^7.5.4",
"@polkadot/dev": "^0.31.0-beta.1"
"@polkadot/dev": "^0.31.0-beta.3"
}
}

View File

@ -17,18 +17,16 @@
declare namespace LibP2p {
export type OptionsConfig = {
contentRouting?: {},
dht?: {
kBucketSize?: number
},
EXPERIMENTAL?: {
pubsub?: boolean,
dht?: boolean
},
peerDiscovery?: {
enabled?: boolean,
bootstrap?: {
interval?: number
enabled?: boolean
list: Multiaddr.Multiaddr[]
list?: Multiaddr.Multiaddr[]
},
mdns?: {
interval?: number
@ -43,7 +41,12 @@ declare namespace LibP2p {
}
},
peerRouting?: {},
contentRouting?: {},
pubsub?: {
enabled?: boolean,
emitSelf: boolean,
signMessages: boolean,
strictSigning: boolean
},
relay?: {
enabled?: boolean,
hop?: {
@ -79,18 +82,18 @@ declare class LibP2p {
readonly peerInfo: PeerInfo;
readonly peerBook: PeerBook;
dial(peerInfo: PeerInfo, cb: (error: Error | null) => any): void;
dialProtocol(peerInfo: PeerInfo | Multiaddr.Multiaddr, protocol: string, cb: (error: Error | null, conn?: LibP2pConnection) => any): void;
hangUp(peerInfo: PeerInfo, cb: (error: Error | null) => any): void;
dial(peerInfo: PeerInfo): Promise<LibP2pConnection>;
dialProtocol(peerInfo: PeerInfo | Multiaddr.Multiaddr, protocol: string): Promise<LibP2pConnection>;
hangUp(peerInfo: PeerInfo): Promise<void>;
handle(protocol: string, handler: (protocol: string, conn: LibP2pConnection) => any, matcher?: (protocol: string, requestedProtocol: string, cb: (error: Error | null, accept: boolean) => void) => any): void;
unhandle(protocol: string): void;
isStarted(): boolean;
on(event: LibP2p.Events, cb: (event: any) => any): this;
once(event: LibP2p.Events, cb: (event: any) => any): this;
removeListener(event: LibP2p.Events, cb: (event: any) => any): this;
ping(peerInfo: PeerInfo, callback: (error: Error | null, ping: any) => void): void;
start(cb: (error: Error | null) => any): void;
stop(cb: (error: Error | null) => any): void;
ping(peerInfo: PeerInfo): Promise<void>;
start(): Promise<void>;
stop(): Promise<void>;
}
declare module 'libp2p' {

View File

@ -12,5 +12,5 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "bn.js-tests.ts"]
"files": ["index.d.ts", "libp2p-tests.ts"]
}

View File

@ -1795,10 +1795,10 @@
universal-user-agent "^3.0.0"
url-template "^2.0.8"
"@polkadot/dev@^0.31.0-beta.1":
version "0.31.0-beta.1"
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.31.0-beta.1.tgz#444cf9b5a2d93bc0c4e054c95bb30e49842b5f06"
integrity sha512-VevAWJHaoftMUNG2CfKwwLeKuvOpzQDomEyTdAGnjqXsigc3Bp/aBR/SkS9EQZU/wA7HcbVDZhEHK6yUm6ETAQ==
"@polkadot/dev@^0.31.0-beta.3":
version "0.31.0-beta.3"
resolved "https://registry.yarnpkg.com/@polkadot/dev/-/dev-0.31.0-beta.3.tgz#f9880e7c430e6a4df423211244a1dddb509c3eca"
integrity sha512-6VTgIR4EBvowVmaJorDmHbCctlUa+gTTL5etlU+T+yaVEA1vAS3gaSwlhgQY1baEjc9PNKHkfHun6MO/gqq+RA==
dependencies:
"@babel/cli" "^7.5.5"
"@babel/core" "^7.5.5"