log invoice creation error

This commit is contained in:
keyan 2021-06-09 15:07:32 -05:00
parent 5e822d8499
commit 10b2c85db1

View File

@ -62,26 +62,31 @@ export default {
// set expires at to 3 hours into future // set expires at to 3 hours into future
const expiresAt = new Date(new Date().setHours(new Date().getHours() + 3)) const expiresAt = new Date(new Date().setHours(new Date().getHours() + 3))
const description = `${amount} sats for @${me.name} on stacker.news` const description = `${amount} sats for @${me.name} on stacker.news`
const invoice = await createInvoice({ try {
description, const invoice = await createInvoice({
lnd, description,
tokens: amount, lnd,
expires_at: expiresAt tokens: amount,
}) expires_at: expiresAt
})
const data = { const data = {
hash: invoice.id, hash: invoice.id,
bolt11: invoice.request, bolt11: invoice.request,
expiresAt: expiresAt, expiresAt: expiresAt,
msatsRequested: amount * 1000, msatsRequested: amount * 1000,
user: { user: {
connect: { connect: {
name: me.name name: me.name
}
} }
} }
}
return await models.invoice.create({ data }) return await models.invoice.create({ data })
} catch (error) {
console.log(error)
throw error
}
}, },
createWithdrawl: async (parent, { invoice, maxFee }, { me, models, lnd }) => { createWithdrawl: async (parent, { invoice, maxFee }, { me, models, lnd }) => {
if (!me) { if (!me) {