diff --git a/docs/ALERTS.md b/docs/ALERTS.md index c097d46..9e7a4ed 100644 --- a/docs/ALERTS.md +++ b/docs/ALERTS.md @@ -1,6 +1,6 @@ # Buffer threshold monitoring -Updated September 20, 2026. This runbook separates local rehearsal, hosted dry runs, and configured Discord sending. The current evidence and outstanding gates are in [the integration matrix](BUFFER-INTEGRATION-STATUS.md). +Updated October 1, 2026. This runbook separates local rehearsal, hosted dry runs, and configured Discord or signed-webhook sending. The current evidence and outstanding gates are in [the integration matrix](BUFFER-INTEGRATION-STATUS.md). Buffer checks **observed Velocity cross-margin maintenance headroom in USD**, or, since 28 September 2026, the **unsigned distance in percent from the current oracle to one position's estimated liquidation price** (model `cross-margin-hold-others-v1`, see [WEBHOOK-ALERTS.md](WEBHOOK-ALERTS.md)). It never alerts on the price slider. A rule binds an authenticated cloud owner, Solana authority/subaccount, provider/network, metric (and market for liquidation distance), exact threshold and direction, cadence, timezone, cooldown, hysteresis, destination reference (Discord or signed webhook), enabled state, and version. Watching a public address does not prove ownership or require signing. @@ -23,7 +23,7 @@ The additive migration `20260920020000_hosted_monitoring.sql` extends the existi - Cadence, cooldown and hysteresis survive unavailable observations and restarts. Pausing, deleting or changing a rule version invalidates pending work. History is retained; a remotely accepted message cannot be recalled. - The scheduler is bounded server work, not a browser timer. A heartbeat expires after 180 seconds, including on a page left open. UI separates attempted check, last fresh observation, next check, provider acceptance and matching receipt. -## Exactly one outbound provider: Discord +## Outbound destinations: Discord and signed webhooks See [the Discord contract and setup](DISCORD-ALERTS.md) for exact configuration, official API references, quotas and sanitized preview. `BUFFER_DISCORD_DESTINATIONS_JSON` contains platform-admin destination references and an explicit allowed-owner list. Tokens stay in server environment variables. Users cannot paste arbitrary fetch URLs. Metadata GET verifies the configured channel; webhook calls use a fixed Discord HTTPS origin/path with redirects rejected. @@ -33,6 +33,8 @@ States are `queued`, `sending`, `accepted_by_provider`, `delivered`, `failed`, ` Discord webhook POST has no documented idempotency key. An ambiguous POST or an expired in-flight send becomes `unknown_outcome`; it is never blindly resent. If the message ID was durably recorded, the worker can reconcile it by GET without another POST. Retries are bounded and safe rate-limit responses respect validated Retry-After with jitter. Permanent credential/destination failures require intervention. No database outbox promises exactly-once external delivery. +Signed webhooks use server-only `BUFFER_WEBHOOK_DESTINATIONS_JSON`, explicit owner allowlists, and HMAC authentication. Their verification confirms configuration policy; it does not contact the receiver. A receiver's successful HTTP response establishes delivery acknowledgement, without Discord's separate message read-back. See [the webhook contract](WEBHOOK-ALERTS.md) for configuration, receipt semantics, retry limits, and rotation. Neither destination is configured by pasting an arbitrary URL into the app. + ## Local rehearsal command Use Node 24 and the existing npm lockfile: @@ -50,8 +52,8 @@ SQLite `.local/alerts.sqlite` uses WAL, full synchronization and transactional r 1. Apply the reviewed additive migration and verify RLS/function privileges. Use the existing Buffer Supabase project; do not create another project or replace its report tables. 2. Generate distinct random worker and cron credentials. Store the worker hash in the private credential row, and put the actual values in server-only Vercel variables. Configure `BUFFER_ALERT_SEND_ENABLED=false` and `BUFFER_ALERT_NOTIFICATION_MODE=test` initially. Deploy before activating the scheduler. 3. Use Supabase Pro `pg_cron` + pinned synchronous `http` 1.6 HEAD to invoke the fixed production worker once per minute. Keep the cron credential in Supabase Vault. [Deployment](DEPLOYMENT.md) records the activation/rollback procedure. Check actual cron result and persisted heartbeat; environment variables alone do not prove execution. -4. Configure exactly one Discord destination for the intended confirmed Supabase owner. Verify its metadata; prepare the exact redacted message and destination. Obtain recipient-send authorization before turning on sends. Existing signup/recovery email stays disabled independently. -5. Save an authorized test threshold around a real current observation. Confirm event ID, rule version, source slot/time, provider message ID and matching channel receipt. Retain redacted evidence, then pause/delete the test rule. Do not call this step verified until a real receipt exists. +4. Configure a reviewed Discord or signed-webhook destination for the intended confirmed Supabase owner. Verify the destination according to its provider contract; prepare the exact redacted message and destination. Obtain recipient-send authorization before turning on sends. Existing signup/recovery email stays disabled independently. +5. Save an authorized test threshold around a real current observation. Confirm event ID, rule version, source slot/time, and the destination-specific delivery receipt. Retain redacted evidence, then pause/delete the test rule. Do not call this step verified until a real receipt exists. To pause: disable the scheduler job and set sending false. To rotate: first disable sends, rotate the webhook/token and configuration fingerprint, reverify the channel, invalidate old pending work, redeploy, then reenable only after authorization. Never reuse unknown-outcome events as fresh sends. Inspect unavailable reasons, heartbeat age and outbox state; do not erase a damaged journal to make the UI green. Rollback leaves the additive schema/RLS in place, disables the job and sending, and promotes the previous known-good application. @@ -59,5 +61,7 @@ To pause: disable the scheduler job and set sending false. To rotate: first disa Unit suites cover exact threshold semantics, provider contracts, response bounds, invalid inputs, owner/session changes, immutable report semantics and crash outcomes. PGlite scripts exercise actual migrations, RLS, two-owner denial, uniqueness and fenced transitions. Real-process SQLite tests exercise independent concurrent runners and crash rollback. Browser tests intercept auth/provider/monitoring transport and explicitly check fixture/live separation, accepted-versus-receipt UI, unknown outcomes, expired heartbeat, unavailable storage and sign-out. These deterministic tests never send to Discord. Hosted scheduler execution and actual recipient delivery have separate evidence gates. +On October 1, 2026 at 06:23 UTC, the production database showed 30 successful scheduled cron runs and 30 completed protected worker runs in the preceding 30 minutes. The worker remained in `dry_run` mode. This verifies execution of the scheduler, not outbound delivery. + The narrow worker processes at most one work item per minute; configured cadence is a minimum interval, not a guaranteed maximum notification delay under backlog. Limits are 20 rules per owner, 100 events per owner per day, 10 send attempts per owner per hour, 3 send attempts and 5 receipt lookups per event. Stale queued events are suppressed after 120seconds rather than dispatched after an outage. Completed/suppressed unreferenced history is pruned after 30 days in bounded batches; unresolved outcomes remain available for investigation. Fresh deliveries take precedence over receipt retries so a slow receipt cannot expire another event's send window. diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index e024f49..3c0df97 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -1,6 +1,6 @@ # Deployment and cloud configuration -**Last updated:** September 20, 2026. Production deployment is now authorized. The reviewed alert hardening and function-permission migrations have been applied; see [the release record](RELEASE-2026-09-20.md) for the final deployment and verification result. +**Last updated:** October 1, 2026. The reviewed alert hardening, function-permission and liquidation-sentinel migrations have been applied. [The September 20 release record](RELEASE-2026-09-20.md) documents the initial hosted-monitoring activation; later verification is described below. Buffer runs on Node 24 with Next.js App Router. `/` is the public website, `/app` is the public explorer with live Velocity as the default, modeled Pacifica reads, and inventory-only Jupiter Perps, and `/auth` contains optional email/password sign-in. The protocol selector also exposes the explicitly paused legacy Drift reader. Scenario functionality, live public reads, device-local reports, and downloads work without a cloud account. @@ -27,6 +27,8 @@ The default live provider is the official `@velocity-exchange/sdk` **0.23.1**, b The server-side RPC endpoint used by Velocity, Jupiter, and legacy Drift must be Solana **mainnet-beta**. Those providers reject a different genesis hash, check program ownership and account identity, and never substitute a sample when a live read fails. Requests have an 18-second abort deadline; Vercel functions need at least 30 seconds. Each process allows 60 reads per minute and four concurrent reads. The live-read route also applies the configured distributed limit when available; see `src/server/rate-limit.ts` and the environment template for its current readiness. A dedicated RPC is still needed for sustained provider capacity. Pacifica uses its fixed HTTPS API boundary and its own timestamp freshness rule. +Buffer's connection to mainnet is read-only. The wallet button requests a public address through Wallet Standard; providers cannot sign, submit or settle transactions. “Settlement” in provider metadata describes the venue's accounting asset, not an execution feature in Buffer. + ## Supabase Create or use the dedicated Buffer project **`vhbngdatlowfnwaymvuq`** in **operatoruplift's Org**. Apply all files in `supabase/migrations/` in timestamp order through the Supabase migration workflow. They create `saved_reports`, the user/date index, authenticated select/insert/delete grants, owner-only row-level security, and strict report/title constraints, plus the additive owner-scoped alert pipeline tables (`alert_rules`, `alert_events`, and `alert_outbox`). Anonymous users have no table privileges. Reports are immutable historical JSON records with a maximum size of 256 KiB and are never inputs to the live reader. @@ -44,7 +46,7 @@ The browser SDK manages sessions and refreshes tokens. Database RLS is the autho ### Provisioning status -The dedicated project **Buffer** (`vhbngdatlowfnwaymvuq`, US East) was created in **operatoruplift's Org** after the organization was upgraded to Pro. Supabase quoted **$10/month** for the additional project. Both saved-report migrations and the September 15 additive alert migration are recorded as applied; the September 19 hardening and September 20 function-permission migrations are now applied; owner isolation, malformed JSON rejection, restricted insert columns, query indexing, and the alert tables' RLS posture have been verified. The shipped browser monitor uses bounded localStorage state and a local mock sink, so hosted delivery is not implied by the production deploy; a hosted provider-polling worker and verified external destination are still required. See [database verification](DATABASE-VERIFICATION.md) and the [alert runbook](ALERTS.md). +The dedicated project **Buffer** (`vhbngdatlowfnwaymvuq`, US East) was created in **operatoruplift's Org** after the organization was upgraded to Pro. Saved-report, alert hardening, owner-scoped hosted-monitoring, and liquidation-sentinel migrations are applied. The hosted worker and minute scheduler are active; the local rehearsal remains a separate experience. A read-only production check on October 1 at 06:23 UTC found 30 successful cron runs and 30 completed protected worker runs in the preceding 30 minutes, all in `dry_run` mode. Outbound notification delivery is not yet verified. See [database verification](DATABASE-VERIFICATION.md), [the alert runbook](ALERTS.md), and [webhook migration evidence](WEBHOOK-ALERTS.md). The original implementation recorded confirmed-account password sign-in and private report CRUD with disposable confirmed accounts. That is historical evidence from the original version. The current redesign's browser auth and report coverage uses the installed Supabase SDK with intercepted/mock transport; it does not prove a current production auth or email journey. Production SMTP delivery, redirect allowlists, Auth password policy, and compromised-password screening still require management-side configuration and verification. Do not treat the built-in restricted Supabase mail sender as public production signup delivery. @@ -57,7 +59,7 @@ The latest production verification also exercises `/brand-kit`, `/api/config`, a ## Installable app -See [PWA details](PWA.md) for supported browser installation and offline behavior. The same responsive web application works on mobile and desktop, and the service worker provides a clearly labeled fixed sample offline. Native App Store/Play Store packages and signed desktop installers are outside this delivery. +See [PWA details](PWA.md) for supported browser installation and offline behavior. The same responsive web application works on mobile and desktop, and the service worker provides a clearly labeled fixed sample offline. The repository also contains an [Android Web Shell project](seeker-and-pwa.md); physical-device installation and store distribution require separate verification. App Store/Play Store releases and signed desktop installers are outside the web deployment. ## Hosted monitoring addition — September 20 @@ -70,6 +72,7 @@ The current monitoring implementation adds authenticated `/api/monitoring` confi | `BUFFER_ALERT_SEND_ENABLED` | Server only | Defaults to false. Keep false until an exact destination and test message are authorized. | | `BUFFER_ALERT_NOTIFICATION_MODE` | Server only | Defaults to `test`; labels genuine live observations as test notifications. `production` is a deliberate separate choice. | | `BUFFER_DISCORD_DESTINATIONS_JSON` | Server only | One reviewed Discord configuration with webhook credentials, channel ID, stable config UUID and explicit allowed owner UUIDs. See the exact schema in the provider runbook. | +| `BUFFER_WEBHOOK_DESTINATIONS_JSON` | Server only | Reviewed HTTPS receivers, HMAC secrets, stable destination UUIDs and explicit allowed owner UUIDs. See [the signed-webhook contract](WEBHOOK-ALERTS.md). | Apply `20260920020000_hosted_monitoring.sql` only after its PostgreSQL verification passes. Initialize `private.buffer_monitor_credentials` with a SHA-256 hash through the administrator connection. Never commit the plaintext secret or put it in a URL. Deploy the new server variables before scheduling. Worker routes declare 60-second duration; their coordinator bounds due-provider work and dispatch. Browser requests time out after 45 seconds. diff --git a/docs/LAUNCH-FILM.md b/docs/LAUNCH-FILM.md new file mode 100644 index 0000000..5167b73 --- /dev/null +++ b/docs/LAUNCH-FILM.md @@ -0,0 +1,21 @@ +# Buffer launch film + +The launch film appears at [/demo#launch](https://bufferonsolana.vercel.app/demo#launch), before the three narrated product films. The landing page links to it from the product essentials strip. Playback is optional, with native controls, inline mobile playback, and no autoplay or video preload. The poster loads before a viewer starts the film. + +The user supplied `buffer-reel-30s-master.mp4` on October 1, 2026. The original master remains unchanged. The hosted derivative preserves the 30-second duration, 1920 × 1080 picture, 60 fps motion, and original music and interface-sound mix. Public assets are `/videos/buffer-launch.mp4` and `/videos/buffer-launch-poster.jpg`, with the cache revision `20261001`. + +The fast-start H.264/AAC derivative is 10,432,064 bytes, 78% smaller than the master. All 1,800 frames decoded successfully; the AAC payload is identical to the source. The source mix measures −14.1 LUFS integrated and −1.8 dB true peak. The 1600 × 900 poster is taken from the final Buffer scene. + +| Asset | SHA-256 | +| --- | --- | +| Supplied master | `a31dbdc8938a4057ec9132a86a0043dbe32ffdcf0a8c9ce5ce1c95ab98b7b592` | +| Hosted film | `fd92e554285f7507ebbd98e33e504508e54071b5880eb4fcca53edcd1d440fc3` | +| Poster | `1b6946ec9b8e7a669223579876d4f2b2db0e178e855772ab4466a4b6f3fb9ba3` | + +Source-project credits list “Vlog Music Promo (Love Language)” by BombinSound on Pixabay, Kenney CC0 sound packs, and synthesized interface effects. This integration preserves the supplied mix without adding voice or replacement music. + +This is a motion-graphics introduction, with illustrative positions and fixed reference prices. It is not footage of transaction signing, trading, or settlement. Four positions show a combined +1,000 USDC price effect for a −10% move; the separate formula scene shows one position contributing −1,500 USDC. Funding, fees, collateral changes, and liquidations are outside the scenario model. + +There is no spoken narration. The page provides a visible description and an expandable visual story, rather than an invented speech-caption track. The existing product, pitch, and technical films retain their English captions, transcripts, downloads, and September 30 capture context. + +`e2e/demo.spec.ts` checks the landing link, initial paused state, native controls, actual video decode/playback/seek, duration and dimensions, ranged download, visual-story disclosure, and viewport fit on desktop and mobile. The three narrated films keep their separate caption and transcript checks. diff --git a/docs/PWA.md b/docs/PWA.md index 0194dde..d9a079d 100644 --- a/docs/PWA.md +++ b/docs/PWA.md @@ -1,6 +1,6 @@ # Buffer on mobile and desktop -Buffer is a responsive, installable progressive web app. The same deployment serves the website, phone app, tablet app and desktop app. It does not include App Store, Play Store, Electron or native installer binaries. +Buffer is a responsive, installable progressive web app. The same deployment serves the website, phone app, tablet app and desktop app. The repository also includes an Android Web Shell project in `android/`; see [Seeker and Android setup](seeker-and-pwa.md). A generated shell is not evidence of a tested physical-device installation or an approved store release. App Store, Play Store, Electron and signed desktop distribution are not part of the web deployment. ## Install diff --git a/docs/seeker-and-pwa.md b/docs/seeker-and-pwa.md index 9e8a943..c71b044 100644 --- a/docs/seeker-and-pwa.md +++ b/docs/seeker-and-pwa.md @@ -1,6 +1,6 @@ # Seeker and PWA readiness -This branch makes Buffer run as an installed app on Android, iOS and the Solana Seeker, and ships the Android shell the Solana Mobile hackathon and dApp Store need. Everything below was lint-, type- and build-checked; the on-device steps still need a phone. +Buffer supports browser installation as a PWA and includes an Android Web Shell project for Seeker and Android distribution. Web lint, type and build checks do not establish a signed APK release or physical-device compatibility; the on-device steps below still need a phone. ## What changed @@ -15,7 +15,7 @@ This branch makes Buffer run as an installed app on Android, iOS and the Solana 1. Open https://bufferonsolana.vercel.app in Chrome on Android or Seeker. Use the browser menu → **Install app**, or the in-page install control where one exists. On iPhone use Safari → Share → **Add to Home Screen**. 2. Launch from the home screen. The app should open full-screen with the status bar in the theme colour and content clear of the notch and gesture bar. 3. Wallet: Open `/app`, pick a protocol and tap **Use my wallet**. On Seeker the phone's wallet chooser opens; approving fills the address and reads the account. Nothing is signed. -4. Offline: turn on airplane mode and relaunch. Static assets and the shell load from cache; live data shows its normal unavailable state rather than a browser error. +4. Offline: after a successful online visit, turn on airplane mode and reopen `/` or `/app`. The service worker serves the separate fixed-price offline scenario. It does not cache live page HTML, account data or authentication. An already-open live screen displays a disconnected notice. See [PWA behavior](PWA.md). Mobile Wallet Adapter registers itself only on Android in a secure context (or inside the Web Shell). Desktop, iOS and in-wallet browsers keep their injected wallets; nothing changes for them. diff --git a/e2e/demo.spec.ts b/e2e/demo.spec.ts index 90609b2..369b6d8 100644 --- a/e2e/demo.spec.ts +++ b/e2e/demo.spec.ts @@ -1,10 +1,10 @@ import { expect, test } from '@playwright/test'; -test('all three hosted videos decode, play and seek with captions available', async ({ page, request }) => { +test('all three narrated videos decode, play and seek with captions available', async ({ page, request }) => { await page.goto('/demo'); await expect(page.getByRole('heading', { name: 'Meet Buffer. Find your perspective.' })).toBeVisible(); await expect(page.getByRole('link', { name: 'Watch the walkthrough' })).toHaveAttribute('href', '#demo'); - const videos = page.locator('video'); + const videos = page.getByRole('region', { name: 'Narrated walkthroughs', exact: true }).locator('video'); await expect(videos).toHaveCount(3); // The product prepares every native track without displaying captions or // waiting for a later film to compete with earlier media range downloads. @@ -56,3 +56,46 @@ test('all three hosted videos decode, play and seek with captions available', as const width = await page.evaluate(() => ({ document: document.documentElement.scrollWidth, viewport: innerWidth })); expect(width.document).toBeLessThanOrEqual(width.viewport); }); + +test('the landing launch-film link opens an optional player that decodes, plays and seeks', async ({ page, request }) => { + await page.goto('/'); + const launchLink = page.getByRole('link', { name: 'Watch the launch film 30 sec', exact: true }); + await expect(launchLink).toHaveAttribute('href', '/demo#launch'); + await launchLink.click(); + await expect(page).toHaveURL(/\/demo#launch$/); + const launch = page.getByRole('region', { name: 'A clearer picture. In thirty seconds.', exact: true }); + const video = launch.locator('video'); + await expect(video).toBeVisible(); + await expect(video).toHaveAttribute('preload', 'none'); + await expect(video).toHaveAttribute('controls', ''); + await expect(video).toHaveAttribute('playsinline', ''); + await expect(video).not.toHaveAttribute('autoplay'); + await expect(video).toHaveAccessibleDescription(/Illustrative positions and fixed prices, with music and interface sounds/); + expect(await video.evaluate((element: HTMLVideoElement) => ({ paused: element.paused, muted: element.muted, time: element.currentTime }))).toEqual({ paused: true, muted: false, time: 0 }); + await expect(video.locator('track')).toHaveCount(0); + await video.evaluate((element: HTMLVideoElement) => { + element.muted = true; + return element.play(); + }); + await expect.poll(() => video.evaluate((element: HTMLVideoElement) => element.currentTime)).toBeGreaterThan(0); + await video.evaluate((element: HTMLVideoElement) => new Promise((resolve, reject) => { + const timeout = setTimeout(() => reject(new Error('Launch-film seek did not complete')), 10_000); + element.addEventListener('seeked', () => { clearTimeout(timeout); resolve(); }, { once: true }); + element.currentTime = 24; + })); + await expect.poll(() => video.evaluate((element: HTMLVideoElement) => element.currentTime)).toBeGreaterThan(24); + const state = await video.evaluate((element: HTMLVideoElement) => ({ width: element.videoWidth, height: element.videoHeight, duration: element.duration, error: element.error?.message })); + expect(state).toEqual({ width: 1920, height: 1080, duration: 30, error: undefined }); + await video.evaluate((element: HTMLVideoElement) => element.pause()); + await launch.getByText('Read the visual story', { exact: false }).click(); + await expect(launch.getByText(/Four illustrative positions show a combined \+1,000 USDC/)).toBeVisible(); + const download = launch.getByRole('link', { name: 'Download launch film', exact: false }); + await expect(download).toHaveAttribute('download', ''); + await expect(download).toHaveAttribute('href', '/videos/buffer-launch.mp4?v=20261001'); + const response = await request.get((await download.getAttribute('href'))!, { headers: { Range: 'bytes=0-1023' } }); + expect(response.status()).toBe(206); + expect(response.headers()['content-type']).toContain('video/mp4'); + const geometry = await video.evaluate((element: HTMLVideoElement) => ({ videoWidth: element.getBoundingClientRect().width, documentWidth: document.documentElement.scrollWidth, viewportWidth: innerWidth })); + expect(geometry.videoWidth).toBeLessThanOrEqual(geometry.viewportWidth); + expect(geometry.documentWidth).toBeLessThanOrEqual(geometry.viewportWidth); +}); diff --git a/e2e/landing-scroll.spec.ts b/e2e/landing-scroll.spec.ts index fd35686..42f6f44 100644 --- a/e2e/landing-scroll.spec.ts +++ b/e2e/landing-scroll.spec.ts @@ -207,10 +207,12 @@ test('feature links keep a stable hitbox during entrance and activate on the fir if (input === 'pointer') { await link.click(); } else { - // Begin at the preceding real control; the first Tab must expose the - // feature CTA and its content, then the first Enter must follow it. + // Follow the real control order through the launch-film link. The next + // Tab must expose the feature CTA, then the first Enter must follow it. await page.locator('.buffer-hero-stage').getByRole('button', { name: 'Pause page animations', exact: true }).focus(); await page.keyboard.press('Tab'); + await expect(page.getByRole('link', { name: 'Watch the launch film 30 sec', exact: true })).toBeFocused(); + await page.keyboard.press('Tab'); await expect(link).toBeFocused(); await expect(card).toHaveCSS('opacity', '1'); await expect(link).toHaveCSS('opacity', '1'); diff --git a/e2e/wallet-address.spec.ts b/e2e/wallet-address.spec.ts new file mode 100644 index 0000000..15322e7 --- /dev/null +++ b/e2e/wallet-address.spec.ts @@ -0,0 +1,165 @@ +import { expect, test, type Page } from '@playwright/test'; +import type { Wallet, WindowAppReadyEventAPI } from '@wallet-standard/base'; +import { PROTOCOLS } from '../src/lib/protocols'; + +const SOLANA_ADDRESS = '11111111111111111111111111111111'; +const PREVIOUS_ADDRESS = 'So11111111111111111111111111111111111111112'; + +type FixtureAccount = { address: string; chains: `${string}:${string}`[] }; +type FixtureWallet = { + name: string; + chains?: `${string}:${string}`[]; + responses: ({ accounts: FixtureAccount[] } | { error: string })[]; +}; +type WalletCalls = { connections: string[]; signing: string[] }; +type FixtureWindow = Window & { bufferWalletCalls?: WalletCalls }; + +// Exercise the real Wallet Standard registration and connection path. These +// synthetic wallets cannot sign, submit transactions, or access an extension. +async function registerWallets(page: Page, fixtures: FixtureWallet[]) { + await page.addInitScript((definitions: FixtureWallet[]) => { + const calls: WalletCalls = { connections: [], signing: [] }; + (window as FixtureWindow).bufferWalletCalls = calls; + const wallets: Wallet[] = definitions.map(definition => { + let attempts = 0; + const refuseSigning = async () => { + calls.signing.push(definition.name); + throw new Error('The address-only flow must not request a signature.'); + }; + return { + version: '1.0.0', + name: definition.name, + icon: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciLz4=', + chains: definition.chains ?? ['solana:mainnet'], + accounts: [], + features: { + 'standard:connect': { + version: '1.0.0', + connect: async () => { + calls.connections.push(definition.name); + const response = definition.responses[Math.min(attempts++, definition.responses.length - 1)]; + if ('error' in response) throw new Error(response.error); + return { accounts: response.accounts.map(account => ({ + ...account, + publicKey: new Uint8Array(32), + features: [], + })) }; + }, + }, + 'solana:signMessage': { version: '1.0.0', signMessage: refuseSigning }, + 'solana:signTransaction': { version: '1.0.0', signTransaction: refuseSigning }, + 'solana:signAndSendTransaction': { version: '1.0.0', signAndSendTransaction: refuseSigning }, + }, + }; + }); + const register = (api: WindowAppReadyEventAPI) => { + for (const wallet of wallets) api.register(wallet); + }; + window.addEventListener('wallet-standard:app-ready', event => { + register((event as CustomEvent).detail); + }); + window.dispatchEvent(new CustomEvent('wallet-standard:register-wallet', { detail: register })); + }, fixtures); +} + +async function openAccountForm(page: Page) { + const reads: string[] = []; + await page.route('**/api/accounts?*', route => { + const authority = new URL(route.request().url()).searchParams.get('authority'); + reads.push(authority ?? ''); + return route.fulfill({ json: { + authority, protocol: PROTOCOLS.velocity, retrievedAt: new Date().toISOString(), subaccounts: [], + } }); + }); + await page.goto('/app'); + await page.getByRole('link', { name: 'Choose an account', exact: true }).click(); + const address = page.getByRole('textbox', { name: 'Solana wallet address', exact: true }); + await expect(address).toBeFocused(); + await address.fill(PREVIOUS_ADDRESS); + return { reads, address, connect: page.getByRole('button', { name: 'Use my wallet', exact: true }) }; +} + +async function walletCalls(page: Page) { + return page.evaluate(() => { + const calls = (window as FixtureWindow).bufferWalletCalls; + if (!calls) throw new Error('The test wallet did not register its call recorder.'); + return calls; + }); +} + +test('wallet connection selects a Solana account and reads its public address without signing', async ({ page }) => { + await registerWallets(page, [{ name: 'Multi-chain wallet', responses: [{ accounts: [ + { address: '0x1234567890', chains: ['eip155:1'] }, + { address: SOLANA_ADDRESS, chains: ['solana:mainnet'] }, + ] }] }]); + const { reads, address, connect } = await openAccountForm(page); + expect(reads).toEqual([]); + await connect.click(); + await expect(page.getByRole('heading', { name: 'No Velocity subaccounts found', exact: true })).toBeVisible(); + await expect(address).toHaveValue(SOLANA_ADDRESS); + expect(reads).toEqual([SOLANA_ADDRESS]); + expect(await walletCalls(page)).toEqual({ connections: ['Multi-chain wallet'], signing: [] }); +}); + +for (const result of ['unsupported chain', 'no accounts'] as const) { + test(`wallet returning ${result} preserves the current address and does not read an account`, async ({ page }) => { + await registerWallets(page, [{ name: 'Unavailable Solana wallet', responses: [{ + // A valid-looking address must not bypass the chain requirement. + accounts: result === 'unsupported chain' ? [{ address: SOLANA_ADDRESS, chains: ['eip155:1'] }] : [], + }] }]); + const { reads, address, connect } = await openAccountForm(page); + await connect.click(); + await expect(page.getByRole('status').filter({ hasText: 'The wallet did not share a Solana address.' })).toBeVisible(); + await expect(address).toHaveValue(PREVIOUS_ADDRESS); + await expect(connect).toBeEnabled(); + expect(reads).toEqual([]); + expect(await walletCalls(page)).toEqual({ connections: ['Unavailable Solana wallet'], signing: [] }); + }); +} + +test('a rejected wallet connection can be retried without losing the entered address', async ({ page }) => { + await registerWallets(page, [{ name: 'Retry wallet', responses: [ + { error: 'You cancelled the wallet connection.' }, + { accounts: [{ address: SOLANA_ADDRESS, chains: ['solana:mainnet'] }] }, + ] }]); + const { reads, address, connect } = await openAccountForm(page); + await connect.click(); + const rejection = page.getByRole('status').filter({ hasText: 'You cancelled the wallet connection.' }); + await expect(rejection).toBeVisible(); + await expect(address).toHaveValue(PREVIOUS_ADDRESS); + expect(reads).toEqual([]); + await expect(connect).toBeEnabled(); + await connect.click(); + await expect(page.getByRole('heading', { name: 'No Velocity subaccounts found', exact: true })).toBeVisible(); + await expect(address).toHaveValue(SOLANA_ADDRESS); + await expect(rejection).toHaveCount(0); + expect(reads).toEqual([SOLANA_ADDRESS]); + expect(await walletCalls(page)).toEqual({ connections: ['Retry wallet', 'Retry wallet'], signing: [] }); +}); + +test('multiple compatible wallets require a choice and exclude non-Solana wallets', async ({ page }) => { + await registerWallets(page, [ + { name: 'First wallet', responses: [{ accounts: [{ address: PREVIOUS_ADDRESS, chains: ['solana:mainnet'] }] }] }, + { name: 'Second wallet', responses: [{ accounts: [{ address: SOLANA_ADDRESS, chains: ['solana:mainnet'] }] }] }, + { name: 'Other-chain wallet', chains: ['eip155:1'], responses: [{ accounts: [] }] }, + ]); + const { reads, address, connect } = await openAccountForm(page); + await connect.click(); + const menu = page.getByRole('menu', { name: 'Choose a wallet', exact: true }); + await expect(menu).toBeVisible(); + await expect(menu.getByRole('menuitem')).toHaveCount(2); + await expect(menu.getByRole('menuitem', { name: 'Other-chain wallet', exact: true })).toHaveCount(0); + expect(await walletCalls(page)).toEqual({ connections: [], signing: [] }); + await page.keyboard.press('Escape'); + await expect(menu).toHaveCount(0); + await expect(address).toHaveValue(PREVIOUS_ADDRESS); + expect(reads).toEqual([]); + + await connect.click(); + await menu.getByRole('menuitem', { name: 'Second wallet', exact: true }).click(); + await expect(menu).toHaveCount(0); + await expect(address).toHaveValue(SOLANA_ADDRESS); + await expect(page.getByRole('heading', { name: 'No Velocity subaccounts found', exact: true })).toBeVisible(); + expect(reads).toEqual([SOLANA_ADDRESS]); + expect(await walletCalls(page)).toEqual({ connections: ['Second wallet'], signing: [] }); +}); diff --git a/public/videos/buffer-launch-poster.jpg b/public/videos/buffer-launch-poster.jpg new file mode 100644 index 0000000..502c731 Binary files /dev/null and b/public/videos/buffer-launch-poster.jpg differ diff --git a/public/videos/buffer-launch.mp4 b/public/videos/buffer-launch.mp4 new file mode 100644 index 0000000..1a32096 Binary files /dev/null and b/public/videos/buffer-launch.mp4 differ diff --git a/src/app/demo/page.module.css b/src/app/demo/page.module.css index 3fc7802..0811e8f 100644 --- a/src/app/demo/page.module.css +++ b/src/app/demo/page.module.css @@ -8,3 +8,4 @@ @media(max-width:700px){.page{padding:20px}.nav{padding-bottom:22px}.navAction{font-size:12px;padding:9px 13px;gap:13px}.header{grid-template-columns:1fr;padding:57px 0 47px;gap:34px}.header h1{font-size:clamp(38px,8.7vw,55px);letter-spacing:-2.3px;margin-top:22px}.headerCopy>p{font-size:15px;line-height:1.75}.headerActions{gap:21px;margin-top:23px}.headerActions :global(.button){font-size:12px;padding:12px 16px}.textLink{font-size:12px;gap:9px}.indexItem{padding:17px 3px}.indexItem strong{font-size:13px}.indexItem small{font-size:10px;margin-top:5px}.indexArrow{font-size:20px}.film{padding-top:34px;margin-bottom:43px}.filmHeading{display:block;margin-bottom:20px}.film h2{font-size:28px;letter-spacing:-1.1px;margin-top:14px}.filmHeading>p{max-width:none;font-size:12px;margin-top:14px;line-height:1.8}.player{border-radius:12px}.filmFooter{flex-direction:column;gap:15px}.topics{gap:6px}.topics li{padding:5px 9px;font-size:9px}.downloads{font-size:11px}.context{grid-template-columns:1fr;gap:24px;padding:28px 24px;margin-bottom:24px;border-radius:16px}.context h2{font-size:28px}.context h2 br{display:none}.context p{font-size:12px}.closing{align-items:flex-start;flex-direction:column;padding:28px 0 38px;gap:23px}.closing h2{font-size:30px;max-width:360px}.closing :global(.button){font-size:13px}.footer{gap:18px;flex-wrap:wrap}.footer>span{display:none}} @media(prefers-reduced-motion:reduce){.indexItem{transition:none}} .player video::cue{font-size:clamp(12px,1.2vw,22px);background:#172d36eb;color:#fff} +.launch{padding-top:0}.launch .player{border-color:#d2dded;background:#edf2ff;box-shadow:0 24px 65px -42px #315fe870}.launchNote{font-size:11px;color:var(--film-muted);line-height:1.6}.visualStory{margin-top:24px;border-top:1px solid #d8e1e1;border-bottom:1px solid #d8e1e1;color:var(--film-muted)}.visualStory summary{display:flex;justify-content:space-between;align-items:center;gap:20px;min-height:48px;cursor:pointer;list-style:none;font-size:12px;color:var(--film-ink)}.visualStory summary::-webkit-details-marker{display:none}.visualStory summary>span{font-size:20px;color:#617b80}.visualStory[open] summary>span{transform:rotate(45deg)}.visualStory summary:focus-visible{outline:2px solid #315fe8;outline-offset:4px;border-radius:4px}.visualStory p{max-width:820px;margin:0 0 22px;font-size:12px;line-height:1.9} diff --git a/src/app/demo/page.tsx b/src/app/demo/page.tsx index b74b11a..751726b 100644 --- a/src/app/demo/page.tsx +++ b/src/app/demo/page.tsx @@ -7,10 +7,11 @@ import styles from './page.module.css'; export const metadata = { title: 'Watch Buffer — A clearer view, in a few minutes', - description: 'Explore the Buffer workspace with current product footage, a short pitch, and an inspectable technical walkthrough.', + description: 'Meet Buffer in a 30-second launch film, then explore the workspace with current product footage, a short pitch, and an inspectable technical walkthrough.', }; const mediaRevision = '20260930'; const mediaPath = (id: string, extension: string) => `/videos/buffer-${id}${extension}?v=${mediaRevision}`; +const launchPath = (extension: string) => `/videos/buffer-launch${extension}?v=20261001`; const films = [ { id: 'demo', title: 'Your next what-if, made clear.', label: 'Product walkthrough', description: 'Explore the workspace, shape a portfolio, open a public mainnet observation, and keep the explanation in a report.', topics: ['The workspace', 'Price scenarios', 'Public mainnet', 'Reports'] }, { id: 'pitch', title: 'A little more perspective.', label: 'The pitch', description: 'Why Buffer exists, and how a calmer workspace can make perpetual exposure easier to understand.', topics: ['The idea', 'Risk in context', 'On every screen'] }, @@ -31,24 +32,49 @@ export default function DemoPage() {
A closer look at Buffer

Meet Buffer.
Find your perspective.

-

A few minutes inside a calmer workspace for your perpetual positions. See the product, follow the idea, or go behind the numbers.

+

Start with a 30-second introduction to Buffer. Then step inside the workspace, follow the idea, or go behind the numbers.

Watch the walkthrough Explore live risk
-
+
+
+
01 / Launch film 0:30

A clearer picture.
In thirty seconds.

+

A motion film about seeing your perpetual positions more clearly. Illustrative positions and fixed prices, with music and interface sounds. No spoken narration or recorded transactions.

+
+
+ +
+
+ Press play when you're ready. Sound is part of the story. + +
+
+ Read the visual story +

The Buffer mark introduces a workspace for perpetual positions. Four illustrative positions show a combined +1,000 USDC price effect when their reference prices move −10%. The film reveals the calculation: signed size × baseline price × price move. It closes with supported providers, phone and desktop views, and the Buffer wordmark. These are fixed examples; they do not represent account equity, a liquidation forecast, or executed trades. The soundtrack contains music and interface sounds, with no speech.

+
+
+
{films.map((film, i) =>
-
0{i + 1} / {film.label} {runtime(film.id)}

{film.title}

+
0{i + 2} / {film.label} {runtime(film.id)}

{film.title}

{film.description}

@@ -63,10 +89,10 @@ export default function DemoPage() {
)} -
+
Your turn

Make room for your next what-if.

Open Buffer
A little more perspective.Brand kit
diff --git a/src/app/landing.css b/src/app/landing.css index 3040b38..2d16a75 100644 --- a/src/app/landing.css +++ b/src/app/landing.css @@ -88,6 +88,11 @@ .buffer-facts > div { display: flex; gap: 39px; } .buffer-facts > div span { display: flex; gap: 8px; align-items: center; } .buffer-facts > div span::before { content: ""; width: 4px; height: 4px; background: var(--cobalt); border-radius: 50%; } +.buffer-launch-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--cobalt); font-size: 11px; white-space: nowrap; } +.buffer-launch-play { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px solid #cbd5f0; border-radius: 50%; font-size: 8px; padding-left: 1px; } +.buffer-launch-link small { font-size: 9px; color: var(--quiet); } +.buffer-launch-link:hover { color: #1740ac; } +.buffer-launch-link:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 4px; border-radius: 4px; } .buffer-section { max-width: 1296px; margin: auto; padding: 106px 0; } .buffer-site h2 { font-size: clamp(34px, 3.6vw, 51px); line-height: 1.08; letter-spacing: -.055em; font-weight: 450; } .buffer-features { display: grid; grid-template-columns: 1fr 1.1fr; gap: 96px; } diff --git a/src/components/Landing.tsx b/src/components/Landing.tsx index 66f7f65..5cf4700 100644 --- a/src/components/Landing.tsx +++ b/src/components/Landing.tsx @@ -217,7 +217,7 @@ export default function Landing() { -
Built for curious humans.
No trading permissionsTransparent calculationsSolana perpetuals
+
Watch the launch film 30 sec
No trading permissionsTransparent calculationsSolana perpetuals
diff --git a/src/components/WalletAddressButton.tsx b/src/components/WalletAddressButton.tsx index adc4876..44665e7 100644 --- a/src/components/WalletAddressButton.tsx +++ b/src/components/WalletAddressButton.tsx @@ -46,7 +46,7 @@ export default function WalletAddressButton({ onAddress, disabled }: { onAddress const feature = wallet.features['standard:connect'] as ConnectFeature | undefined; if (!feature) throw new Error('This wallet does not support the standard connection flow.'); const result = await feature.connect(); - const account = result.accounts.find((item) => item.chains.some((chain) => chain.startsWith('solana:'))) ?? result.accounts[0]; + const account = result.accounts.find((item) => item.chains.some((chain) => chain.startsWith('solana:'))); if (!account) throw new Error('The wallet did not share a Solana address.'); setOpen(false); onAddress(account.address, wallet.name);