@aztec/aztec.js 0.76.4-devnet-test-rc3 → 0.77.0-testnet-ignition.17
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 +5 -5
- package/dest/api/cheat_codes.d.ts.map +1 -1
- package/dest/api/cheat_codes.js +11 -16
- 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 -6
- package/dest/api/ethereum/cheat_codes.d.ts.map +1 -1
- package/dest/api/ethereum/cheat_codes.js +106 -71
- 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 +27 -14
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +26 -16
- 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 +7 -7
- 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 +64 -52
- 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 +37 -63
- 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,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 = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { Wallet } from '../wallet/index.js';
|
|
5
5
|
import { ContractBase } from './contract_base.js';
|
|
6
6
|
|
|
7
7
|
/** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
|
|
3
|
-
AztecAddress,
|
|
4
3
|
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
|
|
5
|
-
REGISTERER_CONTRACT_ADDRESS,
|
|
6
4
|
REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT,
|
|
5
|
+
} from '@aztec/constants';
|
|
6
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
7
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
8
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
9
|
+
import { type ContractArtifact, FunctionSelector, FunctionType, bufferAsFields } from '@aztec/stdlib/abi';
|
|
10
|
+
import {
|
|
7
11
|
computeVerificationKeyHash,
|
|
8
12
|
createPrivateFunctionMembershipProof,
|
|
9
13
|
createUnconstrainedFunctionMembershipProof,
|
|
10
14
|
getContractClassFromArtifact,
|
|
11
|
-
} from '@aztec/
|
|
12
|
-
import {
|
|
13
|
-
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
14
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
15
|
+
} from '@aztec/stdlib/contract';
|
|
16
|
+
import { Capsule } from '@aztec/stdlib/tx';
|
|
15
17
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
18
|
+
import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
19
|
+
import { getRegistererContract } from '../contract/protocol_contracts.js';
|
|
20
|
+
import type { Wallet } from '../wallet/index.js';
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Sets up a call to broadcast a private function's bytecode via the ClassRegisterer contract.
|
|
@@ -55,31 +57,33 @@ export async function broadcastPrivateFunction(
|
|
|
55
57
|
} = await createPrivateFunctionMembershipProof(selector, artifact);
|
|
56
58
|
|
|
57
59
|
const vkHash = await computeVerificationKeyHash(privateFunctionArtifact);
|
|
60
|
+
|
|
61
|
+
const registerer = await getRegistererContract(wallet);
|
|
62
|
+
const fn = registerer.methods.broadcast_private_function(
|
|
63
|
+
contractClass.id,
|
|
64
|
+
artifactMetadataHash,
|
|
65
|
+
unconstrainedFunctionsArtifactTreeRoot,
|
|
66
|
+
privateFunctionTreeSiblingPath,
|
|
67
|
+
privateFunctionTreeLeafIndex,
|
|
68
|
+
padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
|
|
69
|
+
artifactTreeLeafIndex,
|
|
70
|
+
// eslint-disable-next-line camelcase
|
|
71
|
+
{ selector, metadata_hash: functionMetadataHash, vk_hash: vkHash },
|
|
72
|
+
);
|
|
73
|
+
|
|
58
74
|
const bytecode = bufferAsFields(
|
|
59
75
|
privateFunctionArtifact.bytecode,
|
|
60
76
|
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
|
|
61
77
|
);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const registerer = await getRegistererContract(wallet);
|
|
70
|
-
return Promise.resolve(
|
|
71
|
-
registerer.methods.broadcast_private_function(
|
|
72
|
-
contractClass.id,
|
|
73
|
-
artifactMetadataHash,
|
|
74
|
-
unconstrainedFunctionsArtifactTreeRoot,
|
|
75
|
-
privateFunctionTreeSiblingPath,
|
|
76
|
-
privateFunctionTreeLeafIndex,
|
|
77
|
-
padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
|
|
78
|
-
artifactTreeLeafIndex,
|
|
79
|
-
// eslint-disable-next-line camelcase
|
|
80
|
-
{ selector, metadata_hash: functionMetadataHash, vk_hash: vkHash },
|
|
78
|
+
fn.addCapsule(
|
|
79
|
+
new Capsule(
|
|
80
|
+
ProtocolContractAddress.ContractClassRegisterer,
|
|
81
|
+
new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
|
|
82
|
+
bytecode,
|
|
81
83
|
),
|
|
82
84
|
);
|
|
85
|
+
|
|
86
|
+
return fn;
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
/**
|
|
@@ -117,19 +121,8 @@ export async function broadcastUnconstrainedFunction(
|
|
|
117
121
|
privateFunctionsArtifactTreeRoot,
|
|
118
122
|
} = await createUnconstrainedFunctionMembershipProof(selector, artifact);
|
|
119
123
|
|
|
120
|
-
const bytecode = bufferAsFields(
|
|
121
|
-
unconstrainedFunctionArtifact.bytecode,
|
|
122
|
-
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
await wallet.storeCapsule(
|
|
126
|
-
AztecAddress.fromNumber(REGISTERER_CONTRACT_ADDRESS),
|
|
127
|
-
new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
|
|
128
|
-
bytecode,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
124
|
const registerer = await getRegistererContract(wallet);
|
|
132
|
-
|
|
125
|
+
const fn = registerer.methods.broadcast_unconstrained_function(
|
|
133
126
|
contractClass.id,
|
|
134
127
|
artifactMetadataHash,
|
|
135
128
|
privateFunctionsArtifactTreeRoot,
|
|
@@ -138,4 +131,18 @@ export async function broadcastUnconstrainedFunction(
|
|
|
138
131
|
// eslint-disable-next-line camelcase
|
|
139
132
|
{ selector, metadata_hash: functionMetadataHash },
|
|
140
133
|
);
|
|
134
|
+
|
|
135
|
+
const bytecode = bufferAsFields(
|
|
136
|
+
unconstrainedFunctionArtifact.bytecode,
|
|
137
|
+
MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
|
|
138
|
+
);
|
|
139
|
+
fn.addCapsule(
|
|
140
|
+
new Capsule(
|
|
141
|
+
ProtocolContractAddress.ContractClassRegisterer,
|
|
142
|
+
new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
|
|
143
|
+
bytecode,
|
|
144
|
+
),
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
return fn;
|
|
141
148
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { ContractArtifact } from '@aztec/stdlib/abi';
|
|
2
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { PublicKeys } from '@aztec/stdlib/keys';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import type { Wallet } from '../account/wallet.js';
|
|
5
6
|
import { Contract } from '../contract/contract.js';
|
|
6
7
|
import { DeployMethod } from '../contract/deploy_method.js';
|
|
7
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
4
|
+
import { getDeployerContract } from '../contract/protocol_contracts.js';
|
|
5
|
+
import type { Wallet } from '../wallet/index.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Sets up a call to the canonical deployer contract to publicly deploy a contract instance.
|
|
@@ -14,7 +14,7 @@ export async function deployInstance(
|
|
|
14
14
|
instance: ContractInstanceWithAddress,
|
|
15
15
|
): Promise<ContractFunctionInteraction> {
|
|
16
16
|
const deployerContract = await getDeployerContract(wallet);
|
|
17
|
-
const { salt, contractClassId, publicKeys, deployer } = instance;
|
|
17
|
+
const { salt, currentContractClassId: contractClassId, publicKeys, deployer } = instance;
|
|
18
18
|
const isUniversalDeploy = deployer.isZero();
|
|
19
19
|
if (!isUniversalDeploy && !wallet.getAddress().equals(deployer)) {
|
|
20
20
|
throw new Error(
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
getContractClassFromArtifact,
|
|
8
|
-
} from '@aztec/circuits.js';
|
|
9
|
-
import { type ContractArtifact, bufferAsFields } from '@aztec/foundation/abi';
|
|
1
|
+
import { MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
4
|
+
import { type ContractArtifact, bufferAsFields } from '@aztec/stdlib/abi';
|
|
5
|
+
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
6
|
+
import { Capsule } from '@aztec/stdlib/tx';
|
|
10
7
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
|
|
9
|
+
import { getRegistererContract } from '../contract/protocol_contracts.js';
|
|
10
|
+
import type { Wallet } from '../wallet/index.js';
|
|
14
11
|
|
|
15
12
|
const defaultEmitPublicBytecode =
|
|
16
13
|
// guard against `process` not being defined (e.g. in the browser)
|
|
@@ -26,12 +23,22 @@ export async function registerContractClass(
|
|
|
26
23
|
): Promise<ContractFunctionInteraction> {
|
|
27
24
|
const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment, packedBytecode } =
|
|
28
25
|
await getContractClassFromArtifact(artifact);
|
|
29
|
-
const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
|
|
30
26
|
const registerer = await getRegistererContract(wallet);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const fn = registerer.methods.register(
|
|
28
|
+
artifactHash,
|
|
29
|
+
privateFunctionsRoot,
|
|
30
|
+
publicBytecodeCommitment,
|
|
31
|
+
emitPublicBytecode,
|
|
35
32
|
);
|
|
36
|
-
|
|
33
|
+
|
|
34
|
+
const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
|
|
35
|
+
fn.addCapsule(
|
|
36
|
+
new Capsule(
|
|
37
|
+
ProtocolContractAddress.ContractClassRegisterer,
|
|
38
|
+
new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
|
|
39
|
+
encodedBytecode,
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return fn;
|
|
37
44
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TxContext } from '@aztec/
|
|
3
|
-
import { FunctionType } from '@aztec/foundation/abi';
|
|
1
|
+
import { FunctionType } from '@aztec/stdlib/abi';
|
|
2
|
+
import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import type { EntrypointInterface, ExecutionRequestInit } from './entrypoint.js';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Default implementation of the entrypoint interface. It calls a function on a contract directly
|
|
@@ -11,7 +10,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
|
|
|
11
10
|
constructor(private chainId: number, private protocolVersion: number) {}
|
|
12
11
|
|
|
13
12
|
async createTxExecutionRequest(exec: ExecutionRequestInit): Promise<TxExecutionRequest> {
|
|
14
|
-
const { fee, calls, authWitnesses = [], hashedArguments = [] } = exec;
|
|
13
|
+
const { fee, calls, authWitnesses = [], hashedArguments = [], capsules = [] } = exec;
|
|
15
14
|
|
|
16
15
|
if (calls.length > 1) {
|
|
17
16
|
throw new Error(`Expected a single call, got ${calls.length}`);
|
|
@@ -33,6 +32,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
|
|
|
33
32
|
txContext,
|
|
34
33
|
[...hashedArguments, entrypointHashedValues],
|
|
35
34
|
authWitnesses,
|
|
35
|
+
capsules,
|
|
36
36
|
),
|
|
37
37
|
);
|
|
38
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress, TxContext } from '@aztec/circuits.js';
|
|
3
|
-
import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
|
|
4
1
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
|
+
import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
5
5
|
|
|
6
6
|
import { type EntrypointInterface, EntrypointPayload, type ExecutionRequestInit } from './entrypoint.js';
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
|
|
|
16
16
|
) {}
|
|
17
17
|
|
|
18
18
|
async createTxExecutionRequest(executions: ExecutionRequestInit): Promise<TxExecutionRequest> {
|
|
19
|
-
const { fee, calls, authWitnesses = [], hashedArguments = [] } = executions;
|
|
19
|
+
const { fee, calls, authWitnesses = [], hashedArguments = [], capsules = [] } = executions;
|
|
20
20
|
const payload = await EntrypointPayload.fromAppExecution(calls);
|
|
21
21
|
const abi = this.getEntrypointAbi();
|
|
22
22
|
const entrypointHashedArgs = await HashedValues.fromValues(encodeArguments(abi, [payload]));
|
|
@@ -28,6 +28,7 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
|
|
|
28
28
|
txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
|
|
29
29
|
argsOfCalls: [...payload.hashedArguments, ...hashedArguments, entrypointHashedArgs],
|
|
30
30
|
authWitnesses,
|
|
31
|
+
capsules,
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
return Promise.resolve(txRequest);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
4
|
+
import type { Capsule, HashedValues, TxExecutionRequest } from '@aztec/stdlib/tx';
|
|
3
5
|
|
|
4
6
|
import { EntrypointPayload, type FeeOptions, computeCombinedPayloadHash } from './payload.js';
|
|
5
7
|
|
|
6
|
-
export { EntrypointPayload, FeeOptions, computeCombinedPayloadHash };
|
|
8
|
+
export { EntrypointPayload, type FeeOptions, computeCombinedPayloadHash };
|
|
7
9
|
|
|
8
10
|
export { DefaultEntrypoint } from './default_entrypoint.js';
|
|
9
11
|
export { DefaultMultiCallEntrypoint } from './default_multi_call_entrypoint.js';
|
|
@@ -16,6 +18,8 @@ export type ExecutionRequestInit = {
|
|
|
16
18
|
authWitnesses?: AuthWitness[];
|
|
17
19
|
/** Any transient hashed arguments for this execution */
|
|
18
20
|
hashedArguments?: HashedValues[];
|
|
21
|
+
/** Data passed through an oracle for this execution. */
|
|
22
|
+
capsules?: Capsule[];
|
|
19
23
|
/** How the fee is going to be payed */
|
|
20
24
|
fee: FeeOptions;
|
|
21
25
|
/** An optional nonce. Used to repeat a previous tx with a higher fee so that the first one is cancelled */
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AztecAddress, Fr, type GasSettings, GeneratorIndex } from '@aztec/circuits.js';
|
|
3
|
-
import { FunctionType } from '@aztec/foundation/abi';
|
|
1
|
+
import { GeneratorIndex } from '@aztec/constants';
|
|
4
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
3
|
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
+
import type { Tuple } from '@aztec/foundation/serialize';
|
|
6
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
7
|
+
import { FunctionCall, FunctionType } from '@aztec/stdlib/abi';
|
|
8
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
+
import type { GasSettings } from '@aztec/stdlib/gas';
|
|
10
|
+
import { HashedValues } from '@aztec/stdlib/tx';
|
|
8
11
|
|
|
9
|
-
import {
|
|
12
|
+
import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Fee payment options for a transaction.
|
|
@@ -18,6 +21,7 @@ export type FeeOptions = {
|
|
|
18
21
|
gasSettings: GasSettings;
|
|
19
22
|
};
|
|
20
23
|
|
|
24
|
+
// docs:start:user_fee_options
|
|
21
25
|
/** Fee options as set by a user. */
|
|
22
26
|
export type UserFeeOptions = {
|
|
23
27
|
/** The fee payment method to use */
|
|
@@ -31,6 +35,7 @@ export type UserFeeOptions = {
|
|
|
31
35
|
/** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
|
|
32
36
|
estimatedGasPadding?: number;
|
|
33
37
|
};
|
|
38
|
+
// docs:end:user_fee_options
|
|
34
39
|
|
|
35
40
|
// These must match the values defined in:
|
|
36
41
|
// - noir-projects/aztec-nr/aztec/src/entrypoint/app.nr
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { type FunctionCall } from '@aztec/circuit-types';
|
|
2
|
-
import { type AztecAddress } from '@aztec/circuits.js';
|
|
3
1
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
2
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
3
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { FeePaymentMethod } from './fee_payment_method.js';
|
|
6
6
|
|
|
7
|
+
// docs:start:fee_juice_method
|
|
7
8
|
/**
|
|
8
9
|
* Pay fee directly in the Fee Juice.
|
|
9
10
|
*/
|
|
10
11
|
export class FeeJuicePaymentMethod implements FeePaymentMethod {
|
|
12
|
+
// docs:end:fee_juice_method
|
|
11
13
|
constructor(protected sender: AztecAddress) {}
|
|
12
14
|
|
|
13
15
|
getAsset() {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AztecAddress, Fr, FunctionSelector } from '@aztec/circuits.js';
|
|
3
|
-
import { FunctionType, U128 } from '@aztec/foundation/abi';
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
2
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
-
import {
|
|
3
|
+
import type { FunctionCall } from '@aztec/stdlib/abi';
|
|
4
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
6
5
|
|
|
7
|
-
import {
|
|
6
|
+
import type { L2AmountClaim } from '../api/ethereum/portal_manager.js';
|
|
7
|
+
import { getFeeJuice } from '../contract/protocol_contracts.js';
|
|
8
|
+
import type { Wallet } from '../wallet/index.js';
|
|
8
9
|
import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -12,10 +13,10 @@ import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
|
|
|
12
13
|
*/
|
|
13
14
|
export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod {
|
|
14
15
|
constructor(
|
|
15
|
-
|
|
16
|
+
private senderWallet: Wallet,
|
|
16
17
|
private claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>,
|
|
17
18
|
) {
|
|
18
|
-
super(
|
|
19
|
+
super(senderWallet.getAddress());
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -23,7 +24,7 @@ export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod {
|
|
|
23
24
|
* @returns A function call
|
|
24
25
|
*/
|
|
25
26
|
override async getFunctionCalls(): Promise<FunctionCall[]> {
|
|
26
|
-
const canonicalFeeJuice = await
|
|
27
|
+
const canonicalFeeJuice = await getFeeJuice(this.senderWallet);
|
|
27
28
|
const selector = await FunctionSelector.fromNameAndParameters(
|
|
28
29
|
canonicalFeeJuice.artifact.functions.find(f => f.name === 'claim')!,
|
|
29
30
|
);
|
|
@@ -35,8 +36,8 @@ export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod {
|
|
|
35
36
|
selector,
|
|
36
37
|
isStatic: false,
|
|
37
38
|
args: [
|
|
38
|
-
this.
|
|
39
|
-
|
|
39
|
+
this.senderWallet.getAddress().toField(),
|
|
40
|
+
new Fr(this.claim.claimAmount),
|
|
40
41
|
this.claim.claimSecret,
|
|
41
42
|
new Fr(this.claim.messageLeafIndex),
|
|
42
43
|
],
|