Commit d0d11063 authored by kenshin-samourai's avatar kenshin-samourai

replace request-promise-native by axios

parent f9780c55
......@@ -4,7 +4,7 @@
*/
'use strict'
const rp = require('request-promise-native')
const axios = require('axios')
const addrHelper = require('../bitcoin/addresses-helper')
const util = require('../util')
const Logger = require('../logger')
......@@ -34,15 +34,21 @@ class EsploraWrapper extends Wrapper {
const params = {
url: `${this.base}${route}`,
method: 'GET',
json: true,
timeout: 15000
responseType: 'json',
timeout: 15000,
headers: {
'User-Agent': 'Dojo'
}
}
// Sets socks proxy agent if required
if (keys.indexer.socks5Proxy != null)
params['agent'] = this.socksProxyAgent
if (keys.indexer.socks5Proxy != null) {
params['httpAgent'] = this.socksProxyAgent
params['httpsAgent'] = this.socksProxyAgent
}
return rp(params)
const result = await axios(params)
return result.data
}
/**
......
......@@ -4,7 +4,7 @@
*/
'use strict'
const rp = require('request-promise-native')
const axios = require('axios')
const Logger = require('../logger')
const network = require('../bitcoin/network')
const keys = require('../../keys')[network.key]
......@@ -32,7 +32,7 @@ class OxtWrapper extends Wrapper {
const params = {
url: `${this.base}${route}`,
method: 'GET',
json: true,
responseType: 'json',
timeout: 15000,
headers: {
'User-Agent': 'Dojo'
......@@ -40,10 +40,13 @@ class OxtWrapper extends Wrapper {
}
// Sets socks proxy agent if required
if (keys.indexer.socks5Proxy != null)
params['agent'] = this.socksProxyAgent
if (keys.indexer.socks5Proxy != null) {
params['httpAgent'] = this.socksProxyAgent
params['httpsAgent'] = this.socksProxyAgent
}
return rp(params)
const result = await axios(params)
return result.data
}
/**
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment