A decentralized application (dApp) that allows users to check their eligibility for an airdrop by connecting their Ethereum wallet and verifying their Polkadot address.
- 🔐 Secure Ethereum wallet connection (MetaMask support)
- ⛓️ Cross-chain verification with Polkadot network
- 📝 EIP-712 signature verification for address ownership
- 🎨 Modern, responsive UI with step-by-step flow
- 🔍 Real-time eligibility checking
- Node.js (v18 or higher)
- Modern web browser with MetaMask extension installed
- Polkadot account (for receiving tokens)
- Clone the repository:
git clone https://github.com/Krayt78/PolkadotAirdropFrontend.git
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser and navigate to
http://localhost:5173
- Frontend Framework: React with TypeScript
- Styling: Tailwind CSS
- Web3 Integration:
- ethers.js (Ethereum interactions)
- @polkadot/api (Polkadot blockchain interactions)
- UI Components: Lucide React icons
- Build Tool: Vite
src/
├── lib/
│ ├── config.ts # Configuration constants
│ └── hooks/
│ ├── useWallet.ts # Ethereum wallet integration
│ └── usePolkadot.ts # Polkadot network integration
├── App.tsx # Main application component
└── main.tsx # Application entry point
- Connect Wallet: Click "Connect Ethereum Wallet" to connect your MetaMask wallet
- Enter Polkadot Address: Provide the Polkadot address where you want to receive tokens
- Check Eligibility: The system will verify your eligibility on the Polkadot network
- Submit Claim: If eligible, sign the message with your Ethereum wallet to verify ownership
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLint
Make sure you have MetaMask installed and configured for development:
- Install MetaMask browser extension
- Create or import a wallet
- Connect to the appropriate network (Ethereum Mainnet or testnet)
- Make sure you have MetaMask installed and configured
- Ensure your local Substrate node is built and ready to run
- Node.js and npm installed
-
Start the Local Node
# Navigate to your substrate node directory cd ../PolkadotAirdropPallet # Run the node in development mode cargo run --release -- --dev
-
Initialize Test Data
# Navigate to the frontend directory cd ../PolkadotAirdropFrontend # Run the setup script to initialize claims and balances npx tsx src/test/setup_extrinsics.ts
This will:
- Register test claims for predefined Ethereum addresses
- Set up initial balances for testing
- Configure the necessary blockchain state
-
Run the Test Suite
# Run the claim flow test npx tsx src/test/claimFlow.ts
The test will:
- Connect to MetaMask
- Check claim eligibility
- Record initial balance
- Sign and submit the claim
- Verify the balance has increased by the claim amount
You can run the test with different options:
# Skip eligibility check
npx tsx src/test/claimFlow.ts --skip-eligibility
# Use mock signature (doesn't require MetaMask)
npx tsx src/test/claimFlow.ts --mock-signature
# Dry run (no actual transactions)
npx tsx src/test/claimFlow.ts --dry-run
If the test fails, check:
- Is your local node running?
- Did you run the setup script first?
- Is MetaMask unlocked and connected to the correct network?
- Are you using the correct Ethereum address in MetaMask?
A successful test will show:
Testing claim flow...
Connected to wallet: 0x...
Eligible for claim amount: 1000
Initial balance: 0
Message signed: 0x...
Transaction included in block: 0x...
Final balance: 1000
Success: Balance increased by the correct claim amount!
Test completed successfully!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- The application uses EIP-712 for secure message signing
- All blockchain interactions are read-only
- No sensitive data is stored on the frontend
For support, please open an issue in the repository or contact the maintainers.