diff --git a/.circleci/config.yml b/.circleci/config.yml
index ae14946c3d81..67896e61472f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1315,8 +1315,6 @@ workflows:
when:
equal: [system, << pipeline.parameters.workflow >>]
jobs:
- - build-docs: *defaults
-
# Barretenberg
- barretenberg-x86_64-linux-gcc: *defaults
- barretenberg-x86_64-linux-clang: *defaults
@@ -1409,7 +1407,8 @@ workflows:
- l1-contracts
- noir-contracts-build
<<: *defaults
-
+
+ - build-docs: *yarn_project
- aztec-js: *yarn_project
- end-to-end: *yarn_project
- ethereum: *yarn_project
diff --git a/docs/Dockerfile b/docs/Dockerfile
index 572658476eb6..eb5071dc4f22 100644
--- a/docs/Dockerfile
+++ b/docs/Dockerfile
@@ -1,10 +1,14 @@
-FROM node:18-alpine
-RUN apk update
+FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/yarn-project-base AS builder
WORKDIR /usr/src
COPY . .
+WORKDIR /usr/src/yarn-project
+
+RUN yarn build
+
WORKDIR /usr/src/docs
-RUN yarn && yarn build
\ No newline at end of file
+RUN yarn && yarn build
+
diff --git a/docs/docs/.gitignore b/docs/docs/.gitignore
new file mode 100644
index 000000000000..6fa7731468dd
--- /dev/null
+++ b/docs/docs/.gitignore
@@ -0,0 +1 @@
+/apis
diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js
index 7354306c98f9..54f750d2e396 100644
--- a/docs/docusaurus.config.js
+++ b/docs/docusaurus.config.js
@@ -122,6 +122,32 @@ const config = {
disableInDev: false,
},
],
+ [
+ "@spalladino/docusaurus-plugin-typedoc",
+ {
+ id: "apis/aztec-rpc",
+ entryPoints: ["../yarn-project/types/src/interfaces/aztec_rpc.ts"],
+ tsconfig: "../yarn-project/types/tsconfig.json",
+ entryPointStrategy: "expand",
+ out: "apis/aztec-rpc",
+ disableSources: true,
+ frontmatter: { sidebar_label: "Aztec RPC Server" },
+ },
+ ],
+ [
+ "@spalladino/docusaurus-plugin-typedoc",
+ {
+ id: "apis/aztec-js",
+ entryPoints: [
+ "../yarn-project/aztec.js/src/contract/index.ts",
+ "../yarn-project/aztec.js/src/account/index.ts",
+ ],
+ tsconfig: "../yarn-project/aztec.js/tsconfig.json",
+ entryPointStrategy: "resolve",
+ out: "apis/aztec-js",
+ disableSources: true,
+ },
+ ],
// ["./src/plugins/plugin-embed-code", {}],
],
themeConfig:
diff --git a/docs/package.json b/docs/package.json
index b3017e9b2b22..594416233534 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -4,19 +4,20 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
- "start": "docusaurus start",
- "start:dev": "concurrently \"yarn preprocess:dev\" \"docusaurus start --host 0.0.0.0\"",
- "start:dev:local": "concurrently \"yarn preprocess:dev\" \"docusaurus start\"",
- "build": "yarn preprocess && docusaurus build",
+ "start": "yarn preprocess && yarn typedoc && docusaurus start",
+ "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\"",
+ "build": "./scripts/build.sh",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
- "clear": "rm -rf 'processed-docs' 'processed-docs-cache' && docusaurus clear",
+ "clear": "rm -rf 'processed-docs' 'processed-docs-cache' docs/apis && docusaurus clear",
"serve": "docusaurus serve",
"preprocess": "yarn node ./src/preprocess/index.js",
"preprocess:dev": "nodemon --config nodemon.json ./src/preprocess/index.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",
- "write-heading-ids": "docusaurus write-heading-ids",
- "update-specs": "./scripts/update_specs.sh"
+ "write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^2.4.1",
@@ -36,9 +37,12 @@
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1",
+ "@spalladino/docusaurus-plugin-typedoc": "^0.20.3",
"@tsconfig/docusaurus": "^1.0.5",
"concurrently": "^8.0.1",
"nodemon": "^3.0.1",
+ "typedoc": "^0.25.1",
+ "typedoc-plugin-markdown": "^3.16.0",
"typescript": "^4.7.2"
},
"browserslist": {
diff --git a/docs/scripts/build.sh b/docs/scripts/build.sh
new file mode 100755
index 000000000000..d1c4aaab1d4d
--- /dev/null
+++ b/docs/scripts/build.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+set -eo pipefail
+
+# Helper function for building packages in yarn project
+build_package() {
+ local package_name="$1"
+ local build_command="${2:-yarn build}"
+
+ echo "Building $package_name..."
+ (cd "yarn-project/$package_name" && $build_command)
+}
+
+# Build script. If run on Netlify, first it needs to compile all yarn-projects
+# that are involved in typedoc in order to generate their type information.
+if [ -n "$NETLIFY" ]; then
+ # Move to project root
+ cd ..
+ echo Working dir $(pwd)
+
+ # Make sure the latest tag is available for loading code snippets from it
+ LAST_TAG="aztec-packages-v$(jq -r '.["."]' .release-please-manifest.json)"
+ echo Fetching latest released tag $LAST_TAG...
+ git fetch origin refs/tags/$LAST_TAG:refs/tags/$LAST_TAG
+
+ # Tweak global tsconfig so we skip tests in all projects
+ echo Removing test files from tsconfig...
+ jq '. + { "exclude": ["**/*test.ts"] }' yarn-project/tsconfig.json > yarn-project/tsconfig.tmp.json
+ mv yarn-project/tsconfig.tmp.json yarn-project/tsconfig.json
+
+ # Install deps (maybe we can have netlify download these automatically so they get cached..?)
+ echo Installing yarn-project dependencies...
+ (cd yarn-project && yarn)
+
+ # Build the required projects for typedoc
+ build_package "aztec-rpc"
+ build_package "aztec.js" "yarn build:ts"
+
+ # Back to docs site
+ cd docs
+
+ # Install deps
+ echo Install docs deps...
+ yarn
+fi
+
+# Now build the docsite
+echo Building docsite...
+yarn preprocess && yarn typedoc && yarn docusaurus build
diff --git a/docs/sidebars.js b/docs/sidebars.js
index d9362ebe4817..94ec83570ede 100644
--- a/docs/sidebars.js
+++ b/docs/sidebars.js
@@ -346,6 +346,23 @@ const sidebars = {
"dev_docs/privacy/main",
"dev_docs/limitations/main",
+ {
+ label: "API Reference",
+ type: "category",
+ items: [
+ {
+ label: "Aztec RPC Server",
+ type: "doc",
+ id: "apis/aztec-rpc/interfaces/AztecRPC",
+ },
+ {
+ label: "Aztec.js",
+ type: "category",
+ items: [{ dirName: "apis/aztec-js", type: "autogenerated" }],
+ },
+ ],
+ },
+
{
type: "html",
value: '',
diff --git a/docs/src/preprocess/include_code.js b/docs/src/preprocess/include_code.js
index 1e87b9aa3513..9991780e2cc0 100644
--- a/docs/src/preprocess/include_code.js
+++ b/docs/src/preprocess/include_code.js
@@ -93,7 +93,7 @@ function readFile(filePath, tag) {
return childProcess.execSync(`git show ${tag}:${relPath}`).toString();
} catch (err) {
console.error(
- `Error reading file ${relPath} from latest version. Falling back to current content.`
+ `Error reading file ${filePath} from latest version. Falling back to current content.`
);
}
}
diff --git a/docs/yarn.lock b/docs/yarn.lock
index 6b47a0365228..3057a40b1e83 100644
--- a/docs/yarn.lock
+++ b/docs/yarn.lock
@@ -1875,6 +1875,11 @@
p-map "^4.0.0"
webpack-sources "^3.2.2"
+"@spalladino/docusaurus-plugin-typedoc@^0.20.3":
+ version "0.20.3"
+ resolved "https://registry.yarnpkg.com/@spalladino/docusaurus-plugin-typedoc/-/docusaurus-plugin-typedoc-0.20.3.tgz#04e0f8db61b8328ab0b8d6d4bd43a59fb0cdbbdd"
+ integrity sha512-LufWGbOUbyztOgJY42UDeQ0bnpTqZBtdIL1duTaIMpNj1MM2N9F3QqQhmQY3J9SnqCnkMjZu13RnK/ninWbLLg==
+
"@svgr/babel-plugin-add-jsx-attribute@^6.5.1":
version "6.5.1"
resolved "https://registry.yarnpkg.com/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-6.5.1.tgz#74a5d648bd0347bda99d82409d87b8ca80b9a1ba"
@@ -2531,6 +2536,11 @@ ansi-regex@^6.0.1:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a"
integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==
+ansi-sequence-parser@^1.1.0:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz#e0aa1cdcbc8f8bb0b5bca625aac41f5f056973cf"
+ integrity sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==
+
ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
@@ -2802,6 +2812,13 @@ brace-expansion@^1.1.7:
balanced-match "^1.0.0"
concat-map "0.0.1"
+brace-expansion@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
+ integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
+ dependencies:
+ balanced-match "^1.0.0"
+
braces@^3.0.2, braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
@@ -4693,6 +4710,18 @@ handle-thing@^2.0.0:
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e"
integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==
+handlebars@^4.7.7:
+ version "4.7.8"
+ resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9"
+ integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==
+ dependencies:
+ minimist "^1.2.5"
+ neo-async "^2.6.2"
+ source-map "^0.6.1"
+ wordwrap "^1.0.0"
+ optionalDependencies:
+ uglify-js "^3.1.4"
+
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
@@ -5402,6 +5431,11 @@ json5@^2.1.2, json5@^2.2.2:
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
+jsonc-parser@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76"
+ integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==
+
jsonfile@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
@@ -5596,6 +5630,11 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"
+lunr@^2.3.9:
+ version "2.3.9"
+ resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
+ integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==
+
make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
@@ -5608,6 +5647,11 @@ markdown-escapes@^1.0.0:
resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.4.tgz#c95415ef451499d7602b91095f3c8e8975f78535"
integrity sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==
+marked@^4.3.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3"
+ integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==
+
mdast-squeeze-paragraphs@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/mdast-squeeze-paragraphs/-/mdast-squeeze-paragraphs-4.0.0.tgz#7c4c114679c3bee27ef10b58e2e015be79f1ef97"
@@ -5781,6 +5825,13 @@ minimatch@3.1.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch
dependencies:
brace-expansion "^1.1.7"
+minimatch@^9.0.3:
+ version "9.0.3"
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
+ integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
+ dependencies:
+ brace-expansion "^2.0.1"
+
minimist@^1.2.0, minimist@^1.2.5:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
@@ -7474,6 +7525,16 @@ shelljs@^0.8.5:
interpret "^1.0.0"
rechoir "^0.6.2"
+shiki@^0.14.1:
+ version "0.14.4"
+ resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.4.tgz#2454969b466a5f75067d0f2fa0d7426d32881b20"
+ integrity sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==
+ dependencies:
+ ansi-sequence-parser "^1.1.0"
+ jsonc-parser "^3.2.0"
+ vscode-oniguruma "^1.7.0"
+ vscode-textmate "^8.0.0"
+
side-channel@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
@@ -7962,6 +8023,23 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
+typedoc-plugin-markdown@^3.16.0:
+ version "3.16.0"
+ resolved "https://registry.yarnpkg.com/typedoc-plugin-markdown/-/typedoc-plugin-markdown-3.16.0.tgz#98da250271aafade8b6740a8116a97cd3941abcd"
+ integrity sha512-eeiC78fDNGFwemPIHiwRC+mEC7W5jwt3fceUev2gJ2nFnXpVHo8eRrpC9BLWZDee6ehnz/sPmNjizbXwpfaTBw==
+ dependencies:
+ handlebars "^4.7.7"
+
+typedoc@^0.25.1:
+ version "0.25.1"
+ resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.25.1.tgz#50de2d8fb93623fbfb59e2fa6407ff40e3d3f438"
+ integrity sha512-c2ye3YUtGIadxN2O6YwPEXgrZcvhlZ6HlhWZ8jQRNzwLPn2ylhdGqdR8HbyDRyALP8J6lmSANILCkkIdNPFxqA==
+ dependencies:
+ lunr "^2.3.9"
+ marked "^4.3.0"
+ minimatch "^9.0.3"
+ shiki "^0.14.1"
+
typescript@^4.7.2:
version "4.9.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78"
@@ -7972,6 +8050,11 @@ ua-parser-js@^0.7.30:
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211"
integrity sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==
+uglify-js@^3.1.4:
+ version "3.17.4"
+ resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.4.tgz#61678cf5fa3f5b7eb789bb345df29afb8257c22c"
+ integrity sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==
+
undefsafe@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.5.tgz#38733b9327bdcd226db889fb723a6efd162e6e2c"
@@ -8250,6 +8333,16 @@ vfile@^4.0.0:
unist-util-stringify-position "^2.0.0"
vfile-message "^2.0.0"
+vscode-oniguruma@^1.7.0:
+ version "1.7.0"
+ resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b"
+ integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==
+
+vscode-textmate@^8.0.0:
+ version "8.0.0"
+ resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d"
+ integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==
+
wait-on@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-6.0.1.tgz#16bbc4d1e4ebdd41c5b4e63a2e16dbd1f4e5601e"
@@ -8461,6 +8554,11 @@ wildcard@^2.0.0:
resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec"
integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==
+wordwrap@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
+ integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==
+
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
diff --git a/yarn-project/aztec.js/README.md b/yarn-project/aztec.js/README.md
index efaeb621cd84..1c92ea26ede1 100644
--- a/yarn-project/aztec.js/README.md
+++ b/yarn-project/aztec.js/README.md
@@ -1,44 +1,46 @@
# Aztec.js
-Aztec.js is a tool that provides APIs for interacting with contracts on the Aztec network. It communicates with the [AztecRPCServer](../aztec-rpc/) through an AztecRPCClient implementation, allowing developers to easily deploy contracts, view functions, and send transactions.
+Aztec.js is a library that provides APIs for managing accounts and interacting with contracts on the Aztec network. It communicates with the [Aztec RPC Server](https://docs.aztec.network/apis/aztec-rpc/interfaces/AztecRPC) through an `AztecRPCClient` implementation, allowing developers to easily register new accounts, deploy contracts, view functions, and send transactions.
-### Usage
+## Usage
-#### Deploy a contract
+### Create a new account
```typescript
-import { ContractDeployer } from '@aztec/aztec.js';
+import { getSchnorrAccount } from '@aztec/aztec.js';
+import { GrumpkinPrivateKey } from '@aztec/types';
-const deployer = new ContractDeployer(contractAbi, aztecRpcServer);
-const tx = deployer.deploy(constructorArgs[0], constructorArgs[1]).send();
-// wait for tx to be mined
-const receipt = await tx.wait();
-console.log(`Contract deployed at ${receipt.contractAddress}`);
+const encryptionPrivateKey = GrumpkinPrivateKey.random();
+const signingPrivateKey = GrumpkinPrivateKey.random();
+const wallet = getSchnorrAccount(rpc, encryptionPrivateKey, signingPrivateKey).waitDeploy();
+console.log(`New account deployed at ${wallet.getAddress()}`);
```
-#### Send a transaction
+### Deploy a contract
```typescript
import { Contract } from '@aztec/aztec.js';
-const contract = await Contract.at(contractAddress, contractAbi, aztecRpcServer);
-const tx = contract.methods
- .transfer(amount, recipientAddress)
- .send({ origin: senderAddress });
+const contract = await Contract.deploy(wallet, MyContractAbi, [...constructorArgs]).send().deployed();
+console.log(`Contract deployed at ${contract.address}`);
+```
+
+### Send a transaction
+
+```typescript
+import { Contract } from '@aztec/aztec.js';
-// wait for tx to be mined
-await tx.wait();
-console.log(`Transferred ${amount} to ${recipientAddress}!`);
+const contract = await Contract.at(contractAddress, MyContractAbi, wallet);
+const tx = await contract.methods.transfer(amount, recipientAddress).send().wait();
+console.log(`Transferred ${amount} to ${recipientAddress} on block ${tx.blockNumber}`);
```
-#### Call a view function
+### Call a view function
```typescript
import { Contract } from '@aztec/aztec.js';
-const contract = await Contract.at(contractAddress, contractAbi, aztecRpcServer);
-const balance = contract.methods
- .getBalance(accountPublicKey))
- .view({ from: accountAddress });
-console.log(`Account balance: ${balance}.`);
+const contract = await Contract.at(contractAddress, MyContractAbi, wallet);
+const balance = await contract.methods.getBalance(wallet.getAddress()).view();
+console.log(`Account balance is ${balance}`);
```
diff --git a/yarn-project/aztec.js/package.json b/yarn-project/aztec.js/package.json
index 87846f730cb9..12d26f8484b6 100644
--- a/yarn-project/aztec.js/package.json
+++ b/yarn-project/aztec.js/package.json
@@ -19,6 +19,7 @@
"build": "yarn clean && tsc -b && webpack",
"build:web": "webpack",
"build:dev": "tsc -b --watch",
+ "build:ts": "tsc -b",
"clean": "rm -rf ./dest .tsbuildinfo",
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
"formatting:fix": "run -T prettier -w ./src",
diff --git a/yarn-project/aztec.js/package.local.json b/yarn-project/aztec.js/package.local.json
index ae44d5384f7f..bdabc013c57a 100644
--- a/yarn-project/aztec.js/package.local.json
+++ b/yarn-project/aztec.js/package.local.json
@@ -1,5 +1,8 @@
{
"scripts": {
- "build": "yarn clean && tsc -b && webpack"
+ "build": "yarn clean && tsc -b && webpack",
+ "build:web": "webpack",
+ "build:dev": "tsc -b --watch",
+ "build:ts": "tsc -b"
}
}
diff --git a/yarn-project/aztec.js/src/account/index.ts b/yarn-project/aztec.js/src/account/index.ts
index eee5ce8e1e6b..4db12237ee81 100644
--- a/yarn-project/aztec.js/src/account/index.ts
+++ b/yarn-project/aztec.js/src/account/index.ts
@@ -1,3 +1,24 @@
+/**
+ * The `account` module provides utilities for managing accounts. The most common methods to use
+ * are {@link getEcdsaAccount} and {@link getSchnorrAccount}, which return {@link AccountManager} instances
+ * using the default ECDSA or Schnorr account implementation respectively. The {@link AccountManager} class then
+ * allows to deploy and register a fresh account, or to obtain a `Wallet` instance out of an account already deployed.
+ *
+ * ```ts
+ * const encryptionPrivateKey = GrumpkinScalar.random();
+ * const signingPrivateKey = GrumpkinScalar.random();
+ * const wallet = getSchnorrAccount(rpc, encryptionPrivateKey, signingPrivateKey).waitDeploy();
+ * ```
+ *
+ * For testing purposes, consider using the {@link createAccount} and {@link createAccounts} methods,
+ * which create, register, and deploy random accounts, and return their associated `Wallet`s.
+ *
+ * For implementing your own account contract, the recommended way is to extend from the base
+ * {@link BaseAccountContract} class.
+ * Read more in {@link https://docs.aztec.network/dev_docs/wallets/writing_an_account_contract | Writing an account contract}.
+ *
+ * @packageDocumentation
+ */
import { AztecRPC, CompleteAddress, GrumpkinPrivateKey } from '@aztec/types';
import { AccountContract, AccountWallet, AztecAddress, Fr } from '../index.js';
@@ -8,6 +29,7 @@ import { AccountManager } from './manager/index.js';
export * from './contract/index.js';
export * from './defaults/index.js';
+export * from './utils.js';
export { AccountInterface, AuthWitnessProvider } from './interface.js';
export { AccountManager, CompleteAddress };
diff --git a/yarn-project/aztec.js/src/utils/account.ts b/yarn-project/aztec.js/src/account/utils.ts
similarity index 96%
rename from yarn-project/aztec.js/src/utils/account.ts
rename to yarn-project/aztec.js/src/account/utils.ts
index 8bf9bda47981..fcf63096b3a6 100644
--- a/yarn-project/aztec.js/src/utils/account.ts
+++ b/yarn-project/aztec.js/src/account/utils.ts
@@ -5,7 +5,7 @@ import { getSchnorrAccount } from '../index.js';
import { AccountWallet } from '../wallet/account_wallet.js';
/**
- * Deploys and registers a new account using random private keys and returns the associated wallet. Useful for testing.
+ * Deploys and registers a new account using random private keys and returns the associated Schnorr account wallet. Useful for testing.
* @param rpc - RPC client.
* @returns - A wallet for a fresh account.
*/
diff --git a/yarn-project/aztec.js/src/contract/base_contract_interaction.ts b/yarn-project/aztec.js/src/contract/base_contract_interaction.ts
index df444dff0628..6a9458f27c5d 100644
--- a/yarn-project/aztec.js/src/contract/base_contract_interaction.ts
+++ b/yarn-project/aztec.js/src/contract/base_contract_interaction.ts
@@ -6,12 +6,12 @@ import { SentTx } from './sent_tx.js';
* Represents options for calling a (constrained) function in a contract.
* Allows the user to specify the sender address and nonce for a transaction.
*/
-export interface SendMethodOptions {
+export type SendMethodOptions = {
/**
* Wether to skip the simulation of the public part of the transaction.
*/
skipPublicSimulation?: boolean;
-}
+};
/**
* Base class for an interaction with a contract, be it a deployment, a function call, or a batch.
diff --git a/yarn-project/aztec.js/src/contract/contract_function_interaction.ts b/yarn-project/aztec.js/src/contract/contract_function_interaction.ts
index 23753d6eb887..e8a58728fe4c 100644
--- a/yarn-project/aztec.js/src/contract/contract_function_interaction.ts
+++ b/yarn-project/aztec.js/src/contract/contract_function_interaction.ts
@@ -11,12 +11,12 @@ export { SendMethodOptions };
* Represents the options for a view method in a contract function interaction.
* Allows specifying the address from which the view method should be called.
*/
-export interface ViewMethodOptions {
+export type ViewMethodOptions = {
/**
* The sender's Aztec address.
*/
from?: AztecAddress;
-}
+};
/**
* This is the class that is returned when calling e.g. `contract.methods.myMethod(arg0, arg1)`.
diff --git a/yarn-project/aztec.js/src/contract/index.ts b/yarn-project/aztec.js/src/contract/index.ts
index 0079784c7d78..9ef6df450499 100644
--- a/yarn-project/aztec.js/src/contract/index.ts
+++ b/yarn-project/aztec.js/src/contract/index.ts
@@ -1,3 +1,40 @@
+/**
+ * The `contract` module provides utilities for deploying and interacting with contracts, based on a
+ * `Wallet` instance and a compiled artifact. Refer to the {@link account} module for how to obtain a valid
+ * `Wallet` instance, and to the {@link https://docs.aztec.network/dev_docs/contracts/compiling | Compiling contracts}
+ * section of the documentation for how to generate an artifact out of your Noir source code.
+ *
+ * The {@link Contract} class is the main class in this module, and provides static methods for deploying
+ * a contract or interacting with an already deployed one. The `methods` property of the contract instance
+ * provides access to private, public, and view methods, that can be invoked in a transaction via `send()`,
+ * or can be queried via `view()`.
+ *
+ * ```ts
+ * const contract = await Contract.deploy(wallet, MyContractAbi, [...constructorArgs]).send().deployed();
+ * console.log(`Contract deployed at ${contract.address}`);
+ * ```
+ *
+ * ```ts
+ * const contract = await Contract.at(address, MyContractAbi, wallet);
+ * await contract.methods.mint(1000, owner).send().wait();
+ * console.log(`Total supply is now ${await contract.methods.totalSupply().view()}`);
+ * ```
+ *
+ * The result of calling a method in a contract instance, such as `contract.methods.mint(1000, owner)`
+ * in the example, is a {@link ContractFunctionInteraction} instance. Usually this will be just sent as
+ * a transaction to the network via the `send` method, but you can also `simulate` it without sending,
+ * or obtaining the `request` for aggregating into a {@link BatchCall}.
+ *
+ * The result of `send`ing a transaction is a {@link SentTx} object, from which you can get the
+ * transaction hash, or simply `wait` until the transaction is mined and the local RPC server
+ * has synchronised its changes.
+ *
+ * @remarks If you are using typescript, consider using the
+ * {@link https://docs.aztec.network/dev_docs/contracts/compiling#typescript-interfaces | autogenerated type-safe interfaces}
+ * for interacting with your contracts.
+ *
+ * @packageDocumentation
+ */
export * from './contract.js';
export * from './contract_function_interaction.js';
export * from './sent_tx.js';
diff --git a/yarn-project/aztec.js/src/contract_deployer/deploy_method.ts b/yarn-project/aztec.js/src/contract_deployer/deploy_method.ts
index 9e80b8d45a02..b10c6df43fc2 100644
--- a/yarn-project/aztec.js/src/contract_deployer/deploy_method.ts
+++ b/yarn-project/aztec.js/src/contract_deployer/deploy_method.ts
@@ -18,7 +18,7 @@ import { DeploySentTx } from './deploy_sent_tx.js';
* Options for deploying a contract on the Aztec network.
* Allows specifying a portal contract, contract address salt, and additional send method options.
*/
-export interface DeployOptions extends SendMethodOptions {
+export type DeployOptions = {
/**
* The Ethereum address of the Portal contract.
*/
@@ -27,7 +27,7 @@ export interface DeployOptions extends SendMethodOptions {
* An optional salt value used to deterministically calculate the contract address.
*/
contractAddressSalt?: Fr;
-}
+} & SendMethodOptions;
/**
* Creates a TxRequest from a contract ABI, for contract deployment.
diff --git a/yarn-project/aztec.js/src/utils/index.ts b/yarn-project/aztec.js/src/utils/index.ts
index cddef692554e..a2df1771c57a 100644
--- a/yarn-project/aztec.js/src/utils/index.ts
+++ b/yarn-project/aztec.js/src/utils/index.ts
@@ -1,5 +1,4 @@
export * from './secrets.js';
-export * from './account.js';
export * from './pub_key.js';
export * from './l1_contracts.js';
export * from './l2_contracts.js';
diff --git a/yarn-project/types/src/contract_data.ts b/yarn-project/types/src/contract_data.ts
index 56b5d5f0bc79..933b8322b990 100644
--- a/yarn-project/types/src/contract_data.ts
+++ b/yarn-project/types/src/contract_data.ts
@@ -120,7 +120,7 @@ export class ExtendedContractData {
private publicFunctions: EncodedContractFunction[],
/** Partial addresses of the contract. */
public readonly partialAddress: PartialAddress,
- /** Public keys of the contract. */
+ /** Public key of the contract. */
public readonly publicKey: PublicKey,
) {
this.bytecode = serializeBufferArrayToVector(publicFunctions.map(fn => fn.toBuffer()));
diff --git a/yarn-project/types/src/interfaces/aztec_rpc.ts b/yarn-project/types/src/interfaces/aztec_rpc.ts
index 775ad61c6e09..0a5d1fdddd96 100644
--- a/yarn-project/types/src/interfaces/aztec_rpc.ts
+++ b/yarn-project/types/src/interfaces/aztec_rpc.ts
@@ -1,5 +1,4 @@
-import { AztecAddress, EthAddress, Fr, GrumpkinPrivateKey, PartialAddress } from '@aztec/circuits.js';
-import { ContractAbi } from '@aztec/foundation/abi';
+import { AztecAddress, Fr, GrumpkinPrivateKey, PartialAddress } from '@aztec/circuits.js';
import {
AuthWitness,
CompleteAddress,
@@ -13,191 +12,163 @@ import {
TxReceipt,
} from '@aztec/types';
-/**
- * Represents a deployed contract on the Aztec network.
- * Contains the contract ABI, address, and associated portal contract address.
- */
-export interface DeployedContract {
- /**
- * The Application Binary Interface of the deployed contract.
- */
- abi: ContractAbi;
- /**
- * The complete address representing the contract on L2.
- */
- completeAddress: CompleteAddress;
- /**
- * The Ethereum address of the L1 portal contract.
- */
- portalContract: EthAddress;
-}
-
-/**
- * Provides basic information about the running node.
- */
-export type NodeInfo = {
- /**
- * Version as tracked in the aztec-packages repository.
- */
- sandboxVersion: string;
- /**
- * The nargo version compatible with this sandbox version
- */
- compatibleNargoVersion: string;
- /**
- * L1 chain id.
- */
- chainId: number;
- /**
- * Protocol version.
- */
- protocolVersion: number;
- /**
- * The rollup contract address
- */
- rollupAddress: EthAddress;
-};
-
-/** Provides up to which block has been synced by different components. */
-export type SyncStatus = {
- /** Up to which block has been synched for blocks and txs. */
- blocks: number;
- /** Up to which block has been synched for notes, indexed by each public key being monitored. */
- notes: Record;
-};
+import { DeployedContract } from './deployed-contract.js';
+import { NodeInfo } from './node-info.js';
+import { SyncStatus } from './sync-status.js';
// docs:start:rpc-interface
/**
- * Represents an Aztec RPC implementation.
- * Provides functionality for all the operations needed to interact with the Aztec network,
- * including account management, contract deployment, transaction creation, and execution,
- * as well as storage and view functions for smart contracts.
+ * The Aztec RPC Server runs locally for each user, providing functionality for all the operations
+ * needed to interact with the Aztec network, including account management, private data management,
+ * transaction local simulation, and access to an Aztec node. This interface, as part of a Wallet,
+ * is exposed to dapps for interacting with the network on behalf of the user.
*/
export interface AztecRPC {
/**
- * Insert a witness for a given message hash.
- * @param authWitness - The auth witness to insert.
+ * Insert an auth witness for a given message hash. Auth witnesses are used to authorise actions on
+ * behalf of a user. For instance, a token transfer initiated by a different address may request
+ * authorisation from the user to move their tokens. This authorisation is granted by the user
+ * account contract by verifying an auth witness requested to the execution oracle. Witnesses are
+ * usually a signature over a hash of the action to be authorised, but their actual contents depend
+ * on the account contract that consumes them.
+ *
+ * @param authWitness - The auth witness to insert. Composed of an identifier, which is the hash of
+ * the action to be authorised, and the actual witness as an array of fields, which are to be
+ * deserialised and processed by the account contract.
*/
addAuthWitness(authWitness: AuthWitness): Promise;
/**
- * Registers an account in the Aztec RPC server.
+ * Registers a user account in the Aztec RPC server given its master encryption private key.
+ * Once a new account is registered, the RPC server will trial-decrypt all published notes on
+ * the chain and store those that correspond to the registered account.
*
* @param privKey - Private key of the corresponding user master public key.
- * @param partialAddress - A partial address of the account contract corresponding to the account being registered.
- * @returns Empty promise.
+ * @param partialAddress - The partial address of the account contract corresponding to the account being registered.
* @throws If the account is already registered.
*/
registerAccount(privKey: GrumpkinPrivateKey, partialAddress: PartialAddress): Promise;
/**
- * Registers recipient in the Aztec RPC server.
- * @param recipient - A complete address of the recipient
- * @returns Empty promise.
+ * Registers a recipient in the Aztec RPC server. This is required when sending encrypted notes to
+ * a user who hasn't deployed their account contract yet. Since their account is not deployed, their
+ * encryption public key has not been broadcasted, so we need to manually register it on the RPC server
+ * in order to be able to encrypt data for this recipient.
+ *
+ * @param recipient - The complete address of the recipient
* @remarks Called recipient because we can only send notes to this account and not receive them via this RPC server.
- * This is because we don't have the associated private key and for this reason we can't decrypt
- * the recipient's notes. We can send notes to this account because we can encrypt them with the recipient's
- * public key.
+ * This is because we don't have the associated private key and for this reason we can't decrypt
+ * the recipient's notes. We can send notes to this account because we can encrypt them with the recipient's
+ * public key.
*/
registerRecipient(recipient: CompleteAddress): Promise;
/**
- * Retrieves the list of accounts added to this rpc server.
- * The addresses are returned as a promise that resolves to an array of CompleteAddress objects.
- *
- * @returns A promise that resolves to an array of the accounts registered on this RPC server.
+ * Retrieves the user accounts registered on this rpc server.
+ * @returns An array of the accounts registered on this RPC server.
*/
getRegisteredAccounts(): Promise;
/**
* Retrieves the complete address of the account corresponding to the provided aztec address.
- * @param address - The aztec address of the account contract.
- * @returns A promise that resolves to the complete address of the requested account.
+ * Complete addresses include the address, the partial address, and the encryption public key.
+ *
+ * @param address - The address of account.
+ * @returns The complete address of the requested account if found.
*/
getRegisteredAccount(address: AztecAddress): Promise;
/**
- * Retrieves the list of recipients added to this rpc server.
- * The addresses are returned as a promise that resolves to an array of CompleteAddress objects.
- *
- * @returns A promise that resolves to an array registered recipients on this RPC server.
+ * Retrieves the recipients added to this rpc server.
+ * @returns An array of recipients registered on this RPC server.
*/
getRecipients(): Promise;
/**
* Retrieves the complete address of the recipient corresponding to the provided aztec address.
+ * Complete addresses include the address, the partial address, and the encryption public key.
+ *
* @param address - The aztec address of the recipient.
- * @returns A promise that resolves to the complete address of the requested recipient.
+ * @returns The complete address of the requested recipient.
*/
getRecipient(address: AztecAddress): Promise;
/**
- * Add an array of deployed contracts to the database.
- * Each contract should contain ABI, address, and portalContract information.
+ * Adds deployed contracts to the RPC server. Deployed contract information is used to access the
+ * contract code when simulating local transactions. This is automatically called by aztec.js when
+ * deploying a contract. Dapps that wish to interact with contracts already deployed should register
+ * these contracts in their users' RPC server through this method.
*
- * @param contracts - An array of DeployedContract objects containing contract ABI, address, and portalContract.
- * @returns A Promise that resolves once all the contracts have been added to the database.
+ * @param contracts - An array of DeployedContract objects containing contract ABI, address, and portal contract.
*/
addContracts(contracts: DeployedContract[]): Promise;
/**
- * Retrieves the list of addresses of contracts added to this rpc server.
- * @returns A promise that resolves to an array of contracts addresses registered on this RPC server.
+ * Retrieves the addresses of contracts added to this rpc server.
+ * @returns An array of contracts addresses registered on this RPC server.
*/
getContracts(): Promise;
/**
- * Create a transaction for a contract function call with the provided arguments.
- * Throws an error if the contract or function is unknown.
+ * Creates a transaction based on the provided preauthenticated execution request. This will
+ * run a local simulation of the private execution (and optionally of public as well), assemble
+ * the zero-knowledge proof for the private execution, and return the transaction object.
*
* @param txRequest - An authenticated tx request ready for simulation
* @param simulatePublic - Whether to simulate the public part of the transaction.
- * @returns A Tx ready to send to the p2p pool for execution.
+ * @returns A transaction ready to be sent to the network for excution.
+ * @throws If the code for the functions executed in this transaction has not been made available via `addContracts`.
*/
simulateTx(txRequest: TxExecutionRequest, simulatePublic: boolean): Promise;
/**
- * Send a transaction.
- * @param tx - The transaction.
+ * Sends a transaction to an Aztec node to be broadcasted to the network and mined.
+ * @param tx - The transaction as created via `simulateTx`.
* @returns A hash of the transaction, used to identify it.
*/
sendTx(tx: Tx): Promise;
/**
- * Fetches a transaction receipt for a tx.
+ * Fetches a transaction receipt for a given transaction hash. Returns a mined receipt if it was added
+ * to the chain, a pending receipt if it's still in the mempool of the connected Aztec node, or a dropped
+ * receipt if not found in the connected Aztec node.
+ *
* @param txHash - The transaction hash.
* @returns A receipt of the transaction.
*/
getTxReceipt(txHash: TxHash): Promise;
/**
- * Retrieves the private storage data at a specified contract address and storage slot.
- * The returned data is data at the storage slot or throws an error if the contract is not deployed.
+ * Retrieves the private storage data at a specified contract address and storage slot. Returns only data
+ * encrypted for the specified owner that has been already decrypted by the RPC server. Note that there
+ * may be multiple notes for a user in a single slot.
*
* @param owner - The address for whom the private data is encrypted.
* @param contract - The AztecAddress of the target contract.
- * @param storageSlot - The Fr representing the storage slot to be fetched.
+ * @param storageSlot - The storage slot to be fetched.
* @returns A set of note preimages for the owner in that contract and slot.
+ * @throws If the contract is not deployed.
*/
getPrivateStorageAt(owner: AztecAddress, contract: AztecAddress, storageSlot: Fr): Promise;
/**
* Retrieves the public storage data at a specified contract address and storage slot.
- * The returned data is data at the storage slot or throws an error if the contract is not deployed.
*
* @param contract - The AztecAddress of the target contract.
* @param storageSlot - The Fr representing the storage slot to be fetched.
* @returns A buffer containing the public storage data at the storage slot.
+ * @throws If the contract is not deployed.
*/
getPublicStorageAt(contract: AztecAddress, storageSlot: Fr): Promise;
/**
- * Find the nonce(s) for a note in a tx with given preimage at a specified contract address and storage slot.
+ * Finds the nonce(s) for a note in a tx with given preimage at a specified contract address and storage slot.
* @param contract - The contract address of the note.
* @param storageSlot - The storage slot of the note.
* @param preimage - The note preimage.
* @param txHash - The tx hash of the tx containing the note.
- * @returns The nonces of the note. It's an array because there might be more than one note with the same preimage.
+ * @returns The nonces of the note.
+ * @remarks More than single nonce may be returned since there might be more than one note with the same preimage.
*/
getNoteNonces(contract: AztecAddress, storageSlot: Fr, preimage: NotePreimage, txHash: TxHash): Promise;
@@ -210,28 +181,32 @@ export interface AztecRPC {
* @param functionName - The name of the function to be called in the contract.
* @param args - The arguments to be provided to the function.
* @param to - The address of the contract to be called.
- * @param from - (Optional) The caller of the transaction.
+ * @param from - (Optional) The msg sender to set for the call.
* @returns The result of the view function call, structured based on the function ABI.
*/
viewTx(functionName: string, args: any[], to: AztecAddress, from?: AztecAddress): Promise;
/**
- * Get the extended contract data for this contract.
- * @param contractAddress - The contract data address.
- * @returns The extended contract data or undefined if not found.
+ * Gets the extended contract data for this contract. Extended contract data includes the address,
+ * portal contract address on L1, public functions, partial address, and encryption public key.
+ *
+ * @param contractAddress - The contract's address.
+ * @returns The extended contract data if found.
*/
getExtendedContractData(contractAddress: AztecAddress): Promise;
/**
- * Lookup the L2 contract data for this contract.
- * Contains the ethereum portal address .
- * @param contractAddress - The contract data address.
- * @returns The contract's address & portal address.
+ * Gets the portal contract address on L1 for the given contract.
+ *
+ * @param contractAddress - The contract's address.
+ * @returns The contract's portal address if found.
*/
getContractData(contractAddress: AztecAddress): Promise;
/**
- * Gets L2 block unencrypted logs.
+ * Gets unencrypted public logs from the specified block range. Logs are grouped by block and then by
+ * transaction. Use the `L2BlockL2Logs.unrollLogs` helper function to get an flattened array of logs instead.
+ *
* @param from - Number of the L2 block to which corresponds the first unencrypted logs to be returned.
* @param limit - The maximum number of unencrypted logs to return.
* @returns The requested unencrypted logs.
@@ -245,7 +220,8 @@ export interface AztecRPC {
getBlockNumber(): Promise;
/**
- * Returns the information about the server's node
+ * Returns the information about the server's node. Includes current Sandbox version, compatible Noir version,
+ * L1 chain identifier, protocol version, and L1 address of the rollup contract.
* @returns - The node information.
*/
getNodeInfo(): Promise;
@@ -253,8 +229,8 @@ export interface AztecRPC {
/**
* Checks whether all the blocks were processed (tree roots updated, txs updated with block info, etc.).
* @returns True if there are no outstanding blocks to be synched.
- * @remarks This indicates that blocks and transactions are synched even if notes are not.
- * @remarks Compares local block number with the block number from aztec node.
+ * @remarks This indicates that blocks and transactions are synched even if notes are not. Compares local block number with the block number from aztec node.
+ * @deprecated Use `getSyncStatus` instead.
*/
isGlobalStateSynchronised(): Promise;
@@ -262,13 +238,16 @@ export interface AztecRPC {
* Checks if the specified account is synchronised.
* @param account - The aztec address for which to query the sync status.
* @returns True if the account is fully synched, false otherwise.
+ * @deprecated Use `getSyncStatus` instead.
* @remarks Checks whether all the notes from all the blocks have been processed. If it is not the case, the
- * retrieved information from contracts might be old/stale (e.g. old token balance).
+ * retrieved information from contracts might be old/stale (e.g. old token balance).
*/
isAccountStateSynchronised(account: AztecAddress): Promise;
/**
- * Returns the latest block that has been synchronised by the synchronizer and each account.
+ * Returns the latest block that has been synchronised globally and for each account. The global block number
+ * indicates whether global state has been updated up to that block, whereas each address indicates up to which
+ * block the private state has been synced for that account.
* @returns The latest block synchronised for blocks, and the latest block synched for notes for each public key being tracked.
*/
getSyncStatus(): Promise;
diff --git a/yarn-project/types/src/interfaces/deployed-contract.ts b/yarn-project/types/src/interfaces/deployed-contract.ts
new file mode 100644
index 000000000000..6afa2d285e4b
--- /dev/null
+++ b/yarn-project/types/src/interfaces/deployed-contract.ts
@@ -0,0 +1,22 @@
+import { EthAddress } from '@aztec/circuits.js';
+import { ContractAbi } from '@aztec/foundation/abi';
+import { CompleteAddress } from '@aztec/types';
+
+/**
+ * Represents a deployed contract on the Aztec network.
+ * Contains the contract ABI, address, and associated portal contract address.
+ */
+export interface DeployedContract {
+ /**
+ * The Application Binary Interface of the deployed contract.
+ */
+ abi: ContractAbi;
+ /**
+ * The complete address representing the contract on L2.
+ */
+ completeAddress: CompleteAddress;
+ /**
+ * The Ethereum address of the L1 portal contract.
+ */
+ portalContract: EthAddress;
+}
diff --git a/yarn-project/types/src/interfaces/index.ts b/yarn-project/types/src/interfaces/index.ts
index bc3101ac1169..d53098ad94ca 100644
--- a/yarn-project/types/src/interfaces/index.ts
+++ b/yarn-project/types/src/interfaces/index.ts
@@ -4,3 +4,6 @@ export * from './data_commitment_provider.js';
export * from './l1_l2_message_provider.js';
export * from './aztec-node.js';
export * from './aztec_rpc.js';
+export * from './deployed-contract.js';
+export * from './node-info.js';
+export * from './sync-status.js';
diff --git a/yarn-project/types/src/interfaces/node-info.ts b/yarn-project/types/src/interfaces/node-info.ts
new file mode 100644
index 000000000000..4037d4917ed8
--- /dev/null
+++ b/yarn-project/types/src/interfaces/node-info.ts
@@ -0,0 +1,27 @@
+import { EthAddress } from '@aztec/circuits.js';
+
+/**
+ * Provides basic information about the running node.
+ */
+export type NodeInfo = {
+ /**
+ * Version as tracked in the aztec-packages repository.
+ */
+ sandboxVersion: string;
+ /**
+ * The nargo version compatible with this sandbox version
+ */
+ compatibleNargoVersion: string;
+ /**
+ * L1 chain id.
+ */
+ chainId: number;
+ /**
+ * Protocol version.
+ */
+ protocolVersion: number;
+ /**
+ * The rollup contract address
+ */
+ rollupAddress: EthAddress;
+};
diff --git a/yarn-project/types/src/interfaces/sync-status.ts b/yarn-project/types/src/interfaces/sync-status.ts
new file mode 100644
index 000000000000..75770ffe14b6
--- /dev/null
+++ b/yarn-project/types/src/interfaces/sync-status.ts
@@ -0,0 +1,7 @@
+/** Provides up to which block has been synced by different components. */
+export type SyncStatus = {
+ /** Up to which block has been synched for blocks and txs. */
+ blocks: number;
+ /** Up to which block has been synched for notes, indexed by each public key being monitored. */
+ notes: Record;
+};