bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 11쪽
PortalManager")
**Type:** Class
Helper for interacting with a test TokenPortal on L1 for both withdrawing from and bridging to L2.
**Extends:** `L1ToL2TokenPortalManager`
#### Constructor[](#constructor-14 "Direct link to Constructor")
**Signature:**
```
constructor(
portalAddress: EthAddress,
tokenAddress: EthAddress,
handlerAddress: EthAddress | undefined,
outboxAddress: EthAddress,
extendedClient: ExtendedViemWalletClient,
logger: Logger
)
```
**Parameters:**
* `portalAddress`: `EthAddress`
* `tokenAddress`: `EthAddress`
* `handlerAddress`: `EthAddress | undefined`
* `outboxAddress`: `EthAddress`
* `extendedClient`: `ExtendedViemWalletClient`
* `logger`: `Logger`
#### Methods[](#methods-18 "Direct link to Methods")
##### withdrawFunds[](#withdrawfunds "Direct link to 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,
epochNumber: EpochNumber,
numCheckpointsInEpoch: number,
messageIndex: bigint,
siblingPath: SiblingPath<number>
)
```
**Parameters:**
* `amount`: `bigint`
* Amount to withdraw.
* `recipient`: `EthAddress`
* Who will receive the funds.
* `epochNumber`: `EpochNumber`
* Epoch number of the message.
* `numCheckpointsInEpoch`: `number`
* The partial-proof depth (1-indexed) the witness was built against.
* `messageIndex`: `bigint`
* Index of the message.
* `siblingPath`: `SiblingPath<number>`
* Sibling path of the message.
**Returns:**
`Promise<void>`
##### getL2ToL1MessageLeaf[](#getl2tol1messageleaf "Direct link to 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-4 "Direct link to Fee")
***
### `fee/fee_juice_payment_method_with_claim.ts`[](#feefee_juice_payment_method_with_claimts "Direct link to feefee_juice_payment_method_with_claimts")
#### FeeJuicePaymentMethodWithClaim[](#feejuicepaymentmethodwithclaim "Direct link to 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[](#constructor-15 "Direct link to Constructor")
**Signature:**
```
constructor(
private sender: AztecAddress,
private claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>
)
```
**Parameters:**
* `sender`: `AztecAddress`
* `claim`: `Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>`
#### Methods[](#methods-19 "Direct link to Methods")
##### getExecutionPayload[](#getexecutionpayload "Direct link to 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[](#getasset "Direct link to getAsset")
**Signature:**
```
getAsset(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getFeePayer[](#getfeepayer "Direct link to getFeePayer")
**Signature:**
```
getFeePayer(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getGasSettings[](#getgassettings "Direct link to getGasSettings")
**Signature:**
```
getGasSettings(): GasSettings | undefined
```
**Returns:**
`GasSettings | undefined`
***
### `fee/fee_payment_method.ts`[](#feefee_payment_methodts "Direct link to feefee_payment_methodts")
#### FeePaymentMethod[](#feepaymentmethod "Direct link to FeePaymentMethod")
**Type:** Interface
Holds information about how the fee for a transaction is to be paid.
#### Methods[](#methods-20 "Direct link to Methods")
##### getAsset[](#getasset-1 "Direct link to getAsset")
The asset used to pay the fee.
**Signature:**
```
getAsset(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getExecutionPayload[](#getexecutionpayload-1 "Direct link to 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[](#getfeepayer-1 "Direct link to getFeePayer")
The expected fee payer for this tx.
**Signature:**
```
getFeePayer(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getGasSettings[](#getgassettings-1 "Direct link to 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`[](#feeprivate_fee_payment_methodts "Direct link to feeprivate_fee_payment_methodts")
#### PrivateFeePaymentMethod[](#privatefeepaymentmethod "Direct link to PrivateFeePaymentMethod")
**Type:** Class
**Deprecated:** Is not supported on mainnet. Use FeeJuicePaymentMethodWithClaim or `SponsoredFeePaymentMethod` instead.
Holds information about how the fee for a transaction is to be paid.
**Implements:** `FeePaymentMethod`
#### Constructor[](#constructor-16 "Direct link to 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[](#methods-21 "Direct link to Methods")
##### getAsset[](#getasset-2 "Direct link to getAsset")
The asset used to pay the fee.
**Signature:**
```
async getAsset(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>` - The asset used to pay the fee.
##### getFeePayer[](#getfeepayer-2 "Direct link to getFeePayer")
**Signature:**
```
getFeePayer(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getExecutionPayload[](#getexecutionpayload-2 "Direct link to 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[](#getgassettings-2 "Direct link to getGasSettings")
**Signature:**
```
getGasSettings(): GasSettings | undefined
```
**Returns:**
`GasSettings | undefined`
***
### `fee/public_fee_payment_method.ts`[](#feepublic_fee_payment_methodts "Direct link to feepublic_fee_payment_methodts")
#### PublicFeePaymentMethod[](#publicfeepaymentmethod "Direct link to PublicFeePaymentMethod")
**Type:** Class
**Deprecated:** Is not supported on mainnet. Use FeeJuicePaymentMethodWithClaim or `SponsoredFeePaymentMethod` instead.
Holds information about how the fee for a transaction is to be paid.
**Implements:** `FeePaymentMethod`
#### Constructor[](#constructor-17 "Direct link to Constructor")
**Signature:**
```
constructor(
protected paymentContract: AztecAddress,
protected sender: AztecAddress,
protected wallet: Wallet,
protected gasSettings: GasSettings
)
```
**Parameters:**
* `paymentContract`: `AztecAddress`
* Address which will hold the fee payment.
* `sender`: `AztecAddress`
* An auth witness provider to authorize fee payments
* `wallet`: `Wallet`
* A wallet to perform the simulation to get the accepted asset
* `gasSettings`: `GasSettings`
* Gas settings used to compute the maximum fee the user is willing to pay
#### Methods[](#methods-22 "Direct link to Methods")
##### getAsset[](#getasset-3 "Direct link to getAsset")
The asset used to pay the fee.
**Signature:**
```
async getAsset(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>` - The asset used to pay the fee.
##### getFeePayer[](#getfeepayer-3 "Direct link to getFeePayer")
**Signature:**
```
getFeePayer(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getExecutionPayload[](#getexecutionpayload-3 "Direct link to getExecutionPayload")
Creates an execution payload to pay the fee using a public function through an FPC in the desired asset
**Signature:**
```
async getExecutionPayload(): Promise<ExecutionPayload>
```
**Returns:**
`Promise<ExecutionPayload>` - An execution payload that contains the required function calls.
##### getGasSettings[](#getgassettings-3 "Direct link to getGasSettings")
**Signature:**
```
getGasSettings(): GasSettings | undefined
```
**Returns:**
`GasSettings | undefined`
***
### `fee/sponsored_fee_payment.ts`[](#feesponsored_fee_paymentts "Direct link to feesponsored_fee_paymentts")
#### SponsoredFeePaymentMethod[](#sponsoredfeepaymentmethod "Direct link to SponsoredFeePaymentMethod")
**Type:** Class
A fee payment method that uses a contract that blindly sponsors transactions. This contract is expected to be prefunded in testing environments.
**Implements:** `FeePaymentMethod`
#### Constructor[](#constructor-18 "Direct link to Constructor")
**Signature:**
```
constructor(private paymentContract: AztecAddress)
```
**Parameters:**
* `paymentContract`: `AztecAddress`
#### Methods[](#methods-23 "Direct link to Methods")
##### getAsset[](#getasset-4 "Direct link to getAsset")
**Signature:**
```
getAsset(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getFeePayer[](#getfeepayer-4 "Direct link to getFeePayer")
**Signature:**
```
getFeePayer(): Promise<AztecAddress>
```
**Returns:**
`Promise<AztecAddress>`
##### getExecutionPayload[](#getexecutionpayload-4 "Direct link to getExecutionPayload")
**Signature:**
```
async getExecutionPayload(): Promise<ExecutionPayload>
```
**Returns:**
`Promise<ExecutionPayload>`
##### getGasSettings[](#getgassettings-4 "Direct link to getGasSettings")
**Signature:**
```
getGasSettings(): GasSettings | undefined
```
**Returns:**
`GasSettings | undefined`
## Utils[](#utils "Direct link to Utils")
***
### `utils/abi_types.ts`[](#utilsabi_typests "Direct link to utilsabi_typests")
#### FieldLike[](#fieldlike "Direct link to FieldLike")
**Type:** Type Alias
Any type that can be converted into a field for a contract call.
**Signature:**
```
export type FieldLike = Fr | Buffer | bigint | number | { toField: () => Fr };
```
#### EthAddressLike[](#ethaddresslike "Direct link to EthAddressLike")
**Type:** Type Alias
Any type that can be converted into an EthAddress Aztec.nr struct.
**Signature:**
```
export type EthAddressLike = { address: FieldLike } | EthAddress;
```
#### AztecAddressLike[](#aztecaddresslike "Direct link to AztecAddressLike")
**Type:** Type Alias
Any type that can be converted into an AztecAddress Aztec.nr struct.
**Signature:**
```
export type AztecAddressLike = { address: FieldLike } | AztecAddress;
```
#### FunctionSelectorLike[](#functionselectorlike "Direct link to FunctionSelectorLike")
**Type:** Type Alias
Any type that can be converted into a FunctionSelector Aztec.nr struct.
**Signature:**
```
export type FunctionSelectorLike = FieldLike | FunctionSelector;
```
#### EventSelectorLike[](#eventselectorlike "Direct link to EventSelectorLike")
**Type:** Type Alias
Any type that can be converted into an EventSelector Aztec.nr struct.
**Signature:**
```
export type EventSelectorLike = FieldLike | EventSelector;
```
#### U128Like[](#u128like "Direct link to U128Like")
**Type:** Type Alias
Any type that can be converted into a U128.
**Signature:**
```
export type U128Like = bigint | number;
```
#### WrappedFieldLike[](#wrappedfieldlike "Direct link to WrappedFieldLike")
**Type:** Type Alias
Any type that can be converted into a struct with a single `inner` field.
**Signature:**
```
export type WrappedFieldLike = { inner: FieldLike } | FieldLike;
```
#### OptionLike[](#optionlike "Direct link to OptionLike")
**Type:** Type Alias
Noir `Option<T>` lowered ABI shape, plus ergonomic direct `T | null | undefined` inputs.
**Signature:**
```
export type OptionLike<T> =
| T
| null
| undefined
| { _is_some: boolean; _value: T };
```
***
### `utils/authwit.ts`[](#utilsauthwitts "Direct link to utilsauthwitts")
#### IntentInnerHash[](#intentinnerhash "Direct link to IntentInnerHash")
**Type:** Type Alias
Intent with an inner hash
**Signature:**
```
export type IntentInnerHash = {
consumer: AztecAddress;
innerHash: Fr;
};
```
**Type Members:**
##### consumer[](#consumer "Direct link to consumer")
The consumer
**Type:** `AztecAddress`
##### innerHash[](#innerhash "Direct link to innerHash")
The action to approve
**Type:** `Fr`
#### CallIntent[](#callintent "Direct link to CallIntent")
**Type:** Type Alias
Intent with a call
**Signature:**
```
export type CallIntent = {
caller: AztecAddress;
call: FunctionCall;
};
```
**Type Members:**
##### caller[](#caller "Direct link to caller")
The caller to approve
**Type:** `AztecAddress`
##### call[](#call "Direct link to call")
The call to approve
**Type:** `FunctionCall`
#### ContractFunctionInteractionCallIntent[](#contractfunctioninteractioncallintent "Direct link to ContractFunctionInteractionCallIntent")
**Type:** Type Alias
Intent with a ContractFunctionInteraction
**Signature:**
```
export type ContractFunctionInteractionCallIntent = {
caller: AztecAddress;
action: ContractFunctionInteraction;
};
```
**Type Members:**
##### caller[](#caller-1 "Direct link to caller")
The caller to approve
**Type:** `AztecAddress`
##### action[](#action "Direct link to action")
The action to approve
**Type:** `ContractFunctionInteraction`
#### isContractFunctionInteractionCallIntent[](#iscontractfunctioninteractioncallintent "Direct link to isContractFunctionInteractionCallIntent")
**Type:** Function
Identifies ContractFunctionInteractionCallIntents
**Signature:**
```
export isContractFunctionInteractionCallIntent(messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent): messageHashOrIntent is ContractFunctionInteractionCallIntent
```
**Parameters:**
* `messageHashOrIntent`: `Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent`
**Returns:**
`messageHashOrIntent is ContractFunctionInteractionCallIntent`
#### computeAuthWitMessageHash[](#computeauthwitmessagehash "Direct link to computeAuthWitMessageHash")
**Type:** Constant
Compute an authentication witness message hash from an intent and metadata If using the `IntentInnerHash`, the consumer is the address that can "consume" the authwit, for token approvals it is the token contract itself. The `innerHash` itself will be the message that a contract is allowed to execute. At the point of "approval checking", the validating contract (account for private and registry for public) will be computing the message hash (`H(consumer, chainid, version, inner_hash)`) where the all but the `inner_hash` is injected from the context (consumer = msg\_sender), and use it for the authentication check. Therefore, any allowed `innerHash` will therefore also have information around where it can be spent (version, chainId) and who can spend it (consumer). If using the `CallIntent`, the caller is the address that is making the call, for a token approval from Alice to Bob, this would be Bob. The action is then used along with the `caller` to compute the `innerHash` and the consumer.
**Value Type:** `any`
#### getMessageHashFromIntent[](#getmessagehashfromintent "Direct link to getMessageHashFromIntent")
**Type:** Function
Compute an authentication witness message hash from an intent and metadata. This is just a wrapper around computeAuthwitMessageHash that allows receiving an already computed messageHash as input
**Signature:**
```
export async getMessageHashFromIntent(
messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
chainInfo: ChainInfo
)
```
**Parameters:**
* `messageHashOrIntent`: `Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent`
* The precomputed messageHash or intent to approve (consumer and innerHash or caller and call/action)
* `chainInfo`: `ChainInfo`
**Returns:**
`Promise<Fr>` - The message hash for the intent
#### computeInnerAuthWitHashFromAction[](#computeinnerauthwithashfromaction "Direct link to computeInnerAuthWitHashFromAction")
**Type:** Constant
Computes the inner authwitness hash for either a function call or an action, for it to later be combined with the metadata required for the outer hash and eventually the full AuthWitness.
**Value Type:** `any`
#### lookupValidity[](#lookupvalidity "Direct link to lookupValidity")
**Type:** Function
Lookup the validity of an authwit in private and public contexts. Uses the chain id and version of the wallet.
**Signature:**
```
export async lookupValidity(
wallet: Wallet,
onBehalfOf: AztecAddress,
intent: IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
witness: AuthWitness
): Promise<{
isValidInPrivate: boolean;
isValidInPublic: boolean;
}>
```
**Parameters:**
* `wallet`: `Wallet`
* The wallet use to simulate and read the public data
* `onBehalfOf`: `AztecAddress`
* The address of the "approver"
* `intent`: `IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent`
* The consumer and inner hash or the caller and action to lookup
* `witness`: `AuthWitness`
* The computed authentication witness to check
**Returns:**
```
Promise<{
/** boolean flag indicating if the authwit is valid in private context */
isValidInPrivate: boolean;
/** boolean flag indicating if the authwit is valid in public context */
isValidInPublic: boolean;
}>
```
A struct containing the validity of the authwit in private and public contexts.
#### SetPublicAuthwitContractInteraction[](#setpublicauthwitcontractinteraction "Direct link to SetPublicAuthwitContractInteraction")
**Type:** Class
Convenience class designed to wrap the very common interaction of setting a public authwit in the AuthRegistry contract
**Extends:** `ContractFunctionInteraction`
#### Constructor[](#constructor-19 "Direct link to Constructor")
**Signature:**
```
private constructor(
wallet: Wallet,
private from: AztecAddress,
messageHash: Fr,
authorized: boolean
)
```
**Parameters:**
* `wallet`: `Wallet`
* `from`: `AztecAddress`
* `messageHash`: `Fr`
* `authorized`: `boolean`
#### Methods[](#methods-24 "Direct link to Methods")
##### create[](#create-1 "Direct link to create")
**Signature:**
```
static async create(
wallet: Wallet,
from: AztecAddress,
messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
authorized: boolean
)
```
**Parameters:**
* `wallet`: `Wallet프로젝트로 돌아가기