UNPKG

@parity/light.js

Version:

A high-level reactive JS library optimized for light clients

27 lines (26 loc) 880 B
"use strict"; // Copyright 2015-2019 Parity Technologies (UK) Ltd. // This file is part of Parity. // // SPDX-License-Identifier: MIT Object.defineProperty(exports, "__esModule", { value: true }); var createRpc_1 = require("./utils/createRpc"); var frequency_1 = require("../frequency"); var operators_1 = require("../utils/operators"); /** * Get the amount of peers. * * Calls `net_peerCount` * * @param options - Options to pass to {@link RpcObservableOptions}. * @return - An Observable containing the number. */ function peerCount$(options) { return createRpc_1.default({ calls: ['net_peerCount'], frequency: [frequency_1.default.onEvery5Seconds$], name: 'peerCount$', pipes: function (api) { return [operators_1.switchMapPromise(function () { return api.net.peerCount(); })]; } })(options)(); } exports.peerCount$ = peerCount$;