This commit is contained in:
Josh Harvey 2016-11-27 03:18:06 +02:00
parent b16d11045c
commit 966440e074
3 changed files with 13 additions and 9 deletions

View file

@ -106,16 +106,20 @@ exports.trade = function trade (deviceId, rawTrade) {
// TODO: move this to DB, too
// add bill to trader queue (if trader is enabled)
const cryptoCode = rawTrade.cryptoCode
const fiatCode = rawTrade.fiatCode
const cryptoAtoms = rawTrade.cryptoAtoms
return db.recordBill(deviceId, rawTrade)
.then(() => exchange.active(cryptoCode))
.then(active => {
if (!active) return
logger.debug('[%s] Pushing trade: %d', cryptoCode, rawTrade.cryptoAtoms)
tradesQueues[cryptoCode].push({
currency: rawTrade.currency,
cryptoAtoms: rawTrade.cryptoAtoms,
const market = [fiatCode, cryptoCode].join('')
logger.debug('[%s] Pushing trade: %d', market, cryptoAtoms)
tradesQueues[market].push({
fiatCode,
cryptoAtoms,
cryptoCode,
timestamp: Date.now()
})

View file

@ -44,7 +44,7 @@ exports.recordBill = function recordBill (deviceId, rec) {
const values = [
rec.uuid,
deviceId,
rec.currency,
rec.fiatCode,
rec.cryptoCode,
rec.toAddress,
rec.txId,
@ -83,7 +83,7 @@ exports.addOutgoingTx = function addOutgoingTx (deviceId, tx) {
tx.toAddress,
tx.cryptoAtoms.toString(),
tx.cryptoCode,
tx.currencyCode,
tx.fiatCode,
tx.fiat,
tx.txHash,
null,
@ -111,7 +111,7 @@ exports.addInitialIncoming = function addInitialIncoming (deviceId, tx) {
tx.toAddress,
tx.cryptoAtoms.toString(),
tx.cryptoCode,
tx.currencyCode,
tx.fiatCode,
tx.fiat,
tx.txHash,
tx.phone,
@ -170,7 +170,7 @@ exports.addIncomingPhone = function addIncomingPhone (tx, notified) {
function normalizeTx (tx) {
tx.toAddress = tx.to_address
tx.currencyCode = tx.currency_code
tx.fiatCode = tx.currency_code
tx.txHash = tx.tx_hash
tx.cryptoCode = tx.crypto_code
tx.cryptoAtoms = new BigNumber(tx.crypto_atoms)

View file

@ -84,7 +84,7 @@ function poll (req, res) {
const langs = config.languages.machineLanguages
const locale = {
currency: config.currencies.fiatCurrency,
fiatCode: config.currencies.fiatCode,
localeInfo: {
primaryLocale: langs[0],
primaryLocales: langs