This guide provides step-by-step instructions to test and verify that the Advanced Web3 Wallet Integration has been successfully implemented and is working correctly.
Before testing, ensure you have:
- Node.js 18+ installed
- npm or yarn package manager
- A wallet extension installed (MetaMask for testing)
- Access to a testnet (Goerli, Mumbai, Sepolia)
- Git repository available
Run from project root:
# Check Web3 hook
ls -la src/hooks/useWeb3Wallet.ts
# Check Web3 components
ls -la src/components/web3/
# Should show:
# - WalletConnector.tsx
# - TransactionManager.tsx
# - NFTGallery.tsx
# - DeFiInterface.tsx
# - index.ts
# Check Web3 utilities
ls -la src/utils/web3/
# Should show:
# - envValidation.ts
# - walletValidation.ts
# - security.ts
# - index.tsExpected output:
src/hooks/useWeb3Wallet.ts (exists)
src/components/web3/
DeFiInterface.tsx
NFTGallery.tsx
TransactionManager.tsx
WalletConnector.tsx
index.ts
src/utils/web3/
envValidation.ts
index.ts
security.ts
walletValidation.ts
All files should have reasonable sizes (not empty):
wc -l src/components/web3/*.tsx src/hooks/useWeb3Wallet.ts src/utils/web3/*.tsExpected minimum lines:
WalletConnector.tsx: ~350 linesTransactionManager.tsx: ~400 linesNFTGallery.tsx: ~500 linesDeFiInterface.tsx: ~550 linesuseWeb3Wallet.ts: ~350 linessecurity.ts: ~300 lines
npm run type-checkExpected Result: No errors (may have warnings)
If errors occur:
# Get detailed error output
npx tsc --noEmit 2>&1 | head -50npm run lint -- src/components/web3 src/hooks/useWeb3Wallet.ts src/utils/web3Expected Result: Pass (or minor style warnings)
npm run buildExpected Result: Build completes successfully
npm run devVisit http://localhost:3000
- Navigate to
/web3-demo - Click "Connect Wallet" button
- Expected: See wallet provider options (MetaMask, Starknet)
- Click MetaMask
- Expected: MetaMask extension opens, requests connection
- Approve connection in MetaMask
- Expected: Connected wallet address displays in UI
- Click connected wallet button (shows address)
- Click "Disconnect Wallet" in dropdown
- Expected: UI returns to "Connect Wallet" state
- Connect wallet
- Change network in MetaMask (e.g., Polygon)
- Expected: UI updates to show new network name
- May require page reload
- Connect wallet
- In connected dropdown, click copy icon next to address
- Expected: Icon changes to checkmark briefly
- Verify address copied to clipboard
// Test 1: Disconnected state
✓ Shows "Connect Wallet" button
✓ Dropdown opens on click
✓ Shows provider options (MetaMask, Starknet)
✓ Displays error message if wallet not installed
// Test 2: Connected state
✓ Shows address (shortened and full versions)
✓ Displays connected indicator (green dot)
✓ Shows provider and network info
✓ Copy address functionality works
✓ Disconnect button removes connection// Test 1: Form validation
✓ Requires recipient address
✓ Validates address format (0x...)
✓ Requires positive amount
✓ Shows validation errors
// Test 2: Transaction submission
✓ Disables form while pending
✓ Shows loading state
✓ Displays success message with tx hash
✓ Link to explorer works
✓ Form resets after success
✓ History persists in localStorage
// Test 3: Advanced options
✓ Show/hide advanced settings
✓ Can set custom gas limit
✓ Form accepts all inputs// Test 1: Loading state
✓ Shows loading spinner
✓ "Loading your NFT collection..."
// Test 2: Empty state
✓ Shows when no NFTs
✓ "No NFTs yet" message
✓ Mint button visible
// Test 3: Gallery display
✓ Grid view shows 3+ columns
✓ List view shows detailed info
✓ Switch between views works
✓ Pagination works
// Test 4: NFT details
✓ Click NFT opens modal
✓ Shows image, name, description
✓ Shows attributes (if any)
✓ Shows rarity badge
✓ Modal closes on X or outside click// Test 1: Protocols tab
✓ Shows protocol list
✓ Displays APY, TVL, risk level
✓ Shows supported tokens
✓ Stake button clickable
// Test 2: Staking modal
✓ Opens on Stake click
✓ Amount input accepts numbers
✓ Can select lock duration
✓ Confirm button works
✓ Modal closes after confirmation
// Test 3: Positions tab
✓ Shows active staking positions
✓ Displays amount, APY, lock period
✓ Shows earned rewards
✓ Unstake button present
// Test 4: Summary cards
✓ Shows total staked
✓ Shows total rewards
✓ Shows average APY
✓ Statistics update on stake# Add this test to verify security utils
node -e "
const { isValidAddress } = require('@/utils/web3');
console.log(isValidAddress('0x1234567890123456789012345678901234567890')); // true
console.log(isValidAddress('invalid')); // false
console.log(isValidAddress('0x123')); // false
"import { performSecurityChecks } from '@/utils/web3';
// Should flag warnings
const result = performSecurityChecks(
'0x0000000000000000000000000000000000000000', // zero address
'1000', // large amount
'0x...',
'0x1',
);
console.log(result.warnings); // Should include warningsimport { walletActionRateLimiter } from '@/utils/web3';
// Simulate multiple attempts
for (let i = 0; i < 7; i++) {
if (walletActionRateLimiter.isLimited('connect')) {
console.log('Rate limited!');
break;
}
}# After build, check component sizes
npm run build 2>&1 | grep -i "web3\|component"Each component should be < 50KB
In browser DevTools:
- Open Performance tab
- Connect wallet
- Record performance
- Expected: Actions complete within 500ms
- Open DevTools > Memory
- Take heap snapshot
- Connect/disconnect wallet 10 times
- Take another snapshot
- Expected: Memory usage stable (no significant increase)
Visit /web3-demo on:
# Mobile viewport sizes
- iPhone 12 (390x844)
- iPad (768x1024)
- Android (412x915)Expected: UI responds properly at all sizes
- Buttons are large enough (>44px)
- Dropdowns work with touch
- Forms are usable
- Copy button works on mobile
- Connect without mouse (Tab key only)
- All buttons should be reachable
- Dropdowns should open/close with Enter/Space
- Modals should be dismissible with Escape
Use WAVE browser extension or screen reader:
- All buttons have labels
- Form inputs have labels
- Images have alt text
- Color not sole indicator
Test in browsers:
- Chrome/Chromium (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)Expected: All functions work
# Search for any naming conflicts
grep -r "WalletConnector\|TransactionManager\|NFTGallery\|DeFiInterface" src/ --exclude-dir=web3 --exclude="*.tsx.example"Expected: No conflicting components
// In any component, this should work:
import { WalletConnector, TransactionManager, NFTGallery, DeFiInterface } from '@/components/web3';
import { useWeb3Wallet } from '@/hooks/useWeb3Wallet';
import { performSecurityChecks } from '@/utils/web3';- TypeScript compilation succeeds (
npm run type-check) - ESLint passes (
npm run lint) - No console errors in browser
- No console warnings (except expected libraries)
- Code follows project conventions
- All functions have JSDoc comments
- Error handling implemented throughout
- Wallet connection works with multiple providers
- Transactions can be sent and tracked
- NFT gallery displays properly
- DeFi interface loads and functions
- All buttons and forms respond
- Error messages are user-friendly
- Loading states show correctly
- Page loads within 3 seconds
- Components render smoothly
- No memory leaks detected
- Bundle size reasonable
- Images optimized
- No unused imports
- Address validation working
- Security checks prevent issues
- Rate limiting active
- XSS protections in place
- Sensitive data not logged
- No hardcoded secrets
- Dark mode works
- Responsive on all sizes
- Touch-friendly controls
- Accessible to screen readers
- Keyboard navigable
- Loading/error states clear
- Success confirmations shown
- README updated with Web3 info
- Components documented with JSDoc
- Integration guide provided
- Examples included
- Types exported correctly
npm run devnpm run build
npm startvercel deploy --prodSet in your component:
import { useEffect } from 'react';
useEffect(() => {
if (process.env.NODE_ENV === 'development') {
console.log('[Web3] Debug mode enabled');
}
}, []);- No TypeScript errors
- No React warnings
- No wallet provisioning errors
- No CORS issues
Open DevTools > Network tab:
- Wallet provider loads correctly
- No failed RPC calls
- Reasonable response times
| Issue | Solution |
|---|---|
| "Wallet not detected" | Install MetaMask extension |
| "Network mismatch" | Use wallet.switchChain() |
| "Transaction failed" | Check address and balance |
| "Type errors on build" | Run npm run type-check |
| "Components not importing" | Check barrel export in index.ts |
| "Styles not applying" | Verify Tailwind CSS is working |
Target metrics:
| Metric | Target | Actual |
|---|---|---|
| First Paint | < 1s | - |
| Component Load | < 500ms | - |
| Transaction Submit | < 1s | - |
| Page Interactive | < 3s | - |
Run final QA checklist:
# Type check
npm run type-check
# Build
npm run build
# Lint
npm run lint
# Test in dev
npm run dev
# Manually test at localhost:3000/web3-demoAll should pass before deployment.
When all tests pass, update:
git checkout -b web3-integration
git add .
git commit -m "feat: Add Advanced Web3 Wallet Integration
- Multi-wallet connection (MetaMask, Starknet, WalletConnect)
- Transaction management with signing and tracking
- NFT gallery with pagination and details
- DeFi staking interface with rewards tracking
- Comprehensive security validation
- Full TypeScript support
- Production-ready implementation"
git push origin web3-integrationCreate a pull request for review.
Last Updated: April 2026
Status: Ready for Testing