feat: decouple l-s entrypoint

This commit is contained in:
Sérgio Salgado 2022-03-29 15:00:52 +01:00
parent 2a2c1fccc8
commit f4d6b5e454
48 changed files with 411 additions and 232 deletions

View file

@ -4,11 +4,11 @@ const E = require('../../../error')
const _ = require('lodash/fp')
const ENV = process.env.NODE_ENV === undefined || process.env.NODE_ENV === 'development' ? 'development' : 'production'
const SUPPORTED_COINS = ['BTC', 'ZEC', 'LTC', 'BCH', 'DASH', 'ETH']
const SUPPORTED_COINS = ['BTC']
const axios = require('axios').create({
// TODO: get rejectUnauthorized true to work
baseURL: ENV === 'development' ? 'https://localhost:5555/api/' : process.env.PAZUZ_API_WALLET_URL,
baseURL: `${process.env.WALLET_URL}/api`,
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
@ -22,9 +22,8 @@ function balance (account, cryptoCode, settings, operatorId) {
return checkCryptoCode(cryptoCode)
.then(() => {
return axios.post('/balance', {
account,
cryptoCode,
settings,
config: settings.config,
operatorId
})
})
@ -39,9 +38,8 @@ function sendCoins (account, tx, settings, operatorId) {
return checkCryptoCode(cryptoCode)
.then(() => {
return axios.post('/sendCoins', {
account,
tx,
settings,
config: settings.config,
operatorId
})
})
@ -57,10 +55,9 @@ function sendCoins (account, tx, settings, operatorId) {
function newAddress (account, info, tx, settings, operatorId) {
return checkCryptoCode(info.cryptoCode)
.then(() => axios.post('/newAddress', {
account,
info,
tx,
settings,
config: settings.config,
operatorId
}))
.then(({ data }) => {