diff --git a/docs/docs/tutorials/noirjs_app.md b/docs/docs/tutorials/noirjs_app.md index ebc7248dcbd..e82e5e24821 100644 --- a/docs/docs/tutorials/noirjs_app.md +++ b/docs/docs/tutorials/noirjs_app.md @@ -16,14 +16,14 @@ You can find the complete app code for this guide [here](https://github.com/noir Before we start, we want to make sure we have Node installed. If you don't have it already you can install it [here](https://nodejs.org/en/download), we recommend using [Yarn](https://yarnpkg.com/getting-started/install) as our package manager for this tutorial. -We'll also need version 1.0.0-beta.14 nargo installed, see the Noir [installation guide](../getting_started/noir_installation.md) for details. +We'll also need version 1.0.0-beta.15 nargo installed, see the Noir [installation guide](../getting_started/noir_installation.md) for details. Let's go barebones. Doing the bare minimum is not only simple, but also allows you to easily adapt it to almost any frontend framework. Barebones means we can immediately start with the dependencies even on an empty folder 😈: ```bash -yarn add @noir-lang/noir_js@1.0.0-beta.14 @aztec/bb.js@3.0.0-nightly.20251030-2 buffer vite vite-plugin-node-polyfills +yarn add @noir-lang/noir_js@1.0.0-beta.15 @aztec/bb.js@3.0.0-nightly.20251104 buffer vite vite-plugin-node-polyfills@0.17.0 ``` Wait, what are these dependencies? @@ -33,7 +33,7 @@ Wait, what are these dependencies? :::info -In this guide, we will install versions pinned to 1.0.0-beta.14. These work with Barretenberg version 3.0.0-nightly.20251030-2, so we are using that one version too. Feel free to try with older or later versions, though! +In this guide, we will install versions pinned to 1.0.0-beta.15. These work with Barretenberg version 3.0.0-nightly.20251104, so we are using that one version too. Feel free to try with older or later versions, though! ::: @@ -47,7 +47,7 @@ It's not just you. We also enjoy syntax highlighting. [Check out the Language Se ::: -All you need is a `main.nr` and a `Nargo.toml` file. You can follow the [noirup](../getting_started/noir_installation.md) installation and just run `noirup -v 1.0.0-beta.14`, or just create them by hand: +All you need is a `main.nr` and a `Nargo.toml` file. You can follow the [noirup](../getting_started/noir_installation.md) installation and just run `noirup -v 1.0.0-beta.15`, or just create them by hand: ```bash mkdir -p circuit/src @@ -77,7 +77,7 @@ Finally we're up for something cool. But before we can execute a Noir program, w This can be done by cd-ing into our circuit directory and running the `nargo compile` command. ```bash -cd circuits +cd circuit nargo compile ``` @@ -86,7 +86,7 @@ This will write the compiled circuit into the `target` directory, which we'll th ## Setting up our app -Remember when apps only had one `html` and one `js` file? Well, that's enough for Noir webapps. Let's create them: +Remember when apps only had one `html` and one `js` file? Well, that's enough for Noir webapps. Let's create them in the project root: ```bash touch index.html index.js @@ -100,7 +100,17 @@ It _could_ be a beautiful UI... Depending on which universe you live in. In any As for the JS, real madmen could just `console.log` everything, but let's say we want to see things happening (the true initial purpose of JS... right?). Here's some boilerplate for that. Just paste it in `index.js`: -#include_code show_function examples/browser/index.js js +```js +#include_code show_function examples/browser/index.js raw + +document.getElementById('submit').addEventListener('click', async () => { + try { + // code will go in here + } catch { + show('logs', 'Oh 💔'); + } +}); +``` :::info @@ -108,22 +118,23 @@ At this point in the tutorial, your folder structure should look like this: ```tree . -└── circuit - └── node_modules - └── src - └── main.nr - Nargo.toml - index.html - index.js - package.json - ...etc +├── circuit +│ ├── Nargo.toml +│ ├── src +│ │ └── main.nr +│ └── target +│ └── circuit.json +├── index.html +├── index.js +├── package.json +├── etc... ``` ::: ## Some more JS -We're starting with the good stuff now. We want to execute our circuit to get the witness, and then feed that witness to Barretenberg. Luckily, both packages are quite easy to work with. Let's import them at the top of the file: +We're starting with the good stuff now. We want to execute our circuit to get the witness, and then feed that witness to Barretenberg. Luckily, both packages are quite easy to work with. Let's import them at the top of the file and initialize the WASM modules: #include_code imports examples/browser/index.js js diff --git a/docs/versioned_docs/version-v1.0.0-beta.14/tutorials/noirjs_app.md b/docs/versioned_docs/version-v1.0.0-beta.14/tutorials/noirjs_app.md index 1688c9f0905..987fa956e17 100644 --- a/docs/versioned_docs/version-v1.0.0-beta.14/tutorials/noirjs_app.md +++ b/docs/versioned_docs/version-v1.0.0-beta.14/tutorials/noirjs_app.md @@ -16,14 +16,14 @@ You can find the complete app code for this guide [here](https://github.com/noir Before we start, we want to make sure we have Node installed. If you don't have it already you can install it [here](https://nodejs.org/en/download), we recommend using [Yarn](https://yarnpkg.com/getting-started/install) as our package manager for this tutorial. -We'll also need version 1.0.0-beta.2 nargo installed, see the Noir [installation guide](../getting_started/noir_installation.md) for details. +We'll also need version 1.0.0-beta.14 nargo installed, see the Noir [installation guide](../getting_started/noir_installation.md) for details. Let's go barebones. Doing the bare minimum is not only simple, but also allows you to easily adapt it to almost any frontend framework. Barebones means we can immediately start with the dependencies even on an empty folder 😈: ```bash -yarn add @noir-lang/noir_js@1.0.0-beta.9 @aztec/bb.js@0.87.0 +yarn add @noir-lang/noir_js@1.0.0-beta.14 @aztec/bb.js@3.0.0-nightly.20251030-2 buffer vite vite-plugin-node-polyfills@0.17.0 ``` Wait, what are these dependencies? @@ -33,7 +33,7 @@ Wait, what are these dependencies? :::info -In this guide, we will install versions pinned to 1.0.0-beta.9. These work with Barretenberg version 0.87.0, so we are using that one version too. Feel free to try with older or later versions, though! +In this guide, we will install versions pinned to 1.0.0-beta.14. These work with Barretenberg version 3.0.0-nightly.20251030-2, so we are using that one version too. Feel free to try with older or later versions, though! ::: @@ -47,7 +47,7 @@ It's not just you. We also enjoy syntax highlighting. [Check out the Language Se ::: -All you need is a `main.nr` and a `Nargo.toml` file. You can follow the [noirup](../getting_started/noir_installation.md) installation and just run `noirup -v 1.0.0-beta.6`, or just create them by hand: +All you need is a `main.nr` and a `Nargo.toml` file. You can follow the [noirup](../getting_started/noir_installation.md) installation and just run `noirup -v 1.0.0-beta.14`, or just create them by hand: ```bash mkdir -p circuit/src @@ -56,7 +56,7 @@ touch circuit/src/main.nr circuit/Nargo.toml To make our program interesting, let's give it a real use-case scenario: Bob wants to prove he is older than 18, without disclosing his age. Open `main.nr` and write: -```rust title="age_check" showLineNumbers +```rust title="age_check" showLineNumbers fn main(age: u8) { assert(age > 18); } @@ -83,7 +83,7 @@ Finally we're up for something cool. But before we can execute a Noir program, w This can be done by cd-ing into our circuit directory and running the `nargo compile` command. ```bash -cd circuits +cd circuit nargo compile ``` @@ -92,7 +92,7 @@ This will write the compiled circuit into the `target` directory, which we'll th ## Setting up our app -Remember when apps only had one `html` and one `js` file? Well, that's enough for Noir webapps. Let's create them: +Remember when apps only had one `html` and one `js` file? Well, that's enough for Noir webapps. Let's create them in the project root: ```bash touch index.html index.js @@ -100,7 +100,7 @@ touch index.html index.js And add something useful to our HTML file: -```html title="index" showLineNumbers +```html title="index" showLineNumbers