Skip to content

Commit ed305fa

Browse files
committed
Fixing some of the examples
1 parent 0cc56ef commit ed305fa

File tree

6 files changed

+36
-30
lines changed

6 files changed

+36
-30
lines changed

create-leo-app/template-extension/src/worker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ async function localProgramExecution(program, aleoFunction, inputs) {
1818
const account = new Account();
1919
programManager.setAccount(account);
2020

21-
const executionResponse = await programManager.run(
21+
const executionResponse = await programManager.run({
2222
program,
23-
aleoFunction,
23+
functionName: aleoFunction,
2424
inputs,
25-
false,
26-
);
25+
proveExecution: false,
26+
});
2727
return executionResponse.getOutputs();
2828
}
2929

create-leo-app/template-nextjs-ts/src/app/worker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ async function localProgramExecution(program: string, aleoFunction: string, inpu
2323
const account = new Account();
2424
programManager.setAccount(account);
2525

26-
const executionResponse = await programManager.run(
26+
const executionResponse = await programManager.run({
2727
program,
28-
aleoFunction,
28+
functionName: aleoFunction,
2929
inputs,
30-
false,
31-
);
30+
proveExecution: false,
31+
});
3232
return executionResponse.getOutputs();
3333
}
3434

create-leo-app/template-node-ts/src/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
2727

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

3236
programManager.keyProvider.cacheKeys(`${programName}:${aleoFunction}`, keyPair);
3337

@@ -41,18 +45,17 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
4145

4246
// Execute once using the key provider params defined above. This will use the cached proving keys and make
4347
// execution significantly faster.
44-
let executionResponse = await programManager.run(
48+
let executionResponse = await programManager.run({
4549
program,
46-
aleoFunction,
50+
functionName: aleoFunction,
4751
inputs,
48-
true,
49-
undefined,
52+
proveExecution: true,
5053
keyProviderParams,
51-
);
54+
});
5255
console.log("hello_hello/hello executed - result:", executionResponse.getOutputs());
5356

5457
// Verify the execution using the verifying key that was generated earlier.
55-
if (programManager.verifyExecution(executionResponse, 9_000_000)) {
58+
if (programManager.verifyExecution({ executionResponse, blockHeight: 9_000_000 })) {
5659
console.log("hello_hello/hello execution verified!");
5760
} else {
5861
throw("Execution failed verification!");

create-leo-app/template-node/index.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ async function localProgramExecution(program, programName, functionName, inputs)
2929

3030
// Pre-synthesize the program keys and then cache them in memory using key provider.
3131
console.log("Synthesizing hello_hello/hello keys");
32-
const keyPair = await programManager.synthesizeKeys(hello_hello_program, functionName, inputs);
32+
const keyPair = await programManager.synthesizeKeys({
33+
program: hello_hello_program,
34+
functionName,
35+
inputs,
36+
});
3337
programManager.keyProvider.cacheKeys(`${programName}:${functionName}`, keyPair);
3438

3539
// Specify parameters for the key provider to use search for program keys. In particular specify the cache key
@@ -39,18 +43,17 @@ async function localProgramExecution(program, programName, functionName, inputs)
3943
// Execute once using the key provider params defined above. This will use the cached proving keys and make
4044
// execution significantly faster.
4145
console.log("Executing hello_hello/hello");
42-
let executionResponse = await programManager.run(
46+
let executionResponse = await programManager.run({
4347
program,
4448
functionName,
4549
inputs,
46-
true,
47-
undefined,
50+
proveExecution: true,
4851
keyProviderParams,
49-
);
52+
});
5053
console.log("hello_hello/hello executed - result:", executionResponse.getOutputs());
5154

5255
// Verify the execution using the verifying key that was generated earlier.
53-
if (programManager.verifyExecution(executionResponse, 9_000_000)) {
56+
if (programManager.verifyExecution({ executionResponse, blockHeight: 9_000_000 })) {
5457
console.log("hello_hello/hello execution verified!");
5558
} else {
5659
throw("Execution failed verification!");
@@ -86,4 +89,4 @@ async function remoteProgramExecution(programName, functionName, inputs) {
8689
// console.log("Starting remote execute");
8790
// const auctionTicket = "{\n owner: aleo12a4wll9ax6w5355jph0dr5wt2vla5sss2t4cnch0tc3vzh643v8qcfvc7a.private,\n auction: {\n starting_bid: 1000u64.private,\n name: 35399035103896773146887283777field.private,\n item: {\n id: 2711777270856651361584090827715149911900945757872672230578290769243507539617field.private,\n offchain_data: [\n 988474637487226873250021955104421895943605632761729320744454284792013483886field.private,\n 1018595503607749325560812785092303652308909717269501712857428145700763090203field.private,\n 1866354748676879328546224733327549476838379876255164483333908854380501015560field.private,\n 17649382157field.private\n ]\n }\n },\n auction_id: 4494702806735512695876583707511065751304542460719196393147692059573188109243field.private,\n settings: {\n auction_privacy: 1field.private,\n bid_types_accepted: 2field.private\n },\n _nonce: 3369967065799891136255379173673996324404175734426175774361522329924029135340group.public,\n _version: 0u8.public\n}";
8891
// const privateBid = "{\n owner: aleo12a4wll9ax6w5355jph0dr5wt2vla5sss2t4cnch0tc3vzh643v8qcfvc7a.private,\n bid: {\n amount: 50000u64.private,\n auction_id: 4494702806735512695876583707511065751304542460719196393147692059573188109243field.private,\n bid_public_key: 7957235921075215080384898776027711008106448988910535634014947882222019778701group.private\n },\n bid_id: 7560059211950188901208146469854635725646381155467709838136796808753178551929field.private,\n _nonce: 6603986437928263590097393830337419611438422585243442121397081002092267314422group.public,\n _version: 0u8.public\n}";
89-
// await remoteProgramExecution("private_auction_test_3.aleo", "select_winner_private", [auctionTicket, privateBid]);
92+
// await remoteProgramExecution("private_auction_test_3.aleo", "select_winner_private", [auctionTicket, privateBid]);

create-leo-app/template-react-leo/src/workers/worker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ async function localProgramExecution(program, aleoFunction, inputs) {
1818
const account = new Account();
1919
programManager.setAccount(account);
2020

21-
const executionResponse = await programManager.run(
21+
const executionResponse = await programManager.run({
2222
program,
23-
aleoFunction,
23+
programName: aleoFunction,
2424
inputs,
25-
false,
26-
);
25+
proveExecution: false,
26+
});
2727
return executionResponse.getOutputs();
2828
}
2929

create-leo-app/template-vanilla/worker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ async function localProgramExecution(program, aleoFunction, inputs) {
2727
const account = new Account();
2828
programManager.setAccount(account);
2929

30-
const executionResponse = await programManager.run(
30+
const executionResponse = await programManager.run({
3131
program,
32-
aleoFunction,
32+
functionName: aleoFunction,
3333
inputs,
34-
false,
35-
);
34+
proveExecution: false,
35+
});
3636
return executionResponse.getOutputs();
3737
}
3838

0 commit comments

Comments
 (0)