@fluffylabs/anan-as 1.1.3-dde58f0 → 1.1.3-e01d5ea

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.
@@ -179,6 +179,17 @@ declare namespace __AdaptedExports {
179
179
  * @returns `assembly/api-types/VmOutput`
180
180
  */
181
181
  export function runProgram(program: __Internref39, initialGas?: bigint, programCounter?: number, logs?: boolean, useSbrkGas?: boolean): __Record49<never>;
182
+ /**
183
+ * assembly/api-utils/runJAM
184
+ * @param pc `u32`
185
+ * @param gas `i64`
186
+ * @param program `~lib/array/Array<u8>`
187
+ * @param args `~lib/array/Array<u8>`
188
+ * @param logs `bool`
189
+ * @param useSbrkGas `bool`
190
+ * @returns `assembly/api-types/ReturnValue`
191
+ */
192
+ export function runJAM(pc: number, gas: bigint, program: Array<number>, args: Array<number>, logs?: boolean, useSbrkGas?: boolean): __Record58<never>;
182
193
  /**
183
194
  * assembly/program-build/wrapAsProgram
184
195
  * @param bytecode `~lib/typedarray/Uint8Array`
@@ -207,18 +218,16 @@ declare interface __Record45<TOmittable> {
207
218
  declare interface __Record49<TOmittable> {
208
219
  /** @type `i32` */
209
220
  status: number | TOmittable;
210
- /** @type `u32` */
211
- exitCode: number | TOmittable;
212
- /** @type `u32` */
213
- pc: number | TOmittable;
214
- /** @type `i64` */
215
- gas: bigint | TOmittable;
216
- /** @type `~lib/array/Array<u8>` */
217
- result: Array<number>;
218
221
  /** @type `~lib/array/Array<u64>` */
219
222
  registers: Array<bigint>;
223
+ /** @type `u32` */
224
+ pc: number | TOmittable;
220
225
  /** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
221
226
  memory: Array<__Record45<never>>;
227
+ /** @type `i64` */
228
+ gas: bigint | TOmittable;
229
+ /** @type `u32` */
230
+ exitCode: number | TOmittable;
222
231
  }
223
232
  /** assembly/memory/Memory */
224
233
  declare class __Internref15 extends Number {
@@ -251,6 +260,19 @@ declare class __Internref39 extends Number {
251
260
  private __nominal39: symbol;
252
261
  private __nominal0: symbol;
253
262
  }
263
+ /** assembly/api-types/ReturnValue */
264
+ declare interface __Record58<TOmittable> {
265
+ /** @type `i32` */
266
+ status: number | TOmittable;
267
+ /** @type `u32` */
268
+ exitCode: number | TOmittable;
269
+ /** @type `u32` */
270
+ pc: number | TOmittable;
271
+ /** @type `i64` */
272
+ gas: bigint | TOmittable;
273
+ /** @type `~lib/array/Array<u8>` */
274
+ result: Array<number>;
275
+ }
254
276
  /** Instantiates the compiled WebAssembly module with the given imports. */
255
277
  export declare function instantiate(module: WebAssembly.Module, imports: {
256
278
  env: unknown,
@@ -185,6 +185,20 @@ export async function instantiate(module, imports = {}) {
185
185
  exports.__setArgumentsLength(arguments.length);
186
186
  return __liftRecord49(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
187
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
+ },
188
202
  wrapAsProgram(bytecode) {
189
203
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
190
204
  bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
@@ -206,12 +220,11 @@ export async function instantiate(module, imports = {}) {
206
220
  if (!pointer) return null;
207
221
  return {
208
222
  status: __getI32(pointer + 0),
209
- exitCode: __getU32(pointer + 4),
223
+ registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 4)),
210
224
  pc: __getU32(pointer + 8),
225
+ memory: __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, __getU32(pointer + 12)),
211
226
  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)),
227
+ exitCode: __getU32(pointer + 24),
215
228
  };
216
229
  }
217
230
  function __lowerRecord43(value) {
@@ -244,6 +257,18 @@ export async function instantiate(module, imports = {}) {
244
257
  gas: __getU64(pointer + 8),
245
258
  };
246
259
  }
260
+ function __liftRecord58(pointer) {
261
+ // assembly/api-types/ReturnValue
262
+ // Hint: Opt-out from lifting as a record by providing an empty constructor
263
+ if (!pointer) return null;
264
+ return {
265
+ status: __getI32(pointer + 0),
266
+ exitCode: __getU32(pointer + 4),
267
+ pc: __getU32(pointer + 8),
268
+ gas: __getI64(pointer + 16),
269
+ result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
270
+ };
271
+ }
247
272
  function __liftString(pointer) {
248
273
  if (!pointer) return null;
249
274
  const
Binary file
@@ -178,6 +178,17 @@ export declare function prepareProgram(kind: number, hasMetadata: number, progra
178
178
  * @returns `assembly/api-types/VmOutput`
179
179
  */
180
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>;
181
192
  /**
182
193
  * assembly/program-build/wrapAsProgram
183
194
  * @param bytecode `~lib/typedarray/Uint8Array`
@@ -205,18 +216,16 @@ declare interface __Record45<TOmittable> {
205
216
  declare interface __Record49<TOmittable> {
206
217
  /** @type `i32` */
207
218
  status: number | TOmittable;
208
- /** @type `u32` */
209
- exitCode: number | TOmittable;
210
- /** @type `u32` */
211
- pc: number | TOmittable;
212
- /** @type `i64` */
213
- gas: bigint | TOmittable;
214
- /** @type `~lib/array/Array<u8>` */
215
- result: Array<number>;
216
219
  /** @type `~lib/array/Array<u64>` */
217
220
  registers: Array<bigint>;
221
+ /** @type `u32` */
222
+ pc: number | TOmittable;
218
223
  /** @type `~lib/array/Array<assembly/api-types/InitialChunk>` */
219
224
  memory: Array<__Record45<never>>;
225
+ /** @type `i64` */
226
+ gas: bigint | TOmittable;
227
+ /** @type `u32` */
228
+ exitCode: number | TOmittable;
220
229
  }
221
230
  /** assembly/memory/Memory */
222
231
  declare class __Internref15 extends Number {
@@ -249,3 +258,16 @@ declare class __Internref39 extends Number {
249
258
  private __nominal39: symbol;
250
259
  private __nominal0: symbol;
251
260
  }
261
+ /** assembly/api-types/ReturnValue */
262
+ declare interface __Record58<TOmittable> {
263
+ /** @type `i32` */
264
+ status: number | TOmittable;
265
+ /** @type `u32` */
266
+ exitCode: number | TOmittable;
267
+ /** @type `u32` */
268
+ pc: number | TOmittable;
269
+ /** @type `i64` */
270
+ gas: bigint | TOmittable;
271
+ /** @type `~lib/array/Array<u8>` */
272
+ result: Array<number>;
273
+ }
@@ -185,6 +185,20 @@ async function instantiate(module, imports = {}) {
185
185
  exports.__setArgumentsLength(arguments.length);
186
186
  return __liftRecord49(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
187
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
+ },
188
202
  wrapAsProgram(bytecode) {
189
203
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
190
204
  bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
@@ -206,12 +220,11 @@ async function instantiate(module, imports = {}) {
206
220
  if (!pointer) return null;
207
221
  return {
208
222
  status: __getI32(pointer + 0),
209
- exitCode: __getU32(pointer + 4),
223
+ registers: __liftArray(pointer => BigInt.asUintN(64, __getU64(pointer)), 3, __getU32(pointer + 4)),
210
224
  pc: __getU32(pointer + 8),
225
+ memory: __liftArray(pointer => __liftRecord45(__getU32(pointer)), 2, __getU32(pointer + 12)),
211
226
  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)),
227
+ exitCode: __getU32(pointer + 24),
215
228
  };
216
229
  }
217
230
  function __lowerRecord43(value) {
@@ -244,6 +257,18 @@ async function instantiate(module, imports = {}) {
244
257
  gas: __getU64(pointer + 8),
245
258
  };
246
259
  }
260
+ function __liftRecord58(pointer) {
261
+ // assembly/api-types/ReturnValue
262
+ // Hint: Opt-out from lifting as a record by providing an empty constructor
263
+ if (!pointer) return null;
264
+ return {
265
+ status: __getI32(pointer + 0),
266
+ exitCode: __getU32(pointer + 4),
267
+ pc: __getU32(pointer + 8),
268
+ gas: __getI64(pointer + 16),
269
+ result: __liftArray(__getU8, 0, __getU32(pointer + 24)),
270
+ };
271
+ }
247
272
  function __liftString(pointer) {
248
273
  if (!pointer) return null;
249
274
  const
@@ -428,6 +453,7 @@ export const {
428
453
  disassemble,
429
454
  prepareProgram,
430
455
  runProgram,
456
+ runJAM,
431
457
  wrapAsProgram,
432
458
  } = await (async url => instantiate(
433
459
  await (async () => {
Binary file