Aztec 백서

Aztec

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 9쪽

yet. Intended for subclasses that run inside a code path where `getInstance()` is guaranteed to have already been awaited (e.g. `request()` invoked it). Not part of the public API. **Signature:** ``` protected getCachedInstanceOrThrow(): ContractInstanceWithAddress ``` **Returns:** `ContractInstanceWithAddress` ##### with[​](#with-1 "Direct link to with") Augments this DeployMethod with additional metadata, such as authWitnesses and capsules. The deployer lock is preserved: a Pending that has not yet been locked stays Pending; a Pending that has already locked, along with Owned and Universal, returns the matching locked flavor so the cloned method deploys at the same address as `this`. **Signature:** ``` public with({ authWitnesses = [], capsules = [], extraHashedArgs = [], }: { authWitnesses?: AuthWitness[]; capsules?: Capsule[]; extraHashedArgs?: HashedValues[]; }): DeployMethod<TContract> ``` **Parameters:** * `{ authWitnesses = [], capsules = [], extraHashedArgs = [], }`: ``` { /** The authWitnesses to add to the deployment */ authWitnesses?: AuthWitness[]; /** The capsules to add to the deployment */ capsules?: Capsule[]; /** The extra hashed args to add to the deployment */ extraHashedArgs?: HashedValues[]; } ``` **Returns:** `DeployMethod<TContract>` - A new DeployMethod with the added metadata, but calling the same original function in the same manner #### BoundDeployMethod[​](#bounddeploymethod "Direct link to BoundDeployMethod") **Type:** Class Deploy method whose deployer is fixed at construction to a concrete AztecAddress. The deployer is mixed into the address preimage, so the contract address is fully determined. Sending from a different account throws — letting it through would silently produce a deployed address different from the one `getAddress()` reported. **Extends:** `DeployMethod` #### Constructor[​](#constructor-7 "Direct link to Constructor") **Signature:** ``` public constructor( wallet: Wallet, contract: DeployMethodContract<TContract>, instantiation: BoundInstantiationOptions, payload: DeployMethodPayload = {} ) ``` **Parameters:** * `wallet`: `Wallet` * `contract`: `DeployMethodContract<TContract>` * `instantiation`: `BoundInstantiationOptions` * `payload` (optional): `DeployMethodPayload` #### Properties[​](#properties-3 "Direct link to Properties") ##### deployer[​](#deployer-4 "Direct link to deployer") The address baked into the address preimage. Read-only — set at construction. **Type:** `AztecAddress` #### Methods[​](#methods-11 "Direct link to Methods") ##### getDeployerAddress[​](#getdeployeraddress-1 "Direct link to getDeployerAddress") Returns the locked deployer baked into the address preimage. **Signature:** ``` public getDeployerAddress(): AztecAddress ``` **Returns:** `AztecAddress` ##### lockDeployer[​](#lockdeployer-1 "Direct link to lockDeployer") Throws unless `from` matches the locked deployer; the deployer is part of the address. **Signature:** ``` public lockDeployer(from: SendInteractionOptionsWithoutWait['from'] | undefined): void ``` **Parameters:** * `from`: `SendInteractionOptionsWithoutWait['from'] | undefined` * The send-time `from` value (`AztecAddress`, `NO_FROM`, or `undefined`). **Returns:** `void` ##### cloneInstantiation[​](#cloneinstantiation-1 "Direct link to cloneInstantiation") Re-emits this method's `DeployInstantiationOptions` for `with(...)` to consume. **Signature:** ``` public cloneInstantiation(): DeployInstantiationOptions ``` **Returns:** `DeployInstantiationOptions` #### UniversalDeployMethod[​](#universaldeploymethod "Direct link to UniversalDeployMethod") **Type:** Class Deploy method whose deployer is fixed at construction to AztecAddress.ZERO (universal deploy). The address does not depend on the sender, so any account may sign the deploy tx. **Extends:** `DeployMethod` #### Constructor[​](#constructor-8 "Direct link to Constructor") **Signature:** ``` public constructor( wallet: Wallet, contract: DeployMethodContract<TContract>, instantiation: UniversalInstantiationOptions, payload: DeployMethodPayload = {} ) ``` **Parameters:** * `wallet`: `Wallet` * `contract`: `DeployMethodContract<TContract>` * `instantiation`: `UniversalInstantiationOptions` * `payload` (optional): `DeployMethodPayload` #### Methods[​](#methods-12 "Direct link to Methods") ##### getDeployerAddress[​](#getdeployeraddress-2 "Direct link to getDeployerAddress") Universal deploys are anchored at `AztecAddress.ZERO`; the sender does not enter the preimage. **Signature:** ``` public getDeployerAddress(): AztecAddress ``` **Returns:** `AztecAddress` ##### lockDeployer[​](#lockdeployer-2 "Direct link to lockDeployer") Universal deploys accept any sender, including `NO_FROM` / `undefined`. **Signature:** ``` public lockDeployer(_from: SendInteractionOptionsWithoutWait['from'] | undefined): void ``` **Parameters:** * `_from`: `SendInteractionOptionsWithoutWait['from'] | undefined` * Ignored. **Returns:** `void` ##### cloneInstantiation[​](#cloneinstantiation-2 "Direct link to cloneInstantiation") Re-emits this method's `DeployInstantiationOptions` for `with(...)` to consume. **Signature:** ``` public cloneInstantiation(): DeployInstantiationOptions ``` **Returns:** `DeployInstantiationOptions` #### PendingDeployMethod[​](#pendingdeploymethod "Direct link to PendingDeployMethod") **Type:** Class Deploy method whose deployer is not yet decided. The first `send` / `simulate` / `profile` call promotes this into an BoundDeployMethod or UniversalDeployMethod (depending on whether `options.from` is an address or `NO_FROM` / `undefined`); subsequent calls reuse that promotion and reject mismatching `from` values. Reading the address (`getInstance` / `getAddress` / `getPartialAddress`) or building a payload (`request`) before the promotion happens throws — the address would otherwise be ambiguous and could differ from what `send()` ends up deploying. **Extends:** `DeployMethod` #### Constructor[​](#constructor-9 "Direct link to Constructor") **Signature:** ``` public constructor( wallet: Wallet, contract: DeployMethodContract<TContract>, instantiation: PendingInstantiationOptions = {}, payload: DeployMethodPayload = {} ) ``` **Parameters:** * `wallet`: `Wallet` * `contract`: `DeployMethodContract<TContract>` * `instantiation` (optional): `PendingInstantiationOptions` * `payload` (optional): `DeployMethodPayload` #### Properties[​](#properties-4 "Direct link to Properties") ##### #locked[​](#locked "Direct link to #locked") The locked sibling created on the first send-side call. Once set, all flavor-specific decisions (sender compatibility, address derivation, clone shape) delegate to it, so a second call with a mismatched `from` is rejected by `BoundDeployMethod.lockDeployer`. **Type:** `BoundDeployMethod<TContract> | UniversalDeployMethod<TContract>` #### Methods[​](#methods-13 "Direct link to Methods") ##### getDeployerAddress[​](#getdeployeraddress-3 "Direct link to getDeployerAddress") Returns the locked deployer once it has happened. Throws while still pending — the address would otherwise differ from what `send()` ends up deploying. **Signature:** ``` public getDeployerAddress(): AztecAddress ``` **Returns:** `AztecAddress` ##### lockDeployer[​](#lockdeployer-3 "Direct link to lockDeployer") On the first call, promotes this pending method into a locked sibling and remembers it. On subsequent calls, defers to the locked sibling — so a mismatched `from` is rejected by the sibling's own policy, not a duplicate one here. **Signature:** ``` public lockDeployer(from: SendInteractionOptionsWithoutWait['from'] | undefined): void ``` **Parameters:** * `from`: `SendInteractionOptionsWithoutWait['from'] | undefined` * The send-time `from` value (`AztecAddress`, `NO_FROM`, or `undefined`). **Returns:** `void` ##### cloneInstantiation[​](#cloneinstantiation-3 "Direct link to cloneInstantiation") Re-emits this method's `DeployInstantiationOptions` for `with(...)` to consume. **Signature:** ``` public cloneInstantiation(): DeployInstantiationOptions ``` **Returns:** `DeployInstantiationOptions` ##### #promoteFrom[​](#promotefrom "Direct link to #promoteFrom") Builds the locked sibling implied by a send-time `from`: an `AztecAddress` becomes BoundDeployMethod; `NO_FROM` / `undefined` becomes UniversalDeployMethod. **Signature:** ``` #promoteFrom(from: SendInteractionOptionsWithoutWait['from'] | undefined): BoundDeployMethod<TContract> | UniversalDeployMethod<TContract> ``` **Parameters:** * `from`: `SendInteractionOptionsWithoutWait['from'] | undefined` * The send-time `from` value. **Returns:** `BoundDeployMethod<TContract> | UniversalDeployMethod<TContract>` *** ### `contract/fastforward_contract_update.ts`[​](#contractfastforward_contract_updatets "Direct link to contractfastforward_contract_updatets") #### fastForwardContractUpdate[​](#fastforwardcontractupdate "Direct link to fastForwardContractUpdate") **Type:** Function Builds `SimulationOverrides` that simulate a deployed instance as if it had already been upgraded to a new contract class. Mirrors a real onchain upgrade (scheduling the new class and waiting out the delay): - `publicStorage` rewrites the `ContractInstanceRegistry`'s delayed-public-mutable storage so the AVM's `UpdateCheck` resolves to the new class id. - `contracts` swaps the deployed instance for one whose `currentContractClassId` is bumped to the new class. The new class must already be registered on chain. **Signature:** ``` export async fastForwardContractUpdate(args: { instanceAddress: AztecAddress; newClassId: Fr; node: AztecNode; }): Promise<SimulationOverrides> ``` **Parameters:** * `args`: ``` { /** Address of the deployed instance to upgrade. */ instanceAddress: AztecAddress; /** ID of the (already-registered) class to upgrade to. */ newClassId: Fr; /** Node used to fetch the existing instance and validate the class is registered. */ node: AztecNode; } ``` **Returns:** `Promise<SimulationOverrides>` *** ### `contract/interaction_options.ts`[​](#contractinteraction_optionsts "Direct link to contractinteraction_optionsts") #### FeePaymentMethodOption[​](#feepaymentmethodoption "Direct link to 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[​](#paymentmethod "Direct link to paymentMethod") Fee payment method to embed in the interaction **Type:** `FeePaymentMethod` #### GasSettingsOption[​](#gassettingsoption "Direct link to 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>>; congestionEstimate?: ManaUsageEstimate; }; ``` **Type Members:** ##### gasSettings[​](#gassettings "Direct link to gasSettings") The gas settings **Type:** `Partial<FieldsOf<GasSettings>>` ##### congestionEstimate[​](#congestionestimate "Direct link to congestionEstimate") Assumed network congestion level for fee prediction. Controls how aggressively the wallet estimates future fees: None assumes empty blocks, Target assumes steady-state usage, and Limit assumes blocks at maximum capacity. Higher estimates produce higher fee predictions, reducing the risk of underpriced transactions during congestion spikes. Defaults to Limit (worst case) when not specified. **Type:** `ManaUsageEstimate` #### InteractionFeeOptions[​](#interactionfeeoptions "Direct link to InteractionFeeOptions") **Type:** Type Alias Fee options as set by a user. **Signature:** ``` export type InteractionFeeOptions = GasSettingsOption & FeePaymentMethodOption; ``` #### RequestInteractionOptions[​](#requestinteractionoptions "Direct link to 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[​](#authwitnesses-1 "Direct link to authWitnesses") Extra authwits to use during execution **Type:** `AuthWitness[]` ##### capsules[​](#capsules-1 "Direct link to capsules") Extra capsules to use during execution **Type:** `Capsule[]` ##### fee[​](#fee-1 "Direct link to fee") Fee payment method to embed in the interaction request **Type:** `FeePaymentMethodOption` #### NO\_WAIT[​](#no_wait "Direct link to NO_WAIT") **Type:** Constant Constant for explicitly not waiting for transaction confirmation. We use this instead of false to avoid confusion with falsy checks. **Value Type:** `any` #### NoWait[​](#nowait "Direct link to NoWait") **Type:** Type Alias Type for the NO\_WAIT constant. **Signature:** ``` export type NoWait = typeof NO_WAIT; ``` #### NO\_FROM[​](#no_from "Direct link to NO_FROM") **Type:** Constant Constant for explicitly opting out of account contract mediation. When used as the `from` parameter, the wallet executes the payload directly via the DefaultEntrypoint without wrapping it in an account contract entrypoint. The app is responsible for assembling the complete execution payload, including any entrypoint wrapping (e.g. multicall) if needed. This will result in the first call of the chain receiving msg\_sender as Option::none **Value Type:** `any` #### NoFrom[​](#nofrom "Direct link to NoFrom") **Type:** Type Alias Type for the NO\_FROM constant. **Signature:** ``` export type NoFrom = typeof NO_FROM; ``` #### InteractionWaitOptions[​](#interactionwaitoptions "Direct link to InteractionWaitOptions") **Type:** Type Alias Type for wait options in interactions. - NO\_WAIT symbol: Don't wait for confirmation, return TxHash immediately - WaitOpts object: Wait with custom options and return receipt/result - undefined: Wait with default options and return receipt/result **Signature:** ``` export type InteractionWaitOptions = NoWait | WaitOpts | undefined; ``` #### SendInteractionOptionsWithoutWait[​](#sendinteractionoptionswithoutwait "Direct link to SendInteractionOptionsWithoutWait") **Type:** Type Alias Base options for calling a (constrained) function in a contract, without wait parameter. **Signature:** ``` export type SendInteractionOptionsWithoutWait = RequestInteractionOptions & { from: AztecAddress | NoFrom; fee?: InteractionFeeOptions; additionalScopes?: AztecAddress[]; sendMessagesAs?: AztecAddress; }; ``` **Type Members:** ##### from[​](#from "Direct link to from") The sender's Aztec address, or NO\_FROM to execute without account contract mediation. **Type:** `AztecAddress | NoFrom` ##### fee[​](#fee-2 "Direct link to fee") The fee options for the transaction. **Type:** `InteractionFeeOptions` ##### additionalScopes[​](#additionalscopes "Direct link to additionalScopes") Additional addresses whose private state and keys should be accessible during execution, beyond the sender's. Required when the transaction needs to access private state or keys belonging to an address other than `from`, e.g. withdrawing from an escrow that holds its own private notes. **Type:** `AztecAddress[]` ##### sendMessagesAs[​](#sendmessagesas "Direct link to sendMessagesAs") Overrides the sender address used to derive discovery tags for private messages (notes, events, logs). Recipients use these tags to find messages addressed to them. Defaults to `from`. Typically set when `from === NO_FROM`, since there is no account address to derive tags from. **Type:** `AztecAddress` #### SendInteractionOptions[​](#sendinteractionoptions "Direct link to SendInteractionOptions") **Type:** Type Alias Represents options for calling a (constrained) function in a contract. **Signature:** ``` export type SendInteractionOptions<W extends InteractionWaitOptions = undefined> = SendInteractionOptionsWithoutWait & { wait?: W; }; ``` **Type Members:** ##### wait[​](#wait-1 "Direct link to wait") Whether to wait for the transaction to be mined. - undefined (default): wait with default options and return TxReceipt - WaitOpts object: wait with custom options and return TxReceipt - NO\_WAIT: return txHash immediately without waiting **Type:** `W` #### SimulateInteractionOptions[​](#simulateinteractionoptions "Direct link to 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?: InteractionFeeOptions; skipTxValidation?: boolean; skipFeeEnforcement?: boolean; includeMetadata?: boolean; overrides?: SimulationOverrides; }; ``` **Type Members:** ##### fee[​](#fee-3 "Direct link to fee") The fee options for the transaction. **Type:** `InteractionFeeOptions` ##### skipTxValidation[​](#skiptxvalidation-1 "Direct link to skipTxValidation") Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers. **Type:** `boolean` ##### skipFeeEnforcement[​](#skipfeeenforcement-1 "Direct link to skipFeeEnforcement") Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. **Type:** `boolean` ##### includeMetadata[​](#includemetadata-1 "Direct link to includeMetadata") Whether to include metadata such as performance statistics (e.g. timing information of the different circuits and oracles) and simulated gas usage in the simulation result, in addition to the return value and offchain effects **Type:** `boolean` ##### overrides[​](#overrides "Direct link to overrides") Pre-simulation overrides applied to the ephemeral fork and contract DB (publicStorage writes, contract instance overrides). **Type:** `SimulationOverrides` #### ProfileInteractionOptions[​](#profileinteractionoptions "Direct link to 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[​](#profilemode "Direct link to profileMode") Whether to return gates information or the bytecode/witnesses. **Type:** `'gates' | 'execution-steps' | 'full'` ##### skipProofGeneration[​](#skipproofgeneration "Direct link to skipProofGeneration") Whether to generate a Chonk proof or not **Type:** `boolean` #### OffchainMessage[​](#offchainmessage "Direct link to OffchainMessage") **Type:** Type Alias A message emitted during execution or proving, to be delivered offchain. **Signature:** ``` export type OffchainMessage = { recipient: AztecAddress; payload: Fr[]; contractAddress: AztecAddress; anchorBlockTimestamp: bigint; }; ``` **Type Members:** ##### recipient[​](#recipient "Direct link to recipient") The intended recipient of the message. **Type:** `AztecAddress` ##### payload[​](#payload "Direct link to payload") The message payload (typically encrypted). **Type:** `Fr[]` ##### contractAddress[​](#contractaddress "Direct link to contractAddress") The contract that emitted the message. **Type:** `AztecAddress` ##### anchorBlockTimestamp[​](#anchorblocktimestamp "Direct link to anchorBlockTimestamp
프로젝트로 돌아가기