Problem Statement
Today, every wallet-driven transaction in TransactionConfirmation.tsx, batchTransaction.ts, and secureTransactionUtils.ts is sent to the chain without a pre-flight simulation. Users learn about a failed transaction only after spending gas.
Acceptance Criteria
- New
simulateTransaction(txRequest) API wraps viem's estimateContractGas and a Tenderly-style simulateApi.tx call
- Surfaced in the UI as an expandable "Simulated result" section
- Show top-3 expected state changes (token balance deltas, NFT ownership diffs)
- Optional opt-out ("Skip simulation for low-value tx")
Implementation Notes
Tenderly API key kept server-side. Front-end posts via /api/simulate. Vitest fetch mocks emulate Tenderly responses.
Files Likely Affected
src/utils/tenderlySimulation.ts (new)
src/app/api/simulate/route.ts (new)
src/components/TransactionConfirmation.tsx
src/lib/batchTransaction.ts
Difficulty / Effort
- Difficulty: Hard
- Effort: T-Shirt XL
Labels
web3, priority:high, feature, area:smart-contract
Problem Statement
Today, every wallet-driven transaction in
TransactionConfirmation.tsx,batchTransaction.ts, andsecureTransactionUtils.tsis sent to the chain without a pre-flight simulation. Users learn about a failed transaction only after spending gas.Acceptance Criteria
simulateTransaction(txRequest)API wrapsviem'sestimateContractGasand a Tenderly-stylesimulateApi.txcallImplementation Notes
Tenderly API key kept server-side. Front-end posts via
/api/simulate. Vitest fetch mocks emulate Tenderly responses.Files Likely Affected
src/utils/tenderlySimulation.ts(new)src/app/api/simulate/route.ts(new)src/components/TransactionConfirmation.tsxsrc/lib/batchTransaction.tsDifficulty / Effort
Labels
web3,priority:high,feature,area:smart-contract