Skip to content

feat!: remove send wait#19778

Merged
AztecBot merged 1 commit intonextfrom
gj/remove_send_wait
Jan 26, 2026
Merged

feat!: remove send wait#19778
AztecBot merged 1 commit intonextfrom
gj/remove_send_wait

Conversation

@Thunkar
Copy link
Contributor

@Thunkar Thunkar commented Jan 21, 2026

Closes: https://linear.app/aztec-labs/issue/F-112/reevaluate-basecontractinteractionsend
Closes: #13895

This PR removes the infamous SendTx class and its derivations, avoiding the confusing syntax described in #13895 of

const tx = contract.methods.fn().send();
// tx is not actually sent here
console.log(await tx.getTxHash());
// tx is sent now? I just wanted the txhash!
await tx.wait();
// tx is confirmed 

sendTx now allows the consumer to specify wait options. Furthermore, we leverage typescript's type system to dynamically change the return type depending on the input options:

const receipt = await contract.methods.fn.send({ from: address }); // Result is TxReceipt
const txHash = await contract.methods.fn.send({ from: address, wait: false }); // Result is TxHash

A utility called waitForTx has been introduced so things like these are possible:

const txHash = await contract.methods.fn.send({ from: address, wait: false });
await waitForTx(aztecNode, txHash, { timeout: 300 });

All of this allows us to make the Wallet interface leaner too, so getTxReceipt has been removed from it.

@Thunkar Thunkar self-assigned this Jan 21, 2026
@Thunkar Thunkar requested a review from a team as a code owner January 21, 2026 09:33
@Thunkar Thunkar added ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure ci-full Run all master checks. labels Jan 21, 2026

import { waitForTx } from './node.js';

describe('waitForTx', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are ported from the old sent_tx.test.ts

@Thunkar Thunkar changed the title [WIP] feat!: remove send wait feat!: remove send wait Jan 22, 2026
* @param options - Deployment options (same as send, but wait is always true)
* @returns The deployed contract instance
*/
public async deployed(options: DeployOptions): Promise<TContract> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally understand what deployed is 😆 ! Suggest to rename:

Suggested change
public async deployed(options: DeployOptions): Promise<TContract> {
public async deployedInstance(options: DeployOptions): Promise<TContract> {

Ack it's a bit more verbose but this doesn't seem something that people need to write all the time so I think the declarativeness is worth the mild extra typing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning towards just killing it. It does not seem like a lot of gain when you can do:

const { contract } = await MyContract.deploy(wallet).send({ from: address });

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I wholeheartedly agree 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found an alternative approach:

const contract = await MyContract.deploy(wallet).send({ from: address });
const txHash = await MyContract.deploy(wallet).send({ from: address, wait: NO_WAIT });
const receipt = await MyContract.deploy(wallet).send({ from: address, wait: { returnReceipt: true }});

WDYT?

/**
* Type for wait options in interactions - can be false (no wait), WaitOpts (custom wait), or undefined (default wait)
*/
export type InteractionWaitOptions = false | WaitOpts | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this type is what I would consider rewriting as a tagged union

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about replacing the false here with a const expression?

type NO_WAIT = "NO_WAIT";

That way we don't need the builder pattern and the thing wouldn't be falsy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better than false definitely!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another issue with false is it's very natural for someone approaching this API to go like "wait, sure yeah:" => wait: true

Copy link
Contributor Author

@Thunkar Thunkar Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been implemented as a symbol (which turns to a boolean during serialization and then back)
branded string

Copy link
Contributor

@mverzilli mverzilli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Colossal work! Sorry for the spam of API opinions, none of those should block this and in any case they can feed into future conversations

Copy link
Contributor

@mverzilli mverzilli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

Closes: https://linear.app/aztec-labs/issue/F-112/reevaluate-basecontractinteractionsend
Closes: #13895

This PR removes the infamous `SendTx` class and its derivations, avoiding the confusing syntax described in #13895  of

```typescript
const tx = contract.methods.fn().send();
// tx is not actually sent here
console.log(await tx.getTxHash());
// tx is sent now? I just wanted the txhash!
await tx.wait();
// tx is confirmed
```

`sendTx` now allows the consumer to specify wait options. Furthermore, we leverage typescript's type system to dynamically change the return type depending on the input options:

```typescript
const receipt = await contract.methods.fn.send({ from: address }); // Result is TxReceipt
const txHash = await contract.methods.fn.send({ from: address, wait: false }); // Result is TxHash
```

A utility called `waitForTx` has been introduced so things like these are possible:

```typescript
const txHash = await contract.methods.fn.send({ from: address, wait: false });
await waitForTx(aztecNode, txHash, { timeout: 300 });
```

All of this allows us to make the `Wallet` interface leaner too, so `getTxReceipt` has been removed from it.

Co-authored-by: thunkar <gregojquiros@gmail.com>
@AztecBot AztecBot force-pushed the gj/remove_send_wait branch from 80539fa to c7ef263 Compare January 26, 2026 10:25
@AztecBot AztecBot enabled auto-merge January 26, 2026 10:25
@AztecBot AztecBot added this pull request to the merge queue Jan 26, 2026
@AztecBot
Copy link
Collaborator

AztecBot commented Jan 26, 2026

Flakey Tests

🤖 says: This CI run detected 2 tests that failed, but were tolerated due to a .test_patterns.yml entry.

\033FLAKED\033 (8;;http://ci.aztec-labs.com/c940ed46abcfdb19�c940ed46abcfdb198;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_epochs/epochs_invalidate_block.parallel.test.ts "proposer invalidates multiple blocks" (126s) (code: 1) group:e2e-p2p-epoch-flakes (\033Aztec Bot\033: feat!: remove send wait (#19778))
\033FLAKED\033 (8;;http://ci.aztec-labs.com/059ef1534c86d246�059ef1534c86d2468;;�):  yarn-project/end-to-end/scripts/run_test.sh simple src/e2e_p2p/valid_epoch_pruned_slash.test.ts (394s) (code: 1) group:e2e-p2p-epoch-flakes (\033Aztec Bot\033: feat!: remove send wait (#19778))

Merged via the queue into next with commit 030f1ef Jan 26, 2026
17 checks passed
@AztecBot AztecBot deleted the gj/remove_send_wait branch January 26, 2026 11:06
@Thunkar Thunkar mentioned this pull request Jan 26, 2026
AztecBot pushed a commit that referenced this pull request Jan 26, 2026
Somehow got past CI: #19778

Co-authored-by: thunkar <gregojquiros@gmail.com>
AztecBot pushed a commit that referenced this pull request Jan 26, 2026
Migration notes for #19778

Co-authored-by: Gregorio Juliana <gregojquiros@gmail.com>
Co-authored-by: thunkar <gregojquiros@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Jan 26, 2026
critesjosh added a commit that referenced this pull request Jan 29, 2026
Updates documentation to reflect changes from PR #19778:
- Remove .wait() calls - send() now returns receipt directly
- Remove .deployed() calls - send() returns contract for deployments
- Add NO_WAIT option and waitForTx utility examples
- Update getTxReceipt to use node instead of wallet

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
AztecBot pushed a commit that referenced this pull request Feb 3, 2026
## Summary

Comprehensive documentation updates for aztec.js guides and related developer documentation.

### API Updates (from #19778)
- Remove `.wait()` calls - `send()` now returns receipt directly
- Remove `.deployed()` calls - `send()` returns contract for deployments
- Add `NO_WAIT` option and `waitForTx` utility examples
- Update `getTxReceipt` to use node instead of wallet

### Type-Checked Examples
- Add runnable TypeScript examples in `docs/examples/ts/` for:
  - `aztecjs_connection` - Connection and account creation examples
  - `aztecjs_advanced` - `skip_initialization` and `poll_for_events` examples
  - `aztecjs_authwit` - Authorization witness examples
  - `aztecjs_testing` - Testing examples
- Examples are validated with `config.yaml` files for CI integration

### Documentation Improvements
- Add note explaining `TestWallet` vs production wallets in account creation guide
- Clarify undeclared variables in code examples
- Format code blocks for consistency
- Update `devnetTag` version reference

### Bug Fixes
- Update installation commands to use `-L` flag for curl (follows redirects)

**Files updated:**
- `how_to_send_transaction.md`
- `how_to_deploy_contract.md`
- `how_to_create_account.md`
- `how_to_pay_fees.md`
- `how_to_use_authwit.md`
- `how_to_test.md`
- `how_to_read_data.md`
- `how_to_connect_to_local_network.md`
- Various versioned docs with curl -L fix

## Test plan
- [ ] Verify documentation builds successfully
- [ ] Review code examples for accuracy against new API
- [ ] Run type-checked examples to verify they compile

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Josh Crites <jc@joshcrites.com>
AztecBot pushed a commit that referenced this pull request Feb 3, 2026
## Summary

Comprehensive documentation updates for aztec.js guides and related developer documentation.

### API Updates (from #19778)
- Remove `.wait()` calls - `send()` now returns receipt directly
- Remove `.deployed()` calls - `send()` returns contract for deployments
- Add `NO_WAIT` option and `waitForTx` utility examples
- Update `getTxReceipt` to use node instead of wallet

### Type-Checked Examples
- Add runnable TypeScript examples in `docs/examples/ts/` for:
  - `aztecjs_connection` - Connection and account creation examples
  - `aztecjs_advanced` - `skip_initialization` and `poll_for_events` examples
  - `aztecjs_authwit` - Authorization witness examples
  - `aztecjs_testing` - Testing examples
- Examples are validated with `config.yaml` files for CI integration

### Documentation Improvements
- Add note explaining `TestWallet` vs production wallets in account creation guide
- Clarify undeclared variables in code examples
- Format code blocks for consistency
- Update `devnetTag` version reference

### Bug Fixes
- Update installation commands to use `-L` flag for curl (follows redirects)

**Files updated:**
- `how_to_send_transaction.md`
- `how_to_deploy_contract.md`
- `how_to_create_account.md`
- `how_to_pay_fees.md`
- `how_to_use_authwit.md`
- `how_to_test.md`
- `how_to_read_data.md`
- `how_to_connect_to_local_network.md`
- Various versioned docs with curl -L fix

## Test plan
- [ ] Verify documentation builds successfully
- [ ] Review code examples for accuracy against new API
- [ ] Run type-checked examples to verify they compile

🤖 Generated with [Claude Code](https://claude.ai/code)
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2026
## Summary

Comprehensive documentation updates for aztec.js guides and related
developer documentation.

### API Updates (from #19778)
- Remove `.wait()` calls - `send()` now returns receipt directly
- Remove `.deployed()` calls - `send()` returns contract for deployments
- Add `NO_WAIT` option and `waitForTx` utility examples
- Update `getTxReceipt` to use node instead of wallet

### Type-Checked Examples
- Add runnable TypeScript examples in `docs/examples/ts/` for:
  - `aztecjs_connection` - Connection and account creation examples
- `aztecjs_advanced` - `skip_initialization` and `poll_for_events`
examples
  - `aztecjs_authwit` - Authorization witness examples
  - `aztecjs_testing` - Testing examples
- Examples are validated with `config.yaml` files for CI integration

### Documentation Improvements
- Add note explaining `TestWallet` vs production wallets in account
creation guide
- Clarify undeclared variables in code examples
- Format code blocks for consistency
- Update `devnetTag` version reference

### Bug Fixes
- Update installation commands to use `-L` flag for curl (follows
redirects)

**Files updated:**
- `how_to_send_transaction.md`
- `how_to_deploy_contract.md`
- `how_to_create_account.md`
- `how_to_pay_fees.md`
- `how_to_use_authwit.md`
- `how_to_test.md`
- `how_to_read_data.md`
- `how_to_connect_to_local_network.md`
- Various versioned docs with curl -L fix

## Test plan
- [ ] Verify documentation builds successfully
- [ ] Review code examples for accuracy against new API
- [ ] Run type-checked examples to verify they compile

🤖 Generated with [Claude Code](https://claude.ai/code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run all master checks. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] SentTx.hash

3 participants