Add transaction versioning, tx cancellation (#79)

This commit is contained in:
Josh Harvey 2017-08-29 16:08:06 +03:00 committed by GitHub
parent 4a97535dec
commit 500edcf279
15 changed files with 2223 additions and 1468 deletions

View file

@ -184,7 +184,7 @@ function plugins (settings, deviceId) {
cryptoCode,
display: cryptoRec.display,
minimumTx: BN.max(minimumTx, cashInFee),
cashInFee: cashInFee,
cashInFee,
cryptoNetwork
}
}
@ -216,8 +216,6 @@ function plugins (settings, deviceId) {
const testNets = arr.slice(2 * cryptoCodesCount + 3)
const coinParams = _.zip(cryptoCodes, testNets)
console.log('DEBUG200: %j', cryptoCodes)
console.log('DEBUG201: %j', coinParams)
return {
cassettes,
rates: buildRates(tickers),
@ -351,7 +349,6 @@ function plugins (settings, deviceId) {
const market = [fiatCode, cryptoCode].join('')
console.log('DEBUG505')
if (!exchange.active(settings, cryptoCode)) return
logger.debug('[%s] Pushing trade: %d', market, cryptoAtoms)
@ -368,7 +365,6 @@ function plugins (settings, deviceId) {
const market = [fiatCode, cryptoCode].join('')
const marketTradesQueues = tradesQueues[market]
console.log('DEBUG504: %j', marketTradesQueues)
if (!marketTradesQueues || marketTradesQueues.length === 0) return null
logger.debug('[%s] tradesQueues size: %d', market, marketTradesQueues.length)
@ -409,7 +405,6 @@ function plugins (settings, deviceId) {
}
function executeTrades () {
console.log('DEBUG500')
return machineLoader.getMachines()
.then(devices => {
const deviceIds = devices.map(device => device.deviceId)
@ -430,7 +425,6 @@ function plugins (settings, deviceId) {
}
function executeTradesForMarket (settings, fiatCode, cryptoCode) {
console.log('DEBUG501: %s, %j', cryptoCode, exchange.active(settings, cryptoCode))
if (!exchange.active(settings, cryptoCode)) return
const market = [fiatCode, cryptoCode].join('')
@ -438,8 +432,6 @@ function plugins (settings, deviceId) {
if (tradeEntry === null || tradeEntry.cryptoAtoms.eq(0)) return
console.log('DEBUG502')
return executeTradeForType(tradeEntry)
.catch(err => {
tradesQueues[market].push(tradeEntry)
@ -457,8 +449,6 @@ function plugins (settings, deviceId) {
const tradeEntry = expand(_tradeEntry)
const execute = tradeEntry.type === 'buy' ? exchange.buy : exchange.sell
console.log('DEBUG503')
return execute(settings, tradeEntry.cryptoAtoms, tradeEntry.fiatCode, tradeEntry.cryptoCode)
.then(() => recordTrade(tradeEntry))
}