Skip to main content
Version: Devnet (v3.0.0-devnet.4)

Aztec.js API Reference

This documentation is auto-generated from the Aztec.js TypeScript source code.

info

This is an auto-generated reference. For tutorials and guides, see the Aztec.js Overview.

Package: @aztec/aztec.js

Generated: 2025-11-05T19:31:50.586Z

This document provides a comprehensive reference for all public APIs in the Aztec.js library.

Each section is organized by module, with classes, interfaces, types, and functions documented with their full signatures, parameters, and return types.

Table of Contents


Account


account/account_contract.ts

AccountContract

Type: Interface

An account contract instance. Knows its artifact, deployment arguments, how to create transaction execution requests out of function calls, and how to authorize actions.

Methods

getContractArtifact

Returns the artifact of this account contract.

Signature:

getContractArtifact(): Promise<ContractArtifact>

Returns:

Promise<ContractArtifact>

getInitializationFunctionAndArgs

Returns the initializer function name and arguments for this instance, or undefined if this contract does not require initialization.

Signature:

getInitializationFunctionAndArgs(): Promise<{
constructorName: string;
constructorArgs: any[];
} | undefined>

Returns:

Promise<
| {
/** The name of the function used to initialize the contract */
constructorName: string;
/** The args to the function used to initialize the contract */
constructorArgs: any[];
}
| undefined
>
getInterface

Returns the account interface for this account contract given an instance at the provided address. The account interface is responsible for assembling tx requests given requested function calls, and for creating signed auth witnesses given action identifiers (message hashes).

Signature:

getInterface(
address: CompleteAddress,
chainInfo: ChainInfo
): AccountInterface

Parameters:

  • address: CompleteAddress
    • Address of this account contract.
  • chainInfo: ChainInfo
    • Chain id and version of the rollup where the account contract is initialized / published.

Returns:

AccountInterface - An account interface instance for creating tx requests and authorizing actions.

getAuthWitnessProvider

Returns the auth witness provider for the given address.

Signature:

getAuthWitnessProvider(address: CompleteAddress): AuthWitnessProvider

Parameters:

  • address: CompleteAddress
    • Address for which to create auth witnesses.

Returns:

AuthWitnessProvider

getAccountContractAddress

Type: Function

Compute the address of an account contract from secret and salt.

Signature:

export async getAccountContractAddress(
accountContract: AccountContract,
secret: Fr,
salt: Fr
)

Parameters:

  • accountContract: AccountContract
  • secret: Fr
  • salt: Fr

Returns:

Promise<any>


account/account_with_secret_key.ts

AccountWithSecretKey

Type: Class

Extends Account with the encryption private key. Not required for implementing the wallet interface but useful for testing purposes or exporting an account to another pxe.

Extends: BaseAccount

Constructor

Signature:

constructor(
account: AccountInterface,
private secretKey: Fr,
public readonly salt: Salt
)

Parameters:

  • account: AccountInterface
  • secretKey: Fr
  • salt: Salt
    • Deployment salt for this account contract.

Methods

getSecretKey

Returns the encryption private key associated with this account.

Signature:

public getSecretKey()

Returns:

Fr

getEncryptionSecret

Returns the encryption secret, the secret of the encryption point—the point that others use to encrypt messages to this account note - this ensures that the address secret always corresponds to an address point with y being positive dev - this is also referred to as the address secret, which decrypts payloads encrypted to an address point

Signature:

public async getEncryptionSecret()

Returns:

Promise<any>


account/account.ts

Account

Type: Type Alias

A type defining an account, capable of both creating authwits and using them to authenticate transaction execution requests.

Signature:

export type Account = AccountInterface & AuthwitnessIntentProvider;

BaseAccount

Type: Class

An account implementation that uses authwits as an authentication mechanism and can assemble transaction execution requests for an entrypoint.

Implements: Account

Constructor

Signature:

constructor(protected account: AccountInterface)

Parameters:

  • account: AccountInterface

Methods

createTxExecutionRequest

Signature:

createTxExecutionRequest(
exec: ExecutionPayload,
gasSettings: GasSettings,
options: DefaultAccountEntrypointOptions
): Promise<TxExecutionRequest>

Parameters:

  • exec: ExecutionPayload
  • gasSettings: GasSettings
  • options: DefaultAccountEntrypointOptions

Returns:

Promise<TxExecutionRequest>

getChainId

Signature:

getChainId(): Fr

Returns:

Fr

getVersion

Signature:

getVersion(): Fr

Returns:

Fr

getCompleteAddress

Returns the complete address of the account that implements this wallet.

Signature:

public getCompleteAddress()

Returns:

CompleteAddress

getAddress

Returns the address of the account that implements this wallet.

Signature:

public getAddress()

Returns:

any

createAuthWit

Computes an authentication witness from either a message hash or an intent. If a message hash is provided, it will create a witness for the hash directly. Otherwise, it will compute the message hash using the intent, along with the chain id and the version values provided by the wallet.

Signature:

async createAuthWit(messageHashOrIntent: Fr | Buffer | CallIntent | IntentInnerHash): Promise<AuthWitness>

Parameters:

  • messageHashOrIntent: Fr | Buffer | CallIntent | IntentInnerHash
    • The message hash of the intent to approve

Returns:

Promise<AuthWitness> - The authentication witness


account/interface.ts

AccountInterface

Type: Interface

Handler for interfacing with an account. Knows how to create transaction execution requests and authorize actions for its corresponding account.

Extends: EntrypointInterface, AuthWitnessProvider

Methods

getCompleteAddress

Returns the complete address for this account.

Signature:

getCompleteAddress(): CompleteAddress

Returns:

CompleteAddress

getAddress

Returns the address for this account.

Signature:

getAddress(): AztecAddress

Returns:

AztecAddress

getChainId

Returns the chain id for this account

Signature:

getChainId(): Fr

Returns:

Fr

getVersion

Returns the rollup version for this account

Signature:

getVersion(): Fr

Returns:

Fr


account/signerless_account.ts

SignerlessAccount

Type: Class

Account implementation which creates a transaction using the multicall protocol contract as entrypoint.

Implements: Account

Constructor

Signature:

constructor(chainInfo: ChainInfo)

Parameters:

  • chainInfo: ChainInfo

Methods

createTxExecutionRequest

Signature:

createTxExecutionRequest(
exec: ExecutionPayload,
gasSettings: GasSettings
): Promise<TxExecutionRequest>

Parameters:

  • exec: ExecutionPayload
  • gasSettings: GasSettings

Returns:

Promise<TxExecutionRequest>

getChainId

Signature:

getChainId(): Fr

Returns:

Fr

getVersion

Signature:

getVersion(): Fr

Returns:

Fr

getCompleteAddress

Signature:

getCompleteAddress(): CompleteAddress

Returns:

CompleteAddress

getAddress

Signature:

getAddress(): AztecAddress

Returns:

AztecAddress

createAuthWit

Signature:

createAuthWit(_intent: Fr | Buffer | IntentInnerHash | CallIntent): Promise<AuthWitness>

Parameters:

  • _intent: Fr | Buffer | IntentInnerHash | CallIntent

Returns:

Promise<AuthWitness>

Authorization


authorization/call_authorization_request.ts

CallAuthorizationRequest

Type: Class

An authwit request for a function call. Includes the preimage of the data to be signed, as opposed of just the inner hash.

Constructor

Signature:

constructor(
public selector: AuthorizationSelector,
public innerHash: Fr,
public msgSender: AztecAddress,
public functionSelector: FunctionSelector,
public argsHash: Fr,
public args: Fr[]
)

Parameters:

  • selector: AuthorizationSelector
    • The selector of the authwit type, used to identify it when emitted from emit_offchain_effectoracle. Computed as poseidon2("CallAuthwit((Field),(u32),Field)".to_bytes())
  • innerHash: Fr
    • The inner hash of the authwit, computed as poseidon2([msg_sender, selector, args_hash])
  • msgSender: AztecAddress
    • The address performing the call
  • functionSelector: FunctionSelector
    • The selector of the function that is to be authorized
  • argsHash: Fr
    • The hash of the arguments to the function call,
  • args: Fr[]
    • The arguments to the function call.

Methods

getSelector

Signature:

static getSelector(): Promise<AuthorizationSelector>

Returns:

Promise<AuthorizationSelector>

fromFields

Signature:

static async fromFields(fields: Fr[]): Promise<CallAuthorizationRequest>

Parameters:

  • fields: Fr[]

Returns:

Promise<CallAuthorizationRequest>

Contract


contract/base_contract_interaction.ts

BaseContractInteraction

Type: Class

Base class for an interaction with a contract, be it a deployment, a function call, or a batch. Implements the sequence create/simulate/send.

Constructor

Signature:

constructor(
protected wallet: Wallet,
protected authWitnesses: AuthWitness[] = [],
protected capsules: Capsule[] = []
)

Parameters:

  • wallet: Wallet
  • authWitnesses (optional): AuthWitness[]
  • capsules (optional): Capsule[]

Properties

log

Type: any

Methods

request

Returns an execution request that represents this operation. Can be used as a building block for constructing batch requests.

Signature:

public abstract request(options?: RequestInteractionOptions): Promise<ExecutionPayload>

Parameters:

  • options (optional): RequestInteractionOptions
    • An optional object containing additional configuration for the transaction.

Returns:

Promise<ExecutionPayload> - An execution request wrapped in promise.

send

Sends a transaction to the contract function with the specified options. This function throws an error if called on a utility function. It creates and signs the transaction if necessary, and returns a SentTx instance, which can be used to track the transaction status, receipt, and events.

Signature:

public send(options: SendInteractionOptions): SentTx

Parameters:

  • options: SendInteractionOptions
    • An object containing 'from' property representing the AztecAddress of the sender and optional fee configuration

Returns:

SentTx - A SentTx instance for tracking the transaction status and information.


contract/batch_call.ts

BatchCall

Type: Class

A batch of function calls to be sent as a single transaction through a wallet.

Extends: BaseContractInteraction

Constructor

Signature:

constructor(
wallet: Wallet,
protected interactions: (BaseContractInteraction | ExecutionPayload)[]
)

Parameters:

  • wallet: Wallet
  • interactions: (BaseContractInteraction | ExecutionPayload)[]

Methods

request

Returns an execution request that represents this operation.

Signature:

public async request(options: RequestInteractionOptions = {}): Promise<ExecutionPayload>

Parameters:

  • options (optional): RequestInteractionOptions
    • An optional object containing additional configuration for the request generation.

Returns:

Promise<ExecutionPayload> - An execution payload wrapped in promise.

simulate

Simulate a transaction and get its return values Differs from prove in a few important ways: 1. It returns the values of the function execution 2. It supports utility, private and public functions

Signature:

public async simulate(options: SimulateInteractionOptions): Promise<any>

Parameters:

  • options: SimulateInteractionOptions
    • An optional object containing additional configuration for the transaction.

Returns:

Promise<any> - The result of the transaction as returned by the contract function.

getExecutionPayloads

Signature:

protected async getExecutionPayloads(): Promise<ExecutionPayload[]>

Returns:

Promise<ExecutionPayload[]>


contract/checker.ts

abiChecker

Type: Function

Validates the given ContractArtifact object by checking its functions and their parameters. Ensures that the ABI has at least one function, a constructor, valid bytecode, and correct parameter types. Throws an error if any inconsistency is detected during the validation process.

Signature:

export abiChecker(artifact: ContractArtifact)

Parameters:

  • artifact: ContractArtifact
    • The ContractArtifact object to be validated.

Returns:

boolean - A boolean value indicating whether the artifact is valid or not.


contract/contract_base.ts

ContractMethod

Type: Type Alias

Type representing a contract method that returns a ContractFunctionInteraction instance and has a readonly 'selector' property of type Buffer. Takes any number of arguments.

Signature:

export type ContractMethod = ((...args: any[]) => ContractFunctionInteraction) & {
selector: () => Promise<FunctionSelector>;
};

Type Members:

selector

The unique identifier for a contract function in bytecode.

Type: () => Promise<FunctionSelector>

ContractStorageLayout

Type: Type Alias

Type representing the storage layout of a contract.

Signature:

export type ContractStorageLayout<T extends string> = {
[K in T]: FieldLayout;
};

Type Members:

[K in T]

Signature: [K in T]: FieldLayout

Key Type: T

Value Type: FieldLayout

ContractBase

Type: Class

Abstract implementation of a contract extended by the Contract class and generated contract types.

Constructor

Signature:

protected constructor(
public readonly instance: ContractInstanceWithAddress,
public readonly artifact: ContractArtifact,
public wallet: Wallet
)

Parameters:

  • instance: ContractInstanceWithAddress
    • The deployed contract instance definition.
  • artifact: ContractArtifact
    • The Application Binary Interface for the contract.
  • wallet: Wallet
    • The wallet used for interacting with this contract.

Properties

methods

An object containing contract methods mapped to their respective names.

Type: { [name: string]: ContractMethod }

Methods

withWallet

Creates a new instance of the contract wrapper attached to a different wallet.

Signature:

public withWallet(wallet: Wallet): this

Parameters:

  • wallet: Wallet
    • Wallet to use for sending txs.

Returns:

this - A new contract instance.

Getters

address (getter)

Address of the contract.

Signature:

public get address() {

Returns: any

partialAddress (getter)

Partial address of the contract.

Signature:

public get partialAddress() {

Returns: any


contract/contract_function_interaction.ts

ContractFunctionInteraction

Type: Class

This is the class that is returned when calling e.g. contract.methods.myMethod(arg0, arg1). It contains available interactions one can call on a method, including view.

Extends: BaseContractInteraction

Constructor

Signature:

constructor(
wallet: Wallet,
protected contractAddress: AztecAddress,
protected functionDao: FunctionAbi,
protected args: any[],
authWitnesses: AuthWitness[] = [],
capsules: Capsule[] = [],
private extraHashedArgs: HashedValues[] = []
)

Parameters:

  • wallet: Wallet
  • contractAddress: AztecAddress
  • functionDao: FunctionAbi
  • args: any[]
  • authWitnesses (optional): AuthWitness[]
  • capsules (optional): Capsule[]
  • extraHashedArgs (optional): HashedValues[]

Methods

getFunctionCall

Returns the encoded function call wrapped by this interaction Useful when generating authwits

Signature:

public async getFunctionCall()

Returns:

Promise<{ name: any; args: any; selector: any; type: any; to: AztecAddress; isStatic: any; hideMsgSender: boolean; returnTypes: any; }> - An encoded function call

request

Returns the execution payload that allows this operation to happen on chain.

Signature:

public override async request(options: RequestInteractionOptions = {}): Promise<ExecutionPayload>

Parameters:

  • options (optional): RequestInteractionOptions
    • Configuration options.

Returns:

Promise<ExecutionPayload> - The execution payload for this operation

simulate

Simulate a transaction and get information from its execution. Differs from prove in a few important ways: 1. It returns the values of the function execution, plus additional metadata if requested 2. It supports utility, private and public functions

Signature:

public async simulate<T extends SimulateInteractionOptions>(options: T): Promise<SimulationReturn<Exclude<T['fee'], undefined>['estimateGas']>>

Parameters:

  • options: T
    • An optional object containing additional configuration for the simulation.

Returns:

Promise<SimulationReturn<Exclude<T['fee'], undefined>['estimateGas']>> - Depending on the simulation options, this method directly returns the result value of the executed function or a rich object containing extra metadata, such as estimated gas costs (if requested via options), execution statistics and emitted offchain effects

simulate

Signature:

public async simulate<T extends SimulateInteractionOptions>(options: T): Promise<SimulationReturn<T['includeMetadata']>>

Parameters:

  • options: T

Returns:

Promise<SimulationReturn<T['includeMetadata']>>

simulate

Signature:

public async simulate(options: SimulateInteractionOptions): Promise<SimulationReturn<typeof options.includeMetadata>>

Parameters:

  • options: SimulateInteractionOptions

Returns:

Promise<SimulationReturn<typeof options.includeMetadata>>

profile

Simulate a transaction and profile the gate count for each function in the transaction.

Signature:

public async profile(options: ProfileInteractionOptions): Promise<TxProfileResult>

Parameters:

  • options: ProfileInteractionOptions
    • Same options as simulate, plus profiling method

Returns:

Promise<TxProfileResult> - An object containing the function return value and profile result.

with

Augments this ContractFunctionInteraction with additional metadata, such as authWitnesses, capsules, and extraHashedArgs. This is useful when creating a "batteries included" interaction, such as registering a contract class with its associated capsule instead of having the user provide them externally.

Signature:

public with({ authWitnesses = [], capsules = [], extraHashedArgs = [], }: {
authWitnesses?: AuthWitness[];
capsules?: Capsule[];
extraHashedArgs?: HashedValues[];
}): ContractFunctionInteraction

Parameters:

  • { authWitnesses = [], capsules = [], extraHashedArgs = [], }: { /** The authWitnesses to add to the interaction */ authWitnesses?: AuthWitness[]; /** The capsules to add to the interaction */ capsules?: Capsule[]; /** The extra hashed args to add to the interaction */ extraHashedArgs?: HashedValues[]; }

Returns:

ContractFunctionInteraction - A new ContractFunctionInteraction with the added metadata, but calling the same original function in the same manner


contract/contract.ts

Contract

Type: Class

The Contract class represents a contract and provides utility methods for interacting with it. It enables the creation of ContractFunctionInteraction instances for each function in the contract's ABI, allowing users to call or send transactions to these functions. Additionally, the Contract class can be used to attach the contract instance to a deployed contract onchain through the PXE, which facilitates interaction with Aztec's privacy protocol.

Extends: ContractBase

Methods

at

Gets a contract instance.

Signature:

public static async at(
address: AztecAddress,
artifact: ContractArtifact,
wallet: Wallet
): Promise<Contract>

Parameters:

  • address: AztecAddress
    • The address of the contract instance.
  • artifact: ContractArtifact
    • Build artifact of the contract.
  • wallet: Wallet
    • The wallet to use when interacting with the contract.

Returns:

Promise<Contract> - A promise that resolves to a new Contract instance.

deploy

Creates a tx to deploy (initialize and/or publish) a new instance of a contract.

Signature:

public static deploy(
wallet: Wallet,
artifact: ContractArtifact,
args: any[],
constructorName?: string
)

Parameters:

  • wallet: Wallet
    • The wallet for executing the deployment.
  • artifact: ContractArtifact
    • Build artifact of the contract to deploy
  • args: any[]
    • Arguments for the constructor.
  • constructorName (optional): string
    • The name of the constructor function to call.

Returns:

DeployMethod<Contract>

deployWithPublicKeys

Creates a tx to deploy (initialize and/or publish) a new instance of a contract using the specified public keys hash to derive the address.

Signature:

public static deployWithPublicKeys(
publicKeys: PublicKeys,
wallet: Wallet,
artifact: ContractArtifact,
args: any[],
constructorName?: string
)

Parameters:

  • publicKeys: PublicKeys
    • Hash of public keys to use for deriving the address.
  • wallet: Wallet
    • The wallet for executing the deployment.
  • artifact: ContractArtifact
    • Build artifact of the contract.
  • args: any[]
    • Arguments for the constructor.
  • constructorName (optional): string
    • The name of the constructor function to call.

Returns:

DeployMethod<Contract>


contract/deploy_method.ts

RequestDeployOptions

Type: Type Alias

Options for deploying a contract on the Aztec network. Allows specifying a contract address salt and different options to tweak contract publication and initialization

Signature:

export type RequestDeployOptions = RequestInteractionOptions & {
contractAddressSalt?: Fr;
deployer?: AztecAddress;
skipClassPublication?: boolean;
skipInstancePublication?: boolean;
skipInitialization?: boolean;
};

Type Members:

contractAddressSalt

An optional salt value used to deterministically calculate the contract address.

Type: Fr

deployer

Deployer address that will be used for the deployed contract's address computation. If set to 0, the sender's address won't be mixed in

Type: AztecAddress

skipClassPublication

Skip contract class publication.

Type: boolean

skipInstancePublication

Skip publication, instead just privately initialize the contract.

Type: boolean

skipInitialization

Skip contract initialization.

Type: boolean

DeployOptions

Type: Type Alias

Extends the deployment options with the required parameters to send the transaction

Signature:

export type DeployOptions = Omit<RequestDeployOptions, 'deployer'> & {
universalDeploy?: boolean;
} & Pick<SendInteractionOptions, 'from' | 'fee'>;

Type Members:

universalDeploy

Set to true to not include the sender in the address computation. This option is mutually exclusive with "deployer"

Type: boolean

SimulateDeployOptions

Type: Type Alias

Options for simulating the deployment of a contract Allows skipping certain validations and computing gas estimations

Signature:

export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
fee?: SimulationInteractionFeeOptions;
skipTxValidation?: boolean;
skipFeeEnforcement?: boolean;
includeMetadata?: boolean;
};

Type Members:

fee

The fee options for the transaction.

Type: SimulationInteractionFeeOptions

skipTxValidation

Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers.

Type: boolean

skipFeeEnforcement

Whether to ensure the fee payer is not empty and has enough balance to pay for the fee.

Type: boolean

includeMetadata

Whether to include metadata such as offchain effects and performance statistics (e.g. timing information of the different circuits and oracles) in the simulation result, instead of just the return value of the function

Type: boolean

DeployMethod

Type: Class

Contract interaction for deployment. Handles class publication, instance publication, and initialization of the contract. Note that for some contracts, a tx is not required as part of its "creation": If there are no public functions, and if there are no initialization functions, then technically the contract has already been "created", and all of the contract's functions (private and utility) can be interacted-with immediately, without any "deployment tx". Extends the BaseContractInteraction class.

Extends: BaseContractInteraction

Constructor

Signature:

constructor(
private publicKeys: PublicKeys,
wallet: Wallet,
protected artifact: ContractArtifact,
protected postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
private args: any[] = [],
constructorNameOrArtifact?: string | FunctionArtifact,
authWitnesses: AuthWitness[] = [],
capsules: Capsule[] = []
)

Parameters:

  • publicKeys: PublicKeys
  • wallet: Wallet
  • artifact: ContractArtifact
  • postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>
  • args (optional): any[]
  • constructorNameOrArtifact (optional): string | FunctionArtifact
  • authWitnesses (optional): AuthWitness[]
  • capsules (optional): Capsule[]

Methods

request

Returns the execution payload that allows this operation to happen on chain.

Signature:

public async request(options?: RequestDeployOptions): Promise<ExecutionPayload>

Parameters:

  • options (optional): RequestDeployOptions
    • Configuration options.

Returns:

Promise<ExecutionPayload> - The execution payload for this operation

convertDeployOptionsToRequestOptions

Signature:

convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions

Parameters:

  • options: DeployOptions

Returns:

RequestDeployOptions

register

Adds this contract to the wallet and returns the Contract object.

Signature:

public async register(options?: RequestDeployOptions): Promise<TContract>

Parameters:

  • options (optional): RequestDeployOptions
    • Deployment options.

Returns:

Promise<TContract>

getPublicationExecutionPayload

Returns an execution payload for: - publication of the contract class and - publication of the contract instance to enable public execution depending on the provided options.

Signature:

protected async getPublicationExecutionPayload(options?: RequestDeployOptions): Promise<ExecutionPayload>

Parameters:

  • options (optional): RequestDeployOptions
    • Contract creation options.

Returns:

Promise<ExecutionPayload> - An execution payload with potentially calls (and bytecode capsule) to the class registry and instance registry.

getInitializationExecutionPayload

Returns the calls necessary to initialize the contract.

Signature:

protected async getInitializationExecutionPayload(options?: RequestDeployOptions): Promise<ExecutionPayload>

Parameters:

  • options (optional): RequestDeployOptions
    • Deployment options.

Returns:

Promise<ExecutionPayload> - An array of function calls.

send

Send a contract deployment transaction (initialize and/or publish) using the provided options. This function extends the 'send' method from the ContractFunctionInteraction class, allowing us to send a transaction specifically for contract deployment.

Signature:

public override send(options: DeployOptions): DeploySentTx<TContract>

Parameters:

  • options: DeployOptions
    • An object containing various deployment options such as contractAddressSalt and from.

Returns:

DeploySentTx<TContract> - A SentTx object that returns the receipt and the deployed contract instance.

getInstance

Builds the contract instance and returns it.

Signature:

public async getInstance(options?: RequestDeployOptions): Promise<ContractInstanceWithAddress>

Parameters:

  • options (optional): RequestDeployOptions
    • An object containing various initialization and publication options.

Returns:

Promise<ContractInstanceWithAddress> - An instance object.

simulate

Simulate the deployment

Signature:

public async simulate(options: SimulateDeployOptions): Promise<SimulationReturn<true>>

Parameters:

  • options: SimulateDeployOptions
    • An optional object containing additional configuration for the simulation.

Returns:

Promise<SimulationReturn<true>> - A simulation result object containing metadata of the execution, including gas estimations (if requested via options), execution statistics and emitted offchain effects

profile

Simulate a deployment and profile the gate count for each function in the transaction.

Signature:

public async profile(options: DeployOptions & ProfileInteractionOptions): Promise<TxProfileResult>

Parameters:

  • options: DeployOptions & ProfileInteractionOptions
    • Same options as send, plus extra profiling options.

Returns:

Promise<TxProfileResult> - An object containing the function return value and profile result.

with

Augments this DeployMethod with additional metadata, such as authWitnesses and capsules.

Signature:

public with({ authWitnesses = [], capsules = [], }: {
authWitnesses?: AuthWitness[];
capsules?: Capsule[];
}): DeployMethod

Parameters:

  • { authWitnesses = [], capsules = [], }: { /** The authWitnesses to add to the deployment */ authWitnesses?: AuthWitness[]; /** The capsules to add to the deployment */ capsules?: Capsule[]; }

Returns:

DeployMethod - A new DeployMethod with the added metadata, but calling the same original function in the same manner

Getters

address (getter)

Return this deployment address.

Signature:

public get address() {

Returns: any

partialAddress (getter)

Returns the partial address for this deployment.

Signature:

public get partialAddress() {

Returns: any


contract/deploy_sent_tx.ts

DeployedWaitOpts

Type: Type Alias

Options related to waiting for a deployment tx.

Signature:

export type DeployedWaitOpts = WaitOpts & {
wallet?: Wallet;
};

Type Members:

wallet

Wallet to use for creating a contract instance. Uses the one set in the deployer constructor if not set.

Type: Wallet

DeployTxReceipt

Type: Type Alias

Extends a transaction receipt with a contract instance that represents the newly deployed contract.

Signature:

export type DeployTxReceipt<TContract extends ContractBase = Contract> = FieldsOf<TxReceipt> & {
contract: TContract;
};

Type Members:

contract

Instance of the newly deployed contract.

Type: TContract

DeploySentTx

Type: Class

A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.

Extends: SentTx

Constructor

Signature:

constructor(
wallet: Wallet,
sendTx: () => Promise<TxHash>,
private postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
public instanceGetter: () => Promise<ContractInstanceWithAddress>
)

Parameters:

  • wallet: Wallet
  • sendTx: () => Promise<TxHash>
  • postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>
  • instanceGetter: () => Promise<ContractInstanceWithAddress>
    • A getter for the deployed contract instance

Methods

deployed

Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.

Signature:

public async deployed(opts?: DeployedWaitOpts): Promise<TContract>

Parameters:

  • opts (optional): DeployedWaitOpts
    • Options for configuring the waiting for the tx to be mined.

Returns:

Promise<TContract> - The deployed contract instance.

wait

Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.

Signature:

public override async wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>>

Parameters:

  • opts (optional): DeployedWaitOpts
    • Options for configuring the waiting for the tx to be mined.

Returns:

Promise<DeployTxReceipt<TContract>> - The transaction receipt with the deployed contract instance.


contract/get_gas_limits.ts

getGasLimits

Type: Function

Returns suggested total and teardown gas limits for a simulated tx.

Signature:

export getGasLimits(
simulationResult: TxSimulationResult,
pad = 0.1
): {
gasLimits: Gas;
teardownGasLimits: Gas;
}

Parameters:

  • simulationResult: TxSimulationResult
  • pad (optional): any
    • Percentage to pad the suggested gas limits by, (as decimal, e.g., 0.10 for 10%).

Returns:

{
/**
* Gas limit for the tx, excluding teardown gas
*/
gasLimits: Gas;
/**
* Gas limit for the teardown phase
*/
teardownGasLimits: Gas;
}

contract/interaction_options.ts

FeeEstimationOptions

Type: Type Alias

Options used to tweak the simulation and add gas estimation capabilities

Signature:

export type FeeEstimationOptions = {
estimateGas?: boolean;
estimatedGasPadding?: number;
};

Type Members:

estimateGas

Whether to modify the fee settings of the simulation with high gas limit to figure out actual gas settings.

Type: boolean

estimatedGasPadding

Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set.

Type: number

FeePaymentMethodOption

Type: Type Alias

Interactions allow configuring a custom fee payment method that gets bundled with the transaction before sending it to the wallet

Signature:

export type FeePaymentMethodOption = {
paymentMethod?: FeePaymentMethod;
};

Type Members:

paymentMethod

Fee payment method to embed in the interaction

Type: FeePaymentMethod

GasSettingsOption

Type: Type Alias

User-defined partial gas settings for the interaction. This type is completely optional since the wallet will fill in the missing options

Signature:

export type GasSettingsOption = {
gasSettings?: Partial<FieldsOf<GasSettings>>;
};

Type Members:

gasSettings

The gas settings

Type: Partial<FieldsOf<GasSettings>>

InteractionFeeOptions

Type: Type Alias

Fee options as set by a user.

Signature:

export type InteractionFeeOptions = GasSettingsOption & FeePaymentMethodOption;

SimulationInteractionFeeOptions

Type: Type Alias

Fee options that can be set for simulation only

Signature:

export type SimulationInteractionFeeOptions = InteractionFeeOptions & FeeEstimationOptions;

RequestInteractionOptions

Type: Type Alias

Represents the options to configure a request from a contract interaction. Allows specifying additional auth witnesses and capsules to use during execution

Signature:

export type RequestInteractionOptions = {
authWitnesses?: AuthWitness[];
capsules?: Capsule[];
fee?: FeePaymentMethodOption;
};

Type Members:

authWitnesses

Extra authwits to use during execution

Type: AuthWitness[]

capsules

Extra capsules to use during execution

Type: Capsule[]

fee

Fee payment method to embed in the interaction request

Type: FeePaymentMethodOption

SendInteractionOptions

Type: Type Alias

Represents options for calling a (constrained) function in a contract.

Signature:

export type SendInteractionOptions = RequestInteractionOptions & {
from: AztecAddress;
fee?: InteractionFeeOptions;
};

Type Members:

from

The sender's Aztec address.

Type: AztecAddress

fee

The fee options for the transaction.

Type: InteractionFeeOptions

SimulateInteractionOptions

Type: Type Alias

Represents the options for simulating a contract function interaction. Allows specifying the address from which the method should be called. Disregarded for simulation of public functions

Signature:

export type SimulateInteractionOptions = Omit<SendInteractionOptions, 'fee'> & {
fee?: SimulationInteractionFeeOptions;
skipTxValidation?: boolean;
skipFeeEnforcement?: boolean;
includeMetadata?: boolean;
};

Type Members:

fee

The fee options for the transaction.

Type: SimulationInteractionFeeOptions

skipTxValidation

Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers.

Type: boolean

skipFeeEnforcement

Whether to ensure the fee payer is not empty and has enough balance to pay for the fee.

Type: boolean

includeMetadata

Whether to include metadata such as offchain effects and performance statistics (e.g. timing information of the different circuits and oracles) in the simulation result, instead of just the return value of the function

Type: boolean

ProfileInteractionOptions

Type: Type Alias

Represents the options for profiling an interaction.

Signature:

export type ProfileInteractionOptions = SimulateInteractionOptions & {
profileMode: 'gates' | 'execution-steps' | 'full';
skipProofGeneration?: boolean;
};

Type Members:

profileMode

Whether to return gates information or the bytecode/witnesses.

Type: 'gates' | 'execution-steps' | 'full'

skipProofGeneration

Whether to generate a Chonk proof or not

Type: boolean

SimulationReturn

Type: Type Alias

Represents the result type of a simulation. By default, it will just be the return value of the simulated function If includeMetadata is set to true in SimulateInteractionOptions on the input of simulate(...), it will provide extra information.

Signature:

export type SimulationReturn<T extends boolean | undefined> = T extends true
? {
stats: SimulationStats;
offchainEffects: OffchainEffect[];
result: any;
estimatedGas: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>;
}
: any;

toSendOptions

Type: Function

Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into SendOptions, which are the ones that can be serialized and forwarded to the wallet

Signature:

export async toSendOptions(options: SendInteractionOptions): Promise<SendOptions>

Parameters:

  • options: SendInteractionOptions

Returns:

Promise<SendOptions>

toSimulateOptions

Type: Function

Transforms and cleans up the higher level SimulateInteractionOptions defined by the interaction into SimulateOptions, which are the ones that can be serialized and forwarded to the wallet

Signature:

export async toSimulateOptions(options: SimulateInteractionOptions): Promise<SimulateOptions>

Parameters:

  • options: SimulateInteractionOptions

Returns:

Promise<SimulateOptions>

toProfileOptions

Type: Function

Transforms and cleans up the higher level ProfileInteractionOptions defined by the interaction into ProfileOptions, which are the ones that can be serialized and forwarded to the wallet

Signature:

export async toProfileOptions(options: ProfileInteractionOptions): Promise<ProfileOptions>

Parameters:

  • options: ProfileInteractionOptions

Returns:

Promise<ProfileOptions>


contract/protocol_contracts.ts

getClassRegistryContract

Type: Function

Returns a Contract wrapper for the contract class registry.

Signature:

export async getClassRegistryContract(wallet: Wallet)

Parameters:

  • wallet: Wallet

Returns:

Promise<UnsafeContract>

getInstanceRegistryContract

Type: Function

Returns a Contract wrapper for the contract instance registry.

Signature:

export async getInstanceRegistryContract(wallet: Wallet)

Parameters:

  • wallet: Wallet

Returns:

Promise<UnsafeContract>

getFeeJuice

Type: Function

Returns a Contract wrapper for the fee juice contract

Signature:

export async getFeeJuice(wallet: Wallet)

Parameters:

  • wallet: Wallet

Returns:

Promise<UnsafeContract>


contract/sent_tx.ts

WaitOpts

Type: Type Alias

Options related to waiting for a tx.

Signature:

export type WaitOpts = {
ignoreDroppedReceiptsFor?: number;
timeout?: number;
interval?: number;
dontThrowOnRevert?: boolean;
};

Type Members:

ignoreDroppedReceiptsFor

The amount of time to ignore TxStatus.DROPPED receipts (in seconds) due to the presumption that it is being propagated by the p2p network. Defaults to 5.

Type: number

timeout

The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60.

Type: number

interval

The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1.

Type: number

dontThrowOnRevert

Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts.

Type: boolean

DefaultWaitOpts

Type: Constant

Value Type: WaitOpts

SentTx

Type: Class

The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch its hash, receipt, and mining status.

Constructor

Signature:

constructor(
protected walletOrNode: Wallet | AztecNode,
sendTx: () => Promise<TxHash>
)

Parameters:

  • walletOrNode: Wallet | AztecNode
  • sendTx: () => Promise<TxHash>

Properties

sendTxPromise

Type: Promise<void>

sendTxError

Type: Error

txHash

Type: TxHash

Methods

getTxHash

Retrieves the transaction hash of the SentTx instance. The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.

Signature:

public async getTxHash(): Promise<TxHash>

Returns:

Promise<TxHash> - A promise that resolves to the transaction hash of the SentTx instance. TODO(#7717): Don't throw here.

getReceipt

Retrieve the transaction receipt associated with the current SentTx instance. The function fetches the transaction hash using 'getTxHash' and then queries the PXE to get the corresponding transaction receipt.

Signature:

public async getReceipt(): Promise<TxReceipt>

Returns:

Promise<TxReceipt> - A promise that resolves to a TxReceipt object representing the fetched transaction receipt.

wait

Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.

Signature:

public async wait(opts?: WaitOpts): Promise<FieldsOf<TxReceipt>>

Parameters:

  • opts (optional): WaitOpts
    • Options for configuring the waiting for the tx to be mined.

Returns:

Promise<FieldsOf<TxReceipt>> - The transaction receipt.

waitForReceipt

Signature:

protected async waitForReceipt(opts?: WaitOpts): Promise<TxReceipt>

Parameters:

  • opts (optional): WaitOpts

Returns:

Promise<TxReceipt>


contract/unsafe_contract.ts

UnsafeContract

Type: Class

Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet.

Extends: ContractBase

Constructor

Signature:

constructor(
instance: ContractInstanceWithAddress,
artifact: ContractArtifact,
wallet: Wallet
)

Parameters:

  • instance: ContractInstanceWithAddress
    • The deployed contract instance definition.
  • artifact: ContractArtifact
    • The Application Binary Interface for the contract.
  • wallet: Wallet
    • The wallet used for interacting with this contract.

contract/wait_for_proven.ts

WaitForProvenOpts

Type: Type Alias

Options for waiting for a transaction to be proven.

Signature:

export type WaitForProvenOpts = {
provenTimeout?: number;
interval?: number;
};

Type Members:

provenTimeout

Time to wait for the tx to be proven before timing out

Type: number

interval

Elapsed time between polls to the node

Type: number

DefaultWaitForProvenOpts

Type: Constant

Value Type: WaitForProvenOpts

waitForProven

Type: Function

Wait for a transaction to be proven by polling the node

Signature:

export async waitForProven(
node: AztecNode,
receipt: TxReceipt,
opts?: WaitForProvenOpts
)

Parameters:

  • node: AztecNode
  • receipt: TxReceipt
  • opts (optional): WaitForProvenOpts

Returns:

Promise<any>

Deployment


deployment/broadcast_function.ts

broadcastPrivateFunction

Type: Function

Sets up a call to broadcast a private function's bytecode via the ClassRegistry contract. Note that this is not required for users to call the function, but is rather a convenience to make this code publicly available so dapps or wallets do not need to redistribute it.

Signature:

export async broadcastPrivateFunction(
wallet: Wallet,
artifact: ContractArtifact,
selector: FunctionSelector
): Promise<ContractFunctionInteraction>

Parameters:

  • wallet: Wallet
    • Wallet to send the transaction.
  • artifact: ContractArtifact
    • Contract artifact that contains the function to be broadcast.
  • selector: FunctionSelector
    • Selector of the function to be broadcast.

Returns:

Promise<ContractFunctionInteraction> - A ContractFunctionInteraction object that can be used to send the transaction.

broadcastUtilityFunction

Type: Function

Sets up a call to broadcast a utility function's bytecode via the ClassRegistry contract. Note that this is not required for users to call the function, but is rather a convenience to make this code publicly available so dapps or wallets do not need to redistribute it.

Signature:

export async broadcastUtilityFunction(
wallet: Wallet,
artifact: ContractArtifact,
selector: FunctionSelector
): Promise<ContractFunctionInteraction>

Parameters:

  • wallet: Wallet
    • Wallet to send the transaction.
  • artifact: ContractArtifact
    • Contract artifact that contains the function to be broadcast.
  • selector: FunctionSelector
    • Selector of the function to be broadcast.

Returns:

Promise<ContractFunctionInteraction> - A ContractFunctionInteraction object that can be used to send the transaction.


deployment/contract_deployer.ts

ContractDeployer

Type: Class

A class for deploying contract.

Constructor

Signature:

constructor(
private artifact: ContractArtifact,
private wallet: Wallet,
private publicKeys?: PublicKeys,
private constructorName?: string
)

Parameters:

  • artifact: ContractArtifact
  • wallet: Wallet
  • publicKeys (optional): PublicKeys
  • constructorName (optional): string

Methods

deploy

Deploy a contract using the provided ABI and constructor arguments. This function creates a new DeployMethod instance that can be used to send deployment transactions and query deployment status. The method accepts any number of constructor arguments, which will be passed to the contract's constructor during deployment.

Signature:

public deploy(...args: any[])

Parameters:

  • args: any[]
    • The constructor arguments for the contract being deployed.

Returns:

DeployMethod<Contract> - A DeployMethod instance configured with the ABI, PXE, and constructor arguments.


deployment/publish_class.ts

publishContractClass

Type: Function

Sets up a call to publish a contract class given its artifact.

Signature:

export async publishContractClass(
wallet: Wallet,
artifact: ContractArtifact
): Promise<ContractFunctionInteraction>

Parameters:

  • wallet: Wallet
  • artifact: ContractArtifact

Returns:

Promise<ContractFunctionInteraction>


deployment/publish_instance.ts

publishInstance

Type: Function

Sets up a call to the canonical contract instance registry to publish a contract instance.

Signature:

export async publishInstance(
wallet: Wallet,
instance: ContractInstanceWithAddress
): Promise<ContractFunctionInteraction>

Parameters:

  • wallet: Wallet
    • The wallet to use for the publication (setup) tx.
  • instance: ContractInstanceWithAddress
    • The instance to publish.

Returns:

Promise<ContractFunctionInteraction>

Ethereum


ethereum/portal_manager.ts

L2Claim

Type: Type Alias

L1 to L2 message info to claim it on L2.

Signature:

export type L2Claim = {
claimSecret: Fr;
claimSecretHash: Fr;
messageHash: Hex;
messageLeafIndex: bigint;
};

Type Members:

claimSecret

Secret for claiming.

Type: Fr

claimSecretHash

Hash of the secret for claiming.

Type: Fr

messageHash

Hash of the message.

Type: Hex

messageLeafIndex

Leaf index in the L1 to L2 message tree.

Type: bigint

L2AmountClaim

Type: Type Alias

L1 to L2 message info that corresponds to an amount to claim.

Signature:

export type L2AmountClaim = L2Claim & { claimAmount: bigint };

Type Members:

claimAmount

Type: bigint

L2AmountClaimWithRecipient

Type: Type Alias

L1 to L2 message info that corresponds to an amount to claim with associated recipient.

Signature:

export type L2AmountClaimWithRecipient = L2AmountClaim & {
recipient: AztecAddress;
};

Type Members:

recipient

Address that will receive the newly minted notes.

Type: AztecAddress

generateClaimSecret

Type: Function

Generates a pair secret and secret hash

Signature:

export async generateClaimSecret(logger?: Logger): Promise<[
Fr,
Fr
]>

Parameters:

  • logger (optional): Logger

Returns:

Promise<[Fr, Fr]>

L1TokenManager

Type: Class

Helper for managing an ERC20 on L1.

Constructor

Signature:

public constructor(
public readonly tokenAddress: EthAddress,
public readonly handlerAddress: EthAddress | undefined,
private readonly extendedClient: ExtendedViemWalletClient,
private logger: Logger
)

Parameters:

  • tokenAddress: EthAddress
    • Address of the ERC20 contract.
  • handlerAddress: EthAddress | undefined
    • Address of the handler/faucet contract.
  • extendedClient: ExtendedViemWalletClient
  • logger: Logger

Methods

getMintAmount

Returns the amount of tokens available to mint via the handler.

Signature:

public async getMintAmount()

Returns:

Promise<any>

getL1TokenBalance

Returns the balance of the given address.

Signature:

public async getL1TokenBalance(address: Hex)

Parameters:

  • address: Hex
    • Address to get the balance of.

Returns:

Promise<any>

mint

Mints a fixed amount of tokens for the given address. Returns once the tx has been mined.

Signature:

public async mint(
address: Hex,
addressName?: string
)

Parameters:

  • address: Hex
    • Address to mint the tokens for.
  • addressName (optional): string
    • Optional name of the address for logging.

Returns:

Promise<void>

approve

Approves tokens for the given address. Returns once the tx has been mined.

Signature:

public async approve(
amount: bigint,
address: Hex,
addressName = ''
)

Parameters:

  • amount: bigint
    • Amount to approve.
  • address: Hex
    • Address to approve the tokens for.
  • addressName (optional): any
    • Optional name of the address for logging.

Returns:

Promise<void>

L1FeeJuicePortalManager

Type: Class

Helper for interacting with the FeeJuicePortal on L1.

Constructor

Signature:

constructor(
portalAddress: EthAddress,
tokenAddress: EthAddress,
handlerAddress: EthAddress,
private readonly extendedClient: ExtendedViemWalletClient,
private readonly logger: Logger
)

Parameters:

  • portalAddress: EthAddress
  • tokenAddress: EthAddress
  • handlerAddress: EthAddress
  • extendedClient: ExtendedViemWalletClient
  • logger: Logger

Methods

getTokenManager

Returns the associated token manager for the L1 ERC20.

Signature:

public getTokenManager()

Returns:

L1TokenManager

bridgeTokensPublic

Bridges fee juice from L1 to L2 publicly. Handles L1 ERC20 approvals. Returns once the tx has been mined.

Signature:

public async bridgeTokensPublic(
to: AztecAddress,
amount: bigint | undefined,
mint = false
): Promise<L2AmountClaim>

Parameters:

  • to: AztecAddress
    • Address to send the tokens to on L2.
  • amount: bigint | undefined
    • Amount of tokens to send.
  • mint (optional): any
    • Whether to mint the tokens before sending (only during testing).

Returns:

Promise<L2AmountClaim>

new

Creates a new instance

Signature:

public static async new(
node: AztecNode,
extendedClient: ExtendedViemWalletClient,
logger: Logger
): Promise<L1FeeJuicePortalManager>

Parameters:

  • node: AztecNode
    • Aztec node client used for retrieving the L1 contract addresses.
  • extendedClient: ExtendedViemWalletClient
    • Wallet client, extended with public actions.
  • logger: Logger
    • Logger.

Returns:

Promise<L1FeeJuicePortalManager>

L1ToL2TokenPortalManager

Type: Class

Helper for interacting with a test TokenPortal on L1 for sending tokens to L2.

Constructor

Signature:

constructor(
portalAddress: EthAddress,
tokenAddress: EthAddress,
handlerAddress: EthAddress | undefined,
protected extendedClient: ExtendedViemWalletClient,
protected logger: Logger
)

Parameters:

  • portalAddress: EthAddress
  • tokenAddress: EthAddress
  • handlerAddress: EthAddress | undefined
  • extendedClient: ExtendedViemWalletClient
  • logger: Logger

Properties

portal

Type: ViemContract<typeof TokenPortalAbi>

tokenManager

Type: L1TokenManager

Methods

getTokenManager

Returns the token manager for the underlying L1 token.

Signature:

public getTokenManager()

Returns:

L1TokenManager

bridgeTokensPublic

Bridges tokens from L1 to L2. Handles token approvals. Returns once the tx has been mined.

Signature:

public async bridgeTokensPublic(
to: AztecAddress,
amount: bigint,
mint = false
): Promise<L2AmountClaim>

Parameters:

  • to: AztecAddress
    • Address to send the tokens to on L2.
  • amount: bigint
    • Amount of tokens to send.
  • mint (optional): any
    • Whether to mint the tokens before sending (only during testing).

Returns:

Promise<L2AmountClaim>

bridgeTokensPrivate

Bridges tokens from L1 to L2 privately. Handles token approvals. Returns once the tx has been mined.

Signature:

public async bridgeTokensPrivate(
to: AztecAddress,
amount: bigint,
mint = false
): Promise<L2AmountClaimWithRecipient>

Parameters:

  • to: AztecAddress
    • Address to send the tokens to on L2.
  • amount: bigint
    • Amount of tokens to send.
  • mint (optional): any
    • Whether to mint the tokens before sending (only during testing).

Returns:

Promise<L2AmountClaimWithRecipient>

L1TokenPortalManager

Type: Class

Helper for interacting with a test TokenPortal on L1 for both withdrawing from and bridging to L2.

Extends: L1ToL2TokenPortalManager

Constructor

Signature:

constructor(
portalAddress: EthAddress,
tokenAddress: EthAddress,
handlerAddress: EthAddress | undefined,
outboxAddress: EthAddress,
extendedClient: ExtendedViemWalletClient,
logger: Logger
)

Parameters:

  • portalAddress: EthAddress
  • tokenAddress: EthAddress
  • handlerAddress: EthAddress | undefined
  • outboxAddress: EthAddress
  • extendedClient: ExtendedViemWalletClient
  • logger: Logger

Methods

withdrawFunds

Withdraws funds from the portal by consuming an L2 to L1 message. Returns once the tx is mined on L1.

Signature:

public async withdrawFunds(
amount: bigint,
recipient: EthAddress,
blockNumber: bigint,
messageIndex: bigint,
siblingPath: SiblingPath<number>
)

Parameters:

  • amount: bigint
    • Amount to withdraw.
  • recipient: EthAddress
    • Who will receive the funds.
  • blockNumber: bigint
    • L2 block number of the message.
  • messageIndex: bigint
    • Index of the message.
  • siblingPath: SiblingPath<number>
    • Sibling path of the message.

Returns:

Promise<void>

getL2ToL1MessageLeaf

Computes the L2 to L1 message leaf for the given parameters.

Signature:

public async getL2ToL1MessageLeaf(
amount: bigint,
recipient: EthAddress,
l2Bridge: AztecAddress,
callerOnL1: EthAddress = EthAddress.ZERO
): Promise<Fr>

Parameters:

  • amount: bigint
    • Amount to bridge.
  • recipient: EthAddress
    • Recipient on L1.
  • l2Bridge: AztecAddress
    • Address of the L2 bridge.
  • callerOnL1 (optional): EthAddress
    • Caller address on L1.

Returns:

Promise<Fr>

Fee


fee/fee_juice_payment_method_with_claim.ts

FeeJuicePaymentMethodWithClaim

Type: Class

Pay fee directly with Fee Juice claimed in the same tx. Claiming consumes an L1 to L2 message that "contains" the fee juice bridged from L1.

Implements: FeePaymentMethod

Constructor

Signature:

constructor(
private sender: AztecAddress,
private claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>
)

Parameters:

  • sender: AztecAddress
  • claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>

Methods

getExecutionPayload

Creates an execution payload to pay the fee in Fee Juice.

Signature:

async getExecutionPayload(): Promise<ExecutionPayload>

Returns:

Promise<ExecutionPayload> - An execution payload that just contains the claim_and_end_setup function call.

getAsset

Signature:

getAsset()

Returns:

Promise<any>

getFeePayer

Signature:

getFeePayer(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getGasSettings

Signature:

getGasSettings(): GasSettings | undefined

Returns:

GasSettings | undefined


fee/fee_payment_method.ts

FeePaymentMethod

Type: Interface

Holds information about how the fee for a transaction is to be paid.

Methods

getAsset

The asset used to pay the fee.

Signature:

getAsset(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getExecutionPayload

Returns the data to be added to the final execution request to pay the fee in the given asset

Signature:

getExecutionPayload(): Promise<ExecutionPayload>

Returns:

Promise<ExecutionPayload> - The function calls to pay the fee.

getFeePayer

The expected fee payer for this tx.

Signature:

getFeePayer(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getGasSettings

The gas settings (if any) used to compute the execution payload of the payment method

Signature:

getGasSettings(): GasSettings | undefined

Returns:

GasSettings | undefined


fee/private_fee_payment_method.ts

PrivateFeePaymentMethod

Type: Class

Holds information about how the fee for a transaction is to be paid.

Implements: FeePaymentMethod

Constructor

Signature:

constructor(
private paymentContract: AztecAddress,
private sender: AztecAddress,
private wallet: Wallet,
protected gasSettings: GasSettings,
private setMaxFeeToOne = false
)

Parameters:

  • paymentContract: AztecAddress
    • Address which will hold the fee payment.
  • sender: AztecAddress
    • Address of the account that will pay the fee
  • wallet: Wallet
    • A wallet to perform the simulation to get the accepted asset
  • gasSettings: GasSettings
    • Gas settings used to compute the maximum fee the user is willing to pay
  • setMaxFeeToOne (optional): any
    • If true, the max fee will be set to 1. TODO(#7694): Remove this param once the lacking feature in TXE is implemented.

Methods

getAsset

The asset used to pay the fee.

Signature:

async getAsset(): Promise<AztecAddress>

Returns:

Promise<AztecAddress> - The asset used to pay the fee.

getFeePayer

Signature:

getFeePayer(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getExecutionPayload

Creates an execution payload to pay the fee using a private function through an FPC in the desired asset

Signature:

async getExecutionPayload(): Promise<ExecutionPayload>

Returns:

Promise<ExecutionPayload> - An execution payload that contains the required function calls and auth witnesses.

getGasSettings

Signature:

getGasSettings(): GasSettings | undefined

Returns:

GasSettings | undefined


fee/public_fee_payment_method.ts

PublicFeePaymentMethod

Type: Class

Holds information about how the fee for a transaction is to be paid.

Implements: FeePaymentMethod

Constructor

Signature:

constructor(
protected paymentContract: AztecAddress,
protected sender: AztecAddress,
protected wallet: Wallet,
protected gasSettings: GasSettings
)

Parameters:

  • paymentContract: AztecAddress
    • Address which will hold the fee payment.
  • sender: AztecAddress
    • An auth witness provider to authorize fee payments
  • wallet: Wallet
    • A wallet to perform the simulation to get the accepted asset
  • gasSettings: GasSettings
    • Gas settings used to compute the maximum fee the user is willing to pay

Methods

getAsset

The asset used to pay the fee.

Signature:

async getAsset(): Promise<AztecAddress>

Returns:

Promise<AztecAddress> - The asset used to pay the fee.

getFeePayer

Signature:

getFeePayer(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getExecutionPayload

Creates an execution payload to pay the fee using a public function through an FPC in the desired asset

Signature:

async getExecutionPayload(): Promise<ExecutionPayload>

Returns:

Promise<ExecutionPayload> - An execution payload that contains the required function calls.

getGasSettings

Signature:

getGasSettings(): GasSettings | undefined

Returns:

GasSettings | undefined


fee/sponsored_fee_payment.ts

SponsoredFeePaymentMethod

Type: Class

A fee payment method that uses a contract that blindly sponsors transactions. This contract is expected to be prefunded in testing environments.

Implements: FeePaymentMethod

Constructor

Signature:

constructor(private paymentContract: AztecAddress)

Parameters:

  • paymentContract: AztecAddress

Methods

getAsset

Signature:

getAsset(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getFeePayer

Signature:

getFeePayer()

Returns:

Promise<any>

getExecutionPayload

Signature:

async getExecutionPayload(): Promise<ExecutionPayload>

Returns:

Promise<ExecutionPayload>

getGasSettings

Signature:

getGasSettings(): GasSettings | undefined

Returns:

GasSettings | undefined

Utils


utils/abi_types.ts

FieldLike

Type: Type Alias

Any type that can be converted into a field for a contract call.

Signature:

export type FieldLike = Fr | Buffer | bigint | number | { toField: () => Fr };

EthAddressLike

Type: Type Alias

Any type that can be converted into an EthAddress Aztec.nr struct.

Signature:

export type EthAddressLike = { address: FieldLike } | EthAddress;

AztecAddressLike

Type: Type Alias

Any type that can be converted into an AztecAddress Aztec.nr struct.

Signature:

export type AztecAddressLike = { address: FieldLike } | AztecAddress;

FunctionSelectorLike

Type: Type Alias

Any type that can be converted into a FunctionSelector Aztec.nr struct.

Signature:

export type FunctionSelectorLike = FieldLike | FunctionSelector;

EventSelectorLike

Type: Type Alias

Any type that can be converted into an EventSelector Aztec.nr struct.

Signature:

export type EventSelectorLike = FieldLike | EventSelector;

U128Like

Type: Type Alias

Any type that can be converted into a U128.

Signature:

export type U128Like = bigint | number;

WrappedFieldLike

Type: Type Alias

Any type that can be converted into a struct with a single inner field.

Signature:

export type WrappedFieldLike = { inner: FieldLike } | FieldLike;

utils/authwit.ts

IntentInnerHash

Type: Type Alias

Intent with an inner hash

Signature:

export type IntentInnerHash = {
consumer: AztecAddress;
innerHash: Buffer<ArrayBuffer> | Fr;
};

Type Members:

consumer

The consumer

Type: AztecAddress

innerHash

The action to approve

Type: Buffer<ArrayBuffer> | Fr

CallIntent

Type: Type Alias

Intent with a call

Signature:

export type CallIntent = {
caller: AztecAddress;
call: FunctionCall;
};

Type Members:

caller

The caller to approve

Type: AztecAddress

call

The call to approve

Type: FunctionCall

ContractFunctionInteractionCallIntent

Type: Type Alias

Intent with a ContractFunctionInteraction

Signature:

export type ContractFunctionInteractionCallIntent = {
caller: AztecAddress;
action: ContractFunctionInteraction;
};

Type Members:

caller

The caller to approve

Type: AztecAddress

action

The action to approve

Type: ContractFunctionInteraction

computeAuthWitMessageHash

Type: Constant

Compute an authentication witness message hash from an intent and metadata If using the IntentInnerHash, the consumer is the address that can "consume" the authwit, for token approvals it is the token contract itself. The innerHash itself will be the message that a contract is allowed to execute. At the point of "approval checking", the validating contract (account for private and registry for public) will be computing the message hash (H(consumer, chainid, version, inner_hash)) where the all but the inner_hash is injected from the context (consumer = msg_sender), and use it for the authentication check. Therefore, any allowed innerHash will therefore also have information around where it can be spent (version, chainId) and who can spend it (consumer). If using the CallIntent, the caller is the address that is making the call, for a token approval from Alice to Bob, this would be Bob. The action is then used along with the caller to compute the innerHash and the consumer.

Value Type: any

getMessageHashFromIntent

Type: Function

Compute an authentication witness message hash from an intent and metadata. This is just a wrapper around computeAuthwitMessageHash that allows receiving an already computed messageHash as input

Signature:

export async getMessageHashFromIntent(
messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
chainInfo: ChainInfo
)

Parameters:

  • messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent
    • The precomputed messageHash or intent to approve (consumer and innerHash or caller and call/action)
  • chainInfo: ChainInfo

Returns:

Promise<Fr> - The message hash for the intent

computeInnerAuthWitHashFromAction

Type: Constant

Computes the inner authwitness hash for either a function call or an action, for it to later be combined with the metadata required for the outer hash and eventually the full AuthWitness.

Value Type: any

lookupValidity

Type: Function

Lookup the validity of an authwit in private and public contexts. Uses the chain id and version of the wallet.

Signature:

export async lookupValidity(
wallet: Wallet,
onBehalfOf: AztecAddress,
intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
witness: AuthWitness
): Promise<{
isValidInPrivate: boolean;
isValidInPublic: boolean;
}>

Parameters:

  • wallet: Wallet
    • The wallet use to simulate and read the public data
  • onBehalfOf: AztecAddress
    • The address of the "approver"
  • intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent
    • The consumer and inner hash or the caller and action to lookup
  • witness: AuthWitness
    • The computed authentication witness to check

Returns:

Promise<{
/** boolean flag indicating if the authwit is valid in private context */
isValidInPrivate: boolean;
/** boolean flag indicating if the authwit is valid in public context */
isValidInPublic: boolean;
}>

A struct containing the validity of the authwit in private and public contexts.

SetPublicAuthwitContractInteraction

Type: Class

Convenience class designed to wrap the very common interaction of setting a public authwit in the AuthRegistry contract

Extends: ContractFunctionInteraction

Constructor

Signature:

private constructor(
wallet: Wallet,
private from: AztecAddress,
messageHash: Fr,
authorized: boolean
)

Parameters:

  • wallet: Wallet
  • from: AztecAddress
  • messageHash: Fr
  • authorized: boolean

Methods

create

Signature:

static async create(
wallet: Wallet,
from: AztecAddress,
messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
authorized: boolean
)

Parameters:

  • wallet: Wallet
  • from: AztecAddress
  • messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent
  • authorized: boolean

Returns:

Promise<SetPublicAuthwitContractInteraction>

simulate

Overrides the simulate method, adding the sender of the authwit (authorizer) as from and preventing misuse

Signature:

public override simulate<T extends SimulateInteractionOptions>(options: Omit<T, 'from'>): Promise<SimulationReturn<T['includeMetadata']>>

Parameters:

  • options: Omit<T, 'from'>
    • An optional object containing additional configuration for the transaction.

Returns:

Promise<SimulationReturn<T['includeMetadata']>> - The result of the transaction as returned by the contract function.

simulate

Signature:

public override simulate(options: Omit<SimulateInteractionOptions, 'from'> = {}): Promise<SimulationReturn<typeof options.includeMetadata>>

Parameters:

  • options (optional): Omit<SimulateInteractionOptions, 'from'>

Returns:

Promise<SimulationReturn<typeof options.includeMetadata>>

profile

Overrides the profile method, adding the sender of the authwit (authorizer) as from and preventing misuse

Signature:

public override profile(options: Omit<ProfileInteractionOptions, 'from'> = { profileMode: 'gates' }): Promise<TxProfileResult>

Parameters:

  • options (optional): Omit<ProfileInteractionOptions, 'from'>
    • Same options as simulate, plus profiling method

Returns:

Promise<TxProfileResult> - An object containing the function return value and profile result.

send

Overrides the send method, adding the sender of the authwit (authorizer) as from and preventing misuse

Signature:

public override send(options: Omit<SendInteractionOptions, 'from'> = {}): SentTx

Parameters:

  • options (optional): Omit<SendInteractionOptions, 'from'>
    • An optional object containing 'fee' options information

Returns:

SentTx - A SentTx instance for tracking the transaction status and information.


utils/cross_chain.ts

waitForL1ToL2MessageReady

Type: Function

Waits for the L1 to L2 message to be ready to be consumed.

Signature:

export async waitForL1ToL2MessageReady(
node: Pick<AztecNode, 'getBlockNumber' | 'getL1ToL2MessageBlock'>,
l1ToL2MessageHash: Fr,
opts: {
timeoutSeconds: number;
forPublicConsumption: boolean;
}
)

Parameters:

  • node: Pick<AztecNode, 'getBlockNumber' | 'getL1ToL2MessageBlock'>
    • Aztec node instance used to obtain the information about the message
  • l1ToL2MessageHash: Fr
    • Hash of the L1 to L2 message
  • opts: { /** Timeout for the operation in seconds */ timeoutSeconds: number; /** True if the message is meant to be consumed from a public function */ forPublicConsumption: boolean; }
    • Options

Returns:

Promise<any>

isL1ToL2MessageReady

Type: Function

Returns whether the L1 to L2 message is ready to be consumed.

Signature:

export async isL1ToL2MessageReady(
node: Pick<AztecNode, 'getBlockNumber' | 'getL1ToL2MessageBlock'>,
l1ToL2MessageHash: Fr,
opts: {
forPublicConsumption: boolean;
messageBlockNumber?: number;
}
): Promise<boolean>

Parameters:

  • node: Pick<AztecNode, 'getBlockNumber' | 'getL1ToL2MessageBlock'>
    • Aztec node instance used to obtain the information about the message
  • l1ToL2MessageHash: Fr
    • Hash of the L1 to L2 message
  • opts: { /** True if the message is meant to be consumed from a public function */ forPublicConsumption: boolean; /** Cached synced block number for the message (will be fetched from PXE otherwise) */ messageBlockNumber?: number; }
    • Options

Returns:

Promise<boolean> - True if the message is ready to be consumed, false otherwise


utils/fee_juice.ts

getFeeJuiceBalance

Type: Function

Returns the owner's fee juice balance. Note: This is used only e2e_sandbox_example test. TODO: Consider nuking.

Signature:

export async getFeeJuiceBalance(
owner: AztecAddress,
node: AztecNode
): Promise<bigint>

Parameters:

  • owner: AztecAddress
  • node: AztecNode

Returns:

Promise<bigint>


utils/field_compressed_string.ts

readFieldCompressedString

Type: Constant

This turns

Value Type: any


utils/node.ts

waitForNode

Type: Constant

Value Type: any

createAztecNodeClient

Type: Constant

This is re-exported from @aztec/stdlib/interfaces/client. See the source module for full documentation.

Value Type: Re-export

AztecNode

Type: Type Alias

This is a type re-exported from @aztec/stdlib/interfaces/client. See the source module for full type definition and documentation.

Signature:

export type { AztecNode } from '@aztec/stdlib/interfaces/client'

utils/pub_key.ts

generatePublicKey

Type: Function

Method for generating a public grumpkin key from a private key.

Signature:

export generatePublicKey(privateKey: GrumpkinScalar): Promise<PublicKey>

Parameters:

  • privateKey: GrumpkinScalar
    • The private key.

Returns:

Promise<PublicKey> - The generated public key.

Wallet


wallet/account_entrypoint_meta_payment_method.ts

AccountEntrypointMetaPaymentMethod

Type: Class

Fee payment method that allows an account contract to pay for its own deployment It works by rerouting the provided fee payment method through the account's entrypoint, which sets itself as fee payer. If no payment method is provided, it is assumed the account will pay with its own fee juice balance. Usually, in order to pay fees it is necessary to obtain an ExecutionPayload that encodes the necessary information that is sent to the user's account entrypoint, that has plumbing to handle it. If there's no account contract yet (it's being deployed) a MultiCallContract is used, which doesn't have a concept of fees or how to handle this payload. HOWEVER, the account contract's entrypoint does, so this method reshapes that fee payload into a call to the account contract entrypoint being deployed with the original fee payload. This class can be seen in action in DeployAccountMethod.ts#getSelfPaymentMethod

Implements: FeePaymentMethod

Constructor

Signature:

constructor(
private wallet: Wallet,
private artifact: ContractArtifact,
private feePaymentNameOrArtifact: string | FunctionArtifact,
private accountAddress: AztecAddress,
private paymentMethod?: FeePaymentMethod
)

Parameters:

  • wallet: Wallet
  • artifact: ContractArtifact
  • feePaymentNameOrArtifact: string | FunctionArtifact
  • accountAddress: AztecAddress
  • paymentMethod (optional): FeePaymentMethod

Methods

getAsset

Signature:

getAsset(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getExecutionPayload

Signature:

async getExecutionPayload(): Promise<ExecutionPayload>

Returns:

Promise<ExecutionPayload>

getFeePayer

Signature:

getFeePayer(): Promise<AztecAddress>

Returns:

Promise<AztecAddress>

getGasSettings

Signature:

getGasSettings(): GasSettings | undefined

Returns:

GasSettings | undefined


wallet/account_manager.ts

AccountManager

Type: Class

Manages a user account. Provides methods for calculating the account's address and other related data, plus a helper to return a preconfigured deploy method.

Constructor

Signature:

private constructor(
private wallet: Wallet,
private secretKey: Fr,
private accountContract: AccountContract,
private instance: ContractInstanceWithAddress,
public readonly salt: Salt
)

Parameters:

  • wallet: Wallet
  • secretKey: Fr
  • accountContract: AccountContract
  • instance: ContractInstanceWithAddress
  • salt: Salt
    • Contract instantiation salt for the account contract

Methods

create

Signature:

static async create(
wallet: Wallet,
secretKey: Fr,
accountContract: AccountContract,
salt?: Salt
)

Parameters:

  • wallet: Wallet
  • secretKey: Fr
  • accountContract: AccountContract
  • salt (optional): Salt

Returns:

Promise<AccountManager>

getPublicKeys

Signature:

protected getPublicKeys()

Returns:

any

getPublicKeysHash

Signature:

protected getPublicKeysHash()

Returns:

any

getAccountInterface

Returns the entrypoint for this account as defined by its account contract.

Signature:

public async getAccountInterface(): Promise<AccountInterface>

Returns:

Promise<AccountInterface> - An entrypoint.

getCompleteAddress

Gets the calculated complete address associated with this account. Does not require the account to have been published for public execution.

Signature:

public getCompleteAddress(): Promise<CompleteAddress>

Returns:

Promise<CompleteAddress> - The address, partial address, and encryption public key.

getSecretKey

Returns the secret key used to derive the rest of the privacy keys for this contract

Signature:

public getSecretKey()

Returns:

Fr

getInstance

Returns the contract instance definition associated with this account. Does not require the account to have been published for public execution.

Signature:

public getInstance(): ContractInstanceWithAddress

Returns:

ContractInstanceWithAddress - ContractInstance instance.

getAccount

Returns a Wallet instance associated with this account. Use it to create Contract instances to be interacted with from this account.

Signature:

public async getAccount(): Promise<AccountWithSecretKey>

Returns:

Promise<AccountWithSecretKey> - A Wallet instance.

getAccountContract

Returns the account contract that backs this account.

Signature:

getAccountContract(): AccountContract

Returns:

AccountContract - The account contract

getDeployMethod

Returns a preconfigured deploy method that contains all the necessary function calls to deploy the account contract.

Signature:

public async getDeployMethod(): Promise<DeployAccountMethod>

Returns:

Promise<DeployAccountMethod>

hasInitializer

Returns whether this account contract has an initializer function.

Signature:

public async hasInitializer()

Returns:

Promise<boolean>

Getters

address (getter)

Signature:

get address() {

Returns: any


wallet/base_wallet.ts

FeeOptions

Type: Type Alias

Options to configure fee payment for a transaction

Signature:

export type FeeOptions = {
walletFeePaymentMethod?: FeePaymentMethod;
accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
gasSettings: GasSettings;
};

Type Members:

walletFeePaymentMethod

A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed doesn't already include one

Type: FeePaymentMethod

accountFeePaymentMethodOptions

Configuration options for the account to properly handle the selected fee payment method

Type: AccountFeePaymentMethodOptions

gasSettings

The gas settings to use for the transaction

Type: GasSettings

BaseWallet

Type: Class

A base class for Wallet implementations

Implements: Wallet

Constructor

Signature:

protected constructor(
protected readonly pxe: any,
protected readonly aztecNode: AztecNode
)

Parameters:

  • pxe: any
  • aztecNode: AztecNode

Properties

log

Type: any

baseFeePadding

Type: any

cancellableTransactions

Type: any

Methods

getAccountFromAddress

Signature:

protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>

Parameters:

  • address: AztecAddress

Returns:

Promise<Account>

getAccounts

Signature:

abstract getAccounts(): Promise<Aliased<AztecAddress>[]>

Returns:

Promise<Aliased<AztecAddress>[]>

getAddressBook

Returns the list of aliased contacts associated with the wallet. This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders. - Senders: Addresses we check during synching in case they sent us notes, - Contacts: more general concept akin to a phone's contact list.

Signature:

async getAddressBook(): Promise<Aliased<AztecAddress>[]>

Returns:

Promise<Aliased<AztecAddress>[]> - The aliased collection of AztecAddresses that form this wallet's address book

getChainInfo

Signature:

async getChainInfo(): Promise<ChainInfo>

Returns:

Promise<ChainInfo>

createTxExecutionRequestFromPayloadAndFee

Signature:

protected async createTxExecutionRequestFromPayloadAndFee(
executionPayload: ExecutionPayload,
from: AztecAddress,
feeOptions: FeeOptions
): Promise<TxExecutionRequest>

Parameters:

  • executionPayload: ExecutionPayload
  • from: AztecAddress
  • feeOptions: FeeOptions

Returns:

Promise<TxExecutionRequest>

createAuthWit

Signature:

public async createAuthWit(
from: AztecAddress,
messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent
): Promise<AuthWitness>

Parameters:

  • from: AztecAddress
  • messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent

Returns:

Promise<AuthWitness>

batch

Signature:

public async batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>

Parameters:

  • methods: T

Returns:

Promise<BatchResults<T>>

getDefaultFeeOptions

Returns default values for the transaction fee options if they were omitted by the user.

Signature:

protected async getDefaultFeeOptions(
from: AztecAddress,
userFeeOptions?: UserFeeOptions
): Promise<FeeOptions>

Parameters:

  • from: AztecAddress
    • The address where the transaction is being sent from
  • userFeeOptions (optional): UserFeeOptions
    • User-provided fee options, which might be incomplete

Returns:

Promise<FeeOptions> - Populated fee options that can be used to create a transaction execution request

getFeeOptionsForGasEstimation

Returns unreasonably high gas limits in order to execute a simulation with the goal of estimating its gas cost. It will otherwise try to respect the user-specified fee options, filling the gaps with default values as needed.

Signature:

protected async getFeeOptionsForGasEstimation(
from: AztecAddress,
userFeeOptions?: UserFeeOptions
)

Parameters:

  • from: AztecAddress
    • The address where the transaction is being sent from
  • userFeeOptions (optional): UserFeeOptions
    • User-provided fee options to use as a basis for the fully populated FeeOptions type.

Returns:

Promise<{ gasSettings: any; walletFeePaymentMethod?: FeePaymentMethod | undefined; accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions; }>

registerSender

Signature:

registerSender(
address: AztecAddress,
_alias: string = ''
): Promise<AztecAddress>

Parameters:

  • address: AztecAddress
  • _alias (optional): string

Returns:

Promise<AztecAddress>

registerContract

Signature:

async registerContract(
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
artifact?: ContractArtifact,
secretKey?: Fr
): Promise<ContractInstanceWithAddress>

Parameters:

  • instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact
  • artifact (optional): ContractArtifact
  • secretKey (optional): Fr

Returns:

Promise<ContractInstanceWithAddress>

simulateTx

Signature:

async simulateTx(
executionPayload: ExecutionPayload,
opts: SimulateOptions
): Promise<TxSimulationResult>

Parameters:

  • executionPayload: ExecutionPayload
  • opts: SimulateOptions

Returns:

Promise<TxSimulationResult>

profileTx

Signature:

async profileTx(
executionPayload: ExecutionPayload,
opts: ProfileOptions
): Promise<TxProfileResult>

Parameters:

  • executionPayload: ExecutionPayload
  • opts: ProfileOptions

Returns:

Promise<TxProfileResult>

sendTx

Signature:

async sendTx(
executionPayload: ExecutionPayload,
opts: SendOptions
): Promise<TxHash>

Parameters:

  • executionPayload: ExecutionPayload
  • opts: SendOptions

Returns:

Promise<TxHash>

contextualizeError

Signature:

protected contextualizeError(
err: Error,
...context: string[]
): Error

Parameters:

  • err: Error
  • context: string[]

Returns:

Error

simulateUtility

Signature:

simulateUtility(
functionName: string,
args: any[],
to: AztecAddress,
authwits?: AuthWitness[],
from?: AztecAddress
): Promise<UtilitySimulationResult>

Parameters:

  • functionName: string
  • args: any[]
  • to: AztecAddress
  • authwits (optional): AuthWitness[]
  • from (optional): AztecAddress

Returns:

Promise<UtilitySimulationResult>

getContractClassMetadata

Signature:

getContractClassMetadata(
id: Fr,
includeArtifact: boolean = false
): Promise<ContractClassMetadata>

Parameters:

  • id: Fr
  • includeArtifact (optional): boolean

Returns:

Promise<ContractClassMetadata>

getContractMetadata

Signature:

getContractMetadata(address: AztecAddress): Promise<ContractMetadata>

Parameters:

  • address: AztecAddress

Returns:

Promise<ContractMetadata>

getTxReceipt

Signature:

getTxReceipt(txHash: TxHash): Promise<TxReceipt>

Parameters:

  • txHash: TxHash

Returns:

Promise<TxReceipt>

getPrivateEvents

Signature:

getPrivateEvents<T>(
contractAddress: AztecAddress,
event: EventMetadataDefinition,
from: number,
limit: number,
recipients: AztecAddress[] = []
): Promise<T[]>

Parameters:

  • contractAddress: AztecAddress
  • event: EventMetadataDefinition
  • from: number
  • limit: number
  • recipients (optional): AztecAddress[]

Returns:

Promise<T[]>


wallet/deploy_account_method.ts

RequestDeployAccountOptions

Type: Type Alias

The configuration options for the request method. Omits the contractAddressSalt, since for account contracts that is fixed in the constructor

Signature:

export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt'>;

DeployAccountOptions

Type: Type Alias

The configuration options for the send/prove methods. Omits: - The contractAddressSalt, since for account contracts that is fixed in the constructor. - UniversalDeployment flag, since account contracts are always deployed with it set to true

Signature:

export type DeployAccountOptions = Omit<DeployOptions, 'contractAddressSalt' | 'universalDeploy'>;

SimulateDeployAccountOptions

Type: Type Alias

The configuration options for the simulate method. Omits the contractAddressSalt, since for account contracts that is fixed in the constructor

Signature:

export type SimulateDeployAccountOptions = Omit<SimulateDeployOptions, 'contractAddressSalt'>;

DeployAccountMethod

Type: Class

Modified version of the DeployMethod used to deploy account contracts. Supports deploying contracts that can pay for their own fee, plus some preconfigured options to avoid errors.

Extends: DeployMethod

Constructor

Signature:

constructor(
publicKeys: PublicKeys,
wallet: Wallet,
artifact: ContractArtifact,
postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
private salt: Fr,
args: any[] = [],
constructorNameOrArtifact?: string | FunctionArtifact
)

Parameters:

  • publicKeys: PublicKeys
  • wallet: Wallet
  • artifact: ContractArtifact
  • postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>
  • salt: Fr
  • args (optional): any[]
  • constructorNameOrArtifact (optional): string | FunctionArtifact

Methods

request

Returns the execution payload that allows this operation to happen on chain.

Signature:

public override async request(opts?: RequestDeployAccountOptions): Promise<ExecutionPayload>

Parameters:

  • opts (optional): RequestDeployAccountOptions
    • Configuration options.

Returns:

Promise<ExecutionPayload> - The execution payload for this operation

convertDeployOptionsToRequestOptions

Signature:

override convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions

Parameters:

  • options: DeployOptions

Returns:

RequestDeployOptions


wallet/wallet.ts

Aliased

Type: Type Alias

A wrapper type that allows any item to be associated with an alias.

Signature:

export type Aliased<T> = {
alias: string;
item: T;
};

Type Members:

alias

The alias

Type: string

item

The item being aliased.

Type: T

ContractInstanceAndArtifact

Type: Type Alias

A reduced representation of a Contract, only including its instance and artifact

Signature:

export type ContractInstanceAndArtifact = Pick<Contract, 'artifact' | 'instance'>;

UserFeeOptions

Type: Type Alias

Options that can be provided to the wallet for configuration of the fee payment.

Signature:

export type UserFeeOptions = {
embeddedPaymentMethodFeePayer?: AztecAddress;
} & GasSettingsOption;

Type Members:

embeddedPaymentMethodFeePayer

Informs the wallet that the crafted tx already contains the necessary calls to pay for its fee and who is paying

Type: AztecAddress

SimulateOptions

Type: Type Alias

Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with a simplified version that only hints at the wallet wether the interaction contains a fee payment method or not

Signature:

export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
fee?: UserFeeOptions & FeeEstimationOptions;
};

Type Members:

fee

The fee options

Type: UserFeeOptions & FeeEstimationOptions

ProfileOptions

Type: Type Alias

Options for profiling interactions with the wallet. Overrides the fee settings of an interaction with a simplified version that only hints at the wallet wether the interaction contains a fee payment method or not

Signature:

export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
fee?: UserFeeOptions;
};

Type Members:

fee

The fee options

Type: UserFeeOptions

SendOptions

Type: Type Alias

Options for sending/proving interactions with the wallet. Overrides the fee settings of an interaction with a simplified version that only hints at the wallet wether the interaction contains a fee payment method or not

Signature:

export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
fee?: UserFeeOptions;
};

Type Members:

fee

The fee options

Type: UserFeeOptions

BatchableMethods

Type: Type Alias

Helper type that represents all methods that can be batched.

Signature:

export type BatchableMethods = Pick<Wallet, 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility'>;

BatchedMethod

Type: Type Alias

From the batchable methods, we create a type that represents a method call with its name and arguments. This is what the wallet will accept as arguments to the batch method.

Signature:

export type BatchedMethod<T extends keyof BatchableMethods> = {
name: T;
args: Parameters<BatchableMethods[T]>;
};

Type Members:

name

The method name

Type: T

args

The method arguments

Type: Parameters<BatchableMethods[T]>

BatchedMethodResult

Type: Type Alias

Helper type to extract the return type of a batched method

Signature:

export type BatchedMethodResult<T> =
T extends BatchedMethod<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;

BatchedMethodResultWrapper

Type: Type Alias

Wrapper type for batch results that includes the method name for discriminated union deserialization. Each result is wrapped as { name: 'methodName', result: ActualResult } to allow proper deserialization when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).

Signature:

export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMethods>> = {
name: T['name'];
result: BatchedMethodResult<T>;
};

Type Members:

name

The method name

Type: T['name']

result

The method result

Type: BatchedMethodResult<T>

BatchResults

Type: Type Alias

Maps a tuple of BatchedMethod to a tuple of their wrapped return types

Signature:

export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods>[]> = {
[K in keyof T]: BatchedMethodResultWrapper<T[K]>;
};

Type Members:

[K in keyof T]

Signature: [K in keyof T]: BatchedMethodResultWrapper<T[K]>

Key Type: keyof T

Value Type: BatchedMethodResultWrapper<T[K]>

Wallet

Type: Type Alias

The wallet interface.

Signature:

export type Wallet = {
getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
getPrivateEvents<T>(
contractAddress: AztecAddress,
eventMetadata: EventMetadataDefinition,
from: number,
numBlocks: number,
recipients: AztecAddress[],
): Promise<T[]>;
getChainInfo(): Promise<ChainInfo>;
getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
getAddressBook(): Promise<Aliased<AztecAddress>[]>;
getAccounts(): Promise<Aliased<AztecAddress>[]>;
registerContract(
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
): Promise<ContractInstanceWithAddress>;
// Overloaded definition to avoid zod issues
registerContract(
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
artifact: ContractArtifact,
): Promise<ContractInstanceWithAddress>;
registerContract(
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
artifact: ContractArtifact | undefined,
secretKey: Fr | undefined,
): Promise<ContractInstanceWithAddress>;
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
simulateUtility(
functionName: string,
args: any[],
to: AztecAddress,
authwits?: AuthWitness[],
): Promise<UtilitySimulationResult>;
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
createAuthWit(
from: AztecAddress,
messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent,
): Promise<AuthWitness>;
batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
};

Type Members:

getContractClassMetadata

Signature:

getContractClassMetadata(
id: Fr,
includeArtifact?: boolean
): Promise<ContractClassMetadata>

Parameters:

  • id: Fr
  • includeArtifact (optional): boolean

Returns:

Promise<ContractClassMetadata>

getContractMetadata

Signature:

getContractMetadata(address: AztecAddress): Promise<ContractMetadata>

Parameters:

  • address: AztecAddress

Returns:

Promise<ContractMetadata>

getPrivateEvents

Signature:

getPrivateEvents<T>(
contractAddress: AztecAddress,
eventMetadata: EventMetadataDefinition,
from: number,
numBlocks: number,
recipients: AztecAddress[]
): Promise<T[]>

Parameters:

  • contractAddress: AztecAddress
  • eventMetadata: EventMetadataDefinition
  • from: number
  • numBlocks: number
  • recipients: AztecAddress[]

Returns:

Promise<T[]>

getChainInfo

Signature:

getChainInfo(): Promise<ChainInfo>

Returns:

Promise<ChainInfo>

getTxReceipt

Signature:

getTxReceipt(txHash: TxHash): Promise<TxReceipt>

Parameters:

  • txHash: TxHash

Returns:

Promise<TxReceipt>

registerSender

Signature:

registerSender(
address: AztecAddress,
alias?: string
): Promise<AztecAddress>

Parameters:

  • address: AztecAddress
  • alias (optional): string

Returns:

Promise<AztecAddress>

getAddressBook

Signature:

getAddressBook(): Promise<Aliased<AztecAddress>[]>

Returns:

Promise<Aliased<AztecAddress>[]>

getAccounts

Signature:

getAccounts(): Promise<Aliased<AztecAddress>[]>

Returns:

Promise<Aliased<AztecAddress>[]>

registerContract

Signature:

registerContract(instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact): Promise<ContractInstanceWithAddress>

Parameters:

  • instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact

Returns:

Promise<ContractInstanceWithAddress>

registerContract

Signature:

registerContract(
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
artifact: ContractArtifact
): Promise<ContractInstanceWithAddress>

Parameters:

  • instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact
  • artifact: ContractArtifact

Returns:

Promise<ContractInstanceWithAddress>

registerContract

Signature:

registerContract(
instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
artifact: ContractArtifact | undefined,
secretKey: Fr | undefined
): Promise<ContractInstanceWithAddress>

Parameters:

  • instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact
  • artifact: ContractArtifact | undefined
  • secretKey: Fr | undefined

Returns:

Promise<ContractInstanceWithAddress>

simulateTx

Signature:

simulateTx(
exec: ExecutionPayload,
opts: SimulateOptions
): Promise<TxSimulationResult>

Parameters:

  • exec: ExecutionPayload
  • opts: SimulateOptions

Returns:

Promise<TxSimulationResult>

simulateUtility

Signature:

simulateUtility(
functionName: string,
args: any[],
to: AztecAddress,
authwits?: AuthWitness[]
): Promise<UtilitySimulationResult>

Parameters:

  • functionName: string
  • args: any[]
  • to: AztecAddress
  • authwits (optional): AuthWitness[]

Returns:

Promise<UtilitySimulationResult>

profileTx

Signature:

profileTx(
exec: ExecutionPayload,
opts: ProfileOptions
): Promise<TxProfileResult>

Parameters:

  • exec: ExecutionPayload
  • opts: ProfileOptions

Returns:

Promise<TxProfileResult>

sendTx

Signature:

sendTx(
exec: ExecutionPayload,
opts: SendOptions
): Promise<TxHash>

Parameters:

  • exec: ExecutionPayload
  • opts: SendOptions

Returns:

Promise<TxHash>

createAuthWit

Signature:

createAuthWit(
from: AztecAddress,
messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent
): Promise<AuthWitness>

Parameters:

  • from: AztecAddress
  • messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent

Returns:

Promise<AuthWitness>

batch

Signature:

batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>

Parameters:

  • methods: T

Returns:

Promise<BatchResults<T>>

ContractInstantiationDataSchema

Type: Constant

Value Type: any

FunctionCallSchema

Type: Constant

Value Type: any

ExecutionPayloadSchema

Type: Constant

Value Type: any

UserFeeOptionsSchema

Type: Constant

Value Type: any

WalletSimulationFeeOptionSchema

Type: Constant

Value Type: any

SendOptionsSchema

Type: Constant

Value Type: any

SimulateOptionsSchema

Type: Constant

Value Type: any

ProfileOptionsSchema

Type: Constant

Value Type: any

InstanceDataSchema

Type: Constant

Value Type: any

MessageHashOrIntentSchema

Type: Constant

Value Type: any

BatchedMethodSchema

Type: Constant

Value Type: any

ContractMetadataSchema

Type: Constant

Value Type: any

ContractClassMetadataSchema

Type: Constant

Value Type: any

EventMetadataDefinitionSchema

Type: Constant

Value Type: any

WalletSchema

Type: Constant

Value Type: ApiSchemaFor<Wallet>