@aztec/aztec.js 3.0.0-canary.a9708bd → 3.0.0-devnet.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/account/account.d.ts +60 -0
- package/dest/account/account.d.ts.map +1 -0
- package/dest/account/account.js +59 -0
- package/dest/account/account_contract.d.ts +5 -5
- package/dest/account/account_contract.d.ts.map +1 -1
- package/dest/account/account_contract.js +0 -1
- package/dest/{wallet/account_wallet_with_private_key.d.ts → account/account_with_secret_key.d.ts} +7 -8
- package/dest/account/account_with_secret_key.d.ts.map +1 -0
- package/dest/{wallet/account_wallet_with_private_key.js → account/account_with_secret_key.js} +5 -5
- package/dest/account/index.d.ts +1 -4
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +1 -4
- package/dest/account/signerless_account.d.ts +24 -0
- package/dest/account/signerless_account.d.ts.map +1 -0
- package/dest/account/signerless_account.js +27 -0
- package/dest/api/abi.d.ts +1 -0
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/account.d.ts +4 -2
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +3 -1
- package/dest/api/addresses.d.ts +1 -0
- package/dest/api/addresses.d.ts.map +1 -1
- package/dest/api/addresses.js +1 -0
- package/dest/api/authorization.d.ts +2 -0
- package/dest/api/authorization.d.ts.map +1 -1
- package/dest/api/authorization.js +2 -0
- package/dest/api/block.d.ts +3 -0
- package/dest/api/block.d.ts.map +1 -0
- package/dest/api/block.js +2 -0
- package/dest/api/contract.d.ts +4 -5
- package/dest/api/contract.d.ts.map +1 -1
- package/dest/api/contract.js +3 -3
- package/dest/api/crypto.d.ts +2 -0
- package/dest/api/crypto.d.ts.map +1 -0
- package/dest/api/crypto.js +1 -0
- package/dest/api/ethereum.d.ts +0 -1
- package/dest/api/ethereum.d.ts.map +1 -1
- package/dest/api/ethereum.js +0 -1
- package/dest/api/events.d.ts +12 -0
- package/dest/api/events.d.ts.map +1 -0
- package/dest/api/events.js +30 -0
- package/dest/api/fee.d.ts +1 -2
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +0 -1
- package/dest/api/keys.d.ts +4 -0
- package/dest/api/keys.d.ts.map +1 -0
- package/dest/api/keys.js +3 -0
- package/dest/api/log.d.ts +1 -0
- package/dest/api/log.d.ts.map +1 -1
- package/dest/api/log.js +1 -0
- package/dest/api/messaging.d.ts +3 -0
- package/dest/api/messaging.d.ts.map +1 -0
- package/dest/api/messaging.js +2 -0
- package/dest/api/node.d.ts +21 -0
- package/dest/api/node.d.ts.map +1 -0
- package/dest/api/node.js +18 -0
- package/dest/api/note.d.ts +2 -0
- package/dest/api/note.d.ts.map +1 -0
- package/dest/api/note.js +1 -0
- package/dest/api/protocol.d.ts +3 -0
- package/dest/api/protocol.d.ts.map +1 -0
- package/dest/api/protocol.js +2 -0
- package/dest/api/trees.d.ts +3 -0
- package/dest/api/trees.d.ts.map +1 -0
- package/dest/api/trees.js +2 -0
- package/dest/api/tx.d.ts +2 -0
- package/dest/api/tx.d.ts.map +1 -0
- package/dest/api/tx.js +1 -0
- package/dest/api/utils.d.ts +10 -6
- package/dest/api/utils.d.ts.map +1 -1
- package/dest/api/utils.js +10 -5
- package/dest/api/wallet.d.ts +4 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +4 -1
- package/dest/contract/base_contract_interaction.d.ts +6 -48
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +6 -106
- package/dest/contract/batch_call.d.ts +6 -14
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +42 -52
- package/dest/contract/contract.d.ts +1 -1
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +2 -12
- package/dest/contract/contract_base.d.ts +1 -1
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.d.ts +29 -40
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +41 -53
- package/dest/contract/deploy_method.d.ts +63 -56
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +68 -86
- package/dest/contract/deploy_sent_tx.d.ts +0 -1
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +7 -10
- package/dest/contract/interaction_options.d.ts +74 -19
- package/dest/contract/interaction_options.d.ts.map +1 -1
- package/dest/contract/interaction_options.js +51 -3
- package/dest/contract/sent_tx.d.ts +3 -3
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +5 -5
- package/dest/contract/wait_for_proven.d.ts +3 -3
- package/dest/contract/wait_for_proven.d.ts.map +1 -1
- package/dest/contract/wait_for_proven.js +2 -2
- package/dest/deployment/publish_instance.d.ts +1 -1
- package/dest/deployment/publish_instance.d.ts.map +1 -1
- package/dest/deployment/publish_instance.js +2 -5
- package/dest/ethereum/portal_manager.d.ts +3 -4
- package/dest/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/ethereum/portal_manager.js +3 -5
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +12 -7
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +21 -12
- package/dest/fee/fee_payment_method.d.ts +26 -0
- package/dest/fee/fee_payment_method.d.ts.map +1 -0
- package/dest/fee/fee_payment_method.js +3 -0
- package/dest/fee/private_fee_payment_method.d.ts +22 -5
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +34 -13
- package/dest/fee/public_fee_payment_method.d.ts +22 -5
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +37 -14
- package/dest/fee/sponsored_fee_payment.d.ts +2 -0
- package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
- package/dest/fee/sponsored_fee_payment.js +4 -0
- package/dest/utils/authwit.d.ts +77 -25
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +219 -24
- package/dest/utils/cross_chain.d.ts +24 -0
- package/dest/utils/cross_chain.d.ts.map +1 -0
- package/dest/utils/cross_chain.js +30 -0
- package/dest/utils/fee_juice.d.ts +3 -2
- package/dest/utils/fee_juice.d.ts.map +1 -1
- package/dest/utils/fee_juice.js +3 -2
- package/dest/{fee → wallet}/account_entrypoint_meta_payment_method.d.ts +13 -10
- package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
- package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
- package/dest/wallet/account_manager.d.ts +69 -0
- package/dest/wallet/account_manager.d.ts.map +1 -0
- package/dest/wallet/account_manager.js +113 -0
- package/dest/wallet/base_wallet.d.ts +78 -35
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +216 -48
- package/dest/wallet/deploy_account_method.d.ts +52 -0
- package/dest/wallet/deploy_account_method.d.ts.map +1 -0
- package/dest/wallet/deploy_account_method.js +77 -0
- package/dest/wallet/index.d.ts +2 -15
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +2 -19
- package/dest/wallet/wallet.d.ts +2473 -6
- package/dest/wallet/wallet.d.ts.map +1 -1
- package/dest/wallet/wallet.js +202 -3
- package/package.json +25 -21
- package/src/account/account.ts +97 -0
- package/src/account/account_contract.ts +4 -6
- package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +6 -8
- package/src/account/index.ts +1 -4
- package/src/account/signerless_account.ts +46 -0
- package/src/api/abi.ts +11 -0
- package/src/api/account.ts +4 -2
- package/src/api/addresses.ts +1 -0
- package/src/api/authorization.ts +11 -0
- package/src/api/block.ts +2 -0
- package/src/api/contract.ts +16 -8
- package/src/api/crypto.ts +1 -0
- package/src/api/ethereum.ts +0 -1
- package/src/api/events.ts +44 -0
- package/src/api/fee.ts +1 -2
- package/src/api/keys.ts +8 -0
- package/src/api/log.ts +1 -0
- package/src/api/messaging.ts +2 -0
- package/src/api/node.ts +20 -0
- package/src/api/note.ts +1 -0
- package/src/api/protocol.ts +2 -0
- package/src/api/trees.ts +2 -0
- package/src/api/tx.ts +11 -0
- package/src/api/utils.ts +12 -19
- package/src/api/wallet.ts +33 -5
- package/src/contract/base_contract_interaction.ts +9 -138
- package/src/contract/batch_call.ts +52 -61
- package/src/contract/contract.ts +2 -12
- package/src/contract/contract_function_interaction.ts +65 -97
- package/src/contract/deploy_method.ts +117 -99
- package/src/contract/deploy_sent_tx.ts +4 -10
- package/src/contract/interaction_options.ts +126 -24
- package/src/contract/sent_tx.ts +4 -4
- package/src/contract/wait_for_proven.ts +4 -4
- package/src/deployment/publish_instance.ts +3 -8
- package/src/ethereum/portal_manager.ts +4 -12
- package/src/fee/fee_juice_payment_method_with_claim.ts +26 -17
- package/src/fee/fee_payment_method.ts +26 -0
- package/src/fee/private_fee_payment_method.ts +60 -41
- package/src/fee/public_fee_payment_method.ts +73 -49
- package/src/fee/sponsored_fee_payment.ts +6 -0
- package/src/utils/authwit.ts +250 -38
- package/src/utils/cross_chain.ts +53 -0
- package/src/utils/fee_juice.ts +4 -3
- package/src/wallet/account_entrypoint_meta_payment_method.ts +105 -0
- package/src/wallet/account_manager.ts +154 -0
- package/src/wallet/base_wallet.ts +287 -78
- package/src/wallet/deploy_account_method.ts +125 -0
- package/src/wallet/index.ts +2 -32
- package/src/wallet/wallet.ts +357 -29
- package/dest/account_manager/account_manager.d.ts +0 -119
- package/dest/account_manager/account_manager.d.ts.map +0 -1
- package/dest/account_manager/account_manager.js +0 -202
- package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
- package/dest/account_manager/deploy_account_sent_tx.js +0 -29
- package/dest/account_manager/index.d.ts +0 -3
- package/dest/account_manager/index.d.ts.map +0 -1
- package/dest/account_manager/index.js +0 -2
- package/dest/api/interfaces.d.ts +0 -2
- package/dest/api/interfaces.d.ts.map +0 -1
- package/dest/api/interfaces.js +0 -1
- package/dest/api/log_id.d.ts +0 -2
- package/dest/api/log_id.d.ts.map +0 -1
- package/dest/api/log_id.js +0 -1
- package/dest/api/rpc.d.ts +0 -3
- package/dest/api/rpc.d.ts.map +0 -1
- package/dest/api/rpc.js +0 -2
- package/dest/api/tx_hash.d.ts +0 -2
- package/dest/api/tx_hash.d.ts.map +0 -1
- package/dest/api/tx_hash.js +0 -1
- package/dest/contract/deploy_proven_tx.d.ts +0 -21
- package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
- package/dest/contract/deploy_proven_tx.js +0 -21
- package/dest/contract/proven_tx.d.ts +0 -21
- package/dest/contract/proven_tx.d.ts.map +0 -1
- package/dest/contract/proven_tx.js +0 -23
- package/dest/ethereum/l1_contracts.d.ts +0 -3
- package/dest/ethereum/l1_contracts.d.ts.map +0 -1
- package/dest/ethereum/l1_contracts.js +0 -13
- package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +0 -1
- package/dest/fee/account_entrypoint_meta_payment_method.js +0 -64
- package/dest/fee/fee_juice_payment_method.d.ts +0 -14
- package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
- package/dest/fee/fee_juice_payment_method.js +0 -21
- package/dest/fee/utils.d.ts +0 -13
- package/dest/fee/utils.d.ts.map +0 -1
- package/dest/fee/utils.js +0 -32
- package/dest/index.d.ts +0 -59
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -62
- package/dest/rpc_clients/node/index.d.ts +0 -12
- package/dest/rpc_clients/node/index.d.ts.map +0 -1
- package/dest/rpc_clients/node/index.js +0 -72
- package/dest/rpc_clients/pxe_client.d.ts +0 -10
- package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
- package/dest/rpc_clients/pxe_client.js +0 -23
- package/dest/utils/pxe.d.ts +0 -4
- package/dest/utils/pxe.d.ts.map +0 -1
- package/dest/utils/pxe.js +0 -14
- package/dest/wallet/account_wallet.d.ts +0 -74
- package/dest/wallet/account_wallet.d.ts.map +0 -1
- package/dest/wallet/account_wallet.js +0 -232
- package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.d.ts +0 -23
- package/dest/wallet/signerless_wallet.d.ts.map +0 -1
- package/dest/wallet/signerless_wallet.js +0 -33
- package/src/account_manager/account_manager.ts +0 -276
- package/src/account_manager/deploy_account_sent_tx.ts +0 -46
- package/src/account_manager/index.ts +0 -2
- package/src/api/interfaces.ts +0 -1
- package/src/api/log_id.ts +0 -1
- package/src/api/rpc.ts +0 -2
- package/src/api/tx_hash.ts +0 -1
- package/src/contract/deploy_proven_tx.ts +0 -45
- package/src/contract/proven_tx.ts +0 -36
- package/src/ethereum/l1_contracts.ts +0 -21
- package/src/fee/account_entrypoint_meta_payment_method.ts +0 -89
- package/src/fee/fee_juice_payment_method.ts +0 -25
- package/src/fee/utils.ts +0 -39
- package/src/index.ts +0 -85
- package/src/rpc_clients/node/index.ts +0 -77
- package/src/rpc_clients/pxe_client.ts +0 -25
- package/src/utils/pxe.ts +0 -17
- package/src/wallet/account_wallet.ts +0 -246
- package/src/wallet/signerless_wallet.ts +0 -56
|
@@ -5,9 +5,8 @@ import type { Logger } from '@aztec/foundation/log';
|
|
|
5
5
|
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
6
6
|
import { TokenPortalAbi } from '@aztec/l1-artifacts/TokenPortalAbi';
|
|
7
7
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
|
-
import type {
|
|
8
|
+
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
9
9
|
import { type Hex } from 'viem';
|
|
10
|
-
import type { Wallet } from '../index.js';
|
|
11
10
|
/** L1 to L2 message info to claim it on L2. */
|
|
12
11
|
export type L2Claim = {
|
|
13
12
|
/** Secret for claiming. */
|
|
@@ -85,11 +84,11 @@ export declare class L1FeeJuicePortalManager {
|
|
|
85
84
|
bridgeTokensPublic(to: AztecAddress, amount: bigint | undefined, mint?: boolean): Promise<L2AmountClaim>;
|
|
86
85
|
/**
|
|
87
86
|
* Creates a new instance
|
|
88
|
-
* @param
|
|
87
|
+
* @param node - Aztec node client used for retrieving the L1 contract addresses.
|
|
89
88
|
* @param extendedClient - Wallet client, extended with public actions.
|
|
90
89
|
* @param logger - Logger.
|
|
91
90
|
*/
|
|
92
|
-
static new(
|
|
91
|
+
static new(node: AztecNode, extendedClient: ExtendedViemWalletClient, logger: Logger): Promise<L1FeeJuicePortalManager>;
|
|
93
92
|
}
|
|
94
93
|
/** Helper for interacting with a test TokenPortal on L1 for sending tokens to L2. */
|
|
95
94
|
export declare class L1ToL2TokenPortalManager {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal_manager.d.ts","sourceRoot":"","sources":["../../src/ethereum/portal_manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAK3D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"portal_manager.d.ts","sourceRoot":"","sources":["../../src/ethereum/portal_manager.ts"],"names":[],"mappings":"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"}
|
|
@@ -149,11 +149,11 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
149
149
|
}
|
|
150
150
|
/**
|
|
151
151
|
* Creates a new instance
|
|
152
|
-
* @param
|
|
152
|
+
* @param node - Aztec node client used for retrieving the L1 contract addresses.
|
|
153
153
|
* @param extendedClient - Wallet client, extended with public actions.
|
|
154
154
|
* @param logger - Logger.
|
|
155
|
-
*/ static async new(
|
|
156
|
-
const { l1ContractAddresses: { feeJuiceAddress, feeJuicePortalAddress, feeAssetHandlerAddress } } = await
|
|
155
|
+
*/ static async new(node, extendedClient, logger) {
|
|
156
|
+
const { l1ContractAddresses: { feeJuiceAddress, feeJuicePortalAddress, feeAssetHandlerAddress } } = await node.getNodeInfo();
|
|
157
157
|
if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
|
|
158
158
|
throw new Error('Portal or token not deployed on L1');
|
|
159
159
|
}
|
|
@@ -206,14 +206,12 @@ import { getContract, toFunctionSelector } from 'viem';
|
|
|
206
206
|
messageLeafIndex: log.args.index
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
// docs:start:bridge_tokens_private
|
|
210
209
|
/**
|
|
211
210
|
* Bridges tokens from L1 to L2 privately. Handles token approvals. Returns once the tx has been mined.
|
|
212
211
|
* @param to - Address to send the tokens to on L2.
|
|
213
212
|
* @param amount - Amount of tokens to send.
|
|
214
213
|
* @param mint - Whether to mint the tokens before sending (only during testing).
|
|
215
214
|
*/ async bridgeTokensPrivate(to, amount, mint = false) {
|
|
216
|
-
// docs:end:bridge_tokens_private
|
|
217
215
|
const [claimSecret, claimSecretHash] = await this.bridgeSetup(amount, mint);
|
|
218
216
|
this.logger.info('Sending L1 tokens to L2 to be claimed privately');
|
|
219
217
|
const { request } = await this.portal.simulate.depositToAztecPrivate([
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
2
4
|
import type { L2AmountClaim } from '../ethereum/portal_manager.js';
|
|
3
|
-
import type {
|
|
4
|
-
import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
5
|
+
import type { FeePaymentMethod } from './fee_payment_method.js';
|
|
5
6
|
/**
|
|
6
|
-
* Pay fee directly with Fee Juice claimed
|
|
7
|
+
* Pay fee directly with Fee Juice claimed in the same tx. Claiming consumes an L1 to L2 message that "contains"
|
|
8
|
+
* the fee juice bridged from L1.
|
|
7
9
|
*/
|
|
8
|
-
export declare class FeeJuicePaymentMethodWithClaim
|
|
9
|
-
private
|
|
10
|
+
export declare class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
|
|
11
|
+
private sender;
|
|
10
12
|
private claim;
|
|
11
|
-
constructor(
|
|
13
|
+
constructor(sender: AztecAddress, claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>);
|
|
12
14
|
/**
|
|
13
15
|
* Creates an execution payload to pay the fee in Fee Juice.
|
|
14
|
-
* @returns An execution payload that just contains the
|
|
16
|
+
* @returns An execution payload that just contains the `claim_and_end_setup` function call.
|
|
15
17
|
*/
|
|
16
18
|
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
19
|
+
getAsset(): Promise<AztecAddress>;
|
|
20
|
+
getFeePayer(): Promise<AztecAddress>;
|
|
21
|
+
getGasSettings(): GasSettings | undefined;
|
|
17
22
|
}
|
|
18
23
|
//# sourceMappingURL=fee_juice_payment_method_with_claim.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee_juice_payment_method_with_claim.d.ts","sourceRoot":"","sources":["../../src/fee/fee_juice_payment_method_with_claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"fee_juice_payment_method_with_claim.d.ts","sourceRoot":"","sources":["../../src/fee/fee_juice_payment_method_with_claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,qBAAa,8BAA+B,YAAW,gBAAgB;IAEnE,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;gBADL,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAGxF;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IA0BtD,QAAQ;IAIR,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAIpC,cAAc,IAAI,WAAW,GAAG,SAAS;CAG1C"}
|
|
@@ -2,30 +2,30 @@ import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
4
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
5
|
-
import { getFeeJuice } from '../contract/protocol_contracts.js';
|
|
6
|
-
import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
7
5
|
/**
|
|
8
|
-
* Pay fee directly with Fee Juice claimed
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
* Pay fee directly with Fee Juice claimed in the same tx. Claiming consumes an L1 to L2 message that "contains"
|
|
7
|
+
* the fee juice bridged from L1.
|
|
8
|
+
*/ export class FeeJuicePaymentMethodWithClaim {
|
|
9
|
+
sender;
|
|
11
10
|
claim;
|
|
12
|
-
constructor(
|
|
13
|
-
|
|
11
|
+
constructor(sender, claim){
|
|
12
|
+
this.sender = sender;
|
|
13
|
+
this.claim = claim;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Creates an execution payload to pay the fee in Fee Juice.
|
|
17
|
-
* @returns An execution payload that just contains the
|
|
17
|
+
* @returns An execution payload that just contains the `claim_and_end_setup` function call.
|
|
18
18
|
*/ async getExecutionPayload() {
|
|
19
|
-
const
|
|
20
|
-
const selector = await FunctionSelector.fromNameAndParameters(canonicalFeeJuice.artifact.functions.find((f)=>f.name === 'claim'));
|
|
19
|
+
const selector = await FunctionSelector.fromSignature('claim_and_end_setup((Field),u128,Field,Field)');
|
|
21
20
|
return new ExecutionPayload([
|
|
22
21
|
{
|
|
23
22
|
to: ProtocolContractAddress.FeeJuice,
|
|
24
|
-
name: '
|
|
23
|
+
name: 'claim_and_end_setup',
|
|
25
24
|
selector,
|
|
25
|
+
hideMsgSender: false,
|
|
26
26
|
isStatic: false,
|
|
27
27
|
args: [
|
|
28
|
-
this.
|
|
28
|
+
this.sender.toField(),
|
|
29
29
|
new Fr(this.claim.claimAmount),
|
|
30
30
|
this.claim.claimSecret,
|
|
31
31
|
new Fr(this.claim.messageLeafIndex)
|
|
@@ -35,4 +35,13 @@ import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
|
35
35
|
}
|
|
36
36
|
], [], []);
|
|
37
37
|
}
|
|
38
|
+
getAsset() {
|
|
39
|
+
return Promise.resolve(ProtocolContractAddress.FeeJuice);
|
|
40
|
+
}
|
|
41
|
+
getFeePayer() {
|
|
42
|
+
return Promise.resolve(this.sender);
|
|
43
|
+
}
|
|
44
|
+
getGasSettings() {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
38
47
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
4
|
+
/**
|
|
5
|
+
* Holds information about how the fee for a transaction is to be paid.
|
|
6
|
+
*/
|
|
7
|
+
export interface FeePaymentMethod {
|
|
8
|
+
/** The asset used to pay the fee. */
|
|
9
|
+
getAsset(): Promise<AztecAddress>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the data to be added to the final execution request
|
|
12
|
+
* to pay the fee in the given asset
|
|
13
|
+
* @returns The function calls to pay the fee.
|
|
14
|
+
*/
|
|
15
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
16
|
+
/**
|
|
17
|
+
* The expected fee payer for this tx.
|
|
18
|
+
*/
|
|
19
|
+
getFeePayer(): Promise<AztecAddress>;
|
|
20
|
+
/**
|
|
21
|
+
* The gas settings (if any) used to compute the
|
|
22
|
+
* execution payload of the payment method
|
|
23
|
+
*/
|
|
24
|
+
getGasSettings(): GasSettings | undefined;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=fee_payment_method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjD;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,IAAI,WAAW,GAAG,SAAS,CAAC;CAC3C"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FeePaymentMethod } from '@aztec/entrypoints/interfaces';
|
|
2
1
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
|
-
import
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
3
|
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
5
4
|
import type { Wallet } from '../wallet/wallet.js';
|
|
5
|
+
import type { FeePaymentMethod } from './fee_payment_method.js';
|
|
6
6
|
/**
|
|
7
7
|
* Holds information about how the fee for a transaction is to be paid.
|
|
8
8
|
*/
|
|
@@ -12,9 +12,17 @@ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
12
12
|
*/
|
|
13
13
|
private paymentContract;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Address of the account that will pay the fee
|
|
16
|
+
*/
|
|
17
|
+
private sender;
|
|
18
|
+
/**
|
|
19
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
16
20
|
*/
|
|
17
21
|
private wallet;
|
|
22
|
+
/**
|
|
23
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
24
|
+
*/
|
|
25
|
+
protected gasSettings: GasSettings;
|
|
18
26
|
/**
|
|
19
27
|
* If true, the max fee will be set to 1.
|
|
20
28
|
* TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
|
|
@@ -27,9 +35,17 @@ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
27
35
|
*/
|
|
28
36
|
paymentContract: AztecAddress,
|
|
29
37
|
/**
|
|
30
|
-
*
|
|
38
|
+
* Address of the account that will pay the fee
|
|
39
|
+
*/
|
|
40
|
+
sender: AztecAddress,
|
|
41
|
+
/**
|
|
42
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
31
43
|
*/
|
|
32
44
|
wallet: Wallet,
|
|
45
|
+
/**
|
|
46
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
47
|
+
*/
|
|
48
|
+
gasSettings: GasSettings,
|
|
33
49
|
/**
|
|
34
50
|
* If true, the max fee will be set to 1.
|
|
35
51
|
* TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
|
|
@@ -46,6 +62,7 @@ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
|
|
|
46
62
|
* @param gasSettings - The gas settings.
|
|
47
63
|
* @returns An execution payload that contains the required function calls and auth witnesses.
|
|
48
64
|
*/
|
|
49
|
-
getExecutionPayload(
|
|
65
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
66
|
+
getGasSettings(): GasSettings | undefined;
|
|
50
67
|
}
|
|
51
68
|
//# sourceMappingURL=private_fee_payment_method.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/private_fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"private_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/private_fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAI5D;;OAEG;IACH,OAAO,CAAC,eAAe;IAEvB;;OAEG;IACH,OAAO,CAAC,MAAM;IAEd;;OAEG;IACH,OAAO,CAAC,MAAM;IACd;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW;IAClC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAzBxB,OAAO,CAAC,YAAY,CAAsC;;IAGxD;;OAEG;IACK,eAAe,EAAE,YAAY;IAErC;;OAEG;IACK,MAAM,EAAE,YAAY;IAE5B;;OAEG;IACK,MAAM,EAAE,MAAM;IACtB;;OAEG;IACO,WAAW,EAAE,WAAW;IAClC;;;OAGG;IACK,cAAc,UAAQ;IAGhC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAyCvC,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAIpC;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAsCtD,cAAc,IAAI,WAAW,GAAG,SAAS;CAG1C"}
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
4
|
-
import {
|
|
3
|
+
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
5
6
|
/**
|
|
6
7
|
* Holds information about how the fee for a transaction is to be paid.
|
|
7
8
|
*/ export class PrivateFeePaymentMethod {
|
|
8
9
|
paymentContract;
|
|
10
|
+
sender;
|
|
9
11
|
wallet;
|
|
12
|
+
gasSettings;
|
|
10
13
|
setMaxFeeToOne;
|
|
11
14
|
assetPromise;
|
|
12
15
|
constructor(/**
|
|
13
16
|
* Address which will hold the fee payment.
|
|
14
17
|
*/ paymentContract, /**
|
|
15
|
-
*
|
|
18
|
+
* Address of the account that will pay the fee
|
|
19
|
+
*/ sender, /**
|
|
20
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
16
21
|
*/ wallet, /**
|
|
22
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
23
|
+
*/ gasSettings, /**
|
|
17
24
|
* If true, the max fee will be set to 1.
|
|
18
25
|
* TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
|
|
19
26
|
*/ setMaxFeeToOne = false){
|
|
20
27
|
this.paymentContract = paymentContract;
|
|
28
|
+
this.sender = sender;
|
|
21
29
|
this.wallet = wallet;
|
|
30
|
+
this.gasSettings = gasSettings;
|
|
22
31
|
this.setMaxFeeToOne = setMaxFeeToOne;
|
|
23
32
|
this.assetPromise = null;
|
|
24
33
|
}
|
|
25
34
|
/**
|
|
26
35
|
* The asset used to pay the fee.
|
|
27
36
|
* @returns The asset used to pay the fee.
|
|
28
|
-
*/ getAsset() {
|
|
37
|
+
*/ async getAsset() {
|
|
29
38
|
if (!this.assetPromise) {
|
|
30
|
-
|
|
31
|
-
// before the associated account is deployed.
|
|
32
|
-
this.assetPromise = simulateWithoutSignature(this.wallet, this.paymentContract, {
|
|
39
|
+
const abi = {
|
|
33
40
|
name: 'get_accepted_asset',
|
|
34
41
|
functionType: FunctionType.PRIVATE,
|
|
35
42
|
isInternal: false,
|
|
@@ -51,7 +58,16 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
51
58
|
],
|
|
52
59
|
errorTypes: {},
|
|
53
60
|
isInitializer: false
|
|
54
|
-
}
|
|
61
|
+
};
|
|
62
|
+
const interaction = new ContractFunctionInteraction(this.wallet, this.paymentContract, abi, []);
|
|
63
|
+
const executionPayload = await interaction.request();
|
|
64
|
+
this.assetPromise = this.wallet.simulateTx(executionPayload, {
|
|
65
|
+
from: AztecAddress.ZERO,
|
|
66
|
+
skipFeeEnforcement: true
|
|
67
|
+
}).then((simulationResult)=>{
|
|
68
|
+
const rawReturnValues = simulationResult.getPrivateReturnValues().nested[0].values;
|
|
69
|
+
return decodeFromAbi(abi.returnTypes, rawReturnValues);
|
|
70
|
+
});
|
|
55
71
|
}
|
|
56
72
|
return this.assetPromise;
|
|
57
73
|
}
|
|
@@ -62,23 +78,24 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
62
78
|
* Creates an execution payload to pay the fee using a private function through an FPC in the desired asset
|
|
63
79
|
* @param gasSettings - The gas settings.
|
|
64
80
|
* @returns An execution payload that contains the required function calls and auth witnesses.
|
|
65
|
-
*/ async getExecutionPayload(
|
|
81
|
+
*/ async getExecutionPayload() {
|
|
66
82
|
// We assume 1:1 exchange rate between fee juice and token. But in reality you would need to convert feeLimit
|
|
67
83
|
// (maxFee) to be in token denomination.
|
|
68
|
-
const maxFee = this.setMaxFeeToOne ? Fr.ONE : gasSettings.getFeeLimit();
|
|
84
|
+
const maxFee = this.setMaxFeeToOne ? Fr.ONE : this.gasSettings.getFeeLimit();
|
|
69
85
|
const txNonce = Fr.random();
|
|
70
|
-
const witness = await this.wallet.createAuthWit({
|
|
86
|
+
const witness = await this.wallet.createAuthWit(this.sender, {
|
|
71
87
|
caller: this.paymentContract,
|
|
72
|
-
|
|
88
|
+
call: {
|
|
73
89
|
name: 'transfer_to_public',
|
|
74
90
|
args: [
|
|
75
|
-
this.
|
|
91
|
+
this.sender.toField(),
|
|
76
92
|
this.paymentContract.toField(),
|
|
77
93
|
maxFee,
|
|
78
94
|
txNonce
|
|
79
95
|
],
|
|
80
96
|
selector: await FunctionSelector.fromSignature('transfer_to_public((Field),(Field),u128,Field)'),
|
|
81
97
|
type: FunctionType.PRIVATE,
|
|
98
|
+
hideMsgSender: false,
|
|
82
99
|
isStatic: false,
|
|
83
100
|
to: await this.getAsset(),
|
|
84
101
|
returnTypes: []
|
|
@@ -90,6 +107,7 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
90
107
|
to: this.paymentContract,
|
|
91
108
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_private(u128,Field)'),
|
|
92
109
|
type: FunctionType.PRIVATE,
|
|
110
|
+
hideMsgSender: false,
|
|
93
111
|
isStatic: false,
|
|
94
112
|
args: [
|
|
95
113
|
maxFee,
|
|
@@ -101,4 +119,7 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
101
119
|
witness
|
|
102
120
|
], []);
|
|
103
121
|
}
|
|
122
|
+
getGasSettings() {
|
|
123
|
+
return this.gasSettings;
|
|
124
|
+
}
|
|
104
125
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FeePaymentMethod } from '@aztec/entrypoints/interfaces';
|
|
2
1
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
3
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
5
|
-
import type {
|
|
4
|
+
import type { Wallet } from '../wallet/wallet.js';
|
|
5
|
+
import type { FeePaymentMethod } from './fee_payment_method.js';
|
|
6
6
|
/**
|
|
7
7
|
* Holds information about how the fee for a transaction is to be paid.
|
|
8
8
|
*/
|
|
@@ -14,7 +14,15 @@ export declare class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
14
14
|
/**
|
|
15
15
|
* An auth witness provider to authorize fee payments
|
|
16
16
|
*/
|
|
17
|
-
protected
|
|
17
|
+
protected sender: AztecAddress;
|
|
18
|
+
/**
|
|
19
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
20
|
+
*/
|
|
21
|
+
protected wallet: Wallet;
|
|
22
|
+
/**
|
|
23
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
24
|
+
*/
|
|
25
|
+
protected gasSettings: GasSettings;
|
|
18
26
|
private assetPromise;
|
|
19
27
|
constructor(
|
|
20
28
|
/**
|
|
@@ -24,7 +32,15 @@ export declare class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
24
32
|
/**
|
|
25
33
|
* An auth witness provider to authorize fee payments
|
|
26
34
|
*/
|
|
27
|
-
|
|
35
|
+
sender: AztecAddress,
|
|
36
|
+
/**
|
|
37
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
38
|
+
*/
|
|
39
|
+
wallet: Wallet,
|
|
40
|
+
/**
|
|
41
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
42
|
+
*/
|
|
43
|
+
gasSettings: GasSettings);
|
|
28
44
|
/**
|
|
29
45
|
* The asset used to pay the fee.
|
|
30
46
|
* @returns The asset used to pay the fee.
|
|
@@ -36,6 +52,7 @@ export declare class PublicFeePaymentMethod implements FeePaymentMethod {
|
|
|
36
52
|
* @param gasSettings - The gas settings.
|
|
37
53
|
* @returns An execution payload that contains the required function calls.
|
|
38
54
|
*/
|
|
39
|
-
getExecutionPayload(
|
|
55
|
+
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
56
|
+
getGasSettings(): GasSettings | undefined;
|
|
40
57
|
}
|
|
41
58
|
//# sourceMappingURL=public_fee_payment_method.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/public_fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"public_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/public_fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,qBAAa,sBAAuB,YAAW,gBAAgB;IAI3D;;OAEG;IACH,SAAS,CAAC,eAAe,EAAE,YAAY;IACvC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,YAAY;IAC9B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW;IAlBpC,OAAO,CAAC,YAAY,CAAsC;;IAGxD;;OAEG;IACO,eAAe,EAAE,YAAY;IACvC;;OAEG;IACO,MAAM,EAAE,YAAY;IAC9B;;OAEG;IACO,MAAM,EAAE,MAAM;IACxB;;OAEG;IACO,WAAW,EAAE,WAAW;IAGpC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAyCvC,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAIpC;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IA4CtD,cAAc,IAAI,WAAW,GAAG,SAAS;CAG1C"}
|
|
@@ -1,30 +1,38 @@
|
|
|
1
1
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
4
|
-
import {
|
|
3
|
+
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
4
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
6
|
+
import { SetPublicAuthwitContractInteraction } from '../utils/authwit.js';
|
|
5
7
|
/**
|
|
6
8
|
* Holds information about how the fee for a transaction is to be paid.
|
|
7
9
|
*/ export class PublicFeePaymentMethod {
|
|
8
10
|
paymentContract;
|
|
11
|
+
sender;
|
|
9
12
|
wallet;
|
|
13
|
+
gasSettings;
|
|
10
14
|
assetPromise;
|
|
11
15
|
constructor(/**
|
|
12
16
|
* Address which will hold the fee payment.
|
|
13
17
|
*/ paymentContract, /**
|
|
14
18
|
* An auth witness provider to authorize fee payments
|
|
15
|
-
*/
|
|
19
|
+
*/ sender, /**
|
|
20
|
+
* A wallet to perform the simulation to get the accepted asset
|
|
21
|
+
*/ wallet, /**
|
|
22
|
+
* Gas settings used to compute the maximum fee the user is willing to pay
|
|
23
|
+
*/ gasSettings){
|
|
16
24
|
this.paymentContract = paymentContract;
|
|
25
|
+
this.sender = sender;
|
|
17
26
|
this.wallet = wallet;
|
|
27
|
+
this.gasSettings = gasSettings;
|
|
18
28
|
this.assetPromise = null;
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
31
|
* The asset used to pay the fee.
|
|
22
32
|
* @returns The asset used to pay the fee.
|
|
23
|
-
*/ getAsset() {
|
|
33
|
+
*/ async getAsset() {
|
|
24
34
|
if (!this.assetPromise) {
|
|
25
|
-
|
|
26
|
-
// before the associated account is deployed.
|
|
27
|
-
this.assetPromise = simulateWithoutSignature(this.wallet, this.paymentContract, {
|
|
35
|
+
const abi = {
|
|
28
36
|
name: 'get_accepted_asset',
|
|
29
37
|
functionType: FunctionType.PRIVATE,
|
|
30
38
|
isInternal: false,
|
|
@@ -46,7 +54,16 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
46
54
|
],
|
|
47
55
|
errorTypes: {},
|
|
48
56
|
isInitializer: false
|
|
49
|
-
}
|
|
57
|
+
};
|
|
58
|
+
const interaction = new ContractFunctionInteraction(this.wallet, this.paymentContract, abi, []);
|
|
59
|
+
const executionPayload = await interaction.request();
|
|
60
|
+
this.assetPromise = this.wallet.simulateTx(executionPayload, {
|
|
61
|
+
from: AztecAddress.ZERO,
|
|
62
|
+
skipFeeEnforcement: true
|
|
63
|
+
}).then((simulationResult)=>{
|
|
64
|
+
const rawReturnValues = simulationResult.getPrivateReturnValues().nested[0].values;
|
|
65
|
+
return decodeFromAbi(abi.returnTypes, rawReturnValues);
|
|
66
|
+
});
|
|
50
67
|
}
|
|
51
68
|
return this.assetPromise;
|
|
52
69
|
}
|
|
@@ -57,15 +74,15 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
57
74
|
* Creates an execution payload to pay the fee using a public function through an FPC in the desired asset
|
|
58
75
|
* @param gasSettings - The gas settings.
|
|
59
76
|
* @returns An execution payload that contains the required function calls.
|
|
60
|
-
*/ async getExecutionPayload(
|
|
77
|
+
*/ async getExecutionPayload() {
|
|
61
78
|
const txNonce = Fr.random();
|
|
62
|
-
const maxFee = gasSettings.getFeeLimit();
|
|
63
|
-
const
|
|
79
|
+
const maxFee = this.gasSettings.getFeeLimit();
|
|
80
|
+
const intent = {
|
|
64
81
|
caller: this.paymentContract,
|
|
65
|
-
|
|
82
|
+
call: {
|
|
66
83
|
name: 'transfer_in_public',
|
|
67
84
|
args: [
|
|
68
|
-
this.
|
|
85
|
+
this.sender.toField(),
|
|
69
86
|
this.paymentContract.toField(),
|
|
70
87
|
maxFee,
|
|
71
88
|
txNonce
|
|
@@ -73,10 +90,12 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
73
90
|
selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
|
|
74
91
|
type: FunctionType.PUBLIC,
|
|
75
92
|
isStatic: false,
|
|
93
|
+
hideMsgSender: false,
|
|
76
94
|
to: await this.getAsset(),
|
|
77
95
|
returnTypes: []
|
|
78
96
|
}
|
|
79
|
-
}
|
|
97
|
+
};
|
|
98
|
+
const setPublicAuthWitInteraction = await SetPublicAuthwitContractInteraction.create(this.wallet, this.sender, intent, true);
|
|
80
99
|
return new ExecutionPayload([
|
|
81
100
|
...(await setPublicAuthWitInteraction.request()).calls,
|
|
82
101
|
{
|
|
@@ -84,6 +103,7 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
84
103
|
to: this.paymentContract,
|
|
85
104
|
selector: await FunctionSelector.fromSignature('fee_entrypoint_public(u128,Field)'),
|
|
86
105
|
type: FunctionType.PRIVATE,
|
|
106
|
+
hideMsgSender: false,
|
|
87
107
|
isStatic: false,
|
|
88
108
|
args: [
|
|
89
109
|
maxFee,
|
|
@@ -93,4 +113,7 @@ import { simulateWithoutSignature } from './utils.js';
|
|
|
93
113
|
}
|
|
94
114
|
], [], []);
|
|
95
115
|
}
|
|
116
|
+
getGasSettings() {
|
|
117
|
+
return this.gasSettings;
|
|
118
|
+
}
|
|
96
119
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
2
2
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
|
3
3
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
4
5
|
/**
|
|
5
6
|
* A fee payment method that uses a contract that blindly sponsors transactions.
|
|
6
7
|
* This contract is expected to be prefunded in testing environments.
|
|
@@ -11,5 +12,6 @@ export declare class SponsoredFeePaymentMethod implements FeePaymentMethod {
|
|
|
11
12
|
getAsset(): Promise<AztecAddress>;
|
|
12
13
|
getFeePayer(): Promise<AztecAddress>;
|
|
13
14
|
getExecutionPayload(): Promise<ExecutionPayload>;
|
|
15
|
+
getGasSettings(): GasSettings | undefined;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=sponsored_fee_payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/fee/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/fee/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IACpD,OAAO,CAAC,eAAe;gBAAf,eAAe,EAAE,YAAY;IAEjD,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAIjC,WAAW;IAIL,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAmBtD,cAAc,IAAI,WAAW,GAAG,SAAS;CAG1C"}
|
|
@@ -21,10 +21,14 @@ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
|
21
21
|
to: this.paymentContract,
|
|
22
22
|
selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
|
|
23
23
|
type: FunctionType.PRIVATE,
|
|
24
|
+
hideMsgSender: false,
|
|
24
25
|
isStatic: false,
|
|
25
26
|
args: [],
|
|
26
27
|
returnTypes: []
|
|
27
28
|
}
|
|
28
29
|
], [], []);
|
|
29
30
|
}
|
|
31
|
+
getGasSettings() {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
30
34
|
}
|