Skip to content

Commit eba6e49

Browse files
committed
fix(docs): address review comments on v4.1.3 versioned docs
Fixed valid issues identified by code review: - Contract import: use '@aztec/aztec.js/contracts' subpath, not root - TestWallet: replaced internal e2e helper with public EmbeddedWallet API - Transfer test: use transfer_in_public for public balance assertions - simulate() destructuring: wrap with { result } in how_to_read_data - Deploy guide: use consistent TokenContract import matching the example Dismissed invalid claims (verified against v4.1.3 SDK source): - AztecAddress.ZERO is correct for self-deploy (not NO_FROM) - isContractInitialized exists on ContractMetadata (not initializationStatus) - GasSettings.default() exists at v4.1.3 (takes maxFeesPerGas param)
1 parent 9ac97e9 commit eba6e49

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

docs/developer_versioned_docs/version-v4.1.3/docs/aztec-js/how_to_deploy_contract.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The codegen command creates a TypeScript class with typed methods for deployment
3838
### Step 1: Import and connect
3939

4040
```typescript
41-
import { MyContract } from "./artifacts/MyContract";
41+
import { TokenContract } from "@aztec/noir-contracts.js/Token";
4242
```
4343

4444
:::note[About wallets and accounts]

docs/developer_versioned_docs/version-v4.1.3/docs/aztec-js/how_to_read_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ For functions returning multiple values, destructure the result:
4545

4646
```typescript
4747
// contract and callerAddress are from the example above
48-
const [value1, value2] = await contract.methods
48+
const { result: [value1, value2] } = await contract.methods
4949
.get_multiple_values()
5050
.simulate({ from: callerAddress });
5151
```

docs/developer_versioned_docs/version-v4.1.3/docs/aztec-js/how_to_send_transaction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Transactions on Aztec execute contract functions that modify state. Unlike simpl
2222
After connecting to a contract:
2323

2424
```typescript
25-
import { Contract } from "@aztec/aztec.js";
25+
import { Contract } from "@aztec/aztec.js/contracts";
2626

2727
// wallet is from the connection guide; contractAddress and artifact are from your deployed contract
2828
const contract = await Contract.at(contractAddress, artifact, wallet);

docs/developer_versioned_docs/version-v4.1.3/docs/aztec-js/how_to_test.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ This guide covers how to test Aztec smart contracts by connecting to a local net
1818
Connect to your local Aztec network and create an embedded wallet:
1919

2020
```typescript title="setup" showLineNumbers
21-
const logger = createLogger('e2e:token');
21+
import { createAztecNodeClient, waitForNode } from "@aztec/aztec.js/node";
22+
import { EmbeddedWallet } from "@aztec/wallets/embedded";
2223

23-
// We create PXE client connected to the local network URL
24-
const node = createAztecNodeClient(AZTEC_NODE_URL);
25-
// Wait for local network to be ready
26-
await waitForNode(node, logger);
27-
const wallet = await TestWallet.create(node);
24+
const nodeUrl = process.env.AZTEC_NODE_URL ?? "http://localhost:8080";
25+
const node = createAztecNodeClient(nodeUrl);
2826

29-
const nodeInfo = await node.getNodeInfo();
27+
// Wait for the network to be ready
28+
await waitForNode(node);
3029

31-
logger.info(format('Aztec Local Network Info ', nodeInfo));
30+
// Create an embedded wallet connected to the node
31+
const wallet = await EmbeddedWallet.create(node);
32+
33+
const nodeInfo = await node.getNodeInfo();
34+
console.log('Aztec Local Network Info', nodeInfo);
3235
```
33-
> <sup><sub><a href="https://github.com/AztecProtocol/aztec-packages/blob/4.1.3/yarn-project/end-to-end/src/composed/e2e_local_network_example.test.ts#L37-L50" target="_blank" rel="noopener noreferrer">Source code: yarn-project/end-to-end/src/composed/e2e_local_network_example.test.ts#L37-L50</a></sub></sup>
3436

3537

3638
The `EmbeddedWallet` manages accounts, tracks deployed contracts, and handles transaction proving. It connects to the Aztec node which provides access to both the Private eXecution Environment (PXE) and the network.
@@ -165,8 +167,8 @@ async function testTransferTokens() {
165167
.mint_to_public(aliceAddress, 1000n)
166168
.send({ from: aliceAddress });
167169

168-
// Transfer to bob using the simple transfer method
169-
await token.methods.transfer(bobAddress, 100n).send({ from: aliceAddress });
170+
// Transfer to bob using the public transfer method
171+
await token.methods.transfer_in_public(aliceAddress, bobAddress, 100n, 0).send({ from: aliceAddress });
170172

171173
const { result: aliceBalance } = await token.methods
172174
.balance_of_public(aliceAddress)
@@ -188,7 +190,7 @@ async function testRevertOnOverTransfer() {
188190

189191
try {
190192
await token.methods
191-
.transfer(bobAddress, balance + 1n)
193+
.transfer_in_public(aliceAddress, bobAddress, balance + 1n, 0)
192194
.simulate({ from: aliceAddress });
193195
throw new Error("Expected simulation to throw");
194196
} catch (error) {

0 commit comments

Comments
 (0)