126 lines
3.2 KiB
Markdown
126 lines
3.2 KiB
Markdown
# WETH Unwrap Script Instructions
|
|
|
|
## Quick Start
|
|
|
|
**This script will help you get your WETH back if the wrapping transaction failed.**
|
|
|
|
### Step 1: Check Prerequisites
|
|
|
|
```bash
|
|
# Install required packages if not already installed
|
|
pip install web3 eth-account python-dotenv
|
|
```
|
|
|
|
### Step 2: Verify Environment Setup
|
|
|
|
Ensure your `.env` file contains:
|
|
```env
|
|
MAINNET_RPC_URL=https://arb1.arbitrum.io/rpc
|
|
MAIN_WALLET_PRIVATE_KEY=0x_your_private_key_here
|
|
```
|
|
|
|
### Step 3: Run the Script
|
|
|
|
```bash
|
|
python unwrap_weth.py
|
|
```
|
|
|
|
## What the Script Does
|
|
|
|
1. **Checks your balances** - Shows current WETH and ETH balance
|
|
2. **Checks failed transaction** - Verifies status of your previous wrap attempt
|
|
3. **Offers unwrap options**:
|
|
- Unwrap all WETH
|
|
- Unwrap specific amount
|
|
4. **Executes with high gas** - Uses 3x gas price to ensure success
|
|
5. **Monitors transaction** - Waits up to 10 minutes for confirmation
|
|
|
|
## Important Features
|
|
|
|
✅ **Safe Transaction Management**
|
|
- Uses higher gas limits (150k gas)
|
|
- 3x gas price multiplier for faster processing
|
|
- 10-minute timeout for network congestion
|
|
- Confirmation before executing
|
|
|
|
✅ **Error Handling**
|
|
- Checks if previous transaction actually succeeded
|
|
- Handles network errors gracefully
|
|
- Detailed logging to `unwrap_weth.log`
|
|
|
|
✅ **Transaction Monitoring**
|
|
- Provides Arbiscan links for tracking
|
|
- Shows before/after balances
|
|
- Clear success/failure reporting
|
|
|
|
## Expected Output
|
|
|
|
```
|
|
=== WETH Unwrap Script ===
|
|
✅ Connected to Chain ID: 42161
|
|
Wallet: 0xYourAddress...
|
|
Current WETH Balance: 0.016483 WETH
|
|
Current ETH Balance: 1.234567 ETH
|
|
Checking your failed transaction: 0x12c38f989...
|
|
|
|
You have 0.016483 WETH available
|
|
Options:
|
|
1. Unwrap all WETH
|
|
2. Unwrap specific amount
|
|
3. Exit
|
|
|
|
Enter your choice (1, 2, or 3): 1
|
|
Confirm unwrap 0.016483 WETH? (y/N): y
|
|
Sending WETH unwrap transaction...
|
|
Transaction sent: 0xabcdef123...
|
|
Arbiscan: https://arbiscan.io/tx/0xabcdef123...
|
|
✅ WETH unwrap successful!
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### If script fails with connection error:
|
|
- Check your RPC URL in .env file
|
|
- Try a different RPC endpoint:
|
|
```env
|
|
MAINNET_RPC_URL=https://arbitrum-one.public.blastapi.io
|
|
```
|
|
|
|
### If transaction still fails:
|
|
- Network may be congested, try again later
|
|
- Check your ETH balance for gas fees
|
|
- The script automatically uses high gas prices
|
|
|
|
### If you see "No WETH balance":
|
|
- Your previous transaction may have succeeded
|
|
- Check Arbiscan for the transaction hash
|
|
- Your ETH should already be back
|
|
|
|
## Safety Notes
|
|
|
|
⚠️ **Always verify:**
|
|
- Transaction details before confirming
|
|
- Final balances after operation
|
|
- Transaction on Arbiscan
|
|
|
|
✅ **Script protections:**
|
|
- Will never exceed your WETH balance
|
|
- Asks for confirmation before any transaction
|
|
- Uses reasonable gas limits
|
|
- Logs all operations
|
|
|
|
## After Success
|
|
|
|
Once the unwrap completes:
|
|
1. Your WETH will be converted back to native ETH
|
|
2. You can check the transaction on Arbiscan
|
|
3. Your ETH balance will increase by the unwrapped amount
|
|
4. Your WETH balance will decrease to 0 (if unwrapping all)
|
|
|
|
## Support
|
|
|
|
If you encounter issues:
|
|
1. Check the `unwrap_weth.log` file for detailed error messages
|
|
2. Verify your .env file configuration
|
|
3. Ensure you have sufficient ETH for gas fees
|
|
4. Try running the script again (it will re-check transaction status) |