@fluffylabs/anan-as 1.1.3-bac8f87 → 1.1.3-dde58f0
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 +238 -0
- package/dist/bin/test-gas-cost.js +57 -0
- package/dist/bin/test-json.js +135 -0
- package/dist/bin/test-w3f.js +121 -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 +85 -46
- package/{build → dist/build}/debug-raw.js +71 -45
- package/dist/build/debug-raw.wasm +0 -0
- package/{build → dist/build}/debug.d.ts +85 -46
- package/{build → dist/build}/debug.js +76 -47
- 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 +85 -46
- package/{build → dist/build}/release-mini.js +76 -47
- 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 +85 -46
- package/{build → dist/build}/release-stub.js +76 -47
- package/dist/build/release-stub.wasm +0 -0
- package/{build → dist/build}/release.d.ts +85 -46
- package/{build → dist/build}/release.js +76 -47
- 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
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
declare namespace __AdaptedExports {
|
|
2
2
|
/** Exported memory */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
/**
|
|
5
|
-
* assembly/api-internal/getAssembly
|
|
6
|
-
* @param p `assembly/program/Program`
|
|
7
|
-
* @returns `~lib/string/String`
|
|
8
|
-
*/
|
|
9
|
-
export function getAssembly(p: __Internref26): string;
|
|
10
|
-
/**
|
|
11
|
-
* assembly/program-build/wrapAsProgram
|
|
12
|
-
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
13
|
-
* @returns `~lib/typedarray/Uint8Array`
|
|
14
|
-
*/
|
|
15
|
-
export function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
16
4
|
/**
|
|
17
5
|
* assembly/api-debugger/resetJAM
|
|
18
6
|
* @param program `~lib/array/Array<u8>`
|
|
19
|
-
* @param pc `
|
|
7
|
+
* @param pc `u32`
|
|
20
8
|
* @param initialGas `i64`
|
|
21
9
|
* @param args `~lib/array/Array<u8>`
|
|
22
10
|
* @param hasMetadata `bool`
|
|
@@ -111,6 +99,34 @@ declare namespace __AdaptedExports {
|
|
|
111
99
|
* @returns `bool`
|
|
112
100
|
*/
|
|
113
101
|
export function setMemory(address: number, data: Uint8Array): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* assembly/api-internal/getAssembly
|
|
104
|
+
* @param p `assembly/program/Program`
|
|
105
|
+
* @returns `~lib/string/String`
|
|
106
|
+
*/
|
|
107
|
+
export function getAssembly(p: __Internref26): string;
|
|
108
|
+
/**
|
|
109
|
+
* assembly/api-internal/runVm
|
|
110
|
+
* @param input `assembly/api-types/VmInput`
|
|
111
|
+
* @param logs `bool`
|
|
112
|
+
* @param useSbrkGas `bool`
|
|
113
|
+
* @returns `assembly/api-types/VmOutput`
|
|
114
|
+
*/
|
|
115
|
+
export function runVm(input: __Internref48, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
|
|
116
|
+
/**
|
|
117
|
+
* assembly/api-internal/getOutputChunks
|
|
118
|
+
* @param memory `assembly/memory/Memory`
|
|
119
|
+
* @returns `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
120
|
+
*/
|
|
121
|
+
export function getOutputChunks(memory: __Internref15): Array<__Record45<never>>;
|
|
122
|
+
/**
|
|
123
|
+
* assembly/api-internal/buildMemory
|
|
124
|
+
* @param builder `assembly/memory/MemoryBuilder`
|
|
125
|
+
* @param pages `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
126
|
+
* @param chunks `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
127
|
+
* @returns `assembly/memory/Memory`
|
|
128
|
+
*/
|
|
129
|
+
export function buildMemory(builder: __Internref40, pages: Array<__Record43<undefined>>, chunks: Array<__Record45<undefined>>): __Internref15;
|
|
114
130
|
/** assembly/api-utils/InputKind */
|
|
115
131
|
export enum InputKind {
|
|
116
132
|
/** @type `i32` */
|
|
@@ -132,7 +148,7 @@ declare namespace __AdaptedExports {
|
|
|
132
148
|
* @param withMetadata `i32`
|
|
133
149
|
* @returns `~lib/array/Array<assembly/gas-costs/BlockGasCost>`
|
|
134
150
|
*/
|
|
135
|
-
export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<
|
|
151
|
+
export function getGasCosts(input: Array<number>, kind: number, withMetadata: number): Array<__Record54<never>>;
|
|
136
152
|
/**
|
|
137
153
|
* assembly/api-utils/disassemble
|
|
138
154
|
* @param input `~lib/array/Array<u8>`
|
|
@@ -147,12 +163,12 @@ declare namespace __AdaptedExports {
|
|
|
147
163
|
* @param hasMetadata `i32`
|
|
148
164
|
* @param program `~lib/array/Array<u8>`
|
|
149
165
|
* @param initialRegisters `~lib/array/Array<u64>`
|
|
150
|
-
* @param initialPageMap `~lib/array/Array<assembly/api-
|
|
151
|
-
* @param initialMemory `~lib/array/Array<assembly/api-
|
|
166
|
+
* @param initialPageMap `~lib/array/Array<assembly/api-types/InitialPage>`
|
|
167
|
+
* @param initialMemory `~lib/array/Array<assembly/api-types/InitialChunk>`
|
|
152
168
|
* @param args `~lib/array/Array<u8>`
|
|
153
169
|
* @returns `assembly/spi/StandardProgram`
|
|
154
170
|
*/
|
|
155
|
-
export function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<
|
|
171
|
+
export function prepareProgram(kind: number, hasMetadata: number, program: Array<number>, initialRegisters: Array<bigint>, initialPageMap: Array<__Record43<undefined>>, initialMemory: Array<__Record45<undefined>>, args: Array<number>): __Internref39;
|
|
156
172
|
/**
|
|
157
173
|
* assembly/api-utils/runProgram
|
|
158
174
|
* @param program `assembly/spi/StandardProgram`
|
|
@@ -160,24 +176,62 @@ declare namespace __AdaptedExports {
|
|
|
160
176
|
* @param programCounter `u32`
|
|
161
177
|
* @param logs `bool`
|
|
162
178
|
* @param useSbrkGas `bool`
|
|
163
|
-
* @returns `assembly/api-
|
|
179
|
+
* @returns `assembly/api-types/VmOutput`
|
|
164
180
|
*/
|
|
165
|
-
export function runProgram(program:
|
|
181
|
+
export function runProgram(program: __Internref39, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
|
|
182
|
+
/**
|
|
183
|
+
* assembly/program-build/wrapAsProgram
|
|
184
|
+
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
185
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
186
|
+
*/
|
|
187
|
+
export function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
166
188
|
}
|
|
167
189
|
/** assembly/program/Program */
|
|
168
190
|
declare class __Internref26 extends Number {
|
|
169
191
|
private __nominal26: symbol;
|
|
170
192
|
private __nominal0: symbol;
|
|
171
193
|
}
|
|
172
|
-
/** assembly/
|
|
173
|
-
declare
|
|
194
|
+
/** assembly/api-types/VmInput */
|
|
195
|
+
declare class __Internref48 extends Number {
|
|
196
|
+
private __nominal48: symbol;
|
|
197
|
+
private __nominal0: symbol;
|
|
198
|
+
}
|
|
199
|
+
/** assembly/api-types/InitialChunk */
|
|
200
|
+
declare interface __Record45<TOmittable> {
|
|
201
|
+
/** @type `u32` */
|
|
202
|
+
address: number | TOmittable;
|
|
203
|
+
/** @type `~lib/array/Array<u8>` */
|
|
204
|
+
data: Array<number>;
|
|
205
|
+
}
|
|
206
|
+
/** assembly/api-types/VmOutput */
|
|
207
|
+
declare interface __Record49<TOmittable> {
|
|
208
|
+
/** @type `i32` */
|
|
209
|
+
status: number | TOmittable;
|
|
210
|
+
/** @type `u32` */
|
|
211
|
+
exitCode: number | TOmittable;
|
|
174
212
|
/** @type `u32` */
|
|
175
213
|
pc: number | TOmittable;
|
|
176
|
-
/** @type `
|
|
214
|
+
/** @type `i64` */
|
|
177
215
|
gas: bigint | TOmittable;
|
|
216
|
+
/** @type `~lib/array/Array<u8>` */
|
|
217
|
+
result: Array<number>;
|
|
218
|
+
/** @type `~lib/array/Array<u64>` */
|
|
219
|
+
registers: Array<bigint>;
|
|
220
|
+
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
221
|
+
memory: Array<__Record45<never>>;
|
|
222
|
+
}
|
|
223
|
+
/** assembly/memory/Memory */
|
|
224
|
+
declare class __Internref15 extends Number {
|
|
225
|
+
private __nominal15: symbol;
|
|
226
|
+
private __nominal0: symbol;
|
|
227
|
+
}
|
|
228
|
+
/** assembly/memory/MemoryBuilder */
|
|
229
|
+
declare class __Internref40 extends Number {
|
|
230
|
+
private __nominal40: symbol;
|
|
231
|
+
private __nominal0: symbol;
|
|
178
232
|
}
|
|
179
|
-
/** assembly/api-
|
|
180
|
-
declare interface
|
|
233
|
+
/** assembly/api-types/InitialPage */
|
|
234
|
+
declare interface __Record43<TOmittable> {
|
|
181
235
|
/** @type `u32` */
|
|
182
236
|
address: number | TOmittable;
|
|
183
237
|
/** @type `u32` */
|
|
@@ -185,33 +239,18 @@ declare interface __Record46<TOmittable> {
|
|
|
185
239
|
/** @type `i32` */
|
|
186
240
|
access: number | TOmittable;
|
|
187
241
|
}
|
|
188
|
-
/** assembly/
|
|
189
|
-
declare interface
|
|
242
|
+
/** assembly/gas-costs/BlockGasCost */
|
|
243
|
+
declare interface __Record54<TOmittable> {
|
|
190
244
|
/** @type `u32` */
|
|
191
|
-
|
|
192
|
-
/** @type
|
|
193
|
-
|
|
245
|
+
pc: number | TOmittable;
|
|
246
|
+
/** @type `u64` */
|
|
247
|
+
gas: bigint | TOmittable;
|
|
194
248
|
}
|
|
195
249
|
/** assembly/spi/StandardProgram */
|
|
196
|
-
declare class
|
|
197
|
-
private
|
|
250
|
+
declare class __Internref39 extends Number {
|
|
251
|
+
private __nominal39: symbol;
|
|
198
252
|
private __nominal0: symbol;
|
|
199
253
|
}
|
|
200
|
-
/** assembly/api-internal/VmOutput */
|
|
201
|
-
declare interface __Record55<TOmittable> {
|
|
202
|
-
/** @type `i32` */
|
|
203
|
-
status: number | TOmittable;
|
|
204
|
-
/** @type `~lib/array/Array<u64>` */
|
|
205
|
-
registers: Array<bigint>;
|
|
206
|
-
/** @type `u32` */
|
|
207
|
-
pc: number | TOmittable;
|
|
208
|
-
/** @type `~lib/array/Array<assembly/api-internal/InitialChunk>` */
|
|
209
|
-
memory: Array<__Record48<never>>;
|
|
210
|
-
/** @type `i64` */
|
|
211
|
-
gas: bigint | TOmittable;
|
|
212
|
-
/** @type `u32` */
|
|
213
|
-
exitCode: number | TOmittable;
|
|
214
|
-
}
|
|
215
254
|
/** Instantiates the compiled WebAssembly module with the given imports. */
|
|
216
255
|
export declare function instantiate(module: WebAssembly.Module, imports: {
|
|
217
256
|
env: unknown,
|
|
@@ -22,18 +22,8 @@ export 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 @@ export 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 @@ export 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 @@ export 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,71 @@ export 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
|
+
wrapAsProgram(bytecode) {
|
|
189
|
+
// assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
|
|
190
|
+
bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
|
|
191
|
+
return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
|
|
167
192
|
},
|
|
168
193
|
}, exports);
|
|
169
|
-
function
|
|
170
|
-
// assembly/
|
|
194
|
+
function __liftRecord45(pointer) {
|
|
195
|
+
// assembly/api-types/InitialChunk
|
|
171
196
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
172
197
|
if (!pointer) return null;
|
|
173
198
|
return {
|
|
174
|
-
|
|
175
|
-
|
|
199
|
+
address: __getU32(pointer + 0),
|
|
200
|
+
data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function __liftRecord49(pointer) {
|
|
204
|
+
// assembly/api-types/VmOutput
|
|
205
|
+
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
206
|
+
if (!pointer) return null;
|
|
207
|
+
return {
|
|
208
|
+
status: __getI32(pointer + 0),
|
|
209
|
+
exitCode: __getU32(pointer + 4),
|
|
210
|
+
pc: __getU32(pointer + 8),
|
|
211
|
+
gas: __getI64(pointer + 16),
|
|
212
|
+
result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
|
|
213
|
+
registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 28)),
|
|
214
|
+
memory: __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, __getU32(pointer + 32)),
|
|
176
215
|
};
|
|
177
216
|
}
|
|
178
|
-
function
|
|
179
|
-
// assembly/api-
|
|
217
|
+
function __lowerRecord43(value) {
|
|
218
|
+
// assembly/api-types/InitialPage
|
|
180
219
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
181
220
|
if (value == null) return 0;
|
|
182
|
-
const pointer = exports.__pin(exports.__new(12,
|
|
221
|
+
const pointer = exports.__pin(exports.__new(12, 43));
|
|
183
222
|
__setU32(pointer + 0, value.address);
|
|
184
223
|
__setU32(pointer + 4, value.length);
|
|
185
224
|
__setU32(pointer + 8, value.access);
|
|
186
225
|
exports.__unpin(pointer);
|
|
187
226
|
return pointer;
|
|
188
227
|
}
|
|
189
|
-
function
|
|
190
|
-
// assembly/api-
|
|
228
|
+
function __lowerRecord45(value) {
|
|
229
|
+
// assembly/api-types/InitialChunk
|
|
191
230
|
// Hint: Opt-out from lowering as a record by providing an empty constructor
|
|
192
231
|
if (value == null) return 0;
|
|
193
|
-
const pointer = exports.__pin(exports.__new(8,
|
|
232
|
+
const pointer = exports.__pin(exports.__new(8, 45));
|
|
194
233
|
__setU32(pointer + 0, value.address);
|
|
195
234
|
__setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
|
|
196
235
|
exports.__unpin(pointer);
|
|
197
236
|
return pointer;
|
|
198
237
|
}
|
|
199
|
-
function
|
|
200
|
-
// assembly/
|
|
201
|
-
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
202
|
-
if (!pointer) return null;
|
|
203
|
-
return {
|
|
204
|
-
address: __getU32(pointer + 0),
|
|
205
|
-
data: __liftArray(__getU8, 0, __getU32(pointer + 4)),
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
function __liftRecord55(pointer) {
|
|
209
|
-
// assembly/api-internal/VmOutput
|
|
238
|
+
function __liftRecord54(pointer) {
|
|
239
|
+
// assembly/gas-costs/BlockGasCost
|
|
210
240
|
// Hint: Opt-out from lifting as a record by providing an empty constructor
|
|
211
241
|
if (!pointer) return null;
|
|
212
242
|
return {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
pc: __getU32(pointer + 8),
|
|
216
|
-
memory: __liftArray(pointer => __liftRecord48(__getU32(pointer)), 2, __getU32(pointer + 12)),
|
|
217
|
-
gas: __getI64(pointer + 16),
|
|
218
|
-
exitCode: __getU32(pointer + 24),
|
|
243
|
+
pc: __getU32(pointer + 0),
|
|
244
|
+
gas: __getU64(pointer + 8),
|
|
219
245
|
};
|
|
220
246
|
}
|
|
221
247
|
function __liftString(pointer) {
|
|
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,61 @@ 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/program-build/wrapAsProgram
|
|
183
|
+
* @param bytecode `~lib/typedarray/Uint8Array`
|
|
184
|
+
* @returns `~lib/typedarray/Uint8Array`
|
|
185
|
+
*/
|
|
186
|
+
export declare function wrapAsProgram(bytecode: Uint8Array): Uint8Array;
|
|
165
187
|
/** assembly/program/Program */
|
|
166
188
|
declare class __Internref26 extends Number {
|
|
167
189
|
private __nominal26: symbol;
|
|
168
190
|
private __nominal0: symbol;
|
|
169
191
|
}
|
|
170
|
-
/** assembly/
|
|
171
|
-
declare
|
|
192
|
+
/** assembly/api-types/VmInput */
|
|
193
|
+
declare class __Internref48 extends Number {
|
|
194
|
+
private __nominal48: symbol;
|
|
195
|
+
private __nominal0: symbol;
|
|
196
|
+
}
|
|
197
|
+
/** assembly/api-types/InitialChunk */
|
|
198
|
+
declare interface __Record45<TOmittable> {
|
|
199
|
+
/** @type `u32` */
|
|
200
|
+
address: number | TOmittable;
|
|
201
|
+
/** @type `~lib/array/Array<u8>` */
|
|
202
|
+
data: Array<number>;
|
|
203
|
+
}
|
|
204
|
+
/** assembly/api-types/VmOutput */
|
|
205
|
+
declare interface __Record49<TOmittable> {
|
|
206
|
+
/** @type `i32` */
|
|
207
|
+
status: number | TOmittable;
|
|
208
|
+
/** @type `u32` */
|
|
209
|
+
exitCode: number | TOmittable;
|
|
172
210
|
/** @type `u32` */
|
|
173
211
|
pc: number | TOmittable;
|
|
174
|
-
/** @type `
|
|
212
|
+
/** @type `i64` */
|
|
175
213
|
gas: bigint | TOmittable;
|
|
214
|
+
/** @type `~lib/array/Array<u8>` */
|
|
215
|
+
result: Array<number>;
|
|
216
|
+
/** @type `~lib/array/Array<u64>` */
|
|
217
|
+
registers: Array<bigint>;
|
|
218
|
+
/** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
|
|
219
|
+
memory: Array<__Record45<never>>;
|
|
220
|
+
}
|
|
221
|
+
/** assembly/memory/Memory */
|
|
222
|
+
declare class __Internref15 extends Number {
|
|
223
|
+
private __nominal15: symbol;
|
|
224
|
+
private __nominal0: symbol;
|
|
225
|
+
}
|
|
226
|
+
/** assembly/memory/MemoryBuilder */
|
|
227
|
+
declare class __Internref40 extends Number {
|
|
228
|
+
private __nominal40: symbol;
|
|
229
|
+
private __nominal0: symbol;
|
|
176
230
|
}
|
|
177
|
-
/** assembly/api-
|
|
178
|
-
declare interface
|
|
231
|
+
/** assembly/api-types/InitialPage */
|
|
232
|
+
declare interface __Record43<TOmittable> {
|
|
179
233
|
/** @type `u32` */
|
|
180
234
|
address: number | TOmittable;
|
|
181
235
|
/** @type `u32` */
|
|
@@ -183,30 +237,15 @@ declare interface __Record46<TOmittable> {
|
|
|
183
237
|
/** @type `i32` */
|
|
184
238
|
access: number | TOmittable;
|
|
185
239
|
}
|
|
186
|
-
/** assembly/
|
|
187
|
-
declare interface
|
|
240
|
+
/** assembly/gas-costs/BlockGasCost */
|
|
241
|
+
declare interface __Record54<TOmittable> {
|
|
188
242
|
/** @type `u32` */
|
|
189
|
-
|
|
190
|
-
/** @type
|
|
191
|
-
|
|
243
|
+
pc: number | TOmittable;
|
|
244
|
+
/** @type `u64` */
|
|
245
|
+
gas: bigint | TOmittable;
|
|
192
246
|
}
|
|
193
247
|
/** assembly/spi/StandardProgram */
|
|
194
|
-
declare class
|
|
195
|
-
private
|
|
248
|
+
declare class __Internref39 extends Number {
|
|
249
|
+
private __nominal39: symbol;
|
|
196
250
|
private __nominal0: symbol;
|
|
197
251
|
}
|
|
198
|
-
/** assembly/api-internal/VmOutput */
|
|
199
|
-
declare interface __Record55<TOmittable> {
|
|
200
|
-
/** @type `i32` */
|
|
201
|
-
status: number | TOmittable;
|
|
202
|
-
/** @type `~lib/array/Array<u64>` */
|
|
203
|
-
registers: Array<bigint>;
|
|
204
|
-
/** @type `u32` */
|
|
205
|
-
pc: number | TOmittable;
|
|
206
|
-
/** @type `~lib/array/Array<assembly/api-internal/InitialChunk>` */
|
|
207
|
-
memory: Array<__Record48<never>>;
|
|
208
|
-
/** @type `i64` */
|
|
209
|
-
gas: bigint | TOmittable;
|
|
210
|
-
/** @type `u32` */
|
|
211
|
-
exitCode: number | TOmittable;
|
|
212
|
-
}
|