From 26e10d4742208b89db26de6ae37c72264614cfe3 Mon Sep 17 00:00:00 2001 From: christianwwwwwwww Date: Thu, 18 Jul 2024 14:46:54 -0700 Subject: [PATCH] update SDK READMEs and name changes --- .circleci/config.yml | 8 +- README.md | 14 +- {create-aleo-app => create-leo-app}/README.md | 17 +- .../build.config.ts | 0 {create-aleo-app => create-leo-app}/index.js | 0 .../package.json | 6 +- .../src/index.ts | 0 .../template-extension/.gitignore | 0 .../template-extension/README.md | 0 .../template-extension/package.json | 0 .../template-extension/rollup.config.js | 0 .../template-extension/src/offscreen.js | 0 .../template-extension/src/service_worker.js | 0 .../template-extension/src/worker.js | 0 .../template-extension/static/manifest.json | 0 .../template-extension/static/offscreen.html | 0 .../template-nextjs-ts/README.md | 0 .../template-nextjs-ts/_gitignore | 0 .../template-nextjs-ts/next-env.d.ts | 0 .../template-nextjs-ts/next.config.js | 0 .../template-nextjs-ts/package.json | 0 .../template-nextjs-ts/public/aleo.svg | 0 .../template-nextjs-ts/public/next.svg | 0 .../template-nextjs-ts/src/app/favicon.ico | Bin .../template-nextjs-ts/src/app/globals.css | 0 .../template-nextjs-ts/src/app/layout.tsx | 0 .../src/app/page.module.css | 0 .../template-nextjs-ts/src/app/page.tsx | 2 +- .../template-nextjs-ts/src/app/worker.ts | 0 .../template-nextjs-ts/tsconfig.json | 0 .../template-node-ts/README.md | 0 .../template-node-ts/_gitignore | 0 .../template-node-ts/package.json | 0 .../template-node-ts/rollup.config.js | 0 .../template-node-ts/src/index.ts | 0 .../template-node-ts/tsconfig.json | 0 .../template-node/README.md | 0 .../template-node/_gitignore | 0 .../template-node/index.js | 0 .../template-node/package.json | 0 .../README.md | 0 .../_gitignore | 0 .../package.json | 0 .../rollup.config.js | 0 .../src/helpers.ts | 0 .../src/index.ts | 0 .../tsconfig.json | 0 .../template-react-leo/.babelrc | 0 .../template-react-leo/.eslintrc.cjs | 0 .../template-react-leo/README.md | 2 +- .../template-react-leo/_gitignore | 0 .../template-react-leo/_headers | 0 .../helloworld/.env.example | 0 .../template-react-leo/helloworld/.gitignore | 0 .../template-react-leo/helloworld/README.md | 0 .../helloworld/build/main.aleo | 0 .../helloworld/build/program.json | 0 .../helloworld/inputs/helloworld.in | 0 .../helloworld/program.json | 0 .../helloworld/src/main.leo | 0 .../template-react-leo/index.html | 0 .../template-react-leo/install.sh | 0 .../template-react-leo/package.json | 0 .../template-react-leo/public/favicon.ico | Bin .../template-react-leo/src/App.css | 0 .../template-react-leo/src/App.jsx | 2 +- .../template-react-leo/src/assets/aleo.svg | 0 .../template-react-leo/src/assets/react.svg | 0 .../template-react-leo/src/index.css | 0 .../template-react-leo/src/main.jsx | 0 .../src/workers/AleoWorker.js | 0 .../template-react-leo/src/workers/worker.js | 0 .../template-react-leo/vite.config.js | 0 .../template-react-leo/webpack.config.js | 0 .../template-react-managed-worker/.babelrc | 0 .../.eslintrc.cjs | 0 .../template-react-managed-worker/README.md | 0 .../template-react-managed-worker/_gitignore | 0 .../template-react-managed-worker/index.html | 0 .../package.json | 0 .../public/favicon.ico | Bin .../template-react-managed-worker/src/App.css | 0 .../template-react-managed-worker/src/App.jsx | 4 +- .../src/assets/aleo.png | Bin .../src/assets/react.svg | 0 .../src/index.css | 0 .../src/main.jsx | 0 .../vite.config.js | 0 .../webpack.config.js | 0 .../template-react-ts/.babelrc | 0 .../template-react-ts/.eslintrc.cjs | 0 .../template-react-ts/README.md | 2 +- .../template-react-ts/_gitignore | 0 .../template-react-ts/_headers | 0 .../template-react-ts/helloworld/.env.example | 0 .../template-react-ts/helloworld/.gitignore | 0 .../template-react-ts/helloworld/README.md | 0 .../helloworld/build/main.aleo | 0 .../helloworld/build/program.json | 0 .../helloworld/inputs/helloworld.in | 0 .../template-react-ts/helloworld/program.json | 0 .../template-react-ts/helloworld/src/main.leo | 0 .../template-react-ts/index.html | 0 .../template-react-ts/install.sh | 0 .../template-react-ts/package.json | 0 .../template-react-ts/public/favicon.ico | Bin .../template-react-ts/src/App.css | 0 .../template-react-ts/src/App.tsx | 2 +- .../template-react-ts/src/assets/aleo.svg | 0 .../template-react-ts/src/assets/react.svg | 0 .../template-react-ts/src/custom.d.ts | 0 .../template-react-ts/src/index.css | 0 .../template-react-ts/src/main.tsx | 0 .../src/workers/AleoWorker.ts | 0 .../template-react-ts/src/workers/worker.ts | 2 +- .../template-react-ts/tsconfig.json | 0 .../template-react-ts/vite.config.ts | 0 .../template-react-ts/webpack.config.ts | 0 .../template-vanilla/_gitignore | 0 .../template-vanilla/_headers | 0 .../template-vanilla/index.html | 2 +- .../template-vanilla/javascript.svg | 0 .../template-vanilla/main.js | 0 .../template-vanilla/package.json | 0 .../template-vanilla/public/aleo.svg | 0 .../template-vanilla/public/vite.svg | 0 .../template-vanilla/style.css | 0 .../template-vanilla/vite.config.js | 0 .../template-vanilla/worker.js | 0 .../tsconfig.json | 0 index.js | 31 ++ package.json | 5 +- sdk/README.md | 461 +++++------------- sdk/package.json | 4 +- sdk/src/program-manager.ts | 2 +- sdk/src/worker.ts | 6 +- wasm/Cargo.toml | 2 +- wasm/package.json | 2 +- website/src/workers/worker.js | 2 +- 139 files changed, 186 insertions(+), 392 deletions(-) rename {create-aleo-app => create-leo-app}/README.md (65%) rename {create-aleo-app => create-leo-app}/build.config.ts (100%) rename {create-aleo-app => create-leo-app}/index.js (100%) rename {create-aleo-app => create-leo-app}/package.json (83%) rename {create-aleo-app => create-leo-app}/src/index.ts (100%) rename {create-aleo-app => create-leo-app}/template-extension/.gitignore (100%) rename {create-aleo-app => create-leo-app}/template-extension/README.md (100%) rename {create-aleo-app => create-leo-app}/template-extension/package.json (100%) rename {create-aleo-app => create-leo-app}/template-extension/rollup.config.js (100%) rename {create-aleo-app => create-leo-app}/template-extension/src/offscreen.js (100%) rename {create-aleo-app => create-leo-app}/template-extension/src/service_worker.js (100%) rename {create-aleo-app => create-leo-app}/template-extension/src/worker.js (100%) rename {create-aleo-app => create-leo-app}/template-extension/static/manifest.json (100%) rename {create-aleo-app => create-leo-app}/template-extension/static/offscreen.html (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/README.md (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/next-env.d.ts (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/next.config.js (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/package.json (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/public/aleo.svg (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/public/next.svg (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/src/app/favicon.ico (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/src/app/globals.css (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/src/app/layout.tsx (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/src/app/page.module.css (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/src/app/page.tsx (97%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/src/app/worker.ts (100%) rename {create-aleo-app => create-leo-app}/template-nextjs-ts/tsconfig.json (100%) rename {create-aleo-app => create-leo-app}/template-node-ts/README.md (100%) rename {create-aleo-app => create-leo-app}/template-node-ts/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-node-ts/package.json (100%) rename {create-aleo-app => create-leo-app}/template-node-ts/rollup.config.js (100%) rename {create-aleo-app => create-leo-app}/template-node-ts/src/index.ts (100%) rename {create-aleo-app => create-leo-app}/template-node-ts/tsconfig.json (100%) rename {create-aleo-app => create-leo-app}/template-node/README.md (100%) rename {create-aleo-app => create-leo-app}/template-node/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-node/index.js (100%) rename {create-aleo-app => create-leo-app}/template-node/package.json (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/README.md (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/package.json (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/rollup.config.js (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/src/helpers.ts (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/src/index.ts (100%) rename {create-aleo-app => create-leo-app}/template-offline-public-transaction-ts/tsconfig.json (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/.babelrc (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/.eslintrc.cjs (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/README.md (98%) rename {create-aleo-app => create-leo-app}/template-react-leo/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/_headers (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/.env.example (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/.gitignore (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/README.md (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/build/main.aleo (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/build/program.json (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/inputs/helloworld.in (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/program.json (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/helloworld/src/main.leo (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/index.html (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/install.sh (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/package.json (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/public/favicon.ico (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/App.css (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/App.jsx (97%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/assets/aleo.svg (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/assets/react.svg (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/index.css (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/main.jsx (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/workers/AleoWorker.js (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/src/workers/worker.js (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/vite.config.js (100%) rename {create-aleo-app => create-leo-app}/template-react-leo/webpack.config.js (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/.babelrc (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/.eslintrc.cjs (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/README.md (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/index.html (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/package.json (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/public/favicon.ico (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/src/App.css (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/src/App.jsx (90%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/src/assets/aleo.png (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/src/assets/react.svg (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/src/index.css (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/src/main.jsx (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/vite.config.js (100%) rename {create-aleo-app => create-leo-app}/template-react-managed-worker/webpack.config.js (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/.babelrc (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/.eslintrc.cjs (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/README.md (98%) rename {create-aleo-app => create-leo-app}/template-react-ts/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/_headers (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/.env.example (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/.gitignore (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/README.md (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/build/main.aleo (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/build/program.json (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/inputs/helloworld.in (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/program.json (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/helloworld/src/main.leo (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/index.html (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/install.sh (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/package.json (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/public/favicon.ico (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/App.css (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/App.tsx (97%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/assets/aleo.svg (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/assets/react.svg (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/custom.d.ts (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/index.css (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/main.tsx (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/workers/AleoWorker.ts (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/src/workers/worker.ts (96%) rename {create-aleo-app => create-leo-app}/template-react-ts/tsconfig.json (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/vite.config.ts (100%) rename {create-aleo-app => create-leo-app}/template-react-ts/webpack.config.ts (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/_gitignore (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/_headers (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/index.html (91%) rename {create-aleo-app => create-leo-app}/template-vanilla/javascript.svg (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/main.js (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/package.json (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/public/aleo.svg (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/public/vite.svg (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/style.css (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/vite.config.js (100%) rename {create-aleo-app => create-leo-app}/template-vanilla/worker.js (100%) rename {create-aleo-app => create-leo-app}/tsconfig.json (100%) create mode 100644 index.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 7bca81371..395b5623f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -78,7 +78,7 @@ jobs: steps: - setup-sdk - run: - working_directory: create-aleo-app/template-node + working_directory: create-leo-app/template-node command: | yarn start @@ -87,7 +87,7 @@ jobs: steps: - setup-sdk - run: - working_directory: create-aleo-app/template-node-ts + working_directory: create-leo-app/template-node-ts command: | yarn start @@ -96,7 +96,7 @@ jobs: steps: - setup-sdk - run: - working_directory: create-aleo-app/template-extension + working_directory: create-leo-app/template-extension command: | yarn build @@ -105,7 +105,7 @@ jobs: steps: - setup-sdk - run: - working_directory: create-aleo-app/template-react-leo + working_directory: create-leo-app/template-react-leo command: | yarn build diff --git a/README.md b/README.md index e4ee1351f..963a9b082 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The [Aleo SDK](https://github.com/ProvableHQ/sdk) provides tools for building zero-knowledge applications. It consists of several TypeScript & JavaScript libraries which provide the following functionality: -1. [Aleo account management](https://provable.tools/account) +1. [Aleo account management](https://provable.tools/account) 2. [Web-based program execution and deployment](https://provable.tools/develop) 3. [Aleo credit transfers](https://provable.tools/transfer) 4. [Management of program state and data](https://provable.tools/record) @@ -34,17 +34,17 @@ first zero-knowledge web app. #### Source: [`Aleo SDK`](https://www.npmjs.com/package/@provablehq/sdk) -## 2. Create-Aleo-App - Zero-Knowledge Web App Examples - Create Aleo App +## 2. Create-Leo-App - Zero-Knowledge Web App Examples + Create Leo App -Create-aleo-app provides zero-knowledge web app examples in common web frameworks such as React. Developers looking to +Create-leo-app provides zero-knowledge web app examples in common web frameworks such as React. Developers looking to start with working examples should start here. -#### Source: [`sdk/create-aleo-app`](https://github.com/ProvableHQ/sdk/tree/testnet3/create-aleo-app) +#### Source: [`sdk/create-leo-app`](https://github.com/ProvableHQ/sdk/tree/testnet3/create-leo-app) ## 3. Aleo Wasm - Zero-Knowledge Algorithms in JavaScript + WebAssembly - Create Aleo App - Create Aleo App + Create Leo App + Create Leo App Aleo-Wasm Aleo Wasm is a Rust crate which compiles the Aleo source code responsible for creating and executing zero-knowledge programs into diff --git a/create-aleo-app/README.md b/create-leo-app/README.md similarity index 65% rename from create-aleo-app/README.md rename to create-leo-app/README.md index 3503fc678..268476ce5 100644 --- a/create-aleo-app/README.md +++ b/create-leo-app/README.md @@ -1,14 +1,14 @@ -# create-aleo-app +# create-leo-app ## Scaffolding Your First Aleo Project > **Compatibility Note:** -> [Node.js](https://nodejs.org/en/) version 18+ +> Please use [Node.js](https://nodejs.org/en/) version 18+ With NPM: ```bash -npm create aleo-app@latest +npm create leo-app@latest ``` Then follow the prompts! @@ -17,18 +17,17 @@ You can also directly specify the project name and the template you want to use ```bash # npm 6.x -npm create aleo-app@latest my-aleo-app --template react +npm create leo-app@latest my-leo-app --template react # npm 7+, extra double-dash is needed: -npm create aleo-app@latest my-aleo-app -- --template react +npm create leo-app@latest my-leo-app -- --template react ``` Currently supported template presets include: -- `vanilla` -- `react-leo` -- `node` -- `nextjs-ts` +- `Vanilla` +- `React (JavaScript + Leo, React + TypeScript, or TypeScript + Next.js)` +- `Node.js` You can use `.` for the project name to scaffold in the current directory. diff --git a/create-aleo-app/build.config.ts b/create-leo-app/build.config.ts similarity index 100% rename from create-aleo-app/build.config.ts rename to create-leo-app/build.config.ts diff --git a/create-aleo-app/index.js b/create-leo-app/index.js similarity index 100% rename from create-aleo-app/index.js rename to create-leo-app/index.js diff --git a/create-aleo-app/package.json b/create-leo-app/package.json similarity index 83% rename from create-aleo-app/package.json rename to create-leo-app/package.json index d8074e1d3..11c48699d 100644 --- a/create-aleo-app/package.json +++ b/create-leo-app/package.json @@ -1,13 +1,13 @@ { - "name": "create-aleo-app", + "name": "create-leo-app", "version": "0.0.12", "type": "module", "license": "GPL-3.0", "collaborators": [ - "The Provable Team " + "The Provable Team" ], "bin": { - "create-aleo-app": "index.js" + "create-leo-app": "index.js" }, "files": [ "index.js", diff --git a/create-aleo-app/src/index.ts b/create-leo-app/src/index.ts similarity index 100% rename from create-aleo-app/src/index.ts rename to create-leo-app/src/index.ts diff --git a/create-aleo-app/template-extension/.gitignore b/create-leo-app/template-extension/.gitignore similarity index 100% rename from create-aleo-app/template-extension/.gitignore rename to create-leo-app/template-extension/.gitignore diff --git a/create-aleo-app/template-extension/README.md b/create-leo-app/template-extension/README.md similarity index 100% rename from create-aleo-app/template-extension/README.md rename to create-leo-app/template-extension/README.md diff --git a/create-aleo-app/template-extension/package.json b/create-leo-app/template-extension/package.json similarity index 100% rename from create-aleo-app/template-extension/package.json rename to create-leo-app/template-extension/package.json diff --git a/create-aleo-app/template-extension/rollup.config.js b/create-leo-app/template-extension/rollup.config.js similarity index 100% rename from create-aleo-app/template-extension/rollup.config.js rename to create-leo-app/template-extension/rollup.config.js diff --git a/create-aleo-app/template-extension/src/offscreen.js b/create-leo-app/template-extension/src/offscreen.js similarity index 100% rename from create-aleo-app/template-extension/src/offscreen.js rename to create-leo-app/template-extension/src/offscreen.js diff --git a/create-aleo-app/template-extension/src/service_worker.js b/create-leo-app/template-extension/src/service_worker.js similarity index 100% rename from create-aleo-app/template-extension/src/service_worker.js rename to create-leo-app/template-extension/src/service_worker.js diff --git a/create-aleo-app/template-extension/src/worker.js b/create-leo-app/template-extension/src/worker.js similarity index 100% rename from create-aleo-app/template-extension/src/worker.js rename to create-leo-app/template-extension/src/worker.js diff --git a/create-aleo-app/template-extension/static/manifest.json b/create-leo-app/template-extension/static/manifest.json similarity index 100% rename from create-aleo-app/template-extension/static/manifest.json rename to create-leo-app/template-extension/static/manifest.json diff --git a/create-aleo-app/template-extension/static/offscreen.html b/create-leo-app/template-extension/static/offscreen.html similarity index 100% rename from create-aleo-app/template-extension/static/offscreen.html rename to create-leo-app/template-extension/static/offscreen.html diff --git a/create-aleo-app/template-nextjs-ts/README.md b/create-leo-app/template-nextjs-ts/README.md similarity index 100% rename from create-aleo-app/template-nextjs-ts/README.md rename to create-leo-app/template-nextjs-ts/README.md diff --git a/create-aleo-app/template-nextjs-ts/_gitignore b/create-leo-app/template-nextjs-ts/_gitignore similarity index 100% rename from create-aleo-app/template-nextjs-ts/_gitignore rename to create-leo-app/template-nextjs-ts/_gitignore diff --git a/create-aleo-app/template-nextjs-ts/next-env.d.ts b/create-leo-app/template-nextjs-ts/next-env.d.ts similarity index 100% rename from create-aleo-app/template-nextjs-ts/next-env.d.ts rename to create-leo-app/template-nextjs-ts/next-env.d.ts diff --git a/create-aleo-app/template-nextjs-ts/next.config.js b/create-leo-app/template-nextjs-ts/next.config.js similarity index 100% rename from create-aleo-app/template-nextjs-ts/next.config.js rename to create-leo-app/template-nextjs-ts/next.config.js diff --git a/create-aleo-app/template-nextjs-ts/package.json b/create-leo-app/template-nextjs-ts/package.json similarity index 100% rename from create-aleo-app/template-nextjs-ts/package.json rename to create-leo-app/template-nextjs-ts/package.json diff --git a/create-aleo-app/template-nextjs-ts/public/aleo.svg b/create-leo-app/template-nextjs-ts/public/aleo.svg similarity index 100% rename from create-aleo-app/template-nextjs-ts/public/aleo.svg rename to create-leo-app/template-nextjs-ts/public/aleo.svg diff --git a/create-aleo-app/template-nextjs-ts/public/next.svg b/create-leo-app/template-nextjs-ts/public/next.svg similarity index 100% rename from create-aleo-app/template-nextjs-ts/public/next.svg rename to create-leo-app/template-nextjs-ts/public/next.svg diff --git a/create-aleo-app/template-nextjs-ts/src/app/favicon.ico b/create-leo-app/template-nextjs-ts/src/app/favicon.ico similarity index 100% rename from create-aleo-app/template-nextjs-ts/src/app/favicon.ico rename to create-leo-app/template-nextjs-ts/src/app/favicon.ico diff --git a/create-aleo-app/template-nextjs-ts/src/app/globals.css b/create-leo-app/template-nextjs-ts/src/app/globals.css similarity index 100% rename from create-aleo-app/template-nextjs-ts/src/app/globals.css rename to create-leo-app/template-nextjs-ts/src/app/globals.css diff --git a/create-aleo-app/template-nextjs-ts/src/app/layout.tsx b/create-leo-app/template-nextjs-ts/src/app/layout.tsx similarity index 100% rename from create-aleo-app/template-nextjs-ts/src/app/layout.tsx rename to create-leo-app/template-nextjs-ts/src/app/layout.tsx diff --git a/create-aleo-app/template-nextjs-ts/src/app/page.module.css b/create-leo-app/template-nextjs-ts/src/app/page.module.css similarity index 100% rename from create-aleo-app/template-nextjs-ts/src/app/page.module.css rename to create-leo-app/template-nextjs-ts/src/app/page.module.css diff --git a/create-aleo-app/template-nextjs-ts/src/app/page.tsx b/create-leo-app/template-nextjs-ts/src/app/page.tsx similarity index 97% rename from create-aleo-app/template-nextjs-ts/src/app/page.tsx rename to create-leo-app/template-nextjs-ts/src/app/page.tsx index 4ac0104a5..a5eaf0591 100644 --- a/create-aleo-app/template-nextjs-ts/src/app/page.tsx +++ b/create-leo-app/template-nextjs-ts/src/app/page.tsx @@ -77,7 +77,7 @@ export default function Home() {

diff --git a/create-aleo-app/template-nextjs-ts/src/app/worker.ts b/create-leo-app/template-nextjs-ts/src/app/worker.ts similarity index 100% rename from create-aleo-app/template-nextjs-ts/src/app/worker.ts rename to create-leo-app/template-nextjs-ts/src/app/worker.ts diff --git a/create-aleo-app/template-nextjs-ts/tsconfig.json b/create-leo-app/template-nextjs-ts/tsconfig.json similarity index 100% rename from create-aleo-app/template-nextjs-ts/tsconfig.json rename to create-leo-app/template-nextjs-ts/tsconfig.json diff --git a/create-aleo-app/template-node-ts/README.md b/create-leo-app/template-node-ts/README.md similarity index 100% rename from create-aleo-app/template-node-ts/README.md rename to create-leo-app/template-node-ts/README.md diff --git a/create-aleo-app/template-node-ts/_gitignore b/create-leo-app/template-node-ts/_gitignore similarity index 100% rename from create-aleo-app/template-node-ts/_gitignore rename to create-leo-app/template-node-ts/_gitignore diff --git a/create-aleo-app/template-node-ts/package.json b/create-leo-app/template-node-ts/package.json similarity index 100% rename from create-aleo-app/template-node-ts/package.json rename to create-leo-app/template-node-ts/package.json diff --git a/create-aleo-app/template-node-ts/rollup.config.js b/create-leo-app/template-node-ts/rollup.config.js similarity index 100% rename from create-aleo-app/template-node-ts/rollup.config.js rename to create-leo-app/template-node-ts/rollup.config.js diff --git a/create-aleo-app/template-node-ts/src/index.ts b/create-leo-app/template-node-ts/src/index.ts similarity index 100% rename from create-aleo-app/template-node-ts/src/index.ts rename to create-leo-app/template-node-ts/src/index.ts diff --git a/create-aleo-app/template-node-ts/tsconfig.json b/create-leo-app/template-node-ts/tsconfig.json similarity index 100% rename from create-aleo-app/template-node-ts/tsconfig.json rename to create-leo-app/template-node-ts/tsconfig.json diff --git a/create-aleo-app/template-node/README.md b/create-leo-app/template-node/README.md similarity index 100% rename from create-aleo-app/template-node/README.md rename to create-leo-app/template-node/README.md diff --git a/create-aleo-app/template-node/_gitignore b/create-leo-app/template-node/_gitignore similarity index 100% rename from create-aleo-app/template-node/_gitignore rename to create-leo-app/template-node/_gitignore diff --git a/create-aleo-app/template-node/index.js b/create-leo-app/template-node/index.js similarity index 100% rename from create-aleo-app/template-node/index.js rename to create-leo-app/template-node/index.js diff --git a/create-aleo-app/template-node/package.json b/create-leo-app/template-node/package.json similarity index 100% rename from create-aleo-app/template-node/package.json rename to create-leo-app/template-node/package.json diff --git a/create-aleo-app/template-offline-public-transaction-ts/README.md b/create-leo-app/template-offline-public-transaction-ts/README.md similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/README.md rename to create-leo-app/template-offline-public-transaction-ts/README.md diff --git a/create-aleo-app/template-offline-public-transaction-ts/_gitignore b/create-leo-app/template-offline-public-transaction-ts/_gitignore similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/_gitignore rename to create-leo-app/template-offline-public-transaction-ts/_gitignore diff --git a/create-aleo-app/template-offline-public-transaction-ts/package.json b/create-leo-app/template-offline-public-transaction-ts/package.json similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/package.json rename to create-leo-app/template-offline-public-transaction-ts/package.json diff --git a/create-aleo-app/template-offline-public-transaction-ts/rollup.config.js b/create-leo-app/template-offline-public-transaction-ts/rollup.config.js similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/rollup.config.js rename to create-leo-app/template-offline-public-transaction-ts/rollup.config.js diff --git a/create-aleo-app/template-offline-public-transaction-ts/src/helpers.ts b/create-leo-app/template-offline-public-transaction-ts/src/helpers.ts similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/src/helpers.ts rename to create-leo-app/template-offline-public-transaction-ts/src/helpers.ts diff --git a/create-aleo-app/template-offline-public-transaction-ts/src/index.ts b/create-leo-app/template-offline-public-transaction-ts/src/index.ts similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/src/index.ts rename to create-leo-app/template-offline-public-transaction-ts/src/index.ts diff --git a/create-aleo-app/template-offline-public-transaction-ts/tsconfig.json b/create-leo-app/template-offline-public-transaction-ts/tsconfig.json similarity index 100% rename from create-aleo-app/template-offline-public-transaction-ts/tsconfig.json rename to create-leo-app/template-offline-public-transaction-ts/tsconfig.json diff --git a/create-aleo-app/template-react-leo/.babelrc b/create-leo-app/template-react-leo/.babelrc similarity index 100% rename from create-aleo-app/template-react-leo/.babelrc rename to create-leo-app/template-react-leo/.babelrc diff --git a/create-aleo-app/template-react-leo/.eslintrc.cjs b/create-leo-app/template-react-leo/.eslintrc.cjs similarity index 100% rename from create-aleo-app/template-react-leo/.eslintrc.cjs rename to create-leo-app/template-react-leo/.eslintrc.cjs diff --git a/create-aleo-app/template-react-leo/README.md b/create-leo-app/template-react-leo/README.md similarity index 98% rename from create-aleo-app/template-react-leo/README.md rename to create-leo-app/template-react-leo/README.md index 74e4f46fb..14e510447 100644 --- a/create-aleo-app/template-react-leo/README.md +++ b/create-leo-app/template-react-leo/README.md @@ -1,6 +1,6 @@ # React + Aleo + Leo -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-aleo-app/template-react-leo) +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-react-leo) This template provides a minimal setup to get React and Aleo working in Vite with HMR and some ESLint rules. diff --git a/create-aleo-app/template-react-leo/_gitignore b/create-leo-app/template-react-leo/_gitignore similarity index 100% rename from create-aleo-app/template-react-leo/_gitignore rename to create-leo-app/template-react-leo/_gitignore diff --git a/create-aleo-app/template-react-leo/_headers b/create-leo-app/template-react-leo/_headers similarity index 100% rename from create-aleo-app/template-react-leo/_headers rename to create-leo-app/template-react-leo/_headers diff --git a/create-aleo-app/template-react-leo/helloworld/.env.example b/create-leo-app/template-react-leo/helloworld/.env.example similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/.env.example rename to create-leo-app/template-react-leo/helloworld/.env.example diff --git a/create-aleo-app/template-react-leo/helloworld/.gitignore b/create-leo-app/template-react-leo/helloworld/.gitignore similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/.gitignore rename to create-leo-app/template-react-leo/helloworld/.gitignore diff --git a/create-aleo-app/template-react-leo/helloworld/README.md b/create-leo-app/template-react-leo/helloworld/README.md similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/README.md rename to create-leo-app/template-react-leo/helloworld/README.md diff --git a/create-aleo-app/template-react-leo/helloworld/build/main.aleo b/create-leo-app/template-react-leo/helloworld/build/main.aleo similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/build/main.aleo rename to create-leo-app/template-react-leo/helloworld/build/main.aleo diff --git a/create-aleo-app/template-react-leo/helloworld/build/program.json b/create-leo-app/template-react-leo/helloworld/build/program.json similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/build/program.json rename to create-leo-app/template-react-leo/helloworld/build/program.json diff --git a/create-aleo-app/template-react-leo/helloworld/inputs/helloworld.in b/create-leo-app/template-react-leo/helloworld/inputs/helloworld.in similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/inputs/helloworld.in rename to create-leo-app/template-react-leo/helloworld/inputs/helloworld.in diff --git a/create-aleo-app/template-react-leo/helloworld/program.json b/create-leo-app/template-react-leo/helloworld/program.json similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/program.json rename to create-leo-app/template-react-leo/helloworld/program.json diff --git a/create-aleo-app/template-react-leo/helloworld/src/main.leo b/create-leo-app/template-react-leo/helloworld/src/main.leo similarity index 100% rename from create-aleo-app/template-react-leo/helloworld/src/main.leo rename to create-leo-app/template-react-leo/helloworld/src/main.leo diff --git a/create-aleo-app/template-react-leo/index.html b/create-leo-app/template-react-leo/index.html similarity index 100% rename from create-aleo-app/template-react-leo/index.html rename to create-leo-app/template-react-leo/index.html diff --git a/create-aleo-app/template-react-leo/install.sh b/create-leo-app/template-react-leo/install.sh similarity index 100% rename from create-aleo-app/template-react-leo/install.sh rename to create-leo-app/template-react-leo/install.sh diff --git a/create-aleo-app/template-react-leo/package.json b/create-leo-app/template-react-leo/package.json similarity index 100% rename from create-aleo-app/template-react-leo/package.json rename to create-leo-app/template-react-leo/package.json diff --git a/create-aleo-app/template-react-leo/public/favicon.ico b/create-leo-app/template-react-leo/public/favicon.ico similarity index 100% rename from create-aleo-app/template-react-leo/public/favicon.ico rename to create-leo-app/template-react-leo/public/favicon.ico diff --git a/create-aleo-app/template-react-leo/src/App.css b/create-leo-app/template-react-leo/src/App.css similarity index 100% rename from create-aleo-app/template-react-leo/src/App.css rename to create-leo-app/template-react-leo/src/App.css diff --git a/create-aleo-app/template-react-leo/src/App.jsx b/create-leo-app/template-react-leo/src/App.jsx similarity index 97% rename from create-aleo-app/template-react-leo/src/App.jsx rename to create-leo-app/template-react-leo/src/App.jsx index 96f4597b2..b41f64e40 100644 --- a/create-aleo-app/template-react-leo/src/App.jsx +++ b/create-leo-app/template-react-leo/src/App.jsx @@ -61,7 +61,7 @@ function App() {

diff --git a/create-aleo-app/template-react-leo/src/assets/aleo.svg b/create-leo-app/template-react-leo/src/assets/aleo.svg similarity index 100% rename from create-aleo-app/template-react-leo/src/assets/aleo.svg rename to create-leo-app/template-react-leo/src/assets/aleo.svg diff --git a/create-aleo-app/template-react-leo/src/assets/react.svg b/create-leo-app/template-react-leo/src/assets/react.svg similarity index 100% rename from create-aleo-app/template-react-leo/src/assets/react.svg rename to create-leo-app/template-react-leo/src/assets/react.svg diff --git a/create-aleo-app/template-react-leo/src/index.css b/create-leo-app/template-react-leo/src/index.css similarity index 100% rename from create-aleo-app/template-react-leo/src/index.css rename to create-leo-app/template-react-leo/src/index.css diff --git a/create-aleo-app/template-react-leo/src/main.jsx b/create-leo-app/template-react-leo/src/main.jsx similarity index 100% rename from create-aleo-app/template-react-leo/src/main.jsx rename to create-leo-app/template-react-leo/src/main.jsx diff --git a/create-aleo-app/template-react-leo/src/workers/AleoWorker.js b/create-leo-app/template-react-leo/src/workers/AleoWorker.js similarity index 100% rename from create-aleo-app/template-react-leo/src/workers/AleoWorker.js rename to create-leo-app/template-react-leo/src/workers/AleoWorker.js diff --git a/create-aleo-app/template-react-leo/src/workers/worker.js b/create-leo-app/template-react-leo/src/workers/worker.js similarity index 100% rename from create-aleo-app/template-react-leo/src/workers/worker.js rename to create-leo-app/template-react-leo/src/workers/worker.js diff --git a/create-aleo-app/template-react-leo/vite.config.js b/create-leo-app/template-react-leo/vite.config.js similarity index 100% rename from create-aleo-app/template-react-leo/vite.config.js rename to create-leo-app/template-react-leo/vite.config.js diff --git a/create-aleo-app/template-react-leo/webpack.config.js b/create-leo-app/template-react-leo/webpack.config.js similarity index 100% rename from create-aleo-app/template-react-leo/webpack.config.js rename to create-leo-app/template-react-leo/webpack.config.js diff --git a/create-aleo-app/template-react-managed-worker/.babelrc b/create-leo-app/template-react-managed-worker/.babelrc similarity index 100% rename from create-aleo-app/template-react-managed-worker/.babelrc rename to create-leo-app/template-react-managed-worker/.babelrc diff --git a/create-aleo-app/template-react-managed-worker/.eslintrc.cjs b/create-leo-app/template-react-managed-worker/.eslintrc.cjs similarity index 100% rename from create-aleo-app/template-react-managed-worker/.eslintrc.cjs rename to create-leo-app/template-react-managed-worker/.eslintrc.cjs diff --git a/create-aleo-app/template-react-managed-worker/README.md b/create-leo-app/template-react-managed-worker/README.md similarity index 100% rename from create-aleo-app/template-react-managed-worker/README.md rename to create-leo-app/template-react-managed-worker/README.md diff --git a/create-aleo-app/template-react-managed-worker/_gitignore b/create-leo-app/template-react-managed-worker/_gitignore similarity index 100% rename from create-aleo-app/template-react-managed-worker/_gitignore rename to create-leo-app/template-react-managed-worker/_gitignore diff --git a/create-aleo-app/template-react-managed-worker/index.html b/create-leo-app/template-react-managed-worker/index.html similarity index 100% rename from create-aleo-app/template-react-managed-worker/index.html rename to create-leo-app/template-react-managed-worker/index.html diff --git a/create-aleo-app/template-react-managed-worker/package.json b/create-leo-app/template-react-managed-worker/package.json similarity index 100% rename from create-aleo-app/template-react-managed-worker/package.json rename to create-leo-app/template-react-managed-worker/package.json diff --git a/create-aleo-app/template-react-managed-worker/public/favicon.ico b/create-leo-app/template-react-managed-worker/public/favicon.ico similarity index 100% rename from create-aleo-app/template-react-managed-worker/public/favicon.ico rename to create-leo-app/template-react-managed-worker/public/favicon.ico diff --git a/create-aleo-app/template-react-managed-worker/src/App.css b/create-leo-app/template-react-managed-worker/src/App.css similarity index 100% rename from create-aleo-app/template-react-managed-worker/src/App.css rename to create-leo-app/template-react-managed-worker/src/App.css diff --git a/create-aleo-app/template-react-managed-worker/src/App.jsx b/create-leo-app/template-react-managed-worker/src/App.jsx similarity index 90% rename from create-aleo-app/template-react-managed-worker/src/App.jsx rename to create-leo-app/template-react-managed-worker/src/App.jsx index 4162aec2f..f8504eb67 100644 --- a/create-aleo-app/template-react-managed-worker/src/App.jsx +++ b/create-leo-app/template-react-managed-worker/src/App.jsx @@ -27,7 +27,7 @@ function App() { " output r2 as u32.private;\n"; setLoading(true); - const result = await aleoWorker.executeOffline(hello_hello_program,"hello", ["5u32", "5u32"], "APrivateKey1zkp778oUFSck3PZA5xppgp4trFwkkD6xnUXtxcBCfsq4URJ") + const result = await aleoWorker.run(hello_hello_program,"hello", ["5u32", "5u32"], "APrivateKey1zkp778oUFSck3PZA5xppgp4trFwkkD6xnUXtxcBCfsq4URJ") setLoading(false); alert(JSON.stringify(result)); @@ -52,7 +52,7 @@ function App() { diff --git a/create-aleo-app/template-react-managed-worker/src/assets/aleo.png b/create-leo-app/template-react-managed-worker/src/assets/aleo.png similarity index 100% rename from create-aleo-app/template-react-managed-worker/src/assets/aleo.png rename to create-leo-app/template-react-managed-worker/src/assets/aleo.png diff --git a/create-aleo-app/template-react-managed-worker/src/assets/react.svg b/create-leo-app/template-react-managed-worker/src/assets/react.svg similarity index 100% rename from create-aleo-app/template-react-managed-worker/src/assets/react.svg rename to create-leo-app/template-react-managed-worker/src/assets/react.svg diff --git a/create-aleo-app/template-react-managed-worker/src/index.css b/create-leo-app/template-react-managed-worker/src/index.css similarity index 100% rename from create-aleo-app/template-react-managed-worker/src/index.css rename to create-leo-app/template-react-managed-worker/src/index.css diff --git a/create-aleo-app/template-react-managed-worker/src/main.jsx b/create-leo-app/template-react-managed-worker/src/main.jsx similarity index 100% rename from create-aleo-app/template-react-managed-worker/src/main.jsx rename to create-leo-app/template-react-managed-worker/src/main.jsx diff --git a/create-aleo-app/template-react-managed-worker/vite.config.js b/create-leo-app/template-react-managed-worker/vite.config.js similarity index 100% rename from create-aleo-app/template-react-managed-worker/vite.config.js rename to create-leo-app/template-react-managed-worker/vite.config.js diff --git a/create-aleo-app/template-react-managed-worker/webpack.config.js b/create-leo-app/template-react-managed-worker/webpack.config.js similarity index 100% rename from create-aleo-app/template-react-managed-worker/webpack.config.js rename to create-leo-app/template-react-managed-worker/webpack.config.js diff --git a/create-aleo-app/template-react-ts/.babelrc b/create-leo-app/template-react-ts/.babelrc similarity index 100% rename from create-aleo-app/template-react-ts/.babelrc rename to create-leo-app/template-react-ts/.babelrc diff --git a/create-aleo-app/template-react-ts/.eslintrc.cjs b/create-leo-app/template-react-ts/.eslintrc.cjs similarity index 100% rename from create-aleo-app/template-react-ts/.eslintrc.cjs rename to create-leo-app/template-react-ts/.eslintrc.cjs diff --git a/create-aleo-app/template-react-ts/README.md b/create-leo-app/template-react-ts/README.md similarity index 98% rename from create-aleo-app/template-react-ts/README.md rename to create-leo-app/template-react-ts/README.md index e00c62a66..b571c81ea 100644 --- a/create-aleo-app/template-react-ts/README.md +++ b/create-leo-app/template-react-ts/README.md @@ -1,6 +1,6 @@ # React + Aleo + Leo -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-aleo-app/template-react) +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-react) This template provides a minimal setup to get React and Aleo working in Vite with HMR and some ESLint rules. diff --git a/create-aleo-app/template-react-ts/_gitignore b/create-leo-app/template-react-ts/_gitignore similarity index 100% rename from create-aleo-app/template-react-ts/_gitignore rename to create-leo-app/template-react-ts/_gitignore diff --git a/create-aleo-app/template-react-ts/_headers b/create-leo-app/template-react-ts/_headers similarity index 100% rename from create-aleo-app/template-react-ts/_headers rename to create-leo-app/template-react-ts/_headers diff --git a/create-aleo-app/template-react-ts/helloworld/.env.example b/create-leo-app/template-react-ts/helloworld/.env.example similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/.env.example rename to create-leo-app/template-react-ts/helloworld/.env.example diff --git a/create-aleo-app/template-react-ts/helloworld/.gitignore b/create-leo-app/template-react-ts/helloworld/.gitignore similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/.gitignore rename to create-leo-app/template-react-ts/helloworld/.gitignore diff --git a/create-aleo-app/template-react-ts/helloworld/README.md b/create-leo-app/template-react-ts/helloworld/README.md similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/README.md rename to create-leo-app/template-react-ts/helloworld/README.md diff --git a/create-aleo-app/template-react-ts/helloworld/build/main.aleo b/create-leo-app/template-react-ts/helloworld/build/main.aleo similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/build/main.aleo rename to create-leo-app/template-react-ts/helloworld/build/main.aleo diff --git a/create-aleo-app/template-react-ts/helloworld/build/program.json b/create-leo-app/template-react-ts/helloworld/build/program.json similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/build/program.json rename to create-leo-app/template-react-ts/helloworld/build/program.json diff --git a/create-aleo-app/template-react-ts/helloworld/inputs/helloworld.in b/create-leo-app/template-react-ts/helloworld/inputs/helloworld.in similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/inputs/helloworld.in rename to create-leo-app/template-react-ts/helloworld/inputs/helloworld.in diff --git a/create-aleo-app/template-react-ts/helloworld/program.json b/create-leo-app/template-react-ts/helloworld/program.json similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/program.json rename to create-leo-app/template-react-ts/helloworld/program.json diff --git a/create-aleo-app/template-react-ts/helloworld/src/main.leo b/create-leo-app/template-react-ts/helloworld/src/main.leo similarity index 100% rename from create-aleo-app/template-react-ts/helloworld/src/main.leo rename to create-leo-app/template-react-ts/helloworld/src/main.leo diff --git a/create-aleo-app/template-react-ts/index.html b/create-leo-app/template-react-ts/index.html similarity index 100% rename from create-aleo-app/template-react-ts/index.html rename to create-leo-app/template-react-ts/index.html diff --git a/create-aleo-app/template-react-ts/install.sh b/create-leo-app/template-react-ts/install.sh similarity index 100% rename from create-aleo-app/template-react-ts/install.sh rename to create-leo-app/template-react-ts/install.sh diff --git a/create-aleo-app/template-react-ts/package.json b/create-leo-app/template-react-ts/package.json similarity index 100% rename from create-aleo-app/template-react-ts/package.json rename to create-leo-app/template-react-ts/package.json diff --git a/create-aleo-app/template-react-ts/public/favicon.ico b/create-leo-app/template-react-ts/public/favicon.ico similarity index 100% rename from create-aleo-app/template-react-ts/public/favicon.ico rename to create-leo-app/template-react-ts/public/favicon.ico diff --git a/create-aleo-app/template-react-ts/src/App.css b/create-leo-app/template-react-ts/src/App.css similarity index 100% rename from create-aleo-app/template-react-ts/src/App.css rename to create-leo-app/template-react-ts/src/App.css diff --git a/create-aleo-app/template-react-ts/src/App.tsx b/create-leo-app/template-react-ts/src/App.tsx similarity index 97% rename from create-aleo-app/template-react-ts/src/App.tsx rename to create-leo-app/template-react-ts/src/App.tsx index b64330c9d..4dab329d4 100644 --- a/create-aleo-app/template-react-ts/src/App.tsx +++ b/create-leo-app/template-react-ts/src/App.tsx @@ -61,7 +61,7 @@ function App() {

diff --git a/create-aleo-app/template-react-ts/src/assets/aleo.svg b/create-leo-app/template-react-ts/src/assets/aleo.svg similarity index 100% rename from create-aleo-app/template-react-ts/src/assets/aleo.svg rename to create-leo-app/template-react-ts/src/assets/aleo.svg diff --git a/create-aleo-app/template-react-ts/src/assets/react.svg b/create-leo-app/template-react-ts/src/assets/react.svg similarity index 100% rename from create-aleo-app/template-react-ts/src/assets/react.svg rename to create-leo-app/template-react-ts/src/assets/react.svg diff --git a/create-aleo-app/template-react-ts/src/custom.d.ts b/create-leo-app/template-react-ts/src/custom.d.ts similarity index 100% rename from create-aleo-app/template-react-ts/src/custom.d.ts rename to create-leo-app/template-react-ts/src/custom.d.ts diff --git a/create-aleo-app/template-react-ts/src/index.css b/create-leo-app/template-react-ts/src/index.css similarity index 100% rename from create-aleo-app/template-react-ts/src/index.css rename to create-leo-app/template-react-ts/src/index.css diff --git a/create-aleo-app/template-react-ts/src/main.tsx b/create-leo-app/template-react-ts/src/main.tsx similarity index 100% rename from create-aleo-app/template-react-ts/src/main.tsx rename to create-leo-app/template-react-ts/src/main.tsx diff --git a/create-aleo-app/template-react-ts/src/workers/AleoWorker.ts b/create-leo-app/template-react-ts/src/workers/AleoWorker.ts similarity index 100% rename from create-aleo-app/template-react-ts/src/workers/AleoWorker.ts rename to create-leo-app/template-react-ts/src/workers/AleoWorker.ts diff --git a/create-aleo-app/template-react-ts/src/workers/worker.ts b/create-leo-app/template-react-ts/src/workers/worker.ts similarity index 96% rename from create-aleo-app/template-react-ts/src/workers/worker.ts rename to create-leo-app/template-react-ts/src/workers/worker.ts index 9d74019f4..125003604 100644 --- a/create-aleo-app/template-react-ts/src/workers/worker.ts +++ b/create-leo-app/template-react-ts/src/workers/worker.ts @@ -19,7 +19,7 @@ async function localProgramExecution(program, aleoFunction, inputs) { const account = new Account(); programManager.setAccount(account); - const executionResponse = await programManager.executeOffline( + const executionResponse = await programManager.run( program, aleoFunction, inputs, diff --git a/create-aleo-app/template-react-ts/tsconfig.json b/create-leo-app/template-react-ts/tsconfig.json similarity index 100% rename from create-aleo-app/template-react-ts/tsconfig.json rename to create-leo-app/template-react-ts/tsconfig.json diff --git a/create-aleo-app/template-react-ts/vite.config.ts b/create-leo-app/template-react-ts/vite.config.ts similarity index 100% rename from create-aleo-app/template-react-ts/vite.config.ts rename to create-leo-app/template-react-ts/vite.config.ts diff --git a/create-aleo-app/template-react-ts/webpack.config.ts b/create-leo-app/template-react-ts/webpack.config.ts similarity index 100% rename from create-aleo-app/template-react-ts/webpack.config.ts rename to create-leo-app/template-react-ts/webpack.config.ts diff --git a/create-aleo-app/template-vanilla/_gitignore b/create-leo-app/template-vanilla/_gitignore similarity index 100% rename from create-aleo-app/template-vanilla/_gitignore rename to create-leo-app/template-vanilla/_gitignore diff --git a/create-aleo-app/template-vanilla/_headers b/create-leo-app/template-vanilla/_headers similarity index 100% rename from create-aleo-app/template-vanilla/_headers rename to create-leo-app/template-vanilla/_headers diff --git a/create-aleo-app/template-vanilla/index.html b/create-leo-app/template-vanilla/index.html similarity index 91% rename from create-aleo-app/template-vanilla/index.html rename to create-leo-app/template-vanilla/index.html index 19dff6298..dd895fe66 100644 --- a/create-aleo-app/template-vanilla/index.html +++ b/create-leo-app/template-vanilla/index.html @@ -4,7 +4,7 @@ - Aleo App + Leo App
diff --git a/create-aleo-app/template-vanilla/javascript.svg b/create-leo-app/template-vanilla/javascript.svg similarity index 100% rename from create-aleo-app/template-vanilla/javascript.svg rename to create-leo-app/template-vanilla/javascript.svg diff --git a/create-aleo-app/template-vanilla/main.js b/create-leo-app/template-vanilla/main.js similarity index 100% rename from create-aleo-app/template-vanilla/main.js rename to create-leo-app/template-vanilla/main.js diff --git a/create-aleo-app/template-vanilla/package.json b/create-leo-app/template-vanilla/package.json similarity index 100% rename from create-aleo-app/template-vanilla/package.json rename to create-leo-app/template-vanilla/package.json diff --git a/create-aleo-app/template-vanilla/public/aleo.svg b/create-leo-app/template-vanilla/public/aleo.svg similarity index 100% rename from create-aleo-app/template-vanilla/public/aleo.svg rename to create-leo-app/template-vanilla/public/aleo.svg diff --git a/create-aleo-app/template-vanilla/public/vite.svg b/create-leo-app/template-vanilla/public/vite.svg similarity index 100% rename from create-aleo-app/template-vanilla/public/vite.svg rename to create-leo-app/template-vanilla/public/vite.svg diff --git a/create-aleo-app/template-vanilla/style.css b/create-leo-app/template-vanilla/style.css similarity index 100% rename from create-aleo-app/template-vanilla/style.css rename to create-leo-app/template-vanilla/style.css diff --git a/create-aleo-app/template-vanilla/vite.config.js b/create-leo-app/template-vanilla/vite.config.js similarity index 100% rename from create-aleo-app/template-vanilla/vite.config.js rename to create-leo-app/template-vanilla/vite.config.js diff --git a/create-aleo-app/template-vanilla/worker.js b/create-leo-app/template-vanilla/worker.js similarity index 100% rename from create-aleo-app/template-vanilla/worker.js rename to create-leo-app/template-vanilla/worker.js diff --git a/create-aleo-app/tsconfig.json b/create-leo-app/tsconfig.json similarity index 100% rename from create-aleo-app/tsconfig.json rename to create-leo-app/tsconfig.json diff --git a/index.js b/index.js new file mode 100644 index 000000000..f0751cada --- /dev/null +++ b/index.js @@ -0,0 +1,31 @@ +import { Account, AleoNetworkClient, NetworkRecordProvider, ProgramManager, AleoKeyProvider} from '@provablehq/sdk'; + +// Create a key provider that will be used to find public proving & verifying keys for Aleo programs +const keyProvider = new AleoKeyProvider(); +keyProvider.useCache(true); + +// Create a record provider that will be used to find records and transaction data for Aleo programs +const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1"); + +// Use existing account with funds +const account = new Account({ + privateKey: "user1PrivateKey", +}); + +const recordProvider = new NetworkRecordProvider(account, networkClient); + +// Initialize a program manager to talk to the Aleo network with the configured key and record providers +const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider); +programManager.setAccount(account) + +// Define an Aleo program to deploy +const program = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n"; + +// Define a fee to pay to deploy the program +const fee = 3.0; // 3.0 Aleo credits + +// Deploy the program to the Aleo network +const tx_id = await programManager.deploy(program, fee); + +// Verify the transaction was successful +const transaction = await programManager.networkClient.getTransaction(tx_id); \ No newline at end of file diff --git a/package.json b/package.json index 6ec1ef99f..6c3110fc8 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "sdk", "wasm", "website", - "create-aleo-app", - "create-aleo-app/*" + "create-leo-app", + "create-leo-app/*" ], + "type": "module", "scripts": { "build:wasm": "cd wasm && yarn build", "build:sdk": "cd sdk && yarn build", diff --git a/sdk/README.md b/sdk/README.md index a35559d6e..2b1dd30c8 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -32,7 +32,7 @@ The Aleo SDK provides the following functionality (Click to see examples): * [Installation](#Installation) * [Usage](#Usage) * [Zero-Knowledge Web App Examples](#Zero-Knowledge-Web-App-Examples) - * [Create Aleo App](#create-aleo-app) + * [Create Leo App](#create-leo-app) * [Provable.tools](#provabletools) * [Create An Aleo Account](#1-create-an-aleo-account) * [Execute Aleo Programs](#2-execute-aleo-programs) @@ -68,23 +68,33 @@ To clone the repository, run: To install the Aleo SDK from NPM run: -`npm install @provablehq/sdk` or `cd sdk && yarn add @provablehq/sdk`. +`npm install @provablehq/sdk` in your own project's root, or from within this repo run `cd sdk && yarn add @provablehq/sdk`. ### Build from source -To build the project from source, go to this project's root and execute: +To build the project from source, go to the project's root and execute: `yarn build:all` +### Ensure compatibility with ES modules + +In your project's `package.json`, ensure that the following line is added above `scripts`: + +```json +{ + "type": "module", +} +``` + ## Getting Started: Zero-Knowledge Web App Examples -### Create Aleo App +### Create Leo App A set of fully functional examples of zero-knowledge web apps can be found in -[create-aleo-app](https://github.com/ProvableHQ/sdk/tree/testnet3/create-aleo-app). Create Aleo App provides several web app +[create-leo-app](https://github.com/ProvableHQ/sdk/tree/testnet3/create-leo-app). Create Leo App provides several web app templates in common web frameworks such as React that can be used as a starting point for building zero-knowledge web apps. -Developers can get started immediately with create-aleo-app by running: -`npm create aleo-app@latest` +Developers can get started immediately with create-leo-app by running: +`npm create leo-app@latest` ### provable.tools @@ -136,12 +146,13 @@ Aleo programs provide the ability for users to make any input or output of a pro was run correctly. Keeping program inputs and outputs private allows developers to build privacy into their applications. Zero-knowledge programs are written in one of two languages: -1. [Leo](https://docs.leo-lang.org/leo/language): A high-level, developer friendly language for developing +1. [Leo](https://docs.leo-lang.org/leo/language): A high-level, developer-friendly language for developing zero-knowledge programs. -2. [Aleo Instructions](https://docs.leo-lang.org/aleo): A low-level language that provides developers with fine-grained control over the execution flow of zero-knowledge programs. Leo programs are compiled into Aleo Instructions + +2. [Aleo Instructions](https://docs.leo-lang.org/aleo/language): A low-level language that provides developers with fine-grained control over the execution flow of zero-knowledge programs. Leo code is compiled into Aleo Instructions under the hood. -Documentation for both languages can be found at [developer.aleo.org](https://developer.aleo.org). +Documentation for both languages can be found at [docs.leo-lang.org](https://docs.leo-lang.org/). #### "Hello World" in Leo ``` @@ -158,7 +169,7 @@ program helloworld.aleo { ``` program helloworld.aleo; -// The leo code above compiles to the following Aleo Instructions +// The Leo code above compiles to the following Aleo Instructions: function hello: input r0 as u32.public; input r1 as u32.private; @@ -176,15 +187,15 @@ with JavaScript bindings that allow for the execution of Aleo programs fully wit details on how this is achieved can visit the [aleo-wasm](https://www.npmjs.com/package/@provablehq/wasm) crate. The basic execution flow of a program is as follows: -1. A web app is loaded with an instance of the `ProgramManager` object -2. The SDK wasm modules are loaded into the browser's WebAssembly runtime -2. An Aleo program in `Aleo Instructions` format is loaded into the `ProgramManager` as a wasm object -3. The web app provides a user input form for the program -4. The user submits the inputs and the zero-knowledge execution is performed entirely within the browser via WebAssembly -5. The result is returned to the user -6. A fully encrypted zero-knowledge transcript of the execution is optionally sent to the Aleo network - -A diagramatic representation of the program execution flow is shown below. +1. A web app is loaded with an instance of the `ProgramManager` object. +2. The SDK wasm modules are loaded into the browser's WebAssembly runtime. +2. An Aleo program in `Aleo Instructions` format is loaded into the `ProgramManager` as a wasm object. +3. The web app provides a user input form for the program. +4. The user submits the inputs and the zero-knowledge execution is performed entirely within the browser via WebAssembly. +5. The result is returned to the user. +6. A fully encrypted zero-knowledge transcript of the execution is optionally sent to the Aleo network. + +A diagramatic representation of the program execution flow is shown below: ```mermaid graph LR p1[Leo Program] @@ -221,9 +232,9 @@ const account = new Account(); ### 2.4 Local program execution -A simple example of running the "hello world" program within the web browser and capturing its outputs is shown below: +A simple example of running the "hello world" program locally using Node.js and capturing its outputs is shown below: ```typescript -import { Account, Program } from '@provablehq/sdk'; +import { Account, ProgramManager } from '@provablehq/sdk'; /// Create the source for the "hello world" program const program = "program helloworld.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n"; @@ -234,9 +245,9 @@ const account = new Account(); programManager.setAccount(account); /// Get the response and ensure that the program executed correctly -const executionResponse = await programManager.executeOffline(program, "hello", ["5u32", "5u32"]); +const executionResponse = await programManager.run(program, "hello", ["5u32", "5u32"]); const result = executionResponse.getOutputs(); -assert(result === ["10u32"]); +assert.deepStrictEqual(result, ['10u32']); ``` ### 2.5 Program execution on the Aleo network @@ -244,46 +255,63 @@ The SDK provides the ability to execute programs and store an encrypted transcri network that anyone can trustlessly verify. This process can be thought of as being executed in the following steps: -1. A program is run locally -2. A proof that the program was executed correctly and that the outputs follow from the inputs is generated +1. A program is run locally. +2. A proof that the program was executed correctly and that the outputs follow from the inputs is generated. 3. A transcript of the proof is generated client-side containing encrypted proof data (see [Section 2.6](#4-managing-records-and-private-state)) -and any public outputs or state the user of the program wishes to reveal -4. The proof transcript is posted to the Aleo network and verified by the Aleo validator nodes in a trustless manner +and any public outputs or state the user of the program wishes to reveal. +4. The proof transcript is posted to the Aleo network and verified by the Aleo validator nodes in a trustless manner. 5. If the proof is valid, it is stored and anyone can later verify the proof and read the outputs the author of the program has chosen to make public. Private inputs will remain encrypted, but the author of the proof can also choose to -retrieve this encrypted state at any point and decrypt it locally for their own use +retrieve this encrypted state at any point and decrypt it locally for their own use. Posting an execution to the Aleo network serves as a globally trustless and verifiable record of a program execution as well as any resulting state changes in private or public data. A simple example of running the "hello world" program on the Aleo network is shown below: ```typescript -import { Account, AleoNetworkClient, NetworkRecordProvider, ProgramManager, KeySearchParams } from '@provablehq/sdk'; +import { Account, AleoNetworkClient, NetworkRecordProvider, ProgramManager, AleoKeyProvider } from '@provablehq/sdk'; + +// Create an account +const account = new Account(); + +// Create a network client to connect to the Aleo network +const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1"); // Create a key provider that will be used to find public proving & verifying keys for Aleo programs const keyProvider = new AleoKeyProvider(); keyProvider.useCache = true; // Create a record provider that will be used to find records and transaction data for Aleo programs -const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1"); const recordProvider = new NetworkRecordProvider(account, networkClient); // Initialize a program manager to talk to the Aleo network with the configured key and record providers const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider); -// Provide a key search parameter to find the correct key for the program if they are stored in a memory cache -const keySearchParams = { "cacheKey": "hello_hello:hello" }; - -// Execute the program using the options provided inline -const tx_id = await programManager.execute({ - programName: "hello_hello.aleo", - functionName: "hello_hello", - fee: 0.020, - privateFee: false, // Assuming a value for privateFee - inputs: ["5u32", "5u32"], - keySearchParams: keySearchParams -}); -const transaction = await programManager.networkClient.getTransaction(tx_id); +// Set the account for the program manager +programManager.setAccount(account); + +(async () => { + try { + // Provide a key search parameter to find the correct key for the program if they are stored in a memory cache + const keySearchParams = { cacheKey: "helloworld.aleo:main" }; + console.log("Key search parameters set: ", keySearchParams); + + // Execute the program using the options provided inline + const tx_id = await programManager.execute({ + programName: "helloworld.aleo", + functionName: "main", + fee: 0.020, + privateFee: false, // Assuming a value for privateFee + inputs: ["5u32", "5u32"], // Example inputs matching the function definition + keySearchParams: keySearchParams, + privateKey: account.privateKey() // Set the private key + }); + const transaction = await programManager.networkClient.getTransaction(tx_id); + console.log("Transaction details: ", transaction); + } catch (error) { + console.error("Error executing program:", error); + } +})(); ``` A reader of the above example may notice the `RecordProvider` and `KeyProvider` classes that were not present in the local @@ -294,9 +322,9 @@ These two concepts are explained in more detail below. ### 2.6 Program proving keys & program records -Executing Aleo programs in zero-knowledge requires two additional pieces of information: +Executing Aleo programs using zero-knowledge requires two additional pieces of information: -1. **Function Proving & Verifying Keys:** Proving and Verifying keys are cryptographic keys that are generated when a +1. **Function Proving & Verifying Keys:** Proving and verifying keys are cryptographic keys that are generated when a program function is executed. These keys are public and unique for each function in a program. The proving keys allows any party to execute the program and generate a proof that the program was executed correctly. The verifying keys allow any party to verify that the proof was generated correctly and the execution is correct. These keys are required to create the @@ -332,7 +360,7 @@ to the network (as long as it doesn't already exist) by paying a deployment fee provides a simple interface for deploying programs to the Aleo network using the program manager. ```typescript -import { Account, AleoNetworkClient, NetworkRecordProvider, ProgramManager, KeySearchParams} from '@provablehq/sdk'; +import { Account, AleoNetworkClient, NetworkRecordProvider, ProgramManager, AleoKeyProvider} from '@provablehq/sdk'; // Create a key provider that will be used to find public proving & verifying keys for Aleo programs const keyProvider = new AleoKeyProvider(); @@ -356,7 +384,7 @@ programManager.setAccount(account) const program = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n"; // Define a fee to pay to deploy the program -const fee = 1.8; // 1.8 Aleo credits +const fee = 3.8; // 3.8 Aleo credits // Deploy the program to the Aleo network const tx_id = await programManager.deploy(program, fee); @@ -380,300 +408,33 @@ const tx_id = await programManager.deploy(program, fee, undefined, feeRecord); ### 2.8 React example -The above concepts can be tied together in a concrete example of a React web app. This example can be installed in one +The above concepts can be tied together in a concrete example of a single-page web app. This example can be installed in one step by running: -`npm create aleo-app@latest` - -#### Program execution - -Program execution is a computationally expensive process. For this reason, it is recommended to execute programs in -Web Workers. - -
-Example Web Worker Usage - -A worker file that performs the execution can be created as follows: -`worker.js` -```jsx -import * as aleo from "@provablehq/sdk"; - -// Threads are then initialized to execute the program in parallel using multithreading -await aleo.initThreadPool(); - -/// The program manager is initialized with a key provider and a record provider -const defaultHost = "https://api.explorer.aleo.org/v1"; -const keyProvider = new aleo.AleoKeyProvider(); -const recordProvider = new aleo.NetworkRecordProvider(new Account(), "https://api.explorer.aleo.org/v1"); -const programManager = new aleo.ProgramManager( - defaultHost, - keyProvider, - recordProvider, -); - -// The key provider is set to use an in-memory cache to store keys -keyProvider.useCache(true); - -self.postMessage({ - type: "ALEO_WORKER_READY", -}); - -// The program is executed when specific events are dispatched and then communicates the result to the main thread -// when execution has finished -let lastLocalProgram = null; -self.addEventListener("message", (ev) => { - if (ev.data.type === "ALEO_EXECUTE_PROGRAM_LOCAL") { - const {localProgram, aleoFunction, inputs, privateKey} = ev.data; - - console.log("Web worker: Executing function locally..."); - let startTime = performance.now(); - - (async function () { - try { - // Ensure the program is valid and that it contains the function specified - const program = programManager.createProgramFromSource(localProgram); - const program_id = program.id(); - if (!program.hasFunction(aleoFunction)) { - throw `Program ${program_id} does not contain function ${aleoFunction}`; - } - const cacheKey = `${program_id}:${aleoFunction}`; - - // Get the program imports - const imports = - programManager.networkClient.getProgramImports(localProgram); - - // Get the proving and verifying keys for the function - if (lastLocalProgram !== localProgram) { - const keys = programManager.executionEngine.synthesizeKeypair( - localProgram, - aleoFunction, - ); - programManager.keyProvider.cacheKeys(cacheKey, [ - keys.provingKey(), - keys.verifyingKey(), - ]); - lastLocalProgram = localProgram; - } - - // Pass the cache key to the execute function - const keyParams = new aleo.AleoKeyProviderParams({ - cacheKey: cacheKey, - }); - - // Execute the function locally - let response = await programManager.executeOffline( - localProgram, - aleoFunction, - inputs, - imports, - keyParams, - undefined, - undefined, - aleo.PrivateKey.from_string(privateKey), - ); - - // Return the outputs to the main thread - self.postMessage({ - type: "OFFLINE_EXECUTION_COMPLETED", - outputs, - }); - } catch (error) { - console.error(error); - self.postMessage({ - type: "ERROR", - errorMessage: error.toString(), - }); - } - })(); - } -}); -``` - -The Web Worker can then be initialized in a worker provider component which uses React effects - -```jsx -import { useEffect, useState } from "react"; -import WorkerContext from "./WorkerContext"; - -const WorkerProvider = ({ children }) => { - const [worker, setWorker] = useState(null); - const [workerReady, setWorkerReady] = useState(false); +`npm create leo-app@latest` - useEffect(() => { - let worker = new Worker(new URL("./worker.js", import.meta.url), { - type: "module", - }); - setWorker(worker); - - worker.onmessage = (event) => { - if (event.data.type === "ALEO_WORKER_READY") { - setWorkerReady(true); - } - }; - - return () => { - worker.terminate(); - }; - }, []); - - if (!workerReady) { - return ( - <> -
-
-
- - ); - } +You will then be prompted to select either Vanilla, React, or Node.js as the template for the project. For this example, select Vanilla. - return ( - - {children} - - ); -}; - -export default WorkerProvider; -``` - -
- -Using both Web Workers and a Wasm initialization in a React hook, a single-page app can be created that executes -Aleo zero-knowledge programs. - -
-Example App.jsx Implementing Zero-Knowledge Program Execution - -```jsx -import { useEffect, useState } from "react"; -import reactLogo from "./assets/react.svg"; -import aleoLogo from "./assets/aleo.png"; -import "./App.css"; -import { useAleoWASM } from "./aleo-wasm-hook"; - -function App() { - const [count, setCount] = useState(0); - const aleo = useAleoWASM(); - const [account, setAccount] = useState(null); - const [loading, setLoading] = useState(false); - - const generateAccount = () => { - setAccount(new aleo.PrivateKey()); - }; - - const [worker, setWorker] = useState(null); - - useEffect(() => { - if (worker === null) { - const spawnedWorker = spawnWorker(); - setWorker(spawnedWorker); - return () => { - spawnedWorker.terminate(); - }; - } - }, []); - - function spawnWorker() { - return new Worker(new URL("workers/worker.js", import.meta.url), { - type: "module", - }); - } - - function postMessagePromise(worker, message) { - return new Promise((resolve, reject) => { - worker.onmessage = (event) => { - resolve(event.data); - }; - worker.onerror = (error) => { - reject(error); - }; - worker.postMessage(message); - }); - } - - async function execute() { - const hello_hello_program = - "program hello_hello.aleo;\n" + - "\n" + - "function hello:\n" + - " input r0 as u32.public;\n" + - " input r1 as u32.private;\n" + - " add r0 r1 into r2;\n" + - " output r2 as u32.private;\n"; - - setLoading(true); - const result = await postMessagePromise(worker, { - type: "ALEO_EXECUTE_PROGRAM_LOCAL", - localProgram: hello_hello_program, - aleoFunction: "hello", - inputs: ["5u32", "5u32"], - privateKey: account.to_string(), - }); - setLoading(false); - - alert(JSON.stringify(result)); - } +#### Program execution - return ( - <> -
- - Aleo logo - - - React logo - -
-

Aleo + React

-
- -

- -

-

- -

-

- Edit src/App.jsx and save to test HMR -

-
-

- Click on the Aleo and React logos to learn more -

- - ); -} +Program execution is a computationally-expensive process. For this reason, it is recommended to execute programs in +web workers. Create-Leo-App will automatically create a web worker for you that performs the execution called `worker.js`. -export default App; -``` -
- -A full example of this implementation can be found [here](https://github.com/ProvableHQ/sdk/blob/testnet3/create-aleo-app/template-react-managed-worker/src/App.jsx) +A full example of this implementation can be found [here](https://github.com/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-vanilla) ## 3. Aleo Credit Transfers ### 3.1 Aleo credits -The official token of operation on the Aleo Network are Aleo credits. Aleo credits are used to pay all fees for program -execution on the Aleo network. +Aleo Credits are used to access blockspace and computational resources on the network, with users paying Credits to submit transactions and have them processed. Aleo credits are defined in the [credits.aleo](https://explorer.aleo.org/program/credits.aleo) program. This program is deployed to the Aleo network and defines data structures representing Aleo credits and the functions used to manage them. -There are two ways to hold Aleo credits. +There are two ways to hold Aleo credits: -#### 1 - Private balances via credits.aleo records +#### 1 - Private balances via `credits.aleo` records The first method is owning a `credits` record which enables a participant in the Aleo network to hold a private balance of Aleo credits. ``` @@ -685,8 +446,8 @@ record credits: A user's total private credits balance will consist of all unspent `credits` records owned by the user with a non-zero `microcredits` value. -#### 2 - Public balances via credits.aleo account mapping -The second is by holding a `balance` in the `account` mapping in the `credits.aleo` program on the Aleo network. +#### 2 - Public balances via `credits.aleo` account mappings +The second method is by holding a `balance` in the `account` mapping in the `credits.aleo` program on the Aleo network. ``` mapping account: @@ -705,7 +466,7 @@ program under the hood. There are four transfer functions available. -#### 1. transfer_private +#### 1. `transfer_private` Takes a `credits` record owned by the sender, subtracts an amount from it, and adds that amount to a new record owned by the receiver. This function is 100% private and does not affect the `account` mapping. @@ -719,7 +480,8 @@ graph LR ``` -#### 2. transfer_private_to_public +#### 2. `transfer_private_to_public` + Takes a `credits` record owned by the sender, subtracts an amount from it, and adds that amount to the `account` mapping of the receiver. This function is 50% private and 50% public. It consumes a record as a private input and generates a public balance in the `account` mapping entry belonging to the receiver. @@ -734,7 +496,7 @@ graph LR t1--amount 3000u64-->m1 ``` -#### 3. transfer_public +#### 3. `transfer_public` Subtracts an amount of `credits` stored in the `account` mapping of the `credits.aleo` program, and adds that amount to the `account` mapping of the receiver. This function is 100% public and does not consume or generate @@ -753,7 +515,8 @@ graph LR end ``` -#### 4. transfer_public_to_private +#### 4. `transfer_public_to_private` + Subtracts an amount `credits` stored in the `account` mapping of the `credits.aleo program` and adds that amount to a new private record owned by the receiver. This function is 50% private and 50% public. It publicly consumes a balance in the `account` mapping entry belonging to the sender and generates a private record @@ -777,7 +540,7 @@ All four of these functions can be used to transfer credits between users via th `ProgramManager` by specifying the transfer type as the third argument. ```typescript -import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@aleo/sdk'; +import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@provablehq/sdk'; // Create a new NetworkClient, KeyProvider, and RecordProvider const account = Account.from_string({privateKey: "user1PrivateKey"}); @@ -830,7 +593,7 @@ const public_balance = networkClient.getMappingValue("credits.aleo", USER_1_ADDR ## 4. Managing Program Data and Private State ### 4.1 Private state data: records -Records are analogous to concept of [UTXOs](https://en.wikipedia.org/wiki/Unspent_transaction_output). When a record is +Records are analogous to the concept of [UTXOs](https://en.wikipedia.org/wiki/Unspent_transaction_output). When a record is created by a program, it can then be consumed later by the same program as an input to a function. Once a record is used as an input, it is considered consumed and cannot be used again. In many cases a new record will be created from the output of the function. Records are private by default and are associated with a single Aleo program and a single private key @@ -841,7 +604,7 @@ representing a user. A straightforward example of a usage of records in a program can be demonstrated by explaining the process of private value transfers of Aleo credits on the Aleo network. -Aleo credits are the official token in which all on-chain execution and deployment fees are paid. Credits can be public +Aleo credits are used for all on-chain execution and deployment fees. Credits can be public or private. Private credits are represented by the `credits` record in the [credits.aleo](https://www.aleo.network/programs/credits.aleo) program. @@ -871,10 +634,10 @@ function transfer_private: output r5 as credits.record; ``` -The `transfer_private` function can be graphically represented by the graph below. In the graph the first record "Record 1" +The `transfer_private` function can be graphically represented by the graph below. In the graph the first record, Record 1, is consumed and can never be used again. From the data in Record 1, two more records are created. One containing the intended amount for the recipient which is now owned by the recipient and another containing the remaining credits -which is sent back to the sender. +which are sent back to the sender. ```mermaid graph LR @@ -907,7 +670,7 @@ The above state chain would be executed in the following way using the SDK: #### Step 1 - User 1 sends a private value transfer to User 2 ```typescript // USER 1 -import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@aleo/sdk'; +import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@provablehq/sdk'; // Create a new NetworkClient, KeyProvider, and RecordProvider const account = Account.from_string({privateKey: "user1PrivateKey"}); @@ -920,15 +683,15 @@ const USER_2_ADDRESS = "user2Address"; const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider); programManager.setAccount(account); -/// Send private transfer to user 2 +/// Send private transfer to User 2 const tx_id = await programManager.transfer(1, USER_2_ADDRESS, "transfer_private", 0.2); ``` -#### Step 2 - User 2 receives the transaction ID and fetches the credits record they received from user 1 from the network. They then send it to user 3 +#### Step 2 - User 2 receives the transaction ID and fetches the credits record they received from User 1 from the network. They then send it to User 3 ```typescript // USER 2 -import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@aleo/sdk'; +import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@provablehq/sdk'; // Create a new NetworkClient, KeyProvider, and RecordProvider const account = Account.from_string({privateKey: "user2PrivateKey"}); @@ -953,18 +716,18 @@ const USER_3_ADDRESS = "user3Address"; const tx_id = await programManager.transfer(1, USER_3_ADDRESS, "transfer_private", 0.2, undefined, recordPlaintext); ``` -When an execution such as transfer_private consumes or generates a record, an encrypted transcript of the execution, containing an encrypted version of the record output and a transaction ID, is posted on the network. +When an execution such as `transfer_private` consumes or generates a record, an encrypted transcript of the execution containing an encrypted version of the record output and a transaction ID is posted on the network. Because the records are encrypted when they're posted on the network, they do not reveal any information about the party who executed the program, nor the contents of the record. The only information that is revealed is the program ID, function name, encrypted function inputs, and the transaction ID of the program execution. No user except for the recipient of the record can see the contents of the record. -Below, you can see what the exact data which is posted to the Aleo network when `transfer_private` is run. Note that the +Below, you can see the exact data which is posted to the Aleo network when `transfer_private` is run. Note that the record, the amount transferred, and both the sender and recipient addresses are all encrypted.
-transfer_private Execution Transcript +`transfer_private` Execution Transcript ```json "transactions": [ @@ -1029,7 +792,7 @@ that are not owned by the user will fail. Record decryption and ownership verification can be done in the SDK using the following code: ```typescript -import { Account, RecordCiphertext, RecordPlaintext } from '@aleo/sdk'; +import { Account, RecordCiphertext, RecordPlaintext } from '@provablehq/sdk'; // Create an account from an existing private key const account = Account.from_string({privateKey: "existingPrivateKey"}); @@ -1053,7 +816,7 @@ if (RecordCiphertext.is_owner(account.viewKey())) { Mappings are simple key value stores defined in a program. They are represented by a key and a value each of a specified type. They are stored directly within the Aleo blockchain and can be publicly read by any participant in the Aleo network. -An example of a mapping usage is `account` mapping in the `credits.aleo` program. +An example of a mapping usage is the `account` mapping in the `credits.aleo` program. ``` mapping account: key owner as address.public; @@ -1098,7 +861,7 @@ class provides the `getMapping` method to read the public mappings within an pro read the value of a specific key within a mapping. ```typescript -import { AleoNetworkClient } from '@aleo/sdk'; +import { AleoNetworkClient } from '@provablehq/sdk'; const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1"); const creditsMappings = networkClient.getMappings("credits.aleo"); @@ -1110,7 +873,7 @@ assert(publicCredits === "0u64"); ### 4.5 Initializing & updating mappings Updating mappings is done by executing a program function on the Aleo network which has a finalize block that updates the -program's mapping. For instance the `transfer_public` function in the `credits.aleo` program updates the `account` +program's mapping. For instance, the `transfer_public` function in the `credits.aleo` program updates the `account` mapping (and thus a user's balance) when called. ``` @@ -1143,7 +906,7 @@ consumed. Therefore, it is important to ensure that the inputs to a function are A simple example of a mapping update can be shown by simply executing 'transfer_public` as shown below. ```typescript -import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@aleo/sdk'; +import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNetworkClient } from '@provablehq/sdk'; // Create a new NetworkClient, KeyProvider, and RecordProvider const account = Account.from_string({privateKey: "user1PrivateKey"}); @@ -1171,7 +934,7 @@ A full list of methods provided by the `AleoNetworkClient` class and usage examp ## Further Documentation -API documentation for this package, the Leo Language, and Aleo instructions can be found on the [Aleo Developer Hub](https://developer.aleo.org/sdk/typescript/overview). +API documentation for this package, the Leo Language, and Aleo instructions can be found in the [Leo Developer Docs](https://docs.leo-lang.org/getting_started). To view the API documentation for this package locally, open `docs/index.html`. To regenerate the documentation, run `npx jsdoc --configure jsdoc.json --verbose` diff --git a/sdk/package.json b/sdk/package.json index 5a6159b38..575adb90b 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -3,7 +3,7 @@ "version": "0.6.10", "description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions", "collaborators": [ - "The Provable Team " + "The Provable Team" ], "license": "GPL-3.0", "type": "module", @@ -34,7 +34,7 @@ "keywords": [ "Aleo", "Blockchain", - "Zero Knowledge", + "Zero-Knowledge", "ZK" ], "bugs": { diff --git a/sdk/src/program-manager.ts b/sdk/src/program-manager.ts index 85aa2ba89..fc4a40d6a 100644 --- a/sdk/src/program-manager.ts +++ b/sdk/src/program-manager.ts @@ -383,7 +383,7 @@ class ProgramManager { * programManager.setAccount(account); * * /// Get the response and ensure that the program executed correctly - * const executionResponse = await programManager.executeOffline(program, "hello", ["5u32", "5u32"]); + * const executionResponse = await programManager.run(program, "hello", ["5u32", "5u32"]); * const result = executionResponse.getOutputs(); * assert(result === ["10u32"]); */ diff --git a/sdk/src/worker.ts b/sdk/src/worker.ts index 8611538c7..062d732fb 100644 --- a/sdk/src/worker.ts +++ b/sdk/src/worker.ts @@ -17,7 +17,7 @@ keyProvider.useCache(true); let lastLocalProgram: string = ""; export interface WorkerAPI { - executeOffline: ( + run: ( localProgram: string, aleoFunction: string, inputs: string[], @@ -26,7 +26,7 @@ export interface WorkerAPI { getPrivateKey: () => Promise; } -async function executeOffline( +async function run( localProgram: string, aleoFunction: string, inputs: string[], @@ -131,5 +131,5 @@ async function getPrivateKey() { return privateKey.to_string(); } -const workerAPI = { executeOffline, getPrivateKey }; +const workerAPI = { run, getPrivateKey }; expose(workerAPI); diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 017be07c7..852912622 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "aleo-wasm" version = "0.6.9" -authors = [ "The Aleo Team " ] +authors = [ "The Provable Team" ] description = "WebAssembly based toolkit for developing zero-knowledge applications with Aleo" homepage = "https://aleo.org" repository = "https://github.com/ProvableHQ/sdk" diff --git a/wasm/package.json b/wasm/package.json index 6ddb64954..1945c43a0 100644 --- a/wasm/package.json +++ b/wasm/package.json @@ -3,7 +3,7 @@ "version": "0.6.10", "description": "Wasm build for the SDK", "collaborators": [ - "The Aleo Team " + "The Provable Team" ], "license": "GPL-3.0", "type": "module", diff --git a/website/src/workers/worker.js b/website/src/workers/worker.js index 167ae7156..5573bc489 100644 --- a/website/src/workers/worker.js +++ b/website/src/workers/worker.js @@ -5,7 +5,7 @@ await aleo.initThreadPool(); const defaultHost = "https://api.explorer.aleo.org/v1"; const keyProvider = new aleo.AleoKeyProvider(); const programManager = new aleo.ProgramManager(defaultHost, keyProvider, undefined); - +console.log("this is the web worker"); keyProvider.useCache(true); self.postMessage({