Aztec 백서

Aztec

원문

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

` * `from`: `AztecAddress` * `messageHashOrIntent`: `Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent` * `authorized`: `boolean` **Returns:** `Promise<SetPublicAuthwitContractInteraction>` ##### simulate[​](#simulate-3 "Direct link to simulate") Overrides the simulate method, adding the sender of the authwit (authorizer) as from and preventing misuse **Signature:** ``` public override simulate(options: Omit<SimulateInteractionOptions, 'from'> = {} as Omit<SimulateInteractionOptions, 'from'>): Promise<SimulationResult> ``` **Parameters:** * `options` (optional): `Omit<SimulateInteractionOptions, 'from'>` * An optional object containing additional configuration for the transaction. **Returns:** `Promise<SimulationResult>` - The result of the transaction as returned by the contract function. ##### profile[​](#profile-2 "Direct link to 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[​](#send-6 "Direct link to send") Overrides the send method, adding the sender of the authwit (authorizer) as from and preventing misuse **Signature:** ``` public override send(options?: Omit<SendInteractionOptionsWithoutWait, 'from'>): Promise<TxSendResultMined> ``` **Parameters:** * `options` (optional): `Omit<SendInteractionOptionsWithoutWait, 'from'>` * An optional object containing 'fee' options information **Returns:** `Promise<TxSendResultMined>` - A TxReceipt (if wait is true/undefined) or TxHash (if wait is false) ##### send[​](#send-7 "Direct link to send") **Signature:** ``` public override send<W extends InteractionWaitOptions>(options?: Omit<SendInteractionOptions<W>, 'from'>): Promise<SendReturn<W>> ``` **Parameters:** * `options` (optional): `Omit<SendInteractionOptions<W>, 'from'>` **Returns:** `Promise<SendReturn<W>>` ##### send[​](#send-8 "Direct link to send") **Signature:** ``` public override send(options?: Omit<SendInteractionOptions<InteractionWaitOptions>, 'from'>): Promise<SendReturn<InteractionWaitOptions>> ``` **Parameters:** * `options` (optional): `Omit<SendInteractionOptions<InteractionWaitOptions>, 'from'>` **Returns:** `Promise<SendReturn<InteractionWaitOptions>>` *** ### `utils/cross_chain.ts`[​](#utilscross_chaints "Direct link to utilscross_chaints") #### waitForL1ToL2MessageReady[​](#waitforl1tol2messageready "Direct link to waitForL1ToL2MessageReady") **Type:** Function Waits for the L1 to L2 message to be ready to be consumed, that is, for a block that already exists to have inserted it into the message tree at the given tip. This is a check on the chain as it stands, not a promise about a future block: a node simulating public calls may optimistically include messages that are still only in the Inbox, and the block that eventually inserts them can stop short of the one being waited for. **Signature:** ``` export waitForL1ToL2MessageReady( node: Pick<AztecNode, 'getBlockData' | 'getL1ToL2MessageIndex'>, l1ToL2MessageHash: Fr, opts: { timeoutSeconds: number; chainTip?: BlockTag; } ): Promise<boolean> ``` **Parameters:** * `node`: `Pick<AztecNode, 'getBlockData' | 'getL1ToL2MessageIndex'>` * Aztec node instance used to obtain the information about the message * `l1ToL2MessageHash`: `Fr` * Hash of the L1 to L2 message * `opts`: * Options ``` { /** Timeout for the operation in seconds */ timeoutSeconds: number; /** * Chain tip to evaluate readiness against. Defaults to `'latest'`. Set this to the tip the consuming PXE syncs to * (e.g. `'proven'`) so readiness answers whether the message is present at the same block the transaction * simulation will anchor to, not at a newer tip. */ chainTip?: BlockTag; } ``` **Returns:** `Promise<boolean>` #### isL1ToL2MessageReady[​](#isl1tol2messageready "Direct link to isL1ToL2MessageReady") **Type:** Function Returns whether the L1 to L2 message is ready to be consumed: whether a block at `chainTip` has already inserted it into the message tree. A message that is in the Inbox but not yet in any block is not ready, even though a node may already simulate public calls against it; use this rather than a successful simulation when a caller needs to know the message is really there. **Signature:** ``` export async isL1ToL2MessageReady( node: Pick<AztecNode, 'getBlockData' | 'getL1ToL2MessageIndex'>, l1ToL2MessageHash: Fr, chainTip: BlockTag = 'latest' ): Promise<boolean> ``` **Parameters:** * `node`: `Pick<AztecNode, 'getBlockData' | 'getL1ToL2MessageIndex'>` * Aztec node instance used to obtain the information about the message * `l1ToL2MessageHash`: `Fr` * Hash of the L1 to L2 message * `chainTip` (optional): `BlockTag` * Chain tip to evaluate readiness against. Defaults to `'latest'`. Pass the tip the consuming PXE syncs to (e.g. `'proven'`) so readiness is checked at the block the transaction simulation will anchor to. **Returns:** `Promise<boolean>` - True if the message is ready to be consumed, false otherwise *** ### `utils/fee_juice.ts`[​](#utilsfee_juicets "Direct link to utilsfee_juicets") #### getFeeJuiceBalance[​](#getfeejuicebalance "Direct link to getFeeJuiceBalance") **Type:** Function Returns the owner's fee juice balance. Note: This is used only e2e\_local\_network\_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`[​](#utilsfield_compressed_stringts "Direct link to utilsfield_compressed_stringts") #### readFieldCompressedString[​](#readfieldcompressedstring "Direct link to readFieldCompressedString") **Type:** Constant This turns **Value Type:** `any` *** ### `utils/node.ts`[​](#utilsnodets "Direct link to utilsnodets") #### waitForNode[​](#waitfornode "Direct link to waitForNode") **Type:** Constant Waits for an Aztec node to become reachable, polling AztecNode.getNodeInfo until it succeeds. **Value Type:** `any` #### waitForTx[​](#waitfortx "Direct link to waitForTx") **Type:** Function Waits for a transaction to be mined and returns its receipt. **Signature:** ``` export async waitForTx( node: AztecNode, txHash: TxHash, opts?: WaitOpts ): Promise<TxReceipt> ``` **Parameters:** * `node`: `AztecNode` * The Aztec node to query for transaction status * `txHash`: `TxHash` * The hash of the transaction to wait for * `opts` (optional): `WaitOpts` * Optional configuration for waiting behavior **Returns:** `Promise<TxReceipt>` - The transaction receipt #### createAztecNodeClient[​](#createaztecnodeclient "Direct link to createAztecNodeClient") **Type:** Constant This is re-exported from `@aztec-labs/stdlib/interfaces/client`. See the source module for full documentation. **Value Type:** `Re-export` #### AztecNode[​](#aztecnode "Direct link to AztecNode") **Type:** Type Alias This is a type re-exported from `@aztec-labs/stdlib/interfaces/client`. See the source module for full type definition and documentation. **Signature:** ``` export type { AztecNode } from '@aztec-labs/stdlib/interfaces/client' ``` #### AztecNodeClientOptions[​](#aztecnodeclientoptions "Direct link to AztecNodeClientOptions") **Type:** Type Alias This is a type re-exported from `@aztec-labs/stdlib/interfaces/client`. See the source module for full type definition and documentation. **Signature:** ``` export type { AztecNodeClientOptions } from '@aztec-labs/stdlib/interfaces/client' ``` *** ### `utils/pub_key.ts`[​](#utilspub_keyts "Direct link to utilspub_keyts") #### generatePublicKey[​](#generatepublickey "Direct link to 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 "Direct link to Wallet") *** ### `wallet/account_entrypoint_meta_payment_method.ts`[​](#walletaccount_entrypoint_meta_payment_methodts "Direct link to walletaccount_entrypoint_meta_payment_methodts") #### AccountEntrypointMetaPaymentMethod[​](#accountentrypointmetapaymentmethod "Direct link to 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[​](#constructor-20 "Direct link to Constructor") **Signature:** ``` constructor( private account: Account, private chainInfo: ChainInfo, private paymentMethod?: FeePaymentMethod, private feeEntrypointOptions?: any ) ``` **Parameters:** * `account`: `Account` * `chainInfo`: `ChainInfo` * `paymentMethod` (optional): `FeePaymentMethod` * `feeEntrypointOptions` (optional): `any` #### Methods[​](#methods-25 "Direct link to Methods") ##### getAsset[​](#getasset-5 "Direct link to getAsset") **Signature:** ``` getAsset(): Promise<AztecAddress> ``` **Returns:** `Promise<AztecAddress>` ##### getExecutionPayload[​](#getexecutionpayload-5 "Direct link to getExecutionPayload") **Signature:** ``` async getExecutionPayload(): Promise<ExecutionPayload> ``` **Returns:** `Promise<ExecutionPayload>` ##### getFeePayer[​](#getfeepayer-5 "Direct link to getFeePayer") **Signature:** ``` getFeePayer(): Promise<AztecAddress> ``` **Returns:** `Promise<AztecAddress>` ##### getGasSettings[​](#getgassettings-5 "Direct link to getGasSettings") **Signature:** ``` getGasSettings(): GasSettings | undefined ``` **Returns:** `GasSettings | undefined` *** ### `wallet/account_manager.ts`[​](#walletaccount_managerts "Direct link to walletaccount_managerts") #### AccountManagerCreateOptions[​](#accountmanagercreateoptions "Direct link to AccountManagerCreateOptions") **Type:** Interface Optional overrides passed to AccountManager.create. #### Properties[​](#properties-6 "Direct link to Properties") ##### salt[​](#salt-2 "Direct link to salt") Contract instantiation salt. Defaults to a random `Fr`. **Type:** `Salt` ##### immutablesHash[​](#immutableshash-2 "Direct link to immutablesHash") Commitment to the contract's immutable storage values. Folded into the salted initialization hash, so a non-zero value affects the derived address. Defaults to `Fr.ZERO`. **Type:** `Fr` ##### deployer[​](#deployer-5 "Direct link to deployer") Address recorded as the instance deployer. Defaults to `AztecAddress.ZERO`. **Type:** `AztecAddress` #### AccountManager[​](#accountmanager "Direct link to 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[​](#constructor-21 "Direct link to Constructor") **Signature:** ``` private constructor( private wallet: Wallet, private secretKey: Fr, private accountContract: AccountContract, private instance: ContractInstanceWithAddress ) ``` **Parameters:** * `wallet`: `Wallet` * `secretKey`: `Fr` * `accountContract`: `AccountContract` * `instance`: `ContractInstanceWithAddress` #### Methods[​](#methods-26 "Direct link to Methods") ##### create[​](#create-2 "Direct link to create") **Signature:** ``` static async create( wallet: Wallet, secretKey: Fr, accountContract: AccountContract, opts?: AccountManagerCreateOptions ) ``` **Parameters:** * `wallet`: `Wallet` * `secretKey`: `Fr` * `accountContract`: `AccountContract` * `opts` (optional): `AccountManagerCreateOptions` **Returns:** `Promise<AccountManager>` ##### getPublicKeys[​](#getpublickeys "Direct link to getPublicKeys") **Signature:** ``` protected getPublicKeys(): PublicKeys ``` **Returns:** `PublicKeys` ##### getPublicKeysHash[​](#getpublickeyshash "Direct link to getPublicKeysHash") **Signature:** ``` protected getPublicKeysHash(): Promise<Fr> ``` **Returns:** `Promise<Fr>` ##### getCompleteAddress[​](#getcompleteaddress-2 "Direct link to 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[​](#getsecretkey "Direct link to getSecretKey") Returns the secret key used to derive the rest of the privacy keys for this contract **Signature:** ``` public getSecretKey() ``` **Returns:** `Fr` ##### getInstance[​](#getinstance-1 "Direct link to 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[​](#getaccount-1 "Direct link to getAccount") Returns the account (the transaction signer) backed by this account contract. Use it to build and authorize transactions from this account. **Signature:** ``` public async getAccount(): Promise<Account> ``` **Returns:** `Promise<Account>` ##### getAccountContract[​](#getaccountcontract "Direct link to getAccountContract") Returns the account contract that backs this account. **Signature:** ``` getAccountContract(): AccountContract ``` **Returns:** `AccountContract` - The account contract ##### getDeployMethod[​](#getdeploymethod "Direct link to 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[​](#hasinitializer "Direct link to hasInitializer") Returns whether this account contract has an initializer function. **Signature:** ``` public async hasInitializer() ``` **Returns:** `Promise<boolean>` #### Getters[​](#getters "Direct link to Getters") ##### address (getter)[​](#address-getter "Direct link to address (getter)") **Signature:** ``` get address(): AztecAddress { ``` **Returns:** `AztecAddress` *** ### `wallet/capabilities.ts`[​](#walletcapabilitiests "Direct link to walletcapabilitiests") #### CAPABILITY\_VERSION[​](#capability_version "Direct link to CAPABILITY_VERSION") **Type:** Constant Current capability manifest version. **Value Type:** `any` #### ContractFunctionPattern[​](#contractfunctionpattern "Direct link to ContractFunctionPattern") **Type:** Interface Pattern for matching contract functions with wildcards. Used in simulation and transaction capabilities to specify which contract functions are allowed. #### Properties[​](#properties-7 "Direct link to Properties") ##### contract[​](#contract-3 "Direct link to contract") Contract address or '\*' for any contract **Type:** `AztecAddress | '*'` ##### function[​](#function "Direct link to function") Function name or '\*' for any function **Type:** `string` ##### additionalScopes[​](#additionalscopes-1 "Direct link to additionalScopes") Additional addresses whose private state and keys are accessible when calling this function, beyond the sender's. - undefined: No additional scopes allowed - AztecAddress\[]: Only these specific addresses allowed as additional scopes - '\*': All known address allowed as an additional scope **Type:** `AztecAddress[] | '*'` #### AccountsCapability[​](#accountscapability "Direct link to AccountsCapability") **Type:** Interface Account access capability - grants access to user accounts. Maps to wallet methods: - getAccounts (when canGet: true) - createAuthWit (when canCreateAuthWit: true) The wallet decides which accounts to reveal to the app. Apps don't specify which accounts they want - they just request the capability and the wallet shows them the available accounts. #### Properties[​](#properties-8 "Direct link to Properties") ##### type[​](#type "Direct link to type") Discriminator for capability type **Type:** `'accounts'` ##### canGet[​](#canget "Direct link to canGet") Can get accounts from wallet. Maps to: getAccounts **Type:** `boolean` ##### canCreateAuthWit[​](#cancreateauthwit "Direct link to canCreateAuthWit") Can create auth witnesses for accounts. Maps to: createAuthWit **Type:** `boolean` #### GrantedAccountsCapability[​](#grantedaccountscapability "Direct link to GrantedAccountsCapability") **Type:** Interface Granted account access capability. Extends the request with specific accounts that were granted by the wallet. **Extends:** `AccountsCapability` #### Properties[​](#properties-9 "Direct link to Properties") ##### accounts[​](#accounts "Direct link to accounts") Specific accounts granted by the wallet with their aliases. The wallet adds this when granting the capability. **Type:** `Aliased<AztecAddress>[]` #### ContractsCapability[​](#contractscapability "Direct link to ContractsCapability") **Type:** Interface Contract interaction capability - for registering and querying contracts. Maps to wallet methods: - registerContract (when canRegister: true) - getContractMetadata (when canGetMetadata: true) Matching is done by contract address, not class ID. This allows updating existing contracts with new artifacts (e.g., when contract is upgraded to a new contractClassId onchain). Note: For querying contract class metadata, use ContractClassesCapability instead. #### Properties[​](#properties-10 "Direct link to Properties") ##### type[​](#type-1 "Direct link to type") Discriminator for capability type **Type:** `'contracts'` ##### contracts[​](#contracts "Direct link to contracts") Which contracts this applies to: - '\*': Any contract address - AztecAddress\[]: Specific contract addresses **Type:** `'*' | AztecAddress[]` ##### canRegister[​](#canregister "Direct link to canRegister") Can register contracts and update existing registrations. Maps to: registerContract When true, allows: - Registering new contract instances at specified addresses - Re-registering existing contracts with updated artifacts (e.g., after upgrade) **Type:** `boolean` ##### canGetMetadata[​](#cangetmetadata "Direct link to canGetMetadata") Can query contract metadata. Maps to: getContractMetadata **Type:** `boolean` #### GrantedContractsCapability[​](#grantedcontractscapability "Direct link to GrantedContractsCapability") **Type:** Interface Granted co
프로젝트로 돌아가기