@provablehq/sdk 0.9.4 → 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.
@@ -356,7 +356,17 @@ declare class AleoNetworkClient {
356
356
  /**
357
357
  * Returns the source code of a program given a program ID.
358
358
  *
359
- * @param {string} programId The program ID of a program deployed to the Aleo Network
359
+ * @param {string} programId The program ID of a program deployed to the Aleo Network.
360
+ * @param {number | undefined} edition The edition of the program to fetch. When this is undefined it will fetch the latest version.
361
+ * @returns {Promise<string>} The source code of the program.
362
+ *
363
+ * @example
364
+ * import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
365
+ *
366
+ * // Create a network client.
367
+ * const networkClient = new AleoNetworkClient("http://api.explorer.provable.com/v1", undefined);
368
+ *
369
+ * // Get the source code of a program.)
360
370
  * @returns {Promise<string>} Source code of the program
361
371
  *
362
372
  * @example
@@ -369,12 +379,29 @@ declare class AleoNetworkClient {
369
379
  * const expectedSource = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n"
370
380
  * assert.equal(program, expectedSource);
371
381
  */
372
- getProgram(programId: string): Promise<string>;
382
+ getProgram(programId: string, edition?: number): Promise<string>;
383
+ /**
384
+ * Returns the current program edition deployed on the Aleo network.
385
+ *
386
+ * @param {string} programId The program ID of a program deployed to the Aleo Network.
387
+ * @returns {Promise<number>} The edition of the program.
388
+ *
389
+ * @example
390
+ * import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
391
+ *
392
+ * // Create a network client.
393
+ * const networkClient = new AleoNetworkClient("http://api.explorer.provable.com/v1", undefined);
394
+ *
395
+ * const programVersion = networkClient.getLatestProgramEdition("hello_hello.aleo");
396
+ * assert.equal(programVersion, 1);
397
+ */
398
+ getLatestProgramEdition(programId: string): Promise<number>;
373
399
  /**
374
400
  * Returns a program object from a program ID or program source code.
375
401
  *
376
- * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
377
- * @returns {Promise<Program>} Source code of the program
402
+ * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network.
403
+ * @param {number | undefined} edition The edition of the program to fetch. When this is undefined it will fetch the latest version.
404
+ * @returns {Promise<Program>} Source code of the program.
378
405
  *
379
406
  * @example
380
407
  * import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
@@ -392,7 +419,7 @@ declare class AleoNetworkClient {
392
419
  * // Both program objects should be equal
393
420
  * assert(programObjectFromID.to_string() === programObjectFromSource.to_string());
394
421
  */
395
- getProgramObject(inputProgram: string): Promise<Program>;
422
+ getProgramObject(inputProgram: string, edition?: number): Promise<Program>;
396
423
  /**
397
424
  * Returns an object containing the source code of a program and the source code of all programs it imports
398
425
  *
@@ -1,6 +1,6 @@
1
1
  import './node-polyfill.js';
2
2
  export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoNetworkClient, BlockHeightSearch, CREDITS_PROGRAM_KEYS, KEY_STORE, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TO_PRIVATE_TRANSFER, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, ProgramManager, VALID_TRANSFER_TYPES, initializeWasm, logAndThrow } from './browser.js';
3
- export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, ExecutionResponse, Field, Execution as FunctionExecution, Group, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
3
+ export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, ExecutionResponse, Field, Execution as FunctionExecution, GraphKey, Group, I128, I16, I32, I64, I8, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
4
4
  import 'core-js/proposals/json-parse-with-source.js';
5
5
  import 'node:crypto';
6
6
  import 'node:fs';
@@ -38,6 +38,7 @@ interface ExecuteOptions {
38
38
  offlineQuery?: OfflineQuery;
39
39
  program?: string | Program;
40
40
  imports?: ProgramImports;
41
+ edition?: number;
41
42
  }
42
43
  /**
43
44
  * Options for building an Authorization for a function.
@@ -56,6 +57,7 @@ interface AuthorizationOptions {
56
57
  programSource?: string | Program;
57
58
  privateKey?: PrivateKey;
58
59
  programImports?: ProgramImports;
60
+ edition?: number;
59
61
  }
60
62
  /**
61
63
  * Options for executing a fee authorization.
@@ -105,6 +107,7 @@ interface ProvingRequestOptions {
105
107
  programImports?: ProgramImports;
106
108
  broadcast?: boolean;
107
109
  unchecked?: boolean;
110
+ edition?: number;
108
111
  }
109
112
  /**
110
113
  * The ProgramManager class is used to execute and deploy programs on the Aleo network and create value transfers.
@@ -486,7 +489,7 @@ declare class ProgramManager {
486
489
  * const result = executionResponse.getOutputs();
487
490
  * assert(result === ["10u32"]);
488
491
  */
489
- run(program: string, function_name: string, inputs: string[], proveExecution: boolean, imports?: ProgramImports, keySearchParams?: KeySearchParams, provingKey?: ProvingKey, verifyingKey?: VerifyingKey, privateKey?: PrivateKey, offlineQuery?: OfflineQuery): Promise<ExecutionResponse>;
492
+ run(program: string, function_name: string, inputs: string[], proveExecution: boolean, imports?: ProgramImports, keySearchParams?: KeySearchParams, provingKey?: ProvingKey, verifyingKey?: VerifyingKey, privateKey?: PrivateKey, offlineQuery?: OfflineQuery, edition?: number): Promise<ExecutionResponse>;
490
493
  /**
491
494
  * Join two credits records into a single credits record
492
495
  *
@@ -1 +1 @@
1
- export { Address, Authorization, Boolean, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, Execution, ExecutionResponse, Field, Group, OfflineQuery, Metadata, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "@provablehq/wasm/testnet.js";
1
+ export { Address, Authorization, Boolean, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, Execution, ExecutionResponse, Field, GraphKey, Group, I8, I16, I32, I64, I128, OfflineQuery, Metadata, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U8, U16, U32, U64, U128, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "@provablehq/wasm/testnet.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@provablehq/sdk",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions",
5
5
  "collaborators": [
6
6
  "The Provable Team"
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "homepage": "https://github.com/ProvableHQ/sdk#readme",
49
49
  "dependencies": {
50
- "@provablehq/wasm": "^0.9.4",
50
+ "@provablehq/wasm": "^0.9.6",
51
51
  "comlink": "^4.4.2",
52
52
  "core-js": "^3.40.0",
53
53
  "mime": "^4.0.6",