fix: fund-ready scaffold — CLI-matching env names, key gate, funding pre-flight, npm run verify - #8
Merged
Merged
Conversation
…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.
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.
Closes the gaps a first-time builder hits between
npx create-rome-appand a passing demo.What a new dev hit before this
npm run demowith the seeded (unfilled).envdied in a raw viem stack trace (invalid private key, expected hex or 32 bytes, got string).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.EVM_KEY/SOLANA_KEYwhile theromeCLI readsROME_EVM_KEY/ROME_SOLANA_KEY— finishing the demo and then runningrome verifymeant re-exporting the same keys under different names.Changes
ROME_EVM_KEY/ROME_SOLANA_KEYeverywhere. One.env, one export, both tools. (New scaffolds only — existing apps keep working as generated.)lib/keys.ts):demo/deployvalidate both keys before any RPC call and exit with fill-in instructions when.envstill holds placeholders.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.envand runs the rome CLI'sverifyagainst the app's chain — the same works-gate, straight from the scaffold;rome verifyby hand behaves identically with the vars exported..env.example, and the post-scaffold next-steps.The new
test/template-contract.test.mjslocks the contract (names, minimums stated, gate wired, verify script present).Verification (Hadrian, 200010)
npm test6/6 · scaffolded appnpm run typecheckclean.env→ instructions + exit 1 (no stack trace), bothdemoanddeploynpm run verify→{"ok": true}with both lanes answering, via the real CLI