115 lines
2.9 KiB
Markdown
115 lines
2.9 KiB
Markdown
# ๐ง Build Status - Anchor Program
|
|
|
|
## โ
Completed
|
|
|
|
1. **Anchor CLI Installed**
|
|
- Installed `avm` (Anchor Version Manager)
|
|
- Installed Anchor CLI version 0.32.1
|
|
- Anchor is ready to use
|
|
|
|
2. **Program ID Generated**
|
|
- Generated valid program keypair: `HrS1KpYRWfg9xUom8jnGqoRAayVCxHxukeb18C4WKAkE`
|
|
- Keypair saved to: `packages/anchor/target/deploy/betfun-keypair.json`
|
|
- Updated `declare_id!` in `lib.rs`
|
|
- Updated `Anchor.toml` with new program ID
|
|
|
|
3. **SDK Updated**
|
|
- Removed placeholder transaction
|
|
- Implemented real `create_arena` instruction building
|
|
- Uses Anchor Program interface
|
|
|
|
## โ ๏ธ Pending: Solana CLI Installation
|
|
|
|
**Issue**: Solana CLI is required to build the Anchor program. The build tools (`cargo-build-sbf`) are part of Solana CLI.
|
|
|
|
**Solution**: Install Solana CLI manually:
|
|
|
|
```bash
|
|
# Option 1: Direct install (recommended)
|
|
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
|
|
|
|
# Option 2: If curl fails, download manually from:
|
|
# https://github.com/solana-labs/solana/releases
|
|
# Then add to PATH:
|
|
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
|
```
|
|
|
|
**Verify installation**:
|
|
```bash
|
|
solana --version
|
|
cargo-build-sbf --version
|
|
```
|
|
|
|
## ๐ Next Steps
|
|
|
|
Once Solana CLI is installed:
|
|
|
|
1. **Build the program**:
|
|
```bash
|
|
cd packages/anchor
|
|
export PATH="$HOME/.local/share/solana/install/active_release/bin:$HOME/.cargo/bin:$PATH"
|
|
avm use latest
|
|
anchor build
|
|
```
|
|
|
|
2. **Copy IDL to SDK**:
|
|
```bash
|
|
mkdir -p packages/sdk/src/idl
|
|
cp packages/anchor/target/idl/betfun.json packages/sdk/src/idl/betfun.json
|
|
```
|
|
|
|
3. **Update SDK to use real IDL**:
|
|
- Edit `packages/sdk/src/index.ts`
|
|
- Replace `getMinimalIDL()` with actual IDL import:
|
|
```typescript
|
|
import idl from './idl/betfun.json';
|
|
const program = new Program(idl as any, PROGRAM_ID, provider);
|
|
```
|
|
|
|
4. **Deploy to Devnet** (optional for testing):
|
|
```bash
|
|
solana config set --url devnet
|
|
solana airdrop 2
|
|
anchor deploy --provider.cluster devnet
|
|
```
|
|
|
|
5. **Update Environment Variables**:
|
|
```bash
|
|
# .env.local
|
|
NEXT_PUBLIC_PROGRAM_ID=HrS1KpYRWfg9xUom8jnGqoRAayVCxHxukeb18C4WKAkE
|
|
```
|
|
|
|
## ๐ Current Program ID
|
|
|
|
**Program ID**: `HrS1KpYRWfg9xUom8jnGqoRAayVCxHxukeb18C4WKAkE`
|
|
|
|
**Keypair Location**: `packages/anchor/target/deploy/betfun-keypair.json`
|
|
|
|
**Note**: This program ID is already configured in:
|
|
- `packages/anchor/programs/betfun/src/lib.rs`
|
|
- `packages/anchor/Anchor.toml`
|
|
|
|
## ๐ Version Mismatch Warning
|
|
|
|
There's a version mismatch between:
|
|
- Anchor CLI: 0.32.1
|
|
- anchor-lang: 0.30.0
|
|
- @coral-xyz/anchor: ^0.30.0
|
|
|
|
**To fix** (optional, but recommended):
|
|
1. Add to `Anchor.toml`:
|
|
```toml
|
|
[toolchain]
|
|
anchor_version = "0.30.0"
|
|
```
|
|
2. Or upgrade dependencies:
|
|
```bash
|
|
cd packages/anchor
|
|
avm use 0.30.0
|
|
```
|
|
|
|
---
|
|
|
|
**Status**: โ
Program ID configured, โ ๏ธ Waiting for Solana CLI installation
|
|
|