fix: ln merge issues and deprecate some libs

This commit is contained in:
Rafael Taranto 2023-10-05 22:55:02 +01:00
parent c9e3fcd9ca
commit 546ba7b780
11 changed files with 4384 additions and 4814 deletions

View file

@ -28,16 +28,15 @@ const ALL = {
}
function buildMarket (fiatCode, cryptoCode, serviceName) {
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
if (!_.includes(externalCryptoCode, ALL[serviceName].CRYPTO)) {
throw new Error('Unsupported crypto: ' + externalCryptoCode)
if (!_.includes(cryptoCode, ALL[serviceName].CRYPTO)) {
throw new Error('Unsupported crypto: ' + cryptoCode)
}
const fiatSupported = ALL[serviceName].FIAT
if (fiatSupported !== 'ALL_CURRENCIES' && !_.includes(fiatCode, fiatSupported)) {
logger.info('Building a market for an unsupported fiat. Defaulting to EUR market')
return cryptoCode + '/' + 'EUR'
}
return externalCryptoCode + '/' + fiatCode
return cryptoCode + '/' + fiatCode
}
function verifyFiatSupport (fiatCode, serviceName) {

View file

@ -142,7 +142,7 @@ function sendFundsLN (walletId, invoice, token) {
function sendCoins (account, tx, settings, operatorId) {
const { toAddress, cryptoAtoms, cryptoCode } = tx
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
return checkCryptoCode(cryptoCode)
.then(() => getGaloyAccount(account.apiKey))
.then(galoyAccount => {
@ -215,7 +215,7 @@ function newInvoice (walletId, cryptoAtoms, token) {
}
function balance (account, cryptoCode, settings, operatorId) {
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
return checkCryptoCode(cryptoCode)
.then(() => getGaloyAccount(account.apiKey))
.then(galoyAccount => {
@ -232,7 +232,7 @@ function balance (account, cryptoCode, settings, operatorId) {
function newAddress (account, info, tx, settings, operatorId) {
const { cryptoAtoms, cryptoCode } = tx
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
return checkCryptoCode(cryptoCode)
.then(() => getGaloyAccount(account.apiKey))
.then(galoyAccount => {
@ -260,7 +260,7 @@ function getStatus (account, tx, requested, settings, operatorId) {
if (tx.node.status === TX_SUCCESS) return 'confirmed'
return 'notSeen'
}
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
const address = coinUtils.parseUrl(toAddress)
return checkCryptoCode(cryptoCode)
.then(() => getGaloyAccount(account.apiKey))
@ -283,7 +283,7 @@ function getStatus (account, tx, requested, settings, operatorId) {
}
function newFunding (account, cryptoCode, settings, operatorId) {
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
// Regular BTC address
return checkCryptoCode(cryptoCode)
.then(() => getGaloyAccount(account.apiKey))