A modern, secure bridge interface for transferring assets between Layer 1 and Layer 2 networks. This project includes a patch for the viem/op-stack package to fix issues with the withdrawal status detection.
- 🌉 Cross-chain transfers between L1 and L2 networks
- 🔐 Secure wallet integration with multiple wallet providers
- 📱 Responsive design optimized for all devices
- 🌙 Dark/Light mode support
- ⏱️ Real-time status tracking for withdrawal processes
- 💾 Local state persistence for incomplete transactions
- 🎨 Modern UI with smooth animations and transitions
- Node.js 18+
- npm or yarn
- A Web3 wallet (MetaMask, WalletConnect, etc.)
-
Clone the repository: ```bash git clone cd optipulse-bridge ```
-
Install dependencies: ```bash npm install ```
-
Copy environment variables: ```bash cp .env.example .env.local ```
-
Configure your environment variables in
.env.local -
Run the development server: ```bash npm run dev ```
-
Open http://localhost:3000 in your browser
| Variable | Description | Default |
|---|---|---|
NEXT_PUBLIC_L1_CHAIN_ID |
L1 Chain ID | 943 |
NEXT_PUBLIC_L2_CHAIN_ID |
L2 Chain ID | 94128 |
NEXT_PUBLIC_L1_CHAIN_NAME |
L1 Chain Name | Pulse Testnet |
NEXT_PUBLIC_L2_CHAIN_NAME |
L2 Chain Name | OptiPulse Testnet |
NEXT_PUBLIC_NATIVE_TOKEN_SYMBOL |
Native Token Symbol | TPLS |
NEXT_PUBLIC_NATIVE_TOKEN_NAME |
Native Token Name | Test PLS |
NEXT_PUBLIC_DEPOSIT_CAP |
Maximum deposit amount | 10000000 |
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID |
WalletConnect Project ID | Optional |
``` ├── app/ # Next.js App Router │ ├── layout.tsx # Root layout with providers │ ├── page.tsx # Home page │ └── globals.css # Global styles ├── components/ # React components │ ├── ui/ # shadcn/ui components │ ├── bridge.tsx # Main bridge component │ ├── wagmi-provider.tsx # Wagmi configuration │ └── withdraw-tx-status.tsx # Withdrawal status tracker ├── config/ # Configuration files │ ├── chains.ts # Chain definitions │ └── wagmi.ts # Wagmi setup ├── hooks/ # Custom React hooks │ └── use-chain-configs.ts # Chain client hooks ├── store/ # Data persistence │ └── db.ts # Dexie database setup ├── types/ # TypeScript definitions │ └── global.d.ts # Global type declarations └── lib/ # Utility functions └── utils.ts # Helper functions ```
- Connect your wallet
- Select the "Deposit" tab
- Enter the amount to transfer
- Confirm the transaction
- Wait for confirmation on both networks
- Connect your wallet
- Select the "Withdraw" tab
- Enter the amount to transfer
- Initiate the withdrawal
- Wait ~1 hour, then prove the withdrawal
- Wait 7 days for the challenge period
- Finalize the withdrawal
```bash npm run build ```
```bash npm run type-check ```
```bash npm run lint ```
- Always verify transaction details before confirming
- Be aware of the 7-day withdrawal period for L2 to L1 transfers
- Only deposit funds you can afford to lose during testnet phase
- Keep your private keys secure and never share them
- We've added
patch-packageas a dependency to fix the viem/op-stack package. - The patch adds support for new error types:
OptimismPortal_UnprovenOptimismPortal_ProofNotOldEnough
- The patch updates the error causes mapping in the
getWithdrawalStatusfunction.
The patch is automatically applied during the npm install process thanks to the postinstall script in package.json.
If you need to manually apply the patch:
```bash npx patch-package ```
If you need to make further changes to the viem/op-stack package:
- Make your changes directly in the
node_modules/viem/op-stackdirectory - Run the following command to create/update the patch:
```bash npx patch-package viem ```
- Added missing error types to the portal2Abi
- Updated error causes mapping in getWithdrawalStatus
- Improved withdrawal status detection for newer OptimismPortal contracts
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.