Warning: AI slop ahead.
A React application for migrating funds from the defunct Secret Swap protocol on Secret Network. This tool allows users to safely withdraw from reward pools and liquidity pools.
- π Secure Wallet Integration - Connect with Keplr wallet
- π Permit-Based Authentication - Deterministic viewing key generation
- π Reward Pool Migration - Batch withdrawal from staking pools
- π° Liquidity Pool Support - LP token burning and asset claiming (Coming Soon)
- π Dark/Light Theme - Professional UI matching Secret Swap branding
- π± Mobile Responsive - Works on desktop and mobile devices
- πΎ Local Storage - Persistent permit signatures and viewing keys
- π Batch Transactions - Efficient multi-pool operations
- Node.js (v18 or higher)
- Yarn package manager
- Keplr Wallet browser extension
- At least 1 SCRT in your wallet for transaction fees
# Clone the repository
git clone https://github.com/your-org/secretswap-withdraw.git
cd secretswap-withdraw
# Install dependencies
yarn install
# Start development server
yarn dev
# Build for production
yarn build# Start the dev server with hot reload
yarn dev
# Open http://localhost:5173 in your browser- Install Keplr if not already installed
- Add Secret Network to Keplr (should be automatic)
- Fund your wallet with at least 1 SCRT for fees
- Click "Start Migration" on the landing page
The app will attempt to sign a permit message for pools with permit support:
// Example permit message structure
{
chain_id: 'secret-4',
account_number: '0',
sequence: '0',
fee: { amount: [], gas: '1' },
msgs: [{
type: 'query_permit',
value: {
permit_name: 'SecretSwap Migration',
allowed_tokens: ['*'],
permissions: ['balance', 'allowance'],
}
}],
memo: 'SecretSwap Migration Permit - Generated deterministically for viewing key creation',
}The app follows this priority for viewing keys:
- Existing Keplr keys - Query from wallet extension
- Migration-generated keys - Set using permit signature as deterministic key
- Manual key setting - Batch transaction to set keys for selected pools
Test balance queries for different pool types:
- Permit pools - Should show balances immediately
- Pools with Keplr keys - Should show balances after key detection
- Pools without keys - Should show "Balance hidden" until keys are set
IMPORTANT: Test on Secret Network testnet first!
- Select pools with actual balances
- Set viewing keys if needed (batch transaction)
- Execute withdrawals (batch transaction with multiple redeem messages)
- Verify results in the success modal
src/
βββ components/ # React components
β βββ common/ # Reusable UI components
β βββ info/ # Landing page components
β βββ rewards/ # Reward pool components
β βββ liquidity/ # Liquidity pool components (Coming Soon)
β βββ testing/ # Development testing tools
βββ contexts/ # React Context providers
βββ hooks/ # Custom React hooks
βββ styles/ # CSS theme and component styles
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions
βββ data/ # Static JSON data files
AppContext- Global state management with useReduceruseKeplr- Wallet connection and permit signinguseLocalStorage- Persistent data managementRewardPoolsList- Main migration interfacePoolRow- Individual pool display and interaction
# Optional: Customize RPC endpoint
VITE_SECRET_RPC_URL=https://secret.api.trivium.network:1317
# Development: Enable testing panel
NODE_ENV=developmentThe app uses CSS custom properties for theming:
/* Light theme (default) */
:root {
--color-primary: #f4c430;
--color-background: #faf9f6;
--color-text-primary: #2d1810;
/* ... */
}
/* Dark theme */
[data-theme="dark"] {
--color-primary: #f4c430;
--color-background: #0f0f0f;
--color-text-primary: #ffffff;
/* ... */
}- Local Storage - Permit signatures are stored locally (not on servers)
- Viewing Keys - Generated deterministically from permit signatures
- No Private Keys - All signing happens through Keplr extension
- Transaction Verification - Users approve all transactions in Keplr
- Error Handling - Comprehensive error boundaries and user feedback
- Wallet connection and permit signing
- Viewing key detection and management
- Reward pool selection interface
- Batch viewing key setting
- Batch withdrawal transactions
- Theme system and responsive design
- Error handling and loading states
- Local storage persistence
- Developer support section
- Complete testing with live Keplr integration
- Performance optimizations
- Additional error recovery mechanisms
- Liquidity pool migration functionality
- Transaction history tracking
- Advanced slippage protection
- Multi-wallet support
- Analytics and reporting
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- TypeScript for type safety
- ESLint for code linting
- Prettier for code formatting
- CSS Custom Properties for theming
- React Hooks for state management
# Run type checking
yarn type-check
# Run linting
yarn lint
# Run tests (when implemented)
yarn test
# Build and verify
yarn build- Trivium Validator: Support the developers by delegating to
secretvaloper1a73czfcgtzx6y2xn6l7yj9wplrmhqp7fezv7f8 - Community: Join the Secret Network Discord for general support
- Issues: Report bugs on GitHub Issues
- Documentation: See code comments and TypeScript definitions
- Architecture: Review the
src/contexts/AppContext.tsxfor state management - API Integration: Check
src/utils/for Secret Network queries
This project is licensed under the MIT License - see the LICENSE file for details.
- Secret Network community for protocol support
- Keplr Team for wallet integration capabilities
- Secret Swap for the original DeFi protocols
- Trivium team for development and maintenance