fix qr withdrawal

This commit is contained in:
keyan 2023-12-15 18:13:24 -06:00
parent 0fe1d45c8f
commit d3fac7f968
2 changed files with 9 additions and 5 deletions

View File

@ -436,11 +436,9 @@ export default {
}
}
async function createWithdrawal (parent, { invoice, maxFee }, { me, models, lnd, headers }) {
async function createWithdrawal (parent, { invoice, maxFee }, { me, models, lnd }) {
await ssValidate(withdrawlSchema, { invoice, maxFee })
await assertGofacYourself({ models, headers })
// remove 'lightning:' prefix if present
invoice = invoice.replace(/^lightning:/, '')

View File

@ -1,17 +1,23 @@
// verify k1 exists
// send back
import models from '../../api/models'
import assertGofacYourself from '../../api/resolvers/ofac'
import getSSRApolloClient from '../../api/ssrApollo'
import { CREATE_WITHDRAWL } from '../../fragments/wallet'
import { datePivot } from '../../lib/time'
export default async ({ query }, res) => {
export default async ({ query, headers }, res) => {
if (!query.k1) {
return res.status(400).json({ status: 'ERROR', reason: 'k1 not provided' })
}
if (query.pr) {
return doWithdrawal(query, res)
try {
await assertGofacYourself({ models, headers })
return doWithdrawal(query, res)
} catch (e) {
return res.status(400).json({ status: 'ERROR', reason: e.message })
}
}
let reason