@provablehq/wasm 0.9.5 → 0.9.6

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.
@@ -291,7 +291,7 @@ function __wbg_adapter_43(arg0, arg1, arg2) {
291
291
  wasm.__wbindgen_export_7(arg0, arg1, addHeapObject(arg2));
292
292
  }
293
293
 
294
- function __wbg_adapter_851(arg0, arg1, arg2, arg3) {
294
+ function __wbg_adapter_853(arg0, arg1, arg2, arg3) {
295
295
  wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
296
296
  }
297
297
 
@@ -2629,10 +2629,11 @@ class ExecutionRequest {
2629
2629
  * @param {Array<any>} inputs
2630
2630
  * @param {Array<any>} input_types
2631
2631
  * @param {Field | null | undefined} root_tvk
2632
+ * @param {Field | null | undefined} program_checksum
2632
2633
  * @param {boolean} is_root
2633
2634
  * @returns {ExecutionRequest}
2634
2635
  */
2635
- static sign(private_key, program_id, function_name, inputs, input_types, root_tvk, is_root) {
2636
+ static sign(private_key, program_id, function_name, inputs, input_types, root_tvk, program_checksum, is_root) {
2636
2637
  try {
2637
2638
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2638
2639
  _assertClass(private_key, PrivateKey);
@@ -2646,7 +2647,12 @@ class ExecutionRequest {
2646
2647
  _assertClass(root_tvk, Field);
2647
2648
  ptr3 = root_tvk.__destroy_into_raw();
2648
2649
  }
2649
- wasm.executionrequest_sign(retptr, ptr0, ptr1, len1, ptr2, len2, addHeapObject(inputs), addHeapObject(input_types), ptr3, is_root);
2650
+ let ptr4 = 0;
2651
+ if (!isLikeNone(program_checksum)) {
2652
+ _assertClass(program_checksum, Field);
2653
+ ptr4 = program_checksum.__destroy_into_raw();
2654
+ }
2655
+ wasm.executionrequest_sign(retptr, ptr0, ptr1, len1, ptr2, len2, addHeapObject(inputs), addHeapObject(input_types), ptr3, ptr4, is_root);
2650
2656
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2651
2657
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2652
2658
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -2665,10 +2671,16 @@ class ExecutionRequest {
2665
2671
  * @param {boolean} Flag to indicate whether this request is the first function in the call graph.
2666
2672
  * @param {Array<any>} input_types
2667
2673
  * @param {boolean} is_root
2674
+ * @param {Field | null} [program_checksum]
2668
2675
  * @returns {boolean}
2669
2676
  */
2670
- verify(input_types, is_root) {
2671
- const ret = wasm.executionrequest_verify(this.__wbg_ptr, addHeapObject(input_types), is_root);
2677
+ verify(input_types, is_root, program_checksum) {
2678
+ let ptr0 = 0;
2679
+ if (!isLikeNone(program_checksum)) {
2680
+ _assertClass(program_checksum, Field);
2681
+ ptr0 = program_checksum.__destroy_into_raw();
2682
+ }
2683
+ const ret = wasm.executionrequest_verify(this.__wbg_ptr, addHeapObject(input_types), is_root, ptr0);
2672
2684
  return ret !== 0;
2673
2685
  }
2674
2686
  }
@@ -7335,15 +7347,16 @@ class ProgramManager {
7335
7347
  * @param {string} function_name
7336
7348
  * @param {Array<any>} inputs
7337
7349
  * @param {object | null} [imports]
7350
+ * @param {number | null} [edition]
7338
7351
  * @returns {Promise<Authorization>}
7339
7352
  */
7340
- static authorize(private_key, program, function_name, inputs, imports) {
7353
+ static authorize(private_key, program, function_name, inputs, imports, edition) {
7341
7354
  _assertClass(private_key, PrivateKey);
7342
7355
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7343
7356
  const len0 = WASM_VECTOR_LEN;
7344
7357
  const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7345
7358
  const len1 = WASM_VECTOR_LEN;
7346
- const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
7359
+ const ret = wasm.programmanager_authorize(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
7347
7360
  return takeObject(ret);
7348
7361
  }
7349
7362
  /**
@@ -7360,15 +7373,16 @@ class ProgramManager {
7360
7373
  * @param {string} function_name
7361
7374
  * @param {Array<any>} inputs
7362
7375
  * @param {object | null} [imports]
7376
+ * @param {number | null} [edition]
7363
7377
  * @returns {Promise<Authorization>}
7364
7378
  */
7365
- static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports) {
7379
+ static buildAuthorizationUnchecked(private_key, program, function_name, inputs, imports, edition) {
7366
7380
  _assertClass(private_key, PrivateKey);
7367
7381
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7368
7382
  const len0 = WASM_VECTOR_LEN;
7369
7383
  const ptr1 = passStringToWasm0(function_name, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7370
7384
  const len1 = WASM_VECTOR_LEN;
7371
- const ret = wasm.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
7385
+ const ret = wasm.programmanager_buildAuthorizationUnchecked(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
7372
7386
  return takeObject(ret);
7373
7387
  }
7374
7388
  /**
@@ -7538,9 +7552,10 @@ class ProgramManager {
7538
7552
  * @param {VerifyingKey | null} [verifying_key]
7539
7553
  * @param {string | null} [url]
7540
7554
  * @param {OfflineQuery | null} [offline_query]
7555
+ * @param {number | null} [edition]
7541
7556
  * @returns {Promise<ExecutionResponse>}
7542
7557
  */
7543
- static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, offline_query) {
7558
+ static executeFunctionOffline(private_key, program, _function, inputs, prove_execution, cache, imports, proving_key, verifying_key, url, offline_query, edition) {
7544
7559
  _assertClass(private_key, PrivateKey);
7545
7560
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7546
7561
  const len0 = WASM_VECTOR_LEN;
@@ -7563,7 +7578,7 @@ class ProgramManager {
7563
7578
  _assertClass(offline_query, OfflineQuery);
7564
7579
  ptr5 = offline_query.__destroy_into_raw();
7565
7580
  }
7566
- const ret = wasm.programmanager_executeFunctionOffline(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), prove_execution, cache, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr2, ptr3, ptr4, len4, ptr5);
7581
+ const ret = wasm.programmanager_executeFunctionOffline(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), prove_execution, cache, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr2, ptr3, ptr4, len4, ptr5, isLikeNone(edition) ? 0xFFFFFF : edition);
7567
7582
  return takeObject(ret);
7568
7583
  }
7569
7584
  /**
@@ -7587,6 +7602,8 @@ class ProgramManager {
7587
7602
  * @param verifying_key (optional) Provide a verifying key to use for the function execution
7588
7603
  * @param fee_proving_key (optional) Provide a proving key to use for the fee execution
7589
7604
  * @param fee_verifying_key (optional) Provide a verifying key to use for the fee execution
7605
+ * @param offline_query An offline query object to use if building a transaction without an internet connection.
7606
+ * @param edition The edition of the program to execute. Defaults to the latest found on the network, or 1 if the program does not exist on the network.
7590
7607
  * @returns {Transaction}
7591
7608
  * @param {PrivateKey} private_key
7592
7609
  * @param {string} program
@@ -7601,9 +7618,10 @@ class ProgramManager {
7601
7618
  * @param {ProvingKey | null} [fee_proving_key]
7602
7619
  * @param {VerifyingKey | null} [fee_verifying_key]
7603
7620
  * @param {OfflineQuery | null} [offline_query]
7621
+ * @param {number | null} [edition]
7604
7622
  * @returns {Promise<Transaction>}
7605
7623
  */
7606
- static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, offline_query) {
7624
+ static buildExecutionTransaction(private_key, program, _function, inputs, priority_fee_credits, fee_record, url, imports, proving_key, verifying_key, fee_proving_key, fee_verifying_key, offline_query, edition) {
7607
7625
  _assertClass(private_key, PrivateKey);
7608
7626
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7609
7627
  const len0 = WASM_VECTOR_LEN;
@@ -7641,7 +7659,7 @@ class ProgramManager {
7641
7659
  _assertClass(offline_query, OfflineQuery);
7642
7660
  ptr8 = offline_query.__destroy_into_raw();
7643
7661
  }
7644
- const ret = wasm.programmanager_buildExecutionTransaction(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), priority_fee_credits, ptr2, ptr3, len3, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr4, ptr5, ptr6, ptr7, ptr8);
7662
+ const ret = wasm.programmanager_buildExecutionTransaction(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), priority_fee_credits, ptr2, ptr3, len3, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr4, ptr5, ptr6, ptr7, ptr8, isLikeNone(edition) ? 0xFFFFFF : edition);
7645
7663
  return takeObject(ret);
7646
7664
  }
7647
7665
  /**
@@ -7671,9 +7689,10 @@ class ProgramManager {
7671
7689
  * @param {ProvingKey | null} [proving_key]
7672
7690
  * @param {VerifyingKey | null} [verifying_key]
7673
7691
  * @param {OfflineQuery | null} [offline_query]
7692
+ * @param {number | null} [edition]
7674
7693
  * @returns {Promise<bigint>}
7675
7694
  */
7676
- static estimateExecutionFee(private_key, program, _function, inputs, url, imports, proving_key, verifying_key, offline_query) {
7695
+ static estimateExecutionFee(private_key, program, _function, inputs, url, imports, proving_key, verifying_key, offline_query, edition) {
7677
7696
  _assertClass(private_key, PrivateKey);
7678
7697
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7679
7698
  const len0 = WASM_VECTOR_LEN;
@@ -7696,7 +7715,7 @@ class ProgramManager {
7696
7715
  _assertClass(offline_query, OfflineQuery);
7697
7716
  ptr5 = offline_query.__destroy_into_raw();
7698
7717
  }
7699
- const ret = wasm.programmanager_estimateExecutionFee(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5);
7718
+ const ret = wasm.programmanager_estimateExecutionFee(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), ptr2, len2, isLikeNone(imports) ? 0 : addHeapObject(imports), ptr3, ptr4, ptr5, isLikeNone(edition) ? 0xFFFFFF : edition);
7700
7719
  return takeObject(ret);
7701
7720
  }
7702
7721
  /**
@@ -7827,9 +7846,10 @@ class ProgramManager {
7827
7846
  * @param {object | null | undefined} imports
7828
7847
  * @param {boolean} broadcast
7829
7848
  * @param {boolean} unchecked
7849
+ * @param {number | null} [edition]
7830
7850
  * @returns {Promise<ProvingRequest>}
7831
7851
  */
7832
- static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked) {
7852
+ static buildProvingRequest(private_key, program, function_name, inputs, base_fee_credits, priority_fee_credits, fee_record, imports, broadcast, unchecked, edition) {
7833
7853
  _assertClass(private_key, PrivateKey);
7834
7854
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7835
7855
  const len0 = WASM_VECTOR_LEN;
@@ -7840,7 +7860,7 @@ class ProgramManager {
7840
7860
  _assertClass(fee_record, RecordPlaintext);
7841
7861
  ptr2 = fee_record.__destroy_into_raw();
7842
7862
  }
7843
- const ret = wasm.programmanager_buildProvingRequest(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), base_fee_credits, priority_fee_credits, ptr2, isLikeNone(imports) ? 0 : addHeapObject(imports), broadcast, unchecked);
7863
+ const ret = wasm.programmanager_buildProvingRequest(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), base_fee_credits, priority_fee_credits, ptr2, isLikeNone(imports) ? 0 : addHeapObject(imports), broadcast, unchecked, isLikeNone(edition) ? 0xFFFFFF : edition);
7844
7864
  return takeObject(ret);
7845
7865
  }
7846
7866
  /**
@@ -7976,15 +7996,16 @@ class ProgramManager {
7976
7996
  * @param {string} function_id
7977
7997
  * @param {Array<any>} inputs
7978
7998
  * @param {object | null} [imports]
7999
+ * @param {number | null} [edition]
7979
8000
  * @returns {Promise<KeyPair>}
7980
8001
  */
7981
- static synthesizeKeyPair(private_key, program, function_id, inputs, imports) {
8002
+ static synthesizeKeyPair(private_key, program, function_id, inputs, imports, edition) {
7982
8003
  _assertClass(private_key, PrivateKey);
7983
8004
  const ptr0 = passStringToWasm0(program, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7984
8005
  const len0 = WASM_VECTOR_LEN;
7985
8006
  const ptr1 = passStringToWasm0(function_id, wasm.__wbindgen_export_3, wasm.__wbindgen_export_4);
7986
8007
  const len1 = WASM_VECTOR_LEN;
7987
- const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports));
8008
+ const ret = wasm.programmanager_synthesizeKeyPair(private_key.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(inputs), isLikeNone(imports) ? 0 : addHeapObject(imports), isLikeNone(edition) ? 0xFFFFFF : edition);
7988
8009
  return takeObject(ret);
7989
8010
  }
7990
8011
  }
@@ -9377,6 +9398,25 @@ class Scalar {
9377
9398
  const ret = wasm.scalar_toPlaintext(this.__wbg_ptr);
9378
9399
  return Plaintext.__wrap(ret);
9379
9400
  }
9401
+ /**
9402
+ * Cast the scalar element to a field element.
9403
+ * @returns {Field}
9404
+ */
9405
+ toField() {
9406
+ try {
9407
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
9408
+ wasm.scalar_toField(retptr, this.__wbg_ptr);
9409
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
9410
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
9411
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
9412
+ if (r2) {
9413
+ throw takeObject(r1);
9414
+ }
9415
+ return Field.__wrap(r0);
9416
+ } finally {
9417
+ wasm.__wbindgen_add_to_stack_pointer(16);
9418
+ }
9419
+ }
9380
9420
  /**
9381
9421
  * Clone the scalar element.
9382
9422
  * @returns {Scalar}
@@ -12583,6 +12623,25 @@ class ViewKey {
12583
12623
  const ret = wasm.field_clone(this.__wbg_ptr);
12584
12624
  return Scalar.__wrap(ret);
12585
12625
  }
12626
+ /**
12627
+ * Cast the view key to a field.
12628
+ * @returns {Field}
12629
+ */
12630
+ toField() {
12631
+ try {
12632
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
12633
+ wasm.scalar_toField(retptr, this.__wbg_ptr);
12634
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
12635
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
12636
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
12637
+ if (r2) {
12638
+ throw takeObject(r1);
12639
+ }
12640
+ return Field.__wrap(r0);
12641
+ } finally {
12642
+ wasm.__wbindgen_add_to_stack_pointer(16);
12643
+ }
12644
+ }
12586
12645
  /**
12587
12646
  * Decrypt a record ciphertext with a view key
12588
12647
  *
@@ -12733,6 +12792,10 @@ function __wbg_get_imports() {
12733
12792
  const ret = fetch(getObject(arg0));
12734
12793
  return addHeapObject(ret);
12735
12794
  };
12795
+ imports.wbg.__wbg_fetch_f1856afdb49415d1 = function(arg0) {
12796
+ const ret = fetch(getObject(arg0));
12797
+ return addHeapObject(ret);
12798
+ };
12736
12799
  imports.wbg.__wbg_field_new = function(arg0) {
12737
12800
  const ret = Field.__wrap(arg0);
12738
12801
  return addHeapObject(ret);
@@ -12794,7 +12857,7 @@ function __wbg_get_imports() {
12794
12857
  const ret = getObject(arg0).length;
12795
12858
  return ret;
12796
12859
  };
12797
- imports.wbg.__wbg_log_a64934b81f0f0386 = function(arg0, arg1) {
12860
+ imports.wbg.__wbg_log_d77c7cb22d553166 = function(arg0, arg1) {
12798
12861
  console.log(getStringFromWasm0(arg0, arg1));
12799
12862
  };
12800
12863
  imports.wbg.__wbg_msCrypto_0a36e2ec3a343d26 = function(arg0) {
@@ -12812,7 +12875,7 @@ function __wbg_get_imports() {
12812
12875
  const a = state0.a;
12813
12876
  state0.a = 0;
12814
12877
  try {
12815
- return __wbg_adapter_851(a, state0.b, arg0, arg1);
12878
+ return __wbg_adapter_853(a, state0.b, arg0, arg1);
12816
12879
  } finally {
12817
12880
  state0.a = a;
12818
12881
  }
@@ -13003,7 +13066,7 @@ function __wbg_get_imports() {
13003
13066
  const ret = Signature.__wrap(arg0);
13004
13067
  return addHeapObject(ret);
13005
13068
  };
13006
- imports.wbg.__wbg_spawnWorker_3a7bdc39b2bac9d4 = function(arg0, arg1, arg2, arg3) {
13069
+ imports.wbg.__wbg_spawnWorker_d71cf6dd66485b00 = function(arg0, arg1, arg2, arg3) {
13007
13070
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
13008
13071
  return addHeapObject(ret);
13009
13072
  };
@@ -13123,16 +13186,16 @@ function __wbg_get_imports() {
13123
13186
  const ret = false;
13124
13187
  return ret;
13125
13188
  };
13126
- imports.wbg.__wbindgen_closure_wrapper6531 = function(arg0, arg1, arg2) {
13127
- const ret = makeMutClosure(arg0, arg1, 476, __wbg_adapter_40);
13189
+ imports.wbg.__wbindgen_closure_wrapper6646 = function(arg0, arg1, arg2) {
13190
+ const ret = makeMutClosure(arg0, arg1, 481, __wbg_adapter_40);
13128
13191
  return addHeapObject(ret);
13129
13192
  };
13130
- imports.wbg.__wbindgen_closure_wrapper7123 = function(arg0, arg1, arg2) {
13131
- const ret = makeMutClosure(arg0, arg1, 476, __wbg_adapter_43);
13193
+ imports.wbg.__wbindgen_closure_wrapper7240 = function(arg0, arg1, arg2) {
13194
+ const ret = makeMutClosure(arg0, arg1, 481, __wbg_adapter_43);
13132
13195
  return addHeapObject(ret);
13133
13196
  };
13134
- imports.wbg.__wbindgen_closure_wrapper7127 = function(arg0, arg1, arg2) {
13135
- const ret = makeMutClosure(arg0, arg1, 476, __wbg_adapter_43);
13197
+ imports.wbg.__wbindgen_closure_wrapper7244 = function(arg0, arg1, arg2) {
13198
+ const ret = makeMutClosure(arg0, arg1, 481, __wbg_adapter_43);
13136
13199
  return addHeapObject(ret);
13137
13200
  };
13138
13201
  imports.wbg.__wbindgen_is_function = function(arg0) {