📌 Description
useWallet (src/hooks/useWallet.ts) wraps the mock wallet connect flow, persisting the account via saveAccount/loadAccount (src/lib/wallet.ts) to localStorage per the README. It's unclear whether calling connect again while already connected is a safe no-op or silently overwrites the persisted account with a freshly generated mock address, which would be surprising if the "connect" button is clickable while already connected.
🧩 Requirements and context
- Add a test: connect once, capture the resulting account, call connect again, and assert the account is unchanged (no-op) rather than replaced.
- If a fresh reconnect should generate a new mock address (e.g. simulating a wallet switch), that's a valid design choice too — pick one behavior deliberately and test it, rather than leaving it as accidental.
- Ensure
ConnectButton (src/components/ConnectButton.tsx) doesn't present a confusing "Connect" affordance while already connected (should show a connected state per its existing tests).
🛠️ Suggested execution
- Add the double-connect test to
src/hooks/useWallet.test.ts.
- Fix
useWallet.ts/lib/wallet.ts if the behavior is found to be unintentional.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; this is a mock wallet flow, but the same account-persistence pattern would matter for a real wallet integration later.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
useWallet(src/hooks/useWallet.ts) wraps the mock wallet connect flow, persisting the account viasaveAccount/loadAccount(src/lib/wallet.ts) tolocalStorageper the README. It's unclear whether calling connect again while already connected is a safe no-op or silently overwrites the persisted account with a freshly generated mock address, which would be surprising if the "connect" button is clickable while already connected.🧩 Requirements and context
ConnectButton(src/components/ConnectButton.tsx) doesn't present a confusing "Connect" affordance while already connected (should show a connected state per its existing tests).🛠️ Suggested execution
src/hooks/useWallet.test.ts.useWallet.ts/lib/wallet.tsif the behavior is found to be unintentional.✅ Acceptance criteria
ConnectButton's UI state is consistent with the decided behavior.🔒 Security notes
No new attack surface; this is a mock wallet flow, but the same account-persistence pattern would matter for a real wallet integration later.
📋 Guidelines