several order types

This commit is contained in:
Daniel Lugo 2021-02-22 14:33:55 -04:00
parent 38bf829af1
commit 09f717b1a3

View file

@ -11,6 +11,7 @@ const {
Constants: { ErrorCode }, Constants: { ErrorCode },
Schema Schema
} = Common } = Common
const { assertNever } = require('assert-never')
const LightningServices = require('../../../../utils/lightningServices') const LightningServices = require('../../../../utils/lightningServices')
const { const {
@ -222,12 +223,23 @@ const listenerForAddr = (addr, SEA) => async (order, orderID) => {
const onData = invoice => { const onData = invoice => {
if (invoice.settled) { if (invoice.settled) {
writeCoordinate(invoice.r_hash.toString(), coord) writeCoordinate(invoice.r_hash.toString(), coord)
if (order.targetType === 'tip') { if (order.targetType === 'tip') {
getUser() getUser()
.get('postToTipCount') .get('postToTipCount')
// CAST: Checked above. // CAST: Checked above.
.get(/** @type {string} */ (order.ackInfo)) .get(/** @type {string} */ (order.ackInfo))
.set(null) // each item in the set is a tip .set(null) // each item in the set is a tip
} else if (order.targetType === 'contentReveal') {
// TODO
} else if (order.targetType === 'spontaneousPayment') {
// no action required
} else if (order.targetType === 'torrentSeed') {
// TODO
} else if (order.targetType === 'other') {
// TODO
} else {
assertNever(order.targetType)
} }
stream.off() stream.off()