solforge 0.1.5 → 0.1.6

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # SolForge
2
2
 
3
+ [![npm version](https://badge.fury.io/js/solforge.svg)](https://badge.fury.io/js/solforge)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  **SolForge** is a powerful Solana localnet orchestration tool that simplifies the process of setting up and managing local Solana development environments. It allows you to clone mainnet programs and tokens to your local validator, making it easy to develop and test Solana applications with real-world data.
4
7
 
5
8
  ## ✨ Features
@@ -15,15 +18,27 @@
15
18
  - 🎨 **Beautiful CLI** - Colorful, intuitive command-line interface
16
19
  - 🌐 **REST API** - Background API server for programmatic access to validator operations
17
20
 
18
- ## 🚀 Quick Start
21
+ ## 📦 Installation
19
22
 
20
23
  ### Prerequisites
21
24
 
22
- - [Bun](https://bun.sh) runtime
23
25
  - [Solana CLI tools](https://docs.solana.com/cli/install-solana-cli-tools) installed and configured
24
- - Node.js 18+ (for compatibility)
26
+ - Node.js 18+ or [Bun](https://bun.sh) runtime
25
27
 
26
- ### Installation
28
+ ### Install from npm (Recommended)
29
+
30
+ ```bash
31
+ # Install globally with npm
32
+ npm install -g solforge
33
+
34
+ # Or with bun
35
+ bun install -g solforge
36
+
37
+ # Or with yarn
38
+ yarn global add solforge
39
+ ```
40
+
41
+ ### Install from Source
27
42
 
28
43
  ```bash
29
44
  # Clone the repository
@@ -33,14 +48,20 @@ cd solforge
33
48
  # Install dependencies
34
49
  bun install
35
50
 
36
- # Build the project
37
- bun run build
51
+ # Build and install globally
52
+ bun run build:npm
53
+ npm install -g .
54
+ ```
38
55
 
39
- # Install globally (optional)
40
- bun run build:binary
41
- bun run install:binary
56
+ ### Verify Installation
57
+
58
+ ```bash
59
+ solforge --version
60
+ solforge --help
42
61
  ```
43
62
 
63
+ ## 🚀 Quick Start
64
+
44
65
  ### Basic Usage
45
66
 
46
67
  1. **Initialize a new project**:
@@ -78,8 +99,8 @@ solforge start
78
99
  # API available at http://127.0.0.1:3000/api
79
100
  curl http://127.0.0.1:3000/api/health
80
101
 
81
- # Mint tokens via API
82
- curl -X POST http://127.0.0.1:3000/api/tokens/USDC/mint \
102
+ # Mint tokens via API (using mint address)
103
+ curl -X POST http://127.0.0.1:3000/api/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/mint \
83
104
  -H "Content-Type: application/json" \
84
105
  -d '{"walletAddress": "YOUR_WALLET_ADDRESS", "amount": 1000}'
85
106
 
@@ -121,11 +142,14 @@ Start a localnet validator with the current configuration.
121
142
  ```bash
122
143
  solforge start # Start with default settings
123
144
  solforge start --debug # Start with debug logging
145
+ solforge start --network # Make API server accessible over network
146
+ solforge start --debug --network # Debug mode + network access
124
147
  ```
125
148
 
126
149
  **Options:**
127
150
 
128
151
  - `--debug` - Enable debug logging to see detailed command output
152
+ - `--network` - Make API server accessible over network (binds to 0.0.0.0 instead of 127.0.0.1)
129
153
 
130
154
  #### `solforge list`
131
155
 
@@ -228,6 +252,25 @@ When run without arguments, `solforge mint` will:
228
252
  - Prompt for amount to mint
229
253
  - Handle SPL token account creation automatically
230
254
 
255
+ #### `solforge api-server [options]`
256
+
257
+ Start the API server as a standalone service (without validator).
258
+
259
+ ```bash
260
+ solforge api-server # Start on default port 3000
261
+ solforge api-server --port 8080 # Custom port
262
+ solforge api-server --host 0.0.0.0 # Network accessible
263
+ solforge api-server --rpc-url http://localhost:8899 # Custom RPC
264
+ ```
265
+
266
+ **Options:**
267
+
268
+ - `-p, --port <port>` - Port for API server (default: 3000)
269
+ - `--host <host>` - Host to bind to (default: 127.0.0.1, use 0.0.0.0 for network access)
270
+ - `--rpc-url <url>` - Validator RPC URL (default: http://127.0.0.1:8899)
271
+ - `--faucet-url <url>` - Validator faucet URL (default: http://127.0.0.1:9900)
272
+ - `--work-dir <dir>` - Work directory (default: ./.solforge)
273
+
231
274
  #### `solforge reset`
232
275
 
233
276
  Reset localnet ledger (coming soon).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solforge",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Solana localnet orchestration tool for cloning mainnet programs and tokens",
5
5
  "module": "index.ts",
6
6
  "type": "module",
@@ -593,7 +593,7 @@ export async function startCommand(
593
593
  );
594
594
  console.log(
595
595
  chalk.gray(
596
- ` - POST http://${endpointHost}:${apiServerPort}/api/tokens/{symbol}/mint - Mint tokens`
596
+ ` - POST http://${endpointHost}:${apiServerPort}/api/tokens/{mintAddress}/mint - Mint tokens`
597
597
  )
598
598
  );
599
599
  console.log(
@@ -122,9 +122,9 @@ export class APIServer {
122
122
  });
123
123
 
124
124
  // Mint tokens to a wallet
125
- router.post("/tokens/:symbol/mint", async (req, res) => {
125
+ router.post("/tokens/:mintAddress/mint", async (req, res) => {
126
126
  try {
127
- const { symbol } = req.params;
127
+ const { mintAddress } = req.params;
128
128
  const { walletAddress, amount } = req.body;
129
129
 
130
130
  if (!walletAddress || !amount) {
@@ -133,6 +133,15 @@ export class APIServer {
133
133
  });
134
134
  }
135
135
 
136
+ // Validate mint address
137
+ try {
138
+ new PublicKey(mintAddress);
139
+ } catch {
140
+ return res.status(400).json({
141
+ error: "Invalid mint address",
142
+ });
143
+ }
144
+
136
145
  // Validate wallet address
137
146
  try {
138
147
  new PublicKey(walletAddress);
@@ -150,7 +159,7 @@ export class APIServer {
150
159
  }
151
160
 
152
161
  const result = await this.mintTokenToWallet(
153
- symbol,
162
+ mintAddress,
154
163
  walletAddress,
155
164
  amount
156
165
  );
@@ -327,17 +336,19 @@ export class APIServer {
327
336
  }
328
337
 
329
338
  private async mintTokenToWallet(
330
- symbol: string,
339
+ mintAddress: string,
331
340
  walletAddress: string,
332
341
  amount: number
333
342
  ): Promise<any> {
334
343
  const clonedTokens = await this.getClonedTokens();
335
344
  const token = clonedTokens.find(
336
- (t) => t.config.symbol.toLowerCase() === symbol.toLowerCase()
345
+ (t) => t.config.mainnetMint === mintAddress
337
346
  );
338
347
 
339
348
  if (!token) {
340
- throw new Error(`Token ${symbol} not found in cloned tokens`);
349
+ throw new Error(
350
+ `Token with mint address ${mintAddress} not found in cloned tokens`
351
+ );
341
352
  }
342
353
 
343
354
  // Use the shared minting function from the mint command