fix(zapController): get kind 0 with store.query

This commit is contained in:
P. Reis 2024-06-04 16:44:08 -03:00
parent 739fea0890
commit 50e7213954
1 changed files with 2 additions and 1 deletions

View File

@ -471,6 +471,7 @@ const zapController: AppController = async (c) => {
const body = await parseBody(c.req.raw);
const result = zapSchema.safeParse(body);
const { signal } = c.req.raw;
const store = c.get('store');
if (!result.success) {
return c.json({ error: 'Bad request', schema: result.error }, 400);
@ -497,7 +498,7 @@ const zapController: AppController = async (c) => {
);
}
} else {
target = await getEvent(account_id, { kind: 0, signal });
[target] = await store.query([{ authors: [account_id], kinds: [0], limit: 1 }]);
const meta = n.json().pipe(n.metadata()).catch({}).parse(target?.content);
lnurl = getLnurl(meta);
if (target && lnurl) {