forge-solana-sdk 3.3.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -575
- package/dist/cli.js +9 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/simulate.d.ts +2 -0
- package/dist/commands/simulate.d.ts.map +1 -0
- package/dist/commands/simulate.js +120 -0
- package/dist/commands/simulate.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,611 +1,66 @@
|
|
|
1
|
-
# FORGE
|
|
1
|
+
# FORGE ⚡
|
|
2
2
|
|
|
3
|
-

|
|
4
|
-

|
|
3
|
+
[](https://www.npmjs.org/package/forge-solana-sdk)
|
|
4
|
+
[](https://github.com/forge-protocol/forge/blob/main/LICENSE)
|
|
6
5
|
|
|
7
|
-
**Intent-driven Solana program assembly.** Generate production-ready Anchor programs from natural language.
|
|
6
|
+
**Intent-driven Solana program assembly.** Generate production-ready Anchor programs from natural language.
|
|
8
7
|
|
|
9
|
-
> ⚡ **
|
|
8
|
+
> ⚡ **Intent → Code. No magic, just infrastructure.**
|
|
10
9
|
|
|
11
|
-
## ⚡
|
|
10
|
+
## ⚡ Quick Start
|
|
12
11
|
|
|
12
|
+
### 1. Install
|
|
13
13
|
```bash
|
|
14
14
|
npm install -g forge-solana-sdk
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
### Initialize a project
|
|
17
|
+
### 2. Create your first project
|
|
20
18
|
```bash
|
|
21
|
-
#
|
|
22
|
-
forge init my-project
|
|
23
|
-
|
|
24
|
-
# With intent-driven CPI generation
|
|
19
|
+
# Generate a token transfer program from an intent
|
|
25
20
|
forge init my-project --intent "transfer 100 tokens safely"
|
|
26
21
|
|
|
27
|
-
# With program template
|
|
28
|
-
forge init my-token --template token-program
|
|
29
|
-
|
|
30
|
-
# With specific Anchor version
|
|
31
|
-
forge init my-project --anchor-version 0.31.0
|
|
32
|
-
|
|
33
|
-
# Interactive setup wizard
|
|
34
|
-
forge interactive
|
|
35
|
-
|
|
36
|
-
# List available templates
|
|
37
|
-
forge list-templates
|
|
38
|
-
|
|
39
22
|
cd my-project
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Check status
|
|
43
|
-
```bash
|
|
44
23
|
forge status
|
|
45
24
|
```
|
|
46
25
|
|
|
47
|
-
|
|
48
|
-
- ✅ Version compatibility warnings
|
|
49
|
-
- ✅ Rust edition 2024 requirements
|
|
50
|
-
- ✅ Anchor CLI vs project version matching
|
|
51
|
-
- ✅ Network configuration
|
|
52
|
-
|
|
53
|
-
### Generate TypeScript SDK
|
|
54
|
-
```bash
|
|
55
|
-
forge generate-sdk
|
|
56
|
-
|
|
57
|
-
# Or specify custom output directory
|
|
58
|
-
forge generate-sdk ./my-sdk
|
|
59
|
-
|
|
60
|
-
# Generate modern Web3.js v2 SDK (functional, piped API)
|
|
61
|
-
forge generate-sdk --v2
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Deploy to Solana
|
|
65
|
-
```bash
|
|
66
|
-
# Deploy to devnet (default)
|
|
67
|
-
forge deploy
|
|
68
|
-
|
|
69
|
-
# Deploy to specific environment
|
|
70
|
-
forge deploy --env devnet
|
|
71
|
-
forge deploy --env mainnet-beta
|
|
72
|
-
|
|
73
|
-
# Deploy to local validator
|
|
74
|
-
forge deploy --env localnet
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Environment Support:**
|
|
78
|
-
- ✅ **devnet**: Development network (default)
|
|
79
|
-
- ✅ **mainnet-beta**: Production network with safety checks
|
|
80
|
-
- ✅ **localnet**: Local Solana validator
|
|
81
|
-
- ✅ Auto-updates Anchor.toml with environment RPC URLs
|
|
82
|
-
- ✅ Mainnet deployment requires explicit confirmation
|
|
83
|
-
|
|
84
|
-
### Security Hardening
|
|
26
|
+
### 3. Harden and Simulate
|
|
85
27
|
```bash
|
|
28
|
+
# Apply security safeguards
|
|
86
29
|
forge harden
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
**Safeguards include:**
|
|
90
|
-
- 🛡️ **Macro Integration**: Injects `require_signer!`, `assert_owned_by!`, and `checked_math!`
|
|
91
|
-
- 📋 **Config Hardening**: Enforces strict Anchor linting and PDA safety in `Anchor.toml`
|
|
92
|
-
- 🔒 **Security Modules**: Generates a local `security.rs` for project-specific rules
|
|
93
|
-
- 📦 **Runtime Safety**: Automatically adds `forge-runtime` to program dependencies
|
|
94
|
-
|
|
95
|
-
### Security Audit
|
|
96
|
-
```bash
|
|
97
|
-
forge audit
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
**Comprehensive Security Checks:**
|
|
101
|
-
- 🔍 **Critical Issues**: Missing ownership validation, unsafe code
|
|
102
|
-
- ⚠️ **High Priority**: Improper PDA derivation, missing constraints
|
|
103
|
-
- 📊 **Performance**: Expensive operations, large account data
|
|
104
|
-
- 🛡️ **Access Control**: Signer constraints, PDA bumps
|
|
105
|
-
- 📋 **Configuration**: Wallet paths, cluster settings
|
|
106
|
-
|
|
107
|
-
### Testing Framework
|
|
108
|
-
```bash
|
|
109
|
-
forge test
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**Automated Test Generation:**
|
|
113
|
-
- 🧪 **Comprehensive Coverage**: Program initialization, all instructions, edge cases
|
|
114
|
-
- 🔐 **Security Testing**: Access control validation, error condition handling
|
|
115
|
-
- 💰 **Token Operations**: SPL token transfer, mint, burn functionality
|
|
116
|
-
- 🎯 **PDA Validation**: Proper derived address generation and validation
|
|
117
|
-
- ⚡ **Performance Tests**: Gas usage analysis, large data handling
|
|
118
|
-
|
|
119
|
-
**Generated Test Suite Includes:**
|
|
120
|
-
- ✅ Program initialization and IDL validation
|
|
121
|
-
- ✅ All instruction handlers with sensible defaults
|
|
122
|
-
- ✅ Token program integration tests
|
|
123
|
-
- ✅ PDA derivation correctness
|
|
124
|
-
- ✅ Error condition testing
|
|
125
|
-
- ✅ Access control enforcement
|
|
126
|
-
|
|
127
|
-
### Contract Verification
|
|
128
|
-
```bash
|
|
129
|
-
forge verify
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**Source Code Transparency:**
|
|
133
|
-
- 📤 **Solana Explorer Upload**: Source code and IDL verification
|
|
134
|
-
- 🔍 **Trust Building**: Prove deployed code matches published source
|
|
135
|
-
- 🏷️ **Metadata Publishing**: Program name, version, description, repository
|
|
136
|
-
- 🔗 **Explorer Links**: Direct links to verified contract pages
|
|
137
|
-
|
|
138
|
-
**Verification Process:**
|
|
139
|
-
- ✅ Build program and generate IDL
|
|
140
|
-
- ✅ Collect all source files and metadata
|
|
141
|
-
- ✅ Prepare verification bundle
|
|
142
|
-
- ✅ Generate Solana Explorer verification links
|
|
143
|
-
- ✅ Save local verification record
|
|
144
|
-
|
|
145
|
-
### Program Templates
|
|
146
|
-
```bash
|
|
147
|
-
# List all available templates
|
|
148
|
-
forge list-templates
|
|
149
|
-
|
|
150
|
-
# Create project from template
|
|
151
|
-
forge init my-token --template token-program
|
|
152
|
-
forge init my-nft --template nft-marketplace
|
|
153
|
-
forge init my-dao --template dao-governance
|
|
154
|
-
```
|
|
155
30
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
- 🖼️ **nft-marketplace**: NFT marketplace with royalties
|
|
159
|
-
- 🗳️ **dao-governance**: DAO with proposals and voting
|
|
160
|
-
- 💎 **staking-rewards**: Token staking with rewards
|
|
161
|
-
- 🔄 **escrow-swap**: Trustless token swap
|
|
162
|
-
- ⏰ **token-vesting**: Time-based vesting schedules
|
|
163
|
-
- 🚀 **moonshot-fair-launch**: Moonshot-compatible bonding curve
|
|
164
|
-
- 💊 **pumpfun-launch**: Standard Pump.fun meme token
|
|
165
|
-
|
|
166
|
-
### Program Upgrade & Migration
|
|
167
|
-
```bash
|
|
168
|
-
# Upgrade to latest Anchor version
|
|
169
|
-
forge upgrade
|
|
170
|
-
|
|
171
|
-
# Upgrade to specific version
|
|
172
|
-
forge upgrade 0.32.1
|
|
173
|
-
|
|
174
|
-
# Migration assistant (with additional checks)
|
|
175
|
-
forge migrate 0.32.1
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Performance Analysis
|
|
179
|
-
```bash
|
|
180
|
-
forge profile
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**Performance Insights:**
|
|
184
|
-
- ⚡ Compute unit usage analysis
|
|
185
|
-
- 💰 Cost estimation per transaction
|
|
186
|
-
- 🎯 Optimization suggestions
|
|
187
|
-
- 📊 Gas usage reports
|
|
188
|
-
|
|
189
|
-
### Program Monitoring
|
|
190
|
-
```bash
|
|
191
|
-
forge monitor
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Monitoring Features:**
|
|
195
|
-
- 📈 Real-time transaction volume
|
|
196
|
-
- 🔍 Error rate tracking
|
|
197
|
-
- 👥 Active user analytics
|
|
198
|
-
- 📊 Account growth metrics
|
|
199
|
-
|
|
200
|
-
### Interactive Setup
|
|
201
|
-
```bash
|
|
202
|
-
forge interactive
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
**Guided Wizard:**
|
|
206
|
-
- 📦 Project name selection
|
|
207
|
-
- 📚 Template selection
|
|
208
|
-
- 💡 Intent-driven generation
|
|
209
|
-
- 🔧 Anchor version configuration
|
|
210
|
-
|
|
211
|
-
### Documentation Generation
|
|
212
|
-
```bash
|
|
213
|
-
forge docs
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
**Auto-Generated Docs:**
|
|
217
|
-
- 📖 API documentation from IDL
|
|
218
|
-
- 📋 Instruction reference
|
|
219
|
-
- 🏗️ Account structure docs
|
|
220
|
-
- 🔗 Integration examples
|
|
221
|
-
|
|
222
|
-
### Code Quality Analysis
|
|
223
|
-
```bash
|
|
224
|
-
forge quality
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
**Quality Metrics:**
|
|
228
|
-
- 📊 Code complexity scoring
|
|
229
|
-
- 📏 Function/struct counts
|
|
230
|
-
- ✅ Maintainability assessment
|
|
231
|
-
- 💡 Refactoring recommendations
|
|
232
|
-
|
|
233
|
-
### Cost Calculator
|
|
234
|
-
```bash
|
|
235
|
-
forge cost
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
**Cost Analysis:**
|
|
239
|
-
- 💾 Deployment costs (~2.5 SOL)
|
|
240
|
-
- ⚡ Per-transaction fees
|
|
241
|
-
- 📈 Monthly operation estimates
|
|
242
|
-
- 💡 Optimization tips
|
|
243
|
-
|
|
244
|
-
### Keypair Management
|
|
245
|
-
```bash
|
|
246
|
-
# Generate new keypair
|
|
247
|
-
forge keypair generate
|
|
248
|
-
|
|
249
|
-
# Generate to specific path
|
|
250
|
-
forge keypair generate ./my-keypair.json
|
|
251
|
-
|
|
252
|
-
# Import keypair
|
|
253
|
-
forge keypair import ./keypair.json
|
|
254
|
-
|
|
255
|
-
# Show keypair info
|
|
256
|
-
forge keypair info
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Network Management
|
|
260
|
-
```bash
|
|
261
|
-
# Switch network
|
|
262
|
-
forge network switch devnet
|
|
263
|
-
forge network switch mainnet-beta
|
|
264
|
-
|
|
265
|
-
# Check network status
|
|
266
|
-
forge network status
|
|
267
|
-
|
|
268
|
-
# Test RPC connection
|
|
269
|
-
forge network test
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Program Search
|
|
273
|
-
```bash
|
|
274
|
-
# Search for programs
|
|
275
|
-
forge search token program
|
|
276
|
-
forge search nft marketplace
|
|
31
|
+
# Preview performance and logs without spending SOL
|
|
32
|
+
forge simulate
|
|
277
33
|
```
|
|
278
34
|
|
|
279
|
-
###
|
|
35
|
+
### 4. Generate SDK
|
|
280
36
|
```bash
|
|
281
|
-
|
|
37
|
+
# Generate modern Web3.js v2 functional SDK
|
|
38
|
+
forge generate-sdk --v2
|
|
282
39
|
```
|
|
283
40
|
|
|
284
|
-
|
|
285
|
-
- 🔗 Solana Explorer integration
|
|
286
|
-
- 📊 Transaction volume tracking
|
|
287
|
-
- 📈 User activity metrics
|
|
41
|
+
## 🎯 Key Features
|
|
288
42
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
```
|
|
43
|
+
- 💡 **Intent-Driven**: Transform natural language ("mint tokens", "create metadata") into optimized Anchor code.
|
|
44
|
+
- 🛡️ **Security-First**: Integrated `forge harden` system with battery-included macros (`require_signer!`, `assert_owned_by!`).
|
|
45
|
+
- 🚀 **Modern Standards**: Native support for **Web3.js v2**, Anchor 0.32+, and Rust Edition 2024.
|
|
46
|
+
- 🧪 **Complete Workflow**: Auto-generated tests, security audits, performance profiling, and one-command deployment.
|
|
294
47
|
|
|
295
|
-
|
|
296
|
-
- ✅ Auto-test on push/PR
|
|
297
|
-
- ✅ Security audit checks
|
|
298
|
-
- ✅ Code quality validation
|
|
299
|
-
- ✅ Auto-deploy to devnet
|
|
48
|
+
## 📚 Documentation
|
|
300
49
|
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
forge update
|
|
304
|
-
```
|
|
50
|
+
Detailed guides and references:
|
|
305
51
|
|
|
306
|
-
**
|
|
307
|
-
-
|
|
308
|
-
-
|
|
309
|
-
- ✅ Shows clear progress feedback
|
|
310
|
-
- ✅ No manual version management required
|
|
52
|
+
- [**Command Reference**](./docs/COMMANDS.md) - Detailed guide for all CLI commands.
|
|
53
|
+
- [**SDK Generation**](./docs/SDK.md) - How to build and use auto-generated SDKs (v1 & v2).
|
|
54
|
+
- [**Troubleshooting**](./docs/COMMANDS.md#forge-status) - Common issues and how to fix them.
|
|
311
55
|
|
|
312
56
|
## 📋 Prerequisites
|
|
313
57
|
|
|
314
58
|
- **Node.js** 18+
|
|
315
|
-
- **Rust** 1.85.0+ (
|
|
316
|
-
- **Solana CLI**
|
|
317
|
-
- **Anchor CLI** 0.29.0+
|
|
318
|
-
|
|
319
|
-
⚠️ **Important**: Rust 1.85.0+ is required for modern Anchor dependencies. Update with: `rustup update stable`
|
|
320
|
-
|
|
321
|
-
## 🎯 What FORGE Does
|
|
322
|
-
|
|
323
|
-
FORGE transforms natural language intents into production-ready Solana programs. Modern, safe, and future-proof code generation.
|
|
324
|
-
|
|
325
|
-
### Core Features
|
|
326
|
-
- ✅ **Intent-Driven Generation**: `"transfer 100 tokens safely"` → Modern CPI code
|
|
327
|
-
- ✅ **Program Templates Library**: 6 battle-tested templates (Token, NFT, DAO, Staking, Escrow, Vesting)
|
|
328
|
-
- ✅ **Automated Testing Framework**: Comprehensive test suites with security validation
|
|
329
|
-
- ✅ **Contract Verification**: Source code transparency on Solana Explorer
|
|
330
|
-
- ✅ **Multi-Environment Deployment**: Deploy to devnet/mainnet/localnet with safety checks
|
|
331
|
-
- ✅ **Security Audit Tools**: Automated security analysis (--deep for advanced checks)
|
|
332
|
-
- ✅ **Program Upgrade System**: Version management and migration assistance
|
|
333
|
-
- ✅ **Performance Profiler**: Compute unit analysis and optimization suggestions
|
|
334
|
-
- ✅ **Program Monitoring**: Real-time analytics and activity tracking
|
|
335
|
-
- ✅ **Interactive CLI**: Guided project setup wizard
|
|
336
|
-
- ✅ **Documentation Generator**: Auto-generate API docs from IDL
|
|
337
|
-
- ✅ **Code Quality Metrics**: Complexity analysis and maintainability scoring
|
|
338
|
-
- ✅ **Cost Calculator**: Deployment and operation cost estimation
|
|
339
|
-
- ✅ **Keypair Management**: Secure keypair generation and import utilities
|
|
340
|
-
- ✅ **Network Utilities**: Switch between networks, test connections
|
|
341
|
-
- ✅ **Program Search**: Find verified programs and best practices
|
|
342
|
-
- ✅ **CI/CD Integration**: GitHub Actions workflow generation
|
|
343
|
-
- ✅ **Fair-Launch Support**: Integrated Moonshot & Pump.fun launching
|
|
344
|
-
- ✅ **Security Hardening**: Auto-inject safeguards with `forge harden`
|
|
345
|
-
- ✅ **Complete Anchor Workspace**: Ready-to-build projects with proper structure
|
|
346
|
-
- ✅ **Client SDK Generation**: Auto-generated Legacy & **Web3.js v2** SDKs
|
|
347
|
-
- ✅ **Modern CPI Helpers**: `transfer_checked`, `mint_to`, PDA signers with `ctx.bumps`
|
|
348
|
-
- ✅ **Version Compatibility**: Auto-aligns Anchor versions (CLI vs project)
|
|
349
|
-
- ✅ **Production Ready**: IDL features, proper dependencies, deployment configs
|
|
350
|
-
|
|
351
|
-
### Generated Code Quality
|
|
352
|
-
- 🔒 **Safe Operations**: Uses `anchor_spl::token_interface` for Token & Token-2022
|
|
353
|
-
- 🎯 **Modern Patterns**: `InterfaceAccount`, `Interface` types (Anchor 0.31+ compatible)
|
|
354
|
-
- ⚡ **Optimized**: Minimal boilerplate, maximum functionality
|
|
355
|
-
- 🚀 **Future-Proof**: Edition 2024 compatible, latest Anchor best practices
|
|
356
|
-
|
|
357
|
-
### Supported CPI Intents
|
|
358
|
-
- 💸 **Token Transfers**: `"transfer 100 tokens safely"` → `transfer_checked`
|
|
359
|
-
- 🪙 **Token Minting**: `"mint 500 tokens to user"` → `mint_to` with PDA authority
|
|
360
|
-
- 🎫 **ATA Creation**: `"create associated token account"` → `create_associated_token_account`
|
|
361
|
-
- 📊 **Token Metadata**: `"create metadata for token"` → MPL Token Metadata CPIs
|
|
362
|
-
|
|
363
|
-
**Example Generated Code:**
|
|
364
|
-
```rust
|
|
365
|
-
// From: forge init --intent "transfer 100 tokens safely"
|
|
366
|
-
token_interface::transfer_checked(
|
|
367
|
-
CpiContext::new(
|
|
368
|
-
ctx.accounts.token_program.to_account_info(),
|
|
369
|
-
TransferChecked {
|
|
370
|
-
from: ctx.accounts.from.to_account_info(),
|
|
371
|
-
to: ctx.accounts.to.to_account_info(),
|
|
372
|
-
authority: ctx.accounts.authority.to_account_info(),
|
|
373
|
-
mint: ctx.accounts.mint.to_account_info(),
|
|
374
|
-
},
|
|
375
|
-
),
|
|
376
|
-
100, // amount
|
|
377
|
-
decimals, // automatic decimals lookup
|
|
378
|
-
)?;
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
**Client SDK Generated:**
|
|
382
|
-
```typescript
|
|
383
|
-
// Auto-generated TypeScript client
|
|
384
|
-
const client = new TokenTransferClient(connection, wallet);
|
|
385
|
-
await client.transferTokens(amount, from, to, mint, authority);
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
## 🚀 SDK Generation
|
|
389
|
-
|
|
390
|
-
FORGE can automatically generate production-ready TypeScript SDKs from your Anchor programs. The generated SDK includes:
|
|
391
|
-
|
|
392
|
-
- **Type-Safe Client**: Full TypeScript client with proper types for all instructions and accounts
|
|
393
|
-
- **PDA Helpers**: Utility functions to find program-derived addresses
|
|
394
|
-
- **Package Template**: Ready-to-publish npm package with proper dependencies
|
|
395
|
-
- **Modern Standards**: Uses latest Anchor patterns and best practices
|
|
396
|
-
- **Web3.js v2 Support**: Functional, piped API for better performance and tree-shaking
|
|
397
|
-
|
|
398
|
-
### SDK Styles
|
|
399
|
-
- **Legacy (default)**: Anchor-based class-based client
|
|
400
|
-
- **Web3.js v2 (`--v2`)**: Functional client using the latest Solana standards
|
|
401
|
-
|
|
402
|
-
### SDK Features
|
|
403
|
-
|
|
404
|
-
- ✅ **Zero-config generation** from Anchor IDL
|
|
405
|
-
- ✅ **Type-safe method calls** with full IntelliSense
|
|
406
|
-
- ✅ **PDA finder utilities** for program addresses
|
|
407
|
-
- ✅ **Production-ready package** structure
|
|
408
|
-
- ✅ **Anchor integration** with latest patterns
|
|
409
|
-
|
|
410
|
-
### Generated SDK Structure
|
|
411
|
-
|
|
412
|
-
```
|
|
413
|
-
my-program-sdk/
|
|
414
|
-
├── package.json # Ready-to-publish npm package
|
|
415
|
-
├── types.ts # Auto-generated TypeScript types
|
|
416
|
-
├── client.ts # Program interaction client
|
|
417
|
-
├── pdas.ts # PDA finder utilities
|
|
418
|
-
├── index.ts # Main exports
|
|
419
|
-
└── tsconfig.json # TypeScript configuration
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
### Using Generated SDKs
|
|
423
|
-
|
|
424
|
-
```typescript
|
|
425
|
-
import { MyProgramClient } from 'my-program-sdk';
|
|
426
|
-
import { Connection, Keypair } from '@solana/web3.js';
|
|
427
|
-
|
|
428
|
-
// Initialize client
|
|
429
|
-
const connection = new Connection('https://api.mainnet-beta.solana.com');
|
|
430
|
-
const client = new MyProgramClient(connection);
|
|
431
|
-
|
|
432
|
-
// Call program methods with full type safety
|
|
433
|
-
const txId = await client.myInstruction({
|
|
434
|
-
accounts: {
|
|
435
|
-
user: userPublicKey,
|
|
436
|
-
// ... other accounts
|
|
437
|
-
},
|
|
438
|
-
args: {
|
|
439
|
-
amount: 1000,
|
|
440
|
-
// ... other args
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
## 🛠️ Troubleshooting
|
|
446
|
-
|
|
447
|
-
### Version Compatibility Issues
|
|
448
|
-
If you encounter build errors:
|
|
449
|
-
|
|
450
|
-
1. **Update Rust**: `rustup update stable` (requires 1.85.0+)
|
|
451
|
-
2. **Check versions**: `forge status` (shows mismatches)
|
|
452
|
-
3. **Specify version**: `forge init --anchor-version 0.32.1`
|
|
453
|
-
|
|
454
|
-
### Common Errors
|
|
455
|
-
- `edition2024` errors → Update Rust to 1.85.0+
|
|
456
|
-
- Version mismatches → Use `forge status` to check alignment
|
|
457
|
-
- Build failures → Ensure Anchor CLI matches project versions
|
|
458
|
-
|
|
459
|
-
## 🚫 What FORGE Does NOT Do
|
|
460
|
-
|
|
461
|
-
FORGE does not:
|
|
462
|
-
- Host your code
|
|
463
|
-
- Manage your keys
|
|
464
|
-
- Abstract blockchain risks
|
|
465
|
-
- Hold your hand
|
|
466
|
-
|
|
467
|
-
If you want magic, look elsewhere.
|
|
468
|
-
|
|
469
|
-
## 📚 Requirements
|
|
470
|
-
|
|
471
|
-
You must have:
|
|
472
|
-
- Basic Rust knowledge
|
|
473
|
-
- Understanding of Solana concepts
|
|
474
|
-
- Your own wallet and keys
|
|
475
|
-
- Test SOL for deployment
|
|
476
|
-
|
|
477
|
-
## 🔧 Commands
|
|
478
|
-
|
|
479
|
-
| Command | Description |
|
|
480
|
-
|---------|-------------|
|
|
481
|
-
| `forge init <name>` | Create new Anchor project with optional intent |
|
|
482
|
-
| `forge init <name> --intent "transfer tokens"` | Generate CPI code from natural language |
|
|
483
|
-
| `forge init <name> --anchor-version 0.31.0` | Specify Anchor version for project |
|
|
484
|
-
| `forge generate-sdk [dir]` | Generate TypeScript SDK from Anchor program |
|
|
485
|
-
| `forge status` | Check environment, versions, and compatibility |
|
|
486
|
-
| `forge update` | Update FORGE to latest version |
|
|
487
|
-
| `forge deploy` | Deploy program to Solana network |
|
|
488
|
-
| `forge harden` | Apply security safeguards to your project |
|
|
489
|
-
|
|
490
|
-
## 📖 Examples
|
|
491
|
-
|
|
492
|
-
### Basic Project Creation
|
|
493
|
-
```bash
|
|
494
|
-
# Simple Anchor project
|
|
495
|
-
forge init my-project
|
|
496
|
-
cd my-project
|
|
497
|
-
forge status
|
|
498
|
-
```
|
|
499
|
-
|
|
500
|
-
### Intent-Driven CPI Generation
|
|
501
|
-
```bash
|
|
502
|
-
# Generate token transfer program
|
|
503
|
-
forge init token-transfer --intent "transfer 100 tokens safely"
|
|
504
|
-
cd token-transfer
|
|
505
|
-
|
|
506
|
-
# Modern CPI code is automatically generated:
|
|
507
|
-
# - transfer_checked with decimals validation
|
|
508
|
-
# - InterfaceAccount<TokenAccount> types
|
|
509
|
-
# - Proper error handling
|
|
510
|
-
|
|
511
|
-
anchor build # ✅ Works immediately
|
|
512
|
-
anchor test # ✅ Ready for testing
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
### Client SDK Generation
|
|
516
|
-
```bash
|
|
517
|
-
# Generate program with auto-generated TypeScript SDK
|
|
518
|
-
forge init token-transfer --intent "transfer tokens safely"
|
|
519
|
-
|
|
520
|
-
# Project structure includes:
|
|
521
|
-
# ├── programs/token-transfer/src/lib.rs # Anchor program
|
|
522
|
-
# └── client/ # Auto-generated SDK
|
|
523
|
-
# ├── index.ts # Client class
|
|
524
|
-
# ├── idl.ts # Program IDL
|
|
525
|
-
# ├── package.json # SDK package
|
|
526
|
-
# └── tsconfig.json # TypeScript config
|
|
527
|
-
|
|
528
|
-
# Build and use the SDK
|
|
529
|
-
cd client && npm install && npm run build
|
|
530
|
-
|
|
531
|
-
# Use in your frontend/dApp:
|
|
532
|
-
import { TokenTransferClient } from './client';
|
|
533
|
-
const client = new TokenTransferClient(connection, wallet);
|
|
534
|
-
await client.transferTokens(amount, from, to, mint, authority);
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
### SDK Generation
|
|
538
|
-
```bash
|
|
539
|
-
# Generate SDK after building your program
|
|
540
|
-
cd my-project
|
|
541
|
-
anchor build
|
|
542
|
-
forge generate-sdk
|
|
543
|
-
|
|
544
|
-
# SDK appears in ./sdk/ directory
|
|
545
|
-
cd sdk
|
|
546
|
-
npm install
|
|
547
|
-
npm run build
|
|
548
|
-
|
|
549
|
-
# Publish your SDK
|
|
550
|
-
npm publish
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
### Advanced Usage
|
|
554
|
-
```bash
|
|
555
|
-
# Mint tokens with PDA authority
|
|
556
|
-
forge init token-minter --intent "mint 500 tokens to user"
|
|
557
|
-
|
|
558
|
-
# Custom Anchor version
|
|
559
|
-
forge init legacy-project --anchor-version 0.30.1
|
|
560
|
-
|
|
561
|
-
# Stay updated
|
|
562
|
-
forge update
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
## 🏗️ Architecture
|
|
566
|
-
|
|
567
|
-
```
|
|
568
|
-
FORGE Ecosystem
|
|
569
|
-
├── forge-solana-sdk (npm) - Node.js CLI tool
|
|
570
|
-
│ ├── Intent parsing & code generation
|
|
571
|
-
│ ├── Version compatibility management
|
|
572
|
-
│ ├── Project scaffolding
|
|
573
|
-
│ └── Deployment orchestration
|
|
574
|
-
│
|
|
575
|
-
└── forge-runtime (crates.io) - Rust runtime library
|
|
576
|
-
└── Future: Enhanced runtime capabilities
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
**Current Focus**: CLI-first approach with intent-driven generation. Runtime library for future enhancements.
|
|
580
|
-
|
|
581
|
-
## 🐛 Support
|
|
582
|
-
|
|
583
|
-
**FORGE is infrastructure, not a tutorial.** If you need help:
|
|
584
|
-
|
|
585
|
-
### Getting Help
|
|
586
|
-
1. **Run diagnostics first**: `forge status` (includes version compatibility checks)
|
|
587
|
-
2. **Check prerequisites**: Ensure Rust 1.85.0+, Node 18+, Anchor CLI installed
|
|
588
|
-
3. **File an issue**: Include `forge status` output and error details
|
|
589
|
-
4. **Describe expected vs actual**: What did you expect? What happened instead?
|
|
590
|
-
|
|
591
|
-
### Before Asking
|
|
592
|
-
- ✅ Have you run `forge status`?
|
|
593
|
-
- ✅ Is your Rust version 1.85.0+?
|
|
594
|
-
- ✅ Are you in an Anchor project directory?
|
|
595
|
-
- ✅ Have you tried `forge update`?
|
|
596
|
-
|
|
597
|
-
**If you don't understand Solana concepts, learn Solana first.** FORGE assumes basic blockchain knowledge.
|
|
59
|
+
- **Rust** 1.85.0+ (`rustup update stable`)
|
|
60
|
+
- **Solana & Anchor CLI**
|
|
598
61
|
|
|
599
62
|
## 📄 License
|
|
600
|
-
|
|
601
|
-
MIT - [https://github.com/forge-protocol/forge/blob/main/LICENSE](https://github.com/forge-protocol/forge/blob/main/LICENSE)
|
|
602
|
-
|
|
603
|
-
## 🔗 Links
|
|
604
|
-
|
|
605
|
-
- **Homepage**: [https://github.com/forge-protocol/forge](https://github.com/forge-protocol/forge)
|
|
606
|
-
- **NPM Package**: [https://www.npmjs.com/package/forge-solana-sdk](https://www.npmjs.com/package/forge-solana-sdk)
|
|
607
|
-
- **Issues**: [https://github.com/forge-protocol/forge/issues](https://github.com/forge-protocol/forge/issues)
|
|
63
|
+
MIT
|
|
608
64
|
|
|
609
65
|
---
|
|
610
|
-
|
|
611
|
-
**FORGE: Intent → Code. No magic, just infrastructure.** ⚡
|
|
66
|
+
**FORGE generates code, not excuses.** 🔗 [GitHub](https://github.com/forge-protocol/forge)
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ const verify_js_1 = require("./commands/verify.js");
|
|
|
13
13
|
const upgrade_js_1 = require("./commands/upgrade.js");
|
|
14
14
|
const profile_js_1 = require("./commands/profile.js");
|
|
15
15
|
const monitor_js_1 = require("./commands/monitor.js");
|
|
16
|
+
const simulate_js_1 = require("./commands/simulate.js");
|
|
16
17
|
const interactive_js_1 = require("./commands/interactive.js");
|
|
17
18
|
const docs_js_1 = require("./commands/docs.js");
|
|
18
19
|
const migrate_js_1 = require("./commands/migrate.js");
|
|
@@ -27,7 +28,7 @@ const program = new commander_1.Command();
|
|
|
27
28
|
program
|
|
28
29
|
.name('forge')
|
|
29
30
|
.description('FORGE - Intent-driven app assembly on Solana')
|
|
30
|
-
.version('3.
|
|
31
|
+
.version('3.4.1');
|
|
31
32
|
program
|
|
32
33
|
.command('init [projectName]')
|
|
33
34
|
.description('Initialize a new FORGE project')
|
|
@@ -81,6 +82,12 @@ program
|
|
|
81
82
|
.action(async () => {
|
|
82
83
|
await (0, profile_js_1.profileCommand)();
|
|
83
84
|
});
|
|
85
|
+
program
|
|
86
|
+
.command('simulate [instruction]')
|
|
87
|
+
.description('Simulate a program instruction to preview logs and CU usage')
|
|
88
|
+
.action(async (instruction) => {
|
|
89
|
+
await (0, simulate_js_1.simulateCommand)(instruction);
|
|
90
|
+
});
|
|
84
91
|
program
|
|
85
92
|
.command('monitor')
|
|
86
93
|
.description('Monitor program activity and analytics')
|
|
@@ -177,6 +184,7 @@ program.on('--help', () => {
|
|
|
177
184
|
console.log(' test Generate and run comprehensive tests');
|
|
178
185
|
console.log(' audit Run security audit (--deep for advanced)');
|
|
179
186
|
console.log(' harden Apply security safeguards to your project');
|
|
187
|
+
console.log(' simulate Simulate instructions to preview logs and CUs');
|
|
180
188
|
console.log(' quality Analyze code quality metrics');
|
|
181
189
|
console.log(' profile Analyze performance and compute units');
|
|
182
190
|
console.log(' docs Generate API documentation');
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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AC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate.d.ts","sourceRoot":"","sources":["../../src/commands/simulate.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyG7E"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.simulateCommand = simulateCommand;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
7
|
+
async function simulateCommand(instructionName) {
|
|
8
|
+
console.log('🔮 FORGE Instruction Simulator\n');
|
|
9
|
+
try {
|
|
10
|
+
if (!(0, fs_1.existsSync)('Anchor.toml')) {
|
|
11
|
+
console.error('❌ Not in an Anchor project directory');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
// 1. Load IDL to find instructions
|
|
15
|
+
const programName = getProgramName();
|
|
16
|
+
const idlPath = (0, path_1.join)('target', 'idl', `${programName}.json`);
|
|
17
|
+
if (!(0, fs_1.existsSync)(idlPath)) {
|
|
18
|
+
console.error('❌ IDL not found. Run "anchor build" first.');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
const idl = JSON.parse((0, fs_1.readFileSync)(idlPath, 'utf8'));
|
|
22
|
+
const instructions = idl.instructions || [];
|
|
23
|
+
if (instructions.length === 0) {
|
|
24
|
+
console.error('❌ No instructions found in IDL');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
// 2. Select instruction to simulate
|
|
28
|
+
let targetIx = null;
|
|
29
|
+
if (instructionName) {
|
|
30
|
+
targetIx = instructions.find((ix) => ix.name === instructionName);
|
|
31
|
+
if (!targetIx) {
|
|
32
|
+
console.error(`❌ Instruction "${instructionName}" not found in IDL`);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// Use the first one for now (or could be interactive)
|
|
38
|
+
targetIx = instructions[0];
|
|
39
|
+
console.log(`💡 No instruction specified, simulating first instruction: "${targetIx.name}"`);
|
|
40
|
+
}
|
|
41
|
+
console.log(`🛠️ Simulating instruction: ${targetIx.name}`);
|
|
42
|
+
console.log(`📋 Accounts required: ${targetIx.accounts.length}`);
|
|
43
|
+
console.log(`📦 Arguments: ${targetIx.args.length}\n`);
|
|
44
|
+
// 3. Setup Connection
|
|
45
|
+
const rpcUrl = getRpcUrl();
|
|
46
|
+
const connection = new web3_js_1.Connection(rpcUrl);
|
|
47
|
+
console.log(`🌐 Connected to: ${rpcUrl}`);
|
|
48
|
+
console.log('🚀 Running simulation...\n');
|
|
49
|
+
// 4. Create a dummy transaction for simulation
|
|
50
|
+
// Note: This is an approximation. Real simulation requires valid accounts and signatures.
|
|
51
|
+
const programId = new web3_js_1.PublicKey(getProgramId());
|
|
52
|
+
// Create zeroed accounts for simulation
|
|
53
|
+
const keys = targetIx.accounts.map((acc) => ({
|
|
54
|
+
pubkey: web3_js_1.PublicKey.default, // Dummy address
|
|
55
|
+
isSigner: acc.isSigner,
|
|
56
|
+
isWritable: acc.isMut,
|
|
57
|
+
}));
|
|
58
|
+
const ix = new web3_js_1.TransactionInstruction({
|
|
59
|
+
keys,
|
|
60
|
+
programId,
|
|
61
|
+
data: Buffer.alloc(0), // Dummy data
|
|
62
|
+
});
|
|
63
|
+
const tx = new web3_js_1.Transaction().add(ix);
|
|
64
|
+
tx.feePayer = web3_js_1.PublicKey.default;
|
|
65
|
+
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
|
|
66
|
+
const simulation = await connection.simulateTransaction(tx);
|
|
67
|
+
// 5. Display Results
|
|
68
|
+
if (simulation.value.err) {
|
|
69
|
+
console.log('❌ Simulation FAILED');
|
|
70
|
+
console.log(` Error: ${JSON.stringify(simulation.value.err)}`);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
console.log('✅ Simulation SUCCESSFUL');
|
|
74
|
+
}
|
|
75
|
+
console.log(`\n📊 Performance Metrics:`);
|
|
76
|
+
console.log(` • Compute Units Consumed: ${simulation.value.unitsConsumed || 'Unknown'}`);
|
|
77
|
+
if (simulation.value.logs && simulation.value.logs.length > 0) {
|
|
78
|
+
console.log(`\n📜 Program Logs:`);
|
|
79
|
+
simulation.value.logs.forEach(log => {
|
|
80
|
+
if (log.includes('Program log:')) {
|
|
81
|
+
console.log(` • ${log.replace('Program log: ', '')}`);
|
|
82
|
+
}
|
|
83
|
+
else if (log.includes('Program return:')) {
|
|
84
|
+
console.log(` 💎 ${log}`);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
console.log(` ${log}`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
console.log('\n💡 Note: Simulation used default/dummy accounts. Real execution may vary.');
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error('❌ Simulation failed');
|
|
95
|
+
console.error(`Error: ${error.message}`);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function getProgramName() {
|
|
100
|
+
const anchorToml = (0, fs_1.readFileSync)('Anchor.toml', 'utf8');
|
|
101
|
+
const match = anchorToml.match(/\[programs\.localnet\]\s*\n([^\s]+)\s*=/);
|
|
102
|
+
return match ? match[1] : '';
|
|
103
|
+
}
|
|
104
|
+
function getProgramId() {
|
|
105
|
+
const anchorToml = (0, fs_1.readFileSync)('Anchor.toml', 'utf8');
|
|
106
|
+
const match = anchorToml.match(/\[programs\.localnet\]\s*([^=]+)\s*=\s*"([^"]+)"/);
|
|
107
|
+
return match ? match[2] : '';
|
|
108
|
+
}
|
|
109
|
+
function getRpcUrl() {
|
|
110
|
+
const anchorToml = (0, fs_1.readFileSync)('Anchor.toml', 'utf8');
|
|
111
|
+
const match = anchorToml.match(/cluster\s*=\s*"([^"]+)"/);
|
|
112
|
+
const cluster = match ? match[1] : 'localnet';
|
|
113
|
+
const urls = {
|
|
114
|
+
localnet: 'http://127.0.0.1:8899',
|
|
115
|
+
devnet: 'https://api.devnet.solana.com',
|
|
116
|
+
'mainnet-beta': 'https://api.mainnet-beta.solana.com'
|
|
117
|
+
};
|
|
118
|
+
return urls[cluster] || urls.localnet;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=simulate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate.js","sourceRoot":"","sources":["../../src/commands/simulate.ts"],"names":[],"mappings":";;AAIA,0CAyGC;AA7GD,2BAA8C;AAC9C,+BAA4B;AAC5B,6CAA6F;AAEtF,KAAK,UAAU,eAAe,CAAC,eAAwB;IAC1D,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAEhD,IAAI,CAAC;QACD,IAAI,CAAC,IAAA,eAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,mCAAmC;QACnC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,IAAA,WA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