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.
- package/README.md +367 -393
- package/docs/API.md +379 -0
- package/docs/CONFIGURATION.md +407 -0
- package/docs/bun-single-file-executable.md +585 -0
- package/docs/cli-plan.md +154 -0
- package/docs/data-indexing-plan.md +214 -0
- package/docs/gui-roadmap.md +202 -0
- package/package.json +38 -51
- package/server/index.ts +5 -0
- package/server/lib/base58.ts +33 -0
- package/server/lib/faucet.ts +110 -0
- package/server/lib/spl-token.ts +57 -0
- package/server/methods/TEMPLATE.md +117 -0
- package/server/methods/account/get-account-info.ts +90 -0
- package/server/methods/account/get-balance.ts +27 -0
- package/server/methods/account/get-multiple-accounts.ts +83 -0
- package/server/methods/account/get-parsed-account-info.ts +21 -0
- package/server/methods/account/index.ts +12 -0
- package/server/methods/account/parsers/index.ts +52 -0
- package/server/methods/account/parsers/loader-upgradeable.ts +66 -0
- package/server/methods/account/parsers/spl-token.ts +237 -0
- package/server/methods/account/parsers/system.ts +4 -0
- package/server/methods/account/request-airdrop.ts +219 -0
- package/server/methods/admin/adopt-mint-authority.ts +94 -0
- package/server/methods/admin/clone-program-accounts.ts +55 -0
- package/server/methods/admin/clone-program.ts +152 -0
- package/server/methods/admin/clone-token-accounts.ts +117 -0
- package/server/methods/admin/clone-token-mint.ts +82 -0
- package/server/methods/admin/create-mint.ts +114 -0
- package/server/methods/admin/create-token-account.ts +137 -0
- package/server/methods/admin/helpers.ts +70 -0
- package/server/methods/admin/index.ts +10 -0
- package/server/methods/admin/list-mints.ts +21 -0
- package/server/methods/admin/load-program.ts +52 -0
- package/server/methods/admin/mint-to.ts +278 -0
- package/server/methods/block/get-block-height.ts +5 -0
- package/server/methods/block/get-block.ts +35 -0
- package/server/methods/block/get-blocks-with-limit.ts +23 -0
- package/server/methods/block/get-latest-blockhash.ts +12 -0
- package/server/methods/block/get-slot.ts +5 -0
- package/server/methods/block/index.ts +6 -0
- package/server/methods/block/is-blockhash-valid.ts +23 -0
- package/server/methods/epoch/get-cluster-nodes.ts +17 -0
- package/server/methods/epoch/get-epoch-info.ts +16 -0
- package/server/methods/epoch/get-epoch-schedule.ts +15 -0
- package/server/methods/epoch/get-highest-snapshot-slot.ts +9 -0
- package/server/methods/epoch/get-leader-schedule.ts +8 -0
- package/server/methods/epoch/get-max-retransmit-slot.ts +9 -0
- package/server/methods/epoch/get-max-shred-insert-slot.ts +9 -0
- package/server/methods/epoch/get-slot-leader.ts +6 -0
- package/server/methods/epoch/get-slot-leaders.ts +9 -0
- package/server/methods/epoch/get-stake-activation.ts +9 -0
- package/server/methods/epoch/get-stake-minimum-delegation.ts +9 -0
- package/server/methods/epoch/get-vote-accounts.ts +19 -0
- package/server/methods/epoch/index.ts +13 -0
- package/server/methods/epoch/minimum-ledger-slot.ts +5 -0
- package/server/methods/fee/get-fee-calculator-for-blockhash.ts +12 -0
- package/server/methods/fee/get-fee-for-message.ts +8 -0
- package/server/methods/fee/get-fee-rate-governor.ts +16 -0
- package/server/methods/fee/get-fees.ts +14 -0
- package/server/methods/fee/get-recent-prioritization-fees.ts +22 -0
- package/server/methods/fee/index.ts +5 -0
- package/server/methods/get-address-lookup-table.ts +31 -0
- package/server/methods/index.ts +265 -0
- package/server/methods/performance/get-recent-performance-samples.ts +25 -0
- package/server/methods/performance/get-transaction-count.ts +5 -0
- package/server/methods/performance/index.ts +2 -0
- package/server/methods/program/get-block-commitment.ts +9 -0
- package/server/methods/program/get-block-production.ts +14 -0
- package/server/methods/program/get-block-time.ts +21 -0
- package/server/methods/program/get-blocks.ts +11 -0
- package/server/methods/program/get-first-available-block.ts +9 -0
- package/server/methods/program/get-genesis-hash.ts +6 -0
- package/server/methods/program/get-identity.ts +6 -0
- package/server/methods/program/get-inflation-governor.ts +15 -0
- package/server/methods/program/get-inflation-rate.ts +10 -0
- package/server/methods/program/get-inflation-reward.ts +12 -0
- package/server/methods/program/get-largest-accounts.ts +8 -0
- package/server/methods/program/get-parsed-program-accounts.ts +12 -0
- package/server/methods/program/get-parsed-token-accounts-by-delegate.ts +12 -0
- package/server/methods/program/get-parsed-token-accounts-by-owner.ts +12 -0
- package/server/methods/program/get-program-accounts.ts +221 -0
- package/server/methods/program/get-supply.ts +13 -0
- package/server/methods/program/get-token-account-balance.ts +64 -0
- package/server/methods/program/get-token-accounts-by-delegate.ts +81 -0
- package/server/methods/program/get-token-accounts-by-owner.ts +390 -0
- package/server/methods/program/get-token-largest-accounts.ts +80 -0
- package/server/methods/program/get-token-supply.ts +38 -0
- package/server/methods/program/index.ts +21 -0
- package/server/methods/solforge/index.ts +155 -0
- package/server/methods/system/get-health.ts +5 -0
- package/server/methods/system/get-minimum-balance-for-rent-exemption.ts +13 -0
- package/server/methods/system/get-version.ts +9 -0
- package/server/methods/system/index.ts +3 -0
- package/server/methods/transaction/get-confirmed-transaction.ts +11 -0
- package/server/methods/transaction/get-parsed-transaction.ts +21 -0
- package/server/methods/transaction/get-signature-statuses.ts +72 -0
- package/server/methods/transaction/get-signatures-for-address.ts +45 -0
- package/server/methods/transaction/get-transaction.ts +428 -0
- package/server/methods/transaction/index.ts +7 -0
- package/server/methods/transaction/send-transaction.ts +232 -0
- package/server/methods/transaction/simulate-transaction.ts +56 -0
- package/server/rpc-server.ts +474 -0
- package/server/types.ts +74 -0
- package/server/ws-server.ts +171 -0
- package/src/cli/bootstrap.ts +67 -0
- package/src/cli/commands/airdrop.ts +37 -0
- package/src/cli/commands/config.ts +39 -0
- package/src/cli/commands/mint.ts +187 -0
- package/src/cli/commands/program-clone.ts +124 -0
- package/src/cli/commands/program-load.ts +64 -0
- package/src/cli/commands/rpc-start.ts +46 -0
- package/src/cli/commands/token-adopt-authority.ts +37 -0
- package/src/cli/commands/token-clone.ts +113 -0
- package/src/cli/commands/token-create.ts +81 -0
- package/src/cli/main.ts +130 -0
- package/src/cli/run-solforge.ts +98 -0
- package/src/cli/setup-utils.ts +54 -0
- package/src/cli/setup-wizard.ts +256 -0
- package/src/cli/utils/args.ts +15 -0
- package/src/config/index.ts +130 -0
- package/src/db/index.ts +83 -0
- package/src/db/schema/accounts.ts +23 -0
- package/src/db/schema/address-signatures.ts +31 -0
- package/src/db/schema/index.ts +5 -0
- package/src/db/schema/meta-kv.ts +9 -0
- package/src/db/schema/transactions.ts +29 -0
- package/src/db/schema/tx-accounts.ts +33 -0
- package/src/db/tx-store.ts +229 -0
- package/src/gui/public/app.css +1 -0
- package/src/gui/public/build/main.css +1 -0
- package/src/gui/public/build/main.js +303 -0
- package/src/gui/public/build/main.js.txt +231 -0
- package/src/gui/public/index.html +19 -0
- package/src/gui/server.ts +297 -0
- package/src/gui/src/api.ts +127 -0
- package/src/gui/src/app.tsx +390 -0
- package/src/gui/src/components/airdrop-mint-form.tsx +216 -0
- package/src/gui/src/components/clone-program-modal.tsx +183 -0
- package/src/gui/src/components/clone-token-modal.tsx +211 -0
- package/src/gui/src/components/modal.tsx +127 -0
- package/src/gui/src/components/programs-panel.tsx +112 -0
- package/src/gui/src/components/status-panel.tsx +122 -0
- package/src/gui/src/components/tokens-panel.tsx +116 -0
- package/src/gui/src/hooks/use-interval.ts +17 -0
- package/src/gui/src/index.css +529 -0
- package/src/gui/src/main.tsx +17 -0
- package/src/migrations-bundled.ts +17 -0
- package/src/rpc/start.ts +44 -0
- package/scripts/postinstall.cjs +0 -103
- package/tsconfig.json +0 -28
package/docs/API.md
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
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.
|