Reference
This documentation is auto-generated from the Aztec.js TypeScript source code.
This is an auto-generated reference. For tutorials and guides, see the Aztec.js Guide.
Package: @aztec/aztec.js
Generated: 2025-12-10T22:27:41.987Z
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
- Authorization
- Contract
- BaseContractInteraction
- BatchCall
- abiChecker
- ContractMethod
- ContractStorageLayout
- ContractBase
- ContractFunctionInteraction
- Contract
- RequestDeployOptions
- DeployOptions
- SimulateDeployOptions
- DeployMethod
- DeployedWaitOpts
- DeployTxReceipt
- DeploySentTx
- getGasLimits
- FeeEstimationOptions
- FeePaymentMethodOption
- GasSettingsOption
- InteractionFeeOptions
- SimulationInteractionFeeOptions
- RequestInteractionOptions
- SendInteractionOptions
- SimulateInteractionOptions
- ProfileInteractionOptions
- SimulationReturn
- toSendOptions
- toSimulateOptions
- toProfileOptions
- getClassRegistryContract
- getInstanceRegistryContract
- getFeeJuice
- WaitOpts
- DefaultWaitOpts
- SentTx
- UnsafeContract
- WaitForProvenOpts
- DefaultWaitForProvenOpts
- waitForProven
- Deployment
- Ethereum
- Fee
- Utils
- FieldLike
- EthAddressLike
- AztecAddressLike
- FunctionSelectorLike
- EventSelectorLike
- U128Like
- WrappedFieldLike
- IntentInnerHash
- CallIntent
- ContractFunctionInteractionCallIntent
- computeAuthWitMessageHash
- getMessageHashFromIntent
- computeInnerAuthWitHashFromAction
- lookupValidity
- SetPublicAuthwitContractInteraction
- waitForL1ToL2MessageReady
- isL1ToL2MessageReady
- getFeeJuiceBalance
- readFieldCompressedString
- waitForNode
- createAztecNodeClient
- AztecNode
- generatePublicKey
- Wallet
- AccountEntrypointMetaPaymentMethod
- AccountManager
- RequestDeployAccountOptions
- DeployAccountOptions
- SimulateDeployAccountOptions
- DeployAccountMethod
- Aliased
- SimulateOptions
- ProfileOptions
- SendOptions
- BatchableMethods
- BatchedMethod
- BatchedMethodResult
- BatchedMethodResultWrapper
- BatchResults
- PrivateEventFilter
- PrivateEvent
- Wallet
- FunctionCallSchema
- ExecutionPayloadSchema
- GasSettingsOptionSchema
- WalletSimulationFeeOptionSchema
- SendOptionsSchema
- SimulateOptionsSchema
- ProfileOptionsSchema
- MessageHashOrIntentSchema
- BatchedMethodSchema
- ContractMetadataSchema
- ContractClassMetadataSchema
- EventMetadataDefinitionSchema
- PrivateEventSchema
- PrivateEventFilterSchema
- WalletSchema
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:AccountContractsecret:Frsalt: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:AccountInterfacesecretKey:Frsalt: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:ExecutionPayloadgasSettings:GasSettingsoptions: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:ExecutionPayloadgasSettings: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())
- The selector of the authwit type, used to identify it when emitted from
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:WalletauthWitnesses(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:Walletinteractions:(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
Simulates the batch, supporting private, public and utility functions. Although this is a single interaction with the wallet, private and public functions will be grouped into a single ExecutionPayload that the wallet will simulate as a single transaction. Utility function calls will simply be executed one by one.
Signature:
public async simulate(options: SimulateInteractionOptions): Promise<any>
Parameters:
options:SimulateInteractionOptions- An optional object containing additional configuration for the interaction.
Returns:
Promise<any> - The results of all the interactions that make up the batch
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 address: AztecAddress,
public readonly artifact: ContractArtifact,
public wallet: Wallet
)
Parameters:
address:AztecAddress- The contract's address.
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.
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:WalletcontractAddress:AztecAddressfunctionDao:FunctionAbiargs: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
- Same options as
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 at(
address: AztecAddress,
artifact: ContractArtifact,
wallet: Wallet
): 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:
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;
skipRegistration?: 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
skipRegistration
Skip contract registration in the wallet
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: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
private args: any[] = [],
constructorNameOrArtifact?: string | FunctionArtifact,
authWitnesses: AuthWitness[] = [],
capsules: Capsule[] = []
)
Parameters:
publicKeys:PublicKeyswallet:Walletartifact:ContractArtifactpostDeployCtor:(instance: ContractInstanceWithAddress, wallet: Wallet) => TContractargs(optional):any[]constructorNameOrArtifact(optional):string | FunctionArtifactauthWitnesses(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.
- Same options as
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 = ContractBase> = FieldsOf<TxReceipt> & {
contract: TContract;
instance: ContractInstanceWithAddress;
};
Type Members:
contract
Instance of the newly deployed contract.
Type: TContract
instance
The deployed contract instance with address and metadata.
Type: ContractInstanceWithAddress
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: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
private instanceGetter: () => Promise<ContractInstanceWithAddress>
)
Parameters:
wallet:WalletsendTx:() => Promise<TxHash>postDeployCtor:(instance: ContractInstanceWithAddress, wallet: Wallet) => TContractinstanceGetter:() => Promise<ContractInstanceWithAddress>- A getter for the deployed contract instance
Methods
getInstance
Returns the contract instance for this deployment.
Signature:
public async getInstance(): Promise<ContractInstanceWithAddress>
Returns:
Promise<ContractInstanceWithAddress> - The deployed contract instance with address and metadata.
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:TxSimulationResultpad(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 toSendOptions(options: SendInteractionOptions): SendOptions
Parameters:
options:SendInteractionOptions
Returns:
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 toSimulateOptions(options: SimulateInteractionOptions): SimulateOptions
Parameters:
options:SimulateInteractionOptions
Returns:
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 toProfileOptions(options: ProfileInteractionOptions): ProfileOptions
Parameters:
options:ProfileInteractionOptions
Returns:
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 | AztecNodesendTx:() => 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:AztecNodereceipt:TxReceiptopts(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:ContractArtifactwallet:WalletpublicKeys(optional):PublicKeysconstructorName(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:Walletartifact: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:ExtendedViemWalletClientlogger: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:EthAddresstokenAddress:EthAddresshandlerAddress:EthAddressextendedClient:ExtendedViemWalletClientlogger: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:EthAddresstokenAddress:EthAddresshandlerAddress:EthAddress | undefinedextendedClient:ExtendedViemWalletClientlogger: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:EthAddresstokenAddress:EthAddresshandlerAddress:EthAddress | undefinedoutboxAddress:EthAddressextendedClient:ExtendedViemWalletClientlogger: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:AztecAddressclaim: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