create-leo-app 0.9.6 → 0.9.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-leo-app",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "type": "module",
5
5
  "license": "GPL-3.0",
6
6
  "collaborators": [
@@ -7,7 +7,7 @@
7
7
  "build": "rimraf static/js && rollup --config"
8
8
  },
9
9
  "devDependencies": {
10
- "@provablehq/sdk": "^0.9.6",
10
+ "@provablehq/sdk": "^0.9.8",
11
11
  "@web/rollup-plugin-import-meta-assets": "^2.2.1",
12
12
  "rimraf": "^6.0.1",
13
13
  "rollup": "^4.32.0"
@@ -9,7 +9,7 @@
9
9
  "lint": "next lint"
10
10
  },
11
11
  "dependencies": {
12
- "@provablehq/sdk": "^0.9.6",
12
+ "@provablehq/sdk": "^0.9.8",
13
13
  "next": "15.2.3",
14
14
  "react": "^19.0.0",
15
15
  "react-dom": "^19.0.0",
@@ -1,6 +1,8 @@
1
- import {Account, initThreadPool, ProgramManager, AleoKeyProvider, AleoKeyProviderParams} from "@provablehq/sdk";
1
+ import {Account, AleoKeyProvider, AleoKeyProviderParams, initThreadPool, ProgramManager, PrivateKey} from "@provablehq/sdk";
2
2
 
3
- await initThreadPool();
3
+ import * as process from "node:process";
4
+
5
+ // await initThreadPool();
4
6
 
5
7
  const programName = "hello_hello.aleo"
6
8
 
@@ -13,7 +15,7 @@ function hello:
13
15
  add r0 r1 into r2;
14
16
  output r2 as u32.private;`
15
17
 
16
- async function localProgramExecution(program, programName, aleoFunction, inputs) {
18
+ async function localProgramExecution(program, programName, functionName, inputs) {
17
19
  const programManager = new ProgramManager();
18
20
 
19
21
  // Create a temporary account for the execution of the program
@@ -25,19 +27,21 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
25
27
  keyProvider.useCache(true);
26
28
  programManager.setKeyProvider(keyProvider);
27
29
 
28
- // 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);
30
- programManager.keyProvider.cacheKeys(`${programName}:${aleoFunction}`, keyPair);
30
+ // Pre-synthesize the program keys and then cache them in memory using key provider.
31
+ console.log("Synthesizing hello_hello/hello keys");
32
+ const keyPair = await programManager.synthesizeKeys(hello_hello_program, functionName, inputs);
33
+ programManager.keyProvider.cacheKeys(`${programName}:${functionName}`, keyPair);
31
34
 
32
35
  // Specify parameters for the key provider to use search for program keys. In particular specify the cache key
33
36
  // that was used to cache the keys in the previous step.
34
- const keyProviderParams = new AleoKeyProviderParams({cacheKey: `${programName}:${aleoFunction}`});
37
+ const keyProviderParams = new AleoKeyProviderParams({cacheKey: `${programName}:${functionName}`});
35
38
 
36
39
  // Execute once using the key provider params defined above. This will use the cached proving keys and make
37
40
  // execution significantly faster.
41
+ console.log("Executing hello_hello/hello");
38
42
  let executionResponse = await programManager.run(
39
43
  program,
40
- aleoFunction,
44
+ functionName,
41
45
  inputs,
42
46
  true,
43
47
  undefined,
@@ -53,7 +57,33 @@ async function localProgramExecution(program, programName, aleoFunction, inputs)
53
57
  }
54
58
  }
55
59
 
56
- const start = Date.now();
57
- console.log("Starting execute!");
58
- await localProgramExecution(hello_hello_program, programName, "hello", ["5u32", "5u32"]);
59
- console.log("Execute finished!", Date.now() - start);
60
+ // Create a remote program execution transaction.
61
+ async function remoteProgramExecution(programName, functionName, inputs) {
62
+ // Create a key provider in order to re-use the same key for each execution
63
+ const keyProvider = new AleoKeyProvider();
64
+ keyProvider.useCache(true);
65
+
66
+ const programManager = new ProgramManager("http://34.168.156.3:3030", keyProvider);
67
+
68
+ const tx = await programManager.buildExecutionTransaction(
69
+ {
70
+ programName,
71
+ functionName,
72
+ priorityFee: 0,
73
+ privateFee: false,
74
+ inputs,
75
+ privateKey: PrivateKey.from_string(process.env["PUZZLE_PK"])
76
+ }
77
+ );
78
+ console.log("Resulting transaction")
79
+ }
80
+
81
+ // const start = Date.now();
82
+ // console.log("Starting local execute!");
83
+ // await localProgramExecution(hello_hello_program, programName, "hello", ["5u32", "5u32"]);
84
+ // console.log("Local execute finished!", Date.now() - start);
85
+ //
86
+ // console.log("Starting remote execute");
87
+ // 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}";
88
+ // 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]);
@@ -7,6 +7,6 @@
7
7
  "dev": "node index.js"
8
8
  },
9
9
  "dependencies": {
10
- "@provablehq/sdk": "^0.9.6"
10
+ "@provablehq/sdk": "^0.9.8"
11
11
  }
12
12
  }
@@ -8,7 +8,7 @@
8
8
  "dev": "npm run build && node dist/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@provablehq/sdk": "^0.9.6"
11
+ "@provablehq/sdk": "^0.9.8"
12
12
  },
13
13
  "devDependencies": {
14
14
  "rimraf": "^6.0.1",
@@ -8,7 +8,7 @@
8
8
  "dev": "npm run build && node dist/index.js"
9
9
  },
10
10
  "dependencies": {
11
- "@provablehq/sdk": "^0.9.6"
11
+ "@provablehq/sdk": "^0.9.8"
12
12
  },
13
13
  "devDependencies": {
14
14
  "rimraf": "^6.0.1",
@@ -12,7 +12,7 @@
12
12
  "install-leo": "./install.sh"
13
13
  },
14
14
  "dependencies": {
15
- "@provablehq/sdk": "^0.9.6",
15
+ "@provablehq/sdk": "^0.9.8",
16
16
  "comlink": "^4.4.2",
17
17
  "react": "^19.0.0",
18
18
  "react-dom": "^19.0.0"
@@ -11,7 +11,7 @@
11
11
  "preview": "vite preview"
12
12
  },
13
13
  "dependencies": {
14
- "@provablehq/sdk": "^0.9.6",
14
+ "@provablehq/sdk": "^0.9.8",
15
15
  "react": "^19.0.0",
16
16
  "react-dom": "^19.0.0"
17
17
  },
@@ -12,7 +12,7 @@
12
12
  "install-leo": "./install.sh"
13
13
  },
14
14
  "dependencies": {
15
- "@provablehq/sdk": "^0.9.6",
15
+ "@provablehq/sdk": "^0.9.8",
16
16
  "comlink": "^4.4.2",
17
17
  "react": "^19.0.0",
18
18
  "react-dom": "^19.0.0"
@@ -9,7 +9,7 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "devDependencies": {
12
- "@provablehq/sdk": "^0.9.6",
12
+ "@provablehq/sdk": "^0.9.8",
13
13
  "tslib": "^2.8.1",
14
14
  "vite": "^6.1.2"
15
15
  }