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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solforge",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "private": false,
@@ -17,10 +17,6 @@
17
17
  },
18
18
  "files": [
19
19
  "start.cjs",
20
- "scripts",
21
- "src",
22
- "server",
23
- "docs",
24
20
  "README.md",
25
21
  "LICENSE"
26
22
  ],
package/start.cjs CHANGED
@@ -76,7 +76,7 @@ function downloadWithProgress(url, dest) {
76
76
  } else if (response.statusCode === 200) {
77
77
  totalBytes = Number.parseInt(
78
78
  response.headers["content-length"] || "0",
79
- 10
79
+ 10,
80
80
  );
81
81
 
82
82
  response.on("data", (chunk) => {
@@ -86,7 +86,7 @@ function downloadWithProgress(url, dest) {
86
86
  const downloadedMB = (downloadedBytes / 1024 / 1024).toFixed(1);
87
87
  const totalMB = (totalBytes / 1024 / 1024).toFixed(1);
88
88
  process.stdout.write(
89
- `\rDownloading: ${percent}% (${downloadedMB}MB / ${totalMB}MB)`
89
+ `\rDownloading: ${percent}% (${downloadedMB}MB / ${totalMB}MB)`,
90
90
  );
91
91
  }
92
92
  });
@@ -152,7 +152,9 @@ async function install() {
152
152
  try {
153
153
  const asset = assetName();
154
154
  if (!asset) {
155
- throw new Error(`Unsupported platform: ${process.platform}-${process.arch}`);
155
+ throw new Error(
156
+ `Unsupported platform: ${process.platform}-${process.arch}`,
157
+ );
156
158
  }
157
159
 
158
160
  const { version, repository } = pkg();
@@ -178,27 +180,21 @@ async function install() {
178
180
 
179
181
  fs.chmodSync(binPath, 0o755);
180
182
 
181
- const result = spawnSync(binPath, ["--version"], { encoding: "utf8" });
182
- if (result.status === 0) {
183
- console.log("\n✓ solforge installed successfully!");
184
- console.log(`Version: ${result.stdout.trim()}`);
185
- console.log(`Location: ${binPath}`);
186
-
187
- const pathDirs = (process.env.PATH || "").split(path.delimiter);
188
- if (!pathDirs.includes(userBin)) {
189
- updateShellProfile(userBin);
190
- console.log(`\n⚠️ Add ${userBin} to your PATH:`);
191
- console.log(
192
- ` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc`
193
- );
194
- console.log(
195
- ` Or for zsh: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc`
196
- );
197
- } else {
198
- console.log(`✓ ${userBin} already in PATH`);
199
- }
183
+ console.log("\n✓ solforge installed successfully!");
184
+ console.log(`Location: ${binPath}`);
185
+
186
+ const pathDirs = (process.env.PATH || "").split(path.delimiter);
187
+ if (!pathDirs.includes(userBin)) {
188
+ updateShellProfile(userBin);
189
+ console.log(`\n⚠️ Add ${userBin} to your PATH:`);
190
+ console.log(
191
+ ` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc`,
192
+ );
193
+ console.log(
194
+ ` Or for zsh: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc`,
195
+ );
200
196
  } else {
201
- console.log(`\n✓ Installed to ${binPath}`);
197
+ console.log(`✓ ${userBin} already in PATH`);
202
198
  }
203
199
 
204
200
  console.log("\nRun: solforge --help");
package/docs/API.md DELETED
@@ -1,379 +0,0 @@
1
- # SolForge API Documentation
2
-
3
- SolForge includes a REST API server that runs alongside your local validator, providing programmatic access to validator operations and token management.
4
-
5
- ## Getting Started
6
-
7
- The API server starts automatically when you run `solforge start` and is available at:
8
-
9
- ```
10
- http://127.0.0.1:3000/api
11
- ```
12
-
13
- For network access from other devices, use the `--network` flag:
14
-
15
- ```bash
16
- solforge start --network
17
- ```
18
-
19
- This makes the API server accessible at:
20
-
21
- ```
22
- http://0.0.0.0:3000/api
23
- ```
24
-
25
- The API server will:
26
-
27
- - Start in the background when you run `solforge start`
28
- - Stop automatically when you run `solforge stop`
29
- - Use port 3000 by default (configurable)
30
- - Bind to localhost by default (use `--network` for network access)
31
-
32
- You can also run the API server standalone (without a validator):
33
-
34
- ```bash
35
- solforge api-server --port 8080 --host 0.0.0.0
36
- ```
37
-
38
- ## Base URL
39
-
40
- All API endpoints are prefixed with `/api`:
41
-
42
- ```
43
- Base URL: http://127.0.0.1:3000/api
44
- ```
45
-
46
- ## Authentication
47
-
48
- Currently, no authentication is required. The API server is intended for local development use only.
49
-
50
- ## Endpoints
51
-
52
- ### Health Check
53
-
54
- Check if the API server is running.
55
-
56
- ```http
57
- GET /api/health
58
- ```
59
-
60
- **Response:**
61
-
62
- ```json
63
- {
64
- "status": "ok",
65
- "timestamp": "2024-01-15T10:30:00.000Z"
66
- }
67
- ```
68
-
69
- ### Validator Information
70
-
71
- Get information about the running validator.
72
-
73
- ```http
74
- GET /api/validator/info
75
- ```
76
-
77
- **Response:**
78
-
79
- ```json
80
- {
81
- "version": {
82
- "solana-core": "1.17.0"
83
- },
84
- "blockHeight": 12345,
85
- "slotLeader": "11111111111111111111111111111111",
86
- "rpcUrl": "http://127.0.0.1:8899",
87
- "faucetUrl": "http://127.0.0.1:9900"
88
- }
89
- ```
90
-
91
- ### List Tokens
92
-
93
- Get all cloned tokens available on the validator.
94
-
95
- ```http
96
- GET /api/tokens
97
- ```
98
-
99
- **Response:**
100
-
101
- ```json
102
- {
103
- "tokens": [
104
- {
105
- "symbol": "USDC",
106
- "mainnetMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
107
- "mintAuthority": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
108
- "recipients": [
109
- {
110
- "wallet": "YourWalletPublicKeyHere",
111
- "amount": 1000000000
112
- }
113
- ],
114
- "cloneMetadata": true
115
- }
116
- ],
117
- "count": 1
118
- }
119
- ```
120
-
121
- ### List Programs
122
-
123
- Get all cloned programs available on the validator.
124
-
125
- ```http
126
- GET /api/programs
127
- ```
128
-
129
- **Response:**
130
-
131
- ```json
132
- {
133
- "programs": [
134
- {
135
- "name": "Token Metadata",
136
- "programId": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
137
- "filePath": "/path/to/program.so"
138
- }
139
- ],
140
- "count": 1
141
- }
142
- ```
143
-
144
- ### Mint Tokens
145
-
146
- Mint tokens to a specific wallet address.
147
-
148
- ```http
149
- POST /api/tokens/:mintAddress/mint
150
- ```
151
-
152
- **Parameters:**
153
-
154
- - `mintAddress` (path parameter) - Token mint address (e.g., "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")
155
-
156
- **Request Body:**
157
-
158
- ```json
159
- {
160
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
161
- "amount": 1000
162
- }
163
- ```
164
-
165
- **Response:**
166
-
167
- ```json
168
- {
169
- "success": true,
170
- "symbol": "USDC",
171
- "amount": 1000,
172
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
173
- "mintAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
174
- }
175
- ```
176
-
177
- **Error Response:**
178
-
179
- ```json
180
- {
181
- "error": "Token with mint address EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v not found in cloned tokens"
182
- }
183
- ```
184
-
185
- ### Get Wallet Balances
186
-
187
- Get SOL and token balances for a specific wallet.
188
-
189
- ```http
190
- GET /api/wallet/:address/balances
191
- ```
192
-
193
- **Parameters:**
194
-
195
- - `address` (path parameter) - Wallet public key
196
-
197
- **Response:**
198
-
199
- ```json
200
- {
201
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
202
- "solBalance": {
203
- "lamports": 1000000000,
204
- "sol": 1.0
205
- },
206
- "tokenBalances": [
207
- {
208
- "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
209
- "symbol": "USDC",
210
- "balance": "1000000000",
211
- "decimals": 6,
212
- "uiAmount": 1000
213
- }
214
- ],
215
- "timestamp": "2024-01-15T10:30:00.000Z"
216
- }
217
- ```
218
-
219
- ### Airdrop SOL
220
-
221
- Airdrop SOL to a wallet address.
222
-
223
- ```http
224
- POST /api/airdrop
225
- ```
226
-
227
- **Request Body:**
228
-
229
- ```json
230
- {
231
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
232
- "amount": 1
233
- }
234
- ```
235
-
236
- **Response:**
237
-
238
- ```json
239
- {
240
- "success": true,
241
- "amount": 1,
242
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
243
- "signature": "5j7s8K9mN2pQ3rT4uV5wX6yZ7a8B9c0D1e2F3g4H5i6J7k8L9m0N1o2P3q4R5s6T7u8V9w0X1y2Z3a4B5c6D7e8F"
244
- }
245
- ```
246
-
247
- ### Get Recent Transactions
248
-
249
- Get recent transactions from the validator.
250
-
251
- ```http
252
- GET /api/transactions/recent?limit=10
253
- ```
254
-
255
- **Query Parameters:**
256
-
257
- - `limit` (optional) - Number of transactions to return (max 100, default 10)
258
-
259
- **Response:**
260
-
261
- ```json
262
- {
263
- "transactions": [
264
- {
265
- "signature": "5j7s8K9mN2pQ3rT4uV5wX6yZ7a8B9c0D1e2F3g4H5i6J7k8L9m0N1o2P3q4R5s6T7u8V9w0X1y2Z3a4B5c6D7e8F",
266
- "slot": 12345,
267
- "blockTime": 1642234567,
268
- "confirmationStatus": "finalized"
269
- }
270
- ],
271
- "count": 1
272
- }
273
- ```
274
-
275
- ## Error Handling
276
-
277
- All endpoints return appropriate HTTP status codes:
278
-
279
- - `200` - Success
280
- - `400` - Bad Request (invalid parameters)
281
- - `404` - Not Found (endpoint doesn't exist)
282
- - `500` - Internal Server Error
283
-
284
- Error responses include details:
285
-
286
- ```json
287
- {
288
- "error": "Error message",
289
- "details": "Additional error details"
290
- }
291
- ```
292
-
293
- ## Examples
294
-
295
- ### Using curl
296
-
297
- **Mint tokens:**
298
-
299
- ```bash
300
- curl -X POST http://127.0.0.1:3000/api/tokens/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/mint \
301
- -H "Content-Type: application/json" \
302
- -d '{
303
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
304
- "amount": 1000
305
- }'
306
- ```
307
-
308
- **Get wallet balances:**
309
-
310
- ```bash
311
- curl http://127.0.0.1:3000/api/wallet/HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ/balances
312
- ```
313
-
314
- **Airdrop SOL:**
315
-
316
- ```bash
317
- curl -X POST http://127.0.0.1:3000/api/airdrop \
318
- -H "Content-Type: application/json" \
319
- -d '{
320
- "walletAddress": "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
321
- "amount": 1
322
- }'
323
- ```
324
-
325
- ### Using JavaScript/TypeScript
326
-
327
- ```typescript
328
- const API_BASE = "http://127.0.0.1:3000/api";
329
-
330
- // Mint tokens
331
- async function mintTokens(
332
- symbol: string,
333
- walletAddress: string,
334
- amount: number
335
- ) {
336
- const response = await fetch(`${API_BASE}/tokens/${symbol}/mint`, {
337
- method: "POST",
338
- headers: {
339
- "Content-Type": "application/json",
340
- },
341
- body: JSON.stringify({
342
- walletAddress,
343
- amount,
344
- }),
345
- });
346
-
347
- return response.json();
348
- }
349
-
350
- // Get wallet balances
351
- async function getWalletBalances(address: string) {
352
- const response = await fetch(`${API_BASE}/wallet/${address}/balances`);
353
- return response.json();
354
- }
355
-
356
- // Usage
357
- const result = await mintTokens(
358
- "USDC",
359
- "HpHke1uSs4VzA8m76Uy2aDfnhDg2Dw2vJMQvpBVU5mTJ",
360
- 1000
361
- );
362
- console.log(result);
363
- ```
364
-
365
- ## Configuration
366
-
367
- The API server port can be configured by setting the `API_PORT` environment variable or by modifying the start command configuration.
368
-
369
- ## CORS
370
-
371
- CORS is enabled for all origins to facilitate local web development. In production, you should configure appropriate CORS settings.
372
-
373
- ## Rate Limiting
374
-
375
- Currently, no rate limiting is implemented. The API is intended for local development use only.
376
-
377
- ## WebSocket Support
378
-
379
- WebSocket support is not currently implemented but may be added in future versions for real-time updates.