tendermint
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -12,6 +12,3 @@ 'use strict'; | ||
var EventEmitter = require('events'); | ||
var _require = require('request'), | ||
get = _require.get; | ||
var axios = require('axios'); | ||
var url = require('url'); | ||
@@ -79,3 +76,3 @@ var old = require('old'); | ||
if (!data.id) return; | ||
_this2.emit(data.id, data.error ? Error(data.error) : null, data.result); | ||
_this2.emit(data.id, data.error, data.result); | ||
}); | ||
@@ -86,14 +83,12 @@ } | ||
value: function callHttp(method, args, cb) { | ||
get({ | ||
uri: this.uri + method, | ||
qs: convertArgs(args), | ||
json: true | ||
}, function (err, res, data) { | ||
if (err) return cb(err); | ||
if (res.statusCode !== 200) { | ||
var _err = 'Server responded with status code ' + res.statusCode; | ||
return cb(Error(_err)); | ||
} | ||
if (data.error) return cb(Error(data.error)); | ||
cb(null, data.result); | ||
axios({ | ||
url: this.uri + method, | ||
params: args | ||
}).then(function (_ref) { | ||
var data = _ref.data; | ||
if (data.error) return cb(data.error); | ||
cb(null, data); | ||
}, function (err) { | ||
return cb(Error(err)); | ||
}); | ||
@@ -108,2 +103,3 @@ } | ||
this.on(id + '#event', cb); | ||
this.once(id, cb); // errors won't have "#event" | ||
} else { | ||
@@ -110,0 +106,0 @@ this.once(id, cb); |
{ | ||
"name": "tendermint", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "A light client which talks to your Tendermint node over RPC", | ||
@@ -14,2 +14,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"axios": "^0.17.1", | ||
"browser-request": "^0.3.3", | ||
@@ -16,0 +17,0 @@ "camelcase": "^4.0.0", |
'use strict' | ||
const EventEmitter = require('events') | ||
const { get } = require('request') | ||
const axios = require('axios') | ||
const url = require('url') | ||
@@ -54,3 +54,3 @@ const old = require('old') | ||
if (!data.id) return | ||
this.emit(data.id, data.error ? Error(data.error) : null, data.result) | ||
this.emit(data.id, data.error, data.result) | ||
}) | ||
@@ -60,14 +60,10 @@ } | ||
callHttp (method, args, cb) { | ||
get({ | ||
uri: this.uri + method, | ||
qs: convertArgs(args), | ||
json: true | ||
}, (err, res, data) => { | ||
if (err) return cb(err) | ||
if (res.statusCode !== 200) { | ||
let err = `Server responded with status code ${res.statusCode}` | ||
return cb(Error(err)) | ||
} | ||
if (data.error) return cb(Error(data.error)) | ||
cb(null, data.result) | ||
axios({ | ||
url: this.uri + method, | ||
params: args | ||
}).then(({data}) => { | ||
if (data.error) return cb(data.error) | ||
cb(null, data) | ||
}, (err) => { | ||
return cb(Error(err)) | ||
}) | ||
@@ -81,2 +77,3 @@ } | ||
this.on(id + '#event', cb) | ||
this.once(id, cb) // errors won't have "#event" | ||
} else { | ||
@@ -83,0 +80,0 @@ this.once(id, cb) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75170
8
8
242
+ Addedaxios@^0.17.1
+ Addedaxios@0.17.1(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedis-buffer@1.1.6(transitive)