53 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-03-02 16:29:23 +01:00
/*
2015-10-08 15:34:07 +08:00
This file is part of web3.js.
2015-03-02 16:29:23 +01:00
2015-10-08 15:34:07 +08:00
web3.js is free software: you can redistribute it and/or modify
2015-03-02 16:29:23 +01:00
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
2015-10-08 15:34:07 +08:00
web3.js is distributed in the hope that it will be useful,
2015-03-02 16:29:23 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
2015-10-08 15:34:07 +08:00
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
2015-03-02 16:29:23 +01:00
*/
/** @file eth.js
* @authors:
* Marek Kotewicz <marek@ethdev.com>
* @date 2015
*/
2015-08-06 18:25:41 +02:00
var utils = require('../../utils/utils');
var Property = require('../property');
2015-03-02 16:29:23 +01:00
2015-10-07 04:32:32 +02:00
var Net = function (web3) {
2015-10-08 04:09:51 +02:00
this._requestManager = web3._requestManager;
var self = this;
properties().forEach(function(p) {
p.attachToObject(self);
p.setRequestManager(web3._requestManager);
});
2015-10-07 04:32:32 +02:00
};
2015-03-02 16:29:23 +01:00
/// @returns an array of objects describing web3.eth api properties
2015-10-08 04:09:51 +02:00
var properties = function () {
return [
new Property({
name: 'listening',
getter: 'net_listening'
}),
new Property({
name: 'peerCount',
getter: 'net_peerCount',
outputFormatter: utils.toDecimal
})
];
};
2015-03-02 16:29:23 +01:00
2015-10-07 04:32:32 +02:00
module.exports = Net;