Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System logger for users #2035

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

System logger for users #2035

wants to merge 1 commit into from

Conversation

ekzyis
Copy link
Member

@ekzyis ekzyis commented Mar 27, 2025

Description

We currently can only create wallet logs linked to a specific wallet. This means that if we have a user id but no wallet yet, we can't create a log message.

This PR fixes that by dropping the NOT NULL constraint on the WalletLog.wallet column and by defaulting to "system" for the wallet name in /wallet/logs if we didn't pass in a wallet to the logger call.

Checklist

Are your changes backwards compatible? Please answer below:

yes, old logs will continue to work.

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:

7. Tested successful p2p zaps with anon as sender, receiver fallbacks, fallback from proxy to direct and ofc generating and paying invoices via lightning address.

For frontend changes: Tested on mobile, light and dark mode? Please answer below:

n/a

Did you introduce any new environment variables? If so, call them out explicitly here:

no

@ekzyis ekzyis marked this pull request as draft March 27, 2025 19:22
@ekzyis ekzyis force-pushed the system-logger branch 2 times, most recently from 385cf48 to 0514f91 Compare March 27, 2025 20:41
@ekzyis ekzyis marked this pull request as ready for review March 27, 2025 23:00

export default async ({ query: { username, amount, nostr, comment, payerdata: payerData }, headers }, res) => {
const user = await models.user.findUnique({ where: { name: username } })
if (!user) {
return res.status(400).json({ status: 'ERROR', reason: `user @${username} does not exist` })
}

const logger = walletLogger({ models, me: user })
logger.info('LNURL-pay callback', { amount: formatMsats(amount), nostr, comment })
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"LNURL-pay" might still be confusing but it's better than "lnurlp" imo.

Most stackers are probably the most familiar with the concept of a lightning address, but not sure how to mention that here.

@ekzyis ekzyis requested a review from huumn March 27, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant