@fluffylabs/anan-as 1.1.3-cc868cf → 1.1.3-e3864a9
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 +65 -7
- package/dist/bin/build-inline.js +70 -0
- package/dist/bin/fuzz.js +172 -0
- package/dist/bin/index.js +220 -0
- package/dist/bin/test-gas-cost.js +57 -0
- package/dist/bin/test-json.js +135 -0
- package/dist/bin/test-w3f.js +119 -0
- package/dist/bin/test.js +3 -0
- package/dist/build/compiler-inline.d.ts +11 -0
- package/dist/build/compiler-inline.js +22 -0
- package/dist/build/compiler.d.ts +26 -0
- package/dist/build/compiler.js +76 -0
- package/dist/build/compiler.wasm +0 -0
- package/{build → dist/build}/debug-inline.d.ts +1 -1
- package/dist/build/debug-inline.js +22 -0
- package/{build → dist/build}/debug-raw-inline.d.ts +1 -1
- package/dist/build/debug-raw-inline.js +22 -0
- package/{build → dist/build}/debug-raw.d.ts +100 -39
- package/{build → dist/build}/debug-raw.js +88 -37
- package/dist/build/debug-raw.wasm +0 -0
- package/{build → dist/build}/debug.d.ts +100 -39
- package/{build → dist/build}/debug.js +94 -39
- package/dist/build/debug.wasm +0 -0
- package/{build → dist/build}/release-inline.d.ts +1 -1
- package/dist/build/release-inline.js +22 -0
- package/{build → dist/build}/release-mini-inline.d.ts +1 -1
- package/dist/build/release-mini-inline.js +22 -0
- package/{build → dist/build}/release-mini.d.ts +100 -39
- package/{build → dist/build}/release-mini.js +94 -39
- package/dist/build/release-mini.wasm +0 -0
- package/{build → dist/build}/release-stub-inline.d.ts +1 -1
- package/dist/build/release-stub-inline.js +22 -0
- package/{build → dist/build}/release-stub.d.ts +100 -39
- package/{build → dist/build}/release-stub.js +94 -39
- package/dist/build/release-stub.wasm +0 -0
- package/{build → dist/build}/release.d.ts +100 -39
- package/{build → dist/build}/release.js +94 -39
- package/dist/build/release.wasm +0 -0
- package/{build → dist/build}/test-inline.d.ts +1 -1
- package/dist/build/test-inline.js +22 -0
- package/dist/build/test.wasm +0 -0
- package/dist/web/bump-version.js +7 -0
- package/package.json +46 -37
- package/build/debug-inline.js +0 -22
- package/build/debug-raw-inline.js +0 -22
- package/build/debug-raw.wasm +0 -0
- package/build/debug.wasm +0 -0
- package/build/release-inline.js +0 -22
- package/build/release-mini-inline.js +0 -22
- package/build/release-mini.wasm +0 -0
- package/build/release-stub-inline.js +0 -22
- package/build/release-stub.wasm +0 -0
- package/build/release.wasm +0 -0
- package/build/test-inline.js +0 -22
- package/build/test.wasm +0 -0
- /package/{build → dist/build}/test.d.ts +0 -0
- /package/{build → dist/build}/test.js +0 -0
|
@@ -6,22 +6,10 @@ export declare function __pin(ptr: number): number;
|
|
|
6
6
|
export declare function __unpin(ptr: number): void;
|
|
7
7
|
export declare function __collect(): void;
|
|
8
8
|
export declare const __rtti_base: number;
|
|
9
|
-
/**
|
|
10
|
-
* assembly/api-internal/getAssembly
|
|
11
|
-
* @param p `assembly/program/Program`
|
|
12
|
-
* @returns `~lib/string/String`
|
|
13
|
-
*/
|
|
14
|
-
export declare function getAssembly(p: __Internref26): string;
|
|
15
|
-
/**
|
|
16
|
-
* assembly/program-build/wrapAsProgram
|
|
17
|
-
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
18
|
-
* @returns `~lib/typedarray/Uint8Array`
|
|
19
|
-
*/
|
|
20
|
-
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
21
9
|
/**
|
|
22
10
|
* assembly/api-debugger/resetJAM
|
|
23
11
|
* @param program `~lib/array/Array<u8>`
|
|
24
|
-
* @param pc `
|
|
12
|
+
* @param pc `u32`
|
|
25
13
|
* @param initialGas `i64`
|
|
26
14
|
* @param args `~lib/array/Array<u8>`
|
|
27
15
|
* @param hasMetadata `bool`
|
|
@@ -116,6 +104,34 @@ export declare function getMemory(address: number, length: number): Uint8Array |
|
|
|
116
104
|
* @returns `bool`
|
|
117
105
|
*/
|
|
118
106
|
export declare function setMemory(address: number, data: Uint8Array): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* assembly/api-internal/getAssembly
|
|
109
|
+
* @param p `assembly/program/Program`
|
|
110
|
+
* @returns `~lib/string/String`
|
|
111
|
+
*/
|
|
112
|
+
export declare function getAssembly(p: __Internref26): string;
|
|
113
|
+
/**
|
|
114
|
+
* assembly/api-internal/runVm
|
|
115
|
+
* @param input `assembly/api-types/VmInput`
|
|
116
|
+
* @param logs `bool`
|
|
117
|
+
* @param useSbrkGas `bool`
|
|
118
|
+
* @returns `assembly/api-types/VmOutput`
|
|
119
|
+
*/
|
|
120
|
+
export declare function runVm(input: __Internref48, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
|
|
121
|
+
/**
|
|
122
|
+
* assembly/api-internal/getOutputChunks
|
|
123
|
+
* @param memory `assembly/memory/Memory`
|
|
124
|
+
* @returns `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
125
|
+
*/
|
|
126
|
+
export declare function getOutputChunks(memory: __Internref15): Array<__Record45<never>>;
|
|
127
|
+
/**
|
|
128
|
+
* assembly/api-internal/buildMemory
|
|
129
|
+
* @param builder `assembly/memory/MemoryBuilder`
|
|
130
|
+
* @param pages `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
131
|
+
* @param chunks `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
132
|
+
* @returns `assembly/memory/Memory`
|
|
133
|
+
*/
|
|
134
|
+
export declare function buildMemory(builder: __Internref40, pages: Array<__Record43<undefined>>, chunks: Array<__Record45<undefined>>): __Internref15;
|
|
119
135
|
/** assembly/api-utils/InputKind */
|
|
120
136
|
export declare enum InputKind {
|
|
121
137
|
/** @type `i32` */
|
|
@@ -137,7 +153,7 @@ export declare enum HasMetadata {
|
|
|
137
153
|
* @param withMetadata `i32`
|
|
138
154
|
* @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
|
|
139
155
|
*/
|
|
140
|
-
export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<
|
|
156
|
+
export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record54<never>>;
|
|
141
157
|
/**
|
|
142
158
|
* assembly/api-utils/disassemble
|
|
143
159
|
* @param input `~lib/array/Array<u8>`
|
|
@@ -152,12 +168,12 @@ export declare function disassemble(input: Array<number>, kind: number, withMeta
|
|
|
152
168
|
* @param hasMetadata `i32`
|
|
153
169
|
* @param program `~lib/array/Array<u8>`
|
|
154
170
|
* @param initialRegisters `~lib/array/Array<u64>`
|
|
155
|
-
* @param initialPageMap `~lib/array/Array<assembly/api-
|
|
156
|
-
* @param initialMemory `~lib/array/Array<assembly/api-
|
|
171
|
+
* @param initialPageMap `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
172
|
+
* @param initialMemory `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
157
173
|
* @param args `~lib/array/Array<u8>`
|
|
158
174
|
* @returns `assembly/spi/StandardProgram`
|
|
159
175
|
*/
|
|
160
|
-
export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<
|
|
176
|
+
export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record43<undefined>>, initialMemory: Array<__Record45<undefined>>, args: Array<number>): __Internref39;
|
|
161
177
|
/**
|
|
162
178
|
* assembly/api-utils/runProgram
|
|
163
179
|
* @param program `assembly/spi/StandardProgram`
|
|
@@ -165,23 +181,70 @@ export declare function prepareProgram(kind: number, hasMetadata: number, progra
|
|
|
165
181
|
* @param programCounter `u32`
|
|
166
182
|
* @param logs `bool`
|
|
167
183
|
* @param useSbrkGas `bool`
|
|
168
|
-
* @returns `assembly/api-
|
|
184
|
+
* @returns `assembly/api-types/VmOutput`
|
|
169
185
|
*/
|
|
170
|
-
export declare function runProgram(program:
|
|
186
|
+
export declare function runProgram(program: __Internref39, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
|
|
187
|
+
/**
|
|
188
|
+
* assembly/api-utils/runJAM
|
|
189
|
+
* @param pc `u32`
|
|
190
|
+
* @param gas `i64`
|
|
191
|
+
* @param program `~lib/array/Array<u8>`
|
|
192
|
+
* @param args `~lib/array/Array<u8>`
|
|
193
|
+
* @param logs `bool`
|
|
194
|
+
* @param useSbrkGas `bool`
|
|
195
|
+
* @returns `assembly/api-types/ReturnValue`
|
|
196
|
+
*/
|
|
197
|
+
export declare function runJAM(pc: number, gas: bigint, program: Array<number>, args: Array<number>, logs?: boolean, useSbrkGas?: boolean): __Record58<never>;
|
|
198
|
+
/**
|
|
199
|
+
* assembly/program-build/wrapAsProgram
|
|
200
|
+
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
201
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
202
|
+
*/
|
|
203
|
+
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
171
204
|
/** assembly/program/Program */
|
|
172
205
|
declare class __Internref26 extends Number {
|
|
173
206
|
private __nominal26: symbol;
|
|
174
207
|
private __nominal0: symbol;
|
|
175
208
|
}
|
|
176
|
-
/** assembly/
|
|
177
|
-
declare
|
|
209
|
+
/** assembly/api-types/VmInput */
|
|
210
|
+
declare class __Internref48 extends Number {
|
|
211
|
+
private __nominal48: symbol;
|
|
212
|
+
private __nominal0: symbol;
|
|
213
|
+
}
|
|
214
|
+
/** assembly/api-types/InitialChunk */
|
|
215
|
+
declare interface __Record45<TOmittable> {
|
|
216
|
+
/** @type `u32` */
|
|
217
|
+
address: number | TOmittable;
|
|
218
|
+
/** @type `~lib/array/Array<u8>` */
|
|
219
|
+
data: Array<number>;
|
|
220
|
+
}
|
|
221
|
+
/** assembly/api-types/VmOutput */
|
|
222
|
+
declare interface __Record49<TOmittable> {
|
|
223
|
+
/** @type `i32` */
|
|
224
|
+
status: number | TOmittable;
|
|
225
|
+
/** @type `~lib/array/Array<u64>` */
|
|
226
|
+
registers: Array<bigint>;
|
|
178
227
|
/** @type `u32` */
|
|
179
228
|
pc: number | TOmittable;
|
|
180
|
-
/** @type
|
|
229
|
+
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
230
|
+
memory: Array<__Record45<never>>;
|
|
231
|
+
/** @type `i64` */
|
|
181
232
|
gas: bigint | TOmittable;
|
|
233
|
+
/** @type `u32` */
|
|
234
|
+
exitCode: number | TOmittable;
|
|
182
235
|
}
|
|
183
|
-
/** assembly/
|
|
184
|
-
declare
|
|
236
|
+
/** assembly/memory/Memory */
|
|
237
|
+
declare class __Internref15 extends Number {
|
|
238
|
+
private __nominal15: symbol;
|
|
239
|
+
private __nominal0: symbol;
|
|
240
|
+
}
|
|
241
|
+
/** assembly/memory/MemoryBuilder */
|
|
242
|
+
declare class __Internref40 extends Number {
|
|
243
|
+
private __nominal40: symbol;
|
|
244
|
+
private __nominal0: symbol;
|
|
245
|
+
}
|
|
246
|
+
/** assembly/api-types/InitialPage */
|
|
247
|
+
declare interface __Record43<TOmittable> {
|
|
185
248
|
/** @type `u32` */
|
|
186
249
|
address: number | TOmittable;
|
|
187
250
|
/** @type `u32` */
|
|
@@ -189,30 +252,28 @@ declare interface __Record46<TOmittable> {
|
|
|
189
252
|
/** @type `i32` */
|
|
190
253
|
access: number | TOmittable;
|
|
191
254
|
}
|
|
192
|
-
/** assembly/
|
|
193
|
-
declare interface
|
|
255
|
+
/** assembly/gas-costs/BlockGasCost */
|
|
256
|
+
declare interface __Record54<TOmittable> {
|
|
194
257
|
/** @type `u32` */
|
|
195
|
-
|
|
196
|
-
/** @type
|
|
197
|
-
|
|
258
|
+
pc: number | TOmittable;
|
|
259
|
+
/** @type `u64` */
|
|
260
|
+
gas: bigint | TOmittable;
|
|
198
261
|
}
|
|
199
262
|
/** assembly/spi/StandardProgram */
|
|
200
|
-
declare class
|
|
201
|
-
private
|
|
263
|
+
declare class __Internref39 extends Number {
|
|
264
|
+
private __nominal39: symbol;
|
|
202
265
|
private __nominal0: symbol;
|
|
203
266
|
}
|
|
204
|
-
/** assembly/api-
|
|
205
|
-
declare interface
|
|
267
|
+
/** assembly/api-types/ReturnValue */
|
|
268
|
+
declare interface __Record58<TOmittable> {
|
|
206
269
|
/** @type `i32` */
|
|
207
270
|
status: number | TOmittable;
|
|
208
|
-
/** @type
|
|
209
|
-
|
|
271
|
+
/** @type `u32` */
|
|
272
|
+
exitCode: number | TOmittable;
|
|
210
273
|
/** @type `u32` */
|
|
211
274
|
pc: number | TOmittable;
|
|
212
|
-
/** @type `~lib/array/Array<assembly/api-internal/InitialChunk>` */
|
|
213
|
-
memory: Array<__Record48<never>>;
|
|
214
275
|
/** @type `i64` */
|
|
215
276
|
gas: bigint | TOmittable;
|
|
216
|
-
/** @type
|
|
217
|
-
|
|
277
|
+
/** @type `~lib/array/Array<u8>` */
|
|
278
|
+
result: Array<number>;
|
|
218
279
|
}
|
|
@@ -22,18 +22,8 @@ async function instantiate(module, imports = {}) {
|
|
|
22
22
|
const { exports } = await WebAssembly.instantiate(module, adaptedImports);
|
|
23
23
|
const memory = exports.memory || imports.env.memory;
|
|
24
24
|
const adaptedExports = Object.setPrototypeOf({
|
|
25
|
-
getAssembly(p) {
|
|
26
|
-
// assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
|
|
27
|
-
p = __lowerInternref(p) || __notnull();
|
|
28
|
-
return __liftString(exports.getAssembly(p) >>> 0);
|
|
29
|
-
},
|
|
30
|
-
wrapAsProgram(bytecode) {
|
|
31
|
-
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
32
|
-
bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
|
|
33
|
-
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
34
|
-
},
|
|
35
25
|
resetJAM(program, pc, initialGas, args, hasMetadata) {
|
|
36
|
-
// assembly/api-debugger/resetJAM(~lib/array/Array<u8>,
|
|
26
|
+
// assembly/api-debugger/resetJAM(~lib/array/Array<u8>, u32, i64, ~lib/array/Array<u8>, bool?) => void
|
|
37
27
|
program = __retain(__lowerArray(__setU8, 6, 0, program) || __notnull());
|
|
38
28
|
initialGas = initialGas || 0n;
|
|
39
29
|
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
@@ -118,6 +108,36 @@ async function instantiate(module, imports = {}) {
|
|
|
118
108
|
data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
|
|
119
109
|
return exports.setMemory(address, data) != 0;
|
|
120
110
|
},
|
|
111
|
+
getAssembly(p) {
|
|
112
|
+
// assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
|
|
113
|
+
p = __lowerInternref(p) || __notnull();
|
|
114
|
+
return __liftString(exports.getAssembly(p) >>> 0);
|
|
115
|
+
},
|
|
116
|
+
runVm(input, logs, useSbrkGas) {
|
|
117
|
+
// assembly/api-internal/runVm(assembly/api-types/VmInput, bool?, bool?) => assembly/api-types/VmOutput
|
|
118
|
+
input = __lowerInternref(input) || __notnull();
|
|
119
|
+
logs = logs ? 1 : 0;
|
|
120
|
+
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
121
|
+
exports.__setArgumentsLength(arguments.length);
|
|
122
|
+
return __liftRecord49(exports.runVm(input, logs, useSbrkGas) >>> 0);
|
|
123
|
+
},
|
|
124
|
+
getOutputChunks(memory) {
|
|
125
|
+
// assembly/api-internal/getOutputChunks(assembly/memory/Memory) => ~lib/array/Array<assembly/api-types/InitialChunk>
|
|
126
|
+
memory = __lowerInternref(memory) || __notnull();
|
|
127
|
+
return __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, exports.getOutputChunks(memory) >>> 0);
|
|
128
|
+
},
|
|
129
|
+
buildMemory(builder, pages, chunks) {
|
|
130
|
+
// assembly/api-internal/buildMemory(assembly/memory/MemoryBuilder, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>) => assembly/memory/Memory
|
|
131
|
+
builder = __retain(__lowerInternref(builder) || __notnull());
|
|
132
|
+
pages = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord43(value) || __notnull()); }, 44, 2, pages) || __notnull());
|
|
133
|
+
chunks = __lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord45(value) || __notnull()); }, 46, 2, chunks) || __notnull();
|
|
134
|
+
try {
|
|
135
|
+
return __liftInternref(exports.buildMemory(builder, pages, chunks) >>> 0);
|
|
136
|
+
} finally {
|
|
137
|
+
__release(builder);
|
|
138
|
+
__release(pages);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
121
141
|
InputKind: (values => (
|
|
122
142
|
// assembly/api-utils/InputKind
|
|
123
143
|
values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
|
|
@@ -133,7 +153,7 @@ async function instantiate(module, imports = {}) {
|
|
|
133
153
|
getGasCosts(input, kind, withMetadata) {
|
|
134
154
|
// assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
|
|
135
155
|
input = __lowerArray(__setU8, 6, 0, input) || __notnull();
|
|
136
|
-
return __liftArray(pointer =>
|
|
156
|
+
return __liftArray(pointer => __liftRecord54(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
|
|
137
157
|
},
|
|
138
158
|
disassemble(input, kind, withMetadata) {
|
|
139
159
|
// assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
|
|
@@ -141,11 +161,11 @@ async function instantiate(module, imports = {}) {
|
|
|
141
161
|
return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
|
|
142
162
|
},
|
|
143
163
|
prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) {
|
|
144
|
-
// assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-
|
|
164
|
+
// assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-types/InitialPage>, ~lib/array/Array<assembly/api-types/InitialChunk>, ~lib/array/Array<u8>) => assembly/spi/StandardProgram
|
|
145
165
|
program = __retain(__lowerArray(__setU8, 6, 0, program) || __notnull());
|
|
146
|
-
initialRegisters = __retain(__lowerArray(__setU64,
|
|
147
|
-
initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
148
|
-
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer,
|
|
166
|
+
initialRegisters = __retain(__lowerArray(__setU64, 50, 3, initialRegisters) || __notnull());
|
|
167
|
+
initialPageMap = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord43(value) || __notnull()); }, 44, 2, initialPageMap) || __notnull());
|
|
168
|
+
initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord45(value) || __notnull()); }, 46, 2, initialMemory) || __notnull());
|
|
149
169
|
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
150
170
|
try {
|
|
151
171
|
return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
|
|
@@ -157,65 +177,96 @@ async function instantiate(module, imports = {}) {
|
|
|
157
177
|
}
|
|
158
178
|
},
|
|
159
179
|
runProgram(program, initialGas, programCounter, logs, useSbrkGas) {
|
|
160
|
-
// assembly/api-utils/runProgram(assembly/spi/StandardProgram, i64?, u32?, bool?, bool?) => assembly/api-
|
|
180
|
+
// assembly/api-utils/runProgram(assembly/spi/StandardProgram, i64?, u32?, bool?, bool?) => assembly/api-types/VmOutput
|
|
161
181
|
program = __lowerInternref(program) || __notnull();
|
|
162
182
|
initialGas = initialGas || 0n;
|
|
163
183
|
logs = logs ? 1 : 0;
|
|
164
184
|
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
165
185
|
exports.__setArgumentsLength(arguments.length);
|
|
166
|
-
return
|
|
186
|
+
return __liftRecord49(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
|
|
187
|
+
},
|
|
188
|
+
runJAM(pc, gas, program, args, logs, useSbrkGas) {
|
|
189
|
+
// assembly/api-utils/runJAM(u32, i64, ~lib/array/Array<u8>, ~lib/array/Array<u8>, bool?, bool?) => assembly/api-types/ReturnValue
|
|
190
|
+
gas = gas || 0n;
|
|
191
|
+
program = __retain(__lowerArray(__setU8, 6, 0, program) || __notnull());
|
|
192
|
+
args = __lowerArray(__setU8, 6, 0, args) || __notnull();
|
|
193
|
+
logs = logs ? 1 : 0;
|
|
194
|
+
useSbrkGas = useSbrkGas ? 1 : 0;
|
|
195
|
+
try {
|
|
196
|
+
exports.__setArgumentsLength(arguments.length);
|
|
197
|
+
return __liftRecord58(exports.runJAM(pc, gas, program, args, logs, useSbrkGas) >>> 0);
|
|
198
|
+
} finally {
|
|
199
|
+
__release(program);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
wrapAsProgram(bytecode) {
|
|
203
|
+
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
204
|
+
bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
|
|
205
|
+
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
167
206
|
},
|
|
168
207
|
}, exports);
|
|
169
|
-
function
|
|
170
|
-
// assembly/
|
|
208
|
+
function __liftRecord45(pointer) {
|
|
209
|
+
// assembly/api-types/InitialChunk
|
|
171
210
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
172
211
|
if (!pointer) return null;
|
|
173
212
|
return {
|
|
174
|
-
|
|
175
|
-
|
|
213
|
+
address: __getU32(pointer + 0),
|
|
214
|
+
data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
|
|
176
215
|
};
|
|
177
216
|
}
|
|
178
|
-
function
|
|
179
|
-
// assembly/api-
|
|
217
|
+
function __liftRecord49(pointer) {
|
|
218
|
+
// assembly/api-types/VmOutput
|
|
219
|
+
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
220
|
+
if (!pointer) return null;
|
|
221
|
+
return {
|
|
222
|
+
status: __getI32(pointer + 0),
|
|
223
|
+
registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 4)),
|
|
224
|
+
pc: __getU32(pointer + 8),
|
|
225
|
+
memory: __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, __getU32(pointer + 12)),
|
|
226
|
+
gas: __getI64(pointer + 16),
|
|
227
|
+
exitCode: __getU32(pointer + 24),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function __lowerRecord43(value) {
|
|
231
|
+
// assembly/api-types/InitialPage
|
|
180
232
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
181
233
|
if (value == null) return 0;
|
|
182
|
-
const pointer = exports.__pin(exports.__new(12,
|
|
234
|
+
const pointer = exports.__pin(exports.__new(12, 43));
|
|
183
235
|
__setU32(pointer + 0, value.address);
|
|
184
236
|
__setU32(pointer + 4, value.length);
|
|
185
237
|
__setU32(pointer + 8, value.access);
|
|
186
238
|
exports.__unpin(pointer);
|
|
187
239
|
return pointer;
|
|
188
240
|
}
|
|
189
|
-
function
|
|
190
|
-
// assembly/api-
|
|
241
|
+
function __lowerRecord45(value) {
|
|
242
|
+
// assembly/api-types/InitialChunk
|
|
191
243
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
192
244
|
if (value == null) return 0;
|
|
193
|
-
const pointer = exports.__pin(exports.__new(8,
|
|
245
|
+
const pointer = exports.__pin(exports.__new(8, 45));
|
|
194
246
|
__setU32(pointer + 0, value.address);
|
|
195
247
|
__setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
|
|
196
248
|
exports.__unpin(pointer);
|
|
197
249
|
return pointer;
|
|
198
250
|
}
|
|
199
|
-
function
|
|
200
|
-
// assembly/
|
|
251
|
+
function __liftRecord54(pointer) {
|
|
252
|
+
// assembly/gas-costs/BlockGasCost
|
|
201
253
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
202
254
|
if (!pointer) return null;
|
|
203
255
|
return {
|
|
204
|
-
|
|
205
|
-
|
|
256
|
+
pc: __getU32(pointer + 0),
|
|
257
|
+
gas: __getU64(pointer + 8),
|
|
206
258
|
};
|
|
207
259
|
}
|
|
208
|
-
function
|
|
209
|
-
// assembly/api-
|
|
260
|
+
function __liftRecord58(pointer) {
|
|
261
|
+
// assembly/api-types/ReturnValue
|
|
210
262
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
211
263
|
if (!pointer) return null;
|
|
212
264
|
return {
|
|
213
265
|
status: __getI32(pointer + 0),
|
|
214
|
-
|
|
266
|
+
exitCode: __getU32(pointer + 4),
|
|
215
267
|
pc: __getU32(pointer + 8),
|
|
216
|
-
memory: __liftArray(pointer => __liftRecord48(__getU32(pointer)), 2, __getU32(pointer + 12)),
|
|
217
268
|
gas: __getI64(pointer + 16),
|
|
218
|
-
|
|
269
|
+
result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
|
|
219
270
|
};
|
|
220
271
|
}
|
|
221
272
|
function __liftString(pointer) {
|
|
@@ -381,8 +432,6 @@ export const {
|
|
|
381
432
|
__unpin,
|
|
382
433
|
__collect,
|
|
383
434
|
__rtti_base,
|
|
384
|
-
getAssembly,
|
|
385
|
-
wrapAsProgram,
|
|
386
435
|
resetJAM,
|
|
387
436
|
resetGeneric,
|
|
388
437
|
resetGenericWithMemory,
|
|
@@ -399,12 +448,18 @@ export const {
|
|
|
399
448
|
getPageDump,
|
|
400
449
|
getMemory,
|
|
401
450
|
setMemory,
|
|
451
|
+
getAssembly,
|
|
452
|
+
runVm,
|
|
453
|
+
getOutputChunks,
|
|
454
|
+
buildMemory,
|
|
402
455
|
InputKind,
|
|
403
456
|
HasMetadata,
|
|
404
457
|
getGasCosts,
|
|
405
458
|
disassemble,
|
|
406
459
|
prepareProgram,
|
|
407
460
|
runProgram,
|
|
461
|
+
runJAM,
|
|
462
|
+
wrapAsProgram,
|
|
408
463
|
} = await (async url => instantiate(
|
|
409
464
|
await (async () => {
|
|
410
465
|
const isNodeOrBun = typeof process != "undefined" && process.versions != null && (process.versions.node != null || process.versions.bun != null);
|
|
Binary file
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
/** Exported memory */
|
|
2
2
|
export declare const memory: WebAssembly.Memory;
|
|
3
|
-
/**
|
|
4
|
-
* assembly/api-internal/getAssembly
|
|
5
|
-
* @param p `assembly/program/Program`
|
|
6
|
-
* @returns `~lib/string/String`
|
|
7
|
-
*/
|
|
8
|
-
export declare function getAssembly(p: __Internref26): string;
|
|
9
|
-
/**
|
|
10
|
-
* assembly/program-build/wrapAsProgram
|
|
11
|
-
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
12
|
-
* @returns `~lib/typedarray/Uint8Array`
|
|
13
|
-
*/
|
|
14
|
-
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
15
3
|
/**
|
|
16
4
|
* assembly/api-debugger/resetJAM
|
|
17
5
|
* @param program `~lib/array/Array<u8>`
|
|
18
|
-
* @param pc `
|
|
6
|
+
* @param pc `u32`
|
|
19
7
|
* @param initialGas `i64`
|
|
20
8
|
* @param args `~lib/array/Array<u8>`
|
|
21
9
|
* @param hasMetadata `bool`
|
|
@@ -110,6 +98,34 @@ export declare function getMemory(address: number, length: number): Uint8Array |
|
|
|
110
98
|
* @returns `bool`
|
|
111
99
|
*/
|
|
112
100
|
export declare function setMemory(address: number, data: Uint8Array): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* assembly/api-internal/getAssembly
|
|
103
|
+
* @param p `assembly/program/Program`
|
|
104
|
+
* @returns `~lib/string/String`
|
|
105
|
+
*/
|
|
106
|
+
export declare function getAssembly(p: __Internref26): string;
|
|
107
|
+
/**
|
|
108
|
+
* assembly/api-internal/runVm
|
|
109
|
+
* @param input `assembly/api-types/VmInput`
|
|
110
|
+
* @param logs `bool`
|
|
111
|
+
* @param useSbrkGas `bool`
|
|
112
|
+
* @returns `assembly/api-types/VmOutput`
|
|
113
|
+
*/
|
|
114
|
+
export declare function runVm(input: __Internref48, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
|
|
115
|
+
/**
|
|
116
|
+
* assembly/api-internal/getOutputChunks
|
|
117
|
+
* @param memory `assembly/memory/Memory`
|
|
118
|
+
* @returns `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
119
|
+
*/
|
|
120
|
+
export declare function getOutputChunks(memory: __Internref15): Array<__Record45<never>>;
|
|
121
|
+
/**
|
|
122
|
+
* assembly/api-internal/buildMemory
|
|
123
|
+
* @param builder `assembly/memory/MemoryBuilder`
|
|
124
|
+
* @param pages `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
125
|
+
* @param chunks `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
126
|
+
* @returns `assembly/memory/Memory`
|
|
127
|
+
*/
|
|
128
|
+
export declare function buildMemory(builder: __Internref40, pages: Array<__Record43<undefined>>, chunks: Array<__Record45<undefined>>): __Internref15;
|
|
113
129
|
/** assembly/api-utils/InputKind */
|
|
114
130
|
export declare enum InputKind {
|
|
115
131
|
/** @type `i32` */
|
|
@@ -131,7 +147,7 @@ export declare enum HasMetadata {
|
|
|
131
147
|
* @param withMetadata `i32`
|
|
132
148
|
* @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
|
|
133
149
|
*/
|
|
134
|
-
export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<
|
|
150
|
+
export declare function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record54<never>>;
|
|
135
151
|
/**
|
|
136
152
|
* assembly/api-utils/disassemble
|
|
137
153
|
* @param input `~lib/array/Array<u8>`
|
|
@@ -146,12 +162,12 @@ export declare function disassemble(input: Array<number>, kind: number, withMeta
|
|
|
146
162
|
* @param hasMetadata `i32`
|
|
147
163
|
* @param program `~lib/array/Array<u8>`
|
|
148
164
|
* @param initialRegisters `~lib/array/Array<u64>`
|
|
149
|
-
* @param initialPageMap `~lib/array/Array<assembly/api-
|
|
150
|
-
* @param initialMemory `~lib/array/Array<assembly/api-
|
|
165
|
+
* @param initialPageMap `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
166
|
+
* @param initialMemory `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
151
167
|
* @param args `~lib/array/Array<u8>`
|
|
152
168
|
* @returns `assembly/spi/StandardProgram`
|
|
153
169
|
*/
|
|
154
|
-
export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<
|
|
170
|
+
export declare function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record43<undefined>>, initialMemory: Array<__Record45<undefined>>, args: Array<number>): __Internref39;
|
|
155
171
|
/**
|
|
156
172
|
* assembly/api-utils/runProgram
|
|
157
173
|
* @param program `assembly/spi/StandardProgram`
|
|
@@ -159,23 +175,70 @@ export declare function prepareProgram(kind: number, hasMetadata: number, progra
|
|
|
159
175
|
* @param programCounter `u32`
|
|
160
176
|
* @param logs `bool`
|
|
161
177
|
* @param useSbrkGas `bool`
|
|
162
|
-
* @returns `assembly/api-
|
|
178
|
+
* @returns `assembly/api-types/VmOutput`
|
|
163
179
|
*/
|
|
164
|
-
export declare function runProgram(program:
|
|
180
|
+
export declare function runProgram(program: __Internref39, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
|
|
181
|
+
/**
|
|
182
|
+
* assembly/api-utils/runJAM
|
|
183
|
+
* @param pc `u32`
|
|
184
|
+
* @param gas `i64`
|
|
185
|
+
* @param program `~lib/array/Array<u8>`
|
|
186
|
+
* @param args `~lib/array/Array<u8>`
|
|
187
|
+
* @param logs `bool`
|
|
188
|
+
* @param useSbrkGas `bool`
|
|
189
|
+
* @returns `assembly/api-types/ReturnValue`
|
|
190
|
+
*/
|
|
191
|
+
export declare function runJAM(pc: number, gas: bigint, program: Array<number>, args: Array<number>, logs?: boolean, useSbrkGas?: boolean): __Record58<never>;
|
|
192
|
+
/**
|
|
193
|
+
* assembly/program-build/wrapAsProgram
|
|
194
|
+
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
195
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
196
|
+
*/
|
|
197
|
+
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
165
198
|
/** assembly/program/Program */
|
|
166
199
|
declare class __Internref26 extends Number {
|
|
167
200
|
private __nominal26: symbol;
|
|
168
201
|
private __nominal0: symbol;
|
|
169
202
|
}
|
|
170
|
-
/** assembly/
|
|
171
|
-
declare
|
|
203
|
+
/** assembly/api-types/VmInput */
|
|
204
|
+
declare class __Internref48 extends Number {
|
|
205
|
+
private __nominal48: symbol;
|
|
206
|
+
private __nominal0: symbol;
|
|
207
|
+
}
|
|
208
|
+
/** assembly/api-types/InitialChunk */
|
|
209
|
+
declare interface __Record45<TOmittable> {
|
|
210
|
+
/** @type `u32` */
|
|
211
|
+
address: number | TOmittable;
|
|
212
|
+
/** @type `~lib/array/Array<u8>` */
|
|
213
|
+
data: Array<number>;
|
|
214
|
+
}
|
|
215
|
+
/** assembly/api-types/VmOutput */
|
|
216
|
+
declare interface __Record49<TOmittable> {
|
|
217
|
+
/** @type `i32` */
|
|
218
|
+
status: number | TOmittable;
|
|
219
|
+
/** @type `~lib/array/Array<u64>` */
|
|
220
|
+
registers: Array<bigint>;
|
|
172
221
|
/** @type `u32` */
|
|
173
222
|
pc: number | TOmittable;
|
|
174
|
-
/** @type
|
|
223
|
+
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
224
|
+
memory: Array<__Record45<never>>;
|
|
225
|
+
/** @type `i64` */
|
|
175
226
|
gas: bigint | TOmittable;
|
|
227
|
+
/** @type `u32` */
|
|
228
|
+
exitCode: number | TOmittable;
|
|
176
229
|
}
|
|
177
|
-
/** assembly/
|
|
178
|
-
declare
|
|
230
|
+
/** assembly/memory/Memory */
|
|
231
|
+
declare class __Internref15 extends Number {
|
|
232
|
+
private __nominal15: symbol;
|
|
233
|
+
private __nominal0: symbol;
|
|
234
|
+
}
|
|
235
|
+
/** assembly/memory/MemoryBuilder */
|
|
236
|
+
declare class __Internref40 extends Number {
|
|
237
|
+
private __nominal40: symbol;
|
|
238
|
+
private __nominal0: symbol;
|
|
239
|
+
}
|
|
240
|
+
/** assembly/api-types/InitialPage */
|
|
241
|
+
declare interface __Record43<TOmittable> {
|
|
179
242
|
/** @type `u32` */
|
|
180
243
|
address: number | TOmittable;
|
|
181
244
|
/** @type `u32` */
|
|
@@ -183,30 +246,28 @@ declare interface __Record46<TOmittable> {
|
|
|
183
246
|
/** @type `i32` */
|
|
184
247
|
access: number | TOmittable;
|
|
185
248
|
}
|
|
186
|
-
/** assembly/
|
|
187
|
-
declare interface
|
|
249
|
+
/** assembly/gas-costs/BlockGasCost */
|
|
250
|
+
declare interface __Record54<TOmittable> {
|
|
188
251
|
/** @type `u32` */
|
|
189
|
-
|
|
190
|
-
/** @type
|
|
191
|
-
|
|
252
|
+
pc: number | TOmittable;
|
|
253
|
+
/** @type `u64` */
|
|
254
|
+
gas: bigint | TOmittable;
|
|
192
255
|
}
|
|
193
256
|
/** assembly/spi/StandardProgram */
|
|
194
|
-
declare class
|
|
195
|
-
private
|
|
257
|
+
declare class __Internref39 extends Number {
|
|
258
|
+
private __nominal39: symbol;
|
|
196
259
|
private __nominal0: symbol;
|
|
197
260
|
}
|
|
198
|
-
/** assembly/api-
|
|
199
|
-
declare interface
|
|
261
|
+
/** assembly/api-types/ReturnValue */
|
|
262
|
+
declare interface __Record58<TOmittable> {
|
|
200
263
|
/** @type `i32` */
|
|
201
264
|
status: number | TOmittable;
|
|
202
|
-
/** @type
|
|
203
|
-
|
|
265
|
+
/** @type `u32` */
|
|
266
|
+
exitCode: number | TOmittable;
|
|
204
267
|
/** @type `u32` */
|
|
205
268
|
pc: number | TOmittable;
|
|
206
|
-
/** @type `~lib/array/Array<assembly/api-internal/InitialChunk>` */
|
|
207
|
-
memory: Array<__Record48<never>>;
|
|
208
269
|
/** @type `i64` */
|
|
209
270
|
gas: bigint | TOmittable;
|
|
210
|
-
/** @type
|
|
211
|
-
|
|
271
|
+
/** @type `~lib/array/Array<u8>` */
|
|
272
|
+
result: Array<number>;
|
|
212
273
|
}
|