@aztec/aztec.js 0.0.1-commit.b655e406 → 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 (246) hide show
  1. package/dest/account/account.d.ts +26 -42
  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 +20 -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 +7 -9
  13. package/dest/account/signerless_account.d.ts.map +1 -1
  14. package/dest/account/signerless_account.js +8 -11
  15. package/dest/api/abi.d.ts +1 -1
  16. package/dest/api/account.d.ts +3 -4
  17. package/dest/api/account.d.ts.map +1 -1
  18. package/dest/api/account.js +2 -3
  19. package/dest/api/addresses.d.ts +1 -1
  20. package/dest/api/authorization.d.ts +2 -2
  21. package/dest/api/authorization.d.ts.map +1 -1
  22. package/dest/api/authorization.js +1 -1
  23. package/dest/api/block.d.ts +1 -1
  24. package/dest/api/contract.d.ts +17 -11
  25. package/dest/api/contract.d.ts.map +1 -1
  26. package/dest/api/contract.js +15 -9
  27. package/dest/api/crypto.d.ts +1 -1
  28. package/dest/api/deployment.d.ts +1 -1
  29. package/dest/api/eth_address.d.ts +1 -1
  30. package/dest/api/ethereum.d.ts +1 -1
  31. package/dest/api/events.d.ts +1 -1
  32. package/dest/api/fee.d.ts +1 -1
  33. package/dest/api/fee_testing.d.ts +1 -1
  34. package/dest/api/fields.d.ts +3 -2
  35. package/dest/api/fields.d.ts.map +1 -1
  36. package/dest/api/fields.js +2 -1
  37. package/dest/api/keys.d.ts +1 -1
  38. package/dest/api/log.d.ts +1 -1
  39. package/dest/api/messaging.d.ts +1 -1
  40. package/dest/api/node.d.ts +8 -4
  41. package/dest/api/node.d.ts.map +1 -1
  42. package/dest/api/node.js +7 -3
  43. package/dest/api/note.d.ts +2 -2
  44. package/dest/api/note.d.ts.map +1 -1
  45. package/dest/api/note.js +1 -1
  46. package/dest/api/protocol.d.ts +7 -1
  47. package/dest/api/protocol.d.ts.map +1 -1
  48. package/dest/api/protocol.js +6 -0
  49. package/dest/api/trees.d.ts +1 -1
  50. package/dest/api/tx.d.ts +2 -2
  51. package/dest/api/tx.d.ts.map +1 -1
  52. package/dest/api/tx.js +1 -1
  53. package/dest/api/utils.d.ts +1 -1
  54. package/dest/api/wallet.d.ts +2 -3
  55. package/dest/api/wallet.d.ts.map +1 -1
  56. package/dest/api/wallet.js +1 -2
  57. package/dest/authorization/call_authorization_request.d.ts +2 -2
  58. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  59. package/dest/contract/base_contract_interaction.d.ts +8 -11
  60. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  61. package/dest/contract/base_contract_interaction.js +5 -17
  62. package/dest/contract/batch_call.d.ts +8 -9
  63. package/dest/contract/batch_call.d.ts.map +1 -1
  64. package/dest/contract/batch_call.js +54 -34
  65. package/dest/contract/checker.d.ts +1 -1
  66. package/dest/contract/contract.d.ts +2 -2
  67. package/dest/contract/contract.d.ts.map +1 -1
  68. package/dest/contract/contract.js +4 -5
  69. package/dest/contract/contract_base.d.ts +6 -10
  70. package/dest/contract/contract_base.d.ts.map +1 -1
  71. package/dest/contract/contract_base.js +5 -12
  72. package/dest/contract/contract_function_interaction.d.ts +3 -3
  73. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  74. package/dest/contract/contract_function_interaction.js +9 -6
  75. package/dest/contract/deploy_method.d.ts +71 -23
  76. package/dest/contract/deploy_method.d.ts.map +1 -1
  77. package/dest/contract/deploy_method.js +49 -29
  78. package/dest/contract/get_gas_limits.d.ts +1 -1
  79. package/dest/contract/interaction_options.d.ts +44 -7
  80. package/dest/contract/interaction_options.d.ts.map +1 -1
  81. package/dest/contract/interaction_options.js +12 -11
  82. package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
  83. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  84. package/dest/contract/protocol_contracts/auth-registry.js +963 -0
  85. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +35 -0
  86. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  87. package/dest/contract/protocol_contracts/contract-class-registry.js +784 -0
  88. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +31 -0
  89. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  90. package/dest/contract/protocol_contracts/contract-instance-registry.js +858 -0
  91. package/dest/contract/protocol_contracts/fee-juice.d.ts +30 -0
  92. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  93. package/dest/contract/protocol_contracts/fee-juice.js +827 -0
  94. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  95. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  96. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +563 -0
  97. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  98. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  99. package/dest/contract/protocol_contracts/public-checks.js +579 -0
  100. package/dest/contract/wait_for_proven.d.ts +2 -2
  101. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  102. package/dest/contract/wait_for_proven.js +1 -1
  103. package/dest/contract/wait_opts.d.ts +16 -0
  104. package/dest/contract/wait_opts.d.ts.map +1 -0
  105. package/dest/contract/wait_opts.js +5 -0
  106. package/dest/deployment/broadcast_function.d.ts +1 -1
  107. package/dest/deployment/broadcast_function.js +4 -4
  108. package/dest/deployment/contract_deployer.d.ts +1 -1
  109. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  110. package/dest/deployment/contract_deployer.js +1 -1
  111. package/dest/deployment/publish_class.d.ts +1 -1
  112. package/dest/deployment/publish_class.js +3 -3
  113. package/dest/deployment/publish_instance.d.ts +2 -2
  114. package/dest/deployment/publish_instance.d.ts.map +1 -1
  115. package/dest/deployment/publish_instance.js +3 -3
  116. package/dest/ethereum/portal_manager.d.ts +7 -6
  117. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  118. package/dest/ethereum/portal_manager.js +48 -22
  119. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +2 -2
  120. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  121. package/dest/fee/fee_juice_payment_method_with_claim.js +3 -3
  122. package/dest/fee/fee_payment_method.d.ts +2 -2
  123. package/dest/fee/fee_payment_method.d.ts.map +1 -1
  124. package/dest/fee/private_fee_payment_method.d.ts +2 -2
  125. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  126. package/dest/fee/private_fee_payment_method.js +4 -4
  127. package/dest/fee/public_fee_payment_method.d.ts +2 -2
  128. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  129. package/dest/fee/public_fee_payment_method.js +4 -4
  130. package/dest/fee/sponsored_fee_payment.d.ts +2 -2
  131. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
  132. package/dest/fee/sponsored_fee_payment.js +2 -2
  133. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  134. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  135. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  136. package/dest/utils/abi_types.d.ts +2 -2
  137. package/dest/utils/abi_types.d.ts.map +1 -1
  138. package/dest/utils/authwit.d.ts +14 -12
  139. package/dest/utils/authwit.d.ts.map +1 -1
  140. package/dest/utils/authwit.js +27 -20
  141. package/dest/utils/cross_chain.d.ts +2 -2
  142. package/dest/utils/cross_chain.d.ts.map +1 -1
  143. package/dest/utils/fee_juice.d.ts +2 -2
  144. package/dest/utils/fee_juice.js +2 -2
  145. package/dest/utils/field_compressed_string.d.ts +1 -1
  146. package/dest/utils/field_compressed_string.d.ts.map +1 -1
  147. package/dest/utils/field_compressed_string.js +1 -1
  148. package/dest/utils/node.d.ts +13 -2
  149. package/dest/utils/node.d.ts.map +1 -1
  150. package/dest/utils/node.js +46 -0
  151. package/dest/utils/pub_key.d.ts +2 -2
  152. package/dest/utils/pub_key.d.ts.map +1 -1
  153. package/dest/utils/pub_key.js +1 -1
  154. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +6 -9
  155. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  156. package/dest/wallet/account_entrypoint_meta_payment_method.js +29 -44
  157. package/dest/wallet/account_manager.d.ts +3 -9
  158. package/dest/wallet/account_manager.d.ts.map +1 -1
  159. package/dest/wallet/account_manager.js +6 -12
  160. package/dest/wallet/deploy_account_method.d.ts +37 -9
  161. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  162. package/dest/wallet/deploy_account_method.js +9 -7
  163. package/dest/wallet/index.d.ts +1 -2
  164. package/dest/wallet/index.d.ts.map +1 -1
  165. package/dest/wallet/index.js +0 -1
  166. package/dest/wallet/wallet.d.ts +323 -1504
  167. package/dest/wallet/wallet.d.ts.map +1 -1
  168. package/dest/wallet/wallet.js +85 -115
  169. package/package.json +16 -13
  170. package/src/account/account.ts +35 -60
  171. package/src/account/account_contract.ts +7 -8
  172. package/src/account/account_with_secret_key.ts +34 -9
  173. package/src/account/index.ts +3 -2
  174. package/src/account/signerless_account.ts +15 -15
  175. package/src/api/account.ts +10 -3
  176. package/src/api/authorization.ts +1 -0
  177. package/src/api/contract.ts +24 -8
  178. package/src/api/fields.ts +2 -1
  179. package/src/api/node.ts +7 -3
  180. package/src/api/note.ts +1 -1
  181. package/src/api/protocol.ts +7 -0
  182. package/src/api/tx.ts +4 -0
  183. package/src/api/wallet.ts +10 -9
  184. package/src/authorization/call_authorization_request.ts +1 -1
  185. package/src/contract/base_contract_interaction.ts +27 -16
  186. package/src/contract/batch_call.ts +67 -48
  187. package/src/contract/contract.ts +7 -5
  188. package/src/contract/contract_base.ts +5 -15
  189. package/src/contract/contract_function_interaction.ts +10 -11
  190. package/src/contract/deploy_method.ts +134 -40
  191. package/src/contract/interaction_options.ts +52 -13
  192. package/src/contract/protocol_contracts/auth-registry.ts +545 -0
  193. package/src/contract/protocol_contracts/contract-class-registry.ts +433 -0
  194. package/src/contract/protocol_contracts/contract-instance-registry.ts +493 -0
  195. package/src/contract/protocol_contracts/fee-juice.ts +457 -0
  196. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +329 -0
  197. package/src/contract/protocol_contracts/public-checks.ts +315 -0
  198. package/src/contract/wait_for_proven.ts +1 -1
  199. package/src/contract/wait_opts.ts +21 -0
  200. package/src/deployment/broadcast_function.ts +4 -4
  201. package/src/deployment/contract_deployer.ts +3 -2
  202. package/src/deployment/publish_class.ts +3 -3
  203. package/src/deployment/publish_instance.ts +3 -6
  204. package/src/ethereum/portal_manager.ts +65 -34
  205. package/src/fee/fee_juice_payment_method_with_claim.ts +4 -2
  206. package/src/fee/fee_payment_method.ts +1 -1
  207. package/src/fee/private_fee_payment_method.ts +5 -3
  208. package/src/fee/public_fee_payment_method.ts +5 -3
  209. package/src/fee/sponsored_fee_payment.ts +3 -1
  210. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  211. package/src/utils/abi_types.ts +1 -1
  212. package/src/utils/authwit.ts +40 -22
  213. package/src/utils/cross_chain.ts +1 -1
  214. package/src/utils/fee_juice.ts +2 -2
  215. package/src/utils/field_compressed_string.ts +1 -1
  216. package/src/utils/node.ts +62 -0
  217. package/src/utils/pub_key.ts +2 -2
  218. package/src/wallet/account_entrypoint_meta_payment_method.ts +29 -60
  219. package/src/wallet/account_manager.ts +7 -15
  220. package/src/wallet/deploy_account_method.ts +41 -16
  221. package/src/wallet/index.ts +0 -1
  222. package/src/wallet/wallet.ts +207 -152
  223. package/dest/account/interface.d.ts +0 -19
  224. package/dest/account/interface.d.ts.map +0 -1
  225. package/dest/account/interface.js +0 -5
  226. package/dest/contract/deploy_sent_tx.d.ts +0 -43
  227. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  228. package/dest/contract/deploy_sent_tx.js +0 -40
  229. package/dest/contract/protocol_contracts.d.ts +0 -9
  230. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  231. package/dest/contract/protocol_contracts.js +0 -26
  232. package/dest/contract/sent_tx.d.ts +0 -51
  233. package/dest/contract/sent_tx.d.ts.map +0 -1
  234. package/dest/contract/sent_tx.js +0 -90
  235. package/dest/contract/unsafe_contract.d.ts +0 -15
  236. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  237. package/dest/contract/unsafe_contract.js +0 -6
  238. package/dest/wallet/base_wallet.d.ts +0 -91
  239. package/dest/wallet/base_wallet.d.ts.map +0 -1
  240. package/dest/wallet/base_wallet.js +0 -238
  241. package/src/account/interface.ts +0 -25
  242. package/src/contract/deploy_sent_tx.ts +0 -68
  243. package/src/contract/protocol_contracts.ts +0 -35
  244. package/src/contract/sent_tx.ts +0 -130
  245. package/src/contract/unsafe_contract.ts +0 -19
  246. package/src/wallet/base_wallet.ts +0 -350
@@ -1,5 +1,4 @@
1
- import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { type ContractArtifact, type FunctionAbi, type FunctionArtifact, getInitializer } from '@aztec/stdlib/abi';
4
3
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
5
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -10,27 +9,46 @@ import {
10
9
  getContractInstanceFromInstantiationParams,
11
10
  } from '@aztec/stdlib/contract';
12
11
  import type { PublicKeys } from '@aztec/stdlib/keys';
13
- import { type Capsule, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
12
+ import { type Capsule, TxHash, type TxProfileResult, type TxReceipt, collectOffchainEffects } from '@aztec/stdlib/tx';
13
+ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
14
14
 
15
15
  import { publishContractClass } from '../deployment/publish_class.js';
16
16
  import { publishInstance } from '../deployment/publish_instance.js';
17
- import type { Wallet } from '../wallet/wallet.js';
17
+ import type { SendOptions, Wallet } from '../wallet/wallet.js';
18
18
  import { BaseContractInteraction } from './base_contract_interaction.js';
19
- import type { Contract } from './contract.js';
20
19
  import type { ContractBase } from './contract_base.js';
21
20
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
22
- import { DeploySentTx } from './deploy_sent_tx.js';
23
21
  import { getGasLimits } from './get_gas_limits.js';
24
22
  import {
23
+ NO_WAIT,
24
+ type NoWait,
25
25
  type ProfileInteractionOptions,
26
26
  type RequestInteractionOptions,
27
- type SendInteractionOptions,
27
+ type SendInteractionOptionsWithoutWait,
28
28
  type SimulationInteractionFeeOptions,
29
29
  type SimulationReturn,
30
30
  toProfileOptions,
31
31
  toSendOptions,
32
32
  toSimulateOptions,
33
33
  } from './interaction_options.js';
34
+ import type { WaitOpts } from './wait_opts.js';
35
+
36
+ /**
37
+ * Wait options specific to deployment transactions.
38
+ * Extends WaitOpts with a flag to return the full receipt instead of just the contract.
39
+ */
40
+ export type DeployWaitOptions = WaitOpts & {
41
+ /** If true, return the full DeployTxReceipt instead of just the contract. Defaults to false. */
42
+ returnReceipt?: boolean;
43
+ };
44
+
45
+ /**
46
+ * Type for wait options in deployment interactions.
47
+ * - NO_WAIT symbol: Don't wait, return TxHash immediately
48
+ * - DeployWaitOptions: Wait with custom options
49
+ * - undefined: Wait with default options
50
+ */
51
+ export type DeployInteractionWaitOptions = NoWait | DeployWaitOptions | undefined;
34
52
 
35
53
  /**
36
54
  * Options for deploying a contract on the Aztec network.
@@ -51,26 +69,39 @@ export type RequestDeployOptions = RequestInteractionOptions & {
51
69
  skipInstancePublication?: boolean;
52
70
  /** Skip contract initialization. */
53
71
  skipInitialization?: boolean;
72
+ /** Skip contract registration in the wallet */
73
+ skipRegistration?: boolean;
54
74
  };
55
75
 
56
76
  /**
57
- * Extends the deployment options with the required parameters to send the transaction
77
+ * Base deployment options without wait parameter.
58
78
  */
59
- export type DeployOptions = Omit<RequestDeployOptions, 'deployer'> & {
79
+ export type DeployOptionsWithoutWait = Omit<RequestDeployOptions, 'deployer'> & {
60
80
  /**
61
81
  * Set to true to *not* include the sender in the address computation. This option
62
82
  * is mutually exclusive with "deployer"
63
83
  */
64
84
  universalDeploy?: boolean;
65
- } & Pick<SendInteractionOptions, 'from' | 'fee'>;
66
- // docs:end:deploy_options
67
- // TODO(@spalladino): Add unit tests for this class!
85
+ } & Pick<SendInteractionOptionsWithoutWait, 'from' | 'fee'>;
86
+
87
+ /**
88
+ * Extends the deployment options with the required parameters to send the transaction.
89
+ */
90
+ export type DeployOptions<W extends DeployInteractionWaitOptions = undefined> = DeployOptionsWithoutWait & {
91
+ /**
92
+ * Options for waiting for the transaction to be mined.
93
+ * - undefined (default): wait with default options and return the contract instance
94
+ * - DeployWaitOptions: wait with custom options and return contract or receipt based on returnReceipt flag
95
+ * - NO_WAIT: return TxHash immediately without waiting
96
+ */
97
+ wait?: W;
98
+ };
68
99
 
69
100
  /**
70
101
  * Options for simulating the deployment of a contract
71
102
  * Allows skipping certain validations and computing gas estimations
72
103
  */
73
- export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
104
+ export type SimulateDeployOptions = Omit<DeployOptionsWithoutWait, 'fee'> & {
74
105
  /** The fee options for the transaction. */
75
106
  fee?: SimulationInteractionFeeOptions;
76
107
  /** Simulate without checking for the validity of the resulting transaction,
@@ -84,6 +115,29 @@ export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
84
115
  includeMetadata?: boolean;
85
116
  };
86
117
 
118
+ /** Receipt for a deployment transaction with the deployed contract instance. */
119
+ export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = TxReceipt & {
120
+ /** Type-safe wrapper around the deployed contract instance, linked to the deployment wallet */
121
+ contract: TContract;
122
+ /** The deployed contract instance with address and metadata. */
123
+ instance: ContractInstanceWithAddress;
124
+ };
125
+
126
+ /**
127
+ * Represents the result type of deploying a contract.
128
+ * - If wait is NO_WAIT, returns TxHash immediately.
129
+ * - If wait has returnReceipt: true, returns DeployTxReceipt after waiting.
130
+ * - Otherwise (undefined or DeployWaitOptions without returnReceipt), returns TContract after waiting.
131
+ */
132
+ export type DeployReturn<TContract extends ContractBase, W extends DeployInteractionWaitOptions> = W extends NoWait
133
+ ? TxHash
134
+ : W extends {
135
+ // eslint-disable-next-line jsdoc/require-jsdoc
136
+ returnReceipt: true;
137
+ }
138
+ ? DeployTxReceipt<TContract>
139
+ : TContract;
140
+
87
141
  /**
88
142
  * Contract interaction for deployment.
89
143
  * Handles class publication, instance publication, and initialization of the contract.
@@ -93,10 +147,8 @@ export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
93
147
  * then technically the contract has already been "created", and all of the contract's
94
148
  * functions (private and utility) can be interacted-with immediately, without any
95
149
  * "deployment tx".
96
- *
97
- * Extends the BaseContractInteraction class.
98
150
  */
99
- export class DeployMethod<TContract extends ContractBase = Contract> extends BaseContractInteraction {
151
+ export class DeployMethod<TContract extends ContractBase = ContractBase> extends BaseContractInteraction {
100
152
  /** The contract instance to be deployed. */
101
153
  private instance?: ContractInstanceWithAddress = undefined;
102
154
 
@@ -107,7 +159,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
107
159
  private publicKeys: PublicKeys,
108
160
  wallet: Wallet,
109
161
  protected artifact: ContractArtifact,
110
- protected postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
162
+ protected postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
111
163
  private args: any[] = [],
112
164
  constructorNameOrArtifact?: string | FunctionArtifact,
113
165
  authWitnesses: AuthWitness[] = [],
@@ -125,7 +177,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
125
177
  public async request(options?: RequestDeployOptions): Promise<ExecutionPayload> {
126
178
  const publication = await this.getPublicationExecutionPayload(options);
127
179
 
128
- await this.wallet.registerContract(await this.getInstance(options), this.artifact);
180
+ if (!options?.skipRegistration) {
181
+ await this.wallet.registerContract(await this.getInstance(options), this.artifact);
182
+ }
129
183
 
130
184
  const initialization = await this.getInitializationExecutionPayload(options);
131
185
  const feeExecutionPayload = options?.fee?.paymentMethod
@@ -141,13 +195,30 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
141
195
  return finalExecutionPayload;
142
196
  }
143
197
 
144
- convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
198
+ convertDeployOptionsToRequestOptions(options: DeployOptionsWithoutWait): RequestDeployOptions {
145
199
  return {
146
200
  ...options,
147
201
  deployer: !options?.universalDeploy ? options.from : undefined,
148
202
  };
149
203
  }
150
204
 
205
+ /**
206
+ * Converts DeployOptions to SendOptions, stripping out the returnReceipt flag if present.
207
+ * @param options - Deploy options with wait parameter
208
+ * @returns Send options with wait parameter
209
+ */
210
+ private convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
211
+ options: DeployOptions<W>,
212
+ // eslint-disable-next-line jsdoc/require-jsdoc
213
+ ): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
214
+ return {
215
+ ...toSendOptions({
216
+ ...options,
217
+ wait: options.wait as any,
218
+ }),
219
+ } as any;
220
+ }
221
+
151
222
  /**
152
223
  * Adds this contract to the wallet and returns the Contract object.
153
224
  * @param options - Deployment options.
@@ -155,7 +226,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
155
226
  public async register(options?: RequestDeployOptions): Promise<TContract> {
156
227
  const instance = await this.getInstance(options);
157
228
  await this.wallet.registerContract(instance, this.artifact);
158
- return this.postDeployCtor(instance.address, this.wallet);
229
+ return this.postDeployCtor(instance, this.wallet);
159
230
  }
160
231
 
161
232
  /**
@@ -183,16 +254,17 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
183
254
 
184
255
  // Publish the contract class if it hasn't been published already.
185
256
  if (!options?.skipClassPublication) {
186
- if ((await this.wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
187
- this.log.debug(
188
- `Skipping publication of already-registered contract class ${contractClass.id.toString()} for ${instance.address.toString()}`,
189
- );
190
- } else {
257
+ const classMetadata = await this.wallet.getContractClassMetadata(contractClass.id);
258
+ if (!classMetadata.isContractClassPubliclyRegistered) {
191
259
  this.log.info(
192
260
  `Creating request for publishing contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`,
193
261
  );
194
262
  const registerContractClassInteraction = await publishContractClass(this.wallet, this.artifact);
195
263
  calls.push(await registerContractClassInteraction.request());
264
+ } else {
265
+ this.log.debug(
266
+ `Skipping contract class publication for ${contractClass.id.toString()} as it is already registered`,
267
+ );
196
268
  }
197
269
  }
198
270
 
@@ -201,7 +273,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
201
273
  // TODO(https://github.com/AztecProtocol/aztec-packages/issues/15596):
202
274
  // Read the artifact, and if there are no public functions, warn the caller that publication of the
203
275
  // contract instance is not necessary (until such time as they wish to update the instance (i.e. change its class_id)).
204
- const deploymentInteraction = await publishInstance(this.wallet, instance);
276
+ const deploymentInteraction = publishInstance(this.wallet, instance);
205
277
  calls.push(await deploymentInteraction.request());
206
278
  }
207
279
 
@@ -230,20 +302,42 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
230
302
 
231
303
  /**
232
304
  * Send a contract deployment transaction (initialize and/or publish) using the provided options.
233
- * This function extends the 'send' method from the ContractFunctionInteraction class,
234
- * allowing us to send a transaction specifically for contract deployment.
305
+ * By default, waits for the transaction to be mined and returns the deployed contract instance.
235
306
  *
236
307
  * @param options - An object containing various deployment options such as contractAddressSalt and from.
237
- * @returns A SentTx object that returns the receipt and the deployed contract instance.
308
+ * @returns TxHash (if wait is NO_WAIT), TContract (if wait is undefined or doesn't have returnReceipt), or DeployTxReceipt (if wait.returnReceipt is true)
238
309
  */
239
- public override send(options: DeployOptions): DeploySentTx<TContract> {
240
- const sendTx = async () => {
241
- const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
242
- const sendOptions = await toSendOptions(options);
243
- return this.wallet.sendTx(executionPayload, sendOptions);
244
- };
245
- this.log.debug(`Sent deployment tx of ${this.artifact.name} contract`);
246
- return new DeploySentTx(this.wallet, sendTx, this.postDeployCtor, () => this.getInstance(options));
310
+ // Overload for when wait is not specified at all - returns the contract
311
+ public override send(options: DeployOptionsWithoutWait): Promise<TContract>;
312
+ // Generic overload for explicit wait values
313
+ // eslint-disable-next-line jsdoc/require-jsdoc
314
+ public override send<W extends DeployInteractionWaitOptions>(
315
+ options: DeployOptions<W>,
316
+ ): Promise<DeployReturn<TContract, W>>;
317
+ // eslint-disable-next-line jsdoc/require-jsdoc
318
+ public override async send(options: DeployOptions<DeployInteractionWaitOptions>): Promise<any> {
319
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
320
+ const sendOptions = this.convertDeployOptionsToSendOptions(options);
321
+
322
+ if (options.wait === NO_WAIT) {
323
+ const txHash = await this.wallet.sendTx(executionPayload, sendOptions as SendOptions<NoWait>);
324
+ this.log.debug(`Sent deployment tx ${txHash.hash} of ${this.artifact.name} contract`);
325
+ return txHash;
326
+ }
327
+
328
+ const receipt = await this.wallet.sendTx(executionPayload, sendOptions as SendOptions<WaitOpts | undefined>);
329
+ this.log.debug(`Deployed ${this.artifact.name} contract in tx ${receipt.txHash}`);
330
+
331
+ // Attach contract instance
332
+ const instance = await this.getInstance(options);
333
+ const contract = this.postDeployCtor(instance, this.wallet) as TContract;
334
+
335
+ // Return full receipt if requested, otherwise just the contract
336
+ if (options.wait && typeof options.wait === 'object' && options.wait.returnReceipt) {
337
+ return { ...receipt, contract, instance };
338
+ }
339
+
340
+ return contract;
247
341
  }
248
342
 
249
343
  /**
@@ -274,7 +368,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
274
368
  */
275
369
  public async simulate(options: SimulateDeployOptions): Promise<SimulationReturn<true>> {
276
370
  const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
277
- const simulatedTx = await this.wallet.simulateTx(executionPayload, await toSimulateOptions(options));
371
+ const simulatedTx = await this.wallet.simulateTx(executionPayload, toSimulateOptions(options));
278
372
 
279
373
  const { gasLimits, teardownGasLimits } = getGasLimits(simulatedTx, options.fee?.estimatedGasPadding);
280
374
  this.log.verbose(
@@ -294,10 +388,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
294
388
  *
295
389
  * @returns An object containing the function return value and profile result.
296
390
  */
297
- public async profile(options: DeployOptions & ProfileInteractionOptions): Promise<TxProfileResult> {
391
+ public async profile(options: DeployOptionsWithoutWait & ProfileInteractionOptions): Promise<TxProfileResult> {
298
392
  const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
299
393
  return await this.wallet.profileTx(executionPayload, {
300
- ...(await toProfileOptions(options)),
394
+ ...toProfileOptions(options),
301
395
  profileMode: options.profileMode,
302
396
  skipProofGeneration: options.skipProofGeneration,
303
397
  });
@@ -2,10 +2,11 @@ import type { FieldsOf } from '@aztec/foundation/types';
2
2
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { GasSettings } from '@aztec/stdlib/gas';
5
- import type { Capsule, OffchainEffect, SimulationStats } from '@aztec/stdlib/tx';
5
+ import type { Capsule, OffchainEffect, SimulationStats, TxHash, TxReceipt } from '@aztec/stdlib/tx';
6
6
 
7
7
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
8
8
  import type { ProfileOptions, SendOptions, SimulateOptions } from '../wallet/index.js';
9
+ import type { WaitOpts } from './wait_opts.js';
9
10
 
10
11
  /**
11
12
  * Options used to tweak the simulation and add gas estimation capabilities
@@ -55,15 +56,47 @@ export type RequestInteractionOptions = {
55
56
  };
56
57
 
57
58
  /**
58
- * Represents options for calling a (constrained) function in a contract.
59
+ * Constant for explicitly not waiting for transaction confirmation.
60
+ * We use this instead of false to avoid confusion with falsy checks.
61
+ */
62
+ export const NO_WAIT = 'NO_WAIT' as const;
63
+
64
+ /**
65
+ * Type for the NO_WAIT constant.
66
+ */
67
+ export type NoWait = typeof NO_WAIT;
68
+
69
+ /**
70
+ * Type for wait options in interactions.
71
+ * - NO_WAIT symbol: Don't wait for confirmation, return TxHash immediately
72
+ * - WaitOpts object: Wait with custom options and return receipt/result
73
+ * - undefined: Wait with default options and return receipt/result
74
+ */
75
+ export type InteractionWaitOptions = NoWait | WaitOpts | undefined;
76
+
77
+ /**
78
+ * Base options for calling a (constrained) function in a contract, without wait parameter.
59
79
  */
60
- export type SendInteractionOptions = RequestInteractionOptions & {
80
+ export type SendInteractionOptionsWithoutWait = RequestInteractionOptions & {
61
81
  /** The sender's Aztec address. */
62
82
  from: AztecAddress;
63
83
  /** The fee options for the transaction. */
64
84
  fee?: InteractionFeeOptions;
65
85
  };
66
86
 
87
+ /**
88
+ * Represents options for calling a (constrained) function in a contract.
89
+ */
90
+ export type SendInteractionOptions<W extends InteractionWaitOptions = undefined> = SendInteractionOptionsWithoutWait & {
91
+ /**
92
+ * Whether to wait for the transaction to be mined.
93
+ * - undefined (default): wait with default options and return TxReceipt
94
+ * - WaitOpts object: wait with custom options and return TxReceipt
95
+ * - NO_WAIT: return txHash immediately without waiting
96
+ */
97
+ wait?: W;
98
+ };
99
+
67
100
  /**
68
101
  * Represents the options for simulating a contract function interaction.
69
102
  * Allows specifying the address from which the method should be called.
@@ -110,17 +143,25 @@ export type SimulationReturn<T extends boolean | undefined> = T extends true
110
143
  }
111
144
  : any;
112
145
 
146
+ /**
147
+ * Represents the result type of sending a transaction.
148
+ * If `wait` is NO_WAIT, returns TxHash immediately without waiting.
149
+ * If `wait` is undefined or WaitOpts, returns TReturn (defaults to TxReceipt) after waiting.
150
+ */
151
+ export type SendReturn<T extends InteractionWaitOptions, TReturn = TxReceipt> = T extends NoWait ? TxHash : TReturn;
152
+
113
153
  /**
114
154
  * Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into
115
155
  * SendOptions, which are the ones that can be serialized and forwarded to the wallet
156
+ * @param options - The send interaction options with optional wait parameter
157
+ * @returns The send options to forward to the wallet
116
158
  */
117
- export async function toSendOptions(options: SendInteractionOptions): Promise<SendOptions> {
159
+ export function toSendOptions<W extends InteractionWaitOptions = undefined>(
160
+ options: SendInteractionOptions<W>,
161
+ ): SendOptions<W> {
118
162
  return {
119
163
  ...options,
120
164
  fee: {
121
- // If this interaction includes a fee payment method, pass the fee payer
122
- // as a hint to the wallet
123
- embeddedPaymentMethodFeePayer: await options.fee?.paymentMethod?.getFeePayer(),
124
165
  // If a payment method that includes gas settings was used,
125
166
  // try to reuse as much as possible while still allowing
126
167
  // manual override. CAREFUL: this can cause mismatches during proving
@@ -129,6 +170,7 @@ export async function toSendOptions(options: SendInteractionOptions): Promise<Se
129
170
  ...options.fee?.gasSettings,
130
171
  },
131
172
  },
173
+ wait: options.wait, // Pass through wait option
132
174
  };
133
175
  }
134
176
 
@@ -136,13 +178,10 @@ export async function toSendOptions(options: SendInteractionOptions): Promise<Se
136
178
  * Transforms and cleans up the higher level SimulateInteractionOptions defined by the interaction into
137
179
  * SimulateOptions, which are the ones that can be serialized and forwarded to the wallet
138
180
  */
139
- export async function toSimulateOptions(options: SimulateInteractionOptions): Promise<SimulateOptions> {
181
+ export function toSimulateOptions(options: SimulateInteractionOptions): SimulateOptions {
140
182
  return {
141
183
  ...options,
142
184
  fee: {
143
- // If this interaction includes a fee payment method, pass the fee payer
144
- // as a hint to the wallet
145
- embeddedPaymentMethodFeePayer: await options.fee?.paymentMethod?.getFeePayer(),
146
185
  // If a payment method that includes gas settings was used,
147
186
  // try to reuse as much as possible while still allowing
148
187
  // manual override. CAREFUL: this can cause mismatches during proving
@@ -160,9 +199,9 @@ export async function toSimulateOptions(options: SimulateInteractionOptions): Pr
160
199
  * Transforms and cleans up the higher level ProfileInteractionOptions defined by the interaction into
161
200
  * ProfileOptions, which are the ones that can be serialized and forwarded to the wallet
162
201
  */
163
- export async function toProfileOptions(options: ProfileInteractionOptions): Promise<ProfileOptions> {
202
+ export function toProfileOptions(options: ProfileInteractionOptions): ProfileOptions {
164
203
  return {
165
- ...(await toSimulateOptions(options)),
204
+ ...toSimulateOptions(options),
166
205
  profileMode: options.profileMode,
167
206
  skipProofGeneration: options.skipProofGeneration,
168
207
  };