@aztec/aztec.js 0.0.1-commit.9b94fc1 → 0.0.1-commit.bf2612ae

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 (186) hide show
  1. package/dest/account/account.d.ts +25 -40
  2. package/dest/account/account.d.ts.map +1 -1
  3. package/dest/account/account.js +19 -47
  4. package/dest/account/account_contract.d.ts +9 -10
  5. package/dest/account/account_contract.d.ts.map +1 -1
  6. package/dest/account/account_with_secret_key.d.ts +21 -9
  7. package/dest/account/account_with_secret_key.d.ts.map +1 -1
  8. package/dest/account/account_with_secret_key.js +21 -4
  9. package/dest/account/index.d.ts +4 -3
  10. package/dest/account/index.d.ts.map +1 -1
  11. package/dest/account/index.js +2 -0
  12. package/dest/account/signerless_account.d.ts +6 -7
  13. package/dest/account/signerless_account.d.ts.map +1 -1
  14. package/dest/account/signerless_account.js +8 -11
  15. package/dest/api/account.d.ts +2 -4
  16. package/dest/api/account.d.ts.map +1 -1
  17. package/dest/api/account.js +1 -3
  18. package/dest/api/authorization.d.ts +2 -2
  19. package/dest/api/authorization.d.ts.map +1 -1
  20. package/dest/api/authorization.js +1 -1
  21. package/dest/api/contract.d.ts +16 -10
  22. package/dest/api/contract.d.ts.map +1 -1
  23. package/dest/api/contract.js +14 -8
  24. package/dest/api/fields.d.ts +3 -2
  25. package/dest/api/fields.d.ts.map +1 -1
  26. package/dest/api/fields.js +2 -1
  27. package/dest/api/node.d.ts +8 -4
  28. package/dest/api/node.d.ts.map +1 -1
  29. package/dest/api/node.js +7 -3
  30. package/dest/api/protocol.d.ts +7 -1
  31. package/dest/api/protocol.d.ts.map +1 -1
  32. package/dest/api/protocol.js +6 -0
  33. package/dest/api/tx.d.ts +2 -2
  34. package/dest/api/tx.d.ts.map +1 -1
  35. package/dest/api/tx.js +1 -1
  36. package/dest/api/wallet.d.ts +2 -2
  37. package/dest/api/wallet.d.ts.map +1 -1
  38. package/dest/api/wallet.js +1 -1
  39. package/dest/authorization/call_authorization_request.d.ts +23 -2
  40. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  41. package/dest/contract/base_contract_interaction.d.ts +8 -10
  42. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  43. package/dest/contract/base_contract_interaction.js +5 -17
  44. package/dest/contract/batch_call.d.ts +1 -1
  45. package/dest/contract/batch_call.d.ts.map +1 -1
  46. package/dest/contract/batch_call.js +3 -1
  47. package/dest/contract/contract_base.d.ts +4 -1
  48. package/dest/contract/contract_base.d.ts.map +1 -1
  49. package/dest/contract/contract_function_interaction.d.ts +1 -1
  50. package/dest/contract/deploy_method.d.ts +64 -17
  51. package/dest/contract/deploy_method.d.ts.map +1 -1
  52. package/dest/contract/deploy_method.js +42 -24
  53. package/dest/contract/interaction_options.d.ts +42 -5
  54. package/dest/contract/interaction_options.d.ts.map +1 -1
  55. package/dest/contract/interaction_options.js +8 -1
  56. package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
  57. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  58. package/dest/contract/protocol_contracts/auth-registry.js +963 -0
  59. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +35 -0
  60. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  61. package/dest/contract/protocol_contracts/contract-class-registry.js +784 -0
  62. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +31 -0
  63. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  64. package/dest/contract/protocol_contracts/contract-instance-registry.js +858 -0
  65. package/dest/contract/protocol_contracts/fee-juice.d.ts +30 -0
  66. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  67. package/dest/contract/protocol_contracts/fee-juice.js +827 -0
  68. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  69. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  70. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +563 -0
  71. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  72. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  73. package/dest/contract/protocol_contracts/public-checks.js +579 -0
  74. package/dest/contract/wait_for_proven.d.ts +2 -2
  75. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  76. package/dest/contract/wait_for_proven.js +1 -1
  77. package/dest/contract/wait_opts.d.ts +16 -0
  78. package/dest/contract/wait_opts.d.ts.map +1 -0
  79. package/dest/contract/wait_opts.js +5 -0
  80. package/dest/deployment/broadcast_function.js +4 -4
  81. package/dest/deployment/publish_class.js +3 -3
  82. package/dest/deployment/publish_instance.d.ts +2 -2
  83. package/dest/deployment/publish_instance.d.ts.map +1 -1
  84. package/dest/deployment/publish_instance.js +3 -3
  85. package/dest/ethereum/portal_manager.d.ts +9 -6
  86. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  87. package/dest/ethereum/portal_manager.js +17 -18
  88. package/dest/fee/fee_juice_payment_method_with_claim.js +1 -1
  89. package/dest/fee/private_fee_payment_method.js +1 -1
  90. package/dest/fee/public_fee_payment_method.js +1 -1
  91. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  92. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  93. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  94. package/dest/utils/abi_types.d.ts +2 -2
  95. package/dest/utils/abi_types.d.ts.map +1 -1
  96. package/dest/utils/authwit.d.ts +9 -7
  97. package/dest/utils/authwit.d.ts.map +1 -1
  98. package/dest/utils/authwit.js +6 -10
  99. package/dest/utils/cross_chain.d.ts +2 -2
  100. package/dest/utils/cross_chain.d.ts.map +1 -1
  101. package/dest/utils/fee_juice.js +1 -1
  102. package/dest/utils/field_compressed_string.js +1 -1
  103. package/dest/utils/node.d.ts +12 -1
  104. package/dest/utils/node.d.ts.map +1 -1
  105. package/dest/utils/node.js +46 -0
  106. package/dest/utils/pub_key.d.ts +2 -2
  107. package/dest/utils/pub_key.d.ts.map +1 -1
  108. package/dest/utils/pub_key.js +1 -1
  109. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +5 -8
  110. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  111. package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
  112. package/dest/wallet/account_manager.d.ts +6 -9
  113. package/dest/wallet/account_manager.d.ts.map +1 -1
  114. package/dest/wallet/account_manager.js +6 -12
  115. package/dest/wallet/deploy_account_method.d.ts +35 -7
  116. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  117. package/dest/wallet/deploy_account_method.js +8 -6
  118. package/dest/wallet/wallet.d.ts +292 -960
  119. package/dest/wallet/wallet.d.ts.map +1 -1
  120. package/dest/wallet/wallet.js +76 -90
  121. package/package.json +15 -13
  122. package/src/account/account.ts +34 -58
  123. package/src/account/account_contract.ts +7 -8
  124. package/src/account/account_with_secret_key.ts +34 -9
  125. package/src/account/index.ts +3 -2
  126. package/src/account/signerless_account.ts +14 -13
  127. package/src/api/account.ts +9 -3
  128. package/src/api/authorization.ts +1 -0
  129. package/src/api/contract.ts +22 -7
  130. package/src/api/fields.ts +2 -1
  131. package/src/api/node.ts +7 -3
  132. package/src/api/protocol.ts +7 -0
  133. package/src/api/tx.ts +2 -0
  134. package/src/api/wallet.ts +9 -2
  135. package/src/authorization/call_authorization_request.ts +1 -1
  136. package/src/contract/base_contract_interaction.ts +27 -15
  137. package/src/contract/batch_call.ts +4 -2
  138. package/src/contract/deploy_method.ts +123 -30
  139. package/src/contract/interaction_options.ts +49 -4
  140. package/src/contract/protocol_contracts/auth-registry.ts +545 -0
  141. package/src/contract/protocol_contracts/contract-class-registry.ts +433 -0
  142. package/src/contract/protocol_contracts/contract-instance-registry.ts +493 -0
  143. package/src/contract/protocol_contracts/fee-juice.ts +457 -0
  144. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +329 -0
  145. package/src/contract/protocol_contracts/public-checks.ts +315 -0
  146. package/src/contract/wait_for_proven.ts +1 -1
  147. package/src/contract/wait_opts.ts +21 -0
  148. package/src/deployment/broadcast_function.ts +4 -4
  149. package/src/deployment/publish_class.ts +3 -3
  150. package/src/deployment/publish_instance.ts +3 -6
  151. package/src/ethereum/portal_manager.ts +20 -24
  152. package/src/fee/fee_juice_payment_method_with_claim.ts +1 -1
  153. package/src/fee/private_fee_payment_method.ts +1 -1
  154. package/src/fee/public_fee_payment_method.ts +1 -1
  155. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  156. package/src/utils/abi_types.ts +1 -1
  157. package/src/utils/authwit.ts +20 -8
  158. package/src/utils/cross_chain.ts +1 -1
  159. package/src/utils/fee_juice.ts +1 -1
  160. package/src/utils/field_compressed_string.ts +1 -1
  161. package/src/utils/node.ts +62 -0
  162. package/src/utils/pub_key.ts +2 -2
  163. package/src/wallet/account_entrypoint_meta_payment_method.ts +28 -60
  164. package/src/wallet/account_manager.ts +6 -14
  165. package/src/wallet/deploy_account_method.ts +38 -14
  166. package/src/wallet/wallet.ts +192 -93
  167. package/dest/account/interface.d.ts +0 -19
  168. package/dest/account/interface.d.ts.map +0 -1
  169. package/dest/account/interface.js +0 -5
  170. package/dest/contract/deploy_sent_tx.d.ts +0 -48
  171. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  172. package/dest/contract/deploy_sent_tx.js +0 -46
  173. package/dest/contract/protocol_contracts.d.ts +0 -9
  174. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  175. package/dest/contract/protocol_contracts.js +0 -26
  176. package/dest/contract/sent_tx.d.ts +0 -51
  177. package/dest/contract/sent_tx.d.ts.map +0 -1
  178. package/dest/contract/sent_tx.js +0 -90
  179. package/dest/contract/unsafe_contract.d.ts +0 -15
  180. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  181. package/dest/contract/unsafe_contract.js +0 -6
  182. package/src/account/interface.ts +0 -25
  183. package/src/contract/deploy_sent_tx.ts +0 -75
  184. package/src/contract/protocol_contracts.ts +0 -35
  185. package/src/contract/sent_tx.ts +0 -130
  186. package/src/contract/unsafe_contract.ts +0 -19
@@ -1,20 +1,11 @@
1
1
  import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
2
- import { EncodedAppEntrypointCalls } from '@aztec/entrypoints/encoding';
3
2
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
- import {
5
- type ContractArtifact,
6
- type FunctionArtifact,
7
- FunctionCall,
8
- FunctionSelector,
9
- encodeArguments,
10
- getFunctionArtifactByName,
11
- } from '@aztec/stdlib/abi';
12
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
13
4
  import type { GasSettings } from '@aztec/stdlib/gas';
14
5
  import { ExecutionPayload } from '@aztec/stdlib/tx';
15
6
 
7
+ import type { Account } from '../account/account.js';
16
8
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
17
- import type { Wallet } from './index.js';
18
9
 
19
10
  /**
20
11
  * Fee payment method that allows an account contract to pay for its own deployment
@@ -33,11 +24,9 @@ import type { Wallet } from './index.js';
33
24
  */
34
25
  export class AccountEntrypointMetaPaymentMethod implements FeePaymentMethod {
35
26
  constructor(
36
- private wallet: Wallet,
37
- private artifact: ContractArtifact,
38
- private feePaymentNameOrArtifact: string | FunctionArtifact,
39
- private accountAddress: AztecAddress,
27
+ private account: Account,
40
28
  private paymentMethod?: FeePaymentMethod,
29
+ private feeEntrypointOptions?: any,
41
30
  ) {}
42
31
 
43
32
  getAsset(): Promise<AztecAddress> {
@@ -45,59 +34,38 @@ export class AccountEntrypointMetaPaymentMethod implements FeePaymentMethod {
45
34
  }
46
35
 
47
36
  async getExecutionPayload(): Promise<ExecutionPayload> {
48
- // Get the execution payload for the fee, it includes the calls and potentially authWitnesses
49
- // It can be empty because the account might attempt to pay for the tx fee using its own
50
- // FeeJuice balance
51
- const { calls: feeCalls, authWitnesses: feeAuthwitnesses } =
52
- (await this.paymentMethod?.getExecutionPayload()) ?? ExecutionPayload.empty();
53
- // Encode the calls for the fee
54
- const feePayer = (await this.paymentMethod?.getFeePayer()) ?? this.accountAddress;
55
- const isFeePayer = feePayer.equals(this.accountAddress);
56
- let accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.EXTERNAL;
57
- if (isFeePayer) {
58
- // If the account is the fee payer, and the incoming fee payload has calls
59
- // it can only be FeeJuicePaymentMethodWithClaim
60
- // If the payload has no calls, it's paying using
61
- // its own fee juice balance
62
- accountFeePaymentMethodOptions =
63
- feeCalls.length === 0
64
- ? AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE
65
- : AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM;
66
- }
67
- const feeEncodedCalls = await EncodedAppEntrypointCalls.create(feeCalls);
37
+ // Get the execution payload for the fee
38
+ const innerPayload = (await this.paymentMethod?.getExecutionPayload()) ?? ExecutionPayload.empty();
68
39
 
69
- // Get the entrypoint args
70
- const args = [feeEncodedCalls, accountFeePaymentMethodOptions, false];
71
- const feePaymentArtifact =
72
- typeof this.feePaymentNameOrArtifact === 'string'
73
- ? getFunctionArtifactByName(this.artifact, this.feePaymentNameOrArtifact)
74
- : this.feePaymentNameOrArtifact;
40
+ // If no fee entrypoint options were provided, compute them based on the wrapped payment method
41
+ // This mimics how the actual account contract works when invoked directly:
42
+ // - If we are the fee payer, are there calls in the inner payload? In that case, those calls can
43
+ // only be claiming fee juice, so we use FEE_JUICE_WITH_CLAIM
44
+ // - If we are the fee payer, but there are no calls, then we assume the account already has
45
+ // fee juice and can pay directly with PREEXISTING_FEE_JUICE
46
+ // - If we are not the fee payer, then EXTERNAL is used
47
+ let options = this.feeEntrypointOptions;
48
+ if (!options) {
49
+ const feePayer = (await this.paymentMethod?.getFeePayer()) ?? this.account.getAddress();
50
+ const isFeePayer = feePayer.equals(this.account.getAddress());
75
51
 
76
- const entrypointCall = new FunctionCall(
77
- feePaymentArtifact.name,
78
- this.accountAddress,
79
- await FunctionSelector.fromNameAndParameters(feePaymentArtifact.name, feePaymentArtifact.parameters),
80
- feePaymentArtifact.functionType,
81
- false /** hideMsgSender -- set to `false`, because it's not applicable for an entrypoint function (only for enqueued public calls) */,
82
- feePaymentArtifact.isStatic,
83
- encodeArguments(feePaymentArtifact, args),
84
- feePaymentArtifact.returnTypes,
85
- );
52
+ let accountFeePaymentMethodOptions = AccountFeePaymentMethodOptions.EXTERNAL;
53
+ if (isFeePayer) {
54
+ accountFeePaymentMethodOptions =
55
+ innerPayload.calls.length === 0
56
+ ? AccountFeePaymentMethodOptions.PREEXISTING_FEE_JUICE
57
+ : AccountFeePaymentMethodOptions.FEE_JUICE_WITH_CLAIM;
58
+ }
86
59
 
87
- // Compute the authwitness required to verify the combined payload
88
- const payloadAuthWitness = await this.wallet.createAuthWit(this.accountAddress, await feeEncodedCalls.hash());
60
+ options = { feePaymentMethodOptions: accountFeePaymentMethodOptions };
61
+ }
89
62
 
90
- return new ExecutionPayload(
91
- [entrypointCall],
92
- [payloadAuthWitness, ...feeAuthwitnesses],
93
- [],
94
- feeEncodedCalls.hashedArguments,
95
- feePayer,
96
- );
63
+ // Use the generic wrapping mechanism from the account interface
64
+ return this.account.wrapExecutionPayload(innerPayload, options);
97
65
  }
98
66
 
99
67
  getFeePayer(): Promise<AztecAddress> {
100
- return this.paymentMethod?.getFeePayer() ?? Promise.resolve(this.accountAddress);
68
+ return this.paymentMethod?.getFeePayer() ?? Promise.resolve(this.account.getAddress());
101
69
  }
102
70
 
103
71
  getGasSettings(): GasSettings | undefined {
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import {
3
3
  CompleteAddress,
4
4
  type ContractInstanceWithAddress,
@@ -9,7 +9,6 @@ import { deriveKeys } from '@aztec/stdlib/keys';
9
9
  import type { AccountContract } from '../account/account_contract.js';
10
10
  import { AccountWithSecretKey } from '../account/account_with_secret_key.js';
11
11
  import type { Salt } from '../account/index.js';
12
- import type { AccountInterface } from '../account/interface.js';
13
12
  import { Contract } from '../contract/contract.js';
14
13
  import { DeployAccountMethod } from './deploy_account_method.js';
15
14
  import type { Wallet } from './wallet.js';
@@ -58,16 +57,6 @@ export class AccountManager {
58
57
  return this.getPublicKeys().hash();
59
58
  }
60
59
 
61
- /**
62
- * Returns the entrypoint for this account as defined by its account contract.
63
- * @returns An entrypoint.
64
- */
65
- public async getAccountInterface(): Promise<AccountInterface> {
66
- const chainInfo = await this.wallet.getChainInfo();
67
- const completeAddress = await this.getCompleteAddress();
68
- return this.accountContract.getInterface(completeAddress, chainInfo);
69
- }
70
-
71
60
  /**
72
61
  * Gets the calculated complete address associated with this account.
73
62
  * Does not require the account to have been published for public execution.
@@ -103,8 +92,9 @@ export class AccountManager {
103
92
  * @returns A Wallet instance.
104
93
  */
105
94
  public async getAccount(): Promise<AccountWithSecretKey> {
106
- const accountInterface = await this.getAccountInterface();
107
- return new AccountWithSecretKey(accountInterface, this.secretKey, this.salt);
95
+ const completeAddress = await this.getCompleteAddress();
96
+ const account = this.accountContract.getAccount(completeAddress);
97
+ return new AccountWithSecretKey(account, this.secretKey, this.salt);
108
98
  }
109
99
 
110
100
  /**
@@ -134,12 +124,14 @@ export class AccountManager {
134
124
  constructorArgs: undefined,
135
125
  };
136
126
 
127
+ const account = await this.getAccount();
137
128
  return new DeployAccountMethod(
138
129
  this.getPublicKeys(),
139
130
  this.wallet,
140
131
  artifact,
141
132
  instance => Contract.at(instance.address, artifact, this.wallet),
142
133
  new Fr(this.salt),
134
+ account,
143
135
  constructorArgs,
144
136
  constructorName,
145
137
  );
@@ -1,34 +1,62 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
5
  import type { PublicKeys } from '@aztec/stdlib/keys';
6
6
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
7
7
 
8
+ import type { Account } from '../account/account.js';
8
9
  import type { Contract } from '../contract/contract.js';
9
10
  import type { ContractBase } from '../contract/contract_base.js';
10
11
  import {
11
12
  DeployMethod,
12
- type DeployOptions,
13
+ type DeployOptionsWithoutWait,
13
14
  type RequestDeployOptions,
14
15
  type SimulateDeployOptions,
15
16
  } from '../contract/deploy_method.js';
17
+ import type { FeePaymentMethodOption, InteractionWaitOptions } from '../contract/interaction_options.js';
16
18
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
17
19
  import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
18
20
  import type { Wallet } from './index.js';
19
21
 
22
+ /**
23
+ * Extended fee payment method option for account deployments that includes entrypoint wrapping options
24
+ */
25
+ export type DeployAccountFeePaymentMethodOption = FeePaymentMethodOption & {
26
+ /** Optional entrypoint-specific options for wrapping execution payloads */
27
+ feeEntrypointOptions?: unknown;
28
+ };
29
+
20
30
  /**
21
31
  * The configuration options for the request method. Omits the contractAddressSalt, since
22
32
  * for account contracts that is fixed in the constructor
23
33
  */
24
- export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt'>;
34
+ export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt' | 'fee'> & {
35
+ /** Fee options specific to account deployment */
36
+ fee?: DeployAccountFeePaymentMethodOption;
37
+ };
38
+
39
+ /**
40
+ * Base configuration options for the send/prove methods without wait parameter. Omits:
41
+ * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
42
+ * - UniversalDeployment flag, since account contracts are always deployed with it set to true
43
+ */
44
+ export type DeployAccountOptionsWithoutWait = Omit<DeployOptionsWithoutWait, 'contractAddressSalt' | 'universalDeploy'>;
25
45
 
26
46
  /**
27
47
  * The configuration options for the send/prove methods. Omits:
28
48
  * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
29
49
  * - UniversalDeployment flag, since account contracts are always deployed with it set to true
30
50
  */
31
- export type DeployAccountOptions = Omit<DeployOptions, 'contractAddressSalt' | 'universalDeploy'>;
51
+ export type DeployAccountOptions<W extends InteractionWaitOptions = undefined> = DeployAccountOptionsWithoutWait & {
52
+ /**
53
+ * Whether to wait for the transaction to be mined.
54
+ * - undefined (default): wait with default options and return TxReceipt
55
+ * - WaitOpts object: wait with custom options and return TxReceipt
56
+ * - false: return txHash immediately without waiting
57
+ */
58
+ wait?: W;
59
+ };
32
60
 
33
61
  /**
34
62
  * The configuration options for the simulate method. Omits the contractAddressSalt, since
@@ -47,6 +75,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
47
75
  artifact: ContractArtifact,
48
76
  postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
49
77
  private salt: Fr,
78
+ private account: Account,
50
79
  args: any[] = [],
51
80
  constructorNameOrArtifact?: string | FunctionArtifact,
52
81
  ) {
@@ -61,19 +90,14 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
61
90
  * For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
62
91
  *
63
92
  * @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
93
+ * @param feeEntrypointOptions - Optional entrypoint-specific options for wrapping. If not provided, will be auto-computed based on the payment method.
64
94
  * @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
65
95
  */
66
- private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod) {
96
+ private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod, feeEntrypointOptions?: any) {
67
97
  if (!this.address) {
68
98
  throw new Error('Instance is not yet constructed. This is a bug!');
69
99
  }
70
- return new AccountEntrypointMetaPaymentMethod(
71
- this.wallet,
72
- this.artifact,
73
- 'entrypoint',
74
- this.address,
75
- originalPaymentMethod,
76
- );
100
+ return new AccountEntrypointMetaPaymentMethod(this.account, originalPaymentMethod, feeEntrypointOptions);
77
101
  }
78
102
 
79
103
  /**
@@ -97,7 +121,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
97
121
  const executionPayloads = [deploymentExecutionPayload];
98
122
  // If this is a self-deployment, manage the fee accordingly
99
123
  if (opts?.deployer?.equals(AztecAddress.ZERO)) {
100
- const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod);
124
+ const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod, opts?.fee?.feeEntrypointOptions);
101
125
  const feeExecutionPayload = await feePaymentMethod.getExecutionPayload();
102
126
  // Notice they are reversed (fee payment usually goes first):
103
127
  // this is because we need to construct the contract BEFORE it can pay for its own fee
@@ -113,7 +137,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
113
137
  return mergeExecutionPayloads(executionPayloads);
114
138
  }
115
139
 
116
- override convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
140
+ override convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions {
117
141
  return {
118
142
  ...options,
119
143
  // Deployer is handled in the request method and forcibly set to undefined,