WIP
This commit is contained in:
parent
dde57dfba1
commit
44b46bd5ee
2 changed files with 13 additions and 10 deletions
|
|
@ -81,15 +81,17 @@ exports.recordDeviceEvent = function recordDeviceEvent (session, event) {
|
|||
return db.none(sql, values)
|
||||
}
|
||||
|
||||
exports.addOutgoingTx = function addOutgoingTx (session, tx) {
|
||||
// NOTE: This will fail if we have already sent coins because there will be
|
||||
// a unique cash_in_txs record in the table already keyed by sessionId.
|
||||
exports.addOutgoingTx = function addOutgoingTx (fingerprint, tx) {
|
||||
const fields = ['session_id', 'device_fingerprint', 'to_address',
|
||||
'crypto_atoms', 'crypto_code', 'currency_code', 'fiat', 'tx_hash',
|
||||
'fee', 'phone', 'error'
|
||||
]
|
||||
|
||||
const values = [
|
||||
session.id,
|
||||
session.fingerprint,
|
||||
tx.sessionId,
|
||||
fingerprint,
|
||||
tx.toAddress,
|
||||
tx.cryptoAtoms.toString(),
|
||||
tx.cryptoCode,
|
||||
|
|
@ -104,9 +106,9 @@ exports.addOutgoingTx = function addOutgoingTx (session, tx) {
|
|||
return db.none(getInsertQuery('cash_in_txs', fields), values)
|
||||
}
|
||||
|
||||
exports.sentCoins = function sentCoins (session, tx, toSend, fee, error, txHash) {
|
||||
exports.sentCoins = function sentCoins (tx, toSend, fee, error, txHash) {
|
||||
const sql = `update cash_in_txs set tx_hash=$1, error=$2 where session_id=$3`
|
||||
return db.none(sql, [txHash, error, session.id])
|
||||
return db.none(sql, [txHash, error, tx.sessionId])
|
||||
}
|
||||
|
||||
exports.addInitialIncoming = function addInitialIncoming (session, tx) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue