Skip to content

Commit 523cf13

Browse files
committed
Fixing e2e tests
1 parent f97f6c9 commit 523cf13

File tree

6 files changed

+27
-19
lines changed

6 files changed

+27
-19
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "0.0.0",
55
"workspaces": [
66
"sdk",
7+
"sdk/e2e/*",
78
"wasm",
89
"website",
910
"create-leo-app",

sdk/e2e/mainnet/index.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
2626
programManager.setKeyProvider(keyProvider);
2727

2828
// Pre-synthesize the program keys and then cache them in memory using key provider
29-
const keyPair = await programManager.synthesizeKeys(hello_hello_program, aleoFunction, inputs);
29+
const keyPair = await programManager.synthesizeKeys({
30+
program: hello_hello_program,
31+
functionName: aleoFunction,
32+
inputs,
33+
});
34+
3035
programManager.keyProvider.cacheKeys(`${programName}:${aleoFunction}`, keyPair);
3136

3237
// Specify parameters for the key provider to use search for program keys. In particular specify the cache key
@@ -35,18 +40,17 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
3540

3641
// Execute once using the key provider params defined above. This will use the cached proving keys and make
3742
// execution significantly faster.
38-
let executionResponse = await programManager.run(
39-
program,
40-
aleoFunction,
43+
let executionResponse = await programManager.run({
44+
program: program,
45+
functionName: aleoFunction,
4146
inputs,
42-
true,
43-
undefined,
47+
proveExecution: true,
4448
keyProviderParams,
45-
);
49+
});
4650
console.log("hello_hello/hello executed - result:", executionResponse.getOutputs());
4751

4852
// Verify the execution using the verifying key that was generated earlier.
49-
if (programManager.verifyExecution(executionResponse)) {
53+
if (programManager.verifyExecution({ executionResponse })) {
5054
console.log("hello_hello/hello execution verified!");
5155
} else {
5256
throw("Execution failed verification!");

sdk/e2e/mainnet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"start": "node index.js"
88
},
99
"dependencies": {
10-
"@provablehq/sdk": "^0.8.8"
10+
"@provablehq/sdk": "^0.9.0"
1111
}
1212
}

sdk/e2e/testnet/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
2626
programManager.setKeyProvider(keyProvider);
2727

2828
// Pre-synthesize the program keys and then cache them in memory using key provider
29-
const keyPair = await programManager.synthesizeKeys(hello_hello_program, aleoFunction, inputs);
29+
const keyPair = await programManager.synthesizeKeys({
30+
program: hello_hello_program,
31+
functionName: aleoFunction,
32+
inputs,
33+
});
3034
programManager.keyProvider.cacheKeys(`${programName}:${aleoFunction}`, keyPair);
3135

3236
// Specify parameters for the key provider to use search for program keys. In particular specify the cache key
@@ -35,18 +39,17 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
3539

3640
// Execute once using the key provider params defined above. This will use the cached proving keys and make
3741
// execution significantly faster.
38-
let executionResponse = await programManager.run(
42+
let executionResponse = await programManager.run({
3943
program,
40-
aleoFunction,
44+
functionName: aleoFunction,
4145
inputs,
42-
true,
43-
undefined,
46+
proveExecution: true,
4447
keyProviderParams,
45-
);
48+
});
4649
console.log("hello_hello/hello executed - result:", executionResponse.getOutputs());
4750

4851
// Verify the execution using the verifying key that was generated earlier.
49-
if (programManager.verifyExecution(executionResponse)) {
52+
if (programManager.verifyExecution({ executionResponse })) {
5053
console.log("hello_hello/hello execution verified!");
5154
} else {
5255
throw("Execution failed verification!");

sdk/e2e/testnet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"start": "node index.js"
88
},
99
"dependencies": {
10-
"@provablehq/sdk": "^0.8.8"
10+
"@provablehq/sdk": "^0.9.0"
1111
}
1212
}

sdk/src/program-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ProgramManager {
8282

8383
/** Create a new instance of the ProgramManager
8484
*
85-
* @param {Object} params
85+
* @param {Object} [params]
8686
* @param { string | undefined } [params.host] A host uri running the official Aleo API
8787
* @param { FunctionKeyProvider | undefined } [params.keyProvider] A key provider that implements {@link FunctionKeyProvider} interface
8888
* @param { RecordProvider | undefined } [params.recordProvider] A record provider that implements {@link RecordProvider} interface
@@ -93,7 +93,7 @@ class ProgramManager {
9393
keyProvider?: FunctionKeyProvider | undefined,
9494
recordProvider?: RecordProvider | undefined,
9595
networkClientOptions?: AleoNetworkClientOptions | undefined,
96-
}) {
96+
} = {}) {
9797
const { host, keyProvider, recordProvider, networkClientOptions } = params;
9898

9999
this.host = host ? host : "https://api.explorer.provable.com/v1";

0 commit comments

Comments
 (0)