v12.0.0 - initial commit
This commit is contained in:
commit
e2c49ea43c
1145 changed files with 97211 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
const https = require('https')
|
||||
const axios = require('axios').create({
|
||||
// TODO: get rejectUnauthorized true to work
|
||||
baseURL: `${process.env.TICKER_URL}/api/rates/`,
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
}),
|
||||
})
|
||||
|
||||
const BN = require('../../../bn')
|
||||
|
||||
function ticker(account, fiatCode, cryptoCode) {
|
||||
return axios.get(`${cryptoCode}/${fiatCode}`).then(({ data }) => {
|
||||
if (data.error) throw new Error(JSON.stringify(data.error))
|
||||
return {
|
||||
rates: {
|
||||
ask: BN(data.ask),
|
||||
bid: BN(data.bid),
|
||||
signature: data.signature,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ticker,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue