solforge 0.1.7 → 0.2.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.
Files changed (151) hide show
  1. package/README.md +367 -393
  2. package/docs/API.md +379 -0
  3. package/docs/CONFIGURATION.md +407 -0
  4. package/docs/bun-single-file-executable.md +585 -0
  5. package/docs/cli-plan.md +154 -0
  6. package/docs/data-indexing-plan.md +214 -0
  7. package/docs/gui-roadmap.md +202 -0
  8. package/package.json +38 -51
  9. package/server/index.ts +5 -0
  10. package/server/lib/base58.ts +33 -0
  11. package/server/lib/faucet.ts +110 -0
  12. package/server/lib/spl-token.ts +57 -0
  13. package/server/methods/TEMPLATE.md +117 -0
  14. package/server/methods/account/get-account-info.ts +90 -0
  15. package/server/methods/account/get-balance.ts +27 -0
  16. package/server/methods/account/get-multiple-accounts.ts +83 -0
  17. package/server/methods/account/get-parsed-account-info.ts +21 -0
  18. package/server/methods/account/index.ts +12 -0
  19. package/server/methods/account/parsers/index.ts +52 -0
  20. package/server/methods/account/parsers/loader-upgradeable.ts +66 -0
  21. package/server/methods/account/parsers/spl-token.ts +237 -0
  22. package/server/methods/account/parsers/system.ts +4 -0
  23. package/server/methods/account/request-airdrop.ts +219 -0
  24. package/server/methods/admin/adopt-mint-authority.ts +94 -0
  25. package/server/methods/admin/clone-program-accounts.ts +55 -0
  26. package/server/methods/admin/clone-program.ts +152 -0
  27. package/server/methods/admin/clone-token-accounts.ts +117 -0
  28. package/server/methods/admin/clone-token-mint.ts +82 -0
  29. package/server/methods/admin/create-mint.ts +114 -0
  30. package/server/methods/admin/create-token-account.ts +137 -0
  31. package/server/methods/admin/helpers.ts +70 -0
  32. package/server/methods/admin/index.ts +10 -0
  33. package/server/methods/admin/list-mints.ts +21 -0
  34. package/server/methods/admin/load-program.ts +52 -0
  35. package/server/methods/admin/mint-to.ts +278 -0
  36. package/server/methods/block/get-block-height.ts +5 -0
  37. package/server/methods/block/get-block.ts +35 -0
  38. package/server/methods/block/get-blocks-with-limit.ts +23 -0
  39. package/server/methods/block/get-latest-blockhash.ts +12 -0
  40. package/server/methods/block/get-slot.ts +5 -0
  41. package/server/methods/block/index.ts +6 -0
  42. package/server/methods/block/is-blockhash-valid.ts +23 -0
  43. package/server/methods/epoch/get-cluster-nodes.ts +17 -0
  44. package/server/methods/epoch/get-epoch-info.ts +16 -0
  45. package/server/methods/epoch/get-epoch-schedule.ts +15 -0
  46. package/server/methods/epoch/get-highest-snapshot-slot.ts +9 -0
  47. package/server/methods/epoch/get-leader-schedule.ts +8 -0
  48. package/server/methods/epoch/get-max-retransmit-slot.ts +9 -0
  49. package/server/methods/epoch/get-max-shred-insert-slot.ts +9 -0
  50. package/server/methods/epoch/get-slot-leader.ts +6 -0
  51. package/server/methods/epoch/get-slot-leaders.ts +9 -0
  52. package/server/methods/epoch/get-stake-activation.ts +9 -0
  53. package/server/methods/epoch/get-stake-minimum-delegation.ts +9 -0
  54. package/server/methods/epoch/get-vote-accounts.ts +19 -0
  55. package/server/methods/epoch/index.ts +13 -0
  56. package/server/methods/epoch/minimum-ledger-slot.ts +5 -0
  57. package/server/methods/fee/get-fee-calculator-for-blockhash.ts +12 -0
  58. package/server/methods/fee/get-fee-for-message.ts +8 -0
  59. package/server/methods/fee/get-fee-rate-governor.ts +16 -0
  60. package/server/methods/fee/get-fees.ts +14 -0
  61. package/server/methods/fee/get-recent-prioritization-fees.ts +22 -0
  62. package/server/methods/fee/index.ts +5 -0
  63. package/server/methods/get-address-lookup-table.ts +31 -0
  64. package/server/methods/index.ts +265 -0
  65. package/server/methods/performance/get-recent-performance-samples.ts +25 -0
  66. package/server/methods/performance/get-transaction-count.ts +5 -0
  67. package/server/methods/performance/index.ts +2 -0
  68. package/server/methods/program/get-block-commitment.ts +9 -0
  69. package/server/methods/program/get-block-production.ts +14 -0
  70. package/server/methods/program/get-block-time.ts +21 -0
  71. package/server/methods/program/get-blocks.ts +11 -0
  72. package/server/methods/program/get-first-available-block.ts +9 -0
  73. package/server/methods/program/get-genesis-hash.ts +6 -0
  74. package/server/methods/program/get-identity.ts +6 -0
  75. package/server/methods/program/get-inflation-governor.ts +15 -0
  76. package/server/methods/program/get-inflation-rate.ts +10 -0
  77. package/server/methods/program/get-inflation-reward.ts +12 -0
  78. package/server/methods/program/get-largest-accounts.ts +8 -0
  79. package/server/methods/program/get-parsed-program-accounts.ts +12 -0
  80. package/server/methods/program/get-parsed-token-accounts-by-delegate.ts +12 -0
  81. package/server/methods/program/get-parsed-token-accounts-by-owner.ts +12 -0
  82. package/server/methods/program/get-program-accounts.ts +221 -0
  83. package/server/methods/program/get-supply.ts +13 -0
  84. package/server/methods/program/get-token-account-balance.ts +64 -0
  85. package/server/methods/program/get-token-accounts-by-delegate.ts +81 -0
  86. package/server/methods/program/get-token-accounts-by-owner.ts +390 -0
  87. package/server/methods/program/get-token-largest-accounts.ts +80 -0
  88. package/server/methods/program/get-token-supply.ts +38 -0
  89. package/server/methods/program/index.ts +21 -0
  90. package/server/methods/solforge/index.ts +155 -0
  91. package/server/methods/system/get-health.ts +5 -0
  92. package/server/methods/system/get-minimum-balance-for-rent-exemption.ts +13 -0
  93. package/server/methods/system/get-version.ts +9 -0
  94. package/server/methods/system/index.ts +3 -0
  95. package/server/methods/transaction/get-confirmed-transaction.ts +11 -0
  96. package/server/methods/transaction/get-parsed-transaction.ts +21 -0
  97. package/server/methods/transaction/get-signature-statuses.ts +72 -0
  98. package/server/methods/transaction/get-signatures-for-address.ts +45 -0
  99. package/server/methods/transaction/get-transaction.ts +428 -0
  100. package/server/methods/transaction/index.ts +7 -0
  101. package/server/methods/transaction/send-transaction.ts +232 -0
  102. package/server/methods/transaction/simulate-transaction.ts +56 -0
  103. package/server/rpc-server.ts +474 -0
  104. package/server/types.ts +74 -0
  105. package/server/ws-server.ts +171 -0
  106. package/src/cli/bootstrap.ts +67 -0
  107. package/src/cli/commands/airdrop.ts +37 -0
  108. package/src/cli/commands/config.ts +39 -0
  109. package/src/cli/commands/mint.ts +187 -0
  110. package/src/cli/commands/program-clone.ts +124 -0
  111. package/src/cli/commands/program-load.ts +64 -0
  112. package/src/cli/commands/rpc-start.ts +46 -0
  113. package/src/cli/commands/token-adopt-authority.ts +37 -0
  114. package/src/cli/commands/token-clone.ts +113 -0
  115. package/src/cli/commands/token-create.ts +81 -0
  116. package/src/cli/main.ts +130 -0
  117. package/src/cli/run-solforge.ts +98 -0
  118. package/src/cli/setup-utils.ts +54 -0
  119. package/src/cli/setup-wizard.ts +256 -0
  120. package/src/cli/utils/args.ts +15 -0
  121. package/src/config/index.ts +130 -0
  122. package/src/db/index.ts +83 -0
  123. package/src/db/schema/accounts.ts +23 -0
  124. package/src/db/schema/address-signatures.ts +31 -0
  125. package/src/db/schema/index.ts +5 -0
  126. package/src/db/schema/meta-kv.ts +9 -0
  127. package/src/db/schema/transactions.ts +29 -0
  128. package/src/db/schema/tx-accounts.ts +33 -0
  129. package/src/db/tx-store.ts +229 -0
  130. package/src/gui/public/app.css +1 -0
  131. package/src/gui/public/build/main.css +1 -0
  132. package/src/gui/public/build/main.js +303 -0
  133. package/src/gui/public/build/main.js.txt +231 -0
  134. package/src/gui/public/index.html +19 -0
  135. package/src/gui/server.ts +297 -0
  136. package/src/gui/src/api.ts +127 -0
  137. package/src/gui/src/app.tsx +390 -0
  138. package/src/gui/src/components/airdrop-mint-form.tsx +216 -0
  139. package/src/gui/src/components/clone-program-modal.tsx +183 -0
  140. package/src/gui/src/components/clone-token-modal.tsx +211 -0
  141. package/src/gui/src/components/modal.tsx +127 -0
  142. package/src/gui/src/components/programs-panel.tsx +112 -0
  143. package/src/gui/src/components/status-panel.tsx +122 -0
  144. package/src/gui/src/components/tokens-panel.tsx +116 -0
  145. package/src/gui/src/hooks/use-interval.ts +17 -0
  146. package/src/gui/src/index.css +529 -0
  147. package/src/gui/src/main.tsx +17 -0
  148. package/src/migrations-bundled.ts +17 -0
  149. package/src/rpc/start.ts +44 -0
  150. package/scripts/postinstall.cjs +0 -103
  151. package/tsconfig.json +0 -28
@@ -0,0 +1,407 @@
1
+ # Configuration Guide
2
+
3
+ This guide covers all configuration options available in SolForge's `sf.config.json` file.
4
+
5
+ ## Configuration File Structure
6
+
7
+ ```json
8
+ {
9
+ "name": "string",
10
+ "description": "string (optional)",
11
+ "tokens": [
12
+ /* TokenConfig[] */
13
+ ],
14
+ "programs": [
15
+ /* ProgramConfig[] */
16
+ ],
17
+ "localnet": {
18
+ /* LocalnetConfig */
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Root Configuration
24
+
25
+ ### `name` (required)
26
+
27
+ - **Type**: `string`
28
+ - **Default**: `"solforge-localnet"`
29
+ - **Description**: Name identifier for your localnet configuration
30
+
31
+ ### `description` (optional)
32
+
33
+ - **Type**: `string`
34
+ - **Description**: Human-readable description of your setup
35
+
36
+ ### `tokens` (optional)
37
+
38
+ - **Type**: `TokenConfig[]`
39
+ - **Default**: `[]`
40
+ - **Description**: Array of tokens to clone from mainnet
41
+
42
+ ### `programs` (optional)
43
+
44
+ - **Type**: `ProgramConfig[]`
45
+ - **Default**: `[]`
46
+ - **Description**: Array of programs to clone from mainnet
47
+
48
+ ### `localnet` (optional)
49
+
50
+ - **Type**: `LocalnetConfig`
51
+ - **Description**: Validator configuration options
52
+
53
+ ## Token Configuration (`TokenConfig`)
54
+
55
+ ### `symbol` (required)
56
+
57
+ - **Type**: `string`
58
+ - **Description**: Token symbol (e.g., "USDC", "SOL")
59
+ - **Example**: `"USDC"`
60
+
61
+ ### `mainnetMint` (required)
62
+
63
+ - **Type**: `string`
64
+ - **Description**: Mainnet mint address to clone
65
+ - **Example**: `"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"`
66
+
67
+ ### `mintAuthority` (optional)
68
+
69
+ - **Type**: `string`
70
+ - **Description**: Path to keypair file for mint authority
71
+ - **Example**: `"./keypairs/mint-authority.json"`
72
+ - **Note**: If not provided, a new keypair will be generated
73
+
74
+ ### `mintAmount` (optional)
75
+
76
+ - **Type**: `number`
77
+ - **Default**: `1000000`
78
+ - **Description**: Amount to mint to the mint authority
79
+ - **Note**: Amount is in token's base units (considering decimals)
80
+
81
+ ### `cloneMetadata` (optional)
82
+
83
+ - **Type**: `boolean`
84
+ - **Default**: `true`
85
+ - **Description**: Whether to clone token metadata from mainnet
86
+
87
+ ### `recipients` (optional)
88
+
89
+ - **Type**: `RecipientConfig[]`
90
+ - **Default**: `[]`
91
+ - **Description**: List of wallets to receive tokens after minting
92
+
93
+ #### `RecipientConfig`
94
+
95
+ ```json
96
+ {
97
+ "wallet": "string (required)",
98
+ "amount": "number (required)"
99
+ }
100
+ ```
101
+
102
+ - `wallet`: Public key of recipient wallet
103
+ - `amount`: Amount to transfer (in token's base units)
104
+
105
+ ### Example Token Configuration
106
+
107
+ ```json
108
+ {
109
+ "symbol": "USDC",
110
+ "mainnetMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
111
+ "mintAuthority": "./keypairs/usdc-mint.json",
112
+ "mintAmount": 10000000000,
113
+ "cloneMetadata": true,
114
+ "recipients": [
115
+ {
116
+ "wallet": "YourWalletPublicKeyHere",
117
+ "amount": 1000000000
118
+ },
119
+ {
120
+ "wallet": "AnotherWalletPublicKeyHere",
121
+ "amount": 500000000
122
+ }
123
+ ]
124
+ }
125
+ ```
126
+
127
+ ## Program Configuration (`ProgramConfig`)
128
+
129
+ ### `name` (optional)
130
+
131
+ - **Type**: `string`
132
+ - **Description**: Friendly name for the program
133
+ - **Example**: `"Jupiter Aggregator"`
134
+
135
+ ### `mainnetProgramId` (required)
136
+
137
+ - **Type**: `string`
138
+ - **Description**: Mainnet program ID to clone
139
+ - **Example**: `"JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"`
140
+
141
+ ### `deployPath` (optional)
142
+
143
+ - **Type**: `string`
144
+ - **Description**: Path to local .so file to deploy instead of cloning
145
+ - **Example**: `"./target/deploy/my_program.so"`
146
+
147
+ ### `upgradeable` (optional)
148
+
149
+ - **Type**: `boolean`
150
+ - **Default**: `false`
151
+ - **Description**: Whether the program should be deployed as upgradeable
152
+
153
+ ### `cluster` (optional)
154
+
155
+ - **Type**: `"mainnet-beta" | "devnet" | "testnet"`
156
+ - **Default**: `"mainnet-beta"`
157
+ - **Description**: Source cluster to clone the program from
158
+
159
+ ### `dependencies` (optional)
160
+
161
+ - **Type**: `string[]`
162
+ - **Default**: `[]`
163
+ - **Description**: Array of program IDs this program depends on
164
+ - **Note**: Dependencies will be deployed before this program
165
+
166
+ ### Example Program Configuration
167
+
168
+ ```json
169
+ {
170
+ "name": "Jupiter Aggregator",
171
+ "mainnetProgramId": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
172
+ "cluster": "mainnet-beta",
173
+ "upgradeable": false,
174
+ "dependencies": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"]
175
+ }
176
+ ```
177
+
178
+ ## Localnet Configuration (`LocalnetConfig`)
179
+
180
+ ### `airdropAmount` (optional)
181
+
182
+ - **Type**: `number`
183
+ - **Default**: `100`
184
+ - **Description**: SOL amount for initial airdrops
185
+ - **Unit**: SOL
186
+
187
+ ### `faucetAccounts` (optional)
188
+
189
+ - **Type**: `string[]`
190
+ - **Default**: `[]`
191
+ - **Description**: Public keys to receive initial SOL airdrops
192
+
193
+ ### `port` (optional)
194
+
195
+ - **Type**: `number`
196
+ - **Default**: `8899`
197
+ - **Range**: `1000-65535`
198
+ - **Description**: RPC port for the validator
199
+
200
+ ### `faucetPort` (optional)
201
+
202
+ - **Type**: `number`
203
+ - **Default**: `9900`
204
+ - **Range**: `1000-65535`
205
+ - **Description**: Faucet port for the validator
206
+
207
+ ### `reset` (optional)
208
+
209
+ - **Type**: `boolean`
210
+ - **Default**: `false`
211
+ - **Description**: Whether to reset the ledger on startup
212
+
213
+ ### `logLevel` (optional)
214
+
215
+ - **Type**: `"trace" | "debug" | "info" | "warn" | "error"`
216
+ - **Default**: `"info"`
217
+ - **Description**: Validator log level
218
+
219
+ ### `quiet` (optional)
220
+
221
+ - **Type**: `boolean`
222
+ - **Default**: `false`
223
+ - **Description**: Suppress validator output
224
+
225
+ ### `ledgerPath` (optional)
226
+
227
+ - **Type**: `string`
228
+ - **Description**: Custom path for ledger data
229
+ - **Note**: If not specified, uses default location
230
+
231
+ ### `bindAddress` (optional)
232
+
233
+ - **Type**: `string`
234
+ - **Default**: `"127.0.0.1"`
235
+ - **Description**: IP address to bind the validator to
236
+
237
+ ### `limitLedgerSize` (optional)
238
+
239
+ - **Type**: `number`
240
+ - **Default**: `100000`
241
+ - **Description**: Maximum ledger size in slots
242
+
243
+ ### `rpc` (optional)
244
+
245
+ - **Type**: `string` (URL)
246
+ - **Default**: `"https://api.mainnet-beta.solana.com"`
247
+ - **Description**: RPC URL for cloning data from mainnet
248
+
249
+ ### Example Localnet Configuration
250
+
251
+ ```json
252
+ {
253
+ "airdropAmount": 1000,
254
+ "faucetAccounts": ["YourWalletPublicKeyHere", "AnotherWalletPublicKeyHere"],
255
+ "port": 8899,
256
+ "faucetPort": 9900,
257
+ "reset": false,
258
+ "logLevel": "debug",
259
+ "quiet": false,
260
+ "bindAddress": "0.0.0.0",
261
+ "limitLedgerSize": 50000,
262
+ "rpc": "https://mainnet.helius-rpc.com/?api-key=your-key"
263
+ }
264
+ ```
265
+
266
+ ## Complete Example Configuration
267
+
268
+ ```json
269
+ {
270
+ "name": "defi-development",
271
+ "description": "DeFi development environment with popular tokens and DEX programs",
272
+ "tokens": [
273
+ {
274
+ "symbol": "USDC",
275
+ "mainnetMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
276
+ "mintAmount": 10000000000,
277
+ "cloneMetadata": true,
278
+ "recipients": [
279
+ {
280
+ "wallet": "YourWalletPublicKeyHere",
281
+ "amount": 1000000000
282
+ }
283
+ ]
284
+ },
285
+ {
286
+ "symbol": "USDT",
287
+ "mainnetMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
288
+ "mintAmount": 10000000000,
289
+ "cloneMetadata": true,
290
+ "recipients": [
291
+ {
292
+ "wallet": "YourWalletPublicKeyHere",
293
+ "amount": 1000000000
294
+ }
295
+ ]
296
+ }
297
+ ],
298
+ "programs": [
299
+ {
300
+ "name": "Jupiter Aggregator",
301
+ "mainnetProgramId": "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",
302
+ "cluster": "mainnet-beta"
303
+ },
304
+ {
305
+ "name": "Orca",
306
+ "mainnetProgramId": "9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP",
307
+ "cluster": "mainnet-beta"
308
+ },
309
+ {
310
+ "name": "Token Metadata",
311
+ "mainnetProgramId": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
312
+ "cluster": "mainnet-beta"
313
+ }
314
+ ],
315
+ "localnet": {
316
+ "airdropAmount": 1000,
317
+ "faucetAccounts": ["YourWalletPublicKeyHere"],
318
+ "port": 8899,
319
+ "faucetPort": 9900,
320
+ "reset": false,
321
+ "logLevel": "info",
322
+ "bindAddress": "127.0.0.1",
323
+ "limitLedgerSize": 100000,
324
+ "rpc": "https://api.mainnet-beta.solana.com"
325
+ }
326
+ }
327
+ ```
328
+
329
+ ## Configuration Validation
330
+
331
+ SolForge validates your configuration file using Zod schemas. Common validation errors:
332
+
333
+ ### Invalid Token Configuration
334
+
335
+ ```
336
+ ❌ Token symbol is required
337
+ ❌ Mainnet mint address is required
338
+ ❌ Mint amount must be positive
339
+ ❌ Wallet address is required for recipients
340
+ ```
341
+
342
+ ### Invalid Program Configuration
343
+
344
+ ```
345
+ ❌ Program ID is required
346
+ ❌ Invalid cluster (must be mainnet-beta, devnet, or testnet)
347
+ ```
348
+
349
+ ### Invalid Localnet Configuration
350
+
351
+ ```
352
+ ❌ Port must be between 1000 and 65535
353
+ ❌ RPC must be a valid URL
354
+ ❌ Log level must be one of: trace, debug, info, warn, error
355
+ ```
356
+
357
+ ## Best Practices
358
+
359
+ 1. **Use descriptive names**: Make your configuration name and description clear
360
+ 2. **Start small**: Begin with a few tokens/programs and add more as needed
361
+ 3. **Use custom RPC**: Consider using a dedicated RPC endpoint for better performance
362
+ 4. **Manage keypairs**: Store mint authority keypairs securely
363
+ 5. **Port management**: Use different ports for multiple environments
364
+ 6. **Reset wisely**: Use `reset: true` for clean starts, `false` for persistent data
365
+ 7. **Log levels**: Use `debug` for development, `info` for production
366
+
367
+ ## Environment-Specific Configurations
368
+
369
+ ### Development Environment
370
+
371
+ ```json
372
+ {
373
+ "name": "dev-environment",
374
+ "localnet": {
375
+ "reset": true,
376
+ "logLevel": "debug",
377
+ "airdropAmount": 1000
378
+ }
379
+ }
380
+ ```
381
+
382
+ ### Testing Environment
383
+
384
+ ```json
385
+ {
386
+ "name": "test-environment",
387
+ "localnet": {
388
+ "reset": false,
389
+ "logLevel": "warn",
390
+ "quiet": true
391
+ }
392
+ }
393
+ ```
394
+
395
+ ### Production-like Environment
396
+
397
+ ```json
398
+ {
399
+ "name": "prod-like-environment",
400
+ "localnet": {
401
+ "reset": false,
402
+ "logLevel": "error",
403
+ "limitLedgerSize": 1000000,
404
+ "rpc": "https://your-premium-rpc-endpoint.com"
405
+ }
406
+ }
407
+ ```