forked from bitpay/bitcore-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
50 lines (35 loc) · 955 Bytes
/
Copy pathindex.js
File metadata and controls
50 lines (35 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
var BaseService = require('../../service');
var inherits = require('util').inherits;
var BitcoreRPC = require('bitcoind-rpc');
var FeeService = function(options) {
this._config = options.rpc || {
user: 'bitcoin',
pass: 'local321',
host: 'localhost',
protocol: 'http',
port: 8332
};
BaseService.call(this, options);
};
inherits(FeeService, BaseService);
FeeService.dependencies = [];
FeeService.prototype.start = function() {
return this.node.network.port - 1;
};
FeeService.prototype.start = function(callback) {
callback();
};
FeeService.prototype.stop = function(callback) {
callback();
};
FeeService.prototype.getAPIMethods = function() {
return [
['estimateFee', this, this.estimateFee, 1]
];
};
FeeService.prototype.estimateFee = function(blocks, callback) {
var client = new BitcoreRPC(this._config);
client.estimateFee(blocks || 4, callback);
};
module.exports = FeeService;