solforge 0.2.12 → 0.2.14

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 (175) hide show
  1. package/package.json +1 -5
  2. package/start.cjs +19 -23
  3. package/docs/API.md +0 -379
  4. package/docs/CONFIGURATION.md +0 -407
  5. package/docs/bun-single-file-executable.md +0 -585
  6. package/docs/cli-plan.md +0 -154
  7. package/docs/data-indexing-plan.md +0 -214
  8. package/docs/gui-roadmap.md +0 -202
  9. package/scripts/decode-b58.ts +0 -10
  10. package/scripts/install.sh +0 -112
  11. package/server/index.ts +0 -5
  12. package/server/lib/base58.ts +0 -33
  13. package/server/lib/faucet.ts +0 -110
  14. package/server/lib/instruction-parser.ts +0 -328
  15. package/server/lib/parsers/spl-associated-token-account.ts +0 -50
  16. package/server/lib/parsers/spl-token.ts +0 -340
  17. package/server/lib/spl-token.ts +0 -57
  18. package/server/methods/TEMPLATE.md +0 -117
  19. package/server/methods/account/get-account-info.ts +0 -86
  20. package/server/methods/account/get-balance.ts +0 -23
  21. package/server/methods/account/get-multiple-accounts.ts +0 -84
  22. package/server/methods/account/get-parsed-account-info.ts +0 -17
  23. package/server/methods/account/index.ts +0 -12
  24. package/server/methods/account/parsers/index.ts +0 -52
  25. package/server/methods/account/parsers/loader-upgradeable.ts +0 -79
  26. package/server/methods/account/parsers/spl-token.ts +0 -256
  27. package/server/methods/account/parsers/system.ts +0 -4
  28. package/server/methods/account/request-airdrop.ts +0 -271
  29. package/server/methods/admin/adopt-mint-authority.ts +0 -94
  30. package/server/methods/admin/clone-program-accounts.ts +0 -55
  31. package/server/methods/admin/clone-program.ts +0 -152
  32. package/server/methods/admin/clone-token-accounts.ts +0 -117
  33. package/server/methods/admin/clone-token-mint.ts +0 -82
  34. package/server/methods/admin/create-mint.ts +0 -114
  35. package/server/methods/admin/create-token-account.ts +0 -137
  36. package/server/methods/admin/helpers.ts +0 -70
  37. package/server/methods/admin/index.ts +0 -10
  38. package/server/methods/admin/list-mints.ts +0 -21
  39. package/server/methods/admin/load-program.ts +0 -52
  40. package/server/methods/admin/mint-to.ts +0 -266
  41. package/server/methods/block/get-block-height.ts +0 -5
  42. package/server/methods/block/get-block.ts +0 -31
  43. package/server/methods/block/get-blocks-with-limit.ts +0 -19
  44. package/server/methods/block/get-latest-blockhash.ts +0 -12
  45. package/server/methods/block/get-slot.ts +0 -5
  46. package/server/methods/block/index.ts +0 -6
  47. package/server/methods/block/is-blockhash-valid.ts +0 -19
  48. package/server/methods/epoch/get-cluster-nodes.ts +0 -17
  49. package/server/methods/epoch/get-epoch-info.ts +0 -16
  50. package/server/methods/epoch/get-epoch-schedule.ts +0 -15
  51. package/server/methods/epoch/get-highest-snapshot-slot.ts +0 -9
  52. package/server/methods/epoch/get-leader-schedule.ts +0 -8
  53. package/server/methods/epoch/get-max-retransmit-slot.ts +0 -9
  54. package/server/methods/epoch/get-max-shred-insert-slot.ts +0 -9
  55. package/server/methods/epoch/get-slot-leader.ts +0 -6
  56. package/server/methods/epoch/get-slot-leaders.ts +0 -9
  57. package/server/methods/epoch/get-stake-activation.ts +0 -9
  58. package/server/methods/epoch/get-stake-minimum-delegation.ts +0 -9
  59. package/server/methods/epoch/get-vote-accounts.ts +0 -19
  60. package/server/methods/epoch/index.ts +0 -13
  61. package/server/methods/epoch/minimum-ledger-slot.ts +0 -5
  62. package/server/methods/fee/get-fee-calculator-for-blockhash.ts +0 -12
  63. package/server/methods/fee/get-fee-for-message.ts +0 -8
  64. package/server/methods/fee/get-fee-rate-governor.ts +0 -16
  65. package/server/methods/fee/get-fees.ts +0 -14
  66. package/server/methods/fee/get-recent-prioritization-fees.ts +0 -22
  67. package/server/methods/fee/index.ts +0 -5
  68. package/server/methods/get-address-lookup-table.ts +0 -27
  69. package/server/methods/index.ts +0 -265
  70. package/server/methods/performance/get-recent-performance-samples.ts +0 -25
  71. package/server/methods/performance/get-transaction-count.ts +0 -5
  72. package/server/methods/performance/index.ts +0 -2
  73. package/server/methods/program/get-block-commitment.ts +0 -9
  74. package/server/methods/program/get-block-production.ts +0 -14
  75. package/server/methods/program/get-block-time.ts +0 -21
  76. package/server/methods/program/get-blocks.ts +0 -11
  77. package/server/methods/program/get-first-available-block.ts +0 -9
  78. package/server/methods/program/get-genesis-hash.ts +0 -6
  79. package/server/methods/program/get-identity.ts +0 -6
  80. package/server/methods/program/get-inflation-governor.ts +0 -15
  81. package/server/methods/program/get-inflation-rate.ts +0 -10
  82. package/server/methods/program/get-inflation-reward.ts +0 -12
  83. package/server/methods/program/get-largest-accounts.ts +0 -8
  84. package/server/methods/program/get-parsed-program-accounts.ts +0 -12
  85. package/server/methods/program/get-parsed-token-accounts-by-delegate.ts +0 -12
  86. package/server/methods/program/get-parsed-token-accounts-by-owner.ts +0 -12
  87. package/server/methods/program/get-program-accounts.ts +0 -221
  88. package/server/methods/program/get-supply.ts +0 -13
  89. package/server/methods/program/get-token-account-balance.ts +0 -60
  90. package/server/methods/program/get-token-accounts-by-delegate.ts +0 -82
  91. package/server/methods/program/get-token-accounts-by-owner.ts +0 -416
  92. package/server/methods/program/get-token-largest-accounts.ts +0 -81
  93. package/server/methods/program/get-token-supply.ts +0 -39
  94. package/server/methods/program/index.ts +0 -21
  95. package/server/methods/solforge/index.ts +0 -158
  96. package/server/methods/system/get-health.ts +0 -5
  97. package/server/methods/system/get-minimum-balance-for-rent-exemption.ts +0 -13
  98. package/server/methods/system/get-version.ts +0 -9
  99. package/server/methods/system/index.ts +0 -3
  100. package/server/methods/transaction/get-confirmed-transaction.ts +0 -11
  101. package/server/methods/transaction/get-parsed-transaction.ts +0 -17
  102. package/server/methods/transaction/get-signature-statuses.ts +0 -79
  103. package/server/methods/transaction/get-signatures-for-address.ts +0 -41
  104. package/server/methods/transaction/get-transaction.ts +0 -639
  105. package/server/methods/transaction/index.ts +0 -7
  106. package/server/methods/transaction/inner-instructions.test.ts +0 -104
  107. package/server/methods/transaction/send-transaction.ts +0 -469
  108. package/server/methods/transaction/simulate-transaction.ts +0 -57
  109. package/server/rpc-server.ts +0 -521
  110. package/server/types.ts +0 -109
  111. package/server/ws-server.ts +0 -178
  112. package/src/api-server-entry.ts +0 -109
  113. package/src/cli/bootstrap.ts +0 -67
  114. package/src/cli/commands/airdrop.ts +0 -37
  115. package/src/cli/commands/config.ts +0 -39
  116. package/src/cli/commands/mint.ts +0 -187
  117. package/src/cli/commands/program-clone.ts +0 -122
  118. package/src/cli/commands/program-load.ts +0 -64
  119. package/src/cli/commands/rpc-start.ts +0 -49
  120. package/src/cli/commands/token-adopt-authority.ts +0 -37
  121. package/src/cli/commands/token-clone.ts +0 -112
  122. package/src/cli/commands/token-create.ts +0 -81
  123. package/src/cli/main.ts +0 -158
  124. package/src/cli/run-solforge.ts +0 -112
  125. package/src/cli/setup-utils.ts +0 -54
  126. package/src/cli/setup-wizard.ts +0 -258
  127. package/src/cli/utils/args.ts +0 -15
  128. package/src/commands/add-program.ts +0 -333
  129. package/src/commands/init.ts +0 -122
  130. package/src/commands/list.ts +0 -136
  131. package/src/commands/mint.ts +0 -287
  132. package/src/commands/start.ts +0 -881
  133. package/src/commands/status.ts +0 -99
  134. package/src/commands/stop.ts +0 -405
  135. package/src/config/index.ts +0 -146
  136. package/src/config/manager.ts +0 -157
  137. package/src/db/index.ts +0 -83
  138. package/src/db/schema/accounts.ts +0 -23
  139. package/src/db/schema/address-signatures.ts +0 -31
  140. package/src/db/schema/index.ts +0 -6
  141. package/src/db/schema/meta-kv.ts +0 -9
  142. package/src/db/schema/transactions.ts +0 -36
  143. package/src/db/schema/tx-account-states.ts +0 -23
  144. package/src/db/schema/tx-accounts.ts +0 -33
  145. package/src/db/tx-store.ts +0 -264
  146. package/src/gui/public/app.css +0 -1556
  147. package/src/gui/public/build/main.css +0 -1569
  148. package/src/gui/public/build/main.js +0 -303
  149. package/src/gui/public/build/main.js.txt +0 -231
  150. package/src/gui/public/index.html +0 -19
  151. package/src/gui/server.ts +0 -296
  152. package/src/gui/src/api.ts +0 -127
  153. package/src/gui/src/app.tsx +0 -441
  154. package/src/gui/src/components/airdrop-mint-form.tsx +0 -246
  155. package/src/gui/src/components/clone-program-modal.tsx +0 -202
  156. package/src/gui/src/components/clone-token-modal.tsx +0 -230
  157. package/src/gui/src/components/modal.tsx +0 -134
  158. package/src/gui/src/components/programs-panel.tsx +0 -124
  159. package/src/gui/src/components/status-panel.tsx +0 -136
  160. package/src/gui/src/components/tokens-panel.tsx +0 -122
  161. package/src/gui/src/hooks/use-interval.ts +0 -17
  162. package/src/gui/src/index.css +0 -557
  163. package/src/gui/src/main.tsx +0 -17
  164. package/src/index.ts +0 -216
  165. package/src/migrations-bundled.ts +0 -23
  166. package/src/rpc/start.ts +0 -44
  167. package/src/services/api-server.ts +0 -504
  168. package/src/services/port-manager.ts +0 -174
  169. package/src/services/process-registry.ts +0 -153
  170. package/src/services/program-cloner.ts +0 -317
  171. package/src/services/token-cloner.ts +0 -811
  172. package/src/services/validator.ts +0 -293
  173. package/src/types/config.ts +0 -110
  174. package/src/utils/shell.ts +0 -110
  175. package/src/utils/token-loader.ts +0 -115
@@ -1,287 +0,0 @@
1
- import { input, select } from "@inquirer/prompts";
2
- import { PublicKey } from "@solana/web3.js";
3
- import chalk from "chalk";
4
- import { Command } from "commander";
5
- import { existsSync, readFileSync } from "node:fs";
6
- import type { TokenConfig } from "../types/config.js";
7
- import { runCommand } from "../utils/shell";
8
- import {
9
- type ClonedToken,
10
- findTokenBySymbol,
11
- loadClonedTokens,
12
- } from "../utils/token-loader.js";
13
-
14
- export const mintCommand = new Command()
15
- .name("mint")
16
- .description("Interactively mint tokens to any wallet address")
17
- .option("--rpc-url <url>", "RPC URL to use", "http://127.0.0.1:8899")
18
- .option("--symbol <symbol>", "Token symbol to mint")
19
- .option("--wallet <address>", "Wallet address to mint to")
20
- .option("--amount <amount>", "Amount to mint")
21
- .action(async (options) => {
22
- try {
23
- console.log(chalk.blue("đŸĒ™ Interactive Token Minting"));
24
- console.log(chalk.gray("Mint tokens to any wallet address\n"));
25
-
26
- // Check if solforge data exists
27
- const workDir = ".solforge";
28
- if (!existsSync(workDir)) {
29
- console.error(
30
- chalk.red("❌ No solforge data found. Run 'solforge start' first."),
31
- );
32
- process.exit(1);
33
- }
34
-
35
- // Load available tokens
36
- const tokens = await loadAvailableTokens(workDir);
37
-
38
- if (tokens.length === 0) {
39
- console.error(
40
- chalk.red(
41
- "❌ No tokens found. Run 'solforge start' first to clone tokens.",
42
- ),
43
- );
44
- process.exit(1);
45
- }
46
-
47
- // Display available tokens
48
- console.log(chalk.cyan("📋 Available Tokens:"));
49
- tokens.forEach((token, index) => {
50
- console.log(
51
- chalk.gray(
52
- ` ${index + 1}. ${token.config.symbol} (${
53
- token.config.mainnetMint
54
- })`,
55
- ),
56
- );
57
- });
58
- console.log();
59
-
60
- // Select token (or use provided symbol)
61
- let selectedToken: ClonedToken;
62
- if (options.symbol) {
63
- const token = findTokenBySymbol(tokens, options.symbol);
64
- if (!token) {
65
- console.error(
66
- chalk.red(`❌ Token ${options.symbol} not found in cloned tokens`),
67
- );
68
- process.exit(1);
69
- }
70
- selectedToken = token;
71
- console.log(
72
- chalk.gray(`Selected token: ${selectedToken.config.symbol}`),
73
- );
74
- } else {
75
- selectedToken = await select({
76
- message: "Select a token to mint:",
77
- choices: tokens.map((token) => ({
78
- name: `${token.config.symbol} (${token.config.mainnetMint})`,
79
- value: token,
80
- })),
81
- });
82
- }
83
-
84
- // Get recipient address (or use provided wallet)
85
- let recipientAddress: string;
86
- if (options.wallet) {
87
- recipientAddress = options.wallet;
88
- // Validate wallet address
89
- try {
90
- new PublicKey(recipientAddress);
91
- } catch {
92
- console.error(chalk.red("❌ Invalid wallet address"));
93
- process.exit(1);
94
- }
95
- console.log(chalk.gray(`Recipient wallet: ${recipientAddress}`));
96
- } else {
97
- recipientAddress = await input({
98
- message: "Enter recipient wallet address:",
99
- validate: (value: string) => {
100
- if (!value.trim()) {
101
- return "Please enter a valid address";
102
- }
103
- try {
104
- new PublicKey(value.trim());
105
- return true;
106
- } catch {
107
- return "Please enter a valid Solana address";
108
- }
109
- },
110
- });
111
- }
112
-
113
- // Get amount to mint (or use provided amount)
114
- let amount: string;
115
- if (options.amount) {
116
- const num = parseFloat(options.amount);
117
- if (Number.isNaN(num) || num <= 0) {
118
- console.error(chalk.red("❌ Invalid amount"));
119
- process.exit(1);
120
- }
121
- amount = options.amount;
122
- console.log(chalk.gray(`Amount to mint: ${amount}`));
123
- } else {
124
- amount = await input({
125
- message: "Enter amount to mint:",
126
- validate: (value: string) => {
127
- const num = parseFloat(value);
128
- if (Number.isNaN(num) || num <= 0) {
129
- return "Please enter a valid positive number";
130
- }
131
- return true;
132
- },
133
- });
134
- }
135
-
136
- // Confirm minting if interactive
137
- if (!options.symbol || !options.wallet || !options.amount) {
138
- const confirm = await input({
139
- message: `Confirm minting ${amount} ${selectedToken.config.symbol} to ${recipientAddress}? (y/N):`,
140
- default: "N",
141
- });
142
-
143
- if (confirm.toLowerCase() !== "y" && confirm.toLowerCase() !== "yes") {
144
- console.log(chalk.yellow("Minting cancelled."));
145
- process.exit(0);
146
- }
147
- }
148
-
149
- console.log(chalk.blue("🚀 Starting mint..."));
150
-
151
- // Execute mint
152
- await mintTokenToWallet(
153
- selectedToken,
154
- recipientAddress,
155
- parseFloat(amount),
156
- options.rpcUrl,
157
- );
158
-
159
- console.log(
160
- chalk.green(
161
- `✅ Successfully minted ${amount} ${selectedToken.config.symbol} to ${recipientAddress}`,
162
- ),
163
- );
164
- } catch (error) {
165
- console.error(chalk.red(`❌ Mint failed: ${error}`));
166
- process.exit(1);
167
- }
168
- });
169
-
170
- async function loadAvailableTokens(workDir: string): Promise<ClonedToken[]> {
171
- try {
172
- // Load token config from sf.config.json
173
- const configPath = "sf.config.json";
174
- if (!existsSync(configPath)) {
175
- throw new Error("sf.config.json not found in current directory");
176
- }
177
-
178
- const config = JSON.parse(readFileSync(configPath, "utf8"));
179
- const tokenConfigs: TokenConfig[] = config.tokens || [];
180
-
181
- // Use the shared token loader
182
- return await loadClonedTokens(tokenConfigs, workDir);
183
- } catch (error) {
184
- throw new Error(`Failed to load tokens: ${error}`);
185
- }
186
- }
187
-
188
- export async function mintTokenToWallet(
189
- token: ClonedToken,
190
- walletAddress: string,
191
- amount: number,
192
- rpcUrl: string,
193
- ): Promise<void> {
194
- // Check if associated token account already exists (same pattern as token-cloner.ts)
195
- console.log(chalk.gray(`🔍 Checking for existing token account...`));
196
-
197
- const checkAccountsResult = await runCommand(
198
- "spl-token",
199
- ["accounts", "--owner", walletAddress, "--url", rpcUrl, "--output", "json"],
200
- { silent: true },
201
- );
202
-
203
- let tokenAccountAddress = "";
204
-
205
- if (checkAccountsResult.success && checkAccountsResult.stdout) {
206
- try {
207
- const accountsData = JSON.parse(checkAccountsResult.stdout);
208
-
209
- // Look for existing token account for this mint
210
- for (const account of accountsData.accounts || []) {
211
- if (account.mint === token.config.mainnetMint) {
212
- tokenAccountAddress = account.address;
213
- console.log(
214
- chalk.gray(
215
- `â„šī¸ Found existing token account: ${tokenAccountAddress}`,
216
- ),
217
- );
218
- break;
219
- }
220
- }
221
- } catch (_error) {
222
- // No existing accounts found or parsing error, will create new account
223
- }
224
- }
225
-
226
- if (!tokenAccountAddress) {
227
- // Account doesn't exist, create it (same pattern as token-cloner.ts)
228
- console.log(chalk.gray(`🔧 Creating token account...`));
229
-
230
- const createAccountResult = await runCommand(
231
- "spl-token",
232
- [
233
- "create-account",
234
- token.config.mainnetMint,
235
- "--owner",
236
- walletAddress,
237
- "--fee-payer",
238
- token.mintAuthorityPath,
239
- "--url",
240
- rpcUrl,
241
- ],
242
- { silent: false },
243
- );
244
-
245
- if (!createAccountResult.success) {
246
- throw new Error(
247
- `Failed to create token account: ${createAccountResult.stderr}`,
248
- );
249
- }
250
-
251
- // Extract token account address from create-account output
252
- const match = createAccountResult.stdout.match(/Creating account (\S+)/);
253
- tokenAccountAddress = match?.[1] || "";
254
-
255
- if (!tokenAccountAddress) {
256
- throw new Error(
257
- "Failed to determine token account address from create-account output",
258
- );
259
- }
260
-
261
- console.log(chalk.gray(`✅ Created token account: ${tokenAccountAddress}`));
262
- }
263
-
264
- // Now mint to the token account (same pattern as token-cloner.ts)
265
- console.log(chalk.gray(`💰 Minting ${amount} tokens...`));
266
-
267
- const result = await runCommand(
268
- "spl-token",
269
- [
270
- "mint",
271
- token.config.mainnetMint,
272
- amount.toString(),
273
- tokenAccountAddress,
274
- "--mint-authority",
275
- token.mintAuthorityPath,
276
- "--fee-payer",
277
- token.mintAuthorityPath,
278
- "--url",
279
- rpcUrl,
280
- ],
281
- { silent: false },
282
- );
283
-
284
- if (!result.success) {
285
- throw new Error(`Failed to mint tokens: ${result.stderr}`);
286
- }
287
- }