create-leo-app 0.7.2 → 0.8.2

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.
Files changed (121) hide show
  1. package/README.md +3 -3
  2. package/dist/index.mjs +38 -38
  3. package/package.json +14 -8
  4. package/template-extension/README.md +4 -0
  5. package/template-extension/package.json +15 -0
  6. package/template-extension/rollup.config.js +21 -0
  7. package/template-extension/src/offscreen.js +1 -0
  8. package/template-extension/src/service_worker.js +20 -0
  9. package/template-extension/src/worker.js +34 -0
  10. package/template-extension/static/manifest.json +16 -0
  11. package/template-extension/static/offscreen.html +9 -0
  12. package/template-nextjs-ts/README.md +19 -0
  13. package/template-nextjs-ts/_gitignore +35 -0
  14. package/template-nextjs-ts/next-env.d.ts +5 -0
  15. package/template-nextjs-ts/next.config.js +32 -0
  16. package/template-nextjs-ts/package.json +24 -0
  17. package/template-nextjs-ts/public/aleo.svg +8 -0
  18. package/template-nextjs-ts/public/next.svg +1 -0
  19. package/template-nextjs-ts/src/app/favicon.ico +0 -0
  20. package/template-nextjs-ts/src/app/globals.css +126 -0
  21. package/template-nextjs-ts/src/app/layout.tsx +22 -0
  22. package/template-nextjs-ts/src/app/page.module.css +160 -0
  23. package/template-nextjs-ts/src/app/page.tsx +94 -0
  24. package/template-nextjs-ts/src/app/worker.ts +47 -0
  25. package/template-nextjs-ts/tsconfig.json +27 -0
  26. package/template-node/README.md +5 -0
  27. package/template-node/_gitignore +24 -0
  28. package/template-node/package.json +12 -0
  29. package/template-node-ts/README.md +5 -0
  30. package/template-node-ts/_gitignore +24 -0
  31. package/template-node-ts/package.json +19 -0
  32. package/template-node-ts/rollup.config.js +19 -0
  33. package/template-node-ts/src/index.ts +65 -0
  34. package/template-node-ts/tsconfig.json +15 -0
  35. package/template-offline-public-transaction-ts/README.md +52 -0
  36. package/template-offline-public-transaction-ts/_gitignore +24 -0
  37. package/template-offline-public-transaction-ts/package.json +19 -0
  38. package/template-offline-public-transaction-ts/rollup.config.js +19 -0
  39. package/template-offline-public-transaction-ts/src/helpers.ts +70 -0
  40. package/template-offline-public-transaction-ts/src/index.ts +171 -0
  41. package/template-offline-public-transaction-ts/tsconfig.json +15 -0
  42. package/template-react-leo/.babelrc +6 -0
  43. package/template-react-leo/.eslintrc.cjs +20 -0
  44. package/template-react-leo/README.md +85 -0
  45. package/template-react-leo/_gitignore +24 -0
  46. package/template-react-leo/_headers +3 -0
  47. package/template-react-leo/helloworld/.env.example +2 -0
  48. package/template-react-leo/helloworld/README.md +13 -0
  49. package/template-react-leo/helloworld/build/main.aleo +7 -0
  50. package/template-react-leo/helloworld/build/program.json +6 -0
  51. package/template-react-leo/helloworld/inputs/helloworld.in +4 -0
  52. package/template-react-leo/helloworld/program.json +6 -0
  53. package/template-react-leo/helloworld/src/main.leo +7 -0
  54. package/template-react-leo/index.html +88 -0
  55. package/template-react-leo/install.sh +30 -0
  56. package/template-react-leo/package.json +44 -0
  57. package/template-react-leo/public/favicon.ico +0 -0
  58. package/template-react-leo/src/App.css +42 -0
  59. package/template-react-leo/src/App.jsx +103 -0
  60. package/template-react-leo/src/assets/aleo.svg +5 -0
  61. package/template-react-leo/src/assets/react.svg +1 -0
  62. package/template-react-leo/src/index.css +69 -0
  63. package/template-react-leo/src/main.jsx +10 -0
  64. package/template-react-leo/src/workers/AleoWorker.js +20 -0
  65. package/template-react-leo/src/workers/worker.js +72 -0
  66. package/template-react-leo/vite.config.js +17 -0
  67. package/template-react-leo/webpack.config.js +102 -0
  68. package/template-react-managed-worker/.babelrc +6 -0
  69. package/template-react-managed-worker/.eslintrc.cjs +20 -0
  70. package/template-react-managed-worker/README.md +6 -0
  71. package/template-react-managed-worker/_gitignore +24 -0
  72. package/template-react-managed-worker/index.html +88 -0
  73. package/template-react-managed-worker/package.json +41 -0
  74. package/template-react-managed-worker/public/favicon.ico +0 -0
  75. package/template-react-managed-worker/src/App.css +42 -0
  76. package/template-react-managed-worker/src/App.jsx +78 -0
  77. package/template-react-managed-worker/src/assets/aleo.png +0 -0
  78. package/template-react-managed-worker/src/assets/react.svg +1 -0
  79. package/template-react-managed-worker/src/index.css +69 -0
  80. package/template-react-managed-worker/src/main.jsx +10 -0
  81. package/template-react-managed-worker/vite.config.js +21 -0
  82. package/template-react-managed-worker/webpack.config.js +90 -0
  83. package/template-react-ts/.babelrc +7 -0
  84. package/template-react-ts/.eslintrc.cjs +20 -0
  85. package/template-react-ts/README.md +85 -0
  86. package/template-react-ts/_gitignore +24 -0
  87. package/template-react-ts/_headers +3 -0
  88. package/template-react-ts/helloworld/.env.example +2 -0
  89. package/template-react-ts/helloworld/README.md +13 -0
  90. package/template-react-ts/helloworld/build/main.aleo +7 -0
  91. package/template-react-ts/helloworld/build/program.json +6 -0
  92. package/template-react-ts/helloworld/inputs/helloworld.in +4 -0
  93. package/template-react-ts/helloworld/program.json +6 -0
  94. package/template-react-ts/helloworld/src/main.leo +7 -0
  95. package/template-react-ts/index.html +88 -0
  96. package/template-react-ts/install.sh +30 -0
  97. package/template-react-ts/package.json +49 -0
  98. package/template-react-ts/public/favicon.ico +0 -0
  99. package/template-react-ts/src/App.css +42 -0
  100. package/template-react-ts/src/App.tsx +103 -0
  101. package/template-react-ts/src/assets/aleo.svg +5 -0
  102. package/template-react-ts/src/assets/react.svg +1 -0
  103. package/template-react-ts/src/custom.d.ts +16 -0
  104. package/template-react-ts/src/index.css +69 -0
  105. package/template-react-ts/src/main.tsx +10 -0
  106. package/template-react-ts/src/workers/AleoWorker.ts +21 -0
  107. package/template-react-ts/src/workers/worker.ts +73 -0
  108. package/template-react-ts/tsconfig.json +16 -0
  109. package/template-react-ts/vite.config.ts +17 -0
  110. package/template-react-ts/webpack.config.ts +112 -0
  111. package/template-vanilla/_gitignore +24 -0
  112. package/template-vanilla/_headers +3 -0
  113. package/template-vanilla/index.html +13 -0
  114. package/template-vanilla/javascript.svg +1 -0
  115. package/template-vanilla/main.js +48 -0
  116. package/template-vanilla/package.json +16 -0
  117. package/template-vanilla/public/aleo.svg +76 -0
  118. package/template-vanilla/public/vite.svg +1 -0
  119. package/template-vanilla/style.css +97 -0
  120. package/template-vanilla/vite.config.js +14 -0
  121. package/template-vanilla/worker.js +95 -0
@@ -0,0 +1,6 @@
1
+ {
2
+ "program": "helloworld.aleo",
3
+ "version": "0.0.0",
4
+ "description": "",
5
+ "license": "MIT"
6
+ }
@@ -0,0 +1,4 @@
1
+ // The program input for helloworld/src/main.leo
2
+ [main]
3
+ public a: u32 = 1u32;
4
+ b: u32 = 2u32;
@@ -0,0 +1,6 @@
1
+ {
2
+ "program": "helloworld.aleo",
3
+ "version": "0.0.0",
4
+ "description": "",
5
+ "license": "MIT"
6
+ }
@@ -0,0 +1,7 @@
1
+ // The 'helloworld' program.
2
+ program helloworld.aleo {
3
+ transition main(public a: u32, b: u32) -> u32 {
4
+ let c: u32 = a + b;
5
+ return c;
6
+ }
7
+ }
@@ -0,0 +1,88 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href="public/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Aleo + React</title>
8
+ <style>
9
+ body {
10
+ background: #000000;
11
+ }
12
+ .spinner {
13
+ margin: 150px auto 50px auto;
14
+ width: 40px;
15
+ height: 40px;
16
+ position: relative;
17
+ text-align: center;
18
+
19
+ -webkit-animation: sk-rotate 2s infinite linear;
20
+ animation: sk-rotate 2s infinite linear;
21
+ }
22
+
23
+ .dot1,
24
+ .dot2 {
25
+ width: 60%;
26
+ height: 60%;
27
+ display: inline-block;
28
+ position: absolute;
29
+ top: 0;
30
+ background-color: #00C0F9;
31
+ border-radius: 100%;
32
+
33
+ -webkit-animation: sk-bounce 2s infinite ease-in-out;
34
+ animation: sk-bounce 2s infinite ease-in-out;
35
+ }
36
+
37
+ .dot2 {
38
+ top: auto;
39
+ bottom: 0;
40
+ -webkit-animation-delay: -1s;
41
+ animation-delay: -1s;
42
+ }
43
+
44
+ @-webkit-keyframes sk-rotate {
45
+ 100% {
46
+ -webkit-transform: rotate(360deg);
47
+ }
48
+ }
49
+ @keyframes sk-rotate {
50
+ 100% {
51
+ transform: rotate(360deg);
52
+ -webkit-transform: rotate(360deg);
53
+ }
54
+ }
55
+
56
+ @-webkit-keyframes sk-bounce {
57
+ 0%,
58
+ 100% {
59
+ -webkit-transform: scale(0);
60
+ }
61
+ 50% {
62
+ -webkit-transform: scale(1);
63
+ }
64
+ }
65
+
66
+ @keyframes sk-bounce {
67
+ 0%,
68
+ 100% {
69
+ transform: scale(0);
70
+ -webkit-transform: scale(0);
71
+ }
72
+ 50% {
73
+ transform: scale(1);
74
+ -webkit-transform: scale(1);
75
+ }
76
+ }
77
+ </style>
78
+ </head>
79
+ <body>
80
+ <div id="root">
81
+ <div class="spinner">
82
+ <div class="dot1"></div>
83
+ <div class="dot2"></div>
84
+ </div>
85
+ </div>
86
+ <script type="module" src="/src/main.tsx"></script>
87
+ </body>
88
+ </html>
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+
3
+ # script exists immediately if command fails
4
+ set -e
5
+
6
+ # check for dependencies
7
+ command -v git >/dev/null 2>&1 || { echo >&2 "git is required but it's not installed. Aborting."; exit 1; }
8
+ command -v cargo >/dev/null 2>&1 || { echo >&2 "cargo is required but it's not installed. Aborting."; exit 1; }
9
+
10
+ INSTALL_DIR="${INSTALL_DIR:-$HOME/.leo}"
11
+
12
+ # ask for confirmation
13
+ read -p "This script will install Leo into $INSTALL_DIR. Do you want to continue? (y/N) " choice
14
+ case "$choice" in
15
+ y|Y ) echo "Continuing installation...";;
16
+ * ) echo "Aborting."; exit;;
17
+ esac
18
+
19
+ # clone or update the repo
20
+ if [ -d "$INSTALL_DIR" ]; then
21
+ echo "Directory $INSTALL_DIR exists. Updating repository..."
22
+ git -C "$INSTALL_DIR" pull
23
+ else
24
+ echo "Cloning repository into $INSTALL_DIR..."
25
+ git clone https://github.com/ProvableHQ/leo "$INSTALL_DIR"
26
+ fi
27
+
28
+ # build and install
29
+ echo "Building and installing from source..."
30
+ cargo install --path "$INSTALL_DIR"
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "aleo-react-typescript-starter",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "webpack",
8
+ "dev-webpack": "webpack serve",
9
+ "build:vite": "vite build",
10
+ "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
11
+ "preview": "vite preview",
12
+ "install-leo": "./install.sh"
13
+ },
14
+ "dependencies": {
15
+ "@provablehq/sdk": "^0.8.0",
16
+ "comlink": "^4.4.2",
17
+ "react": "^19.0.0",
18
+ "react-dom": "^19.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "@babel/core": "^7.26.7",
22
+ "@babel/preset-env": "^7.26.7",
23
+ "@babel/preset-react": "^7.26.3",
24
+ "@babel/preset-typescript": "^7.26.0",
25
+ "@types/babel__generator": "^7.6.8",
26
+ "@types/node": "^22.12.0",
27
+ "@types/react": "^19.0.8",
28
+ "@types/react-dom": "^19.0.3",
29
+ "@vitejs/plugin-react": "^4.3.4",
30
+ "babel-loader": "^9.2.1",
31
+ "copy-webpack-plugin": "^12.0.2",
32
+ "css-loader": "^7.1.2",
33
+ "eslint": "^9.19.0",
34
+ "eslint-plugin-react": "^7.37.4",
35
+ "eslint-plugin-react-hooks": "^5.1.0",
36
+ "eslint-plugin-react-refresh": "^0.4.18",
37
+ "file-loader": "^6.2.0",
38
+ "html-webpack-plugin": "^5.6.3",
39
+ "raw-loader": "^4.0.2",
40
+ "style-loader": "^4.0.0",
41
+ "svg-url-loader": "^8.0.0",
42
+ "ts-node": "^10.9.2",
43
+ "typescript": "^5.7.3",
44
+ "vite": "^6.0.11",
45
+ "webpack": "^5.97.1",
46
+ "webpack-cli": "^6.0.1",
47
+ "webpack-dev-server": "^5.2.0"
48
+ }
49
+ }
@@ -0,0 +1,42 @@
1
+ #root {
2
+ max-width: 1280px;
3
+ margin: 0 auto;
4
+ padding: 2rem;
5
+ text-align: center;
6
+ }
7
+
8
+ .logo {
9
+ height: 6em;
10
+ padding: 1.5em;
11
+ will-change: filter;
12
+ transition: filter 300ms;
13
+ }
14
+ .logo:hover {
15
+ filter: drop-shadow(0 0 2em #646cffaa);
16
+ }
17
+ .logo.react:hover {
18
+ filter: drop-shadow(0 0 2em #61dafbaa);
19
+ }
20
+
21
+ @keyframes logo-spin {
22
+ from {
23
+ transform: rotate(0deg);
24
+ }
25
+ to {
26
+ transform: rotate(360deg);
27
+ }
28
+ }
29
+
30
+ @media (prefers-reduced-motion: no-preference) {
31
+ a:nth-of-type(2) .logo {
32
+ animation: logo-spin infinite 20s linear;
33
+ }
34
+ }
35
+
36
+ .card {
37
+ padding: 2em;
38
+ }
39
+
40
+ .read-the-docs {
41
+ color: #888;
42
+ }
@@ -0,0 +1,103 @@
1
+ import { useState } from "react";
2
+ import reactLogo from "./assets/react.svg";
3
+ import aleoLogo from "./assets/aleo.svg";
4
+ import "./App.css";
5
+ import helloworld_program from "../helloworld/build/main.aleo?raw";
6
+ import { AleoWorker } from "./workers/AleoWorker";
7
+
8
+ const aleoWorker = AleoWorker();
9
+ function App() {
10
+ const [count, setCount] = useState(0);
11
+ const [account, setAccount] = useState(null);
12
+ const [executing, setExecuting] = useState(false);
13
+ const [deploying, setDeploying] = useState(false);
14
+
15
+ const generateAccount = async () => {
16
+ const key = await aleoWorker.getPrivateKey();
17
+ setAccount(await key.to_string());
18
+ };
19
+
20
+ async function execute() {
21
+ setExecuting(true);
22
+ const result = await aleoWorker.localProgramExecution(
23
+ helloworld_program,
24
+ "main",
25
+ ["5u32", "5u32"],
26
+ );
27
+ setExecuting(false);
28
+
29
+ alert(JSON.stringify(result));
30
+ }
31
+
32
+ async function deploy() {
33
+ setDeploying(true);
34
+ try {
35
+ const result = await aleoWorker.deployProgram(helloworld_program);
36
+ console.log("Transaction:")
37
+ console.log("https://explorer.hamp.app/transaction?id=" + result)
38
+ alert("Transaction ID: " + result);
39
+ } catch (e) {
40
+ console.log(e)
41
+ alert("Error with deployment, please check console for details");
42
+ }
43
+ setDeploying(false);
44
+ }
45
+
46
+ return (
47
+ <>
48
+ <div>
49
+ <a href="https://provable.com" target="_blank">
50
+ <img src={aleoLogo} className="logo" alt="Aleo logo" />
51
+ </a>
52
+ <a href="https://react.dev" target="_blank">
53
+ <img src={reactLogo} className="logo react" alt="React logo" />
54
+ </a>
55
+ </div>
56
+ <h1>Aleo + React</h1>
57
+ <div className="card">
58
+ <button onClick={() => setCount((count) => count + 1)}>
59
+ count is {count}
60
+ </button>
61
+ <p>
62
+ <button onClick={generateAccount}>
63
+ {account
64
+ ? `Account private key is ${JSON.stringify(account)}`
65
+ : `Click to generate account`}
66
+ </button>
67
+ </p>
68
+ <p>
69
+ <button disabled={executing} onClick={execute}>
70
+ {executing
71
+ ? `Executing...check console for details...`
72
+ : `Execute helloworld.aleo`}
73
+ </button>
74
+ </p>
75
+ <p>
76
+ Edit <code>src/App.tsx</code> and save to test HMR
77
+ </p>
78
+ </div>
79
+
80
+ {/* Advanced Section */}
81
+ <div className="card">
82
+ <h2>Advanced Actions</h2>
83
+ <p>
84
+ Deployment on Aleo requires certain prerequisites like seeding your
85
+ wallet with credits and retrieving a fee record. Check README for more
86
+ details.
87
+ </p>
88
+ <p>
89
+ <button disabled={deploying} onClick={deploy}>
90
+ {deploying
91
+ ? `Deploying...check console for details...`
92
+ : `Deploy helloworld.aleo`}
93
+ </button>
94
+ </p>
95
+ </div>
96
+ <p className="read-the-docs">
97
+ Click on the Aleo and React logos to learn more
98
+ </p>
99
+ </>
100
+ );
101
+ }
102
+
103
+ export default App;
@@ -0,0 +1,5 @@
1
+ <svg width="76" height="80" viewBox="0 0 76 80" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M47.886 0H29.4601L13.4679 46.7704H23.2068L36.1609 8.61481H40.8513L53.8036 46.7704H23.2068L20.193 55.3852H56.7073L65.0811 80H75.1314L47.886 0Z" fill="#F5F5F5"/>
3
+ <path d="M2.10278 80H11.8174L20.193 55.3852L10.5213 55.3852L2.10278 80Z" fill="#F5F5F5"/>
4
+ <path d="M3.81482 46.7704L0.868164 55.3852H10.5213L13.4679 46.7704H3.81482Z" fill="#F5F5F5"/>
5
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1,16 @@
1
+ declare module '*.svg' {
2
+ const content: any;
3
+ export default content;
4
+ }
5
+
6
+ declare module '*.aleo' {
7
+ const content: string;
8
+ export default content;
9
+ }
10
+
11
+ declare module '*?raw' {
12
+ const content: string;
13
+ export default content;
14
+ }
15
+
16
+
@@ -0,0 +1,69 @@
1
+ :root {
2
+ font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
3
+ line-height: 1.5;
4
+ font-weight: 400;
5
+
6
+ color-scheme: light dark;
7
+ color: rgba(255, 255, 255, 0.87);
8
+ background-color: #242424;
9
+
10
+ font-synthesis: none;
11
+ text-rendering: optimizeLegibility;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ -webkit-text-size-adjust: 100%;
15
+ }
16
+
17
+ a {
18
+ font-weight: 500;
19
+ color: #646cff;
20
+ text-decoration: inherit;
21
+ }
22
+ a:hover {
23
+ color: #535bf2;
24
+ }
25
+
26
+ body {
27
+ margin: 0;
28
+ display: flex;
29
+ place-items: center;
30
+ min-width: 320px;
31
+ min-height: 100vh;
32
+ }
33
+
34
+ h1 {
35
+ font-size: 3.2em;
36
+ line-height: 1.1;
37
+ }
38
+
39
+ button {
40
+ border-radius: 8px;
41
+ border: 1px solid transparent;
42
+ padding: 0.6em 1.2em;
43
+ font-size: 1em;
44
+ font-weight: 500;
45
+ font-family: inherit;
46
+ background-color: #1a1a1a;
47
+ cursor: pointer;
48
+ transition: border-color 0.25s;
49
+ }
50
+ button:hover {
51
+ border-color: #646cff;
52
+ }
53
+ button:focus,
54
+ button:focus-visible {
55
+ outline: 4px auto -webkit-focus-ring-color;
56
+ }
57
+
58
+ @media (prefers-color-scheme: light) {
59
+ :root {
60
+ color: #213547;
61
+ background-color: #ffffff;
62
+ }
63
+ a:hover {
64
+ color: #747bff;
65
+ }
66
+ button {
67
+ background-color: #f9f9f9;
68
+ }
69
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import ReactDOM from "react-dom/client";
3
+ import App from "./App";
4
+ import "./index.css";
5
+
6
+ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
+ );
@@ -0,0 +1,21 @@
1
+ //@ts-nocheck
2
+ import { wrap } from "comlink";
3
+
4
+ let singletonWorker = null;
5
+
6
+ const AleoWorker = () => {
7
+ if (!singletonWorker) {
8
+ const worker = new Worker(new URL("worker", import.meta.url), {
9
+ type: "module",
10
+ });
11
+
12
+ worker.onerror = function(event) {
13
+ console.error("Error in worker: " + event?.message);
14
+ };
15
+
16
+ singletonWorker = wrap(worker);
17
+ }
18
+ return singletonWorker;
19
+ };
20
+
21
+ export { AleoWorker };
@@ -0,0 +1,73 @@
1
+ //@ts-nocheck
2
+ import {
3
+ Account,
4
+ ProgramManager,
5
+ PrivateKey,
6
+ initThreadPool,
7
+ AleoKeyProvider,
8
+ AleoNetworkClient,
9
+ NetworkRecordProvider,
10
+ } from "@provablehq/sdk";
11
+ import { expose, proxy } from "comlink";
12
+
13
+ await initThreadPool();
14
+
15
+ async function localProgramExecution(program, aleoFunction, inputs) {
16
+ const programManager = new ProgramManager();
17
+
18
+ // Create a temporary account for the execution of the program
19
+ const account = new Account();
20
+ programManager.setAccount(account);
21
+
22
+ const executionResponse = await programManager.run(
23
+ program,
24
+ aleoFunction,
25
+ inputs,
26
+ false,
27
+ );
28
+ return executionResponse.getOutputs();
29
+ }
30
+
31
+ async function getPrivateKey() {
32
+ const key = new PrivateKey();
33
+ return proxy(key);
34
+ }
35
+
36
+ async function deployProgram(program) {
37
+ const keyProvider = new AleoKeyProvider();
38
+ keyProvider.useCache(true);
39
+
40
+ // Create a record provider that will be used to find records and transaction data for Aleo programs
41
+ const networkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
42
+
43
+ // Use existing account with funds
44
+ const account = new Account({
45
+ privateKey: "user1PrivateKey",
46
+ });
47
+
48
+ const recordProvider = new NetworkRecordProvider(account, networkClient);
49
+
50
+ // Initialize a program manager to talk to the Aleo network with the configured key and record providers
51
+ const programManager = new ProgramManager(
52
+ "https://api.explorer.provable.com/v1",
53
+ keyProvider,
54
+ recordProvider,
55
+ );
56
+
57
+ programManager.setAccount(account);
58
+
59
+ // Define a fee to pay to deploy the program
60
+ const fee = 1.9; // 1.9 Aleo credits
61
+
62
+ // Deploy the program to the Aleo network
63
+ const tx_id = await programManager.deploy(program, fee);
64
+
65
+ // Optional: Pass in fee record manually to avoid long scan times
66
+ // const feeRecord = "{ owner: aleo1xxx...xxx.private, microcredits: 2000000u64.private, _nonce: 123...789group.public}";
67
+ // const tx_id = await programManager.deploy(program, fee, undefined, feeRecord);
68
+
69
+ return tx_id;
70
+ }
71
+
72
+ const workerMethods = { localProgramExecution, getPrivateKey, deployProgram };
73
+ expose(workerMethods);
@@ -0,0 +1,16 @@
1
+ {
2
+ "include": ["src", "__tests__", "src/custom.d.ts"],
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "target": "ES2015",
6
+ "moduleResolution": "Bundler",
7
+ "strict": true,
8
+ "skipLibCheck": true,
9
+ "declaration": false,
10
+ "sourceMap": false,
11
+ "noUnusedLocals": true,
12
+ "esModuleInterop": true,
13
+ "allowSyntheticDefaultImports": true,
14
+ "jsx":"react-jsx",
15
+ }
16
+ }
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ assetsInclude: ['**/*.wasm'],
7
+ plugins: [react()],
8
+ optimizeDeps: {
9
+ exclude: ["@provablehq/wasm"],
10
+ },
11
+ server: {
12
+ headers: {
13
+ "Cross-Origin-Opener-Policy": "same-origin",
14
+ "Cross-Origin-Embedder-Policy": "require-corp",
15
+ },
16
+ },
17
+ });