Add "Try Franklin" — in-browser wallet-paid playground (/try) - #2
Closed
KillerQueen-Z wants to merge 1 commit into
Closed
Add "Try Franklin" — in-browser wallet-paid playground (/try)#2KillerQueen-Z wants to merge 1 commit into
KillerQueen-Z wants to merge 1 commit into
Conversation
New nav item "Try Franklin" → /try, a web preview of Franklin styled to match the site (warm-minimal + gold). Users connect a browser-extension wallet and chat with frontier models, paying per message in USDC via x402. Reuses BlockRun's existing x402 API rather than standing up new backend: - /api/blockrun/[...path] transparent proxy forwards to blockrun.ai, relaying the X-Payment request header and payment-required response header so the browser stays same-origin (no CORS, 402 visible). - Wallet/x402 stack ported from the BlockRun video playground: wagmi-config, useUsdcBalance, useX402Payment (EIP-3009 signing). - useFranklinChat: probe → 402 → wallet-sign → retry with X-Payment. Free models (nvidia/*) run with no wallet; paid models charge a few cents of USDC, settled on Base to BlockRun's wallet. UI: WalletProvider (wagmi + react-query, scoped to /try only), ConnectWallet chip with live USDC balance, FranklinChat surface with model picker, suggestions, and status/error states. Nav label localized across all 13 locales. Adds wagmi, viem, @tanstack/react-query. typecheck + production build pass; /try and the proxy verified locally (402 + payment-required relayed correctly).
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.
What
Adds a Try Franklin nav item linking to /try — a web preview of Franklin, styled to match the site (warm-minimal + gold). Users connect a browser-extension wallet and chat with frontier AI models, paying per message in USDC via x402. No account, no subscription.
Modeled on BlockRun's video-model experience page; reuses BlockRun's existing x402 API instead of standing up a new backend.
How it works
/api/blockrun/[...path]— transparent proxy toblockrun.ai. Relays theX-Paymentrequest header upstream and thepayment-requiredresponse header back, so the browser stays same-origin (no CORS, 402 visible to the client).wagmi-config,useUsdcBalance,useX402Payment(EIP-3009TransferWithAuthorizationsigning).useFranklinChat— probe →402→ wallet-sign → retry withX-Payment. Free models (nvidia/*) run with no wallet; paid models charge a few cents of USDC, settled on Base to BlockRun's configured wallet.UI
WalletProvider(wagmi + react-query) scoped to/tryonly — wallet stack stays out of every other page's bundleConnectWalletchip with live USDC balanceFranklinChatsurface: model picker (free + paid), prompt suggestions, signing/thinking/error statesi18n
"Try Franklin" nav label localized across all 13 locales.
Dependencies
Adds
wagmi,viem,@tanstack/react-query.Verification
npm run typecheck✅npm run build✅ (/tryprerenders; wagmi/viem compile under Next 16 SSR)/try→ 200, proxy/v1/models→ 200, paid-model POST → 402 withpayment-requiredheader relayed correctlyFollow-ups (not in this PR)
NEXT_PUBLIC_WALLETCONNECT_IDto enable mobile QR connect