solforge 0.1.6 → 0.2.0
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/.agi/agi.sqlite +0 -0
- package/.claude/settings.local.json +9 -0
- package/.github/workflows/release-binaries.yml +133 -0
- package/.tmp/.787ebcdbf7b8fde8-00000000.hm +0 -0
- package/.tmp/.bffe6efebdf8aedc-00000000.hm +0 -0
- package/AGENTS.md +271 -0
- package/CLAUDE.md +106 -0
- package/PROJECT_STRUCTURE.md +124 -0
- package/README.md +367 -393
- package/SOLANA_KIT_GUIDE.md +251 -0
- package/SOLFORGE.md +119 -0
- package/biome.json +34 -0
- package/bun.lock +743 -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/drizzle/0000_friendly_millenium_guard.sql +53 -0
- package/drizzle/0001_stale_sentinels.sql +2 -0
- package/drizzle/meta/0000_snapshot.json +329 -0
- package/drizzle/meta/0001_snapshot.json +345 -0
- package/drizzle/meta/_journal.json +20 -0
- package/drizzle.config.ts +12 -0
- package/index.ts +21 -0
- package/mint.sh +47 -0
- package/package.json +45 -69
- package/postcss.config.js +6 -0
- package/rpc-server.ts.backup +519 -0
- 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/sf.config.json +38 -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/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/tailwind.config.js +27 -0
- package/test-client.ts +120 -0
- package/tmp/inspect-html.ts +4 -0
- package/tmp/response-test.ts +5 -0
- package/tmp/test-html.ts +5 -0
- package/tmp/test-server.ts +13 -0
- package/tsconfig.json +24 -23
- package/LICENSE +0 -21
- package/scripts/postinstall.cjs +0 -103
- package/src/api-server-entry.ts +0 -109
- package/src/commands/add-program.ts +0 -337
- package/src/commands/init.ts +0 -122
- package/src/commands/list.ts +0 -136
- package/src/commands/mint.ts +0 -336
- package/src/commands/start.ts +0 -878
- package/src/commands/status.ts +0 -99
- package/src/commands/stop.ts +0 -406
- package/src/config/manager.ts +0 -157
- package/src/index.ts +0 -188
- package/src/services/api-server.ts +0 -532
- package/src/services/port-manager.ts +0 -177
- package/src/services/process-registry.ts +0 -154
- package/src/services/program-cloner.ts +0 -317
- package/src/services/token-cloner.ts +0 -809
- package/src/services/validator.ts +0 -295
- package/src/types/config.ts +0 -110
- package/src/utils/shell.ts +0 -110
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Solana Kit Guide for LiteSVM RPC Server
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Solana Kit (formerly Web3.js v2) is a complete rewrite of the Web3.js library, designed to be more composable, customizable, and efficient. This guide covers how to use Kit with our LiteSVM RPC server implementation.
|
|
5
|
+
|
|
6
|
+
## Key Differences from Web3.js
|
|
7
|
+
|
|
8
|
+
### 1. No Connection Class
|
|
9
|
+
- **Web3.js**: Uses a `Connection` class as a central entry point
|
|
10
|
+
- **Kit**: Uses functional approach with `createSolanaRpc` and `createSolanaRpcSubscriptions`
|
|
11
|
+
|
|
12
|
+
### 2. Tree-Shakeable Design
|
|
13
|
+
- All functions are importable individually
|
|
14
|
+
- Only bundle what you use
|
|
15
|
+
- No classes, only functions and Proxy objects
|
|
16
|
+
|
|
17
|
+
### 3. Native TypeScript & Modern JS
|
|
18
|
+
- Uses native `bigint` for large values
|
|
19
|
+
- Native Ed25519 key support via `CryptoKeyPair`
|
|
20
|
+
- Strong TypeScript types throughout
|
|
21
|
+
|
|
22
|
+
## Core Concepts
|
|
23
|
+
|
|
24
|
+
### RPC Creation
|
|
25
|
+
```typescript
|
|
26
|
+
import { createSolanaRpc, createSolanaRpcSubscriptions } from '@solana/kit';
|
|
27
|
+
|
|
28
|
+
// Create RPC proxy for standard requests
|
|
29
|
+
const rpc = createSolanaRpc('http://localhost:8899');
|
|
30
|
+
|
|
31
|
+
// Create RPC subscriptions for WebSocket events
|
|
32
|
+
const rpcSubscriptions = createSolanaRpcSubscriptions('ws://localhost:8900');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Addresses
|
|
36
|
+
```typescript
|
|
37
|
+
import { address, Address } from '@solana/kit';
|
|
38
|
+
|
|
39
|
+
// Create an address (replaces PublicKey)
|
|
40
|
+
const wallet = address('11111111111111111111111111111111');
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Signers
|
|
44
|
+
Kit uses signer objects instead of Keypair arrays:
|
|
45
|
+
```typescript
|
|
46
|
+
import {
|
|
47
|
+
generateKeyPairSigner,
|
|
48
|
+
createNoopSigner,
|
|
49
|
+
TransactionSigner
|
|
50
|
+
} from '@solana/kit';
|
|
51
|
+
|
|
52
|
+
// Generate a new signer
|
|
53
|
+
const signer = await generateKeyPairSigner();
|
|
54
|
+
|
|
55
|
+
// Create a noop signer (for addresses that won't actually sign)
|
|
56
|
+
const noopSigner = createNoopSigner(address('1234...'));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## RPC Methods Mapping
|
|
60
|
+
|
|
61
|
+
### Account Operations
|
|
62
|
+
```typescript
|
|
63
|
+
// Get account info
|
|
64
|
+
const { value: account } = await rpc.getAccountInfo(wallet).send();
|
|
65
|
+
|
|
66
|
+
// Get balance
|
|
67
|
+
const { value: balance } = await rpc.getBalance(wallet).send();
|
|
68
|
+
|
|
69
|
+
// Helper functions
|
|
70
|
+
import { fetchEncodedAccount, assertAccountExists } from '@solana/kit';
|
|
71
|
+
const account = await fetchEncodedAccount(rpc, wallet);
|
|
72
|
+
assertAccountExists(account);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Transaction Operations
|
|
76
|
+
```typescript
|
|
77
|
+
// Get latest blockhash
|
|
78
|
+
const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
|
|
79
|
+
|
|
80
|
+
// Send transaction
|
|
81
|
+
const signature = await rpc.sendTransaction(signedTransaction).send();
|
|
82
|
+
|
|
83
|
+
// Simulate transaction
|
|
84
|
+
const { value: simulation } = await rpc.simulateTransaction(transaction).send();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Building Transactions
|
|
88
|
+
|
|
89
|
+
### Transaction Message Pipeline
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
createTransactionMessage,
|
|
93
|
+
setTransactionMessageFeePayerSigner,
|
|
94
|
+
setTransactionMessageLifetimeUsingBlockhash,
|
|
95
|
+
appendTransactionMessageInstructions,
|
|
96
|
+
pipe
|
|
97
|
+
} from '@solana/kit';
|
|
98
|
+
|
|
99
|
+
const transactionMessage = pipe(
|
|
100
|
+
createTransactionMessage({ version: 0 }),
|
|
101
|
+
tx => setTransactionMessageFeePayerSigner(payer, tx),
|
|
102
|
+
tx => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx),
|
|
103
|
+
tx => appendTransactionMessageInstructions(instructions, tx)
|
|
104
|
+
);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Compiling and Signing
|
|
108
|
+
```typescript
|
|
109
|
+
import {
|
|
110
|
+
compileTransaction,
|
|
111
|
+
signTransactionMessageWithSigners,
|
|
112
|
+
getSignatureFromTransaction
|
|
113
|
+
} from '@solana/kit';
|
|
114
|
+
|
|
115
|
+
// Compile the message
|
|
116
|
+
const transaction = compileTransaction(transactionMessage);
|
|
117
|
+
|
|
118
|
+
// Sign with attached signers
|
|
119
|
+
const signedTransaction = await signTransactionMessageWithSigners(transactionMessage);
|
|
120
|
+
|
|
121
|
+
// Get signature
|
|
122
|
+
const signature = getSignatureFromTransaction(signedTransaction);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Program Instructions
|
|
126
|
+
|
|
127
|
+
### System Program
|
|
128
|
+
```typescript
|
|
129
|
+
import { getTransferSolInstruction } from '@solana-program/system';
|
|
130
|
+
|
|
131
|
+
const instruction = getTransferSolInstruction({
|
|
132
|
+
source: payerSigner,
|
|
133
|
+
destination: recipientAddress,
|
|
134
|
+
amount: 1_000_000_000n // 1 SOL in lamports
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Token Program
|
|
139
|
+
```typescript
|
|
140
|
+
import { getInitializeMintInstruction } from '@solana-program/token';
|
|
141
|
+
|
|
142
|
+
const instruction = getInitializeMintInstruction({
|
|
143
|
+
mint: mintSigner.address,
|
|
144
|
+
decimals: 9,
|
|
145
|
+
mintAuthority: authorityAddress,
|
|
146
|
+
freezeAuthority: null
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Codecs for Data Encoding/Decoding
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {
|
|
154
|
+
Codec,
|
|
155
|
+
getStructCodec,
|
|
156
|
+
getU8Codec,
|
|
157
|
+
getU64Codec,
|
|
158
|
+
getAddressCodec,
|
|
159
|
+
getUtf8Codec,
|
|
160
|
+
addCodecSizePrefix,
|
|
161
|
+
getU32Codec
|
|
162
|
+
} from '@solana/kit';
|
|
163
|
+
|
|
164
|
+
// Define a codec for custom account data
|
|
165
|
+
type MyAccount = {
|
|
166
|
+
version: number;
|
|
167
|
+
owner: Address;
|
|
168
|
+
balance: bigint;
|
|
169
|
+
name: string;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const myAccountCodec: Codec<MyAccount> = getStructCodec([
|
|
173
|
+
['version', getU8Codec()],
|
|
174
|
+
['owner', getAddressCodec()],
|
|
175
|
+
['balance', getU64Codec()],
|
|
176
|
+
['name', addCodecSizePrefix(getUtf8Codec(), getU32Codec())]
|
|
177
|
+
]);
|
|
178
|
+
|
|
179
|
+
// Encode
|
|
180
|
+
const bytes = myAccountCodec.encode(accountData);
|
|
181
|
+
|
|
182
|
+
// Decode
|
|
183
|
+
const decoded = myAccountCodec.decode(bytes);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## RPC Method Requirements for LiteSVM
|
|
187
|
+
|
|
188
|
+
For our LiteSVM RPC server to work with Kit, we need to implement these RPC methods:
|
|
189
|
+
|
|
190
|
+
### Core Methods
|
|
191
|
+
- `getAccountInfo` - Get account data
|
|
192
|
+
- `getBalance` - Get account balance
|
|
193
|
+
- `getLatestBlockhash` - Get recent blockhash
|
|
194
|
+
- `sendTransaction` - Submit transaction
|
|
195
|
+
- `simulateTransaction` - Simulate without executing
|
|
196
|
+
- `requestAirdrop` - Request test SOL
|
|
197
|
+
|
|
198
|
+
### Additional Methods for Full Compatibility
|
|
199
|
+
- `getSignatureStatuses` - Check transaction status
|
|
200
|
+
- `getSlot` - Get current slot
|
|
201
|
+
- `getBlockHeight` - Get block height
|
|
202
|
+
- `getTransaction` - Get transaction by signature
|
|
203
|
+
- `getMultipleAccounts` - Batch account fetching
|
|
204
|
+
- `getMinimumBalanceForRentExemption` - Rent calculation
|
|
205
|
+
|
|
206
|
+
### For WebSocket Subscriptions
|
|
207
|
+
- `accountNotifications` - Account change events
|
|
208
|
+
- `signatureNotifications` - Transaction confirmation events
|
|
209
|
+
- `slotNotifications` - Slot change events
|
|
210
|
+
|
|
211
|
+
## Error Handling
|
|
212
|
+
|
|
213
|
+
Kit uses structured errors:
|
|
214
|
+
```typescript
|
|
215
|
+
import { isSolanaError, SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_FOUND } from '@solana/kit';
|
|
216
|
+
|
|
217
|
+
try {
|
|
218
|
+
const result = await rpc.getTransaction(signature).send();
|
|
219
|
+
} catch (error) {
|
|
220
|
+
if (isSolanaError(error, SOLANA_ERROR__TRANSACTION_SIGNATURE_NOT_FOUND)) {
|
|
221
|
+
console.log('Transaction not found');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Testing with LiteSVM
|
|
227
|
+
|
|
228
|
+
When using Kit with our LiteSVM RPC server:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
// Connect to local LiteSVM RPC
|
|
232
|
+
const rpc = createSolanaRpc('http://localhost:8899');
|
|
233
|
+
|
|
234
|
+
// Use LiteSVM-specific features
|
|
235
|
+
const { value: airdropSig } = await rpc.requestAirdrop(wallet, 1_000_000_000n).send();
|
|
236
|
+
|
|
237
|
+
// All standard Kit operations work normally
|
|
238
|
+
const { value: balance } = await rpc.getBalance(wallet).send();
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Migration from Web3.js
|
|
242
|
+
|
|
243
|
+
Use the `@solana/compat` package for incremental migration:
|
|
244
|
+
```typescript
|
|
245
|
+
import { fromLegacyPublicKey, fromLegacyKeypair } from '@solana/compat';
|
|
246
|
+
import { PublicKey, Keypair } from '@solana/web3.js';
|
|
247
|
+
|
|
248
|
+
// Convert legacy types
|
|
249
|
+
const address = fromLegacyPublicKey(new PublicKey('...'));
|
|
250
|
+
const cryptoKeypair = await fromLegacyKeypair(Keypair.generate());
|
|
251
|
+
```
|
package/SOLFORGE.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# SolForge - Lightweight Solana RPC Server
|
|
2
|
+
|
|
3
|
+
## Vision
|
|
4
|
+
|
|
5
|
+
SolForge is a high-performance, lightweight drop-in replacement for `solana-test-validator` built on LiteSVM. Our goal is to provide developers with a fast, resource-efficient local Solana development environment that "just works."
|
|
6
|
+
|
|
7
|
+
## What We're Building
|
|
8
|
+
|
|
9
|
+
### Core Objectives
|
|
10
|
+
|
|
11
|
+
1. **Drop-in Replacement**: Full compatibility with existing Solana RPC clients and tools
|
|
12
|
+
2. **Blazing Fast**: Sub-second startup, minimal memory footprint (~50MB vs 500MB+)
|
|
13
|
+
3. **Developer First**: Zero configuration, intuitive architecture, easy to extend
|
|
14
|
+
4. **Production Ready**: Reliable, well-tested, suitable for CI/CD pipelines
|
|
15
|
+
|
|
16
|
+
### Key Features
|
|
17
|
+
|
|
18
|
+
- ✅ Broad Solana JSON‑RPC coverage (HTTP + PubSub for signatures)
|
|
19
|
+
- ⚡ In‑memory execution via LiteSVM; sub‑second startup
|
|
20
|
+
- 💧 Faucet-backed airdrops (real transfers, no rate limits)
|
|
21
|
+
- 🗃️ Ephemeral SQLite index (Bun + Drizzle) for rich history during a run
|
|
22
|
+
- 🔧 Modular architecture; one method per file
|
|
23
|
+
- 🧪 Developer‑first defaults; logs and ergonomics for local workflows
|
|
24
|
+
- 🎯 Bun‑native
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
SolForge
|
|
30
|
+
├── Core Server (LiteSVM wrapper)
|
|
31
|
+
├── RPC Method Handlers (modular)
|
|
32
|
+
├── State Management (LiteSVM + ephemeral DB index)
|
|
33
|
+
└── Extensions (plugins, custom programs)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Design Principles
|
|
37
|
+
|
|
38
|
+
1. **Modularity Over Monoliths**: Small, focused modules that do one thing well
|
|
39
|
+
2. **Performance First**: Optimize for speed and resource usage
|
|
40
|
+
3. **Developer Experience**: Clear code, good documentation, helpful errors
|
|
41
|
+
4. **Extensibility**: Easy to add new RPC methods and custom behavior
|
|
42
|
+
5. **Compatibility**: Maintain strict Solana RPC API compatibility
|
|
43
|
+
|
|
44
|
+
## Roadmap
|
|
45
|
+
|
|
46
|
+
### Phase 1: Core RPC Methods ✅
|
|
47
|
+
- Basic account operations
|
|
48
|
+
- Transaction submission and simulation
|
|
49
|
+
- Block and slot information
|
|
50
|
+
- System queries
|
|
51
|
+
|
|
52
|
+
### Phase 2: Extended RPC Methods (Current)
|
|
53
|
+
- Token operations
|
|
54
|
+
- Program deployment
|
|
55
|
+
- Stake operations
|
|
56
|
+
- Vote operations
|
|
57
|
+
- Advanced queries
|
|
58
|
+
|
|
59
|
+
### Phase 3: WebSocket Support ✅ (signatures)
|
|
60
|
+
- Signature subscriptions implemented; other subs stubbed
|
|
61
|
+
|
|
62
|
+
### Phase 4: Advanced Features
|
|
63
|
+
- Snapshot/restore functionality
|
|
64
|
+
- Time travel debugging
|
|
65
|
+
- Custom program loader
|
|
66
|
+
- Performance profiling tools
|
|
67
|
+
- Multi-tenant support
|
|
68
|
+
|
|
69
|
+
### Phase 5: Production Features
|
|
70
|
+
- Clustering support
|
|
71
|
+
- Persistent storage option
|
|
72
|
+
- Metrics and monitoring
|
|
73
|
+
- Admin API
|
|
74
|
+
- Plugin system
|
|
75
|
+
|
|
76
|
+
## Use Cases
|
|
77
|
+
|
|
78
|
+
### Primary
|
|
79
|
+
- Local development environment
|
|
80
|
+
- Unit and integration testing
|
|
81
|
+
- CI/CD pipeline testing
|
|
82
|
+
- Educational purposes
|
|
83
|
+
|
|
84
|
+
### Secondary
|
|
85
|
+
- Performance benchmarking
|
|
86
|
+
- Protocol experimentation
|
|
87
|
+
- Custom program development
|
|
88
|
+
- Lightweight staging environments
|
|
89
|
+
|
|
90
|
+
## Success Metrics
|
|
91
|
+
|
|
92
|
+
- **Startup Time**: < 1 second
|
|
93
|
+
- **Memory Usage**: < 50MB idle, < 200MB under load
|
|
94
|
+
- **RPC Compatibility**: 100% core methods, 80%+ extended methods
|
|
95
|
+
- **Developer Adoption**: Primary choice for local Solana development
|
|
96
|
+
- **Test Speed**: 10x faster than solana-test-validator
|
|
97
|
+
|
|
98
|
+
## Non-Goals
|
|
99
|
+
|
|
100
|
+
- Not a production validator; not for mainnet/testnet
|
|
101
|
+
- Not for consensus participation
|
|
102
|
+
- Not for long‑term ledger persistence (DB is ephemeral by default)
|
|
103
|
+
|
|
104
|
+
## Technical Stack
|
|
105
|
+
|
|
106
|
+
- **Runtime**: Bun (exclusively)
|
|
107
|
+
- **Core**: LiteSVM
|
|
108
|
+
- **Language**: TypeScript
|
|
109
|
+
- **Architecture**: Modular, event-driven
|
|
110
|
+
- **Testing**: Bun test framework
|
|
111
|
+
- **Package Management**: Bun
|
|
112
|
+
|
|
113
|
+
## Contributing
|
|
114
|
+
|
|
115
|
+
We welcome contributions that align with our vision of a fast, lightweight, developer-friendly Solana RPC server. See AGENTS.md for development guidelines.
|
|
116
|
+
|
|
117
|
+
## Why "SolForge"?
|
|
118
|
+
|
|
119
|
+
Like a forge shapes raw metal into useful tools, SolForge shapes the Solana runtime into a powerful development tool - hot, fast, and ready to create.
|
package/biome.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": false
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false
|
|
10
|
+
},
|
|
11
|
+
"formatter": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"indentStyle": "tab"
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"recommended": true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"javascript": {
|
|
22
|
+
"formatter": {
|
|
23
|
+
"quoteStyle": "double"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"assist": {
|
|
27
|
+
"enabled": true,
|
|
28
|
+
"actions": {
|
|
29
|
+
"source": {
|
|
30
|
+
"organizeImports": "on"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|