@5ive-tech/cli 1.0.4
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 +226 -0
- package/dist/assets/vm/five_vm_wasm.d.ts +762 -0
- package/dist/assets/vm/five_vm_wasm.js +3754 -0
- package/dist/assets/vm/five_vm_wasm_bg.wasm +0 -0
- package/dist/assets/vm/five_vm_wasm_bg.wasm.d.ts +247 -0
- package/dist/assets/vm/package.json +11 -0
- package/dist/cli.d.ts +47 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +343 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/analyze.d.ts +3 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +435 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/build.d.ts +3 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +66 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/compile.d.ts +3 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +872 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +431 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/deploy-and-execute.d.ts +3 -0
- package/dist/commands/deploy-and-execute.d.ts.map +1 -0
- package/dist/commands/deploy-and-execute.js +317 -0
- package/dist/commands/deploy-and-execute.js.map +1 -0
- package/dist/commands/deploy.d.ts +21 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +806 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/donate.d.ts +4 -0
- package/dist/commands/donate.d.ts.map +1 -0
- package/dist/commands/donate.js +104 -0
- package/dist/commands/donate.js.map +1 -0
- package/dist/commands/execute.d.ts +6 -0
- package/dist/commands/execute.d.ts.map +1 -0
- package/dist/commands/execute.js +749 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/fmt.d.ts +3 -0
- package/dist/commands/fmt.d.ts.map +1 -0
- package/dist/commands/fmt.js +327 -0
- package/dist/commands/fmt.js.map +1 -0
- package/dist/commands/help.d.ts +6 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +224 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/index.d.ts +45 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +119 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +887 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/local.d.ts +3 -0
- package/dist/commands/local.d.ts.map +1 -0
- package/dist/commands/local.js +703 -0
- package/dist/commands/local.js.map +1 -0
- package/dist/commands/namespace.d.ts +3 -0
- package/dist/commands/namespace.d.ts.map +1 -0
- package/dist/commands/namespace.js +328 -0
- package/dist/commands/namespace.js.map +1 -0
- package/dist/commands/template.d.ts +4 -0
- package/dist/commands/template.d.ts.map +1 -0
- package/dist/commands/template.js +486 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/commands/test.d.ts +6 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +890 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/version.d.ts +6 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +339 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +69 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +261 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +21 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +35 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +105 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/project/ProjectLoader.d.ts +12 -0
- package/dist/project/ProjectLoader.d.ts.map +1 -0
- package/dist/project/ProjectLoader.js +115 -0
- package/dist/project/ProjectLoader.js.map +1 -0
- package/dist/types.d.ts +334 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/AccountFixtureGenerator.d.ts +48 -0
- package/dist/utils/AccountFixtureGenerator.d.ts.map +1 -0
- package/dist/utils/AccountFixtureGenerator.js +265 -0
- package/dist/utils/AccountFixtureGenerator.js.map +1 -0
- package/dist/utils/FiveFileManager.d.ts +96 -0
- package/dist/utils/FiveFileManager.d.ts.map +1 -0
- package/dist/utils/FiveFileManager.js +329 -0
- package/dist/utils/FiveFileManager.js.map +1 -0
- package/dist/utils/ascii-art.d.ts +72 -0
- package/dist/utils/ascii-art.d.ts.map +1 -0
- package/dist/utils/ascii-art.js +314 -0
- package/dist/utils/ascii-art.js.map +1 -0
- package/dist/utils/cli-ui.d.ts +39 -0
- package/dist/utils/cli-ui.d.ts.map +1 -0
- package/dist/utils/cli-ui.js +75 -0
- package/dist/utils/cli-ui.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +25 -0
- package/dist/utils/fileUtils.d.ts.map +1 -0
- package/dist/utils/fileUtils.js +50 -0
- package/dist/utils/fileUtils.js.map +1 -0
- package/dist/utils/logger.d.ts +53 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +287 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/wasm/compiler.d.ts +101 -0
- package/dist/wasm/compiler.d.ts.map +1 -0
- package/dist/wasm/compiler.js +906 -0
- package/dist/wasm/compiler.js.map +1 -0
- package/dist/wasm/loader.d.ts +2 -0
- package/dist/wasm/loader.d.ts.map +1 -0
- package/dist/wasm/loader.js +90 -0
- package/dist/wasm/loader.js.map +1 -0
- package/dist/wasm/vm.d.ts +32 -0
- package/dist/wasm/vm.d.ts.map +1 -0
- package/dist/wasm/vm.js +440 -0
- package/dist/wasm/vm.js.map +1 -0
- package/package.json +100 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
export interface CLIConfig {
|
|
2
|
+
rootDir: string;
|
|
3
|
+
verbose?: boolean;
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
wasmDir?: string;
|
|
6
|
+
tempDir?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CLIOptions {
|
|
9
|
+
verbose?: boolean;
|
|
10
|
+
debug?: boolean;
|
|
11
|
+
output?: string;
|
|
12
|
+
format?: 'binary' | 'hex' | 'text' | 'json';
|
|
13
|
+
optimize?: boolean;
|
|
14
|
+
target?: 'local' | 'devnet' | 'testnet' | 'mainnet';
|
|
15
|
+
network?: string;
|
|
16
|
+
keypair?: string;
|
|
17
|
+
programId?: string;
|
|
18
|
+
forceLocal?: boolean;
|
|
19
|
+
namespace?: string;
|
|
20
|
+
namespaceManager?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface WasmModule {
|
|
23
|
+
instance: WebAssembly.Instance;
|
|
24
|
+
module: WebAssembly.Module;
|
|
25
|
+
exports: Record<string, any>;
|
|
26
|
+
memory: WebAssembly.Memory;
|
|
27
|
+
}
|
|
28
|
+
export interface WasmModuleConfig {
|
|
29
|
+
moduleName: string;
|
|
30
|
+
wasmPath: string;
|
|
31
|
+
jsBindingsPath?: string;
|
|
32
|
+
enableOptimizations?: boolean;
|
|
33
|
+
memorySize?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface WasmLoadOptions {
|
|
36
|
+
streaming?: boolean;
|
|
37
|
+
enableSIMD?: boolean;
|
|
38
|
+
enableThreads?: boolean;
|
|
39
|
+
importObject?: WebAssembly.Imports;
|
|
40
|
+
}
|
|
41
|
+
export interface CompilationOptions {
|
|
42
|
+
sourceFile: string;
|
|
43
|
+
outputFile?: string;
|
|
44
|
+
generateABI?: boolean;
|
|
45
|
+
abiOutputFile?: string;
|
|
46
|
+
optimize?: boolean;
|
|
47
|
+
target?: CompilationTarget;
|
|
48
|
+
includeDebugInfo?: boolean;
|
|
49
|
+
maxBytecodeSize?: number;
|
|
50
|
+
enableCompression?: boolean;
|
|
51
|
+
includeMetrics?: boolean;
|
|
52
|
+
metricsFormat?: "json" | "csv" | "toml";
|
|
53
|
+
errorFormat?: "terminal" | "json" | "lsp";
|
|
54
|
+
comprehensiveMetrics?: boolean;
|
|
55
|
+
metricsOutput?: string;
|
|
56
|
+
}
|
|
57
|
+
export type CompilationTarget = 'vm' | 'solana' | 'debug' | 'test';
|
|
58
|
+
export interface CompilationResult {
|
|
59
|
+
success: boolean;
|
|
60
|
+
bytecode?: Uint8Array;
|
|
61
|
+
abi?: any;
|
|
62
|
+
metadata?: CompilationMetadata;
|
|
63
|
+
errors?: CompilationError[];
|
|
64
|
+
warnings?: CompilationWarning[];
|
|
65
|
+
disassembly?: string[];
|
|
66
|
+
metrics?: CompilationMetrics;
|
|
67
|
+
metricsReport?: CompilationMetricsReport;
|
|
68
|
+
formattedErrorsTerminal?: string;
|
|
69
|
+
formattedErrorsJson?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface CompilationMetadata {
|
|
72
|
+
sourceFile: string;
|
|
73
|
+
timestamp: string;
|
|
74
|
+
compilerVersion: string;
|
|
75
|
+
target: CompilationTarget;
|
|
76
|
+
optimizations: string[];
|
|
77
|
+
originalSize: number;
|
|
78
|
+
compressedSize: number;
|
|
79
|
+
compressionRatio: number;
|
|
80
|
+
}
|
|
81
|
+
export interface CompilationError {
|
|
82
|
+
type: 'syntax' | 'semantic' | 'type' | 'runtime';
|
|
83
|
+
message: string;
|
|
84
|
+
line?: number;
|
|
85
|
+
column?: number;
|
|
86
|
+
sourceLocation?: string;
|
|
87
|
+
suggestion?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface CompilationWarning {
|
|
90
|
+
type: 'performance' | 'deprecation' | 'unused' | 'optimization';
|
|
91
|
+
message: string;
|
|
92
|
+
line?: number;
|
|
93
|
+
column?: number;
|
|
94
|
+
sourceLocation?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface CompilationMetrics {
|
|
97
|
+
compilationTime: number;
|
|
98
|
+
memoryUsed: number;
|
|
99
|
+
optimizationTime: number;
|
|
100
|
+
bytecodeSize: number;
|
|
101
|
+
instructionCount: number;
|
|
102
|
+
functionCount: number;
|
|
103
|
+
}
|
|
104
|
+
export interface CompilationMetricsReport {
|
|
105
|
+
format: string;
|
|
106
|
+
exported: string;
|
|
107
|
+
detailed?: any;
|
|
108
|
+
}
|
|
109
|
+
export interface VMExecutionOptions {
|
|
110
|
+
bytecode: Uint8Array;
|
|
111
|
+
inputData?: Uint8Array;
|
|
112
|
+
accounts?: AccountInfo[];
|
|
113
|
+
maxComputeUnits?: number;
|
|
114
|
+
enableLogging?: boolean;
|
|
115
|
+
enableProfiling?: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface VMExecutionResult {
|
|
118
|
+
success: boolean;
|
|
119
|
+
result?: any;
|
|
120
|
+
error?: VMError;
|
|
121
|
+
logs?: string[];
|
|
122
|
+
computeUnitsUsed?: number;
|
|
123
|
+
executionTime?: number;
|
|
124
|
+
memoryUsage?: MemoryUsage;
|
|
125
|
+
profileData?: ProfileData;
|
|
126
|
+
status?: string;
|
|
127
|
+
stoppedAt?: string;
|
|
128
|
+
errorMessage?: string;
|
|
129
|
+
}
|
|
130
|
+
export interface VMError {
|
|
131
|
+
type: string;
|
|
132
|
+
message: string;
|
|
133
|
+
instructionPointer?: number;
|
|
134
|
+
stackTrace?: string[];
|
|
135
|
+
errorCode?: number;
|
|
136
|
+
}
|
|
137
|
+
export interface AccountInfo {
|
|
138
|
+
pubkey?: string;
|
|
139
|
+
key?: Uint8Array;
|
|
140
|
+
lamports: number;
|
|
141
|
+
data: Uint8Array;
|
|
142
|
+
owner: Uint8Array | string;
|
|
143
|
+
executable: boolean;
|
|
144
|
+
rentEpoch: number;
|
|
145
|
+
isWritable?: boolean;
|
|
146
|
+
isSigner?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export interface MemoryUsage {
|
|
149
|
+
heapUsed: number;
|
|
150
|
+
heapTotal: number;
|
|
151
|
+
external: number;
|
|
152
|
+
arrayBuffers: number;
|
|
153
|
+
rss: number;
|
|
154
|
+
}
|
|
155
|
+
export interface ProfileData {
|
|
156
|
+
instructionCounts: Map<string, number>;
|
|
157
|
+
functionCallCounts: Map<string, number>;
|
|
158
|
+
hotspots: Array<{
|
|
159
|
+
instruction: string;
|
|
160
|
+
count: number;
|
|
161
|
+
percentage: number;
|
|
162
|
+
}>;
|
|
163
|
+
}
|
|
164
|
+
export interface BytecodeAnalysis {
|
|
165
|
+
instructionCount: number;
|
|
166
|
+
functionCount: number;
|
|
167
|
+
jumpTargets: number[];
|
|
168
|
+
callGraph: CallGraphNode[];
|
|
169
|
+
complexity: ComplexityMetrics;
|
|
170
|
+
optimizationOpportunities: OptimizationSuggestion[];
|
|
171
|
+
securityIssues: SecurityIssue[];
|
|
172
|
+
}
|
|
173
|
+
export interface CallGraphNode {
|
|
174
|
+
functionName: string;
|
|
175
|
+
callsTo: string[];
|
|
176
|
+
calledBy: string[];
|
|
177
|
+
instructionCount: number;
|
|
178
|
+
complexity: number;
|
|
179
|
+
}
|
|
180
|
+
export interface ComplexityMetrics {
|
|
181
|
+
cyclomaticComplexity: number;
|
|
182
|
+
nestingDepth: number;
|
|
183
|
+
halsteadComplexity: number;
|
|
184
|
+
maintainabilityIndex: number;
|
|
185
|
+
}
|
|
186
|
+
export interface OptimizationSuggestion {
|
|
187
|
+
type: 'performance' | 'size' | 'readability';
|
|
188
|
+
location: string;
|
|
189
|
+
description: string;
|
|
190
|
+
estimatedImprovement: string;
|
|
191
|
+
priority: 'low' | 'medium' | 'high';
|
|
192
|
+
}
|
|
193
|
+
export interface SecurityIssue {
|
|
194
|
+
type: 'vulnerability' | 'warning' | 'info';
|
|
195
|
+
category: string;
|
|
196
|
+
description: string;
|
|
197
|
+
location: string;
|
|
198
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
199
|
+
recommendation: string;
|
|
200
|
+
}
|
|
201
|
+
export interface DeploymentOptions {
|
|
202
|
+
bytecode: Uint8Array;
|
|
203
|
+
network: 'devnet' | 'testnet' | 'mainnet' | 'local';
|
|
204
|
+
programId?: string;
|
|
205
|
+
upgradeAuthority?: string;
|
|
206
|
+
maxDataSize?: number;
|
|
207
|
+
computeBudget?: number;
|
|
208
|
+
scriptAccount?: string;
|
|
209
|
+
extraLamports?: number;
|
|
210
|
+
fiveVMProgramId?: string;
|
|
211
|
+
vmStateAccount?: string;
|
|
212
|
+
exportMetadata?: {
|
|
213
|
+
methods?: string[];
|
|
214
|
+
interfaces?: Array<{
|
|
215
|
+
name: string;
|
|
216
|
+
methodMap?: Record<string, string>;
|
|
217
|
+
}>;
|
|
218
|
+
};
|
|
219
|
+
namespace?: string;
|
|
220
|
+
namespaceManager?: string;
|
|
221
|
+
}
|
|
222
|
+
export interface DeploymentResult {
|
|
223
|
+
success: boolean;
|
|
224
|
+
programId?: string;
|
|
225
|
+
transactionId?: string;
|
|
226
|
+
deploymentCost?: number;
|
|
227
|
+
error?: string;
|
|
228
|
+
logs?: string[];
|
|
229
|
+
}
|
|
230
|
+
export interface ProjectConfig {
|
|
231
|
+
name: string;
|
|
232
|
+
version: string;
|
|
233
|
+
description?: string;
|
|
234
|
+
sourceDir: string;
|
|
235
|
+
buildDir: string;
|
|
236
|
+
target: CompilationTarget;
|
|
237
|
+
entryPoint?: string;
|
|
238
|
+
outputArtifactName?: string;
|
|
239
|
+
cluster?: string;
|
|
240
|
+
commitment?: string;
|
|
241
|
+
rpcUrl?: string;
|
|
242
|
+
programId?: string;
|
|
243
|
+
namespaceManager?: string;
|
|
244
|
+
keypairPath?: string;
|
|
245
|
+
optimizations: ProjectOptimizations;
|
|
246
|
+
dependencies: ProjectDependency[];
|
|
247
|
+
multiFileMode?: boolean;
|
|
248
|
+
modules?: Record<string, string[]>;
|
|
249
|
+
}
|
|
250
|
+
export interface ProjectOptimizations {
|
|
251
|
+
enableCompression: boolean;
|
|
252
|
+
enableConstraintOptimization: boolean;
|
|
253
|
+
optimizationLevel: 'production';
|
|
254
|
+
}
|
|
255
|
+
export interface ProjectDependency {
|
|
256
|
+
name: string;
|
|
257
|
+
version: string;
|
|
258
|
+
type: 'five' | 'wasm' | 'solana';
|
|
259
|
+
path?: string;
|
|
260
|
+
}
|
|
261
|
+
export interface BuildManifest {
|
|
262
|
+
artifact_path: string;
|
|
263
|
+
abi_path?: string;
|
|
264
|
+
compiler_version?: string;
|
|
265
|
+
source_files: string[];
|
|
266
|
+
target: string;
|
|
267
|
+
timestamp: string;
|
|
268
|
+
hash?: string;
|
|
269
|
+
format: 'five' | 'bin';
|
|
270
|
+
entry_point?: string;
|
|
271
|
+
source_dir?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface CLIError extends Error {
|
|
274
|
+
code: string;
|
|
275
|
+
exitCode: number;
|
|
276
|
+
category: 'user' | 'system' | 'wasm' | 'network';
|
|
277
|
+
details?: any;
|
|
278
|
+
}
|
|
279
|
+
export interface ErrorContext {
|
|
280
|
+
command: string;
|
|
281
|
+
arguments: string[];
|
|
282
|
+
options: any;
|
|
283
|
+
environment: {
|
|
284
|
+
nodeVersion: string;
|
|
285
|
+
platform: string;
|
|
286
|
+
arch: string;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
290
|
+
export interface Logger {
|
|
291
|
+
debug(message: string, ...args: any[]): void;
|
|
292
|
+
info(message: string, ...args: any[]): void;
|
|
293
|
+
warn(message: string, ...args: any[]): void;
|
|
294
|
+
error(message: string, ...args: any[]): void;
|
|
295
|
+
}
|
|
296
|
+
export interface ProgressOptions {
|
|
297
|
+
total?: number;
|
|
298
|
+
current?: number;
|
|
299
|
+
message?: string;
|
|
300
|
+
spinner?: boolean;
|
|
301
|
+
}
|
|
302
|
+
export interface CommandContext {
|
|
303
|
+
config: CLIConfig;
|
|
304
|
+
logger: Logger;
|
|
305
|
+
wasmManager: any;
|
|
306
|
+
options: CLIOptions;
|
|
307
|
+
}
|
|
308
|
+
export interface CommandDefinition {
|
|
309
|
+
name: string;
|
|
310
|
+
description: string;
|
|
311
|
+
aliases?: string[];
|
|
312
|
+
options?: CommandOption[];
|
|
313
|
+
arguments?: CommandArgument[];
|
|
314
|
+
examples?: CommandExample[];
|
|
315
|
+
handler: (args: any[], options: any, context: CommandContext) => Promise<void>;
|
|
316
|
+
}
|
|
317
|
+
export interface CommandOption {
|
|
318
|
+
flags: string;
|
|
319
|
+
description: string;
|
|
320
|
+
defaultValue?: any;
|
|
321
|
+
choices?: string[];
|
|
322
|
+
required?: boolean;
|
|
323
|
+
}
|
|
324
|
+
export interface CommandArgument {
|
|
325
|
+
name: string;
|
|
326
|
+
description: string;
|
|
327
|
+
required?: boolean;
|
|
328
|
+
variadic?: boolean;
|
|
329
|
+
}
|
|
330
|
+
export interface CommandExample {
|
|
331
|
+
command: string;
|
|
332
|
+
description: string;
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,GA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AE,CAAC;IACnB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChF;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare function generateFixtureForScript(scriptPath: string, options?: {
|
|
2
|
+
debug?: boolean;
|
|
3
|
+
mode?: 'local' | 'onchain';
|
|
4
|
+
connection?: any;
|
|
5
|
+
payer?: any;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
fixture: any;
|
|
8
|
+
accountAddresses: string[];
|
|
9
|
+
accountNames: string[];
|
|
10
|
+
pattern: string | null;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Generate fixture and return as CLI-compatible format
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateFixtureForCLI(scriptPath: string, options?: {
|
|
16
|
+
debug?: boolean;
|
|
17
|
+
mode?: 'local' | 'onchain';
|
|
18
|
+
connection?: any;
|
|
19
|
+
payer?: any;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
accounts: string;
|
|
22
|
+
keypairs: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
secret: string;
|
|
25
|
+
}>;
|
|
26
|
+
summary: string;
|
|
27
|
+
fixture: any;
|
|
28
|
+
cleanup?: () => Promise<void>;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Check if a script is an account-system test
|
|
32
|
+
*/
|
|
33
|
+
export declare function isAccountSystemScript(scriptPath: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Generate fixtures for all scripts in a directory
|
|
36
|
+
*/
|
|
37
|
+
export declare function generateFixturesForDirectory(directory: string, options?: {
|
|
38
|
+
debug?: boolean;
|
|
39
|
+
filter?: (name: string) => boolean;
|
|
40
|
+
}): Promise<Map<string, {
|
|
41
|
+
accounts: string;
|
|
42
|
+
keypairs: Array<{
|
|
43
|
+
name: string;
|
|
44
|
+
secret: string;
|
|
45
|
+
}>;
|
|
46
|
+
summary: string;
|
|
47
|
+
}>>;
|
|
48
|
+
//# sourceMappingURL=AccountFixtureGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountFixtureGenerator.d.ts","sourceRoot":"","sources":["../../src/utils/AccountFixtureGenerator.ts"],"names":[],"mappings":"AAkHA,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IACP,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;CACR,GACL,OAAO,CAAC;IACT,OAAO,EAAE,GAAG,CAAC;IACb,gBAAgB,EAAE,MAAM,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+
import * as path from 'path';
|
|
4
|
+
import { AccountTestFixture, FixtureTemplates } from '@5ive-tech/sdk';
|
|
5
|
+
function detectAccountPattern(scriptContent) {
|
|
6
|
+
// Look for account definitions in the script
|
|
7
|
+
const hasSignerConstraint = /@signer/g.test(scriptContent);
|
|
8
|
+
const hasMutConstraint = /@mut/g.test(scriptContent);
|
|
9
|
+
const hasInitConstraint = /@init/g.test(scriptContent);
|
|
10
|
+
// Count signers and mutable accounts
|
|
11
|
+
const signerMatches = scriptContent.match(/account\s+@signer/g) || [];
|
|
12
|
+
const mutMatches = scriptContent.match(/account\s+@mut/g) || [];
|
|
13
|
+
// Detect pattern
|
|
14
|
+
if (hasInitConstraint && hasSignerConstraint) {
|
|
15
|
+
return 'account-creation';
|
|
16
|
+
}
|
|
17
|
+
if (signerMatches.length >= 2) {
|
|
18
|
+
return 'multi-sig';
|
|
19
|
+
}
|
|
20
|
+
if (hasSignerConstraint && hasMutConstraint) {
|
|
21
|
+
return 'authorization';
|
|
22
|
+
}
|
|
23
|
+
if (hasMutConstraint && signerMatches.length === 0) {
|
|
24
|
+
return 'state-mutation';
|
|
25
|
+
}
|
|
26
|
+
if (hasSignerConstraint) {
|
|
27
|
+
return 'authorization';
|
|
28
|
+
}
|
|
29
|
+
// Default: try to identify from filename
|
|
30
|
+
const fileName = path.basename(scriptContent);
|
|
31
|
+
if (fileName.includes('signer'))
|
|
32
|
+
return 'authorization';
|
|
33
|
+
if (fileName.includes('mut'))
|
|
34
|
+
return 'state-mutation';
|
|
35
|
+
if (fileName.includes('init'))
|
|
36
|
+
return 'account-creation';
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function parseAccountDefinitions(scriptContent) {
|
|
40
|
+
const accounts = new Map();
|
|
41
|
+
// Regex to find account definitions
|
|
42
|
+
const accountRegex = /account\s+(\w+)\s*\{([^}]*)\}/g;
|
|
43
|
+
let match;
|
|
44
|
+
while ((match = accountRegex.exec(scriptContent)) !== null) {
|
|
45
|
+
const accountName = match[1];
|
|
46
|
+
const accountFields = match[2];
|
|
47
|
+
// Parse fields
|
|
48
|
+
const fields = {};
|
|
49
|
+
const fieldRegex = /(\w+)\s*:\s*(\w+)/g;
|
|
50
|
+
let fieldMatch;
|
|
51
|
+
while ((fieldMatch = fieldRegex.exec(accountFields)) !== null) {
|
|
52
|
+
const fieldName = fieldMatch[1];
|
|
53
|
+
const fieldType = fieldMatch[2];
|
|
54
|
+
// Set default values based on type
|
|
55
|
+
if (fieldType === 'u64') {
|
|
56
|
+
fields[fieldName] = 0;
|
|
57
|
+
}
|
|
58
|
+
else if (fieldType === 'pubkey') {
|
|
59
|
+
fields[fieldName] = '11111111111111111111111111111111';
|
|
60
|
+
}
|
|
61
|
+
else if (fieldType === 'bool') {
|
|
62
|
+
fields[fieldName] = false;
|
|
63
|
+
}
|
|
64
|
+
else if (fieldType.startsWith('Option')) {
|
|
65
|
+
fields[fieldName] = null;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
fields[fieldName] = null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
accounts.set(accountName, fields);
|
|
72
|
+
}
|
|
73
|
+
return accounts;
|
|
74
|
+
}
|
|
75
|
+
function parseFunctionSignatures(scriptContent) {
|
|
76
|
+
const functions = new Map();
|
|
77
|
+
// Regex to find function definitions with account parameters
|
|
78
|
+
const funcRegex = /pub\s+(\w+)\s*\(([^)]*)\)/g;
|
|
79
|
+
let match;
|
|
80
|
+
while ((match = funcRegex.exec(scriptContent)) !== null) {
|
|
81
|
+
const funcName = match[1];
|
|
82
|
+
const paramsStr = match[2];
|
|
83
|
+
// Extract account parameter names and constraints
|
|
84
|
+
const accountParams = [];
|
|
85
|
+
const paramRegex = /(\w+)\s*:\s*account\s*(@\w+)?/g;
|
|
86
|
+
let paramMatch;
|
|
87
|
+
while ((paramMatch = paramRegex.exec(paramsStr)) !== null) {
|
|
88
|
+
const paramName = paramMatch[1];
|
|
89
|
+
const constraint = paramMatch[2] || '';
|
|
90
|
+
accountParams.push(`${paramName}${constraint}`);
|
|
91
|
+
}
|
|
92
|
+
functions.set(funcName, accountParams);
|
|
93
|
+
}
|
|
94
|
+
return functions;
|
|
95
|
+
}
|
|
96
|
+
export async function generateFixtureForScript(scriptPath, options = {}) {
|
|
97
|
+
// Read script content
|
|
98
|
+
if (!fs.existsSync(scriptPath)) {
|
|
99
|
+
throw new Error(`Script not found: ${scriptPath}`);
|
|
100
|
+
}
|
|
101
|
+
const scriptContent = fs.readFileSync(scriptPath, 'utf-8');
|
|
102
|
+
// Detect pattern
|
|
103
|
+
const pattern = detectAccountPattern(scriptContent);
|
|
104
|
+
if (options.debug) {
|
|
105
|
+
console.log(`[AccountFixtureGenerator] Detected pattern: ${pattern}, mode: ${options.mode || 'local'}`);
|
|
106
|
+
}
|
|
107
|
+
// Use template if detected
|
|
108
|
+
let fixture;
|
|
109
|
+
const buildOptions = {
|
|
110
|
+
debug: options.debug,
|
|
111
|
+
mode: options.mode || 'local',
|
|
112
|
+
connection: options.connection,
|
|
113
|
+
payer: options.payer,
|
|
114
|
+
cleanup: true // Auto-cleanup after test
|
|
115
|
+
};
|
|
116
|
+
if (pattern) {
|
|
117
|
+
switch (pattern) {
|
|
118
|
+
case 'state-mutation':
|
|
119
|
+
fixture = await FixtureTemplates.stateCounter().build(buildOptions);
|
|
120
|
+
break;
|
|
121
|
+
case 'authorization':
|
|
122
|
+
fixture = await FixtureTemplates.authorization().build(buildOptions);
|
|
123
|
+
break;
|
|
124
|
+
case 'account-creation':
|
|
125
|
+
fixture = await FixtureTemplates.accountCreation().build(buildOptions);
|
|
126
|
+
break;
|
|
127
|
+
case 'multi-sig':
|
|
128
|
+
fixture = await FixtureTemplates.multiSigPattern().build(buildOptions);
|
|
129
|
+
break;
|
|
130
|
+
default:
|
|
131
|
+
fixture = await FixtureTemplates.stateCounter().build(buildOptions);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// Fallback: create minimal fixture
|
|
136
|
+
fixture = await new AccountTestFixture()
|
|
137
|
+
.addStateAccount('state')
|
|
138
|
+
.build(buildOptions);
|
|
139
|
+
}
|
|
140
|
+
// Extract account addresses and names
|
|
141
|
+
const accountAddresses = fixture.accounts.map((a) => a.pubkey);
|
|
142
|
+
const accountNames = fixture.accounts.map((a) => a.name || 'unknown');
|
|
143
|
+
if (options.debug) {
|
|
144
|
+
const modeStr = options.mode === 'onchain' ? '[ON-CHAIN]' : '[LOCAL]';
|
|
145
|
+
console.log(`[AccountFixtureGenerator] ${modeStr} Generated ${accountAddresses.length} accounts`);
|
|
146
|
+
accountNames.forEach((name, i) => {
|
|
147
|
+
console.log(` ${i}: ${name} -> ${accountAddresses[i].substring(0, 8)}...`);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
fixture,
|
|
152
|
+
accountAddresses,
|
|
153
|
+
accountNames,
|
|
154
|
+
pattern
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Generate fixture and return as CLI-compatible format
|
|
159
|
+
*/
|
|
160
|
+
export async function generateFixtureForCLI(scriptPath, options = {}) {
|
|
161
|
+
const { fixture, accountAddresses, accountNames, pattern } = await generateFixtureForScript(scriptPath, {
|
|
162
|
+
debug: options.debug,
|
|
163
|
+
mode: options.mode || 'local',
|
|
164
|
+
connection: options.connection,
|
|
165
|
+
payer: options.payer
|
|
166
|
+
});
|
|
167
|
+
// Format accounts as comma-separated string
|
|
168
|
+
const accounts = accountAddresses.join(',');
|
|
169
|
+
// Extract keypairs for signers
|
|
170
|
+
const keypairs = [];
|
|
171
|
+
fixture.accounts.forEach((acc, i) => {
|
|
172
|
+
if (acc.keypair) {
|
|
173
|
+
const secretArray = Array.from(acc.keypair.secretKey);
|
|
174
|
+
keypairs.push({
|
|
175
|
+
name: accountNames[i],
|
|
176
|
+
secret: JSON.stringify(secretArray)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
// Create summary
|
|
181
|
+
const modeStr = options.mode === 'onchain' ? '[ON-CHAIN]' : '[LOCAL]';
|
|
182
|
+
const summary = [
|
|
183
|
+
`${modeStr} Fixture for: ${path.basename(scriptPath)}`,
|
|
184
|
+
`Pattern: ${pattern || 'custom'}`,
|
|
185
|
+
`Accounts: ${accountAddresses.length}`,
|
|
186
|
+
accountNames.map((name, i) => ` ${i}: ${name} [${accountAddresses[i].substring(0, 8)}...]`).join('\n')
|
|
187
|
+
].join('\n');
|
|
188
|
+
return {
|
|
189
|
+
accounts,
|
|
190
|
+
keypairs,
|
|
191
|
+
summary,
|
|
192
|
+
fixture,
|
|
193
|
+
cleanup: fixture.cleanup
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Check if a script is an account-system test
|
|
198
|
+
*/
|
|
199
|
+
export function isAccountSystemScript(scriptPath) {
|
|
200
|
+
if (!fs.existsSync(scriptPath))
|
|
201
|
+
return false;
|
|
202
|
+
const scriptContent = fs.readFileSync(scriptPath, 'utf-8');
|
|
203
|
+
// Check for account definitions or constraints
|
|
204
|
+
return (/account\s+\w+\s*\{/g.test(scriptContent) ||
|
|
205
|
+
/@signer/g.test(scriptContent) ||
|
|
206
|
+
/@mut/g.test(scriptContent) ||
|
|
207
|
+
/@init/g.test(scriptContent));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Generate fixtures for all scripts in a directory
|
|
211
|
+
*/
|
|
212
|
+
export async function generateFixturesForDirectory(directory, options = {}) {
|
|
213
|
+
const results = new Map();
|
|
214
|
+
// Find all .v files
|
|
215
|
+
const files = fs.readdirSync(directory).filter(f => f.endsWith('.v'));
|
|
216
|
+
for (const file of files) {
|
|
217
|
+
if (options.filter && !options.filter(file))
|
|
218
|
+
continue;
|
|
219
|
+
const scriptPath = path.join(directory, file);
|
|
220
|
+
try {
|
|
221
|
+
if (isAccountSystemScript(scriptPath)) {
|
|
222
|
+
const result = await generateFixtureForCLI(scriptPath, options);
|
|
223
|
+
results.set(file, result);
|
|
224
|
+
if (options.debug) {
|
|
225
|
+
console.log(`\n${result.summary}\n`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
console.error(`Error generating fixture for ${file}: ${error}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return results;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Main entry point when run as CLI tool
|
|
237
|
+
*/
|
|
238
|
+
async function main() {
|
|
239
|
+
const args = process.argv.slice(2);
|
|
240
|
+
const scriptPath = args[0];
|
|
241
|
+
if (!scriptPath) {
|
|
242
|
+
console.error('Usage: node AccountFixtureGenerator.ts <script-path>');
|
|
243
|
+
process.exit(1);
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
const result = await generateFixtureForCLI(scriptPath, { debug: true });
|
|
247
|
+
console.log('\n' + result.summary);
|
|
248
|
+
console.log(`\nAccounts: ${result.accounts}`);
|
|
249
|
+
if (result.keypairs.length > 0) {
|
|
250
|
+
console.log('\nSigner Keypairs:');
|
|
251
|
+
result.keypairs.forEach(kp => {
|
|
252
|
+
console.log(` ${kp.name}: ${kp.secret.substring(0, 50)}...`);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
console.error(`Error: ${error}`);
|
|
258
|
+
process.exit(1);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// Run if invoked directly
|
|
262
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
263
|
+
main();
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=AccountFixtureGenerator.js.map
|