94 lines
2.2 KiB
Markdown
94 lines
2.2 KiB
Markdown
# ๐ง Bun/ethers v6 Compatibility Issue - Solution
|
|
|
|
## โ Problem
|
|
|
|
Bun has a compatibility issue with ethers v6's bigint handling in the `@noble/curves` library. This causes:
|
|
|
|
```
|
|
error: Expected valid bigint: 0 < bigint < curve.n
|
|
```
|
|
|
|
This happens when creating wallets with `new ethers.Wallet(privateKey)`.
|
|
|
|
## โ
Solution: Use Node.js
|
|
|
|
The application works perfectly with Node.js. Use the Node.js startup script:
|
|
|
|
```bash
|
|
cd /Users/arhansubasi/immortal-bnb-1
|
|
./start-all-node.sh
|
|
```
|
|
|
|
## ๐ Quick Start (Node.js)
|
|
|
|
### 1. Install tsx (TypeScript runner for Node.js)
|
|
|
|
```bash
|
|
npm install -g tsx
|
|
# or
|
|
bun add -g tsx
|
|
```
|
|
|
|
### 2. Run with Node.js
|
|
|
|
```bash
|
|
cd /Users/arhansubasi/immortal-bnb-1
|
|
./start-all-node.sh
|
|
```
|
|
|
|
## ๐ Alternative: Manual Start with Node.js
|
|
|
|
If the script doesn't work, start manually:
|
|
|
|
### Terminal 1: Backend
|
|
```bash
|
|
cd /Users/arhansubasi/immortal-bnb-1
|
|
npx tsx src/index.ts
|
|
```
|
|
|
|
### Terminal 2: Frontend
|
|
```bash
|
|
cd /Users/arhansubasi/immortal-bnb-1/frontend
|
|
bun run dev
|
|
# or
|
|
npm run dev
|
|
```
|
|
|
|
## ๐ฏ What's Fixed
|
|
|
|
โ
**Frontend package.json**: `start` now uses `next dev` (development mode)
|
|
โ
**Startup scripts**: Both Bun and Node.js versions available
|
|
โ
**Greenfield SDK**: Made optional to avoid blocking startup
|
|
โ
**Wallet initialization**: Better error handling
|
|
|
|
## ๐ Expected Output
|
|
|
|
When running successfully, you'll see:
|
|
|
|
```
|
|
==================================================
|
|
๐ All Services Started Successfully!
|
|
==================================================
|
|
|
|
๐ Access Points:
|
|
Frontend: http://localhost:3000
|
|
Backend: http://localhost:3001
|
|
WebSocket: ws://localhost:3001/ws
|
|
Health: http://localhost:3001/health
|
|
```
|
|
|
|
## ๐ If Still Having Issues
|
|
|
|
1. **Check Node.js version**: `node --version` (should be 18+)
|
|
2. **Install dependencies**: `npm install` in root and `npm install` in frontend
|
|
3. **Check .env**: Make sure `WALLET_PRIVATE_KEY` is set
|
|
4. **Check ports**: Make sure 3000 and 3001 are free
|
|
|
|
## ๐ Notes
|
|
|
|
- Bun works for frontend (Next.js)
|
|
- Node.js required for backend (ethers v6 compatibility)
|
|
- The Node.js script handles both automatically
|
|
- All services integrate the same way regardless of runtime
|
|
|