UNPKG

1.4 kBTypeScriptView Raw
1/*
2 This file is part of confluxWeb.
3 confluxWeb is free software: you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as published by
5 the Free Software Foundation, either version 3 of the License, or
6 (at your option) any later version.
7 confluxWeb is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU Lesser General Public License for more details.
11 You should have received a copy of the GNU Lesser General Public License
12 along with confluxWeb. If not, see <http://www.gnu.org/licenses/>.
13*/
14import {provider} from 'conflux-web-providers';
15import {AbstractConfluxWebModule, ConfluxWebModuleOptions} from 'conflux-web-core';
16import * as net from 'net';
17
18export class Network extends AbstractConfluxWebModule {
19 constructor(
20 provider: provider,
21 net?: net.Socket|null,
22 options?: ConfluxWebModuleOptions
23 );
24
25 getNetworkType(callback?: (error: Error, returnValue: string) => void): Promise<string>;
26
27 getId(callback?: (error: Error, id: number) => void): Promise<number>;
28
29 isListening(callback?: (error: Error, listening: boolean) => void): Promise<boolean>;
30
31 getPeerCount(callback?: (error: Error, peerCount: number) => void): Promise<number>;
32}