USD-denominated payment requests settled as stablecoins on Robinhood Chain via Across Protocol.
- Next.js App Router + React 19
- Convex (database + backend functions)
- Privy for Sandia accounts (email OTP and an embedded wallet) and for payer wallet connection, wagmi/viem for chain reads and sends
- Across Swap API for quotes, approvals, bridging, and deposit tracking
After step 3 initializes Convex, configure Jev through OpenRouter. Keep this key in Convex only:
npx convex env set OPENROUTER_API_KEY <openrouter-api-key>
- Copy env template:
cp .env.example .env.local
- Install dependencies:
pnpm install
- Start Convex (creates a deployment and writes
NEXT_PUBLIC_CONVEX_URL):
npx convex dev
- Set the Privy app id in
.env.local:
NEXT_PUBLIC_PRIVY_APP_ID=<privy-app-id>
Create a Privy app with email OTP and wallets enabled. Allow http://localhost:3000. On Convex, set the same app id and the wallet-claim secret:
npx convex env set PRIVY_APP_ID <same-as-NEXT_PUBLIC_PRIVY_APP_ID> npx convex env set SANDIA_NONCE_SECRET <secret>
The Privy app secret stays on Convex only. Copy it from Configuration → App settings → Basics in the Privy Dashboard. Privy shows it once; regenerating it invalidates the previous secret. Do not put it in .env.local or any NEXT_PUBLIC_ variable. The Next.js client does not read it. Client sends authenticate with the signed-in Privy session.
npx convex env set PRIVY_APP_SECRET <app-secret>
Batch sends also need the deployed Sandia Send address in .env.local:
NEXT_PUBLIC_SANDIA_SEND_ADDRESS=<sandia-send-address>
The Sandia Send contract, deployment scripts, and contract tests live in sandia-core.
A single recipient still transfers USDG directly. Two or more recipients approve that contract, then call sandia_send.
- In another terminal:
pnpm dev
Open http://localhost:3000.
- Creator signs in with email+OTP. Privy creates an embedded wallet, and that wallet is claimed automatically so they can create requests and send.
- Create a request: USD amount, optional description and expiry. The recipient is that wallet. The destination token is USDG on Robinhood Chain.
- Share the public
/pay/{id}URL. - Payer connects an external wallet through Privy, selects an Across-supported source chain/token, reviews quote (input, fees, min received, ETA), approves if needed, and pays. Paying does not create a Sandia account.
- The request is marked completed only after a deposit receipt matches the request and Across
/depositreportsfilledwith destination chain 4663, the request token, the snapshotted recipient, an output amount at least as large as the request, and a fill transaction./deposit/statusis not used as proof. A minute cron keeps checking if the payer closes the tab.
- Monetary values are stored as integer base units / USD micros — no floating-point arithmetic.
- Destination tokens are discovered live from
GET /swap/tokens?chainId=4663filtered toUSDC|USDT|USDG. - The payer's browser also polls every 10 seconds. The server calls Across
GET /deposit(or/deposits) withACROSS_API_KEYon Convex, not a public env var. - Register an Across integrator id and set Convex
ACROSS_INTEGRATOR_ID. /otcredirects to/requests/new.- App accounts use the Privy embedded wallet on Robinhood Chain. The public pay page uses the same Privy wagmi provider and connects an external wallet for payment, so paying does not claim a Sandia account. WalletConnect for payers is the connector enabled in the Privy dashboard.
- Outbound USDG sends use Privy's embedded-wallet gas sponsorship on Robinhood Chain (chain id 4663), so the sender does not need ETH. The browser calls
useSendTransactionwithsponsor: true; that uses the signed-in session, not the app secret. In the Privy Dashboard: enable TEE execution under Wallets → Advanced (do not disable automatic wallet migration), turn on Fee sponsorship → Sponsor gas fees (App pays; User pays does not cover Robinhood Chain), add Robinhood Chain, allow client-initiated sponsored transactions, set a spend cap, and add credits plus a payment method under Billing → Fee sponsorship. Store the app secret only as ConvexPRIVY_APP_SECRET. Batch sends sponsor both the USDG approval and the Sandia Send call. - Stock buy and sell quote Uniswap v2 and v3 on Robinhood Chain and submit the swap to SwapRouter02. Steakhouse USDG deposits, withdrawals, and redemptions are submitted from Earn. See
docs/gates.md.