aboutsummaryrefslogtreecommitdiffstats
path: root/lib/providermanager.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/providermanager.js')
-rw-r--r--lib/providermanager.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/providermanager.js b/lib/providermanager.js
index 25cd14288..38c0f6c46 100644
--- a/lib/providermanager.js
+++ b/lib/providermanager.js
@@ -43,18 +43,14 @@ var ProviderManager = function() {
var poll = function () {
if (self.provider) {
self.polls.forEach(function (data) {
- data.data._id = self.id;
- self.id++;
- var result = self.provider.send(data.data);
+ var result = self.send(data.data);
- result = JSON.parse(result);
-
// dont call the callback if result is not an array, or empty one
- if (result.error || !(result.result instanceof Array) || result.result.length === 0) {
+ if (!(result instanceof Array) || result.length === 0) {
return;
}
- data.callback(result.result);
+ data.callback(result);
});
}
setTimeout(poll, 1000);
@@ -63,10 +59,12 @@ var ProviderManager = function() {
};
/// sends outgoing requests
+/// @params data - an object with at least 'method' property
ProviderManager.prototype.send = function(data) {
- data.args = data.args || [];
- data._id = this.id++;
+ data.jsonrpc = '2.0';
+ data.params = data.params || [];
+ data.id = this.id++;
if (this.provider === undefined) {
console.error('provider is not set');