Skip to content

[BUG] SendInteractionOptionsWithoutWait is used in public signatures but not exported from @aztec/aztec.js #25303

Description

@shiqicao

What are you trying to do?

Write an application-side helper that wraps .send() in its default wait-for-receipt mode and forwards the caller's options through — i.e. a helper whose parameter type is exactly the parameter type of the first send overload.

That type is SendInteractionOptionsWithoutWait, and it is not exported from any @aztec/aztec.js entry point.

yarn-project/aztec.js/src/contract/interaction_options.ts declares it (line 99) and yarn-project/aztec.js/src/api/contract.ts re-exports its neighbours — SendInteractionOptions, RequestInteractionOptions, SimulateInteractionOptions, InteractionFeeOptions, InteractionWaitOptions, GasSettingsOption — but not this one. The package exports map has no root or wildcard entry, so there is no deep-import escape hatch either.

The type is not internal. It appears directly in public signatures across the API surface:

  • BaseContractInteraction.send<TReturn>(options: SendInteractionOptionsWithoutWait)base_contract_interaction.ts:46, the first of the two send overloads
  • DeployMethod.lockDeployer(from: SendInteractionOptionsWithoutWait['from'] | undefined)deploy_method.ts:309, plus three implementations
  • DeployOptionsWithoutWait = RequestDeployOptions & Pick<SendInteractionOptionsWithoutWait, 'from' | 'fee' | 'additionalScopes'>deploy_method.ts:172
  • AuthWitnessInteraction.send(options?: Omit<SendInteractionOptionsWithoutWait, 'from'>)authwit.ts:292

Most tellingly, SendOptions in wallet/wallet.ts:100 is publicly exported (via api/wallet.ts) and is defined as:

export type SendOptions<W extends InteractionWaitOptions = undefined> = Omit<
  SendInteractionOptionsWithoutWait,
  'fee'
> & { fee?: GasSettingsOption; wait?: W };

So an exported public type is defined in terms of an unexported one. Consumers can use these APIs but cannot name the type they accept.

Code Reference

import type { SendInteractionOptions } from '@aztec/aztec.js/contracts';
// import type { SendInteractionOptionsWithoutWait } from '@aztec/aztec.js/contracts';
//   ^ TS2305: Module '"@aztec/aztec.js/contracts"' has no exported member
//     'SendInteractionOptionsWithoutWait'.

// What I want to write — matches the first `send` overload, so the helper
// returns TxSendResultMined and callers can't pass a meaningless `wait`:
async function sendAndConfirm(
  interaction: ContractFunctionInteraction,
  options: SendInteractionOptionsWithoutWait,
) {
  const { receipt } = await interaction.send(options);
  return receipt;
}

// What I have to write instead. SendInteractionOptions<undefined> is close but
// carries `wait?: undefined`, so `wait` shows up in the helper's public surface
// as a property that can only ever be passed as undefined:
async function sendAndConfirm2(
  interaction: ContractFunctionInteraction,
  options: SendInteractionOptions,
) {
  const { receipt } = await interaction.send(options);
  return receipt;
}

// Or hand-roll the Omit, duplicating a definition that already exists upstream
// and that will drift when the upstream type changes:
type SendOptionsNoWait = Omit<SendInteractionOptions, 'wait'>;

Requested change — add it to the existing export block in api/contract.ts:

export {
  ...
  type SendInteractionOptions,
  type SendInteractionOptionsWithoutWait,   // <-- add
  ...
} from '../contract/interaction_options.js';

DeployOptionsWithoutWait (deploy_method.ts:172) looks like it has the same problem for the deployment path and could be included in the same change. FeePaymentMethodOption is likewise unexported, though it is less load-bearing.

Aztec Version

5.0.1 (commit 72666f8)

OS

Linux

Node Version

v24.18.0

Additional Context

Filed under the bug template because this reads as an oversight in the export surface rather than a new capability — an exported method whose parameter type consumers cannot name. Happy to have it retriaged as a feature request, and happy to open the one-line PR.

Related: #25302, which is also in interaction_options.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions