@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.
- package/dist/mainnet/browser.d.ts +1 -1
- package/dist/mainnet/browser.js +106 -34
- package/dist/mainnet/browser.js.map +1 -1
- package/dist/mainnet/network-client.d.ts +10 -1
- package/dist/mainnet/node.js +1 -1
- package/dist/mainnet/program-manager.d.ts +28 -25
- package/dist/mainnet/wasm.d.ts +1 -1
- package/dist/testnet/browser.d.ts +1 -1
- package/dist/testnet/browser.js +106 -34
- package/dist/testnet/browser.js.map +1 -1
- package/dist/testnet/network-client.d.ts +10 -1
- package/dist/testnet/node.js +1 -1
- package/dist/testnet/program-manager.d.ts +28 -25
- package/dist/testnet/wasm.d.ts +1 -1
- package/package.json +2 -2
|
@@ -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, };
|
package/dist/mainnet/browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'core-js/proposals/json-parse-with-source.js';
|
|
2
|
-
import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, Program, Plaintext, Transaction, Metadata, VerifyingKey, ProvingKey, ProgramManager as ProgramManager$1, RecordPlaintext, verifyFunctionExecution } from '@provablehq/wasm/mainnet.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';
|
|
2
|
+
import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, Program, Plaintext, Transaction, ProvingRequest, Metadata, VerifyingKey, ProvingKey, ProgramManager as ProgramManager$1, RecordPlaintext, 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
|
|
|
5
5
|
/**
|
|
6
6
|
* Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from
|
|
@@ -489,7 +489,7 @@ class AleoNetworkClient {
|
|
|
489
489
|
else {
|
|
490
490
|
this.headers = {
|
|
491
491
|
// This is replaced by the actual version by a Rollup plugin
|
|
492
|
-
"X-Aleo-SDK-Version": "0.9.
|
|
492
|
+
"X-Aleo-SDK-Version": "0.9.7",
|
|
493
493
|
"X-Aleo-environment": environment(),
|
|
494
494
|
};
|
|
495
495
|
}
|
|
@@ -1244,7 +1244,8 @@ class AleoNetworkClient {
|
|
|
1244
1244
|
async getLatestProgramEdition(programId) {
|
|
1245
1245
|
try {
|
|
1246
1246
|
this.ctx = { "X-ALEO-METHOD": "getLatestProgramEdition" };
|
|
1247
|
-
|
|
1247
|
+
const raw = await this.fetchRaw("/program/" + programId + "/latest_edition");
|
|
1248
|
+
return JSON.parse(raw);
|
|
1248
1249
|
}
|
|
1249
1250
|
catch (error) {
|
|
1250
1251
|
throw new Error(`Error fetching program ${programId}: ${error}`);
|
|
@@ -1816,6 +1817,37 @@ class AleoNetworkClient {
|
|
|
1816
1817
|
throw new Error(`Error posting solution: No response received: ${error.message}`);
|
|
1817
1818
|
}
|
|
1818
1819
|
}
|
|
1820
|
+
/**
|
|
1821
|
+
* 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.
|
|
1822
|
+
*
|
|
1823
|
+
* @param {ProvingRequest | string} provingRequest - The `ProvingRequest` (generated by the ProgramManager) to submit.
|
|
1824
|
+
* @param {string} url - (Optional) The url of the proving service.
|
|
1825
|
+
* @returns {Promise<ProvingResponse>} The ProvingResponse containing the transaction result and the result of the broadcast if the `broadcast` flag was set to `true`.
|
|
1826
|
+
*/
|
|
1827
|
+
async submitProvingRequest(provingRequest, url) {
|
|
1828
|
+
const prover_uri = url ? url : this.host;
|
|
1829
|
+
const provingRequestString = provingRequest instanceof ProvingRequest
|
|
1830
|
+
? provingRequest.toString()
|
|
1831
|
+
: provingRequest;
|
|
1832
|
+
try {
|
|
1833
|
+
const response = await retryWithBackoff(() => post(prover_uri + "/prove", {
|
|
1834
|
+
body: provingRequestString,
|
|
1835
|
+
headers: Object.assign({}, { ...this.headers, "X-ALEO-METHOD": "submitProvingRequest" }, {
|
|
1836
|
+
"Content-Type": "application/json",
|
|
1837
|
+
}),
|
|
1838
|
+
}));
|
|
1839
|
+
try {
|
|
1840
|
+
const text = await response.text();
|
|
1841
|
+
return parseJSON(text);
|
|
1842
|
+
}
|
|
1843
|
+
catch (error) {
|
|
1844
|
+
throw new Error(`Error posting proving request. Aleo network response: ${error.message}`);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
catch (error) {
|
|
1848
|
+
throw new Error(`Error posting proving request: No response received: ${error.message}`);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1819
1851
|
/**
|
|
1820
1852
|
* Await a submitted transaction to be confirmed or rejected on the Aleo network.
|
|
1821
1853
|
*
|
|
@@ -3281,7 +3313,7 @@ class ProgramManager {
|
|
|
3281
3313
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
3282
3314
|
* const keyProvider = new AleoKeyProvider();
|
|
3283
3315
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3284
|
-
* keyProvider.useCache
|
|
3316
|
+
* keyProvider.useCache(true);
|
|
3285
3317
|
*
|
|
3286
3318
|
* // Initialize a program manager with the key provider to automatically fetch keys for deployments
|
|
3287
3319
|
* 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";
|
|
@@ -3385,7 +3417,7 @@ class ProgramManager {
|
|
|
3385
3417
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider.
|
|
3386
3418
|
* const keyProvider = new AleoKeyProvider();
|
|
3387
3419
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3388
|
-
* keyProvider.useCache
|
|
3420
|
+
* keyProvider.useCache(true);
|
|
3389
3421
|
*
|
|
3390
3422
|
* // Initialize a program manager with the key provider to automatically fetch keys for deployments
|
|
3391
3423
|
* 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";
|
|
@@ -3432,7 +3464,7 @@ class ProgramManager {
|
|
|
3432
3464
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider.
|
|
3433
3465
|
* const keyProvider = new AleoKeyProvider();
|
|
3434
3466
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3435
|
-
* keyProvider.useCache
|
|
3467
|
+
* keyProvider.useCache(true);
|
|
3436
3468
|
*
|
|
3437
3469
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
3438
3470
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -3464,6 +3496,7 @@ class ProgramManager {
|
|
|
3464
3496
|
let verifyingKey = options.verifyingKey;
|
|
3465
3497
|
let program = options.program;
|
|
3466
3498
|
let imports = options.imports;
|
|
3499
|
+
let edition = options.edition;
|
|
3467
3500
|
// Ensure the function exists on the network
|
|
3468
3501
|
if (program === undefined) {
|
|
3469
3502
|
try {
|
|
@@ -3476,6 +3509,15 @@ class ProgramManager {
|
|
|
3476
3509
|
else if (program instanceof Program) {
|
|
3477
3510
|
program = program.toString();
|
|
3478
3511
|
}
|
|
3512
|
+
if (edition == undefined) {
|
|
3513
|
+
try {
|
|
3514
|
+
edition = await this.networkClient.getLatestProgramEdition(programName);
|
|
3515
|
+
}
|
|
3516
|
+
catch (e) {
|
|
3517
|
+
console.warn(`Error finding edition for ${programName}. Network response: '${e.message}'. Assuming edition 1.`);
|
|
3518
|
+
edition = 1;
|
|
3519
|
+
}
|
|
3520
|
+
}
|
|
3479
3521
|
// Get the private key from the account if it is not provided in the parameters
|
|
3480
3522
|
let executionPrivateKey = privateKey;
|
|
3481
3523
|
if (typeof privateKey === "undefined" &&
|
|
@@ -3525,7 +3567,7 @@ class ProgramManager {
|
|
|
3525
3567
|
}
|
|
3526
3568
|
}
|
|
3527
3569
|
// Build an execution transaction
|
|
3528
|
-
return await ProgramManager$1.buildExecutionTransaction(executionPrivateKey, program, functionName, inputs, priorityFee, feeRecord, this.host, imports, provingKey, verifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery);
|
|
3570
|
+
return await ProgramManager$1.buildExecutionTransaction(executionPrivateKey, program, functionName, inputs, priorityFee, feeRecord, this.host, imports, provingKey, verifyingKey, feeProvingKey, feeVerifyingKey, offlineQuery, edition);
|
|
3529
3571
|
}
|
|
3530
3572
|
/**
|
|
3531
3573
|
* Builds a SnarkVM `Authorization` for a specific function.
|
|
@@ -3540,7 +3582,7 @@ class ProgramManager {
|
|
|
3540
3582
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider.
|
|
3541
3583
|
* const keyProvider = new AleoKeyProvider();
|
|
3542
3584
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3543
|
-
* keyProvider.useCache
|
|
3585
|
+
* keyProvider.useCache(true);
|
|
3544
3586
|
*
|
|
3545
3587
|
* // Initialize a ProgramManager with the key and record providers.
|
|
3546
3588
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -3561,6 +3603,7 @@ class ProgramManager {
|
|
|
3561
3603
|
const privateKey = options.privateKey;
|
|
3562
3604
|
let program = options.programSource;
|
|
3563
3605
|
let imports = options.programImports;
|
|
3606
|
+
let edition = options.edition;
|
|
3564
3607
|
// Ensure the function exists on the network.
|
|
3565
3608
|
if (program === undefined) {
|
|
3566
3609
|
try {
|
|
@@ -3582,6 +3625,15 @@ class ProgramManager {
|
|
|
3582
3625
|
if (typeof executionPrivateKey === "undefined") {
|
|
3583
3626
|
throw "No private key provided and no private key set in the ProgramManager";
|
|
3584
3627
|
}
|
|
3628
|
+
if (edition == undefined) {
|
|
3629
|
+
try {
|
|
3630
|
+
edition = await this.networkClient.getLatestProgramEdition(programName);
|
|
3631
|
+
}
|
|
3632
|
+
catch (e) {
|
|
3633
|
+
console.warn(`Error finding edition for ${programName}. Network response: '${e.message}'. Assuming edition 1.`);
|
|
3634
|
+
edition = 1;
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3585
3637
|
// Resolve the program imports if they exist.
|
|
3586
3638
|
const numberOfImports = Program.fromString(program).getImports().length;
|
|
3587
3639
|
if (numberOfImports > 0 && !imports) {
|
|
@@ -3593,7 +3645,7 @@ class ProgramManager {
|
|
|
3593
3645
|
}
|
|
3594
3646
|
}
|
|
3595
3647
|
// Build and return an `Authorization` for the desired function.
|
|
3596
|
-
return await ProgramManager$1.authorize(executionPrivateKey, program, functionName, inputs, imports);
|
|
3648
|
+
return await ProgramManager$1.authorize(executionPrivateKey, program, functionName, inputs, imports, edition);
|
|
3597
3649
|
}
|
|
3598
3650
|
/**
|
|
3599
3651
|
* Builds a SnarkVM `Authorization` for a specific function without building a circuit first. This should be used when fast authorization generation is needed and the invoker is confident inputs are coorect.
|
|
@@ -3608,7 +3660,7 @@ class ProgramManager {
|
|
|
3608
3660
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider.
|
|
3609
3661
|
* const keyProvider = new AleoKeyProvider();
|
|
3610
3662
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3611
|
-
* keyProvider.useCache
|
|
3663
|
+
* keyProvider.useCache(true);
|
|
3612
3664
|
*
|
|
3613
3665
|
* // Initialize a ProgramManager with the key and record providers.
|
|
3614
3666
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -3629,6 +3681,7 @@ class ProgramManager {
|
|
|
3629
3681
|
const privateKey = options.privateKey;
|
|
3630
3682
|
let program = options.programSource;
|
|
3631
3683
|
let imports = options.programImports;
|
|
3684
|
+
let edition = options.edition;
|
|
3632
3685
|
// Ensure the function exists on the network.
|
|
3633
3686
|
if (program === undefined) {
|
|
3634
3687
|
try {
|
|
@@ -3660,8 +3713,17 @@ class ProgramManager {
|
|
|
3660
3713
|
logAndThrow(`Error finding program imports. Network response: '${e.message}'. Please ensure you're connected to a valid Aleo network and the program is deployed to the network.`);
|
|
3661
3714
|
}
|
|
3662
3715
|
}
|
|
3716
|
+
if (edition == undefined) {
|
|
3717
|
+
try {
|
|
3718
|
+
edition = await this.networkClient.getLatestProgramEdition(programName);
|
|
3719
|
+
}
|
|
3720
|
+
catch (e) {
|
|
3721
|
+
console.warn(`Error finding edition for ${programName}. Network response: '${e.message}'. Assuming edition 1.`);
|
|
3722
|
+
edition = 1;
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3663
3725
|
// Build and return an `Authorization` for the desired function.
|
|
3664
|
-
return await ProgramManager$1.buildAuthorizationUnchecked(executionPrivateKey, program, functionName, inputs, imports);
|
|
3726
|
+
return await ProgramManager$1.buildAuthorizationUnchecked(executionPrivateKey, program, functionName, inputs, imports, edition);
|
|
3665
3727
|
}
|
|
3666
3728
|
/**
|
|
3667
3729
|
* Builds a `ProvingRequest` for submission to a prover for execution.
|
|
@@ -3676,7 +3738,7 @@ class ProgramManager {
|
|
|
3676
3738
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider.
|
|
3677
3739
|
* const keyProvider = new AleoKeyProvider();
|
|
3678
3740
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3679
|
-
* keyProvider.useCache
|
|
3741
|
+
* keyProvider.useCache(true);
|
|
3680
3742
|
*
|
|
3681
3743
|
* // Initialize a ProgramManager with the key and record providers.
|
|
3682
3744
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -3702,6 +3764,7 @@ class ProgramManager {
|
|
|
3702
3764
|
let program = options.programSource;
|
|
3703
3765
|
let feeRecord = options.feeRecord;
|
|
3704
3766
|
let imports = options.programImports;
|
|
3767
|
+
let edition = options.edition;
|
|
3705
3768
|
// Ensure the function exists on the network.
|
|
3706
3769
|
if (program === undefined) {
|
|
3707
3770
|
try {
|
|
@@ -3714,6 +3777,15 @@ class ProgramManager {
|
|
|
3714
3777
|
else if (program instanceof Program) {
|
|
3715
3778
|
program = program.toString();
|
|
3716
3779
|
}
|
|
3780
|
+
if (edition == undefined) {
|
|
3781
|
+
try {
|
|
3782
|
+
edition = await this.networkClient.getLatestProgramEdition(programName);
|
|
3783
|
+
}
|
|
3784
|
+
catch (e) {
|
|
3785
|
+
console.warn(`Error finding edition for ${programName}. Network response: '${e.message}'. Assuming edition 1.`);
|
|
3786
|
+
edition = 1;
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3717
3789
|
// Get the private key from the account if it is not provided in the parameters.
|
|
3718
3790
|
let executionPrivateKey = privateKey;
|
|
3719
3791
|
if (typeof privateKey === "undefined" &&
|
|
@@ -3743,7 +3815,7 @@ class ProgramManager {
|
|
|
3743
3815
|
}
|
|
3744
3816
|
}
|
|
3745
3817
|
// Build and return the `ProvingRequest`.
|
|
3746
|
-
return await ProgramManager$1.buildProvingRequest(executionPrivateKey, program, functionName, inputs, baseFee, priorityFee, feeRecord, imports, broadcast, unchecked);
|
|
3818
|
+
return await ProgramManager$1.buildProvingRequest(executionPrivateKey, program, functionName, inputs, baseFee, priorityFee, feeRecord, imports, broadcast, unchecked, edition);
|
|
3747
3819
|
}
|
|
3748
3820
|
/**
|
|
3749
3821
|
* Builds a SnarkVM fee `Authorization` for `credits.aleo/fee_private` or `credits.aleo/fee_public`. If a record is provided `fee_private` will be executed, otherwise `fee_public` will be executed.
|
|
@@ -3758,7 +3830,7 @@ class ProgramManager {
|
|
|
3758
3830
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider.
|
|
3759
3831
|
* const keyProvider = new AleoKeyProvider();
|
|
3760
3832
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3761
|
-
* keyProvider.useCache
|
|
3833
|
+
* keyProvider.useCache(true);
|
|
3762
3834
|
*
|
|
3763
3835
|
* // Initialize a ProgramManager with the key and record providers.
|
|
3764
3836
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -3805,7 +3877,7 @@ class ProgramManager {
|
|
|
3805
3877
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider using official Aleo record, key, and network providers
|
|
3806
3878
|
* const keyProvider = new AleoKeyProvider();
|
|
3807
3879
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3808
|
-
* keyProvider.useCache
|
|
3880
|
+
* keyProvider.useCache(true);
|
|
3809
3881
|
*
|
|
3810
3882
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
3811
3883
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -3874,7 +3946,7 @@ class ProgramManager {
|
|
|
3874
3946
|
* const result = executionResponse.getOutputs();
|
|
3875
3947
|
* assert(result === ["10u32"]);
|
|
3876
3948
|
*/
|
|
3877
|
-
async run(program, function_name, inputs, proveExecution, imports, keySearchParams, provingKey, verifyingKey, privateKey, offlineQuery) {
|
|
3949
|
+
async run(program, function_name, inputs, proveExecution, imports, keySearchParams, provingKey, verifyingKey, privateKey, offlineQuery, edition) {
|
|
3878
3950
|
// Get the private key from the account if it is not provided in the parameters
|
|
3879
3951
|
let executionPrivateKey = privateKey;
|
|
3880
3952
|
if (typeof privateKey === "undefined" &&
|
|
@@ -3897,7 +3969,7 @@ class ProgramManager {
|
|
|
3897
3969
|
console.log("Running program offline");
|
|
3898
3970
|
console.log("Proving key: ", provingKey);
|
|
3899
3971
|
console.log("Verifying key: ", verifyingKey);
|
|
3900
|
-
return ProgramManager$1.executeFunctionOffline(executionPrivateKey, program, function_name, inputs, proveExecution, false, imports, provingKey, verifyingKey, this.host, offlineQuery);
|
|
3972
|
+
return ProgramManager$1.executeFunctionOffline(executionPrivateKey, program, function_name, inputs, proveExecution, false, imports, provingKey, verifyingKey, this.host, offlineQuery, edition);
|
|
3901
3973
|
}
|
|
3902
3974
|
/**
|
|
3903
3975
|
* Join two credits records into a single credits record
|
|
@@ -3919,7 +3991,7 @@ class ProgramManager {
|
|
|
3919
3991
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
3920
3992
|
* const keyProvider = new AleoKeyProvider();
|
|
3921
3993
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
3922
|
-
* keyProvider.useCache
|
|
3994
|
+
* keyProvider.useCache(true);
|
|
3923
3995
|
*
|
|
3924
3996
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
3925
3997
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -4007,7 +4079,7 @@ class ProgramManager {
|
|
|
4007
4079
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
4008
4080
|
* const keyProvider = new AleoKeyProvider();
|
|
4009
4081
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
4010
|
-
* keyProvider.useCache
|
|
4082
|
+
* keyProvider.useCache(true);
|
|
4011
4083
|
*
|
|
4012
4084
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
4013
4085
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -4110,7 +4182,7 @@ class ProgramManager {
|
|
|
4110
4182
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
4111
4183
|
* const keyProvider = new AleoKeyProvider();
|
|
4112
4184
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
4113
|
-
* keyProvider.useCache
|
|
4185
|
+
* keyProvider.useCache(true);
|
|
4114
4186
|
*
|
|
4115
4187
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
4116
4188
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -4188,7 +4260,7 @@ class ProgramManager {
|
|
|
4188
4260
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
4189
4261
|
* const keyProvider = new AleoKeyProvider();
|
|
4190
4262
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
4191
|
-
* keyProvider.useCache
|
|
4263
|
+
* keyProvider.useCache(true);
|
|
4192
4264
|
*
|
|
4193
4265
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
4194
4266
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -4221,7 +4293,7 @@ class ProgramManager {
|
|
|
4221
4293
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
4222
4294
|
* const keyProvider = new AleoKeyProvider();
|
|
4223
4295
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
4224
|
-
* keyProvider.useCache
|
|
4296
|
+
* keyProvider.useCache(true);
|
|
4225
4297
|
*
|
|
4226
4298
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
4227
4299
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -4259,7 +4331,7 @@ class ProgramManager {
|
|
|
4259
4331
|
* // Create a new NetworkClient, KeyProvider, and RecordProvider
|
|
4260
4332
|
* const keyProvider = new AleoKeyProvider();
|
|
4261
4333
|
* const recordProvider = new NetworkRecordProvider(account, networkClient);
|
|
4262
|
-
* keyProvider.useCache
|
|
4334
|
+
* keyProvider.useCache(true);
|
|
4263
4335
|
*
|
|
4264
4336
|
* // Initialize a program manager with the key provider to automatically fetch keys for executions
|
|
4265
4337
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, recordProvider);
|
|
@@ -4302,7 +4374,7 @@ class ProgramManager {
|
|
|
4302
4374
|
*
|
|
4303
4375
|
* // Create a keyProvider to handle key management
|
|
4304
4376
|
* const keyProvider = new AleoKeyProvider();
|
|
4305
|
-
* keyProvider.useCache
|
|
4377
|
+
* keyProvider.useCache(true);
|
|
4306
4378
|
*
|
|
4307
4379
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4308
4380
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4357,7 +4429,7 @@ class ProgramManager {
|
|
|
4357
4429
|
*
|
|
4358
4430
|
* // Create a keyProvider to handle key management
|
|
4359
4431
|
* const keyProvider = new AleoKeyProvider();
|
|
4360
|
-
* keyProvider.useCache
|
|
4432
|
+
* keyProvider.useCache(true);
|
|
4361
4433
|
*
|
|
4362
4434
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4363
4435
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4403,7 +4475,7 @@ class ProgramManager {
|
|
|
4403
4475
|
*
|
|
4404
4476
|
* // Create a keyProvider to handle key management
|
|
4405
4477
|
* const keyProvider = new AleoKeyProvider();
|
|
4406
|
-
* keyProvider.useCache
|
|
4478
|
+
* keyProvider.useCache(true);
|
|
4407
4479
|
*
|
|
4408
4480
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4409
4481
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4461,7 +4533,7 @@ class ProgramManager {
|
|
|
4461
4533
|
*
|
|
4462
4534
|
* // Create a keyProvider to handle key management
|
|
4463
4535
|
* const keyProvider = new AleoKeyProvider();
|
|
4464
|
-
* keyProvider.useCache
|
|
4536
|
+
* keyProvider.useCache(true);
|
|
4465
4537
|
*
|
|
4466
4538
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4467
4539
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4506,7 +4578,7 @@ class ProgramManager {
|
|
|
4506
4578
|
*
|
|
4507
4579
|
* // Create a keyProvider to handle key management.
|
|
4508
4580
|
* const keyProvider = new AleoKeyProvider();
|
|
4509
|
-
* keyProvider.useCache
|
|
4581
|
+
* keyProvider.useCache(true);
|
|
4510
4582
|
*
|
|
4511
4583
|
* // Create a new ProgramManager with the key that will be used to unbond credits.
|
|
4512
4584
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4558,7 +4630,7 @@ class ProgramManager {
|
|
|
4558
4630
|
*
|
|
4559
4631
|
* // Create a keyProvider to handle key management
|
|
4560
4632
|
* const keyProvider = new AleoKeyProvider();
|
|
4561
|
-
* keyProvider.useCache
|
|
4633
|
+
* keyProvider.useCache(true);
|
|
4562
4634
|
*
|
|
4563
4635
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4564
4636
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4602,7 +4674,7 @@ class ProgramManager {
|
|
|
4602
4674
|
*
|
|
4603
4675
|
* // Create a keyProvider to handle key management
|
|
4604
4676
|
* const keyProvider = new AleoKeyProvider();
|
|
4605
|
-
* keyProvider.useCache
|
|
4677
|
+
* keyProvider.useCache(true);
|
|
4606
4678
|
*
|
|
4607
4679
|
* // Create a new ProgramManager with the key that will be used to claim unbonded credits.
|
|
4608
4680
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4651,7 +4723,7 @@ class ProgramManager {
|
|
|
4651
4723
|
*
|
|
4652
4724
|
* // Create a keyProvider to handle key management
|
|
4653
4725
|
* const keyProvider = new AleoKeyProvider();
|
|
4654
|
-
* keyProvider.useCache
|
|
4726
|
+
* keyProvider.useCache(true);
|
|
4655
4727
|
*
|
|
4656
4728
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4657
4729
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4703,7 +4775,7 @@ class ProgramManager {
|
|
|
4703
4775
|
*
|
|
4704
4776
|
* // Create a keyProvider to handle key management
|
|
4705
4777
|
* const keyProvider = new AleoKeyProvider();
|
|
4706
|
-
* keyProvider.useCache
|
|
4778
|
+
* keyProvider.useCache(true);
|
|
4707
4779
|
*
|
|
4708
4780
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4709
4781
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|
|
@@ -4758,7 +4830,7 @@ class ProgramManager {
|
|
|
4758
4830
|
*
|
|
4759
4831
|
* // Create a keyProvider to handle key management
|
|
4760
4832
|
* const keyProvider = new AleoKeyProvider();
|
|
4761
|
-
* keyProvider.useCache
|
|
4833
|
+
* keyProvider.useCache(true);
|
|
4762
4834
|
*
|
|
4763
4835
|
* // Create a new ProgramManager with the key that will be used to bond credits
|
|
4764
4836
|
* const programManager = new ProgramManager("https://api.explorer.provable.com/v1", keyProvider, undefined);
|