@aztec/aztec.js 0.76.4 → 0.77.0-testnet-ignition.21
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/contract.d.ts +9 -5
- package/dest/account/contract.d.ts.map +1 -1
- package/dest/account/contract.js +15 -2
- package/dest/account/index.d.ts +2 -2
- package/dest/account/index.d.ts.map +1 -1
- package/dest/account/index.js +8 -1
- package/dest/account/interface.d.ts +5 -4
- package/dest/account/interface.d.ts.map +1 -1
- package/dest/account/interface.js +4 -3
- package/dest/account/wallet.d.ts +4 -3
- package/dest/account/wallet.d.ts.map +1 -1
- package/dest/account/wallet.js +3 -2
- package/dest/account_manager/deploy_account_method.d.ts +5 -5
- package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_method.js +22 -25
- package/dest/account_manager/deploy_account_sent_tx.d.ts +4 -3
- package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
- package/dest/account_manager/deploy_account_sent_tx.js +16 -17
- package/dest/account_manager/index.d.ts +20 -11
- package/dest/account_manager/index.d.ts.map +1 -1
- package/dest/account_manager/index.js +89 -87
- package/dest/api/abi.d.ts +2 -3
- package/dest/api/abi.d.ts.map +1 -1
- package/dest/api/abi.js +1 -3
- package/dest/api/account.d.ts +1 -2
- package/dest/api/account.d.ts.map +1 -1
- package/dest/api/account.js +1 -2
- package/dest/api/addresses.d.ts +2 -2
- package/dest/api/addresses.d.ts.map +1 -1
- package/dest/api/addresses.js +2 -3
- package/dest/api/cheat_codes.d.ts +4 -4
- package/dest/api/cheat_codes.d.ts.map +1 -1
- package/dest/api/cheat_codes.js +10 -15
- package/dest/api/deployment.js +0 -1
- package/dest/api/entrypoint.js +0 -1
- package/dest/api/eth_address.js +0 -1
- package/dest/api/ethereum/anvil_test_watcher.d.ts +10 -6
- package/dest/api/ethereum/anvil_test_watcher.d.ts.map +1 -1
- package/dest/api/ethereum/anvil_test_watcher.js +43 -18
- package/dest/api/ethereum/chain_monitor.d.ts +6 -2
- package/dest/api/ethereum/chain_monitor.d.ts.map +1 -1
- package/dest/api/ethereum/chain_monitor.js +24 -8
- package/dest/api/ethereum/cheat_codes.d.ts +14 -3
- package/dest/api/ethereum/cheat_codes.d.ts.map +1 -1
- package/dest/api/ethereum/cheat_codes.js +106 -53
- package/dest/api/ethereum/index.d.ts +1 -1
- package/dest/api/ethereum/index.d.ts.map +1 -1
- package/dest/api/ethereum/index.js +1 -2
- package/dest/api/ethereum/l1_contracts.d.ts +1 -1
- package/dest/api/ethereum/l1_contracts.d.ts.map +1 -1
- package/dest/api/ethereum/l1_contracts.js +4 -6
- package/dest/api/ethereum/portal_manager.d.ts +16 -12
- package/dest/api/ethereum/portal_manager.d.ts.map +1 -1
- package/dest/api/ethereum/portal_manager.js +134 -115
- package/dest/api/fee.d.ts +0 -1
- package/dest/api/fee.d.ts.map +1 -1
- package/dest/api/fee.js +0 -2
- package/dest/api/fields.js +0 -1
- package/dest/api/interfaces/pxe.d.ts +1 -1
- package/dest/api/interfaces/pxe.d.ts.map +1 -1
- package/dest/api/interfaces/pxe.js +1 -2
- package/dest/api/log.js +0 -1
- package/dest/api/log_id.d.ts +1 -1
- package/dest/api/log_id.d.ts.map +1 -1
- package/dest/api/log_id.js +1 -2
- package/dest/api/tx_hash.d.ts +1 -1
- package/dest/api/tx_hash.d.ts.map +1 -1
- package/dest/api/tx_hash.js +1 -2
- package/dest/api/wallet.d.ts +1 -1
- package/dest/api/wallet.d.ts.map +1 -1
- package/dest/api/wallet.js +1 -2
- package/dest/contract/base_contract_interaction.d.ts +21 -5
- package/dest/contract/base_contract_interaction.d.ts.map +1 -1
- package/dest/contract/base_contract_interaction.js +97 -55
- package/dest/contract/batch_call.d.ts +3 -2
- package/dest/contract/batch_call.d.ts.map +1 -1
- package/dest/contract/batch_call.js +64 -40
- package/dest/contract/checker.d.ts +1 -1
- package/dest/contract/checker.d.ts.map +1 -1
- package/dest/contract/checker.js +29 -20
- package/dest/contract/contract.d.ts +4 -4
- package/dest/contract/contract.d.ts.map +1 -1
- package/dest/contract/contract.js +30 -28
- package/dest/contract/contract_base.d.ts +5 -5
- package/dest/contract/contract_base.d.ts.map +1 -1
- package/dest/contract/contract_base.js +22 -31
- package/dest/contract/contract_function_interaction.d.ts +9 -8
- package/dest/contract/contract_function_interaction.d.ts.map +1 -1
- package/dest/contract/contract_function_interaction.js +63 -51
- package/dest/contract/deploy_method.d.ts +14 -11
- package/dest/contract/deploy_method.d.ts.map +1 -1
- package/dest/contract/deploy_method.js +115 -87
- package/dest/contract/deploy_proven_tx.d.ts +6 -4
- package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
- package/dest/contract/deploy_proven_tx.js +8 -11
- package/dest/contract/deploy_sent_tx.d.ts +8 -6
- package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
- package/dest/contract/deploy_sent_tx.js +19 -22
- package/dest/contract/get_gas_limits.d.ts +2 -2
- package/dest/contract/get_gas_limits.d.ts.map +1 -1
- package/dest/contract/get_gas_limits.js +2 -4
- package/dest/contract/index.js +2 -4
- package/dest/{deployment → contract}/protocol_contracts.d.ts +4 -2
- package/dest/contract/protocol_contracts.d.ts.map +1 -0
- package/dest/contract/protocol_contracts.js +26 -0
- package/dest/contract/proven_tx.d.ts +3 -2
- package/dest/contract/proven_tx.d.ts.map +1 -1
- package/dest/contract/proven_tx.js +8 -11
- package/dest/contract/sent_tx.d.ts +3 -2
- package/dest/contract/sent_tx.d.ts.map +1 -1
- package/dest/contract/sent_tx.js +33 -35
- package/dest/contract/unsafe_contract.d.ts +3 -3
- package/dest/contract/unsafe_contract.d.ts.map +1 -1
- package/dest/contract/unsafe_contract.js +2 -10
- package/dest/deployment/broadcast_function.d.ts +3 -3
- package/dest/deployment/broadcast_function.d.ts.map +1 -1
- package/dest/deployment/broadcast_function.js +39 -32
- package/dest/deployment/contract_deployer.d.ts +3 -3
- package/dest/deployment/contract_deployer.d.ts.map +1 -1
- package/dest/deployment/contract_deployer.js +16 -15
- package/dest/deployment/deploy_instance.d.ts +3 -3
- package/dest/deployment/deploy_instance.d.ts.map +1 -1
- package/dest/deployment/deploy_instance.js +3 -5
- package/dest/deployment/index.js +0 -1
- package/dest/deployment/register_class.d.ts +3 -3
- package/dest/deployment/register_class.d.ts.map +1 -1
- package/dest/deployment/register_class.js +19 -14
- package/dest/entrypoint/default_entrypoint.d.ts +2 -2
- package/dest/entrypoint/default_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_entrypoint.js +11 -9
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts +2 -2
- package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/default_multi_call_entrypoint.js +68 -25
- package/dest/entrypoint/entrypoint.d.ts +7 -3
- package/dest/entrypoint/entrypoint.d.ts.map +1 -1
- package/dest/entrypoint/entrypoint.js +0 -1
- package/dest/entrypoint/payload.d.ts +8 -5
- package/dest/entrypoint/payload.d.ts.map +1 -1
- package/dest/entrypoint/payload.js +78 -85
- package/dest/fee/fee_juice_payment_method.d.ts +3 -3
- package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method.js +5 -4
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts +5 -4
- package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
- package/dest/fee/fee_juice_payment_method_with_claim.js +18 -20
- package/dest/fee/fee_payment_method.d.ts +3 -3
- package/dest/fee/fee_payment_method.d.ts.map +1 -1
- package/dest/fee/fee_payment_method.js +3 -2
- package/dest/fee/private_fee_payment_method.d.ts +5 -5
- package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/private_fee_payment_method.js +40 -38
- package/dest/fee/public_fee_payment_method.d.ts +5 -5
- package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
- package/dest/fee/public_fee_payment_method.js +38 -35
- package/dest/index.d.ts +25 -12
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +24 -14
- package/dest/rpc_clients/index.js +0 -1
- package/dest/rpc_clients/node/index.d.ts +2 -1
- package/dest/rpc_clients/node/index.d.ts.map +1 -1
- package/dest/rpc_clients/node/index.js +35 -18
- package/dest/rpc_clients/pxe_client.d.ts +2 -2
- package/dest/rpc_clients/pxe_client.d.ts.map +1 -1
- package/dest/rpc_clients/pxe_client.js +9 -7
- package/dest/utils/abi_types.d.ts +4 -1
- package/dest/utils/abi_types.d.ts.map +1 -1
- package/dest/utils/abi_types.js +1 -2
- package/dest/utils/authwit.d.ts +3 -2
- package/dest/utils/authwit.d.ts.map +1 -1
- package/dest/utils/authwit.js +18 -17
- package/dest/utils/aztec_cheatcodes.d.ts +4 -2
- package/dest/utils/aztec_cheatcodes.d.ts.map +1 -1
- package/dest/utils/aztec_cheatcodes.js +32 -41
- package/dest/utils/field_compressed_string.js +3 -5
- package/dest/utils/index.d.ts +1 -1
- package/dest/utils/index.d.ts.map +1 -1
- package/dest/utils/index.js +1 -2
- package/dest/utils/node.d.ts +3 -3
- package/dest/utils/node.d.ts.map +1 -1
- package/dest/utils/node.js +4 -6
- package/dest/utils/pub_key.d.ts +2 -1
- package/dest/utils/pub_key.d.ts.map +1 -1
- package/dest/utils/pub_key.js +2 -4
- package/dest/utils/pxe.d.ts +2 -2
- package/dest/utils/pxe.d.ts.map +1 -1
- package/dest/utils/pxe.js +3 -5
- package/dest/wallet/account_wallet.d.ts +8 -5
- package/dest/wallet/account_wallet.d.ts.map +1 -1
- package/dest/wallet/account_wallet.js +120 -83
- package/dest/wallet/account_wallet_with_private_key.d.ts +5 -5
- package/dest/wallet/account_wallet_with_private_key.d.ts.map +1 -1
- package/dest/wallet/account_wallet_with_private_key.js +10 -16
- package/dest/wallet/base_wallet.d.ts +19 -10
- package/dest/wallet/base_wallet.d.ts.map +1 -1
- package/dest/wallet/base_wallet.js +12 -13
- package/dest/wallet/index.d.ts +3 -3
- package/dest/wallet/index.d.ts.map +1 -1
- package/dest/wallet/index.js +2 -4
- package/dest/wallet/signerless_wallet.d.ts +7 -4
- package/dest/wallet/signerless_wallet.d.ts.map +1 -1
- package/dest/wallet/signerless_wallet.js +4 -6
- package/package.json +10 -14
- package/src/account/contract.ts +22 -5
- package/src/account/index.ts +2 -2
- package/src/account/interface.ts +5 -4
- package/src/account/wallet.ts +4 -3
- package/src/account_manager/deploy_account_method.ts +5 -5
- package/src/account_manager/deploy_account_sent_tx.ts +4 -3
- package/src/account_manager/index.ts +51 -24
- package/src/api/abi.ts +10 -3
- package/src/api/account.ts +8 -3
- package/src/api/addresses.ts +2 -2
- package/src/api/cheat_codes.ts +6 -6
- package/src/api/ethereum/anvil_test_watcher.ts +31 -7
- package/src/api/ethereum/chain_monitor.ts +9 -2
- package/src/api/ethereum/cheat_codes.ts +65 -24
- package/src/api/ethereum/index.ts +5 -1
- package/src/api/ethereum/l1_contracts.ts +1 -1
- package/src/api/ethereum/portal_manager.ts +27 -32
- package/src/api/fee.ts +0 -1
- package/src/api/interfaces/pxe.ts +1 -1
- package/src/api/log_id.ts +1 -1
- package/src/api/tx_hash.ts +1 -1
- package/src/api/wallet.ts +1 -1
- package/src/contract/base_contract_interaction.ts +35 -9
- package/src/contract/batch_call.ts +9 -7
- package/src/contract/checker.ts +1 -1
- package/src/contract/contract.ts +11 -4
- package/src/contract/contract_base.ts +3 -3
- package/src/contract/contract_function_interaction.ts +24 -13
- package/src/contract/deploy_method.ts +27 -18
- package/src/contract/deploy_proven_tx.ts +6 -4
- package/src/contract/deploy_sent_tx.ts +8 -6
- package/src/contract/get_gas_limits.ts +2 -2
- package/src/contract/protocol_contracts.ts +35 -0
- package/src/contract/proven_tx.ts +3 -2
- package/src/contract/sent_tx.ts +3 -2
- package/src/contract/unsafe_contract.ts +3 -3
- package/src/deployment/broadcast_function.ts +47 -40
- package/src/deployment/contract_deployer.ts +4 -3
- package/src/deployment/deploy_instance.ts +5 -5
- package/src/deployment/register_class.ts +25 -18
- package/src/entrypoint/default_entrypoint.ts +5 -5
- package/src/entrypoint/default_multi_call_entrypoint.ts +5 -4
- package/src/entrypoint/entrypoint.ts +7 -3
- package/src/entrypoint/payload.ts +11 -6
- package/src/fee/fee_juice_payment_method.ts +5 -3
- package/src/fee/fee_juice_payment_method_with_claim.ts +11 -10
- package/src/fee/fee_payment_method.ts +3 -3
- package/src/fee/private_fee_payment_method.ts +10 -11
- package/src/fee/public_fee_payment_method.ts +11 -11
- package/src/index.ts +35 -58
- package/src/rpc_clients/node/index.ts +2 -1
- package/src/rpc_clients/pxe_client.ts +2 -2
- package/src/utils/abi_types.ts +4 -7
- package/src/utils/authwit.ts +5 -2
- package/src/utils/aztec_cheatcodes.ts +5 -3
- package/src/utils/field_compressed_string.ts +1 -1
- package/src/utils/index.ts +1 -1
- package/src/utils/node.ts +3 -3
- package/src/utils/pub_key.ts +3 -2
- package/src/utils/pxe.ts +2 -2
- package/src/wallet/account_wallet.ts +8 -5
- package/src/wallet/account_wallet_with_private_key.ts +5 -4
- package/src/wallet/base_wallet.ts +37 -46
- package/src/wallet/index.ts +3 -3
- package/src/wallet/signerless_wallet.ts +7 -4
- package/dest/deployment/protocol_contracts.d.ts.map +0 -1
- package/dest/deployment/protocol_contracts.js +0 -14
- package/dest/fee/no_fee_payment_method.d.ts +0 -13
- package/dest/fee/no_fee_payment_method.d.ts.map +0 -1
- package/dest/fee/no_fee_payment_method.js +0 -17
- package/src/deployment/protocol_contracts.ts +0 -17
- package/src/fee/no_fee_payment_method.ts +0 -23
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
2
2
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
3
|
|
|
4
4
|
import { createPXEClient } from '../../rpc_clients/index.js';
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AztecAddress, EthAddress, Fr } from '@aztec/circuits.js';
|
|
3
|
-
import { computeSecretHash } from '@aztec/circuits.js/hash';
|
|
1
|
+
import type { ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
|
|
4
2
|
import { extractEvent } from '@aztec/ethereum/utils';
|
|
5
3
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
6
|
-
import {
|
|
4
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
6
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
7
|
+
import type { SiblingPath } from '@aztec/foundation/trees';
|
|
7
8
|
import { FeeJuicePortalAbi, OutboxAbi, TestERC20Abi, TokenPortalAbi } from '@aztec/l1-artifacts';
|
|
9
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import { computeSecretHash } from '@aztec/stdlib/hash';
|
|
11
|
+
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
8
12
|
|
|
9
|
-
import {
|
|
10
|
-
type Account,
|
|
11
|
-
type Chain,
|
|
12
|
-
type GetContractReturnType,
|
|
13
|
-
type Hex,
|
|
14
|
-
type HttpTransport,
|
|
15
|
-
type PublicClient,
|
|
16
|
-
type WalletClient,
|
|
17
|
-
getContract,
|
|
18
|
-
toFunctionSelector,
|
|
19
|
-
} from 'viem';
|
|
13
|
+
import { type GetContractReturnType, type Hex, getContract, toFunctionSelector } from 'viem';
|
|
20
14
|
|
|
15
|
+
// docs:start:claim_type
|
|
16
|
+
// docs:start:claim_type_amount
|
|
21
17
|
/** L1 to L2 message info to claim it on L2. */
|
|
22
18
|
export type L2Claim = {
|
|
23
19
|
/** Secret for claiming. */
|
|
@@ -29,9 +25,11 @@ export type L2Claim = {
|
|
|
29
25
|
/** Leaf index in the L1 to L2 message tree. */
|
|
30
26
|
messageLeafIndex: bigint;
|
|
31
27
|
};
|
|
28
|
+
// docs:end:claim_type
|
|
32
29
|
|
|
33
30
|
/** L1 to L2 message info that corresponds to an amount to claim. */
|
|
34
31
|
export type L2AmountClaim = L2Claim & { /** Amount to claim */ claimAmount: bigint };
|
|
32
|
+
// docs:end:claim_type_amount
|
|
35
33
|
|
|
36
34
|
/** L1 to L2 message info that corresponds to an amount to claim with associated recipient. */
|
|
37
35
|
export type L2AmountClaimWithRecipient = L2AmountClaim & {
|
|
@@ -53,13 +51,13 @@ export async function generateClaimSecret(logger?: Logger): Promise<[Fr, Fr]> {
|
|
|
53
51
|
|
|
54
52
|
/** Helper for managing an ERC20 on L1. */
|
|
55
53
|
export class L1TokenManager {
|
|
56
|
-
private contract: GetContractReturnType<typeof TestERC20Abi,
|
|
54
|
+
private contract: GetContractReturnType<typeof TestERC20Abi, ViemWalletClient>;
|
|
57
55
|
|
|
58
56
|
public constructor(
|
|
59
57
|
/** Address of the ERC20 contract. */
|
|
60
58
|
public readonly address: EthAddress,
|
|
61
|
-
private publicClient:
|
|
62
|
-
private walletClient:
|
|
59
|
+
private publicClient: ViemPublicClient,
|
|
60
|
+
private walletClient: ViemWalletClient,
|
|
63
61
|
private logger: Logger,
|
|
64
62
|
) {
|
|
65
63
|
this.contract = getContract({
|
|
@@ -107,16 +105,13 @@ export class L1TokenManager {
|
|
|
107
105
|
/** Helper for interacting with the FeeJuicePortal on L1. */
|
|
108
106
|
export class L1FeeJuicePortalManager {
|
|
109
107
|
private readonly tokenManager: L1TokenManager;
|
|
110
|
-
private readonly contract: GetContractReturnType<
|
|
111
|
-
typeof FeeJuicePortalAbi,
|
|
112
|
-
WalletClient<HttpTransport, Chain, Account>
|
|
113
|
-
>;
|
|
108
|
+
private readonly contract: GetContractReturnType<typeof FeeJuicePortalAbi, ViemWalletClient>;
|
|
114
109
|
|
|
115
110
|
constructor(
|
|
116
111
|
portalAddress: EthAddress,
|
|
117
112
|
tokenAddress: EthAddress,
|
|
118
|
-
private readonly publicClient:
|
|
119
|
-
private readonly walletClient:
|
|
113
|
+
private readonly publicClient: ViemPublicClient,
|
|
114
|
+
private readonly walletClient: ViemWalletClient,
|
|
120
115
|
private readonly logger: Logger,
|
|
121
116
|
) {
|
|
122
117
|
this.tokenManager = new L1TokenManager(tokenAddress, publicClient, walletClient, logger);
|
|
@@ -187,8 +182,8 @@ export class L1FeeJuicePortalManager {
|
|
|
187
182
|
*/
|
|
188
183
|
public static async new(
|
|
189
184
|
pxe: PXE,
|
|
190
|
-
publicClient:
|
|
191
|
-
walletClient:
|
|
185
|
+
publicClient: ViemPublicClient,
|
|
186
|
+
walletClient: ViemWalletClient,
|
|
192
187
|
logger: Logger,
|
|
193
188
|
): Promise<L1FeeJuicePortalManager> {
|
|
194
189
|
const {
|
|
@@ -205,14 +200,14 @@ export class L1FeeJuicePortalManager {
|
|
|
205
200
|
|
|
206
201
|
/** Helper for interacting with a test TokenPortal on L1 for sending tokens to L2. */
|
|
207
202
|
export class L1ToL2TokenPortalManager {
|
|
208
|
-
protected readonly portal: GetContractReturnType<typeof TokenPortalAbi,
|
|
203
|
+
protected readonly portal: GetContractReturnType<typeof TokenPortalAbi, ViemWalletClient>;
|
|
209
204
|
protected readonly tokenManager: L1TokenManager;
|
|
210
205
|
|
|
211
206
|
constructor(
|
|
212
207
|
portalAddress: EthAddress,
|
|
213
208
|
tokenAddress: EthAddress,
|
|
214
|
-
protected publicClient:
|
|
215
|
-
protected walletClient:
|
|
209
|
+
protected publicClient: ViemPublicClient,
|
|
210
|
+
protected walletClient: ViemWalletClient,
|
|
216
211
|
protected logger: Logger,
|
|
217
212
|
) {
|
|
218
213
|
this.tokenManager = new L1TokenManager(tokenAddress, publicClient, walletClient, logger);
|
|
@@ -323,14 +318,14 @@ export class L1ToL2TokenPortalManager {
|
|
|
323
318
|
|
|
324
319
|
/** Helper for interacting with a test TokenPortal on L1 for both withdrawing from and bridging to L2. */
|
|
325
320
|
export class L1TokenPortalManager extends L1ToL2TokenPortalManager {
|
|
326
|
-
private readonly outbox: GetContractReturnType<typeof OutboxAbi,
|
|
321
|
+
private readonly outbox: GetContractReturnType<typeof OutboxAbi, ViemWalletClient>;
|
|
327
322
|
|
|
328
323
|
constructor(
|
|
329
324
|
portalAddress: EthAddress,
|
|
330
325
|
tokenAddress: EthAddress,
|
|
331
326
|
outboxAddress: EthAddress,
|
|
332
|
-
publicClient:
|
|
333
|
-
walletClient:
|
|
327
|
+
publicClient: ViemPublicClient,
|
|
328
|
+
walletClient: ViemWalletClient,
|
|
334
329
|
logger: Logger,
|
|
335
330
|
) {
|
|
336
331
|
super(portalAddress, tokenAddress, publicClient, walletClient, logger);
|
package/src/api/fee.ts
CHANGED
|
@@ -3,4 +3,3 @@ export { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
|
|
|
3
3
|
export { PrivateFeePaymentMethod } from '../fee/private_fee_payment_method.js';
|
|
4
4
|
export { PublicFeePaymentMethod } from '../fee/public_fee_payment_method.js';
|
|
5
5
|
export { FeeJuicePaymentMethodWithClaim } from '../fee/fee_juice_payment_method_with_claim.js';
|
|
6
|
-
export { NoFeePaymentMethod } from '../fee/no_fee_payment_method.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PXE } from '@aztec/
|
|
1
|
+
export type { PXE } from '@aztec/stdlib/interfaces/client';
|
package/src/api/log_id.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { LogId } from '@aztec/
|
|
1
|
+
export { LogId } from '@aztec/stdlib/logs';
|
package/src/api/tx_hash.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { TxHash } from '@aztec/
|
|
1
|
+
export { TxHash } from '@aztec/stdlib/tx';
|
package/src/api/wallet.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type Fr, GasSettings } from '@aztec/circuits.js';
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
3
2
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { GasSettings } from '@aztec/stdlib/gas';
|
|
4
|
+
import type { Capsule, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import type { Wallet } from '../account/wallet.js';
|
|
7
|
+
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
8
|
+
import type { FeeOptions, UserFeeOptions } from '../entrypoint/payload.js';
|
|
9
|
+
import { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
|
|
9
10
|
import { getGasLimits } from './get_gas_limits.js';
|
|
10
11
|
import { ProvenTx } from './proven_tx.js';
|
|
11
12
|
import { SentTx } from './sent_tx.js';
|
|
@@ -32,6 +33,8 @@ export type SendMethodOptions = {
|
|
|
32
33
|
export abstract class BaseContractInteraction {
|
|
33
34
|
protected log = createLogger('aztecjs:contract_interaction');
|
|
34
35
|
|
|
36
|
+
private capsules: Capsule[] = [];
|
|
37
|
+
|
|
35
38
|
constructor(protected wallet: Wallet) {}
|
|
36
39
|
|
|
37
40
|
/**
|
|
@@ -102,7 +105,7 @@ export abstract class BaseContractInteraction {
|
|
|
102
105
|
true /*simulatePublic*/,
|
|
103
106
|
undefined /* msgSender */,
|
|
104
107
|
undefined /* skipTxValidation */,
|
|
105
|
-
|
|
108
|
+
true /* skipFeeEnforcement */,
|
|
106
109
|
);
|
|
107
110
|
const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
|
|
108
111
|
simulationResult,
|
|
@@ -118,7 +121,7 @@ export abstract class BaseContractInteraction {
|
|
|
118
121
|
protected async getDefaultFeeOptions(fee: UserFeeOptions | undefined): Promise<FeeOptions> {
|
|
119
122
|
const maxFeesPerGas =
|
|
120
123
|
fee?.gasSettings?.maxFeesPerGas ?? (await this.wallet.getCurrentBaseFees()).mul(1 + (fee?.baseFeePadding ?? 0.5));
|
|
121
|
-
const paymentMethod = fee?.paymentMethod ?? new
|
|
124
|
+
const paymentMethod = fee?.paymentMethod ?? new FeeJuicePaymentMethod(this.wallet.getAddress());
|
|
122
125
|
const gasSettings: GasSettings = GasSettings.default({ ...fee?.gasSettings, maxFeesPerGas });
|
|
123
126
|
this.log.debug(`Using L2 gas settings`, gasSettings);
|
|
124
127
|
return { gasSettings, paymentMethod };
|
|
@@ -149,7 +152,7 @@ export abstract class BaseContractInteraction {
|
|
|
149
152
|
true /*simulatePublic*/,
|
|
150
153
|
undefined /* msgSender */,
|
|
151
154
|
undefined /* skipTxValidation */,
|
|
152
|
-
|
|
155
|
+
true /* skipFeeEnforcement */,
|
|
153
156
|
);
|
|
154
157
|
const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
|
|
155
158
|
simulationResult,
|
|
@@ -163,4 +166,27 @@ export abstract class BaseContractInteraction {
|
|
|
163
166
|
|
|
164
167
|
return { gasSettings, paymentMethod };
|
|
165
168
|
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Add data passed to the oracle calls during this contract interaction.
|
|
172
|
+
* @param capsule - Data passed to oracle calls.
|
|
173
|
+
*/
|
|
174
|
+
public addCapsule(capsule: Capsule) {
|
|
175
|
+
this.capsules.push(capsule);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Add data passed to the oracle calls during this contract interaction.
|
|
180
|
+
* @param capsules - Data passed to oracle calls.
|
|
181
|
+
*/
|
|
182
|
+
public addCapsules(capsules: Capsule[]) {
|
|
183
|
+
this.capsules.push(...capsules);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Return all capsules added for this function interaction.
|
|
188
|
+
*/
|
|
189
|
+
public getCapsules() {
|
|
190
|
+
return this.capsules;
|
|
191
|
+
}
|
|
166
192
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type FunctionCall,
|
|
2
|
-
import {
|
|
1
|
+
import { type FunctionCall, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { Wallet } from '../account/index.js';
|
|
5
5
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
6
6
|
import type { SimulateMethodOptions } from './contract_function_interaction.js';
|
|
7
7
|
|
|
@@ -19,8 +19,9 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
19
19
|
*/
|
|
20
20
|
public async create(opts?: SendMethodOptions): Promise<TxExecutionRequest> {
|
|
21
21
|
const calls = this.calls;
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const capsules = this.getCapsules();
|
|
23
|
+
const fee = await this.getFeeOptions({ calls, capsules, ...opts });
|
|
24
|
+
return await this.wallet.createTxExecutionRequest({ calls, capsules, ...opts, fee });
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -59,8 +60,9 @@ export class BatchCall extends BaseContractInteraction {
|
|
|
59
60
|
);
|
|
60
61
|
|
|
61
62
|
const calls = indexedCalls.map(([call]) => call);
|
|
62
|
-
const
|
|
63
|
-
const
|
|
63
|
+
const capsules = this.getCapsules();
|
|
64
|
+
const fee = await this.getFeeOptions({ calls, capsules, ...options });
|
|
65
|
+
const txRequest = await this.wallet.createTxExecutionRequest({ calls, capsules, ...options, fee });
|
|
64
66
|
|
|
65
67
|
const unconstrainedCalls = unconstrained.map(
|
|
66
68
|
async ([call, index]) =>
|
package/src/contract/checker.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AbiType, BasicType, ContractArtifact, StructType } from '@aztec/stdlib/abi';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a type derived from input type T with the 'kind' property removed.
|
package/src/contract/contract.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
4
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import type { Wallet } from '../account/index.js';
|
|
6
7
|
import { ContractBase } from './contract_base.js';
|
|
7
8
|
import { DeployMethod } from './deploy_method.js';
|
|
8
9
|
|
|
@@ -26,6 +27,12 @@ export class Contract extends ContractBase {
|
|
|
26
27
|
if (instance === undefined) {
|
|
27
28
|
throw new Error(`Contract instance at ${address.toString()} has not been registered in the wallet's PXE`);
|
|
28
29
|
}
|
|
30
|
+
const thisContractClass = await getContractClassFromArtifact(artifact);
|
|
31
|
+
if (!thisContractClass.id.equals(instance.currentContractClassId)) {
|
|
32
|
+
// wallet holds an outdated version of this contract
|
|
33
|
+
await wallet.updateContract(address, artifact);
|
|
34
|
+
instance.currentContractClassId = thisContractClass.id;
|
|
35
|
+
}
|
|
29
36
|
return new Contract(instance, artifact, wallet);
|
|
30
37
|
}
|
|
31
38
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/circuits.js';
|
|
2
1
|
import {
|
|
3
2
|
type ContractArtifact,
|
|
4
3
|
type ContractNote,
|
|
5
4
|
type FieldLayout,
|
|
6
5
|
type FunctionArtifact,
|
|
7
6
|
FunctionSelector,
|
|
8
|
-
} from '@aztec/
|
|
7
|
+
} from '@aztec/stdlib/abi';
|
|
8
|
+
import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/stdlib/contract';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import type { Wallet } from '../account/index.js';
|
|
11
11
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import type { FunctionCall, PrivateKernelProverProfileResult, TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress, type GasSettings } from '@aztec/circuits.js';
|
|
3
1
|
import {
|
|
4
2
|
type FunctionAbi,
|
|
3
|
+
FunctionCall,
|
|
5
4
|
FunctionSelector,
|
|
6
5
|
FunctionType,
|
|
7
6
|
decodeFromAbi,
|
|
8
7
|
encodeArguments,
|
|
9
|
-
} from '@aztec/
|
|
8
|
+
} from '@aztec/stdlib/abi';
|
|
9
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
|
+
import type { PrivateKernelProverProfileResult } from '@aztec/stdlib/kernel';
|
|
11
|
+
import type { TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
10
12
|
|
|
11
|
-
import {
|
|
13
|
+
import type { Wallet } from '../account/wallet.js';
|
|
14
|
+
import { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
|
|
12
15
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
13
16
|
|
|
14
|
-
export { SendMethodOptions };
|
|
17
|
+
export type { SendMethodOptions };
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Represents the options for simulating a contract function interaction.
|
|
18
21
|
* Allows specifying the address from which the view method should be called.
|
|
19
22
|
* Disregarded for simulation of public functions
|
|
20
23
|
*/
|
|
21
|
-
export type SimulateMethodOptions = {
|
|
24
|
+
export type SimulateMethodOptions = Pick<SendMethodOptions, 'fee'> & {
|
|
22
25
|
/** The sender's Aztec address. */
|
|
23
26
|
from?: AztecAddress;
|
|
24
|
-
/** Gas settings for the simulation. */
|
|
25
|
-
gasSettings?: GasSettings;
|
|
26
27
|
/** Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers. */
|
|
27
28
|
skipTxValidation?: boolean;
|
|
29
|
+
/** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
|
|
30
|
+
skipFeeEnforcement?: boolean;
|
|
28
31
|
};
|
|
29
32
|
|
|
30
33
|
/**
|
|
@@ -65,9 +68,10 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
65
68
|
throw new Error("Can't call `create` on an unconstrained function.");
|
|
66
69
|
}
|
|
67
70
|
const calls = [await this.request()];
|
|
68
|
-
const
|
|
71
|
+
const capsules = this.getCapsules();
|
|
72
|
+
const fee = await this.getFeeOptions({ calls, capsules, ...opts });
|
|
69
73
|
const { nonce, cancellable } = opts;
|
|
70
|
-
return await this.wallet.createTxExecutionRequest({ calls, fee, nonce, cancellable });
|
|
74
|
+
return await this.wallet.createTxExecutionRequest({ calls, fee, nonce, cancellable, capsules });
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
// docs:start:request
|
|
@@ -106,8 +110,15 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
106
110
|
return this.wallet.simulateUnconstrained(this.functionDao.name, this.args, this.contractAddress, options?.from);
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
const
|
|
110
|
-
const
|
|
113
|
+
const fee = options.fee ?? { paymentMethod: new FeeJuicePaymentMethod(AztecAddress.ZERO) };
|
|
114
|
+
const txRequest = await this.create({ fee });
|
|
115
|
+
const simulatedTx = await this.wallet.simulateTx(
|
|
116
|
+
txRequest,
|
|
117
|
+
true /* simulatePublic */,
|
|
118
|
+
options.from,
|
|
119
|
+
options.skipTxValidation,
|
|
120
|
+
options.skipFeeEnforcement ?? true,
|
|
121
|
+
);
|
|
111
122
|
|
|
112
123
|
let rawReturnValues;
|
|
113
124
|
if (this.functionDao.functionType == FunctionType.PRIVATE) {
|
|
@@ -138,7 +149,7 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
|
|
|
138
149
|
throw new Error("Can't profile an unconstrained function.");
|
|
139
150
|
}
|
|
140
151
|
|
|
141
|
-
const txRequest = await this.create();
|
|
152
|
+
const txRequest = await this.create({ fee: options.fee });
|
|
142
153
|
const simulatedTx = await this.wallet.simulateTx(
|
|
143
154
|
txRequest,
|
|
144
155
|
true,
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { type ContractArtifact, type FunctionArtifact, type FunctionCall, getInitializer } from '@aztec/stdlib/abi';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
4
|
import {
|
|
3
|
-
AztecAddress,
|
|
4
5
|
type ContractInstanceWithAddress,
|
|
5
|
-
type PublicKeys,
|
|
6
6
|
computePartialAddress,
|
|
7
7
|
getContractClassFromArtifact,
|
|
8
8
|
getContractInstanceFromDeployParams,
|
|
9
|
-
} from '@aztec/
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
9
|
+
} from '@aztec/stdlib/contract';
|
|
10
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
11
|
+
import type { PublicKeys } from '@aztec/stdlib/keys';
|
|
12
|
+
import type { Capsule, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import type { Wallet } from '../account/index.js';
|
|
14
15
|
import { deployInstance } from '../deployment/deploy_instance.js';
|
|
15
16
|
import { registerContractClass } from '../deployment/register_class.js';
|
|
16
|
-
import {
|
|
17
|
+
import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
|
|
17
18
|
import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import type { Contract } from './contract.js';
|
|
20
|
+
import type { ContractBase } from './contract_base.js';
|
|
20
21
|
import { ContractFunctionInteraction } from './contract_function_interaction.js';
|
|
21
22
|
import { DeployProvenTx } from './deploy_proven_tx.js';
|
|
22
23
|
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
@@ -111,9 +112,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
111
112
|
const calls = [...deployment.calls, ...bootstrap.calls];
|
|
112
113
|
const authWitnesses = [...(deployment.authWitnesses ?? []), ...(bootstrap.authWitnesses ?? [])];
|
|
113
114
|
const hashedArguments = [...(deployment.hashedArguments ?? []), ...(bootstrap.hashedArguments ?? [])];
|
|
115
|
+
const capsules = [...(deployment.capsules ?? []), ...(bootstrap.capsules ?? [])];
|
|
114
116
|
const { cancellable, nonce, fee: userFee } = options;
|
|
115
117
|
|
|
116
|
-
const request = { calls, authWitnesses, hashedArguments, cancellable, fee: userFee, nonce };
|
|
118
|
+
const request = { calls, authWitnesses, hashedArguments, capsules, cancellable, fee: userFee, nonce };
|
|
117
119
|
|
|
118
120
|
const fee = await this.getFeeOptions(request);
|
|
119
121
|
return { ...request, fee };
|
|
@@ -136,8 +138,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
136
138
|
*/
|
|
137
139
|
protected async getDeploymentFunctionCalls(
|
|
138
140
|
options: DeployOptions = {},
|
|
139
|
-
): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments'>> {
|
|
141
|
+
): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
|
|
140
142
|
const calls: FunctionCall[] = [];
|
|
143
|
+
const capsules: Capsule[] = [];
|
|
141
144
|
|
|
142
145
|
// Set contract instance object so it's available for populating the DeploySendTx object
|
|
143
146
|
const instance = await this.getInstance(options);
|
|
@@ -145,9 +148,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
145
148
|
// Obtain contract class from artifact and check it matches the reported one by the instance.
|
|
146
149
|
// TODO(@spalladino): We're unnecessarily calculating the contract class multiple times here.
|
|
147
150
|
const contractClass = await getContractClassFromArtifact(this.artifact);
|
|
148
|
-
if (!instance.
|
|
151
|
+
if (!instance.currentContractClassId.equals(contractClass.id)) {
|
|
149
152
|
throw new Error(
|
|
150
|
-
`Contract class mismatch when deploying contract: got ${instance.
|
|
153
|
+
`Contract class mismatch when deploying contract: got ${instance.currentContractClassId.toString()} from instance and ${contractClass.id.toString()} from artifact`,
|
|
151
154
|
);
|
|
152
155
|
}
|
|
153
156
|
|
|
@@ -163,6 +166,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
163
166
|
);
|
|
164
167
|
const registerContractClassInteraction = await registerContractClass(this.wallet, this.artifact);
|
|
165
168
|
calls.push(await registerContractClassInteraction.request());
|
|
169
|
+
capsules.push(...registerContractClassInteraction.getCapsules());
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
|
|
@@ -170,9 +174,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
170
174
|
if (!options.skipPublicDeployment) {
|
|
171
175
|
const deploymentInteraction = await deployInstance(this.wallet, instance);
|
|
172
176
|
calls.push(await deploymentInteraction.request());
|
|
177
|
+
capsules.push(...deploymentInteraction.getCapsules());
|
|
173
178
|
}
|
|
174
179
|
|
|
175
|
-
return { calls };
|
|
180
|
+
return { calls, capsules };
|
|
176
181
|
}
|
|
177
182
|
|
|
178
183
|
/**
|
|
@@ -182,9 +187,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
182
187
|
*/
|
|
183
188
|
protected async getInitializeFunctionCalls(
|
|
184
189
|
options: DeployOptions,
|
|
185
|
-
): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments'>> {
|
|
190
|
+
): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
|
|
186
191
|
const { address } = await this.getInstance(options);
|
|
187
192
|
const calls: FunctionCall[] = [];
|
|
193
|
+
const capsules: Capsule[] = [];
|
|
188
194
|
if (this.constructorArtifact && !options.skipInitialization) {
|
|
189
195
|
const constructorCall = new ContractFunctionInteraction(
|
|
190
196
|
this.wallet,
|
|
@@ -193,8 +199,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
193
199
|
this.args,
|
|
194
200
|
);
|
|
195
201
|
calls.push(await constructorCall.request());
|
|
202
|
+
capsules.push(...constructorCall.getCapsules());
|
|
196
203
|
}
|
|
197
|
-
return { calls };
|
|
204
|
+
return { calls, capsules };
|
|
198
205
|
}
|
|
199
206
|
|
|
200
207
|
/**
|
|
@@ -246,7 +253,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
|
|
|
246
253
|
* Estimates gas cost for this deployment operation.
|
|
247
254
|
* @param options - Options.
|
|
248
255
|
*/
|
|
249
|
-
public override estimateGas(
|
|
256
|
+
public override estimateGas(
|
|
257
|
+
options?: Omit<DeployOptions, 'estimateGas' | 'skipPublicSimulation'>,
|
|
258
|
+
): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>> {
|
|
250
259
|
return super.estimateGas(options);
|
|
251
260
|
}
|
|
252
261
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
|
+
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
4
|
+
import type { Tx } from '@aztec/stdlib/tx';
|
|
3
5
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import type { Wallet } from '../account/index.js';
|
|
7
|
+
import type { Contract } from './contract.js';
|
|
6
8
|
import { DeploySentTx } from './deploy_sent_tx.js';
|
|
7
9
|
import { ProvenTx } from './proven_tx.js';
|
|
8
10
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type PXE, type TxHash, type TxReceipt } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
|
|
3
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import {
|
|
2
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
5
|
+
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
6
|
+
import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
5
7
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import type { Wallet } from '../account/index.js';
|
|
9
|
+
import type { Contract } from './contract.js';
|
|
10
|
+
import type { ContractBase } from './contract_base.js';
|
|
9
11
|
import { SentTx, type WaitOpts } from './sent_tx.js';
|
|
10
12
|
|
|
11
13
|
/** Options related to waiting for a deployment tx. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Gas } from '@aztec/stdlib/gas';
|
|
2
|
+
import type { TxSimulationResult } from '@aztec/stdlib/tx';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns suggested total and teardown gas limits for a simulated tx.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
|
+
|
|
3
|
+
import type { Wallet } from '../wallet/index.js';
|
|
4
|
+
import { UnsafeContract } from './unsafe_contract.js';
|
|
5
|
+
|
|
6
|
+
/** Returns a Contract wrapper for the class registerer. */
|
|
7
|
+
export async function getRegistererContract(wallet: Wallet) {
|
|
8
|
+
const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegisterer);
|
|
9
|
+
if (!contractInstance) {
|
|
10
|
+
throw new Error("ContractClassRegisterer is not registered in this wallet's instance");
|
|
11
|
+
}
|
|
12
|
+
const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
|
|
13
|
+
|
|
14
|
+
return new UnsafeContract(contractInstance!, artifact!, wallet);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Returns a Contract wrapper for the instance deployer. */
|
|
18
|
+
export async function getDeployerContract(wallet: Wallet) {
|
|
19
|
+
const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceDeployer);
|
|
20
|
+
if (!contractInstance) {
|
|
21
|
+
throw new Error("ContractInstanceDeployer is not registered in this wallet's instance");
|
|
22
|
+
}
|
|
23
|
+
const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
|
|
24
|
+
return new UnsafeContract(contractInstance!, artifact!, wallet);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Returns a Contract wrapper for the fee juice */
|
|
28
|
+
export async function getFeeJuice(wallet: Wallet) {
|
|
29
|
+
const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
|
|
30
|
+
if (!contractInstance) {
|
|
31
|
+
throw new Error("FeeJuice is not registered in this wallet's instance");
|
|
32
|
+
}
|
|
33
|
+
const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
|
|
34
|
+
return new UnsafeContract(contractInstance!, artifact!, wallet);
|
|
35
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { PXE } from '@aztec/stdlib/interfaces/client';
|
|
2
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import type { Wallet } from '../account/index.js';
|
|
4
5
|
import { SentTx } from './sent_tx.js';
|
|
5
6
|
|
|
6
7
|
/**
|
package/src/contract/sent_tx.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type GetPublicLogsResponse, type PXE, type TxHash, type TxReceipt, TxStatus } from '@aztec/circuit-types';
|
|
2
1
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
3
|
-
import {
|
|
2
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
|
+
import type { GetPublicLogsResponse, PXE } from '@aztec/stdlib/interfaces/client';
|
|
4
|
+
import { type TxHash, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
|
|
4
5
|
|
|
5
6
|
/** Options related to waiting for a tx. */
|
|
6
7
|
export type WaitOpts = {
|