@provablehq/sdk 0.9.5 → 0.9.7

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.
@@ -1,8 +1,9 @@
1
1
  import { Account } from "./account.js";
2
2
  import { BlockJSON } from "./models/blockJSON.js";
3
3
  import { TransactionJSON } from "./models/transaction/transactionJSON.js";
4
- import { Address, Plaintext, Program, RecordPlaintext, PrivateKey, Transaction } from "./wasm.js";
4
+ import { Address, Plaintext, Program, ProvingRequest, RecordPlaintext, PrivateKey, Transaction } from "./wasm.js";
5
5
  import { ConfirmedTransactionJSON } from "./models/confirmed_transaction.js";
6
+ import { ProvingResponse } from "./models/provingResponse.js";
6
7
  type ProgramImports = {
7
8
  [key: string]: string | Program;
8
9
  };
@@ -707,6 +708,14 @@ declare class AleoNetworkClient {
707
708
  * @returns {Promise<string>} The solution id of the submitted solution or the resulting error.
708
709
  */
709
710
  submitSolution(solution: string): Promise<string>;
711
+ /**
712
+ * Submit a `ProvingRequest` to a remote proving service for delegated proving. If the broadcast flag of the `ProvingRequest` is set to `true` the remote service will attempt to broadcast the result `Transaction` on behalf of the requestor.
713
+ *
714
+ * @param {ProvingRequest | string} provingRequest - The `ProvingRequest` (generated by the ProgramManager) to submit.
715
+ * @param {string} url - (Optional) The url of the proving service.
716
+ * @returns {Promise<ProvingResponse>} The ProvingResponse containing the transaction result and the result of the broadcast if the `broadcast` flag was set to `true`.
717
+ */
718
+ submitProvingRequest(provingRequest: ProvingRequest | string, url?: string): Promise<ProvingResponse>;
710
719
  /**
711
720
  * Await a submitted transaction to be confirmed or rejected on the Aleo network.
712
721
  *
@@ -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, 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/mainnet.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/mainnet.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.
@@ -199,7 +202,7 @@ declare class ProgramManager {
199
202
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
200
203
  * const keyProvider = new AleoKeyProvider();
201
204
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
202
- * keyProvider.useCache = true;
205
+ * keyProvider.useCache(true);
203
206
  *
204
207
  * // Initialize a program manager with the key provider to automatically fetch keys for deployments
205
208
  * const program = "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";
@@ -238,7 +241,7 @@ declare class ProgramManager {
238
241
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
239
242
  * const keyProvider = new AleoKeyProvider();
240
243
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
241
- * keyProvider.useCache = true;
244
+ * keyProvider.useCache(true);
242
245
  *
243
246
  * // Initialize a program manager with the key provider to automatically fetch keys for deployments
244
247
  * const program = "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";
@@ -270,7 +273,7 @@ declare class ProgramManager {
270
273
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
271
274
  * const keyProvider = new AleoKeyProvider();
272
275
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
273
- * keyProvider.useCache = true;
276
+ * keyProvider.useCache(true);
274
277
  *
275
278
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
276
279
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -308,7 +311,7 @@ declare class ProgramManager {
308
311
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
309
312
  * const keyProvider = new AleoKeyProvider();
310
313
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
311
- * keyProvider.useCache = true;
314
+ * keyProvider.useCache(true);
312
315
  *
313
316
  * // Initialize a ProgramManager with the key and record providers.
314
317
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -337,7 +340,7 @@ declare class ProgramManager {
337
340
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
338
341
  * const keyProvider = new AleoKeyProvider();
339
342
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
340
- * keyProvider.useCache = true;
343
+ * keyProvider.useCache(true);
341
344
  *
342
345
  * // Initialize a ProgramManager with the key and record providers.
343
346
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -366,7 +369,7 @@ declare class ProgramManager {
366
369
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
367
370
  * const keyProvider = new AleoKeyProvider();
368
371
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
369
- * keyProvider.useCache = true;
372
+ * keyProvider.useCache(true);
370
373
  *
371
374
  * // Initialize a ProgramManager with the key and record providers.
372
375
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -399,7 +402,7 @@ declare class ProgramManager {
399
402
  * // Create a new NetworkClient, KeyProvider, and RecordProvider.
400
403
  * const keyProvider = new AleoKeyProvider();
401
404
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
402
- * keyProvider.useCache = true;
405
+ * keyProvider.useCache(true);
403
406
  *
404
407
  * // Initialize a ProgramManager with the key and record providers.
405
408
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -432,7 +435,7 @@ declare class ProgramManager {
432
435
  * // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
433
436
  * const keyProvider = new AleoKeyProvider();
434
437
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
435
- * keyProvider.useCache = true;
438
+ * keyProvider.useCache(true);
436
439
  *
437
440
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
438
441
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -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
  *
@@ -507,7 +510,7 @@ declare class ProgramManager {
507
510
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
508
511
  * const keyProvider = new AleoKeyProvider();
509
512
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
510
- * keyProvider.useCache = true;
513
+ * keyProvider.useCache(true);
511
514
  *
512
515
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
513
516
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -538,7 +541,7 @@ declare class ProgramManager {
538
541
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
539
542
  * const keyProvider = new AleoKeyProvider();
540
543
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
541
- * keyProvider.useCache = true;
544
+ * keyProvider.useCache(true);
542
545
  *
543
546
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
544
547
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -585,7 +588,7 @@ declare class ProgramManager {
585
588
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
586
589
  * const keyProvider = new AleoKeyProvider();
587
590
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
588
- * keyProvider.useCache = true;
591
+ * keyProvider.useCache(true);
589
592
  *
590
593
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
591
594
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -616,7 +619,7 @@ declare class ProgramManager {
616
619
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
617
620
  * const keyProvider = new AleoKeyProvider();
618
621
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
619
- * keyProvider.useCache = true;
622
+ * keyProvider.useCache(true);
620
623
  *
621
624
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
622
625
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -647,7 +650,7 @@ declare class ProgramManager {
647
650
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
648
651
  * const keyProvider = new AleoKeyProvider();
649
652
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
650
- * keyProvider.useCache = true;
653
+ * keyProvider.useCache(true);
651
654
  *
652
655
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
653
656
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -683,7 +686,7 @@ declare class ProgramManager {
683
686
  * // Create a new NetworkClient, KeyProvider, and RecordProvider
684
687
  * const keyProvider = new AleoKeyProvider();
685
688
  * const recordProvider = new NetworkRecordProvider(account, networkClient);
686
- * keyProvider.useCache = true;
689
+ * keyProvider.useCache(true);
687
690
  *
688
691
  * // Initialize a program manager with the key provider to automatically fetch keys for executions
689
692
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
@@ -711,7 +714,7 @@ declare class ProgramManager {
711
714
  *
712
715
  * // Create a keyProvider to handle key management
713
716
  * const keyProvider = new AleoKeyProvider();
714
- * keyProvider.useCache = true;
717
+ * keyProvider.useCache(true);
715
718
  *
716
719
  * // Create a new ProgramManager with the key that will be used to bond credits
717
720
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -745,7 +748,7 @@ declare class ProgramManager {
745
748
  *
746
749
  * // Create a keyProvider to handle key management
747
750
  * const keyProvider = new AleoKeyProvider();
748
- * keyProvider.useCache = true;
751
+ * keyProvider.useCache(true);
749
752
  *
750
753
  * // Create a new ProgramManager with the key that will be used to bond credits
751
754
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -776,7 +779,7 @@ declare class ProgramManager {
776
779
  *
777
780
  * // Create a keyProvider to handle key management
778
781
  * const keyProvider = new AleoKeyProvider();
779
- * keyProvider.useCache = true;
782
+ * keyProvider.useCache(true);
780
783
  *
781
784
  * // Create a new ProgramManager with the key that will be used to bond credits
782
785
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -811,7 +814,7 @@ declare class ProgramManager {
811
814
  *
812
815
  * // Create a keyProvider to handle key management
813
816
  * const keyProvider = new AleoKeyProvider();
814
- * keyProvider.useCache = true;
817
+ * keyProvider.useCache(true);
815
818
  *
816
819
  * // Create a new ProgramManager with the key that will be used to bond credits
817
820
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -841,7 +844,7 @@ declare class ProgramManager {
841
844
  *
842
845
  * // Create a keyProvider to handle key management.
843
846
  * const keyProvider = new AleoKeyProvider();
844
- * keyProvider.useCache = true;
847
+ * keyProvider.useCache(true);
845
848
  *
846
849
  * // Create a new ProgramManager with the key that will be used to unbond credits.
847
850
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -876,7 +879,7 @@ declare class ProgramManager {
876
879
  *
877
880
  * // Create a keyProvider to handle key management
878
881
  * const keyProvider = new AleoKeyProvider();
879
- * keyProvider.useCache = true;
882
+ * keyProvider.useCache(true);
880
883
  *
881
884
  * // Create a new ProgramManager with the key that will be used to bond credits
882
885
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -905,7 +908,7 @@ declare class ProgramManager {
905
908
  *
906
909
  * // Create a keyProvider to handle key management
907
910
  * const keyProvider = new AleoKeyProvider();
908
- * keyProvider.useCache = true;
911
+ * keyProvider.useCache(true);
909
912
  *
910
913
  * // Create a new ProgramManager with the key that will be used to claim unbonded credits.
911
914
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -937,7 +940,7 @@ declare class ProgramManager {
937
940
  *
938
941
  * // Create a keyProvider to handle key management
939
942
  * const keyProvider = new AleoKeyProvider();
940
- * keyProvider.useCache = true;
943
+ * keyProvider.useCache(true);
941
944
  *
942
945
  * // Create a new ProgramManager with the key that will be used to bond credits
943
946
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -974,7 +977,7 @@ declare class ProgramManager {
974
977
  *
975
978
  * // Create a keyProvider to handle key management
976
979
  * const keyProvider = new AleoKeyProvider();
977
- * keyProvider.useCache = true;
980
+ * keyProvider.useCache(true);
978
981
  *
979
982
  * // Create a new ProgramManager with the key that will be used to bond credits
980
983
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -1013,7 +1016,7 @@ declare class ProgramManager {
1013
1016
  *
1014
1017
  * // Create a keyProvider to handle key management
1015
1018
  * const keyProvider = new AleoKeyProvider();
1016
- * keyProvider.useCache = true;
1019
+ * keyProvider.useCache(true);
1017
1020
  *
1018
1021
  * // Create a new ProgramManager with the key that will be used to bond credits
1019
1022
  * const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
@@ -1 +1 @@
1
- export { Address, Authorization, Boolean, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, Execution, ExecutionResponse, Field, 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/mainnet.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/mainnet.js";
@@ -33,7 +33,7 @@ import { BlockHeightSearch, NetworkRecordProvider, RecordProvider, RecordSearchP
33
33
  declare function initializeWasm(): Promise<void>;
34
34
  export { ProgramManager, ProvingRequestOptions, ExecuteOptions, FeeAuthorizationOptions, AuthorizationOptions } from "./program-manager.js";
35
35
  export { logAndThrow } from "./utils.js";
36
- export { Address, Authorization, Boolean, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, Execution as FunctionExecution, ExecutionRequest, ExecutionResponse, EncryptionToolkit, Field, Group, I8, I16, I32, I64, I128, OfflineQuery, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Signature, Scalar, Transaction, Transition, U8, U16, U32, U64, U128, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "./wasm.js";
36
+ export { Address, Authorization, Boolean, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, Execution as FunctionExecution, ExecutionRequest, ExecutionResponse, EncryptionToolkit, Field, GraphKey, Group, I8, I16, I32, I64, I128, OfflineQuery, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Signature, Scalar, Transaction, Transition, U8, U16, U32, U64, U128, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "./wasm.js";
37
37
  export { initializeWasm };
38
38
  export { Key, CREDITS_PROGRAM_KEYS, KEY_STORE, PRIVATE_TRANSFER, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, PUBLIC_TO_PRIVATE_TRANSFER, VALID_TRANSFER_TYPES, } from "./constants.js";
39
39
  export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, AleoNetworkClient, BlockJSON, BlockHeightSearch, CachedKeyPair, ConfirmedTransactionJSON, DeploymentJSON, DeploymentObject, ExecutionJSON, ExecutionObject, FeeExecutionJSON, FeeExecutionObject, FinalizeJSON, FunctionObject, FunctionKeyPair, FunctionKeyProvider, Header, ImportedPrograms, ImportedVerifyingKeys, InputJSON, InputObject, KeySearchParams, Metadata, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, OutputJSON, OutputObject, OwnerJSON, PartialSolutionJSON, PlaintextArray, PlaintextLiteral, PlaintextObject, PlaintextStruct, ProgramImports, ProvingRequestJSON, ProvingResponse, RatificationJSON, RecordProvider, RecordSearchParams, SolutionJSON, SolutionsJSON, TransactionJSON, TransactionObject, TransitionJSON, TransitionObject, VerifyingKeys, };