@provablehq/sdk 0.10.3 → 0.10.4

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.
@@ -863,7 +863,7 @@ class AleoNetworkClient {
863
863
  else {
864
864
  this.headers = {
865
865
  // This is replaced by the actual version by a Rollup plugin
866
- "X-Aleo-SDK-Version": "0.10.3",
866
+ "X-Aleo-SDK-Version": "0.10.4",
867
867
  "X-Aleo-environment": environment(),
868
868
  };
869
869
  }
@@ -879,7 +879,7 @@ class AleoNetworkClient {
879
879
  else {
880
880
  this.headers = {
881
881
  // This is replaced by the actual version by a Rollup plugin
882
- "X-Aleo-SDK-Version": "0.10.3",
882
+ "X-Aleo-SDK-Version": "0.10.4",
883
883
  "X-Aleo-environment": environment(),
884
884
  };
885
885
  }
@@ -8027,6 +8027,28 @@ function verifyBatchProof(options) {
8027
8027
  proof.free();
8028
8028
  }
8029
8029
  }
8030
+ /**
8031
+ * Get the checksum of an Aleo program.
8032
+ *
8033
+ * @param {string | Program} program Program string or Program object
8034
+ * @returns {Uint8Array} The keccak256 checksum of the program as a 32-byte Uint8Array
8035
+ *
8036
+ * @example
8037
+ * import { programChecksum } from "@provablehq/sdk/mainnet.js";
8038
+ *
8039
+ * const checksum = programChecksum("program foo.aleo; ...");
8040
+ */
8041
+ function programChecksum(program) {
8042
+ const owned = typeof program === "string" ? mainnet_js.Program.fromString(program) : undefined;
8043
+ const p = owned ?? program;
8044
+ try {
8045
+ return p.toChecksum();
8046
+ }
8047
+ finally {
8048
+ if (owned)
8049
+ owned.free();
8050
+ }
8051
+ }
8030
8052
 
8031
8053
  // ---------------------------------------------------------------------------
8032
8054
  // Converters
@@ -8492,6 +8514,7 @@ exports.isProvingResponse = isProvingResponse;
8492
8514
  exports.isRecordViewKeyStrategy = isRecordViewKeyStrategy;
8493
8515
  exports.isViewKeyStrategy = isViewKeyStrategy;
8494
8516
  exports.logAndThrow = logAndThrow;
8517
+ exports.programChecksum = programChecksum;
8495
8518
  exports.provingKeyLocator = provingKeyLocator;
8496
8519
  exports.sha256Hex = sha256Hex;
8497
8520
  exports.toAddress = toAddress;