Skip to content

Conversation

@shroominic
Copy link
Contributor

Implement automatic crediting of Cashu tokens from ?topup URL parameters to support pre-filled topup links for new and existing users (fixes #90).


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Oct 16, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@cloudflare-workers-and-pages
Copy link

Deploying routstr-chat with  Cloudflare Pages  Cloudflare Pages

Latest commit: 03952eb
Status: ✅  Deploy successful!
Preview URL: https://98a5697f.routstr-chat.pages.dev
Branch Preview URL: https://cursor-process-prefilled-cas.routstr-chat.pages.dev

View logs

@shroominic shroominic marked this pull request as ready for review October 16, 2025 08:36
if (!topupFromUrl) return;
try {
localStorage.setItem('prefilled_topup_token', topupFromUrl);
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we log the error instead of silently catching?

let token: string | null = null;
try {
token = localStorage.getItem('prefilled_topup_token');
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we log the error instead of silently catching?

if (!token) return;

processingTopupRef.current = true;
(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Without awaiting here, errors may not surface properly.

await receiveToken(token as string);
try { localStorage.removeItem('prefilled_topup_token'); } catch {}
} catch (err) {
console.error('Failed to process prefilled topup token:', err);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should provide user feedback when token processing fails, not just console.error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement user onboarding with cashu token in query parameters

4 participants