create-leo-app 0.0.13

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 (126) hide show
  1. package/README.md +36 -0
  2. package/dist/index.mjs +52 -0
  3. package/index.js +3 -0
  4. package/package.json +34 -0
  5. package/template-extension/.gitignore +2 -0
  6. package/template-extension/README.md +4 -0
  7. package/template-extension/package.json +15 -0
  8. package/template-extension/rollup.config.js +21 -0
  9. package/template-extension/src/offscreen.js +1 -0
  10. package/template-extension/src/service_worker.js +20 -0
  11. package/template-extension/src/worker.js +34 -0
  12. package/template-extension/static/manifest.json +16 -0
  13. package/template-extension/static/offscreen.html +9 -0
  14. package/template-nextjs-ts/README.md +19 -0
  15. package/template-nextjs-ts/_gitignore +35 -0
  16. package/template-nextjs-ts/next-env.d.ts +5 -0
  17. package/template-nextjs-ts/next.config.js +32 -0
  18. package/template-nextjs-ts/package.json +24 -0
  19. package/template-nextjs-ts/public/aleo.svg +8 -0
  20. package/template-nextjs-ts/public/next.svg +1 -0
  21. package/template-nextjs-ts/src/app/favicon.ico +0 -0
  22. package/template-nextjs-ts/src/app/globals.css +126 -0
  23. package/template-nextjs-ts/src/app/layout.tsx +22 -0
  24. package/template-nextjs-ts/src/app/page.module.css +160 -0
  25. package/template-nextjs-ts/src/app/page.tsx +94 -0
  26. package/template-nextjs-ts/src/app/worker.ts +47 -0
  27. package/template-nextjs-ts/tsconfig.json +27 -0
  28. package/template-node/README.md +5 -0
  29. package/template-node/_gitignore +24 -0
  30. package/template-node/index.js +59 -0
  31. package/template-node/package.json +12 -0
  32. package/template-node-ts/README.md +5 -0
  33. package/template-node-ts/_gitignore +24 -0
  34. package/template-node-ts/package.json +19 -0
  35. package/template-node-ts/rollup.config.js +19 -0
  36. package/template-node-ts/src/index.ts +66 -0
  37. package/template-node-ts/tsconfig.json +15 -0
  38. package/template-offline-public-transaction-ts/README.md +52 -0
  39. package/template-offline-public-transaction-ts/_gitignore +24 -0
  40. package/template-offline-public-transaction-ts/package.json +19 -0
  41. package/template-offline-public-transaction-ts/rollup.config.js +19 -0
  42. package/template-offline-public-transaction-ts/src/helpers.ts +70 -0
  43. package/template-offline-public-transaction-ts/src/index.ts +171 -0
  44. package/template-offline-public-transaction-ts/tsconfig.json +15 -0
  45. package/template-react-leo/.babelrc +6 -0
  46. package/template-react-leo/.eslintrc.cjs +20 -0
  47. package/template-react-leo/README.md +90 -0
  48. package/template-react-leo/_gitignore +24 -0
  49. package/template-react-leo/_headers +3 -0
  50. package/template-react-leo/helloworld/.env.example +2 -0
  51. package/template-react-leo/helloworld/.gitignore +5 -0
  52. package/template-react-leo/helloworld/README.md +13 -0
  53. package/template-react-leo/helloworld/build/main.aleo +7 -0
  54. package/template-react-leo/helloworld/build/program.json +6 -0
  55. package/template-react-leo/helloworld/inputs/helloworld.in +4 -0
  56. package/template-react-leo/helloworld/program.json +6 -0
  57. package/template-react-leo/helloworld/src/main.leo +7 -0
  58. package/template-react-leo/index.html +88 -0
  59. package/template-react-leo/install.sh +30 -0
  60. package/template-react-leo/package.json +44 -0
  61. package/template-react-leo/public/favicon.ico +0 -0
  62. package/template-react-leo/src/App.css +42 -0
  63. package/template-react-leo/src/App.jsx +103 -0
  64. package/template-react-leo/src/assets/aleo.svg +5 -0
  65. package/template-react-leo/src/assets/react.svg +1 -0
  66. package/template-react-leo/src/index.css +69 -0
  67. package/template-react-leo/src/main.jsx +10 -0
  68. package/template-react-leo/src/workers/AleoWorker.js +20 -0
  69. package/template-react-leo/src/workers/worker.js +72 -0
  70. package/template-react-leo/vite.config.js +16 -0
  71. package/template-react-leo/webpack.config.js +102 -0
  72. package/template-react-managed-worker/.babelrc +6 -0
  73. package/template-react-managed-worker/.eslintrc.cjs +20 -0
  74. package/template-react-managed-worker/README.md +8 -0
  75. package/template-react-managed-worker/_gitignore +24 -0
  76. package/template-react-managed-worker/index.html +88 -0
  77. package/template-react-managed-worker/package.json +41 -0
  78. package/template-react-managed-worker/public/favicon.ico +0 -0
  79. package/template-react-managed-worker/src/App.css +42 -0
  80. package/template-react-managed-worker/src/App.jsx +78 -0
  81. package/template-react-managed-worker/src/assets/aleo.png +0 -0
  82. package/template-react-managed-worker/src/assets/react.svg +1 -0
  83. package/template-react-managed-worker/src/index.css +69 -0
  84. package/template-react-managed-worker/src/main.jsx +10 -0
  85. package/template-react-managed-worker/vite.config.js +20 -0
  86. package/template-react-managed-worker/webpack.config.js +90 -0
  87. package/template-react-ts/.babelrc +7 -0
  88. package/template-react-ts/.eslintrc.cjs +20 -0
  89. package/template-react-ts/README.md +90 -0
  90. package/template-react-ts/_gitignore +24 -0
  91. package/template-react-ts/_headers +3 -0
  92. package/template-react-ts/helloworld/.env.example +2 -0
  93. package/template-react-ts/helloworld/.gitignore +5 -0
  94. package/template-react-ts/helloworld/README.md +13 -0
  95. package/template-react-ts/helloworld/build/main.aleo +7 -0
  96. package/template-react-ts/helloworld/build/program.json +6 -0
  97. package/template-react-ts/helloworld/inputs/helloworld.in +4 -0
  98. package/template-react-ts/helloworld/program.json +6 -0
  99. package/template-react-ts/helloworld/src/main.leo +7 -0
  100. package/template-react-ts/index.html +88 -0
  101. package/template-react-ts/install.sh +30 -0
  102. package/template-react-ts/package.json +49 -0
  103. package/template-react-ts/public/favicon.ico +0 -0
  104. package/template-react-ts/src/App.css +42 -0
  105. package/template-react-ts/src/App.tsx +103 -0
  106. package/template-react-ts/src/assets/aleo.svg +5 -0
  107. package/template-react-ts/src/assets/react.svg +1 -0
  108. package/template-react-ts/src/custom.d.ts +16 -0
  109. package/template-react-ts/src/index.css +69 -0
  110. package/template-react-ts/src/main.tsx +10 -0
  111. package/template-react-ts/src/workers/AleoWorker.ts +21 -0
  112. package/template-react-ts/src/workers/worker.ts +73 -0
  113. package/template-react-ts/tsconfig.json +16 -0
  114. package/template-react-ts/vite.config.ts +16 -0
  115. package/template-react-ts/webpack.config.ts +112 -0
  116. package/template-vanilla/_gitignore +24 -0
  117. package/template-vanilla/_headers +3 -0
  118. package/template-vanilla/index.html +13 -0
  119. package/template-vanilla/javascript.svg +1 -0
  120. package/template-vanilla/main.js +48 -0
  121. package/template-vanilla/package.json +16 -0
  122. package/template-vanilla/public/aleo.svg +76 -0
  123. package/template-vanilla/public/vite.svg +1 -0
  124. package/template-vanilla/style.css +97 -0
  125. package/template-vanilla/vite.config.js +12 -0
  126. package/template-vanilla/worker.js +95 -0
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
3
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg"
5
+ width="896.000000pt" height="896.000000pt" viewBox="0 0 896.000000 896.000000"
6
+ preserveAspectRatio="xMidYMid meet">
7
+ <metadata>
8
+ Created by potrace 1.14, written by Peter Selinger 2001-2017
9
+ </metadata>
10
+ <g transform="translate(0.000000,896.000000) scale(0.100000,-0.100000)"
11
+ fill="#ffffff" stroke="none">
12
+ <path d="M3504 8848 c-21 -62 -39 -117 -40 -123 -2 -8 -162 -483 -179 -533 -2
13
+ -7 -5 -16 -6 -20 -1 -4 -15 -43 -31 -87 -16 -44 -29 -81 -29 -82 0 -2 -2 -8
14
+ -4 -15 -19 -54 -224 -669 -256 -768 -22 -69 -44 -134 -49 -145 -5 -11 -36
15
+ -103 -70 -205 -33 -102 -63 -192 -67 -200 -3 -8 -7 -19 -8 -25 -4 -13 -125
16
+ -376 -132 -395 -4 -8 -7 -17 -8 -20 -4 -18 -48 -149 -55 -165 -5 -11 -32 -92
17
+ -60 -180 -28 -88 -56 -169 -61 -180 -6 -12 -12 -30 -14 -40 -2 -11 -4 -20 -4
18
+ -20 -2 0 -371 -1097 -376 -1115 -2 -8 -15 -46 -28 -85 -13 -38 -54 -162 -91
19
+ -275 -37 -113 -71 -214 -76 -225 -16 -38 -70 -205 -70 -216 0 -6 6 -9 14 -6 7
20
+ 3 19 0 25 -6 6 -6 11 -7 11 -2 0 10 996 12 1006 3 4 -5 -29 -117 -45 -153 -5
21
+ -11 -19 -51 -32 -90 -12 -38 -24 -74 -28 -80 -3 -5 -6 -12 -6 -15 -1 -21 -82
22
+ -247 -90 -252 -5 -4 -7 -8 -3 -8 3 0 -22 -82 -56 -182 l-63 -182 -529 1 c-445
23
+ 0 -528 3 -525 14 2 8 6 26 9 41 2 16 8 28 11 28 4 0 8 6 8 13 0 6 26 91 59
24
+ 187 32 96 59 177 60 180 0 3 3 12 7 20 6 15 29 87 34 105 1 6 16 48 33 95 17
25
+ 47 35 101 41 120 6 19 12 40 13 45 2 6 4 13 5 17 1 4 8 26 17 49 8 23 12 44 9
26
+ 47 -5 5 -1044 6 -1050 1 -3 -4 -164 -474 -170 -499 -2 -8 -35 -108 -74 -221
27
+ -38 -114 -71 -215 -73 -225 -3 -17 23 -18 517 -19 286 -1 523 -3 527 -3 3 -1
28
+ -34 -120 -83 -265 -49 -144 -91 -271 -94 -282 -3 -11 -29 -91 -59 -178 -30
29
+ -86 -55 -158 -55 -160 0 -1 -2 -9 -5 -17 -15 -41 -297 -885 -302 -905 -2 -5
30
+ -22 -64 -44 -130 -23 -66 -43 -127 -45 -135 -2 -8 -9 -28 -16 -45 -7 -16 -13
31
+ -32 -14 -35 -1 -3 -8 -25 -15 -50 -7 -25 -14 -47 -15 -50 -1 -3 -7 -18 -14
32
+ -34 -6 -16 -13 -36 -15 -45 -2 -9 -6 -24 -10 -33 -4 -9 -9 -22 -10 -30 -2 -7
33
+ -6 -20 -9 -28 -14 -34 -107 -314 -107 -322 0 -4 238 -8 530 -8 l529 0 12 23
34
+ c7 12 11 22 10 22 -1 0 0 7 3 15 3 8 39 119 81 245 42 127 79 237 82 245 3 8
35
+ 7 22 9 31 2 9 9 29 15 45 13 32 16 39 22 69 3 11 15 45 27 75 12 30 24 66 27
36
+ 79 2 14 7 29 11 35 3 6 7 16 8 21 2 12 102 313 111 335 4 8 7 17 8 20 1 3 4
37
+ 12 7 20 3 8 40 121 82 250 43 129 81 244 86 255 8 18 87 254 93 280 2 6 13 42
38
+ 26 80 30 91 31 95 30 98 -1 2 12 38 37 102 4 11 8 22 9 25 0 3 16 50 34 105
39
+ 33 101 40 123 41 128 0 1 13 36 28 77 l28 75 2003 1 2003 0 9 -20 c19 -48 695
40
+ -2069 704 -2106 2 -8 4 -16 5 -17 2 -2 3 -6 5 -10 1 -5 4 -15 8 -23 3 -8 29
41
+ -87 57 -175 28 -88 55 -169 60 -180 16 -37 61 -184 58 -188 -2 -2 3 -11 11
42
+ -20 12 -15 64 -17 561 -17 l548 0 -5 23 c-3 12 -10 28 -16 35 -5 6 -7 12 -3
43
+ 12 3 0 -3 21 -13 48 -10 26 -19 49 -19 52 -1 7 -11 38 -28 83 -8 20 -14 38
44
+ -13 40 0 1 -2 9 -5 17 -3 8 -46 139 -96 290 -50 151 -94 282 -97 290 -4 8 -7
45
+ 17 -7 20 -3 13 -108 327 -115 345 -10 24 -72 206 -75 220 -4 20 -117 360 -126
46
+ 380 -8 18 -212 630 -216 648 -1 4 -3 9 -4 12 -1 3 -3 8 -5 13 -1 4 -4 14 -8
47
+ 22 -10 28 -51 155 -53 168 -1 8 -6 21 -10 30 -4 9 -8 20 -9 25 -2 4 -3 8 -4
48
+ 10 -2 4 -173 512 -177 527 -2 8 -31 96 -65 195 -34 99 -61 186 -62 193 0 6 -3
49
+ 12 -7 12 -4 0 -7 6 -7 13 0 10 -413 1255 -430 1297 -3 8 -7 20 -9 25 -3 14
50
+ -104 317 -111 335 -4 8 -7 17 -7 20 -5 16 -68 208 -75 225 -9 20 -50 141 -55
51
+ 160 -6 26 -18 62 -26 80 -5 11 -13 36 -19 55 -5 19 -17 55 -26 80 -9 25 -18
52
+ 52 -20 60 -2 8 -20 62 -40 120 -20 58 -38 112 -40 120 -6 24 -246 743 -255
53
+ 765 -8 17 -73 211 -76 225 0 3 -3 12 -7 20 -7 19 -71 213 -72 220 0 3 -6 15
54
+ -13 28 -7 12 -10 22 -7 22 3 0 -1 16 -9 35 -9 20 -15 38 -16 40 0 3 0 6 0 8 0
55
+ 1 -30 88 -65 192 -36 105 -67 197 -69 205 -2 9 -52 159 -111 335 -59 176 -108
56
+ 325 -110 330 -1 6 -5 17 -8 25 -18 42 -35 100 -30 100 3 0 1 6 -4 13 -5 6 -15
57
+ 31 -23 55 l-13 42 -1013 0 -1012 0 -38 -112z m1289 -858 c4 -4 159 -465 162
58
+ -480 5 -27 120 -358 127 -367 6 -7 8 -13 5 -13 -3 0 15 -60 39 -132 25 -73 47
59
+ -140 49 -148 4 -21 55 -170 65 -195 8 -19 33 -94 35 -105 2 -11 37 -116 45
60
+ -135 9 -21 32 -92 36 -110 1 -5 13 -41 26 -80 14 -38 37 -108 52 -155 15 -47
61
+ 30 -92 33 -100 4 -8 7 -17 8 -20 1 -3 4 -12 7 -20 3 -8 18 -53 32 -100 15 -47
62
+ 30 -92 33 -100 4 -8 7 -18 8 -22 2 -5 4 -10 5 -13 1 -3 3 -8 4 -12 3 -15 28
63
+ -88 36 -108 4 -11 14 -40 21 -65 7 -25 16 -49 19 -55 6 -8 33 -99 35 -115 1
64
+ -5 25 -74 45 -125 4 -11 13 -38 19 -60 7 -22 16 -49 20 -60 5 -11 14 -38 20
65
+ -60 7 -22 16 -49 21 -60 5 -11 23 -67 41 -125 17 -58 35 -109 39 -115 3 -5 12
66
+ -30 19 -55 6 -25 16 -54 20 -65 5 -11 14 -38 20 -60 7 -22 16 -49 21 -60 9
67
+ -21 91 -272 95 -289 1 -6 5 -18 8 -26 22 -55 44 -130 39 -134 -3 -3 -1 -6 5
68
+ -6 5 0 10 -6 10 -12 0 -7 21 -75 47 -150 25 -76 46 -142 46 -147 0 -5 -696 -9
69
+ -1675 -9 -991 0 -1675 4 -1675 9 0 5 23 77 51 160 28 83 52 156 54 162 1 7 5
70
+ 20 8 30 4 9 10 25 14 35 3 9 7 22 9 27 1 6 91 276 199 600 109 325 198 595
71
+ 200 600 1 6 5 19 9 30 24 63 34 91 36 100 1 6 4 15 6 20 29 83 116 344 118
72
+ 355 4 13 138 421 152 460 3 8 5 15 5 15 0 0 79 234 175 520 96 286 176 528
73
+ 179 538 2 10 25 80 51 155 26 75 47 143 47 150 0 6 3 12 7 12 4 0 7 6 7 13 0
74
+ 18 86 271 95 277 8 7 505 6 511 0z"/>
75
+ </g>
76
+ </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="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,97 @@
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
+ #app {
40
+ max-width: 1280px;
41
+ margin: 0 auto;
42
+ padding: 2rem;
43
+ text-align: center;
44
+ }
45
+
46
+ .logo {
47
+ height: 6em;
48
+ padding: 1.5em;
49
+ will-change: filter;
50
+ transition: filter 300ms;
51
+ }
52
+ .logo:hover {
53
+ filter: drop-shadow(0 0 2em #646cffaa);
54
+ }
55
+ .logo.vanilla:hover {
56
+ filter: drop-shadow(0 0 2em #f7df1eaa);
57
+ }
58
+
59
+ .card {
60
+ padding: 2em;
61
+ }
62
+
63
+ .read-the-docs {
64
+ color: #888;
65
+ }
66
+
67
+ button {
68
+ border-radius: 8px;
69
+ border: 1px solid transparent;
70
+ padding: 0.6em 1.2em;
71
+ font-size: 1em;
72
+ font-weight: 500;
73
+ font-family: inherit;
74
+ background-color: #1a1a1a;
75
+ cursor: pointer;
76
+ transition: border-color 0.25s;
77
+ }
78
+ button:hover {
79
+ border-color: #646cff;
80
+ }
81
+ button:focus,
82
+ button:focus-visible {
83
+ outline: 4px auto -webkit-focus-ring-color;
84
+ }
85
+
86
+ @media (prefers-color-scheme: light) {
87
+ :root {
88
+ color: #213547;
89
+ background-color: #ffffff;
90
+ }
91
+ a:hover {
92
+ color: #747bff;
93
+ }
94
+ button {
95
+ background-color: #f9f9f9;
96
+ }
97
+ }
@@ -0,0 +1,12 @@
1
+ import { defineConfig } from "vite";
2
+ export default defineConfig({
3
+ optimizeDeps: {
4
+ exclude: ["@provablehq/wasm", "@provablehq/sdk"],
5
+ },
6
+ server: {
7
+ headers: {
8
+ "Cross-Origin-Opener-Policy": "same-origin",
9
+ "Cross-Origin-Embedder-Policy": "require-corp",
10
+ },
11
+ },
12
+ });
@@ -0,0 +1,95 @@
1
+ import {
2
+ Account,
3
+ ProgramManager,
4
+ PrivateKey,
5
+ initThreadPool,
6
+ AleoKeyProvider,
7
+ AleoNetworkClient,
8
+ NetworkRecordProvider,
9
+ } from "@provablehq/sdk";
10
+
11
+ await initThreadPool();
12
+
13
+ // A program name must be unique. To deploy the program, you should change the name from hello_hello.aleo to something else that is unique.
14
+ const hello_hello_program =`
15
+ program hello_hello.aleo;
16
+
17
+ function hello:
18
+ input r0 as u32.public;
19
+ input r1 as u32.private;
20
+ add r0 r1 into r2;
21
+ output r2 as u32.private;`
22
+
23
+ async function localProgramExecution(program, aleoFunction, inputs) {
24
+ const programManager = new ProgramManager();
25
+
26
+ // Create a temporary account for the execution of the program
27
+ const account = new Account();
28
+ programManager.setAccount(account);
29
+
30
+ const executionResponse = await programManager.run(
31
+ program,
32
+ aleoFunction,
33
+ inputs,
34
+ false,
35
+ );
36
+ return executionResponse.getOutputs();
37
+ }
38
+
39
+ function getPrivateKey() {
40
+ return new PrivateKey().to_string();
41
+ }
42
+
43
+ async function deployProgram(program) {
44
+ const keyProvider = new AleoKeyProvider();
45
+ keyProvider.useCache(true);
46
+
47
+ // Create a record provider that will be used to find records and transaction data for Aleo programs
48
+ const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
49
+
50
+ // Use existing account with funds
51
+ const account = new Account({
52
+ privateKey: "user1PrivateKey",
53
+ });
54
+
55
+ const recordProvider = new NetworkRecordProvider(account, networkClient);
56
+
57
+ // Initialize a program manager to talk to the Aleo network with the configured key and record providers
58
+ const programManager = new ProgramManager(
59
+ "https://api.explorer.aleo.org/v1",
60
+ keyProvider,
61
+ recordProvider,
62
+ );
63
+
64
+ programManager.setAccount(account);
65
+
66
+ // Define a fee to pay to deploy the program
67
+ const fee = 1.9; // 1.9 Aleo credits
68
+
69
+ // Deploy the program to the Aleo network
70
+ const tx_id = await programManager.deploy(program, fee);
71
+
72
+ // Optional: Pass in fee record manually to avoid long scan times
73
+ // const feeRecord = "{ owner: aleo1xxx...xxx.private, microcredits: 2000000u64.private, _nonce: 123...789group.public}";
74
+ // const tx_id = await programManager.deploy(program, fee, undefined, feeRecord);
75
+
76
+ return tx_id;
77
+ }
78
+
79
+ onmessage = async function (e) {
80
+ if (e.data === "execute") {
81
+ const result = await localProgramExecution(hello_hello_program, "hello", ["5u32", "5u32"]);
82
+ postMessage(result);
83
+ } else if (e.data === "key") {
84
+ const result = getPrivateKey();
85
+ postMessage(result);
86
+ } else if (e.data === "deploy") {
87
+ try {
88
+ const result = await deployProgram(hello_hello_program);
89
+ postMessage(result);
90
+ } catch (error) {
91
+ postMessage({ error: error.message });
92
+ }
93
+ }
94
+
95
+ };