Skip to content

Commit 5aaf5e8

Browse files
committed
docs: added migration notes
Migration notes for #19778 Co-authored-by: Gregorio Juliana <[email protected]> Co-authored-by: thunkar <[email protected]>
1 parent 3bc986d commit 5aaf5e8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

docs/docs-developers/docs/resources/migration_notes.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,78 @@ Aztec is in active development. Each version may introduce breaking changes that
99

1010
## TBD
1111

12+
### [Aztec.js] Transaction sending API redesign
13+
14+
The old chained `.send().wait()` pattern has been replaced with a single `.send(options)` call that handles both sending and waiting.
15+
16+
```diff
17+
+ import { Contract, NO_WAIT } from '@aztec/aztec.js/contracts';
18+
19+
- const receipt = await contract.methods.transfer(recipient, amount).send().wait();
20+
21+
// Send now waits by default
22+
+ const receipt = await contract.methods.transfer(recipient, amount).send({ from: sender });
23+
24+
// getTxHash() would confusingly send the transaction too
25+
- const txHash = await contract.methods.transfer(recipient, amount).send().getTxHash();
26+
27+
// NO_WAIT to send the transaction and return TxHash immediately
28+
+ const txHash = await contract.methods.transfer(recipient, amount).send({
29+
+ from: sender,
30+
+ wait: NO_WAIT
31+
+ });
32+
```
33+
34+
#### Deployment changes
35+
36+
The old `.send().deployed()` method has been removed. Deployments now return the contract instance by default, or you can request the full receipt with `returnReceipt: true`:
37+
38+
```diff
39+
- const contract = await MyContract.deploy(wallet, ...args).send().deployed();
40+
- const { contract, instance } = await MyContract.deploy(wallet, ...args).send().wait();
41+
42+
+ const contract = await MyContract.deploy(wallet, ...args).send({ from: deployer });
43+
44+
+ const { contract, instance } = await MyContract.deploy(wallet, ...args).send({
45+
+ from: deployer,
46+
+ wait: { returnReceipt: true },
47+
+ });
48+
```
49+
50+
#### Breaking changes to `Wallet` interface
51+
52+
`getTxReceipt()` has been removed from the interface.
53+
54+
`sendTx` method signature has changed to support the new wait behavior:
55+
56+
```diff
57+
- sendTx(payload: ExecutionPayload, options: SendOptions): Promise<TxReceipt>
58+
59+
+ sendTx<W extends InteractionWaitOptions = undefined>(
60+
+ payload: ExecutionPayload,
61+
+ options: SendOptions<W>
62+
+ ): Promise<SendReturn<W>>
63+
```
64+
65+
#### Manual waiting with `waitForTx`
66+
67+
When using `NO_WAIT` to send transactions, you can manually wait for confirmation using the `waitForTx` utility:
68+
69+
```typescript
70+
import { waitForTx } from "@aztec/aztec.js/node";
71+
72+
const txHash = await contract.methods.transfer(recipient, amount).send({
73+
from: sender,
74+
wait: NO_WAIT,
75+
});
76+
77+
const receipt = await waitForTx(node, txHash, {
78+
timeout: 60000, // Optional: timeout in ms
79+
interval: 1000, // Optional: polling interval in ms
80+
dontThrowOnRevert: true, // Optional: return receipt even if tx reverted
81+
});
82+
```
83+
1284
### [aztec-nr] Removal of intermediate modules
1385

1486
Lots of unnecessary modules have been removed from the API, making imports shorter. These are the modules that contain just a single struct, in which the module has the same name as the struct.

0 commit comments

Comments
 (0)