import { Connector } from '../../connectors/Connector' ; import { AddrInfo , Connectedness , NatInfo , PeerID , PubsubScore } from '../Types' ; export class JsonRpcNetMethodGroup { private conn : Connector ; constructor ( conn ) { this . conn = conn ; } public async connectedness ( peerId ) { const connectedness = await this . conn . request ( { method : 'Filecoin.NetConnectedness' , params : [ peerId ] } ) ; return connectedness ; } public async peers ( ) { const peers = await this . conn . request ( { method : 'Filecoin.NetPeers' } ) ; return peers ; } public async connect ( addrInfo ) { const result = await this . conn . request ( { method : 'Filecoin.NetConnect' , params : [ addrInfo ] } ) ; return result ; } public async addrsListen ( ) { const addr = await this . conn . request ( { method : 'Filecoin.NetAddrsListen' } ) ; return addr ; } public async disconnect ( peerID ) { await this . conn . request ( { method : 'Filecoin.NetDisconnect' , params : [ peerID ] } ) ; } public async findPeer ( peerID ) { const peer = await this . conn . request ( { method : 'Filecoin.NetFindPeer' , params : [ peerID ] } ) ; return peer ; } public async pubsubScores ( ) { const score = await this . conn . request ( { method : 'Filecoin.NetPubsubScores' } ) ; return score ; } public async autoNatStatus ( ) { const natInfo = await this . conn . request ( { method : 'Filecoin.NetAutoNatStatus' } ) ; return natInfo ; } }