Repository navigation
feat: portfolio diversification, creator media kit, email broadcasts, passkey sign-in (#1474, #1475, #1476, #1477) - #1495
Open
Itodo-S wants to merge 4 commits into
Conversation
…ayerorg#1474) The portfolio page gets a DiversificationPanel with Correlation and Concentration tabs. - usePortfolioCorrelation(range, positions) fetches each held key's daily snapshots, builds daily returns from consecutive closing prices, and computes pairwise Pearson correlation over the days two keys share. Keys with fewer than 14 days of history are left out with a notice. - CorrelationMatrix renders a heatmap (symmetric, ones on the diagonal) and the same values as a screen-reader table; the heatmap is hidden from assistive technology. Pairs above 0.8 are outlined and listed with a suggestion to reduce the overlap. - The diversification score is 100 x (1 - HHI) x (1 - max(0, weighted average correlation)), with pair weights w_i x w_j, mapped to a plain-language label, so it moves with both holdings and weights. Concentration shows each key's share of the analysed value. Closes accesslayerorg#1474
- MediaKitPage at /creator/media-kit?key=<id>, linked from the creator dashboard and editable only by the key's creator wallet: handle, short bio, talking points, contact email, per-field visibility and a public toggle (off by default). - PublicPressPage at /k/:handle/press renders the 404 page unless the creator turned visibility on, and receives only the fields they enabled (hidden fields are dropped in the service, not just hidden). - useMediaKit(keyId) returns price, holders, 24h volume and key age with the last-updated time, using the same resolvers and formatters as the key page's stat row so the numbers match. - Canvas-generated PNG downloads: avatar at 128/256/512, a 1500x500 banner and a 1080x1080 card, falling back to initials when the avatar cannot be drawn. - Copy-ready text blocks and a QR code linking to /keys/:id. Media kits are stored through the shared local collection like the other creator tools, so a public page is only visible in the browser that saved it until a backend endpoint exists. Closes accesslayerorg#1475
- Holders opt in per held key under Settings > Notification preferences (off by default, needs an email address). - BroadcastComposer on the creator dashboard (key creator only): subject, message, minimum keys held, a live audience count before sending, an email preview with its unsubscribe footer, and send now or schedule. - useBroadcasts(keyId) follows the holders endpoint's cursor to count the audience, and exposes send, schedule, cancel and history. Scheduled broadcasts take their audience when they go out, so later opt-outs are respected. - Each key can send 4 broadcasts per calendar month (UTC); scheduled ones count against the month they go out in. A fifth is blocked with an explanation and the remaining allowance is shown. - Every email carries a per-subscription unsubscribe link and a List-Unsubscribe value; /unsubscribe/:token opts the holder out at once and counts it against that broadcast. - BroadcastHistory shows recipients, delivered, bounced and unsubscribed. Delivered and bounced stay "—" until a delivery report is recorded. Opt-ins and broadcasts are stored through the shared local collection like the other creator tools; sending real email and receiving delivery reports need a backend endpoint and an email provider. The NotificationPreferencesPage test now stubs the new opt-in section, which has its own tests and needs a QueryClient. Closes accesslayerorg#1476
…yerorg#1477) - SignInOptionsModal offers Connect wallet, Continue with passkey and Continue with email; it opens from the existing connect dialog. In browsers without WebAuthn (or outside a secure context) the passkey option is disabled and points to wallet connection. - usePasskeyAuth() runs WebAuthn registration and authentication against server-issued challenges and verifies through the embedded wallet service; useEmailSignIn() handles the one-time code flow. - SecurityNotice explains the custody trade-offs. Creating a wallet is blocked until it is acknowledged, both in the UI and in the hook, and the accepted notice version is sent to the server. - EmbeddedWalletAdapter implements Signer with server-assisted signing. Transactions moving more than VITE_EMBEDDED_REAUTH_THRESHOLD_XLM (default 100), or whose amount cannot be read from the XDR, need a fresh passkey assertion first. useSigner falls back to it when no browser wallet is installed. - Settings gets Export keys (after a passkey check; shown once, never stored) and Link self-custody wallet (signed challenge from Freighter) with steps for moving holdings. No wallet key material is created or stored in the browser; the client keeps only the public session (address, sign-in method). The server endpoints this calls are documented in embeddedWallet.service.ts and do not exist in accesslayer-server yet; the server must enforce the re-authentication threshold itself. Closes accesslayerorg#1477
|
@Itodo-S Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four issues, one commit each:
DiversificationPanelon/portfolio, with Correlation and Concentration tabs.usePortfolioCorrelation(range, positions)builds daily returns from each held key's snapshots (GET /keys/:id/snapshots).100 × (1 − HHI) × (1 − max(0, weighted avg ρ)), so it changes with both correlation and position weights. It is shown with a plain-language label.positionsas well asrange, because the page already values each holding; this is a deliberate deviation from the spec's(range)signature.MediaKitPageat/creator/media-kit?key=<id>, linked from the creator dashboard and editable only by the key's creator wallet./k/:handle/press. It renders the 404 page while visibility is off and receives only the fields the creator enabled.useMediaKit(keyId)returns price, holders, 24h volume and age, with the last-updated time. It uses the same resolvers and formatters as the key page, so the numbers match./keys/:id.BroadcastComposeris on the creator dashboard. Before sending it shows the audience size and an email preview; the audience is filtered by a minimum balance. Broadcasts can be sent now or scheduled.useBroadcasts(keyId)follows the holders endpoint's cursor to count the audience./unsubscribe/:tokentakes effect immediately, and scheduled broadcasts pick their audience at send time.BroadcastHistoryshows recipients, delivered, bounced and unsubscribed for each broadcast.SignInOptionsModaloffers Connect wallet / Continue with passkey / Continue with email. It opens from the existing connect dialog.usePasskeyAuth()runs WebAuthn against server-issued challenges.SecurityNoticemust be acknowledged before a wallet is created. This is enforced in the hook as well as the UI.EmbeddedWalletAdapterimplementsSignerwith server-assisted signing. It asks for a fresh passkey assertion when a transaction moves more thanVITE_EMBEDDED_REAUTH_THRESHOLD_XLM(default 100), or when the amount can't be read from the XDR.useSignerfalls back to the embedded wallet when no browser wallet is installed.Closes #1474
Closes #1475
Closes #1476
Closes #1477
What needs backend work (not verified here)
localCollection.service. Until server endpoints exist:recordDeliveryReport). They are not invented.src/services/embeddedWallet.service.ts(passkey register/login, email start/verify, reauth options, sign, export, link).403 REAUTH_REQUIRED); the client check only decides when to prompt.navigator.credentials.Testing
Compared against
devat 32f00b3 (the default branch):pnpm lint: same 7 problems asdev(2 errors, 5 warnings, all in files this PR doesn't touch), none new.pnpm build:vite buildsucceeds.tsc -p tsconfig.app.jsonhas the same 26 errors asdev(useBenchmarks, useScreener, ScreenerPage, …), none new.pnpm build(tsc -b && vite build) still fails exactly as it does ondev.vitest run: 402 failed / 4024 passed.devis 402 failed / 3934 passed, so there are 90 new tests and they all pass.devfails here.useSignerfallback, no-passkey guard.NotificationPreferencesPage.test.tsxnow stubs the new opt-in section, which has its own tests and needs a QueryClient that test does not set up.Checklist
.env.example:VITE_EMBEDDED_REAUTH_THRESHOLD_XLM)