@aztec/bb.js 0.0.1-alpha.6 → 0.0.1-fake-ceab37513c

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.
Files changed (227) hide show
  1. package/README.md +69 -33
  2. package/package.json +56 -41
  3. package/src/barretenberg/__snapshots__/pedersen.test.ts.snap +156 -0
  4. package/src/barretenberg/__snapshots__/poseidon.test.ts.snap +40 -0
  5. package/src/barretenberg/backend.ts +378 -0
  6. package/src/barretenberg/blake2s.test.ts +70 -0
  7. package/src/{barretenberg_api → barretenberg}/common.test.ts +7 -5
  8. package/src/barretenberg/index.ts +204 -0
  9. package/src/barretenberg/pedersen.test.ts +62 -0
  10. package/src/barretenberg/poseidon.test.ts +39 -0
  11. package/src/barretenberg_api/index.ts +1128 -383
  12. package/src/barretenberg_wasm/barretenberg_wasm_base/index.ts +138 -0
  13. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/browser/index.ts +11 -0
  14. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/browser/main.worker.ts +13 -0
  15. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/node/index.ts +21 -0
  16. package/src/barretenberg_wasm/barretenberg_wasm_main/factory/node/main.worker.ts +19 -0
  17. package/src/{barretenberg_binder/heap_allocator_sync.ts → barretenberg_wasm/barretenberg_wasm_main/heap_allocator.ts} +20 -17
  18. package/src/barretenberg_wasm/barretenberg_wasm_main/index.ts +167 -0
  19. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/browser/index.ts +11 -0
  20. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/browser/thread.worker.ts +13 -0
  21. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/node/index.ts +21 -0
  22. package/src/barretenberg_wasm/barretenberg_wasm_thread/factory/node/thread.worker.ts +19 -0
  23. package/src/barretenberg_wasm/barretenberg_wasm_thread/index.ts +47 -0
  24. package/src/barretenberg_wasm/fetch_code/browser/barretenberg-threads.ts +3 -0
  25. package/src/barretenberg_wasm/fetch_code/browser/barretenberg.ts +3 -0
  26. package/src/barretenberg_wasm/fetch_code/browser/index.ts +34 -0
  27. package/src/barretenberg_wasm/fetch_code/index.ts +1 -0
  28. package/src/barretenberg_wasm/fetch_code/node/index.ts +34 -0
  29. package/src/barretenberg_wasm/fetch_code/wasm-module.d.ts +4 -0
  30. package/src/barretenberg_wasm/helpers/browser/index.ts +47 -0
  31. package/src/barretenberg_wasm/helpers/index.ts +1 -0
  32. package/src/barretenberg_wasm/{node → helpers/node}/index.ts +24 -15
  33. package/src/barretenberg_wasm/index.test.ts +45 -0
  34. package/src/barretenberg_wasm/index.ts +22 -1
  35. package/src/benchmark/index.ts +26 -0
  36. package/src/benchmark/timer.ts +45 -0
  37. package/src/bigint-array/index.ts +39 -17
  38. package/src/bindgen/index.ts +2 -2
  39. package/src/bindgen/mappings.ts +3 -2
  40. package/src/bindgen/typescript.ts +50 -25
  41. package/src/cbind/README.md +1 -0
  42. package/src/cbind/generate.ts +89 -0
  43. package/src/cbind/schema_compiler.ts +833 -0
  44. package/src/crs/browser/cached_net_crs.ts +41 -2
  45. package/src/crs/browser/index.ts +1 -1
  46. package/src/crs/index.ts +1 -1
  47. package/src/crs/net_crs.ts +114 -19
  48. package/src/crs/node/index.ts +98 -20
  49. package/src/index.html +1 -1
  50. package/src/index.ts +13 -5
  51. package/src/log/browser/index.ts +35 -0
  52. package/src/log/index.ts +1 -0
  53. package/src/log/node/index.ts +52 -0
  54. package/src/log/types.ts +6 -0
  55. package/src/main.ts +395 -185
  56. package/src/proof/index.ts +94 -0
  57. package/src/random/browser/index.ts +1 -1
  58. package/src/retry/index.ts +50 -0
  59. package/src/serialize/buffer_reader.ts +4 -1
  60. package/src/types/fields.ts +46 -18
  61. package/src/types/point.ts +4 -1
  62. package/dest/async_map/index.d.ts +0 -10
  63. package/dest/async_map/index.d.ts.map +0 -1
  64. package/dest/async_map/index.js +0 -16
  65. package/dest/barretenberg-threads.wasm +0 -0
  66. package/dest/barretenberg.wasm +0 -0
  67. package/dest/barretenberg_api/blake2s.test.d.ts +0 -2
  68. package/dest/barretenberg_api/blake2s.test.d.ts.map +0 -1
  69. package/dest/barretenberg_api/blake2s.test.js +0 -30
  70. package/dest/barretenberg_api/common.test.d.ts +0 -2
  71. package/dest/barretenberg_api/common.test.d.ts.map +0 -1
  72. package/dest/barretenberg_api/common.test.js +0 -18
  73. package/dest/barretenberg_api/index.d.ts +0 -103
  74. package/dest/barretenberg_api/index.d.ts.map +0 -1
  75. package/dest/barretenberg_api/index.js +0 -379
  76. package/dest/barretenberg_api/pedersen.test.d.ts +0 -2
  77. package/dest/barretenberg_api/pedersen.test.d.ts.map +0 -1
  78. package/dest/barretenberg_api/pedersen.test.js +0 -69
  79. package/dest/barretenberg_api/schnorr.test.d.ts +0 -2
  80. package/dest/barretenberg_api/schnorr.test.d.ts.map +0 -1
  81. package/dest/barretenberg_api/schnorr.test.js +0 -113
  82. package/dest/barretenberg_binder/heap_allocator.d.ts +0 -22
  83. package/dest/barretenberg_binder/heap_allocator.d.ts.map +0 -1
  84. package/dest/barretenberg_binder/heap_allocator.js +0 -59
  85. package/dest/barretenberg_binder/heap_allocator_sync.d.ts +0 -22
  86. package/dest/barretenberg_binder/heap_allocator_sync.d.ts.map +0 -1
  87. package/dest/barretenberg_binder/heap_allocator_sync.js +0 -58
  88. package/dest/barretenberg_binder/index.d.ts +0 -32
  89. package/dest/barretenberg_binder/index.d.ts.map +0 -1
  90. package/dest/barretenberg_binder/index.js +0 -73
  91. package/dest/barretenberg_wasm/barretenberg_wasm.d.ts +0 -50
  92. package/dest/barretenberg_wasm/barretenberg_wasm.d.ts.map +0 -1
  93. package/dest/barretenberg_wasm/barretenberg_wasm.js +0 -212
  94. package/dest/barretenberg_wasm/barretenberg_wasm.test.d.ts +0 -2
  95. package/dest/barretenberg_wasm/barretenberg_wasm.test.d.ts.map +0 -1
  96. package/dest/barretenberg_wasm/barretenberg_wasm.test.js +0 -43
  97. package/dest/barretenberg_wasm/browser/index.d.ts +0 -8
  98. package/dest/barretenberg_wasm/browser/index.d.ts.map +0 -1
  99. package/dest/barretenberg_wasm/browser/index.js +0 -26
  100. package/dest/barretenberg_wasm/browser/worker.d.ts +0 -2
  101. package/dest/barretenberg_wasm/browser/worker.d.ts.map +0 -1
  102. package/dest/barretenberg_wasm/browser/worker.js +0 -11
  103. package/dest/barretenberg_wasm/index.d.ts +0 -2
  104. package/dest/barretenberg_wasm/index.d.ts.map +0 -1
  105. package/dest/barretenberg_wasm/index.js +0 -2
  106. package/dest/barretenberg_wasm/node/index.d.ts +0 -17
  107. package/dest/barretenberg_wasm/node/index.d.ts.map +0 -1
  108. package/dest/barretenberg_wasm/node/index.js +0 -40
  109. package/dest/barretenberg_wasm/node/node_endpoint.d.ts +0 -8
  110. package/dest/barretenberg_wasm/node/node_endpoint.d.ts.map +0 -1
  111. package/dest/barretenberg_wasm/node/node_endpoint.js +0 -28
  112. package/dest/barretenberg_wasm/node/worker.d.ts +0 -2
  113. package/dest/barretenberg_wasm/node/worker.d.ts.map +0 -1
  114. package/dest/barretenberg_wasm/node/worker.js +0 -9
  115. package/dest/barretenberg_wasm.js +0 -2
  116. package/dest/barretenberg_wasm.js.LICENSE.txt +0 -5
  117. package/dest/bigint-array/index.d.ts +0 -3
  118. package/dest/bigint-array/index.d.ts.map +0 -1
  119. package/dest/bigint-array/index.js +0 -21
  120. package/dest/bindgen/function_declaration.d.ts +0 -11
  121. package/dest/bindgen/function_declaration.d.ts.map +0 -1
  122. package/dest/bindgen/function_declaration.js +0 -2
  123. package/dest/bindgen/index.d.ts +0 -2
  124. package/dest/bindgen/index.d.ts.map +0 -1
  125. package/dest/bindgen/index.js +0 -15
  126. package/dest/bindgen/mappings.d.ts +0 -4
  127. package/dest/bindgen/mappings.d.ts.map +0 -1
  128. package/dest/bindgen/mappings.js +0 -63
  129. package/dest/bindgen/rust.d.ts +0 -2
  130. package/dest/bindgen/rust.d.ts.map +0 -1
  131. package/dest/bindgen/rust.js +0 -43
  132. package/dest/bindgen/to_camel_case.d.ts +0 -2
  133. package/dest/bindgen/to_camel_case.d.ts.map +0 -1
  134. package/dest/bindgen/to_camel_case.js +0 -11
  135. package/dest/bindgen/typescript.d.ts +0 -2
  136. package/dest/bindgen/typescript.d.ts.map +0 -1
  137. package/dest/bindgen/typescript.js +0 -80
  138. package/dest/crs/browser/cached_net_crs.d.ts +0 -25
  139. package/dest/crs/browser/cached_net_crs.d.ts.map +0 -1
  140. package/dest/crs/browser/cached_net_crs.js +0 -54
  141. package/dest/crs/browser/index.d.ts +0 -2
  142. package/dest/crs/browser/index.d.ts.map +0 -1
  143. package/dest/crs/browser/index.js +0 -2
  144. package/dest/crs/index.d.ts +0 -2
  145. package/dest/crs/index.d.ts.map +0 -1
  146. package/dest/crs/index.js +0 -2
  147. package/dest/crs/net_crs.d.ts +0 -36
  148. package/dest/crs/net_crs.d.ts.map +0 -1
  149. package/dest/crs/net_crs.js +0 -59
  150. package/dest/crs/node/file_crs.d.ts +0 -37
  151. package/dest/crs/node/file_crs.d.ts.map +0 -1
  152. package/dest/crs/node/file_crs.js +0 -51
  153. package/dest/crs/node/index.d.ts +0 -31
  154. package/dest/crs/node/index.d.ts.map +0 -1
  155. package/dest/crs/node/index.js +0 -41
  156. package/dest/examples/simple.rawtest.d.ts +0 -2
  157. package/dest/examples/simple.rawtest.d.ts.map +0 -1
  158. package/dest/examples/simple.rawtest.js +0 -29
  159. package/dest/examples/simple.test.d.ts +0 -2
  160. package/dest/examples/simple.test.d.ts.map +0 -1
  161. package/dest/examples/simple.test.js +0 -22
  162. package/dest/factory/index.d.ts +0 -21
  163. package/dest/factory/index.d.ts.map +0 -1
  164. package/dest/factory/index.js +0 -34
  165. package/dest/index.d.ts +0 -6
  166. package/dest/index.d.ts.map +0 -1
  167. package/dest/index.html +0 -1
  168. package/dest/index.js +0 -6
  169. package/dest/main.d.ts +0 -10
  170. package/dest/main.d.ts.map +0 -1
  171. package/dest/main.js +0 -280
  172. package/dest/random/browser/index.d.ts +0 -2
  173. package/dest/random/browser/index.d.ts.map +0 -1
  174. package/dest/random/browser/index.js +0 -31
  175. package/dest/random/index.d.ts +0 -2
  176. package/dest/random/index.d.ts.map +0 -1
  177. package/dest/random/index.js +0 -2
  178. package/dest/random/node/index.d.ts +0 -2
  179. package/dest/random/node/index.d.ts.map +0 -1
  180. package/dest/random/node/index.js +0 -5
  181. package/dest/serialize/buffer_reader.d.ts +0 -28
  182. package/dest/serialize/buffer_reader.d.ts.map +0 -1
  183. package/dest/serialize/buffer_reader.js +0 -66
  184. package/dest/serialize/index.d.ts +0 -4
  185. package/dest/serialize/index.d.ts.map +0 -1
  186. package/dest/serialize/index.js +0 -4
  187. package/dest/serialize/output_type.d.ts +0 -11
  188. package/dest/serialize/output_type.d.ts.map +0 -1
  189. package/dest/serialize/output_type.js +0 -44
  190. package/dest/serialize/serialize.d.ts +0 -53
  191. package/dest/serialize/serialize.d.ts.map +0 -1
  192. package/dest/serialize/serialize.js +0 -139
  193. package/dest/simple_test.js +0 -2
  194. package/dest/simple_test.js.LICENSE.txt +0 -14
  195. package/dest/types/fields.d.ts +0 -33
  196. package/dest/types/fields.d.ts.map +0 -1
  197. package/dest/types/fields.js +0 -86
  198. package/dest/types/fixed_size_buffer.d.ts +0 -26
  199. package/dest/types/fixed_size_buffer.d.ts.map +0 -1
  200. package/dest/types/fixed_size_buffer.js +0 -54
  201. package/dest/types/index.d.ts +0 -6
  202. package/dest/types/index.d.ts.map +0 -1
  203. package/dest/types/index.js +0 -6
  204. package/dest/types/point.d.ts +0 -17
  205. package/dest/types/point.d.ts.map +0 -1
  206. package/dest/types/point.js +0 -32
  207. package/dest/types/ptr.d.ts +0 -13
  208. package/dest/types/ptr.d.ts.map +0 -1
  209. package/dest/types/ptr.js +0 -20
  210. package/dest/types/raw_buffer.d.ts +0 -3
  211. package/dest/types/raw_buffer.d.ts.map +0 -1
  212. package/dest/types/raw_buffer.js +0 -5
  213. package/src/barretenberg_api/blake2s.test.ts +0 -39
  214. package/src/barretenberg_api/pedersen.test.ts +0 -84
  215. package/src/barretenberg_api/schnorr.test.ts +0 -169
  216. package/src/barretenberg_binder/heap_allocator.ts +0 -62
  217. package/src/barretenberg_binder/index.ts +0 -76
  218. package/src/barretenberg_wasm/barretenberg_wasm.test.ts +0 -52
  219. package/src/barretenberg_wasm/barretenberg_wasm.ts +0 -246
  220. package/src/barretenberg_wasm/browser/index.ts +0 -32
  221. package/src/barretenberg_wasm/browser/worker.ts +0 -13
  222. package/src/barretenberg_wasm/node/worker.ts +0 -10
  223. package/src/crs/node/file_crs.ts +0 -60
  224. package/src/examples/simple.rawtest.ts +0 -37
  225. package/src/examples/simple.test.ts +0 -27
  226. package/src/factory/index.ts +0 -36
  227. /package/src/barretenberg_wasm/{node → helpers/node}/node_endpoint.ts +0 -0
@@ -1,471 +1,1216 @@
1
1
  // WARNING: FILE CODE GENERATED BY BINDGEN UTILITY. DO NOT EDIT!
2
2
  /* eslint-disable @typescript-eslint/no-unused-vars */
3
- import { BarretenbergBinder, BarretenbergBinderSync } from '../barretenberg_binder/index.js';
4
- import { BufferDeserializer, NumberDeserializer, VectorDeserializer, BoolDeserializer, StringDeserializer } from '../serialize/index.js';
5
- import { Fr, Fq, Point, Buffer32, Buffer128, Ptr } from '../types/index.js';
3
+ import { BarretenbergWasmMain, BarretenbergWasmMainWorker } from '../barretenberg_wasm/barretenberg_wasm_main/index.js';
4
+ import {
5
+ BufferDeserializer,
6
+ NumberDeserializer,
7
+ VectorDeserializer,
8
+ BoolDeserializer,
9
+ StringDeserializer,
10
+ serializeBufferable,
11
+ OutputType,
12
+ } from '../serialize/index.js';
13
+ import { Fr, Point, Buffer32, Ptr } from '../types/index.js';
6
14
 
7
15
  export class BarretenbergApi {
8
- constructor(public binder: BarretenbergBinder) {}
9
-
10
- async destroy() {
11
- await this.binder.wasm.destroy();
12
- }
13
-
14
- async pedersenInit(): Promise<void> {
15
- const result = await this.binder.callWasmExport('pedersen___init', [], []);
16
- return;
17
- }
18
-
19
- async pedersenCompressFields(left: Fr, right: Fr): Promise<Fr> {
20
- const result = await this.binder.callWasmExport('pedersen___compress_fields', [left, right], [Fr]);
21
- return result[0];
22
- }
23
-
24
- async pedersenPlookupCompressFields(left: Fr, right: Fr): Promise<Fr> {
25
- const result = await this.binder.callWasmExport('pedersen___plookup_compress_fields', [left, right], [Fr]);
26
- return result[0];
27
- }
28
-
29
- async pedersenCompress(inputsBuffer: Fr[]): Promise<Fr> {
30
- const result = await this.binder.callWasmExport('pedersen___compress', [inputsBuffer], [Fr]);
31
- return result[0];
32
- }
33
-
34
- async pedersenPlookupCompress(inputsBuffer: Fr[]): Promise<Fr> {
35
- const result = await this.binder.callWasmExport('pedersen___plookup_compress', [inputsBuffer], [Fr]);
36
- return result[0];
37
- }
38
-
39
- async pedersenCompressWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
40
- const result = await this.binder.callWasmExport('pedersen___compress_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
41
- return result[0];
42
- }
43
-
44
- async pedersenCommit(inputsBuffer: Fr[]): Promise<Fr> {
45
- const result = await this.binder.callWasmExport('pedersen___commit', [inputsBuffer], [Fr]);
46
- return result[0];
47
- }
48
-
49
- async pedersenPlookupCommit(inputsBuffer: Fr[]): Promise<Fr> {
50
- const result = await this.binder.callWasmExport('pedersen___plookup_commit', [inputsBuffer], [Fr]);
51
- return result[0];
52
- }
53
-
54
- async pedersenPlookupCommitWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
55
- const result = await this.binder.callWasmExport('pedersen___plookup_commit_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
56
- return result[0];
57
- }
58
-
59
- async pedersenBufferToField(data: Uint8Array): Promise<Fr> {
60
- const result = await this.binder.callWasmExport('pedersen___buffer_to_field', [data], [Fr]);
61
- return result[0];
62
- }
63
-
64
- async pedersenHashInit(): Promise<void> {
65
- const result = await this.binder.callWasmExport('pedersen_hash_init', [], []);
66
- return;
67
- }
68
-
69
- async pedersenHashPair(left: Fr, right: Fr): Promise<Fr> {
70
- const result = await this.binder.callWasmExport('pedersen_hash_pair', [left, right], [Fr]);
71
- return result[0];
72
- }
73
-
74
- async pedersenHashMultiple(inputsBuffer: Fr[]): Promise<Fr> {
75
- const result = await this.binder.callWasmExport('pedersen_hash_multiple', [inputsBuffer], [Fr]);
76
- return result[0];
77
- }
78
-
79
- async pedersenHashMultipleWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
80
- const result = await this.binder.callWasmExport('pedersen_hash_multiple_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
81
- return result[0];
82
- }
83
-
84
- async pedersenHashToTree(data: Fr[]): Promise<Fr[]> {
85
- const result = await this.binder.callWasmExport('pedersen_hash_to_tree', [data], [VectorDeserializer(Fr)]);
86
- return result[0];
16
+ constructor(protected wasm: BarretenbergWasmMainWorker) {}
17
+
18
+ async pedersenCommit(inputsBuffer: Fr[], ctxIndex: number): Promise<Point> {
19
+ const inArgs = [inputsBuffer, ctxIndex].map(serializeBufferable);
20
+ const outTypes: OutputType[] = [Point];
21
+ const result = await this.wasm.callWasmExport(
22
+ 'pedersen_commit',
23
+ inArgs,
24
+ outTypes.map(t => t.SIZE_IN_BYTES),
25
+ );
26
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
27
+ return out[0];
28
+ }
29
+
30
+ async pedersenHash(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
31
+ const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
32
+ const outTypes: OutputType[] = [Fr];
33
+ const result = await this.wasm.callWasmExport(
34
+ 'pedersen_hash',
35
+ inArgs,
36
+ outTypes.map(t => t.SIZE_IN_BYTES),
37
+ );
38
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
39
+ return out[0];
40
+ }
41
+
42
+ async pedersenHashes(inputsBuffer: Fr[], hashIndex: number): Promise<Fr> {
43
+ const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
44
+ const outTypes: OutputType[] = [Fr];
45
+ const result = await this.wasm.callWasmExport(
46
+ 'pedersen_hashes',
47
+ inArgs,
48
+ outTypes.map(t => t.SIZE_IN_BYTES),
49
+ );
50
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
51
+ return out[0];
52
+ }
53
+
54
+ async pedersenHashBuffer(inputBuffer: Uint8Array, hashIndex: number): Promise<Fr> {
55
+ const inArgs = [inputBuffer, hashIndex].map(serializeBufferable);
56
+ const outTypes: OutputType[] = [Fr];
57
+ const result = await this.wasm.callWasmExport(
58
+ 'pedersen_hash_buffer',
59
+ inArgs,
60
+ outTypes.map(t => t.SIZE_IN_BYTES),
61
+ );
62
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
63
+ return out[0];
64
+ }
65
+
66
+ async poseidon2Hash(inputsBuffer: Fr[]): Promise<Fr> {
67
+ const inArgs = [inputsBuffer].map(serializeBufferable);
68
+ const outTypes: OutputType[] = [Fr];
69
+ const result = await this.wasm.callWasmExport(
70
+ 'poseidon2_hash',
71
+ inArgs,
72
+ outTypes.map(t => t.SIZE_IN_BYTES),
73
+ );
74
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
75
+ return out[0];
76
+ }
77
+
78
+ async poseidon2Hashes(inputsBuffer: Fr[]): Promise<Fr> {
79
+ const inArgs = [inputsBuffer].map(serializeBufferable);
80
+ const outTypes: OutputType[] = [Fr];
81
+ const result = await this.wasm.callWasmExport(
82
+ 'poseidon2_hashes',
83
+ inArgs,
84
+ outTypes.map(t => t.SIZE_IN_BYTES),
85
+ );
86
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
87
+ return out[0];
88
+ }
89
+
90
+ async poseidon2Permutation(inputsBuffer: Fr[]): Promise<Fr[]> {
91
+ const inArgs = [inputsBuffer].map(serializeBufferable);
92
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
93
+ const result = await this.wasm.callWasmExport(
94
+ 'poseidon2_permutation',
95
+ inArgs,
96
+ outTypes.map(t => t.SIZE_IN_BYTES),
97
+ );
98
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
99
+ return out[0];
100
+ }
101
+
102
+ async poseidon2HashAccumulate(inputsBuffer: Fr[]): Promise<Fr> {
103
+ const inArgs = [inputsBuffer].map(serializeBufferable);
104
+ const outTypes: OutputType[] = [Fr];
105
+ const result = await this.wasm.callWasmExport(
106
+ 'poseidon2_hash_accumulate',
107
+ inArgs,
108
+ outTypes.map(t => t.SIZE_IN_BYTES),
109
+ );
110
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
111
+ return out[0];
87
112
  }
88
113
 
89
114
  async blake2s(data: Uint8Array): Promise<Buffer32> {
90
- const result = await this.binder.callWasmExport('blake2s', [data], [Buffer32]);
91
- return result[0];
115
+ const inArgs = [data].map(serializeBufferable);
116
+ const outTypes: OutputType[] = [Buffer32];
117
+ const result = await this.wasm.callWasmExport(
118
+ 'blake2s',
119
+ inArgs,
120
+ outTypes.map(t => t.SIZE_IN_BYTES),
121
+ );
122
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
123
+ return out[0];
92
124
  }
93
125
 
94
126
  async blake2sToField(data: Uint8Array): Promise<Fr> {
95
- const result = await this.binder.callWasmExport('blake2s_to_field_', [data], [Fr]);
96
- return result[0];
97
- }
98
-
99
- async schnorrComputePublicKey(privateKey: Fr): Promise<Point> {
100
- const result = await this.binder.callWasmExport('schnorr_compute_public_key', [privateKey], [Point]);
101
- return result[0];
102
- }
103
-
104
- async schnorrNegatePublicKey(publicKeyBuffer: Point): Promise<Point> {
105
- const result = await this.binder.callWasmExport('schnorr_negate_public_key', [publicKeyBuffer], [Point]);
106
- return result[0];
107
- }
108
-
109
- async schnorrConstructSignature(message: Uint8Array, privateKey: Fr): Promise<[Buffer32, Buffer32]> {
110
- const result = await this.binder.callWasmExport('schnorr_construct_signature', [message, privateKey], [Buffer32, Buffer32]);
111
- return result as any;
112
- }
113
-
114
- async schnorrVerifySignature(message: Uint8Array, pubKey: Point, sigS: Buffer32, sigE: Buffer32): Promise<boolean> {
115
- const result = await this.binder.callWasmExport('schnorr_verify_signature', [message, pubKey, sigS, sigE], [BoolDeserializer()]);
116
- return result[0];
117
- }
118
-
119
- async schnorrMultisigCreateMultisigPublicKey(privateKey: Fq): Promise<Buffer128> {
120
- const result = await this.binder.callWasmExport('schnorr_multisig_create_multisig_public_key', [privateKey], [Buffer128]);
121
- return result[0];
122
- }
123
-
124
- async schnorrMultisigValidateAndCombineSignerPubkeys(signerPubkeyBuf: Buffer128[]): Promise<[Point, boolean]> {
125
- const result = await this.binder.callWasmExport('schnorr_multisig_validate_and_combine_signer_pubkeys', [signerPubkeyBuf], [Point, BoolDeserializer()]);
126
- return result as any;
127
- }
128
-
129
- async schnorrMultisigConstructSignatureRound1(): Promise<[Buffer128, Buffer128]> {
130
- const result = await this.binder.callWasmExport('schnorr_multisig_construct_signature_round_1', [], [Buffer128, Buffer128]);
131
- return result as any;
132
- }
133
-
134
- async schnorrMultisigConstructSignatureRound2(message: Uint8Array, privateKey: Fq, signerRoundOnePrivateBuf: Buffer128, signerPubkeysBuf: Buffer128[], roundOnePublicBuf: Buffer128[]): Promise<[Fq, boolean]> {
135
- const result = await this.binder.callWasmExport('schnorr_multisig_construct_signature_round_2', [message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf], [Fq, BoolDeserializer()]);
136
- return result as any;
137
- }
138
-
139
- async schnorrMultisigCombineSignatures(message: Uint8Array, signerPubkeysBuf: Buffer128[], roundOneBuf: Buffer128[], roundTwoBuf: Fr[]): Promise<[Buffer32, Buffer32, boolean]> {
140
- const result = await this.binder.callWasmExport('schnorr_multisig_combine_signatures', [message, signerPubkeysBuf, roundOneBuf, roundTwoBuf], [Buffer32, Buffer32, BoolDeserializer()]);
141
- return result as any;
127
+ const inArgs = [data].map(serializeBufferable);
128
+ const outTypes: OutputType[] = [Fr];
129
+ const result = await this.wasm.callWasmExport(
130
+ 'blake2s_to_field_',
131
+ inArgs,
132
+ outTypes.map(t => t.SIZE_IN_BYTES),
133
+ );
134
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
135
+ return out[0];
136
+ }
137
+
138
+ async aesEncryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Promise<Uint8Array> {
139
+ const inArgs = [input, iv, key, length].map(serializeBufferable);
140
+ const outTypes: OutputType[] = [BufferDeserializer()];
141
+ const result = await this.wasm.callWasmExport(
142
+ 'aes_encrypt_buffer_cbc',
143
+ inArgs,
144
+ outTypes.map(t => t.SIZE_IN_BYTES),
145
+ );
146
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
147
+ return out[0];
148
+ }
149
+
150
+ async aesDecryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Promise<Uint8Array> {
151
+ const inArgs = [input, iv, key, length].map(serializeBufferable);
152
+ const outTypes: OutputType[] = [BufferDeserializer()];
153
+ const result = await this.wasm.callWasmExport(
154
+ 'aes_decrypt_buffer_cbc',
155
+ inArgs,
156
+ outTypes.map(t => t.SIZE_IN_BYTES),
157
+ );
158
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
159
+ return out[0];
142
160
  }
143
161
 
144
162
  async srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): Promise<void> {
145
- const result = await this.binder.callWasmExport('srs_init_srs', [pointsBuf, numPoints, g2PointBuf], []);
163
+ const inArgs = [pointsBuf, numPoints, g2PointBuf].map(serializeBufferable);
164
+ const outTypes: OutputType[] = [];
165
+ const result = await this.wasm.callWasmExport(
166
+ 'srs_init_srs',
167
+ inArgs,
168
+ outTypes.map(t => t.SIZE_IN_BYTES),
169
+ );
170
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
146
171
  return;
147
172
  }
148
173
 
149
- async examplesSimpleCreateAndVerifyProof(): Promise<boolean> {
150
- const result = await this.binder.callWasmExport('examples_simple_create_and_verify_proof', [], [BoolDeserializer()]);
151
- return result[0];
152
- }
153
-
154
- async testThreads(threads: number, iterations: number): Promise<number> {
155
- const result = await this.binder.callWasmExport('test_threads', [threads, iterations], [NumberDeserializer()]);
156
- return result[0];
157
- }
158
-
159
- async testThreadAbort(): Promise<void> {
160
- const result = await this.binder.callWasmExport('test_thread_abort', [], []);
174
+ async srsInitGrumpkinSrs(pointsBuf: Uint8Array, numPoints: number): Promise<void> {
175
+ const inArgs = [pointsBuf, numPoints].map(serializeBufferable);
176
+ const outTypes: OutputType[] = [];
177
+ const result = await this.wasm.callWasmExport(
178
+ 'srs_init_grumpkin_srs',
179
+ inArgs,
180
+ outTypes.map(t => t.SIZE_IN_BYTES),
181
+ );
182
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
161
183
  return;
162
184
  }
163
185
 
164
- async testAbort(): Promise<void> {
165
- const result = await this.binder.callWasmExport('test_abort', [], []);
166
- return;
186
+ async testThreads(threads: number, iterations: number): Promise<number> {
187
+ const inArgs = [threads, iterations].map(serializeBufferable);
188
+ const outTypes: OutputType[] = [NumberDeserializer()];
189
+ const result = await this.wasm.callWasmExport(
190
+ 'test_threads',
191
+ inArgs,
192
+ outTypes.map(t => t.SIZE_IN_BYTES),
193
+ );
194
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
195
+ return out[0];
167
196
  }
168
197
 
169
198
  async commonInitSlabAllocator(circuitSize: number): Promise<void> {
170
- const result = await this.binder.callWasmExport('common_init_slab_allocator', [circuitSize], []);
171
- return;
172
- }
173
-
174
- async acirGetCircuitSizes(constraintSystemBuf: Uint8Array): Promise<[number, number, number]> {
175
- const result = await this.binder.callWasmExport('acir_get_circuit_sizes', [constraintSystemBuf], [NumberDeserializer(), NumberDeserializer(), NumberDeserializer()]);
176
- return result as any;
177
- }
178
-
179
- async acirNewAcirComposer(sizeHint: number): Promise<Ptr> {
180
- const result = await this.binder.callWasmExport('acir_new_acir_composer', [sizeHint], [Ptr]);
181
- return result[0];
182
- }
183
-
184
- async acirDeleteAcirComposer(acirComposerPtr: Ptr): Promise<void> {
185
- const result = await this.binder.callWasmExport('acir_delete_acir_composer', [acirComposerPtr], []);
186
- return;
187
- }
188
-
189
- async acirCreateCircuit(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, sizeHint: number): Promise<void> {
190
- const result = await this.binder.callWasmExport('acir_create_circuit', [acirComposerPtr, constraintSystemBuf, sizeHint], []);
191
- return;
192
- }
193
-
194
- async acirInitProvingKey(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array): Promise<void> {
195
- const result = await this.binder.callWasmExport('acir_init_proving_key', [acirComposerPtr, constraintSystemBuf], []);
199
+ const inArgs = [circuitSize].map(serializeBufferable);
200
+ const outTypes: OutputType[] = [];
201
+ const result = await this.wasm.callWasmExport(
202
+ 'common_init_slab_allocator',
203
+ inArgs,
204
+ outTypes.map(t => t.SIZE_IN_BYTES),
205
+ );
206
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
196
207
  return;
197
208
  }
198
209
 
199
- async acirCreateProof(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array, isRecursive: boolean): Promise<Uint8Array> {
200
- const result = await this.binder.callWasmExport('acir_create_proof', [acirComposerPtr, constraintSystemBuf, witnessBuf, isRecursive], [BufferDeserializer()]);
201
- return result[0];
210
+ async acirGetCircuitSizes(
211
+ constraintSystemBuf: Uint8Array,
212
+ recursive: boolean,
213
+ honkRecursion: boolean,
214
+ ): Promise<[number, number]> {
215
+ const inArgs = [constraintSystemBuf, recursive, honkRecursion].map(serializeBufferable);
216
+ const outTypes: OutputType[] = [NumberDeserializer(), NumberDeserializer()];
217
+ const result = await this.wasm.callWasmExport(
218
+ 'acir_get_circuit_sizes',
219
+ inArgs,
220
+ outTypes.map(t => t.SIZE_IN_BYTES),
221
+ );
222
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
223
+ return out as any;
224
+ }
225
+
226
+ async acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<boolean> {
227
+ const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
228
+ const outTypes: OutputType[] = [BoolDeserializer()];
229
+ const result = await this.wasm.callWasmExport(
230
+ 'acir_prove_and_verify_ultra_honk',
231
+ inArgs,
232
+ outTypes.map(t => t.SIZE_IN_BYTES),
233
+ );
234
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
235
+ return out[0];
236
+ }
237
+
238
+ async acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): Promise<boolean> {
239
+ const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
240
+ const outTypes: OutputType[] = [BoolDeserializer()];
241
+ const result = await this.wasm.callWasmExport(
242
+ 'acir_prove_and_verify_mega_honk',
243
+ inArgs,
244
+ outTypes.map(t => t.SIZE_IN_BYTES),
245
+ );
246
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
247
+ return out[0];
248
+ }
249
+
250
+ async acirProveAztecClient(ivcInputsBuf: Uint8Array): Promise<[Uint8Array, Uint8Array]> {
251
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
252
+ const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
253
+ const result = await this.wasm.callWasmExport(
254
+ 'acir_prove_aztec_client',
255
+ inArgs,
256
+ outTypes.map(t => t.SIZE_IN_BYTES),
257
+ );
258
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
259
+ return out as any;
260
+ }
261
+
262
+ async acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
263
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
264
+ const outTypes: OutputType[] = [BoolDeserializer()];
265
+ const result = await this.wasm.callWasmExport(
266
+ 'acir_verify_aztec_client',
267
+ inArgs,
268
+ outTypes.map(t => t.SIZE_IN_BYTES),
269
+ );
270
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
271
+ return out[0];
202
272
  }
203
273
 
204
274
  async acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): Promise<void> {
205
- const result = await this.binder.callWasmExport('acir_load_verification_key', [acirComposerPtr, vkBuf], []);
275
+ const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
276
+ const outTypes: OutputType[] = [];
277
+ const result = await this.wasm.callWasmExport(
278
+ 'acir_load_verification_key',
279
+ inArgs,
280
+ outTypes.map(t => t.SIZE_IN_BYTES),
281
+ );
282
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
206
283
  return;
207
284
  }
208
285
 
209
286
  async acirInitVerificationKey(acirComposerPtr: Ptr): Promise<void> {
210
- const result = await this.binder.callWasmExport('acir_init_verification_key', [acirComposerPtr], []);
287
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
288
+ const outTypes: OutputType[] = [];
289
+ const result = await this.wasm.callWasmExport(
290
+ 'acir_init_verification_key',
291
+ inArgs,
292
+ outTypes.map(t => t.SIZE_IN_BYTES),
293
+ );
294
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
211
295
  return;
212
296
  }
213
297
 
214
298
  async acirGetVerificationKey(acirComposerPtr: Ptr): Promise<Uint8Array> {
215
- const result = await this.binder.callWasmExport('acir_get_verification_key', [acirComposerPtr], [BufferDeserializer()]);
216
- return result[0];
217
- }
218
-
219
- async acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array, isRecursive: boolean): Promise<boolean> {
220
- const result = await this.binder.callWasmExport('acir_verify_proof', [acirComposerPtr, proofBuf, isRecursive], [BoolDeserializer()]);
221
- return result[0];
299
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
300
+ const outTypes: OutputType[] = [BufferDeserializer()];
301
+ const result = await this.wasm.callWasmExport(
302
+ 'acir_get_verification_key',
303
+ inArgs,
304
+ outTypes.map(t => t.SIZE_IN_BYTES),
305
+ );
306
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
307
+ return out[0];
308
+ }
309
+
310
+ async acirGetProvingKey(acirComposerPtr: Ptr, acirVec: Uint8Array, recursive: boolean): Promise<Uint8Array> {
311
+ const inArgs = [acirComposerPtr, acirVec, recursive].map(serializeBufferable);
312
+ const outTypes: OutputType[] = [BufferDeserializer()];
313
+ const result = await this.wasm.callWasmExport(
314
+ 'acir_get_proving_key',
315
+ inArgs,
316
+ outTypes.map(t => t.SIZE_IN_BYTES),
317
+ );
318
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
319
+ return out[0];
320
+ }
321
+
322
+ async acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array): Promise<boolean> {
323
+ const inArgs = [acirComposerPtr, proofBuf].map(serializeBufferable);
324
+ const outTypes: OutputType[] = [BoolDeserializer()];
325
+ const result = await this.wasm.callWasmExport(
326
+ 'acir_verify_proof',
327
+ inArgs,
328
+ outTypes.map(t => t.SIZE_IN_BYTES),
329
+ );
330
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
331
+ return out[0];
222
332
  }
223
333
 
224
334
  async acirGetSolidityVerifier(acirComposerPtr: Ptr): Promise<string> {
225
- const result = await this.binder.callWasmExport('acir_get_solidity_verifier', [acirComposerPtr], [StringDeserializer()]);
226
- return result[0];
227
- }
228
-
229
- async acirSerializeProofIntoFields(acirComposerPtr: Ptr, proofBuf: Uint8Array, numInnerPublicInputs: number): Promise<Fr[]> {
230
- const result = await this.binder.callWasmExport('acir_serialize_proof_into_fields', [acirComposerPtr, proofBuf, numInnerPublicInputs], [VectorDeserializer(Fr)]);
231
- return result[0];
335
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
336
+ const outTypes: OutputType[] = [StringDeserializer()];
337
+ const result = await this.wasm.callWasmExport(
338
+ 'acir_get_solidity_verifier',
339
+ inArgs,
340
+ outTypes.map(t => t.SIZE_IN_BYTES),
341
+ );
342
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
343
+ return out[0];
344
+ }
345
+
346
+ async acirHonkSolidityVerifier(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<string> {
347
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
348
+ const outTypes: OutputType[] = [StringDeserializer()];
349
+ const result = await this.wasm.callWasmExport(
350
+ 'acir_honk_solidity_verifier',
351
+ inArgs,
352
+ outTypes.map(t => t.SIZE_IN_BYTES),
353
+ );
354
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
355
+ return out[0];
356
+ }
357
+
358
+ async acirSerializeProofIntoFields(
359
+ acirComposerPtr: Ptr,
360
+ proofBuf: Uint8Array,
361
+ numInnerPublicInputs: number,
362
+ ): Promise<Fr[]> {
363
+ const inArgs = [acirComposerPtr, proofBuf, numInnerPublicInputs].map(serializeBufferable);
364
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
365
+ const result = await this.wasm.callWasmExport(
366
+ 'acir_serialize_proof_into_fields',
367
+ inArgs,
368
+ outTypes.map(t => t.SIZE_IN_BYTES),
369
+ );
370
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
371
+ return out[0];
232
372
  }
233
373
 
234
374
  async acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): Promise<[Fr[], Fr]> {
235
- const result = await this.binder.callWasmExport('acir_serialize_verification_key_into_fields', [acirComposerPtr], [VectorDeserializer(Fr), Fr]);
236
- return result as any;
375
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
376
+ const outTypes: OutputType[] = [VectorDeserializer(Fr), Fr];
377
+ const result = await this.wasm.callWasmExport(
378
+ 'acir_serialize_verification_key_into_fields',
379
+ inArgs,
380
+ outTypes.map(t => t.SIZE_IN_BYTES),
381
+ );
382
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
383
+ return out as any;
384
+ }
385
+
386
+ async acirProveUltraZKHonk(acirVec: Uint8Array, witnessVec: Uint8Array, vkBuf: Uint8Array): Promise<Uint8Array> {
387
+ const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
388
+ const outTypes: OutputType[] = [BufferDeserializer()];
389
+ const result = await this.wasm.callWasmExport(
390
+ 'acir_prove_ultra_zk_honk',
391
+ inArgs,
392
+ outTypes.map(t => t.SIZE_IN_BYTES),
393
+ );
394
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
395
+ return out[0];
396
+ }
397
+
398
+ async acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array, vkBuf: Uint8Array): Promise<Uint8Array> {
399
+ const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
400
+ const outTypes: OutputType[] = [BufferDeserializer()];
401
+ const result = await this.wasm.callWasmExport(
402
+ 'acir_prove_ultra_keccak_honk',
403
+ inArgs,
404
+ outTypes.map(t => t.SIZE_IN_BYTES),
405
+ );
406
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
407
+ return out[0];
408
+ }
409
+
410
+ async acirProveUltraKeccakZkHonk(
411
+ acirVec: Uint8Array,
412
+ witnessVec: Uint8Array,
413
+ vkBuf: Uint8Array,
414
+ ): Promise<Uint8Array> {
415
+ const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
416
+ const outTypes: OutputType[] = [BufferDeserializer()];
417
+ const result = await this.wasm.callWasmExport(
418
+ 'acir_prove_ultra_keccak_zk_honk',
419
+ inArgs,
420
+ outTypes.map(t => t.SIZE_IN_BYTES),
421
+ );
422
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
423
+ return out[0];
424
+ }
425
+
426
+ async acirProveUltraStarknetHonk(
427
+ acirVec: Uint8Array,
428
+ witnessVec: Uint8Array,
429
+ vkBuf: Uint8Array,
430
+ ): Promise<Uint8Array> {
431
+ const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
432
+ const outTypes: OutputType[] = [BufferDeserializer()];
433
+ const result = await this.wasm.callWasmExport(
434
+ 'acir_prove_ultra_starknet_honk',
435
+ inArgs,
436
+ outTypes.map(t => t.SIZE_IN_BYTES),
437
+ );
438
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
439
+ return out[0];
440
+ }
441
+
442
+ async acirProveUltraStarknetZkHonk(
443
+ acirVec: Uint8Array,
444
+ witnessVec: Uint8Array,
445
+ vkBuf: Uint8Array,
446
+ ): Promise<Uint8Array> {
447
+ const inArgs = [acirVec, witnessVec, vkBuf].map(serializeBufferable);
448
+ const outTypes: OutputType[] = [BufferDeserializer()];
449
+ const result = await this.wasm.callWasmExport(
450
+ 'acir_prove_ultra_starknet_zk_honk',
451
+ inArgs,
452
+ outTypes.map(t => t.SIZE_IN_BYTES),
453
+ );
454
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
455
+ return out[0];
456
+ }
457
+
458
+ async acirVerifyUltraZKHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
459
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
460
+ const outTypes: OutputType[] = [BoolDeserializer()];
461
+ const result = await this.wasm.callWasmExport(
462
+ 'acir_verify_ultra_zk_honk',
463
+ inArgs,
464
+ outTypes.map(t => t.SIZE_IN_BYTES),
465
+ );
466
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
467
+ return out[0];
468
+ }
469
+
470
+ async acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
471
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
472
+ const outTypes: OutputType[] = [BoolDeserializer()];
473
+ const result = await this.wasm.callWasmExport(
474
+ 'acir_verify_ultra_keccak_honk',
475
+ inArgs,
476
+ outTypes.map(t => t.SIZE_IN_BYTES),
477
+ );
478
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
479
+ return out[0];
480
+ }
481
+
482
+ async acirVerifyUltraKeccakZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
483
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
484
+ const outTypes: OutputType[] = [BoolDeserializer()];
485
+ const result = await this.wasm.callWasmExport(
486
+ 'acir_verify_ultra_keccak_zk_honk',
487
+ inArgs,
488
+ outTypes.map(t => t.SIZE_IN_BYTES),
489
+ );
490
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
491
+ return out[0];
492
+ }
493
+
494
+ async acirVerifyUltraStarknetHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
495
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
496
+ const outTypes: OutputType[] = [BoolDeserializer()];
497
+ const result = await this.wasm.callWasmExport(
498
+ 'acir_verify_ultra_starknet_honk',
499
+ inArgs,
500
+ outTypes.map(t => t.SIZE_IN_BYTES),
501
+ );
502
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
503
+ return out[0];
504
+ }
505
+
506
+ async acirVerifyUltraStarknetZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): Promise<boolean> {
507
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
508
+ const outTypes: OutputType[] = [BoolDeserializer()];
509
+ const result = await this.wasm.callWasmExport(
510
+ 'acir_verify_ultra_starknet_zk_honk',
511
+ inArgs,
512
+ outTypes.map(t => t.SIZE_IN_BYTES),
513
+ );
514
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
515
+ return out[0];
516
+ }
517
+
518
+ async acirWriteVkUltraHonk(acirVec: Uint8Array): Promise<Uint8Array> {
519
+ const inArgs = [acirVec].map(serializeBufferable);
520
+ const outTypes: OutputType[] = [BufferDeserializer()];
521
+ const result = await this.wasm.callWasmExport(
522
+ 'acir_write_vk_ultra_honk',
523
+ inArgs,
524
+ outTypes.map(t => t.SIZE_IN_BYTES),
525
+ );
526
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
527
+ return out[0];
528
+ }
529
+
530
+ async acirWriteVkUltraKeccakHonk(acirVec: Uint8Array): Promise<Uint8Array> {
531
+ const inArgs = [acirVec].map(serializeBufferable);
532
+ const outTypes: OutputType[] = [BufferDeserializer()];
533
+ const result = await this.wasm.callWasmExport(
534
+ 'acir_write_vk_ultra_keccak_honk',
535
+ inArgs,
536
+ outTypes.map(t => t.SIZE_IN_BYTES),
537
+ );
538
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
539
+ return out[0];
540
+ }
541
+
542
+ async acirWriteVkUltraKeccakZkHonk(acirVec: Uint8Array): Promise<Uint8Array> {
543
+ const inArgs = [acirVec].map(serializeBufferable);
544
+ const outTypes: OutputType[] = [BufferDeserializer()];
545
+ const result = await this.wasm.callWasmExport(
546
+ 'acir_write_vk_ultra_keccak_zk_honk',
547
+ inArgs,
548
+ outTypes.map(t => t.SIZE_IN_BYTES),
549
+ );
550
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
551
+ return out[0];
552
+ }
553
+
554
+ async acirWriteVkUltraStarknetHonk(acirVec: Uint8Array): Promise<Uint8Array> {
555
+ const inArgs = [acirVec].map(serializeBufferable);
556
+ const outTypes: OutputType[] = [BufferDeserializer()];
557
+ const result = await this.wasm.callWasmExport(
558
+ 'acir_write_vk_ultra_starknet_honk',
559
+ inArgs,
560
+ outTypes.map(t => t.SIZE_IN_BYTES),
561
+ );
562
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
563
+ return out[0];
564
+ }
565
+
566
+ async acirWriteVkUltraStarknetZkHonk(acirVec: Uint8Array): Promise<Uint8Array> {
567
+ const inArgs = [acirVec].map(serializeBufferable);
568
+ const outTypes: OutputType[] = [BufferDeserializer()];
569
+ const result = await this.wasm.callWasmExport(
570
+ 'acir_write_vk_ultra_starknet_zk_honk',
571
+ inArgs,
572
+ outTypes.map(t => t.SIZE_IN_BYTES),
573
+ );
574
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
575
+ return out[0];
576
+ }
577
+
578
+ async acirProofAsFieldsUltraHonk(proofBuf: Uint8Array): Promise<Fr[]> {
579
+ const inArgs = [proofBuf].map(serializeBufferable);
580
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
581
+ const result = await this.wasm.callWasmExport(
582
+ 'acir_proof_as_fields_ultra_honk',
583
+ inArgs,
584
+ outTypes.map(t => t.SIZE_IN_BYTES),
585
+ );
586
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
587
+ return out[0];
588
+ }
589
+
590
+ async acirVkAsFieldsUltraHonk(vkBuf: Uint8Array): Promise<Fr[]> {
591
+ const inArgs = [vkBuf].map(serializeBufferable);
592
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
593
+ const result = await this.wasm.callWasmExport(
594
+ 'acir_vk_as_fields_ultra_honk',
595
+ inArgs,
596
+ outTypes.map(t => t.SIZE_IN_BYTES),
597
+ );
598
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
599
+ return out[0];
600
+ }
601
+
602
+ async acirVkAsFieldsMegaHonk(vkBuf: Uint8Array): Promise<Fr[]> {
603
+ const inArgs = [vkBuf].map(serializeBufferable);
604
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
605
+ const result = await this.wasm.callWasmExport(
606
+ 'acir_vk_as_fields_mega_honk',
607
+ inArgs,
608
+ outTypes.map(t => t.SIZE_IN_BYTES),
609
+ );
610
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
611
+ return out[0];
612
+ }
613
+
614
+ async acirGatesAztecClient(ivcInputsBuf: Uint8Array): Promise<Uint8Array> {
615
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
616
+ const outTypes: OutputType[] = [BufferDeserializer()];
617
+ const result = await this.wasm.callWasmExport(
618
+ 'acir_gates_aztec_client',
619
+ inArgs,
620
+ outTypes.map(t => t.SIZE_IN_BYTES),
621
+ );
622
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
623
+ return out[0];
237
624
  }
238
625
  }
239
-
240
626
  export class BarretenbergApiSync {
241
- constructor(public binder: BarretenbergBinderSync) {}
242
-
243
- async destroy() {
244
- await this.binder.wasm.destroy();
245
- }
246
-
247
- pedersenInit(): void {
248
- const result = this.binder.callWasmExport('pedersen___init', [], []);
249
- return;
250
- }
251
-
252
- pedersenCompressFields(left: Fr, right: Fr): Fr {
253
- const result = this.binder.callWasmExport('pedersen___compress_fields', [left, right], [Fr]);
254
- return result[0];
255
- }
256
-
257
- pedersenPlookupCompressFields(left: Fr, right: Fr): Fr {
258
- const result = this.binder.callWasmExport('pedersen___plookup_compress_fields', [left, right], [Fr]);
259
- return result[0];
260
- }
261
-
262
- pedersenCompress(inputsBuffer: Fr[]): Fr {
263
- const result = this.binder.callWasmExport('pedersen___compress', [inputsBuffer], [Fr]);
264
- return result[0];
265
- }
266
-
267
- pedersenPlookupCompress(inputsBuffer: Fr[]): Fr {
268
- const result = this.binder.callWasmExport('pedersen___plookup_compress', [inputsBuffer], [Fr]);
269
- return result[0];
270
- }
271
-
272
- pedersenCompressWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Fr {
273
- const result = this.binder.callWasmExport('pedersen___compress_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
274
- return result[0];
275
- }
276
-
277
- pedersenCommit(inputsBuffer: Fr[]): Fr {
278
- const result = this.binder.callWasmExport('pedersen___commit', [inputsBuffer], [Fr]);
279
- return result[0];
280
- }
281
-
282
- pedersenPlookupCommit(inputsBuffer: Fr[]): Fr {
283
- const result = this.binder.callWasmExport('pedersen___plookup_commit', [inputsBuffer], [Fr]);
284
- return result[0];
285
- }
286
-
287
- pedersenPlookupCommitWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Fr {
288
- const result = this.binder.callWasmExport('pedersen___plookup_commit_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
289
- return result[0];
290
- }
291
-
292
- pedersenBufferToField(data: Uint8Array): Fr {
293
- const result = this.binder.callWasmExport('pedersen___buffer_to_field', [data], [Fr]);
294
- return result[0];
295
- }
296
-
297
- pedersenHashInit(): void {
298
- const result = this.binder.callWasmExport('pedersen_hash_init', [], []);
299
- return;
300
- }
301
-
302
- pedersenHashPair(left: Fr, right: Fr): Fr {
303
- const result = this.binder.callWasmExport('pedersen_hash_pair', [left, right], [Fr]);
304
- return result[0];
305
- }
306
-
307
- pedersenHashMultiple(inputsBuffer: Fr[]): Fr {
308
- const result = this.binder.callWasmExport('pedersen_hash_multiple', [inputsBuffer], [Fr]);
309
- return result[0];
310
- }
311
-
312
- pedersenHashMultipleWithHashIndex(inputsBuffer: Fr[], hashIndex: number): Fr {
313
- const result = this.binder.callWasmExport('pedersen_hash_multiple_with_hash_index', [inputsBuffer, hashIndex], [Fr]);
314
- return result[0];
315
- }
316
-
317
- pedersenHashToTree(data: Fr[]): Fr[] {
318
- const result = this.binder.callWasmExport('pedersen_hash_to_tree', [data], [VectorDeserializer(Fr)]);
319
- return result[0];
627
+ constructor(protected wasm: BarretenbergWasmMain) {}
628
+
629
+ pedersenCommit(inputsBuffer: Fr[], ctxIndex: number): Point {
630
+ const inArgs = [inputsBuffer, ctxIndex].map(serializeBufferable);
631
+ const outTypes: OutputType[] = [Point];
632
+ const result = this.wasm.callWasmExport(
633
+ 'pedersen_commit',
634
+ inArgs,
635
+ outTypes.map(t => t.SIZE_IN_BYTES),
636
+ );
637
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
638
+ return out[0];
639
+ }
640
+
641
+ pedersenHash(inputsBuffer: Fr[], hashIndex: number): Fr {
642
+ const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
643
+ const outTypes: OutputType[] = [Fr];
644
+ const result = this.wasm.callWasmExport(
645
+ 'pedersen_hash',
646
+ inArgs,
647
+ outTypes.map(t => t.SIZE_IN_BYTES),
648
+ );
649
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
650
+ return out[0];
651
+ }
652
+
653
+ pedersenHashes(inputsBuffer: Fr[], hashIndex: number): Fr {
654
+ const inArgs = [inputsBuffer, hashIndex].map(serializeBufferable);
655
+ const outTypes: OutputType[] = [Fr];
656
+ const result = this.wasm.callWasmExport(
657
+ 'pedersen_hashes',
658
+ inArgs,
659
+ outTypes.map(t => t.SIZE_IN_BYTES),
660
+ );
661
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
662
+ return out[0];
663
+ }
664
+
665
+ pedersenHashBuffer(inputBuffer: Uint8Array, hashIndex: number): Fr {
666
+ const inArgs = [inputBuffer, hashIndex].map(serializeBufferable);
667
+ const outTypes: OutputType[] = [Fr];
668
+ const result = this.wasm.callWasmExport(
669
+ 'pedersen_hash_buffer',
670
+ inArgs,
671
+ outTypes.map(t => t.SIZE_IN_BYTES),
672
+ );
673
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
674
+ return out[0];
675
+ }
676
+
677
+ poseidon2Hash(inputsBuffer: Fr[]): Fr {
678
+ const inArgs = [inputsBuffer].map(serializeBufferable);
679
+ const outTypes: OutputType[] = [Fr];
680
+ const result = this.wasm.callWasmExport(
681
+ 'poseidon2_hash',
682
+ inArgs,
683
+ outTypes.map(t => t.SIZE_IN_BYTES),
684
+ );
685
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
686
+ return out[0];
687
+ }
688
+
689
+ poseidon2Hashes(inputsBuffer: Fr[]): Fr {
690
+ const inArgs = [inputsBuffer].map(serializeBufferable);
691
+ const outTypes: OutputType[] = [Fr];
692
+ const result = this.wasm.callWasmExport(
693
+ 'poseidon2_hashes',
694
+ inArgs,
695
+ outTypes.map(t => t.SIZE_IN_BYTES),
696
+ );
697
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
698
+ return out[0];
699
+ }
700
+
701
+ poseidon2Permutation(inputsBuffer: Fr[]): Fr[] {
702
+ const inArgs = [inputsBuffer].map(serializeBufferable);
703
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
704
+ const result = this.wasm.callWasmExport(
705
+ 'poseidon2_permutation',
706
+ inArgs,
707
+ outTypes.map(t => t.SIZE_IN_BYTES),
708
+ );
709
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
710
+ return out[0];
711
+ }
712
+
713
+ poseidon2HashAccumulate(inputsBuffer: Fr[]): Fr {
714
+ const inArgs = [inputsBuffer].map(serializeBufferable);
715
+ const outTypes: OutputType[] = [Fr];
716
+ const result = this.wasm.callWasmExport(
717
+ 'poseidon2_hash_accumulate',
718
+ inArgs,
719
+ outTypes.map(t => t.SIZE_IN_BYTES),
720
+ );
721
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
722
+ return out[0];
320
723
  }
321
724
 
322
725
  blake2s(data: Uint8Array): Buffer32 {
323
- const result = this.binder.callWasmExport('blake2s', [data], [Buffer32]);
324
- return result[0];
726
+ const inArgs = [data].map(serializeBufferable);
727
+ const outTypes: OutputType[] = [Buffer32];
728
+ const result = this.wasm.callWasmExport(
729
+ 'blake2s',
730
+ inArgs,
731
+ outTypes.map(t => t.SIZE_IN_BYTES),
732
+ );
733
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
734
+ return out[0];
325
735
  }
326
736
 
327
737
  blake2sToField(data: Uint8Array): Fr {
328
- const result = this.binder.callWasmExport('blake2s_to_field_', [data], [Fr]);
329
- return result[0];
330
- }
331
-
332
- schnorrComputePublicKey(privateKey: Fr): Point {
333
- const result = this.binder.callWasmExport('schnorr_compute_public_key', [privateKey], [Point]);
334
- return result[0];
335
- }
336
-
337
- schnorrNegatePublicKey(publicKeyBuffer: Point): Point {
338
- const result = this.binder.callWasmExport('schnorr_negate_public_key', [publicKeyBuffer], [Point]);
339
- return result[0];
340
- }
341
-
342
- schnorrConstructSignature(message: Uint8Array, privateKey: Fr): [Buffer32, Buffer32] {
343
- const result = this.binder.callWasmExport('schnorr_construct_signature', [message, privateKey], [Buffer32, Buffer32]);
344
- return result as any;
345
- }
346
-
347
- schnorrVerifySignature(message: Uint8Array, pubKey: Point, sigS: Buffer32, sigE: Buffer32): boolean {
348
- const result = this.binder.callWasmExport('schnorr_verify_signature', [message, pubKey, sigS, sigE], [BoolDeserializer()]);
349
- return result[0];
350
- }
351
-
352
- schnorrMultisigCreateMultisigPublicKey(privateKey: Fq): Buffer128 {
353
- const result = this.binder.callWasmExport('schnorr_multisig_create_multisig_public_key', [privateKey], [Buffer128]);
354
- return result[0];
355
- }
356
-
357
- schnorrMultisigValidateAndCombineSignerPubkeys(signerPubkeyBuf: Buffer128[]): [Point, boolean] {
358
- const result = this.binder.callWasmExport('schnorr_multisig_validate_and_combine_signer_pubkeys', [signerPubkeyBuf], [Point, BoolDeserializer()]);
359
- return result as any;
360
- }
361
-
362
- schnorrMultisigConstructSignatureRound1(): [Buffer128, Buffer128] {
363
- const result = this.binder.callWasmExport('schnorr_multisig_construct_signature_round_1', [], [Buffer128, Buffer128]);
364
- return result as any;
365
- }
366
-
367
- schnorrMultisigConstructSignatureRound2(message: Uint8Array, privateKey: Fq, signerRoundOnePrivateBuf: Buffer128, signerPubkeysBuf: Buffer128[], roundOnePublicBuf: Buffer128[]): [Fq, boolean] {
368
- const result = this.binder.callWasmExport('schnorr_multisig_construct_signature_round_2', [message, privateKey, signerRoundOnePrivateBuf, signerPubkeysBuf, roundOnePublicBuf], [Fq, BoolDeserializer()]);
369
- return result as any;
370
- }
371
-
372
- schnorrMultisigCombineSignatures(message: Uint8Array, signerPubkeysBuf: Buffer128[], roundOneBuf: Buffer128[], roundTwoBuf: Fr[]): [Buffer32, Buffer32, boolean] {
373
- const result = this.binder.callWasmExport('schnorr_multisig_combine_signatures', [message, signerPubkeysBuf, roundOneBuf, roundTwoBuf], [Buffer32, Buffer32, BoolDeserializer()]);
374
- return result as any;
738
+ const inArgs = [data].map(serializeBufferable);
739
+ const outTypes: OutputType[] = [Fr];
740
+ const result = this.wasm.callWasmExport(
741
+ 'blake2s_to_field_',
742
+ inArgs,
743
+ outTypes.map(t => t.SIZE_IN_BYTES),
744
+ );
745
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
746
+ return out[0];
747
+ }
748
+
749
+ aesEncryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Uint8Array {
750
+ const inArgs = [input, iv, key, length].map(serializeBufferable);
751
+ const outTypes: OutputType[] = [BufferDeserializer()];
752
+ const result = this.wasm.callWasmExport(
753
+ 'aes_encrypt_buffer_cbc',
754
+ inArgs,
755
+ outTypes.map(t => t.SIZE_IN_BYTES),
756
+ );
757
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
758
+ return out[0];
759
+ }
760
+
761
+ aesDecryptBufferCbc(input: Uint8Array, iv: Uint8Array, key: Uint8Array, length: number): Uint8Array {
762
+ const inArgs = [input, iv, key, length].map(serializeBufferable);
763
+ const outTypes: OutputType[] = [BufferDeserializer()];
764
+ const result = this.wasm.callWasmExport(
765
+ 'aes_decrypt_buffer_cbc',
766
+ inArgs,
767
+ outTypes.map(t => t.SIZE_IN_BYTES),
768
+ );
769
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
770
+ return out[0];
375
771
  }
376
772
 
377
773
  srsInitSrs(pointsBuf: Uint8Array, numPoints: number, g2PointBuf: Uint8Array): void {
378
- const result = this.binder.callWasmExport('srs_init_srs', [pointsBuf, numPoints, g2PointBuf], []);
774
+ const inArgs = [pointsBuf, numPoints, g2PointBuf].map(serializeBufferable);
775
+ const outTypes: OutputType[] = [];
776
+ const result = this.wasm.callWasmExport(
777
+ 'srs_init_srs',
778
+ inArgs,
779
+ outTypes.map(t => t.SIZE_IN_BYTES),
780
+ );
781
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
379
782
  return;
380
783
  }
381
784
 
382
- examplesSimpleCreateAndVerifyProof(): boolean {
383
- const result = this.binder.callWasmExport('examples_simple_create_and_verify_proof', [], [BoolDeserializer()]);
384
- return result[0];
385
- }
386
-
387
- testThreads(threads: number, iterations: number): number {
388
- const result = this.binder.callWasmExport('test_threads', [threads, iterations], [NumberDeserializer()]);
389
- return result[0];
390
- }
391
-
392
- testThreadAbort(): void {
393
- const result = this.binder.callWasmExport('test_thread_abort', [], []);
785
+ srsInitGrumpkinSrs(pointsBuf: Uint8Array, numPoints: number): void {
786
+ const inArgs = [pointsBuf, numPoints].map(serializeBufferable);
787
+ const outTypes: OutputType[] = [];
788
+ const result = this.wasm.callWasmExport(
789
+ 'srs_init_grumpkin_srs',
790
+ inArgs,
791
+ outTypes.map(t => t.SIZE_IN_BYTES),
792
+ );
793
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
394
794
  return;
395
795
  }
396
796
 
397
- testAbort(): void {
398
- const result = this.binder.callWasmExport('test_abort', [], []);
399
- return;
797
+ testThreads(threads: number, iterations: number): number {
798
+ const inArgs = [threads, iterations].map(serializeBufferable);
799
+ const outTypes: OutputType[] = [NumberDeserializer()];
800
+ const result = this.wasm.callWasmExport(
801
+ 'test_threads',
802
+ inArgs,
803
+ outTypes.map(t => t.SIZE_IN_BYTES),
804
+ );
805
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
806
+ return out[0];
400
807
  }
401
808
 
402
809
  commonInitSlabAllocator(circuitSize: number): void {
403
- const result = this.binder.callWasmExport('common_init_slab_allocator', [circuitSize], []);
404
- return;
405
- }
406
-
407
- acirGetCircuitSizes(constraintSystemBuf: Uint8Array): [number, number, number] {
408
- const result = this.binder.callWasmExport('acir_get_circuit_sizes', [constraintSystemBuf], [NumberDeserializer(), NumberDeserializer(), NumberDeserializer()]);
409
- return result as any;
410
- }
411
-
412
- acirNewAcirComposer(sizeHint: number): Ptr {
413
- const result = this.binder.callWasmExport('acir_new_acir_composer', [sizeHint], [Ptr]);
414
- return result[0];
415
- }
416
-
417
- acirDeleteAcirComposer(acirComposerPtr: Ptr): void {
418
- const result = this.binder.callWasmExport('acir_delete_acir_composer', [acirComposerPtr], []);
810
+ const inArgs = [circuitSize].map(serializeBufferable);
811
+ const outTypes: OutputType[] = [];
812
+ const result = this.wasm.callWasmExport(
813
+ 'common_init_slab_allocator',
814
+ inArgs,
815
+ outTypes.map(t => t.SIZE_IN_BYTES),
816
+ );
817
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
419
818
  return;
420
819
  }
421
820
 
422
- acirCreateCircuit(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, sizeHint: number): void {
423
- const result = this.binder.callWasmExport('acir_create_circuit', [acirComposerPtr, constraintSystemBuf, sizeHint], []);
424
- return;
425
- }
426
-
427
- acirInitProvingKey(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array): void {
428
- const result = this.binder.callWasmExport('acir_init_proving_key', [acirComposerPtr, constraintSystemBuf], []);
429
- return;
430
- }
431
-
432
- acirCreateProof(acirComposerPtr: Ptr, constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array, isRecursive: boolean): Uint8Array {
433
- const result = this.binder.callWasmExport('acir_create_proof', [acirComposerPtr, constraintSystemBuf, witnessBuf, isRecursive], [BufferDeserializer()]);
434
- return result[0];
821
+ acirGetCircuitSizes(constraintSystemBuf: Uint8Array, recursive: boolean, honkRecursion: boolean): [number, number] {
822
+ const inArgs = [constraintSystemBuf, recursive, honkRecursion].map(serializeBufferable);
823
+ const outTypes: OutputType[] = [NumberDeserializer(), NumberDeserializer()];
824
+ const result = this.wasm.callWasmExport(
825
+ 'acir_get_circuit_sizes',
826
+ inArgs,
827
+ outTypes.map(t => t.SIZE_IN_BYTES),
828
+ );
829
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
830
+ return out as any;
831
+ }
832
+
833
+ acirProveAndVerifyUltraHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): boolean {
834
+ const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
835
+ const outTypes: OutputType[] = [BoolDeserializer()];
836
+ const result = this.wasm.callWasmExport(
837
+ 'acir_prove_and_verify_ultra_honk',
838
+ inArgs,
839
+ outTypes.map(t => t.SIZE_IN_BYTES),
840
+ );
841
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
842
+ return out[0];
843
+ }
844
+
845
+ acirProveAndVerifyMegaHonk(constraintSystemBuf: Uint8Array, witnessBuf: Uint8Array): boolean {
846
+ const inArgs = [constraintSystemBuf, witnessBuf].map(serializeBufferable);
847
+ const outTypes: OutputType[] = [BoolDeserializer()];
848
+ const result = this.wasm.callWasmExport(
849
+ 'acir_prove_and_verify_mega_honk',
850
+ inArgs,
851
+ outTypes.map(t => t.SIZE_IN_BYTES),
852
+ );
853
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
854
+ return out[0];
855
+ }
856
+
857
+ acirProveAztecClient(ivcInputsBuf: Uint8Array): [Uint8Array, Uint8Array] {
858
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
859
+ const outTypes: OutputType[] = [BufferDeserializer(), BufferDeserializer()];
860
+ const result = this.wasm.callWasmExport(
861
+ 'acir_prove_aztec_client',
862
+ inArgs,
863
+ outTypes.map(t => t.SIZE_IN_BYTES),
864
+ );
865
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
866
+ return out as any;
867
+ }
868
+
869
+ acirVerifyAztecClient(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
870
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
871
+ const outTypes: OutputType[] = [BoolDeserializer()];
872
+ const result = this.wasm.callWasmExport(
873
+ 'acir_verify_aztec_client',
874
+ inArgs,
875
+ outTypes.map(t => t.SIZE_IN_BYTES),
876
+ );
877
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
878
+ return out[0];
435
879
  }
436
880
 
437
881
  acirLoadVerificationKey(acirComposerPtr: Ptr, vkBuf: Uint8Array): void {
438
- const result = this.binder.callWasmExport('acir_load_verification_key', [acirComposerPtr, vkBuf], []);
882
+ const inArgs = [acirComposerPtr, vkBuf].map(serializeBufferable);
883
+ const outTypes: OutputType[] = [];
884
+ const result = this.wasm.callWasmExport(
885
+ 'acir_load_verification_key',
886
+ inArgs,
887
+ outTypes.map(t => t.SIZE_IN_BYTES),
888
+ );
889
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
439
890
  return;
440
891
  }
441
892
 
442
893
  acirInitVerificationKey(acirComposerPtr: Ptr): void {
443
- const result = this.binder.callWasmExport('acir_init_verification_key', [acirComposerPtr], []);
894
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
895
+ const outTypes: OutputType[] = [];
896
+ const result = this.wasm.callWasmExport(
897
+ 'acir_init_verification_key',
898
+ inArgs,
899
+ outTypes.map(t => t.SIZE_IN_BYTES),
900
+ );
901
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
444
902
  return;
445
903
  }
446
904
 
447
905
  acirGetVerificationKey(acirComposerPtr: Ptr): Uint8Array {
448
- const result = this.binder.callWasmExport('acir_get_verification_key', [acirComposerPtr], [BufferDeserializer()]);
449
- return result[0];
450
- }
451
-
452
- acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array, isRecursive: boolean): boolean {
453
- const result = this.binder.callWasmExport('acir_verify_proof', [acirComposerPtr, proofBuf, isRecursive], [BoolDeserializer()]);
454
- return result[0];
906
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
907
+ const outTypes: OutputType[] = [BufferDeserializer()];
908
+ const result = this.wasm.callWasmExport(
909
+ 'acir_get_verification_key',
910
+ inArgs,
911
+ outTypes.map(t => t.SIZE_IN_BYTES),
912
+ );
913
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
914
+ return out[0];
915
+ }
916
+
917
+ acirGetProvingKey(acirComposerPtr: Ptr, acirVec: Uint8Array, recursive: boolean): Uint8Array {
918
+ const inArgs = [acirComposerPtr, acirVec, recursive].map(serializeBufferable);
919
+ const outTypes: OutputType[] = [BufferDeserializer()];
920
+ const result = this.wasm.callWasmExport(
921
+ 'acir_get_proving_key',
922
+ inArgs,
923
+ outTypes.map(t => t.SIZE_IN_BYTES),
924
+ );
925
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
926
+ return out[0];
927
+ }
928
+
929
+ acirVerifyProof(acirComposerPtr: Ptr, proofBuf: Uint8Array): boolean {
930
+ const inArgs = [acirComposerPtr, proofBuf].map(serializeBufferable);
931
+ const outTypes: OutputType[] = [BoolDeserializer()];
932
+ const result = this.wasm.callWasmExport(
933
+ 'acir_verify_proof',
934
+ inArgs,
935
+ outTypes.map(t => t.SIZE_IN_BYTES),
936
+ );
937
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
938
+ return out[0];
455
939
  }
456
940
 
457
941
  acirGetSolidityVerifier(acirComposerPtr: Ptr): string {
458
- const result = this.binder.callWasmExport('acir_get_solidity_verifier', [acirComposerPtr], [StringDeserializer()]);
459
- return result[0];
942
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
943
+ const outTypes: OutputType[] = [StringDeserializer()];
944
+ const result = this.wasm.callWasmExport(
945
+ 'acir_get_solidity_verifier',
946
+ inArgs,
947
+ outTypes.map(t => t.SIZE_IN_BYTES),
948
+ );
949
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
950
+ return out[0];
951
+ }
952
+
953
+ acirHonkSolidityVerifier(proofBuf: Uint8Array, vkBuf: Uint8Array): string {
954
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
955
+ const outTypes: OutputType[] = [StringDeserializer()];
956
+ const result = this.wasm.callWasmExport(
957
+ 'acir_honk_solidity_verifier',
958
+ inArgs,
959
+ outTypes.map(t => t.SIZE_IN_BYTES),
960
+ );
961
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
962
+ return out[0];
460
963
  }
461
964
 
462
965
  acirSerializeProofIntoFields(acirComposerPtr: Ptr, proofBuf: Uint8Array, numInnerPublicInputs: number): Fr[] {
463
- const result = this.binder.callWasmExport('acir_serialize_proof_into_fields', [acirComposerPtr, proofBuf, numInnerPublicInputs], [VectorDeserializer(Fr)]);
464
- return result[0];
966
+ const inArgs = [acirComposerPtr, proofBuf, numInnerPublicInputs].map(serializeBufferable);
967
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
968
+ const result = this.wasm.callWasmExport(
969
+ 'acir_serialize_proof_into_fields',
970
+ inArgs,
971
+ outTypes.map(t => t.SIZE_IN_BYTES),
972
+ );
973
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
974
+ return out[0];
465
975
  }
466
976
 
467
977
  acirSerializeVerificationKeyIntoFields(acirComposerPtr: Ptr): [Fr[], Fr] {
468
- const result = this.binder.callWasmExport('acir_serialize_verification_key_into_fields', [acirComposerPtr], [VectorDeserializer(Fr), Fr]);
469
- return result as any;
978
+ const inArgs = [acirComposerPtr].map(serializeBufferable);
979
+ const outTypes: OutputType[] = [VectorDeserializer(Fr), Fr];
980
+ const result = this.wasm.callWasmExport(
981
+ 'acir_serialize_verification_key_into_fields',
982
+ inArgs,
983
+ outTypes.map(t => t.SIZE_IN_BYTES),
984
+ );
985
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
986
+ return out as any;
987
+ }
988
+
989
+ acirProveUltraHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
990
+ const inArgs = [acirVec, witnessVec].map(serializeBufferable);
991
+ const outTypes: OutputType[] = [BufferDeserializer()];
992
+ const result = this.wasm.callWasmExport(
993
+ 'acir_prove_ultra_honk',
994
+ inArgs,
995
+ outTypes.map(t => t.SIZE_IN_BYTES),
996
+ );
997
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
998
+ return out[0];
999
+ }
1000
+
1001
+ acirProveUltraKeccakHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
1002
+ const inArgs = [acirVec, witnessVec].map(serializeBufferable);
1003
+ const outTypes: OutputType[] = [BufferDeserializer()];
1004
+ const result = this.wasm.callWasmExport(
1005
+ 'acir_prove_ultra_keccak_honk',
1006
+ inArgs,
1007
+ outTypes.map(t => t.SIZE_IN_BYTES),
1008
+ );
1009
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1010
+ return out[0];
1011
+ }
1012
+
1013
+ acirProveUltraKeccakZkHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
1014
+ const inArgs = [acirVec, witnessVec].map(serializeBufferable);
1015
+ const outTypes: OutputType[] = [BufferDeserializer()];
1016
+ const result = this.wasm.callWasmExport(
1017
+ 'acir_prove_ultra_keccak_zk_honk',
1018
+ inArgs,
1019
+ outTypes.map(t => t.SIZE_IN_BYTES),
1020
+ );
1021
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1022
+ return out[0];
1023
+ }
1024
+
1025
+ acirProveUltraStarknetHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
1026
+ const inArgs = [acirVec, witnessVec].map(serializeBufferable);
1027
+ const outTypes: OutputType[] = [BufferDeserializer()];
1028
+ const result = this.wasm.callWasmExport(
1029
+ 'acir_prove_ultra_starknet_honk',
1030
+ inArgs,
1031
+ outTypes.map(t => t.SIZE_IN_BYTES),
1032
+ );
1033
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1034
+ return out[0];
1035
+ }
1036
+
1037
+ acirProveUltraStarknetZkHonk(acirVec: Uint8Array, witnessVec: Uint8Array): Uint8Array {
1038
+ const inArgs = [acirVec, witnessVec].map(serializeBufferable);
1039
+ const outTypes: OutputType[] = [BufferDeserializer()];
1040
+ const result = this.wasm.callWasmExport(
1041
+ 'acir_prove_ultra_starknet_zk_honk',
1042
+ inArgs,
1043
+ outTypes.map(t => t.SIZE_IN_BYTES),
1044
+ );
1045
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1046
+ return out[0];
1047
+ }
1048
+
1049
+ acirVerifyUltraHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1050
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1051
+ const outTypes: OutputType[] = [BoolDeserializer()];
1052
+ const result = this.wasm.callWasmExport(
1053
+ 'acir_verify_ultra_honk',
1054
+ inArgs,
1055
+ outTypes.map(t => t.SIZE_IN_BYTES),
1056
+ );
1057
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1058
+ return out[0];
1059
+ }
1060
+
1061
+ acirVerifyUltraKeccakHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1062
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1063
+ const outTypes: OutputType[] = [BoolDeserializer()];
1064
+ const result = this.wasm.callWasmExport(
1065
+ 'acir_verify_ultra_keccak_honk',
1066
+ inArgs,
1067
+ outTypes.map(t => t.SIZE_IN_BYTES),
1068
+ );
1069
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1070
+ return out[0];
1071
+ }
1072
+
1073
+ acirVerifyUltraKeccakZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1074
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1075
+ const outTypes: OutputType[] = [BoolDeserializer()];
1076
+ const result = this.wasm.callWasmExport(
1077
+ 'acir_verify_ultra_keccak_zk_honk',
1078
+ inArgs,
1079
+ outTypes.map(t => t.SIZE_IN_BYTES),
1080
+ );
1081
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1082
+ return out[0];
1083
+ }
1084
+
1085
+ acirVerifyUltraStarknetHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1086
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1087
+ const outTypes: OutputType[] = [BoolDeserializer()];
1088
+ const result = this.wasm.callWasmExport(
1089
+ 'acir_verify_ultra_starknet_honk',
1090
+ inArgs,
1091
+ outTypes.map(t => t.SIZE_IN_BYTES),
1092
+ );
1093
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1094
+ return out[0];
1095
+ }
1096
+
1097
+ acirVerifyUltraStarknetZkHonk(proofBuf: Uint8Array, vkBuf: Uint8Array): boolean {
1098
+ const inArgs = [proofBuf, vkBuf].map(serializeBufferable);
1099
+ const outTypes: OutputType[] = [BoolDeserializer()];
1100
+ const result = this.wasm.callWasmExport(
1101
+ 'acir_verify_ultra_starknet_zk_honk',
1102
+ inArgs,
1103
+ outTypes.map(t => t.SIZE_IN_BYTES),
1104
+ );
1105
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1106
+ return out[0];
1107
+ }
1108
+
1109
+ acirWriteVkUltraHonk(acirVec: Uint8Array): Uint8Array {
1110
+ const inArgs = [acirVec].map(serializeBufferable);
1111
+ const outTypes: OutputType[] = [BufferDeserializer()];
1112
+ const result = this.wasm.callWasmExport(
1113
+ 'acir_write_vk_ultra_honk',
1114
+ inArgs,
1115
+ outTypes.map(t => t.SIZE_IN_BYTES),
1116
+ );
1117
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1118
+ return out[0];
1119
+ }
1120
+
1121
+ acirWriteVkUltraKeccakHonk(acirVec: Uint8Array): Uint8Array {
1122
+ const inArgs = [acirVec].map(serializeBufferable);
1123
+ const outTypes: OutputType[] = [BufferDeserializer()];
1124
+ const result = this.wasm.callWasmExport(
1125
+ 'acir_write_vk_ultra_keccak_honk',
1126
+ inArgs,
1127
+ outTypes.map(t => t.SIZE_IN_BYTES),
1128
+ );
1129
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1130
+ return out[0];
1131
+ }
1132
+
1133
+ acirWriteVkUltraKeccakZkHonk(acirVec: Uint8Array): Uint8Array {
1134
+ const inArgs = [acirVec].map(serializeBufferable);
1135
+ const outTypes: OutputType[] = [BufferDeserializer()];
1136
+ const result = this.wasm.callWasmExport(
1137
+ 'acir_write_vk_ultra_keccak_zk_honk',
1138
+ inArgs,
1139
+ outTypes.map(t => t.SIZE_IN_BYTES),
1140
+ );
1141
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1142
+ return out[0];
1143
+ }
1144
+
1145
+ acirWriteVkUltraStarknetHonk(acirVec: Uint8Array): Uint8Array {
1146
+ const inArgs = [acirVec].map(serializeBufferable);
1147
+ const outTypes: OutputType[] = [BufferDeserializer()];
1148
+ const result = this.wasm.callWasmExport(
1149
+ 'acir_write_vk_ultra_starknet_honk',
1150
+ inArgs,
1151
+ outTypes.map(t => t.SIZE_IN_BYTES),
1152
+ );
1153
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1154
+ return out[0];
1155
+ }
1156
+
1157
+ acirWriteVkUltraStarknetZkHonk(acirVec: Uint8Array): Uint8Array {
1158
+ const inArgs = [acirVec].map(serializeBufferable);
1159
+ const outTypes: OutputType[] = [BufferDeserializer()];
1160
+ const result = this.wasm.callWasmExport(
1161
+ 'acir_write_vk_ultra_starknet_zk_honk',
1162
+ inArgs,
1163
+ outTypes.map(t => t.SIZE_IN_BYTES),
1164
+ );
1165
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1166
+ return out[0];
1167
+ }
1168
+
1169
+ acirProofAsFieldsUltraHonk(proofBuf: Uint8Array): Fr[] {
1170
+ const inArgs = [proofBuf].map(serializeBufferable);
1171
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
1172
+ const result = this.wasm.callWasmExport(
1173
+ 'acir_proof_as_fields_ultra_honk',
1174
+ inArgs,
1175
+ outTypes.map(t => t.SIZE_IN_BYTES),
1176
+ );
1177
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1178
+ return out[0];
1179
+ }
1180
+
1181
+ acirVkAsFieldsUltraHonk(vkBuf: Uint8Array): Fr[] {
1182
+ const inArgs = [vkBuf].map(serializeBufferable);
1183
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
1184
+ const result = this.wasm.callWasmExport(
1185
+ 'acir_vk_as_fields_ultra_honk',
1186
+ inArgs,
1187
+ outTypes.map(t => t.SIZE_IN_BYTES),
1188
+ );
1189
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1190
+ return out[0];
1191
+ }
1192
+
1193
+ acirVkAsFieldsMegaHonk(vkBuf: Uint8Array): Fr[] {
1194
+ const inArgs = [vkBuf].map(serializeBufferable);
1195
+ const outTypes: OutputType[] = [VectorDeserializer(Fr)];
1196
+ const result = this.wasm.callWasmExport(
1197
+ 'acir_vk_as_fields_mega_honk',
1198
+ inArgs,
1199
+ outTypes.map(t => t.SIZE_IN_BYTES),
1200
+ );
1201
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1202
+ return out[0];
1203
+ }
1204
+
1205
+ acirGatesAztecClient(ivcInputsBuf: Uint8Array): Uint8Array {
1206
+ const inArgs = [ivcInputsBuf].map(serializeBufferable);
1207
+ const outTypes: OutputType[] = [BufferDeserializer()];
1208
+ const result = this.wasm.callWasmExport(
1209
+ 'acir_gates_aztec_client',
1210
+ inArgs,
1211
+ outTypes.map(t => t.SIZE_IN_BYTES),
1212
+ );
1213
+ const out = result.map((r, i) => outTypes[i].fromBuffer(r));
1214
+ return out[0];
470
1215
  }
471
1216
  }