Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): Autogenerated Aztec-nr reference docs #3481

Merged
merged 37 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e3b31b6
initial script
catmcgee Nov 30, 2023
0c42ed3
multiple line comment descriptions
catmcgee Dec 5, 2023
9b9b625
Merge branch 'master' into aztecnr-reference
catmcgee Dec 18, 2023
44df329
reference
catmcgee Jan 15, 2024
07c6b13
Merge branch 'master' into aztecnr-reference
catmcgee Feb 6, 2024
5a745d5
update script
catmcgee Feb 6, 2024
9cb59e9
kinda working
catmcgee Feb 6, 2024
6462e80
sidebar merge conflicts
catmcgee Feb 9, 2024
54bd296
Merge remote-tracking branch 'origin/master' into aztecnr-reference
catmcgee Feb 9, 2024
e4935e7
transcript.hpp
catmcgee Feb 9, 2024
5f88400
script
catmcgee Feb 9, 2024
8efe5ad
fix yarn start:dev:local
catmcgee Feb 12, 2024
6160d9b
add code block in functions
catmcgee Feb 12, 2024
92e6418
added some comments
catmcgee Feb 12, 2024
1edcd75
Merge branch 'master' into aztecnr-reference
catmcgee Feb 12, 2024
dd7a1a9
Merge branch 'master' into aztecnr-reference
catmcgee Feb 12, 2024
8e5b51d
Merge branch 'master' into aztecnr-reference
catmcgee Feb 12, 2024
a490da8
Merge remote-tracking branch 'origin/master' into aztecnr-reference
catmcgee Feb 13, 2024
0c8a8fe
Merge branch 'master' into aztecnr-reference
catmcgee Feb 13, 2024
cc7c599
Merge branch 'master' into aztecnr-reference
catmcgee Feb 14, 2024
5780de5
Merge branch 'master' into aztecnr-reference
catmcgee Feb 14, 2024
7799747
Merge branch 'master' into aztecnr-reference
catmcgee Feb 15, 2024
9990da1
Merge branch 'master' into aztecnr-reference
catmcgee Feb 15, 2024
579a042
woops
catmcgee Feb 15, 2024
2cd491c
update paths for ci
catmcgee Feb 15, 2024
36de06a
const -> let
catmcgee Feb 15, 2024
b4e5bd9
Merge branch 'master' into aztecnr-reference
catmcgee Feb 16, 2024
5eccc41
update paths
catmcgee Feb 16, 2024
a881a8b
Merge branch 'master' into aztecnr-reference
catmcgee Feb 16, 2024
ad8a686
Merge branch 'master' into aztecnr-reference
catmcgee Feb 16, 2024
8eaa5c2
Merge branch 'master' into aztecnr-reference
catmcgee Feb 16, 2024
5b48bcc
Merge remote-tracking branch 'origin/master' into aztecnr-reference
catmcgee Feb 22, 2024
5d15b9e
Merge branch 'master' into aztecnr-reference
signorecello Feb 22, 2024
a7dcd86
chore(docs): fix
signorecello Feb 22, 2024
f87af4a
fix?
signorecello Feb 22, 2024
b708225
fix?
signorecello Feb 22, 2024
6a371cc
Merge branch 'master' into aztecnr-reference
signorecello Feb 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

docs/developers/contracts/references/aztec-nr
src/preprocess/developers

/src/preprocess/AztecnrReferenceAutogenStructure.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Allows us to modify the storage by inserting a note into the set.

A hash of the note will be generated, and inserted into the note hash tree, allowing us to later use in contract interactions. Recall that the content of the note should be shared with the owner to allow them to use it, as mentioned this can be done via an [encrypted log](../../writing_contracts/events/emit_event.md#encrypted-events), or offchain via web2, or completely offline.

#include_code insert /noir-projects/aztec-nr/easy-private-state/src/easy_private_state.nr rust
#include_code insert /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust

### `insert_from_public`

Expand All @@ -220,7 +220,7 @@ Nullifiers are emitted when reading values to make sure that they are up to date

An example of how to use this operation is visible in the `easy_private_state`:

#include_code remove /noir-projects/aztec-nr/easy-private-state/src/easy_private_state.nr rust
#include_code remove /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust

### `get_notes`

Expand All @@ -232,7 +232,7 @@ Because of this limit, we should always consider using the second argument `Note

An example of such options is using the [filter_notes_min_sum](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/aztec-nr/value-note/src/filter.nr) to get "enough" notes to cover a given value. Essentially, this function will return just enough notes to cover the amount specified such that we don't need to read all our notes. For users with a lot of notes, this becomes increasingly important.

#include_code get_notes /noir-projects/aztec-nr/easy-private-state/src/easy_private_state.nr rust
#include_code get_notes /noir-projects/aztec-nr/easy-private-state/src/easy_private_uint.nr rust

### `view_notes`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ In the public context this header is set by sequencer (sequencer executes public

Just like with the `is_contract_deployment` flag mentioned earlier. This data will only be set to true when the current transaction is one in which a contract is being deployed.

#include_code contract-deployment-data /noir-projects/noir-protocol-circuits/src/crates/types/src/contrakt/deployment_data.nr rust
#include_code contract-deployment-data /noir-projects/noir-protocol-circuits/src/crates/types/src/contrakt/contract_deployment_data.nr rust

### Private Global Variables

Expand Down
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"scripts": {
"docusaurus": "docusaurus",
"start": "yarn preprocess && yarn typedoc && docusaurus start --host 0.0.0.0",
"start:dev": "concurrently \"yarn preprocess:dev\" \"yarn typedoc:dev\" \"sleep 2 && docusaurus start --host 0.0.0.0\"",
"start:dev:local": "concurrently \"yarn preprocess:dev\" \"yarn typedoc:dev\" \"sleep 2 && docusaurus start\"",
"start:dev": "yarn start",
"start:dev:local": "yarn preprocess && yarn typedoc && docusaurus start",
"build": "./scripts/build.sh",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "rm -rf 'processed-docs' 'processed-docs-cache' docs/apis && docusaurus clear",
"clear": "rm -rf 'processed-docs' 'processed-docs-cache' docs/apis && docusaurus clear && rm 'src/preprocess/AztecnrReferenceAutogenStructure.json' && rm -rf 'docs/developers/references/aztec-nr'",
"serve": "docusaurus serve",
"preprocess": "yarn node -r dotenv/config ./src/preprocess/index.js",
"preprocess:dev": "nodemon --config nodemon.json ./src/preprocess/index.js",
"preprocess": "yarn node -r dotenv/config ./src/preprocess/index.js && node src/preprocess/generate_aztecnr_reference.js",
"preprocess:dev": "nodemon --config nodemon.json ./src/preprocess/index.js && nodemon --config nodemon.json src/preprocess/generate_aztecnr_reference.js ",
"typedoc": "rm -rf docs/apis && docusaurus generate-typedoc && cp -a docs/apis processed-docs/",
"typedoc:dev": "nodemon -w ../yarn-project -e '*.js,*.ts,*.nr,*.md' --exec \"rm -rf docs/apis && yarn docusaurus generate-typedoc && cp -a docs/apis processed-docs/\"",
"write-translations": "docusaurus write-translations",
Expand Down
3 changes: 3 additions & 0 deletions docs/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ fi

# Now build the docsite
echo Building docsite...
echo "Generating Aztec.nr reference docs..."
node ./src/preprocess/generate_aztecnr_reference.js
echo "Generated Aztec.nr reference docs"
yarn preprocess && yarn typedoc && yarn docusaurus build
75 changes: 58 additions & 17 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,47 @@

// @ts-check

const fs = require("fs");
const path = require("path");
// Load the structured documentation paths
const docsStructurePath = path.join(
__dirname,
"/src/preprocess/AztecnrReferenceAutogenStructure.json"
);
const docsStructure = JSON.parse(fs.readFileSync(docsStructurePath, "utf8"));

// Function to recursively build sidebar items from the structured documentation
function buildSidebarItemsFromStructure(structure, basePath = "") {
const items = [];
for (const key in structure) {
if (key === "_docs") {
// Base case: add the docs
structure[key].forEach((doc) => {
items.push(`${basePath}/${doc}`);
});
} else {
// Recursive case: process a subdirectory
const subItems = buildSidebarItemsFromStructure(
structure[key],
`${basePath}/${key}`
);
items.push({
type: "category",
label: key.charAt(0).toUpperCase() + key.slice(1), // Capitalize the label
items: subItems,
});
}
}
return items;
}

// Build sidebar for AztecNR documentation
const aztecNRSidebar = buildSidebarItemsFromStructure(
docsStructure.AztecNR,
"developers/contracts/references/aztec-nr"
);

console.log(aztecNRSidebar);
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
docsSidebar: [
Expand All @@ -22,7 +63,7 @@ const sidebars = {
// ABOUT AZTEC

{
type: "html",
type: "html",
className: "sidebar-title",
value: "LEARN",
defaultStyle: true,
Expand Down Expand Up @@ -278,9 +319,7 @@ const sidebars = {
id: "apis/pxe/interfaces/PXE",
},
],

},

],
},
{
Expand Down Expand Up @@ -331,7 +370,6 @@ const sidebars = {
type: "category",
items: [
"developers/contracts/writing_contracts/accounts/write_accounts_contract",

],
},
{
Expand Down Expand Up @@ -383,7 +421,8 @@ const sidebars = {
],
},
{
label: "Access public data from private state (Slow Updates Tree)",
label:
"Access public data from private state (Slow Updates Tree)",
type: "category",
link: {
type: "doc",
Expand All @@ -393,7 +432,6 @@ const sidebars = {
"developers/contracts/writing_contracts/historical_data/slow_updates_tree/implement_slow_updates",
],
},

],
},
{
Expand All @@ -402,16 +440,16 @@ const sidebars = {
items: [
"developers/contracts/compiling_contracts/how_to_compile_contract",
"developers/contracts/compiling_contracts/artifacts",
],
],
},
{
label: "Deploying Contracts",
type: "category",
items: [
"developers/contracts/deploying_contracts/how_to_deploy_contract",
],
],
},
"developers/contracts/testing_contracts/main",
"developers/contracts/testing_contracts/main",
{
label: "References",
type: "category",
Expand All @@ -426,7 +464,7 @@ const sidebars = {
},
items: [
"developers/contracts/references/storage/private_state",
"developers/contracts/references/storage/public_state"
"developers/contracts/references/storage/public_state",
],
},
{
Expand All @@ -439,6 +477,11 @@ const sidebars = {
"developers/contracts/references/portals/registry",
],
},
{
label: "Aztec.nr Reference",
type: "category",
items: aztecNRSidebar,
},
"developers/contracts/references/history_lib_reference",
"developers/contracts/references/slow_updates_tree",
],
Expand Down Expand Up @@ -502,7 +545,7 @@ const sidebars = {
"developers/aztecjs/guides/call_view_function",
],
},
{
{
label: "References",
type: "category",
items: [
Expand All @@ -516,9 +559,9 @@ const sidebars = {
type: "category",
items: [{ dirName: "apis/accounts", type: "autogenerated" }],
},
],
},
],
],
},
],
},
{
label: "Debugging",
Expand All @@ -544,9 +587,7 @@ const sidebars = {
type: "doc",
id: "developers/wallets/main",
},
items: [
"developers/wallets/architecture",
],
items: ["developers/wallets/architecture"],
},

/* {
Expand Down
Loading
Loading