feat(encryptid): link claimed funds to rWallet with wallet address

After claiming funds, the success button now links to
{username}.rspace.online/rwallet?address={walletAddress} instead of
rflows.online, so users can visually analyze their wallet flows.

The accept endpoint now returns the username for URL construction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-06 23:10:53 -08:00
parent 8a4fc3051e
commit c2f9a07389
1 changed files with 6 additions and 1 deletions

View File

@ -2989,11 +2989,15 @@ app.post('/api/claims/:token/accept', async (c) => {
const accepted = await acceptFundClaim(token, claims.sub); const accepted = await acceptFundClaim(token, claims.sub);
if (!accepted) return c.json({ error: 'Failed to accept claim' }, 500); if (!accepted) return c.json({ error: 'Failed to accept claim' }, 500);
// Get username for redirect URL
const user = await getUserById(claims.sub);
return c.json({ return c.json({
success: true, success: true,
walletAddress: fundClaim.walletAddress, walletAddress: fundClaim.walletAddress,
amount: fundClaim.fiatAmount, amount: fundClaim.fiatAmount,
currency: fundClaim.fiatCurrency, currency: fundClaim.fiatCurrency,
username: user?.username || '',
}); });
}); });
@ -3185,12 +3189,13 @@ app.get('/claim', (c) => {
}); });
const result = await acceptRes.json(); const result = await acceptRes.json();
if (acceptRes.ok && result.success) { if (acceptRes.ok && result.success) {
var walletUrl = 'https://' + (result.username || 'demo') + '.rspace.online/rwallet?address=' + encodeURIComponent(result.walletAddress);
document.getElementById('claim-info').innerHTML = document.getElementById('claim-info').innerHTML =
'<div class="success-card">' + '<div class="success-card">' +
'<p class="success" style="font-size:18px;font-weight:600">&#x2705; Funds Claimed!</p>' + '<p class="success" style="font-size:18px;font-weight:600">&#x2705; Funds Claimed!</p>' +
'<p style="color:#e2e8f0;margin-top:12px">Wallet <code style="background:rgba(255,255,255,0.1);padding:2px 6px;border-radius:4px">' + result.walletAddress.slice(0, 6) + '...' + result.walletAddress.slice(-4) + '</code> has been linked to your EncryptID account.</p>' + '<p style="color:#e2e8f0;margin-top:12px">Wallet <code style="background:rgba(255,255,255,0.1);padding:2px 6px;border-radius:4px">' + result.walletAddress.slice(0, 6) + '...' + result.walletAddress.slice(-4) + '</code> has been linked to your EncryptID account.</p>' +
(result.amount ? '<p style="color:#94a3b8;margin-top:8px">$' + result.amount + ' ' + (result.currency || 'USD') + ' are now accessible.</p>' : '') + (result.amount ? '<p style="color:#94a3b8;margin-top:8px">$' + result.amount + ' ' + (result.currency || 'USD') + ' are now accessible.</p>' : '') +
'<a class="btn" href="https://rflows.online" style="margin-top:20px">Go to rFlows</a>' + '<a class="btn" href="' + walletUrl + '" style="margin-top:20px">View in rWallet</a>' +
'</div>'; '</div>';
} else { } else {
document.getElementById('status').innerHTML = '<p class="error">' + (result.error || 'Claim failed') + '</p>'; document.getElementById('status').innerHTML = '<p class="error">' + (result.error || 'Claim failed') + '</p>';