@aztec/aztec.js 0.65.1 → 0.65.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.
Files changed (37) hide show
  1. package/dest/account_manager/deploy_account_method.d.ts +1 -1
  2. package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
  3. package/dest/account_manager/deploy_account_method.js +3 -2
  4. package/dest/account_manager/index.d.ts +1 -1
  5. package/dest/account_manager/index.d.ts.map +1 -1
  6. package/dest/account_manager/index.js +1 -2
  7. package/dest/contract/base_contract_interaction.d.ts +12 -11
  8. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  9. package/dest/contract/base_contract_interaction.js +27 -13
  10. package/dest/contract/batch_call.d.ts.map +1 -1
  11. package/dest/contract/batch_call.js +11 -17
  12. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  13. package/dest/contract/contract_function_interaction.js +5 -12
  14. package/dest/contract/deploy_method.d.ts +2 -2
  15. package/dest/contract/deploy_method.d.ts.map +1 -1
  16. package/dest/contract/deploy_method.js +10 -17
  17. package/dest/entrypoint/default_entrypoint.d.ts.map +1 -1
  18. package/dest/entrypoint/default_entrypoint.js +4 -5
  19. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
  20. package/dest/entrypoint/default_multi_call_entrypoint.js +4 -5
  21. package/dest/entrypoint/entrypoint.d.ts +1 -1
  22. package/dest/entrypoint/entrypoint.d.ts.map +1 -1
  23. package/dest/entrypoint/payload.d.ts +12 -0
  24. package/dest/entrypoint/payload.d.ts.map +1 -1
  25. package/dest/entrypoint/payload.js +1 -1
  26. package/dest/main.js +1 -1
  27. package/package.json +8 -8
  28. package/src/account_manager/deploy_account_method.ts +5 -2
  29. package/src/account_manager/index.ts +1 -2
  30. package/src/contract/base_contract_interaction.ts +37 -18
  31. package/src/contract/batch_call.ts +18 -29
  32. package/src/contract/contract_function_interaction.ts +4 -11
  33. package/src/contract/deploy_method.ts +15 -18
  34. package/src/entrypoint/default_entrypoint.ts +3 -4
  35. package/src/entrypoint/default_multi_call_entrypoint.ts +3 -4
  36. package/src/entrypoint/entrypoint.ts +1 -1
  37. package/src/entrypoint/payload.ts +13 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aztec/aztec.js",
3
3
  "homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
4
- "version": "0.65.1",
4
+ "version": "0.65.2",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./dest/index.js",
@@ -76,13 +76,13 @@
76
76
  ]
77
77
  },
78
78
  "dependencies": {
79
- "@aztec/circuit-types": "0.65.1",
80
- "@aztec/circuits.js": "0.65.1",
81
- "@aztec/ethereum": "0.65.1",
82
- "@aztec/foundation": "0.65.1",
83
- "@aztec/l1-artifacts": "0.65.1",
84
- "@aztec/protocol-contracts": "0.65.1",
85
- "@aztec/types": "0.65.1",
79
+ "@aztec/circuit-types": "0.65.2",
80
+ "@aztec/circuits.js": "0.65.2",
81
+ "@aztec/ethereum": "0.65.2",
82
+ "@aztec/foundation": "0.65.2",
83
+ "@aztec/l1-artifacts": "0.65.2",
84
+ "@aztec/protocol-contracts": "0.65.2",
85
+ "@aztec/types": "0.65.2",
86
86
  "axios": "^1.7.2",
87
87
  "tslib": "^2.4.0",
88
88
  "viem": "^2.7.15"
@@ -46,13 +46,16 @@ export class DeployAccountMethod extends DeployMethod {
46
46
  : feePaymentNameOrArtifact;
47
47
  }
48
48
 
49
- protected override async getInitializeFunctionCalls(options: DeployOptions): Promise<ExecutionRequestInit> {
49
+ protected override async getInitializeFunctionCalls(
50
+ options: DeployOptions,
51
+ ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'packedArguments'>> {
50
52
  const exec = await super.getInitializeFunctionCalls(options);
51
53
 
52
54
  if (options.fee && this.#feePaymentArtifact) {
53
55
  const { address } = this.getInstance();
54
56
  const emptyAppPayload = EntrypointPayload.fromAppExecution([]);
55
- const feePayload = await EntrypointPayload.fromFeeOptions(address, options?.fee);
57
+ const fee = await this.getDefaultFeeOptions(options.fee);
58
+ const feePayload = await EntrypointPayload.fromFeeOptions(address, fee);
56
59
 
57
60
  exec.calls.push({
58
61
  name: this.#feePaymentArtifact.name,
@@ -17,7 +17,7 @@ import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
17
17
  */
18
18
  export type DeployAccountOptions = Pick<
19
19
  DeployOptions,
20
- 'fee' | 'skipClassRegistration' | 'skipPublicDeployment' | 'estimateGas' | 'skipInitialization'
20
+ 'fee' | 'skipClassRegistration' | 'skipPublicDeployment' | 'skipInitialization'
21
21
  >;
22
22
 
23
23
  /**
@@ -166,7 +166,6 @@ export class AccountManager {
166
166
  skipInitialization: opts?.skipInitialization ?? false,
167
167
  universalDeploy: true,
168
168
  fee: opts?.fee,
169
- estimateGas: opts?.estimateGas,
170
169
  }),
171
170
  )
172
171
  .then(tx => tx.getTxHash());
@@ -3,7 +3,9 @@ import { type Fr, GasSettings } from '@aztec/circuits.js';
3
3
  import { createDebugLogger } from '@aztec/foundation/log';
4
4
 
5
5
  import { type Wallet } from '../account/wallet.js';
6
- import { type ExecutionRequestInit, type FeeOptions } from '../entrypoint/entrypoint.js';
6
+ import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
7
+ import { type FeeOptions, type UserFeeOptions } from '../entrypoint/payload.js';
8
+ import { NoFeePaymentMethod } from '../fee/no_fee_payment_method.js';
7
9
  import { getGasLimits } from './get_gas_limits.js';
8
10
  import { ProvenTx } from './proven_tx.js';
9
11
  import { SentTx } from './sent_tx.js';
@@ -16,11 +18,7 @@ export type SendMethodOptions = {
16
18
  /** Wether to skip the simulation of the public part of the transaction. */
17
19
  skipPublicSimulation?: boolean;
18
20
  /** The fee options for the transaction. */
19
- fee?: FeeOptions;
20
- /** Whether to run an initial simulation of the tx with high gas limit to figure out actual gas settings (will default to true later down the road). */
21
- estimateGas?: boolean;
22
- /** Percentage to pad the suggested gas limits by, if empty, defaults to 10%. */
23
- estimatedGasPad?: number;
21
+ fee?: UserFeeOptions;
24
22
  /** Custom nonce to inject into the app payload of the transaction. Useful when trying to cancel an ongoing transaction by creating a new one with a higher fee */
25
23
  nonce?: Fr;
26
24
  /** Whether the transaction can be cancelled. If true, an extra nullifier will be emitted: H(nonce, GENERATOR_INDEX__TX_NULLIFIER) */
@@ -92,33 +90,54 @@ export abstract class BaseContractInteraction {
92
90
  public async estimateGas(
93
91
  opts?: Omit<SendMethodOptions, 'estimateGas' | 'skipPublicSimulation'>,
94
92
  ): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>> {
95
- const txRequest = await this.create({ ...opts, estimateGas: false });
93
+ const txRequest = await this.create({ ...opts, fee: { ...opts?.fee, estimateGas: false } });
96
94
  const simulationResult = await this.wallet.simulateTx(txRequest, true);
97
95
  const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
98
96
  simulationResult,
99
- opts?.estimatedGasPad,
97
+ opts?.fee?.estimatedGasPadding,
100
98
  );
101
99
  return { gasLimits, teardownGasLimits };
102
100
  }
103
101
 
104
102
  /**
105
- * Helper method to return fee options based on the user opts, estimating tx gas if needed.
103
+ * Returns default fee options based on the user opts without running a simulation for gas estimation.
104
+ * @param fee - User-provided fee options.
105
+ */
106
+ protected async getDefaultFeeOptions(fee: UserFeeOptions | undefined): Promise<FeeOptions> {
107
+ const maxFeesPerGas = fee?.gasSettings?.maxFeesPerGas ?? (await this.wallet.getCurrentBaseFees());
108
+ const paymentMethod = fee?.paymentMethod ?? new NoFeePaymentMethod();
109
+ const gasSettings: GasSettings = GasSettings.default({ ...fee?.gasSettings, maxFeesPerGas });
110
+ return { gasSettings, paymentMethod };
111
+ }
112
+
113
+ /**
114
+ * Return fee options based on the user opts, estimating tx gas if needed.
106
115
  * @param request - Request to execute for this interaction.
107
116
  * @param pad - Percentage to pad the suggested gas limits by, as decimal (e.g., 0.10 for 10%).
108
117
  * @returns Fee options for the actual transaction.
109
118
  */
110
- protected async getFeeOptionsFromEstimatedGas(request: ExecutionRequestInit, pad?: number) {
111
- const fee = request.fee;
112
- if (fee) {
113
- const txRequest = await this.wallet.createTxExecutionRequest(request);
119
+ protected async getFeeOptions(
120
+ request: Omit<ExecutionRequestInit, 'fee'> & { /** User-provided fee options */ fee?: UserFeeOptions },
121
+ ): Promise<FeeOptions> {
122
+ const defaultFeeOptions = await this.getDefaultFeeOptions(request.fee);
123
+ const paymentMethod = defaultFeeOptions.paymentMethod;
124
+ const maxFeesPerGas = defaultFeeOptions.gasSettings.maxFeesPerGas;
125
+
126
+ let gasSettings = defaultFeeOptions.gasSettings;
127
+ if (request.fee?.estimateGas) {
128
+ const feeForEstimation: FeeOptions = { paymentMethod, gasSettings };
129
+ const txRequest = await this.wallet.createTxExecutionRequest({ ...request, fee: feeForEstimation });
114
130
  const simulationResult = await this.wallet.simulateTx(txRequest, true);
115
- const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(simulationResult, pad);
116
- this.log.debug(
131
+ const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
132
+ simulationResult,
133
+ request.fee?.estimatedGasPadding,
134
+ );
135
+ gasSettings = GasSettings.from({ maxFeesPerGas, gasLimits, teardownGasLimits });
136
+ this.log.verbose(
117
137
  `Estimated gas limits for tx: DA=${gasLimits.daGas} L2=${gasLimits.l2Gas} teardownDA=${teardownGasLimits.daGas} teardownL2=${teardownGasLimits.l2Gas}`,
118
138
  );
119
- const gasSettings = GasSettings.default({ ...fee.gasSettings, gasLimits, teardownGasLimits });
120
- return { ...fee, gasSettings };
121
139
  }
122
- return fee;
140
+
141
+ return { gasSettings, paymentMethod };
123
142
  }
124
143
  }
@@ -19,10 +19,8 @@ export class BatchCall extends BaseContractInteraction {
19
19
  */
20
20
  public async create(opts?: SendMethodOptions): Promise<TxExecutionRequest> {
21
21
  const calls = this.calls;
22
- const fee = opts?.estimateGas
23
- ? await this.getFeeOptionsFromEstimatedGas({ calls, fee: opts?.fee }, opts?.estimatedGasPad)
24
- : opts?.fee;
25
- return await this.wallet.createTxExecutionRequest({ calls, fee });
22
+ const fee = await this.getFeeOptions({ calls, ...opts });
23
+ return await this.wallet.createTxExecutionRequest({ calls, ...opts, fee });
26
24
  }
27
25
 
28
26
  /**
@@ -35,29 +33,21 @@ export class BatchCall extends BaseContractInteraction {
35
33
  * @returns The result of the transaction as returned by the contract function.
36
34
  */
37
35
  public async simulate(options: SimulateMethodOptions = {}): Promise<any> {
38
- const { calls, unconstrained } = this.calls.reduce<{
39
- /**
40
- * Keep track of the number of private calls to retrieve the return values
41
- */
36
+ const { indexedCalls, unconstrained } = this.calls.reduce<{
37
+ /** Keep track of the number of private calls to retrieve the return values */
42
38
  privateIndex: 0;
43
- /**
44
- * Keep track of the number of private calls to retrieve the return values
45
- */
39
+ /** Keep track of the number of public calls to retrieve the return values */
46
40
  publicIndex: 0;
47
- /**
48
- * The public and private function calls in the batch
49
- */
50
- calls: [FunctionCall, number, number][];
51
- /**
52
- * The unconstrained function calls in the batch.
53
- */
41
+ /** The public and private function calls in the batch */
42
+ indexedCalls: [FunctionCall, number, number][];
43
+ /** The unconstrained function calls in the batch. */
54
44
  unconstrained: [FunctionCall, number][];
55
45
  }>(
56
46
  (acc, current, index) => {
57
47
  if (current.type === FunctionType.UNCONSTRAINED) {
58
48
  acc.unconstrained.push([current, index]);
59
49
  } else {
60
- acc.calls.push([
50
+ acc.indexedCalls.push([
61
51
  current,
62
52
  index,
63
53
  current.type === FunctionType.PRIVATE ? acc.privateIndex++ : acc.publicIndex++,
@@ -65,18 +55,17 @@ export class BatchCall extends BaseContractInteraction {
65
55
  }
66
56
  return acc;
67
57
  },
68
- { calls: [], unconstrained: [], publicIndex: 0, privateIndex: 0 },
58
+ { indexedCalls: [], unconstrained: [], publicIndex: 0, privateIndex: 0 },
69
59
  );
70
60
 
71
- const txRequest = await this.wallet.createTxExecutionRequest({ calls: calls.map(indexedCall => indexedCall[0]) });
61
+ const calls = indexedCalls.map(([call]) => call);
62
+ const fee = await this.getFeeOptions({ calls, ...options });
63
+ const txRequest = await this.wallet.createTxExecutionRequest({ calls, ...options, fee });
72
64
 
73
- const unconstrainedCalls = unconstrained.map(async indexedCall => {
74
- const call = indexedCall[0];
75
- return [
76
- await this.wallet.simulateUnconstrained(call.name, call.args, call.to, options?.from),
77
- indexedCall[1],
78
- ] as const;
79
- });
65
+ const unconstrainedCalls = unconstrained.map(
66
+ async ([call, index]) =>
67
+ [await this.wallet.simulateUnconstrained(call.name, call.args, call.to, options?.from), index] as const,
68
+ );
80
69
 
81
70
  const [unconstrainedResults, simulatedTx] = await Promise.all([
82
71
  Promise.all(unconstrainedCalls),
@@ -88,7 +77,7 @@ export class BatchCall extends BaseContractInteraction {
88
77
  unconstrainedResults.forEach(([result, index]) => {
89
78
  results[index] = result;
90
79
  });
91
- calls.forEach(([call, callIndex, resultIndex]) => {
80
+ indexedCalls.forEach(([call, callIndex, resultIndex]) => {
92
81
  // As account entrypoints are private, for private functions we retrieve the return values from the first nested call
93
82
  // since we're interested in the first set of values AFTER the account entrypoint
94
83
  // For public functions we retrieve the first values directly from the public output.
@@ -58,21 +58,14 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
58
58
  * @param opts - An optional object containing additional configuration for the transaction.
59
59
  * @returns A Promise that resolves to a transaction instance.
60
60
  */
61
- public async create(opts?: SendMethodOptions): Promise<TxExecutionRequest> {
61
+ public async create(opts: SendMethodOptions = {}): Promise<TxExecutionRequest> {
62
62
  if (this.functionDao.functionType === FunctionType.UNCONSTRAINED) {
63
63
  throw new Error("Can't call `create` on an unconstrained function.");
64
64
  }
65
65
  const calls = [this.request()];
66
- const fee = opts?.estimateGas
67
- ? await this.getFeeOptionsFromEstimatedGas({ calls, fee: opts?.fee }, opts?.estimatedGasPad)
68
- : opts?.fee;
69
- const txRequest = await this.wallet.createTxExecutionRequest({
70
- calls,
71
- fee,
72
- nonce: opts?.nonce,
73
- cancellable: opts?.cancellable,
74
- });
75
- return txRequest;
66
+ const fee = await this.getFeeOptions({ calls, ...opts });
67
+ const { nonce, cancellable } = opts;
68
+ return await this.wallet.createTxExecutionRequest({ calls, fee, nonce, cancellable });
76
69
  }
77
70
 
78
71
  /**
@@ -104,18 +104,15 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
104
104
  throw new Error(`No function calls needed to deploy contract ${this.artifact.name}`);
105
105
  }
106
106
 
107
- const request = {
108
- calls: [...deployment.calls, ...bootstrap.calls],
109
- authWitnesses: [...(deployment.authWitnesses ?? []), ...(bootstrap.authWitnesses ?? [])],
110
- packedArguments: [...(deployment.packedArguments ?? []), ...(bootstrap.packedArguments ?? [])],
111
- fee: options.fee,
112
- };
107
+ const calls = [...deployment.calls, ...bootstrap.calls];
108
+ const authWitnesses = [...(deployment.authWitnesses ?? []), ...(bootstrap.authWitnesses ?? [])];
109
+ const packedArguments = [...(deployment.packedArguments ?? []), ...(bootstrap.packedArguments ?? [])];
110
+ const { cancellable, nonce, fee: userFee } = options;
113
111
 
114
- if (options.estimateGas) {
115
- request.fee = await this.getFeeOptionsFromEstimatedGas(request, options.estimatedGasPad);
116
- }
112
+ const request = { calls, authWitnesses, packedArguments, cancellable, fee: userFee, nonce };
117
113
 
118
- return request;
114
+ const fee = await this.getFeeOptions(request);
115
+ return { ...request, fee };
119
116
  }
120
117
 
121
118
  /**
@@ -133,7 +130,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
133
130
  * @param options - Deployment options.
134
131
  * @returns A function call array with potentially requests to the class registerer and instance deployer.
135
132
  */
136
- protected async getDeploymentFunctionCalls(options: DeployOptions = {}): Promise<ExecutionRequestInit> {
133
+ protected async getDeploymentFunctionCalls(
134
+ options: DeployOptions = {},
135
+ ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'packedArguments'>> {
137
136
  const calls: FunctionCall[] = [];
138
137
 
139
138
  // Set contract instance object so it's available for populating the DeploySendTx object
@@ -167,9 +166,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
167
166
  calls.push(deployInstance(this.wallet, instance).request());
168
167
  }
169
168
 
170
- return {
171
- calls,
172
- };
169
+ return { calls };
173
170
  }
174
171
 
175
172
  /**
@@ -177,7 +174,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
177
174
  * @param options - Deployment options.
178
175
  * @returns - An array of function calls.
179
176
  */
180
- protected getInitializeFunctionCalls(options: DeployOptions): Promise<ExecutionRequestInit> {
177
+ protected getInitializeFunctionCalls(
178
+ options: DeployOptions,
179
+ ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'packedArguments'>> {
181
180
  const { address } = this.getInstance(options);
182
181
  const calls: FunctionCall[] = [];
183
182
  if (this.constructorArtifact && !options.skipInitialization) {
@@ -189,9 +188,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
189
188
  );
190
189
  calls.push(constructorCall.request());
191
190
  }
192
- return Promise.resolve({
193
- calls,
194
- });
191
+ return Promise.resolve({ calls });
195
192
  }
196
193
 
197
194
  /**
@@ -1,5 +1,5 @@
1
1
  import { PackedValues, TxExecutionRequest } from '@aztec/circuit-types';
2
- import { GasSettings, TxContext } from '@aztec/circuits.js';
2
+ import { TxContext } from '@aztec/circuits.js';
3
3
  import { FunctionType } from '@aztec/foundation/abi';
4
4
 
5
5
  import { type EntrypointInterface, type ExecutionRequestInit } from './entrypoint.js';
@@ -11,7 +11,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
11
11
  constructor(private chainId: number, private protocolVersion: number) {}
12
12
 
13
13
  createTxExecutionRequest(exec: ExecutionRequestInit): Promise<TxExecutionRequest> {
14
- const { calls, authWitnesses = [], packedArguments = [] } = exec;
14
+ const { fee, calls, authWitnesses = [], packedArguments = [] } = exec;
15
15
 
16
16
  if (calls.length > 1) {
17
17
  throw new Error(`Expected a single call, got ${calls.length}`);
@@ -24,8 +24,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
24
24
  }
25
25
 
26
26
  const entrypointPackedValues = PackedValues.fromValues(call.args);
27
- const gasSettings = exec.fee?.gasSettings ?? GasSettings.default();
28
- const txContext = new TxContext(this.chainId, this.protocolVersion, gasSettings);
27
+ const txContext = new TxContext(this.chainId, this.protocolVersion, fee.gasSettings);
29
28
  return Promise.resolve(
30
29
  new TxExecutionRequest(
31
30
  call.to,
@@ -1,6 +1,6 @@
1
1
  import { type EntrypointInterface, EntrypointPayload, type ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
2
2
  import { PackedValues, TxExecutionRequest } from '@aztec/circuit-types';
3
- import { type AztecAddress, GasSettings, TxContext } from '@aztec/circuits.js';
3
+ import { type AztecAddress, TxContext } from '@aztec/circuits.js';
4
4
  import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
5
5
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
6
6
 
@@ -15,17 +15,16 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
15
15
  ) {}
16
16
 
17
17
  createTxExecutionRequest(executions: ExecutionRequestInit): Promise<TxExecutionRequest> {
18
- const { calls, authWitnesses = [], packedArguments = [] } = executions;
18
+ const { fee, calls, authWitnesses = [], packedArguments = [] } = executions;
19
19
  const payload = EntrypointPayload.fromAppExecution(calls);
20
20
  const abi = this.getEntrypointAbi();
21
21
  const entrypointPackedArgs = PackedValues.fromValues(encodeArguments(abi, [payload]));
22
- const gasSettings = executions.fee?.gasSettings ?? GasSettings.default();
23
22
 
24
23
  const txRequest = TxExecutionRequest.from({
25
24
  firstCallArgsHash: entrypointPackedArgs.hash,
26
25
  origin: this.address,
27
26
  functionSelector: FunctionSelector.fromNameAndParameters(abi.name, abi.parameters),
28
- txContext: new TxContext(this.chainId, this.version, gasSettings),
27
+ txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
29
28
  argsOfCalls: [...payload.packedArguments, ...packedArguments, entrypointPackedArgs],
30
29
  authWitnesses,
31
30
  });
@@ -17,7 +17,7 @@ export type ExecutionRequestInit = {
17
17
  /** Any transient packed arguments for this execution */
18
18
  packedArguments?: PackedValues[];
19
19
  /** How the fee is going to be payed */
20
- fee?: FeeOptions;
20
+ fee: FeeOptions;
21
21
  /** An optional nonce. Used to repeat a previous tx with a higher fee so that the first one is cancelled */
22
22
  nonce?: Fr;
23
23
  /** Whether the transaction can be cancelled. If true, an extra nullifier will be emitted: H(nonce, GENERATOR_INDEX__TX_NULLIFIER) */
@@ -4,6 +4,7 @@ import { FunctionType } from '@aztec/foundation/abi';
4
4
  import { padArrayEnd } from '@aztec/foundation/collection';
5
5
  import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
6
6
  import { type Tuple } from '@aztec/foundation/serialize';
7
+ import { type FieldsOf } from '@aztec/foundation/types';
7
8
 
8
9
  import { type FeePaymentMethod } from '../fee/fee_payment_method.js';
9
10
 
@@ -17,6 +18,18 @@ export type FeeOptions = {
17
18
  gasSettings: GasSettings;
18
19
  };
19
20
 
21
+ /** Fee options as set by a user. */
22
+ export type UserFeeOptions = {
23
+ /** The fee payment method to use */
24
+ paymentMethod?: FeePaymentMethod;
25
+ /** The gas settings */
26
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
27
+ /** Whether to run an initial simulation of the tx with high gas limit to figure out actual gas settings. */
28
+ estimateGas?: boolean;
29
+ /** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
30
+ estimatedGasPadding?: number;
31
+ };
32
+
20
33
  // These must match the values defined in:
21
34
  // - noir-projects/aztec-nr/aztec/src/entrypoint/app.nr
22
35
  const APP_MAX_CALLS = 4;