A fully functional crypto wallet for the Flare Coston2 Testnet with a pixel-perfect retro UI. Built with Next.js, React, Ethers.js, and MetaMask integration.
- MetaMask Integration: Seamless connection with MetaMask wallet
- Auto Network Detection: Automatically detects and prompts to switch to Flare Coston2 testnet
- Address Display: Shows connected wallet address in the header
- Live Blockchain Data: Real-time display of:
- Wallet address
- Wallet FLR balance
- Smart contract balance
- Contract owner address
- Network status
- Manual Refresh: Refresh button to manually update all balances
- Deposit FLR: Send FLR from your wallet to the smart contract
- Withdraw FLR: Withdraw specific amounts from the contract to any address
- Withdraw All: Withdraw the entire contract balance to a recipient address
- Transaction Status: Real-time feedback with success, error, and pending states
- Rate Limiting Protection: Automatic retry with exponential backoff
- Network Error Recovery: Graceful handling of RPC rate limits
- User-Friendly Messages: Clear error messages instead of technical jargon
- Node.js 18+ and npm
- MetaMask browser extension installed
- Flare Coston2 Testnet added to MetaMask (auto-prompted on first connection)
-
Clone the repository
git clone <repository-url> cd simplewallet
-
Install dependencies
npm install
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
npm run build
npm start- Click the "Connect Wallet" button in the header
- Approve the MetaMask connection request
- If you're on the wrong network, click "Switch Network" to automatically switch to Flare Coston2
- Your wallet address will appear in the header once connected
- Click the "Account" button in the header to open the Account Overview window
- View your:
- Wallet address
- Current FLR balance
- Contract balance
- Contract owner
- Network status
- Click the Refresh button to manually update all balances
- Open the "Transactions" window (click "Transactions" in the header)
- In the Deposit FLR section:
- Enter the amount of FLR you want to deposit
- Click "Deposit"
- Approve the transaction in MetaMask
- Wait for confirmation - you'll see a success message when complete
- Open the "Transactions" window
- In the Send FLR section:
- Enter the recipient address
- Enter the amount to withdraw
- Click "Send"
- Approve the transaction in MetaMask
- Wait for confirmation
- Open the "Transactions" window
- In the Withdraw All section:
- Enter the recipient address
- Click "Withdraw All"
- Approve the transaction in MetaMask
- The entire contract balance will be sent to the recipient
simplewallet/
βββ app/
β βββ page.tsx # Main application page
β βββ layout.tsx # Root layout
β βββ globals.css # Global styles
βββ artifacts/
β βββ contract-abi.json # Generated ABI from contract.sol
βββ components/
β βββ ui/ # Reusable UI components (shadcn/ui)
β βββ window-frame.tsx # Draggable window component
β βββ chat-panel.tsx # Chat/transaction panel
βββ contracts/
β βββ contract.sol # Smart contract source code (actively used)
βββ hooks/
β βββ useWallet.js # Wallet connection and management
β βββ useContract.js # Smart contract interactions
βββ lib/
β βββ flare.js # Flare network configuration
β βββ contract.js # Contract instance and helpers (imports ABI)
βββ scripts/
β βββ compile-contract.js # Compiles contract.sol to generate ABI
βββ styles/
β βββ habbo.module.css # Pixel-art CSS styles
βββ public/ # Static assets
- Address:
0x735E060B08aB94905D50de4760c8f53594cc07F9 - Network: Flare Coston2 Testnet (Chain ID: 114)
- RPC URL:
https://coston2-api.flare.network/ext/C/rpc - Contract Source: Located in
contracts/contract.sol(actively used) - ABI Generation: Automatically generated from
contract.soltoartifacts/contract-abi.json - Block Explorer: View Contract
deposit()- Deposit native FLR to the contract (anyone can call)withdraw(address payable _to, uint256 _amount)- Withdraw specific amount (owner only)withdrawAll(address payable _to)- Withdraw entire balance (owner only)getBalance()- View current contract balanceowner()- View contract owner addresschangeOwner(address _newOwner)- Change contract owner (owner only)receive()- Fallback function to accept plain FLR transfers
The contract ABI is automatically generated from contracts/contract.sol:
- Edit the contract: Modify
contracts/contract.sol - Compile: Run
npm run compile:contractto generate the ABI - Auto-compilation: The ABI is automatically generated when running
npm run devornpm run build
The generated ABI is stored in artifacts/contract-abi.json and imported by lib/contract.js.
- Next.js 15: React framework with App Router
- React 19: UI library
- Ethers.js v6: Blockchain interaction library
- MetaMask: Wallet provider
- Tailwind CSS: Utility-first CSS framework
- TypeScript: Type safety
The wallet is configured for Flare Coston2 testnet:
- Chain ID: 114 (0x72)
- Currency: FLR
- Block Explorer: Coston2 Explorer
The app includes intelligent rate limiting protection:
- Automatic retry with exponential backoff (2s, 4s, 8s delays)
- Graceful error handling for 429 (rate limit) errors
- Reduced polling frequency (20s for balances, 15s for contract state)
- Manual refresh option when automatic updates fail
Solution: Install the MetaMask browser extension
Solution: Click the "Switch Network" button to automatically switch to Flare Coston2
Symptoms: "Network is busy" messages or failed balance fetches
Solutions:
- Wait a few seconds and click the Refresh button
- The app will automatically retry with backoff
- Reduce transaction frequency if possible
Solutions:
- Check MetaMask for pending transactions
- Click the Refresh button in Account Overview
- Wait a few seconds - transactions may take time to confirm
- Check the transaction on Coston2 Explorer
- View your contract: 0x735E060B08aB94905D50de4760c8f53594cc07F9
Solutions:
- Click the Refresh button manually
- Wait for the next automatic refresh (15-20 seconds)
- Check your internet connection
- If rate limited, wait a moment and try again
- This is a testnet wallet - do not use with mainnet funds
- Always verify transaction details in MetaMask before approving
- Never share your private keys or seed phrases
- The smart contract address is hardcoded - verify it matches your contract
npm run dev- Compile contract and start development servernpm run build- Compile contract and build for productionnpm start- Start production servernpm run lint- Run ESLintnpm run compile:contract- Compilecontracts/contract.soland generate ABI
- Wallet Features: Modify
hooks/useWallet.js - Contract Features: Modify
hooks/useContract.jsandlib/contract.js - Smart Contract:
- Edit
contracts/contract.sol - Run
npm run compile:contractto regenerate ABI - Redeploy the contract to update the on-chain version
- Edit
- UI Components: Add to
components/directory - Styling: Use Tailwind classes or modify
styles/habbo.module.css
The application actively uses contracts/contract.sol as the source of truth:
- Edit Contract: Make changes to
contracts/contract.sol - Compile: Run
npm run compile:contractto generate the ABI - Deploy: Deploy the updated contract to Flare Coston2 testnet
- Update Address: Update
CONTRACT_ADDRESSinlib/contract.jswith the new deployment address
The ABI is automatically imported from artifacts/contract-abi.json into lib/contract.js, ensuring the frontend always uses the correct interface matching your Solidity contract.
If you deploy a new contract, update the address in:
lib/contract.js- Line 4:CONTRACT_ADDRESSapp/page.tsx- Update contract address display (2 locations)README.md- Update contract address in Technical Details section
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Built with Next.js
- UI components from shadcn/ui
- Icons from Lucide
- Powered by Flare Network
For issues, questions, or contributions, please open an issue on GitHub.