Cause: React 19 has peer dependency conflicts with some packages.
Fix:
npm install --legacy-peer-depsCause: .env.local file is missing or the variable is not set.
Fix:
- Create
.env.localin the project root (not insideapp/) - Add:
NEXT_PUBLIC_APPKIT_PROJECT_ID=your_id_here - Restart the dev server (
npm run dev)
Environment variables are loaded at build time. Changes require a server restart.
Cause: Invalid or missing project ID.
Fix:
- Verify your project ID at cloud.reown.com
- Ensure
localhost:3000is in the allowed origins for your Reown project - Check browser console for AppKit initialization errors
Cause: Contract address environment variable is not set, so the contract instance is null.
Fix:
- Ensure both
NEXT_PUBLIC_YIELD_SAVE_CONTRACT_ADDRESSandNEXT_PUBLIC_USDC_CONTRACT_ADDRESSare set in.env.local - Restart the dev server
Cause: Wallet is connected to a network other than Base Sepolia.
Fix: AppKit automatically prompts to switch networks. If it doesn't:
- Manually switch to Base Sepolia in your wallet
- Network details: RPC
https://sepolia.base.org, Chain ID84532
Cause: A stuck transaction in MetaMask.
Fix:
- Open MetaMask → Settings → Advanced → Reset Account
- This clears the nonce cache without affecting balances
Cause: Wallet is not yet connected when the hook is called.
Fix: This is handled by useRunner.ts — it returns null for provider and signer when not connected. Components check isConnected before calling write operations.
Cause: Tried to deposit or withdraw with amount = 0.
Fix: Ensure the input field has a valid non-zero amount before submitting.
Cause: The withdraw amount exceeds the user's share balance.
Fix: Use the MAX button to fill in the exact share balance, or enter a lower value.
Cause: USDC transferFrom failed — most likely the approval was insufficient or expired.
Fix:
- Go back to the Deposit tab
- The allowance check will detect the issue
- Re-approve the required amount
Cause: Transaction was included in a block but reverted on-chain.
Fix: Check the transaction on BaseScan. The revert reason will be visible in the internal transactions tab. Common causes:
- Stale
previewDepositresult (price moved between preview and submission) - Re-entrancy attempt (very unlikely in normal use)
Cause: The contract address is wrong, the ABI is outdated, or the node returned unexpected data.
Symptoms: All balance displays show 0 or null; console shows "BAD_DATA" warnings.
Fix:
- Verify the contract address in
.env.localmatches the deployed contract - Verify the ABI in
lib/abis/YieldSaveVault.jsonmatches the deployed bytecode - Try a different RPC URL in
NEXT_PUBLIC_BASE_SEPOLIA_RPC_URL
Cause: A transaction with the same nonce was already broadcast.
Fix: Wait for the pending transaction to confirm or fail, then retry.
Cause: Data fetch hasn't completed yet, or the user has no balance.
Fix:
- Wait 2-3 seconds after connecting — data is fetched asynchronously
- Check if the wallet has USDC balance on Base Sepolia
- Open browser console and look for RPC errors
Cause: Theme is stored in localStorage as "theme".
Fix: This is expected behaviour. If localStorage is cleared (e.g., incognito mode), the theme resets to dark. This is by design.
Cause: USDC uses 6 decimal places. Raw bigint values need to be formatted.
Fix (for developers):
import { formatUnits } from "ethers"
const display = formatUnits(rawBigInt, 6) // "100.0"Ensure any new display code uses formatUnits(value, 6) for USDC values.
Cause: TypeScript type mismatch, usually from bigint | null not being handled.
Fix: Add null checks:
if (value !== null) {
// use value safely
}Cause: Import path is wrong or file doesn't exist.
Fix:
- Check the file exists at
lib/abis/YieldSaveVault.json - The
tsconfig.jsonpath alias@/*maps to./src/*— but this project usesapp/notsrc/. Use relative imports:../../lib/abis/YieldSaveVault.json
Cause: ethers.js v6 changed its import paths.
Fix: Use named imports from the correct path:
// v6 (correct):
import { formatUnits, parseUnits, BrowserProvider } from "ethers"
// v5 (wrong):
import { ethers } from "ethers"
ethers.utils.formatUnits(...) // does not work in v6- Check BaseScan for transaction details and contract state
- Check Reown docs for AppKit issues
- Check ethers.js v6 docs for provider/signer questions
- Open an issue in the repository with: browser console output, wallet type, and steps to reproduce