Skip to content

fix: fund-ready scaffold — CLI-matching env names, key gate, funding pre-flight, npm run verify - #8

Merged
skansal-rome merged 1 commit into
mainfrom
fix-scaffold-funding-dx
Jul 24, 2026
Merged

fix: fund-ready scaffold — CLI-matching env names, key gate, funding pre-flight, npm run verify#8
skansal-rome merged 1 commit into
mainfrom
fix-scaffold-funding-dx

Conversation

@skansal-rome

Copy link
Copy Markdown
Contributor

Closes the gaps a first-time builder hits between npx create-rome-app and a passing demo.

What a new dev hit before this

  1. npm run demo with the seeded (unfilled) .env died in a raw viem stack trace (invalid private key, expected hex or 32 bytes, got string).
  2. The docs said fund the Solana wallet with "a little SOL + USDC" — but the demo's fund leg moves 0.5 USDC, so 0.2 fails mid-run with an opaque custom program error: 0x1. And each run deploys a fresh Vault (~0.3 USDC gas) + wraps 0.15, so an EVM wallet funded with less than ~0.5 dies on its second run after spending real gas.
  3. The scaffold read EVM_KEY/SOLANA_KEY while the rome CLI reads ROME_EVM_KEY/ROME_SOLANA_KEY — finishing the demo and then running rome verify meant re-exporting the same keys under different names.

Changes

  • Env names match the CLI: the template now uses ROME_EVM_KEY / ROME_SOLANA_KEY everywhere. One .env, one export, both tools. (New scaffolds only — existing apps keep working as generated.)
  • Key gate (lib/keys.ts): demo/deploy validate both keys before any RPC call and exit with fill-in instructions when .env still holds placeholders.
  • Funding pre-flight (demo.ts): checks both wallets and prints the exact per-wallet shortfall (needs ≥ 0.7 USDC gas EVM-side, ≥ 0.6 USDC + 0.02 SOL Solana-side) before deploying, so an underfunded run costs nothing.
  • npm run verify: loads .env and runs the rome CLI's verify against the app's chain — the same works-gate, straight from the scaffold; rome verify by hand behaves identically with the vars exported.
  • Concrete amounts in README, .env.example, and the post-scaffold next-steps.

The new test/template-contract.test.mjs locks the contract (names, minimums stated, gate wired, verify script present).

Verification (Hadrian, 200010)

  • npm test 6/6 · scaffolded app npm run typecheck clean
  • unfilled .env → instructions + exit 1 (no stack trace), both demo and deploy
  • valid-but-unfunded key → pre-flight lists the exact shortfall, exits before spending gas
  • funded wallets → dual-lane demo passes (both lanes deposit/withdraw one Vault)
  • npm run verify{"ok": true} with both lanes answering, via the real CLI

…pre-flight, npm run verify

- Rename the scaffold's env keys to ROME_EVM_KEY / ROME_SOLANA_KEY — the same
  names the rome CLI reads, so one .env / one export serves both tools.
- lib/keys.ts gates demo/deploy before any RPC call: an unfilled or malformed
  .env exits with fill-in instructions instead of a viem stack trace.
- demo.ts pre-flights both wallets and lists exact shortfalls before spending
  gas (a run deploys a fresh Vault ~0.3 USDC gas + wraps 0.15; the Solana lane
  moves 0.5 USDC through the synthetic).
- npm run verify: loads .env and runs the rome CLI's verify on the app's chain
  — the works-gate straight from the scaffold.
- README / .env.example / next-steps state concrete funding minimums
  (EVM >= 1 USDC gas, Solana >= 0.6 USDC + 0.02 SOL) instead of 'a little'.

Template contract locked by test/template-contract.test.mjs.
@skansal-rome
skansal-rome merged commit 403884d into main Jul 24, 2026
7 checks passed
@skansal-rome
skansal-rome deleted the fix-scaffold-funding-dx branch July 24, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant