@5ive-tech/sdk 1.1.2
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 +279 -0
- package/dist/FiveSDK.d.ts +336 -0
- package/dist/FiveSDK.js +395 -0
- package/dist/accounts/index.d.ts +254 -0
- package/dist/accounts/index.js +543 -0
- package/dist/assets/vm/dummy.file +0 -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.js +3307 -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/bin/gen-types.d.ts +2 -0
- package/dist/bin/gen-types.js +35 -0
- package/dist/compiler/BytecodeCompiler.d.ts +83 -0
- package/dist/compiler/BytecodeCompiler.js +379 -0
- package/dist/config/ConfigManager.d.ts +13 -0
- package/dist/config/ConfigManager.js +27 -0
- package/dist/config/ProgramIdResolver.d.ts +62 -0
- package/dist/config/ProgramIdResolver.js +104 -0
- package/dist/crypto/index.d.ts +211 -0
- package/dist/crypto/index.js +451 -0
- package/dist/encoding/ParameterEncoder.d.ts +31 -0
- package/dist/encoding/ParameterEncoder.js +278 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +28 -0
- package/dist/lib/bytecode-encoder.d.ts +62 -0
- package/dist/lib/bytecode-encoder.js +281 -0
- package/dist/logging/index.d.ts +9 -0
- package/dist/logging/index.js +10 -0
- package/dist/metadata/index.d.ts +213 -0
- package/dist/metadata/index.js +296 -0
- package/dist/modules/accounts.d.ts +60 -0
- package/dist/modules/accounts.js +275 -0
- package/dist/modules/deploy.d.ts +90 -0
- package/dist/modules/deploy.js +1118 -0
- package/dist/modules/execute.d.ts +90 -0
- package/dist/modules/execute.js +649 -0
- package/dist/modules/fees.d.ts +14 -0
- package/dist/modules/fees.js +112 -0
- package/dist/modules/namespaces.d.ts +39 -0
- package/dist/modules/namespaces.js +190 -0
- package/dist/modules/state-diff.d.ts +35 -0
- package/dist/modules/state-diff.js +342 -0
- package/dist/modules/vm-state.d.ts +7 -0
- package/dist/modules/vm-state.js +44 -0
- package/dist/program/AccountResolver.d.ts +67 -0
- package/dist/program/AccountResolver.js +134 -0
- package/dist/program/BorshSchemaGenerator.d.ts +8 -0
- package/dist/program/BorshSchemaGenerator.js +57 -0
- package/dist/program/FiveProgram.d.ts +144 -0
- package/dist/program/FiveProgram.js +282 -0
- package/dist/program/FunctionBuilder.d.ts +114 -0
- package/dist/program/FunctionBuilder.js +347 -0
- package/dist/program/ProgramAccount.d.ts +38 -0
- package/dist/program/ProgramAccount.js +170 -0
- package/dist/program/TypeGenerator.d.ts +90 -0
- package/dist/program/TypeGenerator.js +195 -0
- package/dist/program/index.d.ts +24 -0
- package/dist/program/index.js +21 -0
- package/dist/project/config.d.ts +5 -0
- package/dist/project/config.js +33 -0
- package/dist/project/toml.d.ts +6 -0
- package/dist/project/toml.js +43 -0
- package/dist/project/workspace.d.ts +160 -0
- package/dist/project/workspace.js +73 -0
- package/dist/testing/AccountMetaGenerator.d.ts +121 -0
- package/dist/testing/AccountMetaGenerator.js +261 -0
- package/dist/testing/AccountTestFixture.d.ts +211 -0
- package/dist/testing/AccountTestFixture.js +530 -0
- package/dist/testing/OnChainAccountManager.d.ts +81 -0
- package/dist/testing/OnChainAccountManager.js +260 -0
- package/dist/testing/StateSerializer.d.ts +65 -0
- package/dist/testing/StateSerializer.js +330 -0
- package/dist/testing/TestDiscovery.d.ts +79 -0
- package/dist/testing/TestDiscovery.js +274 -0
- package/dist/testing/TestRunner.d.ts +117 -0
- package/dist/testing/TestRunner.js +346 -0
- package/dist/testing/index.d.ts +14 -0
- package/dist/testing/index.js +13 -0
- package/dist/types.d.ts +356 -0
- package/dist/types.js +32 -0
- package/dist/utils/abi.d.ts +31 -0
- package/dist/utils/abi.js +92 -0
- package/dist/utils/transaction.d.ts +5 -0
- package/dist/utils/transaction.js +48 -0
- package/dist/validation/InputValidator.d.ts +142 -0
- package/dist/validation/InputValidator.js +332 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/index.js +4 -0
- package/dist/wasm/compiler/AbiLogic.d.ts +4 -0
- package/dist/wasm/compiler/AbiLogic.js +37 -0
- package/dist/wasm/compiler/AnalysisLogic.d.ts +6 -0
- package/dist/wasm/compiler/AnalysisLogic.js +61 -0
- package/dist/wasm/compiler/CompilationLogic.d.ts +10 -0
- package/dist/wasm/compiler/CompilationLogic.js +431 -0
- package/dist/wasm/compiler/FiveCompiler.d.ts +48 -0
- package/dist/wasm/compiler/FiveCompiler.js +183 -0
- package/dist/wasm/compiler/InfoLogic.d.ts +6 -0
- package/dist/wasm/compiler/InfoLogic.js +24 -0
- package/dist/wasm/compiler/OptimizationLogic.d.ts +2 -0
- package/dist/wasm/compiler/OptimizationLogic.js +13 -0
- package/dist/wasm/compiler/ValidationLogic.d.ts +7 -0
- package/dist/wasm/compiler/ValidationLogic.js +26 -0
- package/dist/wasm/compiler/index.d.ts +2 -0
- package/dist/wasm/compiler/index.js +2 -0
- package/dist/wasm/compiler/types.d.ts +8 -0
- package/dist/wasm/compiler/types.js +1 -0
- package/dist/wasm/compiler/utils.d.ts +8 -0
- package/dist/wasm/compiler/utils.js +75 -0
- package/dist/wasm/index.d.ts +9 -0
- package/dist/wasm/index.js +12 -0
- package/dist/wasm/instance.d.ts +1 -0
- package/dist/wasm/instance.js +26 -0
- package/dist/wasm/loader.d.ts +7 -0
- package/dist/wasm/loader.js +112 -0
- package/dist/wasm/vm.d.ts +33 -0
- package/dist/wasm/vm.js +250 -0
- package/package.json +59 -0
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Bytecode analyzer for WASM
|
|
6
|
+
*/
|
|
7
|
+
export class BytecodeAnalyzer {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Analyze bytecode and return instruction breakdown (legacy method for compatibility)
|
|
13
|
+
*/
|
|
14
|
+
static analyze(bytecode: Uint8Array): any;
|
|
15
|
+
/**
|
|
16
|
+
* Get detailed opcode flow analysis - shows execution paths through the bytecode
|
|
17
|
+
*/
|
|
18
|
+
static analyze_execution_flow(bytecode: Uint8Array): any;
|
|
19
|
+
/**
|
|
20
|
+
* Get detailed information about a specific instruction at an offset
|
|
21
|
+
*/
|
|
22
|
+
static analyze_instruction_at(bytecode: Uint8Array, offset: number): any;
|
|
23
|
+
/**
|
|
24
|
+
* Advanced semantic analysis with full opcode understanding and instruction flow
|
|
25
|
+
* Performs semantic analysis of bytecode to understand opcode behavior
|
|
26
|
+
* and instruction flow.
|
|
27
|
+
*/
|
|
28
|
+
static analyze_semantic(bytecode: Uint8Array): any;
|
|
29
|
+
/**
|
|
30
|
+
* Get summary statistics about the bytecode
|
|
31
|
+
*/
|
|
32
|
+
static get_bytecode_summary(bytecode: Uint8Array): any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Bytecode Encoding utilities for JavaScript (Fixed Size)
|
|
37
|
+
*/
|
|
38
|
+
export class BytecodeEncoder {
|
|
39
|
+
private constructor();
|
|
40
|
+
free(): void;
|
|
41
|
+
[Symbol.dispose](): void;
|
|
42
|
+
/**
|
|
43
|
+
* Decode a u16 value
|
|
44
|
+
* Returns [value, bytes_consumed] or null if invalid
|
|
45
|
+
*/
|
|
46
|
+
static decode_u16(bytes: Uint8Array): Array<any> | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Decode a u32 value
|
|
49
|
+
* Returns [value, bytes_consumed] or null if invalid
|
|
50
|
+
*/
|
|
51
|
+
static decode_u32(bytes: Uint8Array): Array<any> | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Encode a u16 value
|
|
54
|
+
* Returns [size, byte1, byte2]
|
|
55
|
+
*/
|
|
56
|
+
static encode_u16(value: number): Array<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Encode a u32 value
|
|
59
|
+
* Returns [size, byte1, byte2, byte3, byte4]
|
|
60
|
+
*/
|
|
61
|
+
static encode_u32(value: number): Array<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Calculate encoded size (Always 2 for u16)
|
|
64
|
+
*/
|
|
65
|
+
static encoded_size_u16(_value: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* Calculate encoded size (Always 4 for u32)
|
|
68
|
+
*/
|
|
69
|
+
static encoded_size_u32(_value: number): number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Execution result.
|
|
74
|
+
*/
|
|
75
|
+
export enum ExecutionStatus {
|
|
76
|
+
/**
|
|
77
|
+
* All operations completed successfully.
|
|
78
|
+
*/
|
|
79
|
+
Completed = 0,
|
|
80
|
+
/**
|
|
81
|
+
* Execution stopped because it hit a system program call that cannot be executed in WASM.
|
|
82
|
+
*/
|
|
83
|
+
StoppedAtSystemCall = 1,
|
|
84
|
+
/**
|
|
85
|
+
* Execution stopped because it hit an INIT_PDA operation that requires real Solana context.
|
|
86
|
+
*/
|
|
87
|
+
StoppedAtInitPDA = 2,
|
|
88
|
+
/**
|
|
89
|
+
* Execution stopped because it hit an INVOKE operation that requires real RPC.
|
|
90
|
+
*/
|
|
91
|
+
StoppedAtInvoke = 3,
|
|
92
|
+
/**
|
|
93
|
+
* Execution stopped because it hit an INVOKE_SIGNED operation that requires real RPC.
|
|
94
|
+
*/
|
|
95
|
+
StoppedAtInvokeSigned = 4,
|
|
96
|
+
/**
|
|
97
|
+
* Execution stopped because compute limit was reached.
|
|
98
|
+
*/
|
|
99
|
+
ComputeLimitExceeded = 5,
|
|
100
|
+
/**
|
|
101
|
+
* Execution failed due to an error.
|
|
102
|
+
*/
|
|
103
|
+
Failed = 6,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* JavaScript-compatible VM state representation.
|
|
108
|
+
*/
|
|
109
|
+
export class FiveVMState {
|
|
110
|
+
private constructor();
|
|
111
|
+
free(): void;
|
|
112
|
+
[Symbol.dispose](): void;
|
|
113
|
+
readonly compute_units: bigint;
|
|
114
|
+
readonly instruction_pointer: number;
|
|
115
|
+
readonly stack: Array<any>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Main WASM VM wrapper.
|
|
120
|
+
*/
|
|
121
|
+
export class FiveVMWasm {
|
|
122
|
+
free(): void;
|
|
123
|
+
[Symbol.dispose](): void;
|
|
124
|
+
/**
|
|
125
|
+
* Execute VM with input data and accounts (legacy method).
|
|
126
|
+
*/
|
|
127
|
+
execute(input_data: Uint8Array, accounts: Array<any>): any;
|
|
128
|
+
/**
|
|
129
|
+
* Execute VM with partial execution support - stops at system calls.
|
|
130
|
+
*/
|
|
131
|
+
execute_partial(input_data: Uint8Array, accounts: Array<any>): TestResult;
|
|
132
|
+
/**
|
|
133
|
+
* Get VM constants for JavaScript
|
|
134
|
+
*/
|
|
135
|
+
static get_constants(): any;
|
|
136
|
+
/**
|
|
137
|
+
* Get current VM state
|
|
138
|
+
*/
|
|
139
|
+
get_state(): any;
|
|
140
|
+
/**
|
|
141
|
+
* Create new VM instance with bytecode.
|
|
142
|
+
*/
|
|
143
|
+
constructor(_bytecode: Uint8Array);
|
|
144
|
+
/**
|
|
145
|
+
* Validate bytecode without execution
|
|
146
|
+
*/
|
|
147
|
+
static validate_bytecode(bytecode: Uint8Array): boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Parameter encoding utilities using fixed-size encoding and protocol types
|
|
152
|
+
*/
|
|
153
|
+
export class ParameterEncoder {
|
|
154
|
+
private constructor();
|
|
155
|
+
free(): void;
|
|
156
|
+
[Symbol.dispose](): void;
|
|
157
|
+
/**
|
|
158
|
+
* Encode function parameters using fixed size encoding
|
|
159
|
+
* Returns ONLY parameter data - SDK handles discriminator AND function index
|
|
160
|
+
*/
|
|
161
|
+
static encode_execute(_function_index: number, params: Array<any>): Uint8Array;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Detailed execution result.
|
|
166
|
+
*/
|
|
167
|
+
export class TestResult {
|
|
168
|
+
private constructor();
|
|
169
|
+
free(): void;
|
|
170
|
+
[Symbol.dispose](): void;
|
|
171
|
+
/**
|
|
172
|
+
* Compute units consumed.
|
|
173
|
+
*/
|
|
174
|
+
compute_units_used: bigint;
|
|
175
|
+
/**
|
|
176
|
+
* Final instruction pointer.
|
|
177
|
+
*/
|
|
178
|
+
instruction_pointer: number;
|
|
179
|
+
/**
|
|
180
|
+
* Which opcode caused the stop (if stopped at system call).
|
|
181
|
+
*/
|
|
182
|
+
get stopped_at_opcode(): number | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Which opcode caused the stop (if stopped at system call).
|
|
185
|
+
*/
|
|
186
|
+
set stopped_at_opcode(value: number | null | undefined);
|
|
187
|
+
readonly error_message: string | undefined;
|
|
188
|
+
readonly execution_context: string | undefined;
|
|
189
|
+
readonly final_accounts: Array<any>;
|
|
190
|
+
readonly final_memory: Uint8Array;
|
|
191
|
+
readonly final_stack: Array<any>;
|
|
192
|
+
readonly get_result_value: any;
|
|
193
|
+
readonly has_result_value: boolean;
|
|
194
|
+
readonly status: string;
|
|
195
|
+
readonly stopped_at_opcode_name: string | undefined;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* JavaScript-compatible account representation.
|
|
200
|
+
*/
|
|
201
|
+
export class WasmAccount {
|
|
202
|
+
free(): void;
|
|
203
|
+
[Symbol.dispose](): void;
|
|
204
|
+
constructor(key: Uint8Array, data: Uint8Array, lamports: bigint, is_writable: boolean, is_signer: boolean, owner: Uint8Array);
|
|
205
|
+
is_signer: boolean;
|
|
206
|
+
is_writable: boolean;
|
|
207
|
+
lamports: bigint;
|
|
208
|
+
data: Uint8Array;
|
|
209
|
+
readonly key: Uint8Array;
|
|
210
|
+
readonly owner: Uint8Array;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* WASM source analysis result
|
|
215
|
+
*/
|
|
216
|
+
export class WasmAnalysisResult {
|
|
217
|
+
private constructor();
|
|
218
|
+
free(): void;
|
|
219
|
+
[Symbol.dispose](): void;
|
|
220
|
+
/**
|
|
221
|
+
* Get parsed metrics as JavaScript object
|
|
222
|
+
*/
|
|
223
|
+
get_metrics_object(): any;
|
|
224
|
+
/**
|
|
225
|
+
* Analysis time in milliseconds
|
|
226
|
+
*/
|
|
227
|
+
analysis_time: number;
|
|
228
|
+
/**
|
|
229
|
+
* Whether analysis succeeded
|
|
230
|
+
*/
|
|
231
|
+
success: boolean;
|
|
232
|
+
readonly errors: Array<any>;
|
|
233
|
+
readonly metrics: string;
|
|
234
|
+
readonly summary: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Compilation options for enhanced error reporting and formatting
|
|
239
|
+
*/
|
|
240
|
+
export class WasmCompilationOptions {
|
|
241
|
+
free(): void;
|
|
242
|
+
[Symbol.dispose](): void;
|
|
243
|
+
/**
|
|
244
|
+
* Create development-debug configuration
|
|
245
|
+
*/
|
|
246
|
+
static development_debug(): WasmCompilationOptions;
|
|
247
|
+
/**
|
|
248
|
+
* Create fast iteration configuration
|
|
249
|
+
*/
|
|
250
|
+
static fast_iteration(): WasmCompilationOptions;
|
|
251
|
+
/**
|
|
252
|
+
* Create default compilation options
|
|
253
|
+
*/
|
|
254
|
+
constructor();
|
|
255
|
+
/**
|
|
256
|
+
* Create production-optimized configuration
|
|
257
|
+
*/
|
|
258
|
+
static production_optimized(): WasmCompilationOptions;
|
|
259
|
+
/**
|
|
260
|
+
* Set analysis depth level
|
|
261
|
+
*/
|
|
262
|
+
with_analysis_depth(depth: string): WasmCompilationOptions;
|
|
263
|
+
/**
|
|
264
|
+
* Enable or disable complexity analysis
|
|
265
|
+
*/
|
|
266
|
+
with_complexity_analysis(enabled: boolean): WasmCompilationOptions;
|
|
267
|
+
/**
|
|
268
|
+
* Enable or disable comprehensive metrics collection
|
|
269
|
+
*/
|
|
270
|
+
with_comprehensive_metrics(enabled: boolean): WasmCompilationOptions;
|
|
271
|
+
/**
|
|
272
|
+
* Enable or disable bytecode compression
|
|
273
|
+
*/
|
|
274
|
+
with_compression(enabled: boolean): WasmCompilationOptions;
|
|
275
|
+
/**
|
|
276
|
+
* Enable or disable constraint caching optimization
|
|
277
|
+
*/
|
|
278
|
+
with_constraint_cache(enabled: boolean): WasmCompilationOptions;
|
|
279
|
+
/**
|
|
280
|
+
* Enable or disable debug information
|
|
281
|
+
*/
|
|
282
|
+
with_debug_info(enabled: boolean): WasmCompilationOptions;
|
|
283
|
+
/**
|
|
284
|
+
* Enable or disable enhanced error reporting
|
|
285
|
+
*/
|
|
286
|
+
with_enhanced_errors(enabled: boolean): WasmCompilationOptions;
|
|
287
|
+
/**
|
|
288
|
+
* Set error output format
|
|
289
|
+
*/
|
|
290
|
+
with_error_format(format: string): WasmCompilationOptions;
|
|
291
|
+
/**
|
|
292
|
+
* Set export format
|
|
293
|
+
*/
|
|
294
|
+
with_export_format(format: string): WasmCompilationOptions;
|
|
295
|
+
/**
|
|
296
|
+
* Enable or disable basic metrics collection
|
|
297
|
+
*/
|
|
298
|
+
with_metrics(enabled: boolean): WasmCompilationOptions;
|
|
299
|
+
/**
|
|
300
|
+
* Set metrics export format
|
|
301
|
+
*/
|
|
302
|
+
with_metrics_format(format: string): WasmCompilationOptions;
|
|
303
|
+
/**
|
|
304
|
+
* Set compilation mode
|
|
305
|
+
*/
|
|
306
|
+
with_mode(mode: string): WasmCompilationOptions;
|
|
307
|
+
/**
|
|
308
|
+
* Enable or disable module namespace qualification
|
|
309
|
+
*/
|
|
310
|
+
with_module_namespaces(enabled: boolean): WasmCompilationOptions;
|
|
311
|
+
/**
|
|
312
|
+
* Set optimization level (production)
|
|
313
|
+
*/
|
|
314
|
+
with_optimization_level(level: string): WasmCompilationOptions;
|
|
315
|
+
/**
|
|
316
|
+
* Enable or disable performance analysis
|
|
317
|
+
*/
|
|
318
|
+
with_performance_analysis(enabled: boolean): WasmCompilationOptions;
|
|
319
|
+
/**
|
|
320
|
+
* Enable or disable quiet mode
|
|
321
|
+
*/
|
|
322
|
+
with_quiet(enabled: boolean): WasmCompilationOptions;
|
|
323
|
+
/**
|
|
324
|
+
* Set source file name for better error reporting
|
|
325
|
+
*/
|
|
326
|
+
with_source_file(filename: string): WasmCompilationOptions;
|
|
327
|
+
/**
|
|
328
|
+
* Enable or disable compilation summary
|
|
329
|
+
*/
|
|
330
|
+
with_summary(enabled: boolean): WasmCompilationOptions;
|
|
331
|
+
/**
|
|
332
|
+
* Enable or disable v2-preview features
|
|
333
|
+
*/
|
|
334
|
+
with_v2_preview(enabled: boolean): WasmCompilationOptions;
|
|
335
|
+
/**
|
|
336
|
+
* Enable or disable verbose output
|
|
337
|
+
*/
|
|
338
|
+
with_verbose(enabled: boolean): WasmCompilationOptions;
|
|
339
|
+
/**
|
|
340
|
+
* Include complexity analysis
|
|
341
|
+
*/
|
|
342
|
+
complexity_analysis: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Include comprehensive metrics collection
|
|
345
|
+
*/
|
|
346
|
+
comprehensive_metrics: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Enable bytecode compression
|
|
349
|
+
*/
|
|
350
|
+
compress_output: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Enable constraint caching optimization
|
|
353
|
+
*/
|
|
354
|
+
enable_constraint_cache: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Enable module namespace qualification (module::function)
|
|
357
|
+
*/
|
|
358
|
+
enable_module_namespaces: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Enable enhanced error reporting with suggestions
|
|
361
|
+
*/
|
|
362
|
+
enhanced_errors: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Include debug information
|
|
365
|
+
*/
|
|
366
|
+
include_debug_info: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* Include basic metrics
|
|
369
|
+
*/
|
|
370
|
+
include_metrics: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Include performance analysis
|
|
373
|
+
*/
|
|
374
|
+
performance_analysis: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Suppress non-essential output
|
|
377
|
+
*/
|
|
378
|
+
quiet: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Show compilation summary
|
|
381
|
+
*/
|
|
382
|
+
summary: boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Enable v2-preview features (nibble immediates, BR_EQ_U8, etc.)
|
|
385
|
+
*/
|
|
386
|
+
v2_preview: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Verbose output
|
|
389
|
+
*/
|
|
390
|
+
verbose: boolean;
|
|
391
|
+
readonly analysis_depth: string;
|
|
392
|
+
readonly error_format: string;
|
|
393
|
+
readonly export_format: string;
|
|
394
|
+
readonly metrics_format: string;
|
|
395
|
+
readonly mode: string;
|
|
396
|
+
readonly optimization_level: string;
|
|
397
|
+
readonly source_file: string | undefined;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* WASM compilation result - unified with enhanced error support
|
|
402
|
+
*/
|
|
403
|
+
export class WasmCompilationResult {
|
|
404
|
+
private constructor();
|
|
405
|
+
free(): void;
|
|
406
|
+
[Symbol.dispose](): void;
|
|
407
|
+
/**
|
|
408
|
+
* Get all errors as JSON array
|
|
409
|
+
*/
|
|
410
|
+
format_all_json(): string;
|
|
411
|
+
/**
|
|
412
|
+
* Get all errors formatted as terminal output
|
|
413
|
+
*/
|
|
414
|
+
format_all_terminal(): string;
|
|
415
|
+
get_formatted_errors_json(): string;
|
|
416
|
+
get_formatted_errors_terminal(): string;
|
|
417
|
+
/**
|
|
418
|
+
* Get fully detailed metrics regardless of export format
|
|
419
|
+
*/
|
|
420
|
+
get_metrics_detailed(): any;
|
|
421
|
+
/**
|
|
422
|
+
* Get parsed metrics as JavaScript object
|
|
423
|
+
*/
|
|
424
|
+
get_metrics_object(): any;
|
|
425
|
+
/**
|
|
426
|
+
* Size of generated bytecode
|
|
427
|
+
*/
|
|
428
|
+
bytecode_size: number;
|
|
429
|
+
/**
|
|
430
|
+
* Compilation time in milliseconds
|
|
431
|
+
*/
|
|
432
|
+
compilation_time: number;
|
|
433
|
+
/**
|
|
434
|
+
* Total error count
|
|
435
|
+
*/
|
|
436
|
+
error_count: number;
|
|
437
|
+
/**
|
|
438
|
+
* Whether compilation succeeded
|
|
439
|
+
*/
|
|
440
|
+
success: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Total warning count
|
|
443
|
+
*/
|
|
444
|
+
warning_count: number;
|
|
445
|
+
readonly abi: any;
|
|
446
|
+
readonly bytecode: Uint8Array | undefined;
|
|
447
|
+
readonly compiler_errors: WasmCompilerError[];
|
|
448
|
+
readonly disassembly: Array<any>;
|
|
449
|
+
readonly errors: Array<any>;
|
|
450
|
+
readonly metrics: string;
|
|
451
|
+
readonly metrics_format: string;
|
|
452
|
+
readonly warnings: Array<any>;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* WASM compilation result with comprehensive metrics
|
|
457
|
+
*/
|
|
458
|
+
export class WasmCompilationWithMetrics {
|
|
459
|
+
private constructor();
|
|
460
|
+
free(): void;
|
|
461
|
+
[Symbol.dispose](): void;
|
|
462
|
+
/**
|
|
463
|
+
* Get parsed metrics as JavaScript object
|
|
464
|
+
*/
|
|
465
|
+
get_metrics_object(): any;
|
|
466
|
+
/**
|
|
467
|
+
* Size of generated bytecode
|
|
468
|
+
*/
|
|
469
|
+
bytecode_size: number;
|
|
470
|
+
/**
|
|
471
|
+
* Compilation time in milliseconds
|
|
472
|
+
*/
|
|
473
|
+
compilation_time: number;
|
|
474
|
+
/**
|
|
475
|
+
* Whether compilation succeeded
|
|
476
|
+
*/
|
|
477
|
+
success: boolean;
|
|
478
|
+
readonly bytecode: Uint8Array | undefined;
|
|
479
|
+
readonly errors: Array<any>;
|
|
480
|
+
readonly metrics: string;
|
|
481
|
+
readonly warnings: Array<any>;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Enhanced compiler error for WASM
|
|
486
|
+
*/
|
|
487
|
+
export class WasmCompilerError {
|
|
488
|
+
private constructor();
|
|
489
|
+
free(): void;
|
|
490
|
+
[Symbol.dispose](): void;
|
|
491
|
+
/**
|
|
492
|
+
* Get error as JSON string
|
|
493
|
+
*/
|
|
494
|
+
format_json(): string;
|
|
495
|
+
/**
|
|
496
|
+
* Get formatted error message (terminal style)
|
|
497
|
+
* Get formatted error message (terminal style)
|
|
498
|
+
*/
|
|
499
|
+
format_terminal(): string;
|
|
500
|
+
readonly category: string;
|
|
501
|
+
readonly code: string;
|
|
502
|
+
readonly column: any;
|
|
503
|
+
readonly description: string | undefined;
|
|
504
|
+
readonly line: any;
|
|
505
|
+
readonly location: WasmSourceLocation | undefined;
|
|
506
|
+
readonly message: string;
|
|
507
|
+
readonly severity: string;
|
|
508
|
+
readonly source_line: string | undefined;
|
|
509
|
+
readonly suggestions: WasmSuggestion[];
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Enhanced compilation result with rich error information
|
|
514
|
+
*/
|
|
515
|
+
export class WasmEnhancedCompilationResult {
|
|
516
|
+
private constructor();
|
|
517
|
+
free(): void;
|
|
518
|
+
[Symbol.dispose](): void;
|
|
519
|
+
/**
|
|
520
|
+
* Get all errors as JSON array
|
|
521
|
+
*/
|
|
522
|
+
format_all_json(): string;
|
|
523
|
+
/**
|
|
524
|
+
* Get all errors formatted as terminal output
|
|
525
|
+
*/
|
|
526
|
+
format_all_terminal(): string;
|
|
527
|
+
/**
|
|
528
|
+
* Size of generated bytecode
|
|
529
|
+
*/
|
|
530
|
+
bytecode_size: number;
|
|
531
|
+
/**
|
|
532
|
+
* Compilation time in milliseconds
|
|
533
|
+
*/
|
|
534
|
+
compilation_time: number;
|
|
535
|
+
/**
|
|
536
|
+
* Total error count
|
|
537
|
+
*/
|
|
538
|
+
error_count: number;
|
|
539
|
+
/**
|
|
540
|
+
* Whether compilation succeeded
|
|
541
|
+
*/
|
|
542
|
+
success: boolean;
|
|
543
|
+
/**
|
|
544
|
+
* Total warning count
|
|
545
|
+
*/
|
|
546
|
+
warning_count: number;
|
|
547
|
+
readonly compiler_errors: WasmCompilerError[];
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* WASM DSL Compiler for client-side compilation
|
|
552
|
+
*/
|
|
553
|
+
export class WasmFiveCompiler {
|
|
554
|
+
free(): void;
|
|
555
|
+
[Symbol.dispose](): void;
|
|
556
|
+
/**
|
|
557
|
+
* Get detailed analysis of source code
|
|
558
|
+
*/
|
|
559
|
+
analyze_source(source: string): WasmAnalysisResult;
|
|
560
|
+
/**
|
|
561
|
+
* Get detailed analysis of source code with compilation mode selection
|
|
562
|
+
*/
|
|
563
|
+
analyze_source_mode(source: string, mode: string): WasmAnalysisResult;
|
|
564
|
+
/**
|
|
565
|
+
* Unified compilation method with enhanced error reporting and metrics
|
|
566
|
+
*/
|
|
567
|
+
compile(source: string, options: WasmCompilationOptions): WasmCompilationResult;
|
|
568
|
+
/**
|
|
569
|
+
* Compile multi-file project with explicit module list
|
|
570
|
+
*/
|
|
571
|
+
compileModules(module_files: any, entry_point: string, options: WasmCompilationOptions): WasmCompilationResult;
|
|
572
|
+
/**
|
|
573
|
+
* Compile multi-file project with automatic discovery
|
|
574
|
+
*/
|
|
575
|
+
compileMultiWithDiscovery(entry_point: string, options: WasmCompilationOptions): WasmCompilationResult;
|
|
576
|
+
/**
|
|
577
|
+
* Multi-file compilation using module merger (main source + modules)
|
|
578
|
+
*/
|
|
579
|
+
compile_multi(main_source: string, modules: any, options: WasmCompilationOptions): WasmCompilationResult;
|
|
580
|
+
/**
|
|
581
|
+
* Compile DSL and generate both bytecode and ABI
|
|
582
|
+
*/
|
|
583
|
+
compile_with_abi(source: string): any;
|
|
584
|
+
/**
|
|
585
|
+
* Discover modules starting from an entry point
|
|
586
|
+
*/
|
|
587
|
+
discoverModules(entry_point: string): any;
|
|
588
|
+
/**
|
|
589
|
+
* Extract function name metadata from compiled bytecode
|
|
590
|
+
* Returns a list of discovered functions in the bytecode
|
|
591
|
+
*/
|
|
592
|
+
extractFunctionMetadata(bytecode: Uint8Array): any;
|
|
593
|
+
/**
|
|
594
|
+
* Extract account definitions from DSL source code
|
|
595
|
+
*/
|
|
596
|
+
extract_account_definitions(source: string): any;
|
|
597
|
+
/**
|
|
598
|
+
* Extract function signatures with account parameters
|
|
599
|
+
*/
|
|
600
|
+
extract_function_signatures(source: string): any;
|
|
601
|
+
/**
|
|
602
|
+
* Format an error message using the native terminal formatter
|
|
603
|
+
* This provides rich Rust-style error output with source context and colors
|
|
604
|
+
*/
|
|
605
|
+
format_error_terminal(message: string, code: string, severity: string, line: number, column: number, _source: string): string;
|
|
606
|
+
/**
|
|
607
|
+
* Generate ABI from DSL source code for function calls
|
|
608
|
+
*/
|
|
609
|
+
generate_abi(source: string): any;
|
|
610
|
+
/**
|
|
611
|
+
* Get compiler statistics
|
|
612
|
+
*/
|
|
613
|
+
get_compiler_stats(): any;
|
|
614
|
+
/**
|
|
615
|
+
* Get comprehensive compiler statistics including which opcodes are used vs unused
|
|
616
|
+
*/
|
|
617
|
+
get_opcode_analysis(source: string): any;
|
|
618
|
+
/**
|
|
619
|
+
* Get opcode usage statistics from compilation
|
|
620
|
+
*/
|
|
621
|
+
get_opcode_usage(source: string): any;
|
|
622
|
+
/**
|
|
623
|
+
* Create a new WASM compiler instance
|
|
624
|
+
*/
|
|
625
|
+
constructor();
|
|
626
|
+
/**
|
|
627
|
+
* Optimize bytecode
|
|
628
|
+
*/
|
|
629
|
+
optimize_bytecode(bytecode: Uint8Array): Uint8Array;
|
|
630
|
+
/**
|
|
631
|
+
* Parse DSL source code and return AST information
|
|
632
|
+
*/
|
|
633
|
+
parse_dsl(source: string): any;
|
|
634
|
+
/**
|
|
635
|
+
* Type-check parsed AST
|
|
636
|
+
*/
|
|
637
|
+
type_check(_ast_json: string): any;
|
|
638
|
+
/**
|
|
639
|
+
* Validate account constraints against function parameters
|
|
640
|
+
*/
|
|
641
|
+
validate_account_constraints(source: string, function_name: string, accounts_json: string): any;
|
|
642
|
+
/**
|
|
643
|
+
* Validate DSL syntax without full compilation
|
|
644
|
+
*/
|
|
645
|
+
validate_syntax(source: string): any;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* WASM-exposed metrics collector wrapper
|
|
650
|
+
*/
|
|
651
|
+
export class WasmMetricsCollector {
|
|
652
|
+
free(): void;
|
|
653
|
+
[Symbol.dispose](): void;
|
|
654
|
+
/**
|
|
655
|
+
* End the current compilation phase
|
|
656
|
+
*/
|
|
657
|
+
end_phase(): void;
|
|
658
|
+
/**
|
|
659
|
+
* Export metrics in the requested format
|
|
660
|
+
*/
|
|
661
|
+
export(format: string): string;
|
|
662
|
+
/**
|
|
663
|
+
* Finalize metrics collection
|
|
664
|
+
*/
|
|
665
|
+
finalize(): void;
|
|
666
|
+
/**
|
|
667
|
+
* Get metrics as a JS object for programmatic use
|
|
668
|
+
*/
|
|
669
|
+
get_metrics_object(): any;
|
|
670
|
+
constructor();
|
|
671
|
+
/**
|
|
672
|
+
* Reset the collector for a new compilation
|
|
673
|
+
*/
|
|
674
|
+
reset(): void;
|
|
675
|
+
/**
|
|
676
|
+
* Start timing a compilation phase
|
|
677
|
+
*/
|
|
678
|
+
start_phase(phase_name: string): void;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Enhanced source location for WASM
|
|
683
|
+
*/
|
|
684
|
+
export class WasmSourceLocation {
|
|
685
|
+
private constructor();
|
|
686
|
+
free(): void;
|
|
687
|
+
[Symbol.dispose](): void;
|
|
688
|
+
/**
|
|
689
|
+
* Column number (1-based)
|
|
690
|
+
*/
|
|
691
|
+
column: number;
|
|
692
|
+
/**
|
|
693
|
+
* Length of the relevant text
|
|
694
|
+
*/
|
|
695
|
+
length: number;
|
|
696
|
+
/**
|
|
697
|
+
* Line number (1-based)
|
|
698
|
+
*/
|
|
699
|
+
line: number;
|
|
700
|
+
/**
|
|
701
|
+
* Byte offset in source
|
|
702
|
+
*/
|
|
703
|
+
offset: number;
|
|
704
|
+
readonly file: string | undefined;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Enhanced error suggestion for WASM
|
|
709
|
+
*/
|
|
710
|
+
export class WasmSuggestion {
|
|
711
|
+
private constructor();
|
|
712
|
+
free(): void;
|
|
713
|
+
[Symbol.dispose](): void;
|
|
714
|
+
/**
|
|
715
|
+
* Confidence score (0.0 to 1.0)
|
|
716
|
+
*/
|
|
717
|
+
confidence: number;
|
|
718
|
+
readonly code_suggestion: string | undefined;
|
|
719
|
+
readonly explanation: string | undefined;
|
|
720
|
+
readonly message: string;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Get function names from bytecode as a JS value (array of objects)
|
|
725
|
+
*
|
|
726
|
+
* This function avoids constructing `FunctionNameInfo` JS instances and instead
|
|
727
|
+
* marshals the parsed metadata directly into a serde-friendly structure and
|
|
728
|
+
* returns a `JsValue` via `JsValue::from_serde`.
|
|
729
|
+
*/
|
|
730
|
+
export function get_function_names(bytecode: Uint8Array): any;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Get the count of public functions from bytecode header
|
|
734
|
+
*/
|
|
735
|
+
export function get_public_function_count(bytecode: Uint8Array): number;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Get information about the WASM compiler capabilities
|
|
739
|
+
*/
|
|
740
|
+
export function get_wasm_compiler_info(): any;
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Helper function to convert JS value to VM Value
|
|
744
|
+
*/
|
|
745
|
+
export function js_value_to_vm_value(js_val: any, value_type: number): any;
|
|
746
|
+
|
|
747
|
+
export function log_to_console(message: string): void;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Parse function names from bytecode metadata
|
|
751
|
+
*
|
|
752
|
+
* Returns a JS value which is a JSON string encoding an array of objects:
|
|
753
|
+
* [ { "name": "...", "function_index": N }, ... ]
|
|
754
|
+
* We serialize via serde_json and return the JSON string as a `JsValue` to
|
|
755
|
+
* avoid complex JS object construction in Rust/WASM glue.
|
|
756
|
+
*/
|
|
757
|
+
export function parse_function_names(bytecode: Uint8Array): any;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Utility: Validate optimized headers and mirror bytecode back to JS callers
|
|
761
|
+
*/
|
|
762
|
+
export function wrap_with_script_header(bytecode: Uint8Array): Uint8Array;
|