Skip to content

Commit 2776401

Browse files
committed
feat!: wallets package
Deletes the `@aztec/test-wallet` package that was confusing and dangerous. In hindsight, it was a bad idea. `TestWallet` is now internal to `@aztec/end-to-end` and for external use an `@aztec/wallets` package has been created. The latter adds an `EmbeddedWallet` implementation for both Node and the browser, with conditional exports for ease of use. It is a somewhat opinionated implementation, but includes all our optimizations and it is easily extended. I also think it will be good to have a reference implementation to put out there and continuously improve. Co-authored-by: thunkar <gregojquiros@gmail.com>
1 parent 71d202c commit 2776401

File tree

186 files changed

+1882
-1824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+1882
-1824
lines changed

boxes/boxes/react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"dependencies": {
3434
"@aztec/accounts": "latest",
3535
"@aztec/aztec.js": "latest",
36-
"@aztec/test-wallet": "latest",
36+
"@aztec/wallets": "latest",
3737
"classnames": "^2.3.2",
3838
"formik": "^2.4.3",
3939
"react": "^18.2.0",

boxes/boxes/react/src/config.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
22
import { AztecAddress } from '@aztec/aztec.js/addresses';
3-
import { createAztecNodeClient } from '@aztec/aztec.js/node';
43
import type { Wallet } from '@aztec/aztec.js/wallet';
5-
import { getPXEConfig } from '@aztec/pxe/client/lazy';
6-
import { TestWallet } from '@aztec/test-wallet/client/lazy';
4+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
75

86
export class PrivateEnv {
97
private wallet!: Wallet;
@@ -14,11 +12,7 @@ export class PrivateEnv {
1412
async init() {
1513
const nodeURL = process.env.AZTEC_NODE_URL ?? 'http://localhost:8080';
1614

17-
const aztecNode = await createAztecNodeClient(nodeURL);
18-
const config = getPXEConfig();
19-
config.dataDirectory = 'pxe';
20-
config.proverEnabled = false;
21-
const wallet = await TestWallet.create(aztecNode, config);
15+
const wallet = await EmbeddedWallet.create(nodeURL);
2216

2317
const [accountData] = await getInitialTestAccountsData();
2418
if (!accountData) {

boxes/boxes/vanilla/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@aztec/wallet-sdk": "latest"
2929
},
3030
"devDependencies": {
31-
"@aztec/test-wallet": "latest",
31+
"@aztec/wallets": "latest",
3232
"@playwright/test": "1.49.0",
3333
"@types/node": "^22.15.17",
3434
"buffer": "^6.0.3",

boxes/boxes/vanilla/scripts/deploy.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,19 @@ import { createAztecNodeClient } from '@aztec/aztec.js/node';
1212
import type { DeployAccountOptions, Wallet } from '@aztec/aztec.js/wallet';
1313
import { type AztecNode } from '@aztec/aztec.js/node';
1414
import { SPONSORED_FPC_SALT } from '@aztec/constants';
15-
import { createStore } from '@aztec/kv-store/lmdb';
1615
import { SponsoredFPCContractArtifact } from '@aztec/noir-contracts.js/SponsoredFPC';
17-
import { getPXEConfig, PXE_DATA_SCHEMA_VERSION } from '@aztec/pxe/server';
1816
import { getDefaultInitializer } from '@aztec/stdlib/abi';
19-
import { TestWallet } from '@aztec/test-wallet/server';
17+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
2018
import fs from 'fs';
2119
import path from 'path';
2220
// @ts-ignore
2321
import { PrivateVotingContract } from '../artifacts/PrivateVoting.ts';
2422

2523
const AZTEC_NODE_URL = process.env.AZTEC_NODE_URL || 'http://localhost:8080';
26-
const PROVER_ENABLED = process.env.PROVER_ENABLED === 'false' ? false : true;
2724
const WRITE_ENV_FILE = process.env.WRITE_ENV_FILE === 'false' ? false : true;
2825

29-
const PXE_STORE_DIR = path.join(import.meta.dirname, '.store');
30-
3126
async function setupWallet(aztecNode: AztecNode) {
32-
fs.rmSync(PXE_STORE_DIR, { recursive: true, force: true });
33-
34-
const store = await createStore('pxe', {
35-
dataDirectory: PXE_STORE_DIR,
36-
dataStoreMapSizeKb: 1e6,
37-
}, PXE_DATA_SCHEMA_VERSION);
38-
39-
const config = getPXEConfig();
40-
config.dataDirectory = 'pxe';
41-
config.proverEnabled = PROVER_ENABLED;
42-
43-
return await TestWallet.create(aztecNode, config, { store });
27+
return await EmbeddedWallet.create(aztecNode, { ephemeral: true });
4428
}
4529

4630
async function getSponsoredPFCContract() {
@@ -54,7 +38,7 @@ async function getSponsoredPFCContract() {
5438
return instance;
5539
}
5640

57-
async function createAccount(wallet: TestWallet) {
41+
async function createAccount(wallet: EmbeddedWallet) {
5842
const salt = Fr.random();
5943
const secretKey = Fr.random();
6044
const signingKey = Buffer.alloc(32, Fr.random().toBuffer());
@@ -169,9 +153,6 @@ async function createAccountAndDeployContract() {
169153
if (WRITE_ENV_FILE) {
170154
await writeEnvFile(deploymentInfo);
171155
}
172-
173-
// Clean up the PXE store
174-
fs.rmSync(PXE_STORE_DIR, { recursive: true, force: true });
175156
}
176157

177158
createAccountAndDeployContract().catch((error) => {

boxes/boxes/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@aztec/aztec.js": "latest",
1919
"@aztec/pxe": "latest",
2020
"@aztec/stdlib": "latest",
21-
"@aztec/test-wallet": "latest",
21+
"@aztec/wallets": "latest",
2222
"react": "^18.3.1",
2323
"react-dom": "^18.3.1",
2424
"react-toastify": "^10.0.6"

boxes/boxes/vite/src/config.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { getInitialTestAccountsData } from "@aztec/accounts/testing";
22
import { AztecAddress } from '@aztec/aztec.js/addresses';
3-
import { createAztecNodeClient } from '@aztec/aztec.js/node';
43
import { Wallet } from '@aztec/aztec.js/wallet';
5-
import { getPXEConfig } from "@aztec/pxe/client/lazy";
6-
import { TestWallet } from "@aztec/test-wallet/client/lazy";
4+
import { EmbeddedWallet } from '@aztec/wallets/embedded';
75

86
export class PrivateEnv {
97
private wallet!: Wallet;
@@ -14,11 +12,7 @@ export class PrivateEnv {
1412
async init() {
1513
const nodeURL = process.env.AZTEC_NODE_URL ?? "http://localhost:8080";
1614

17-
const aztecNode = await createAztecNodeClient(nodeURL);
18-
const config = getPXEConfig();
19-
config.dataDirectory = "pxe";
20-
config.proverEnabled = false;
21-
const wallet = await TestWallet.create(aztecNode, config);
15+
const wallet = await EmbeddedWallet.create(nodeURL);
2216

2317
const [accountData] = await getInitialTestAccountsData();
2418
if (!accountData) {

boxes/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"@aztec/archiver": "link:../yarn-project/archiver",
4949
"@aztec/sequencer-client": "link:../yarn-project/sequencer-client",
5050
"@aztec/p2p": "link:../yarn-project/p2p",
51-
"@aztec/test-wallet": "link:../yarn-project/test-wallet",
51+
"@aztec/wallets": "link:../yarn-project/wallets",
5252
"@aztec/wallet-sdk": "link:../yarn-project/wallet-sdk"
5353
},
5454
"dependencies": {

boxes/yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ __metadata:
8888
languageName: node
8989
linkType: soft
9090

91-
"@aztec/test-wallet@link:../yarn-project/test-wallet::locator=%40aztec%2Fexamples%40workspace%3A.":
91+
"@aztec/wallet-sdk@link:../yarn-project/wallet-sdk::locator=%40aztec%2Fexamples%40workspace%3A.":
9292
version: 0.0.0-use.local
93-
resolution: "@aztec/test-wallet@link:../yarn-project/test-wallet::locator=%40aztec%2Fexamples%40workspace%3A."
93+
resolution: "@aztec/wallet-sdk@link:../yarn-project/wallet-sdk::locator=%40aztec%2Fexamples%40workspace%3A."
9494
languageName: node
9595
linkType: soft
9696

97-
"@aztec/wallet-sdk@link:../yarn-project/wallet-sdk::locator=%40aztec%2Fexamples%40workspace%3A.":
97+
"@aztec/wallets@link:../yarn-project/wallets::locator=%40aztec%2Fexamples%40workspace%3A.":
9898
version: 0.0.0-use.local
99-
resolution: "@aztec/wallet-sdk@link:../yarn-project/wallet-sdk::locator=%40aztec%2Fexamples%40workspace%3A."
99+
resolution: "@aztec/wallets@link:../yarn-project/wallets::locator=%40aztec%2Fexamples%40workspace%3A."
100100
languageName: node
101101
linkType: soft
102102

@@ -3769,7 +3769,7 @@ __metadata:
37693769
dependencies:
37703770
"@aztec/accounts": "npm:latest"
37713771
"@aztec/aztec.js": "npm:latest"
3772-
"@aztec/test-wallet": "npm:latest"
3772+
"@aztec/wallets": "npm:latest"
37733773
"@playwright/test": "npm:1.49.0"
37743774
"@types/jest": "npm:^30.0.0"
37753775
"@types/node": "npm:^22.15.17"
@@ -3826,8 +3826,8 @@ __metadata:
38263826
"@aztec/noir-contracts.js": "npm:latest"
38273827
"@aztec/pxe": "npm:latest"
38283828
"@aztec/stdlib": "npm:latest"
3829-
"@aztec/test-wallet": "npm:latest"
38303829
"@aztec/wallet-sdk": "npm:latest"
3830+
"@aztec/wallets": "npm:latest"
38313831
"@playwright/test": "npm:1.49.0"
38323832
"@types/node": "npm:^22.15.17"
38333833
buffer: "npm:^6.0.3"
@@ -3852,7 +3852,7 @@ __metadata:
38523852
"@aztec/aztec.js": "npm:latest"
38533853
"@aztec/pxe": "npm:latest"
38543854
"@aztec/stdlib": "npm:latest"
3855-
"@aztec/test-wallet": "npm:latest"
3855+
"@aztec/wallets": "npm:latest"
38563856
"@eslint/js": "npm:^9.13.0"
38573857
"@playwright/test": "npm:1.49.0"
38583858
"@types/react": "npm:^18.3.12"

docs/CLAUDE.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,26 @@ For development:
4848

4949
The preprocessing system uses these environment variables:
5050

51-
| Variable | Description | Default |
52-
|----------|-------------|---------|
53-
| `RELEASE_TYPE` | Release type: `nightly`, `devnet`, `testnet`, `mainnet`, `ignition` | `nightly` |
54-
| `NIGHTLY_TAG` | Version for nightly builds (falls back to `COMMIT_TAG`) | `0.0.0-nightly.0` |
55-
| `DEVNET_TAG` | Version for devnet builds | `3.0.0-devnet.5` |
56-
| `TESTNET_TAG` | Version for testnet builds | `2.1.11` |
57-
| `MAINNET_TAG` | Version for mainnet/ignition builds | `2.1.11` |
58-
| `COMMIT_TAG` | Legacy variable, used as fallback for `NIGHTLY_TAG` | `next` |
51+
| Variable | Description | Default |
52+
| -------------- | ------------------------------------------------------------------- | ----------------- |
53+
| `RELEASE_TYPE` | Release type: `nightly`, `devnet`, `testnet`, `mainnet`, `ignition` | `nightly` |
54+
| `NIGHTLY_TAG` | Version for nightly builds (falls back to `COMMIT_TAG`) | `0.0.0-nightly.0` |
55+
| `DEVNET_TAG` | Version for devnet builds | `3.0.0-devnet.5` |
56+
| `TESTNET_TAG` | Version for testnet builds | `2.1.11` |
57+
| `MAINNET_TAG` | Version for mainnet/ignition builds | `2.1.11` |
58+
| `COMMIT_TAG` | Legacy variable, used as fallback for `NIGHTLY_TAG` | `next` |
5959

6060
### Preprocessing Macros
6161

6262
**Release-type-aware macros:**
63+
6364
- `#release_version` - Resolves to the version for the current `RELEASE_TYPE`:
6465
- `nightly``NIGHTLY_TAG`, `devnet``DEVNET_TAG`, `testnet``TESTNET_TAG`, `mainnet`/`ignition``MAINNET_TAG`
6566
- `#release_network` - Resolves to the network name for CLI `--network` flag:
6667
- `nightly``local-network`, `devnet``devnet`, `testnet``testnet`, `mainnet`/`ignition``mainnet`
6768

6869
**Legacy macros:**
70+
6971
- `#include_aztec_version` - Uses `COMMIT_TAG`
7072
- `#include_devnet_version`, `#include_testnet_version`, `#include_mainnet_version` - Version-specific macros
7173

@@ -86,6 +88,7 @@ Default content
8688
**Supported conditions** (matching `RELEASE_TYPE` values): `nightly`, `devnet`, `testnet`, `mainnet`, `ignition`
8789

8890
**Notes:**
91+
8992
- Conditional blocks are processed before version macro substitution (so you can use version macros inside conditionals)
9093
- Nested conditionals are not supported
9194
- The `#else` block is optional
@@ -125,7 +128,8 @@ Two API reference systems generate documentation from source code:
125128
- **TypeScript API** (`static/typescript-api/`) - Generated from `yarn-project/` packages using TypeDoc
126129

127130
The TypeScript API generation is configured in `scripts/typescript_api_generation/config.json` and documents:
128-
- Client SDKs: `aztec.js`, `accounts`, `pxe`, `wallet-sdk`, `test-wallet`, `entrypoints`
131+
132+
- Client SDKs: `aztec.js`, `accounts`, `pxe`, `wallet-sdk`, `wallets`, `entrypoints`
129133
- Core Libraries: `stdlib`, `foundation`, `constants`
130134

131135
### Versioning System

docs/README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ The TypeScript API reference is auto-generated from the `yarn-project/` packages
238238

239239
**Documented packages:**
240240

241-
- **Client SDKs:** `@aztec/aztec.js`, `@aztec/accounts`, `@aztec/pxe`, `@aztec/wallet-sdk`, `@aztec/test-wallet`, `@aztec/entrypoints`
241+
- **Client SDKs:** `@aztec/aztec.js`, `@aztec/accounts`, `@aztec/pxe`, `@aztec/wallet-sdk`, `@aztec/wallets`, `@aztec/entrypoints`
242242
- **Core Libraries:** `@aztec/stdlib`, `@aztec/foundation`, `@aztec/constants`
243243

244244
**Prerequisites:** You need `yarn-project` to be built first (the bootstrap process handles this).
@@ -378,27 +378,27 @@ This value is used for mainnet and ignition releases.
378378
379379
This macro is release-type-aware and automatically resolves to the appropriate version based on the `RELEASE_TYPE` environment variable:
380380
381-
| RELEASE_TYPE | Resolves to | Example |
382-
|--------------|-------------|---------|
383-
| nightly | `NIGHTLY_TAG` (falls back to `COMMIT_TAG`) | `3.0.0-nightly.20251218` |
384-
| devnet | `DEVNET_TAG` | `3.0.0-devnet.5` |
385-
| testnet | `TESTNET_TAG` | `2.1.11` |
386-
| mainnet | `MAINNET_TAG` | `2.1.11` |
387-
| ignition | `MAINNET_TAG` | `2.1.11` |
381+
| RELEASE_TYPE | Resolves to | Example |
382+
| ------------ | ------------------------------------------ | ------------------------ |
383+
| nightly | `NIGHTLY_TAG` (falls back to `COMMIT_TAG`) | `3.0.0-nightly.20251218` |
384+
| devnet | `DEVNET_TAG` | `3.0.0-devnet.5` |
385+
| testnet | `TESTNET_TAG` | `2.1.11` |
386+
| mainnet | `MAINNET_TAG` | `2.1.11` |
387+
| ignition | `MAINNET_TAG` | `2.1.11` |
388388
389389
Usage: `aztecprotocol/aztec:#release_version`
390390
391391
### `#release_network`
392392
393393
This macro resolves to the network name for use with the `--network` CLI flag:
394394
395-
| RELEASE_TYPE | Resolves to |
396-
|--------------|-------------|
397-
| nightly | `local-network` |
398-
| devnet | `devnet` |
399-
| testnet | `testnet` |
400-
| mainnet | `mainnet` |
401-
| ignition | `mainnet` |
395+
| RELEASE_TYPE | Resolves to |
396+
| ------------ | --------------- |
397+
| nightly | `local-network` |
398+
| devnet | `devnet` |
399+
| testnet | `testnet` |
400+
| mainnet | `mainnet` |
401+
| ignition | `mainnet` |
402402
403403
Usage: `--network #release_network`
404404
@@ -413,6 +413,7 @@ The `RELEASE_TYPE` environment variable controls which release type the document
413413
- `ignition` - For ignition releases (treated as mainnet)
414414
415415
Example build commands:
416+
416417
```bash
417418
# Build for nightly (default)
418419
NIGHTLY_TAG=v3.0.0-nightly.20251218 yarn build
@@ -446,13 +447,15 @@ Default content if no condition matches
446447
```
447448

448449
**Supported conditions** (matching `RELEASE_TYPE` values):
450+
449451
- `nightly` - True when `RELEASE_TYPE=nightly`
450452
- `devnet` - True when `RELEASE_TYPE=devnet`
451453
- `testnet` - True when `RELEASE_TYPE=testnet`
452454
- `mainnet` - True when `RELEASE_TYPE=mainnet` or `RELEASE_TYPE=ignition`
453455
- `ignition` - Alias for `mainnet`
454456

455457
**Notes:**
458+
456459
- Conditional blocks are processed before version macro substitution, so you can use version macros inside conditionals
457460
- Nested conditionals are not supported
458461
- The `else` block is optional
@@ -516,7 +519,6 @@ When documentation references source code files, the CI system can automatically
516519
```
517520

518521
2. **Automatic Detection**: During CI builds (`bootstrap.sh`), the system:
519-
520522
- Extracts all referenced paths from documentation frontmatter
521523
- Checks if any referenced files (or files within referenced directories) changed in the current PR
522524
- Automatically requests `@AztecProtocol/devrel` as reviewers if:
@@ -532,6 +534,7 @@ When documentation references source code files, the CI system can automatically
532534
**Implementation**: The automation is handled by `scripts/check_doc_references.sh`, which runs as part of the docs CI pipeline.
533535

534536
**Path Format**:
537+
535538
- Paths must be absolute from the repository root (e.g., `yarn-project/...`, not `../../../../yarn-project/...`)
536539
- For individual files: `"path/to/file.ts"`
537540
- For directories (all files within): `"path/to/directory/*"`
@@ -556,24 +559,28 @@ Building on the DevRel review automation, the docs CI can analyze PRs and notify
556559
- The DevRel team can review and apply the changes manually
557560

558561
**Requirements**:
562+
559563
- `ANTHROPIC_API_KEY` must be set in CI secrets
560564
- `SLACK_BOT_TOKEN` must be set for Slack notifications
561565
- Claude Code CLI must be installed (`@anthropic-ai/claude-code`)
562566
- The PR must not be a draft
563567

564568
**Environment Variables**:
569+
565570
- `SLACK_DOC_UPDATE_CHANNEL` - Slack channel for notifications (default: `#devrel`)
566571
- `DRY_RUN=1` - Skip Slack notification, just print what would be sent
567572

568573
**Implementation**: The automation is handled by `scripts/update_doc_references.sh`, which runs as part of the docs CI pipeline after `check_doc_references.sh`.
569574

570575
**Script Architecture**:
576+
571577
- `scripts/update_doc_references.sh` - Main script that orchestrates the workflow
572578
- `scripts/lib/extract_doc_references.sh` - Shared library for parsing frontmatter references
573579
- `scripts/lib/create_doc_update_pr.sh` - (Reserved for future use) PR creation logic
574580
- `scripts/test_update_doc_references.sh` - Local testing helper
575581

576582
**Local Testing**:
583+
577584
```bash
578585
# Find a PR with referenced file changes and test
579586
./scripts/test_update_doc_references.sh
@@ -583,6 +590,7 @@ LOCAL_TEST=1 DRY_RUN=1 ./scripts/update_doc_references.sh 19803
583590
```
584591

585592
**Limitations**:
593+
586594
- Only analyzes documentation in the source folders (`docs-developers/`, `docs-network/`), not versioned docs
587595
- Suggested changes should always be reviewed by a human before applying
588596
- The AI may occasionally suggest unnecessary or incorrect changes

0 commit comments

Comments
 (0)