@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.023c3e5

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 (450) hide show
  1. package/README.md +1 -1
  2. package/dest/account/account.d.ts +44 -0
  3. package/dest/account/account.d.ts.map +1 -0
  4. package/dest/account/account.js +31 -0
  5. package/dest/account/account_contract.d.ts +42 -0
  6. package/dest/account/account_contract.d.ts.map +1 -0
  7. package/dest/account/{contract.js → account_contract.js} +7 -4
  8. package/dest/account/account_with_secret_key.d.ts +36 -0
  9. package/dest/account/account_with_secret_key.d.ts.map +1 -0
  10. package/dest/{wallet/account_wallet_with_private_key.js → account/account_with_secret_key.js} +22 -5
  11. package/dest/account/index.d.ts +6 -9
  12. package/dest/account/index.d.ts.map +1 -1
  13. package/dest/account/index.js +4 -6
  14. package/dest/account/signerless_account.d.ts +22 -0
  15. package/dest/account/signerless_account.d.ts.map +1 -0
  16. package/dest/account/signerless_account.js +24 -0
  17. package/dest/api/abi.d.ts +3 -2
  18. package/dest/api/abi.d.ts.map +1 -1
  19. package/dest/api/abi.js +1 -1
  20. package/dest/api/account.d.ts +5 -3
  21. package/dest/api/account.d.ts.map +1 -1
  22. package/dest/api/account.js +3 -2
  23. package/dest/api/addresses.d.ts +2 -1
  24. package/dest/api/addresses.d.ts.map +1 -1
  25. package/dest/api/addresses.js +1 -0
  26. package/dest/api/authorization.d.ts +5 -0
  27. package/dest/api/authorization.d.ts.map +1 -0
  28. package/dest/api/authorization.js +4 -0
  29. package/dest/api/block.d.ts +3 -0
  30. package/dest/api/block.d.ts.map +1 -0
  31. package/dest/api/block.js +2 -0
  32. package/dest/api/contract.d.ts +55 -0
  33. package/dest/api/contract.d.ts.map +1 -0
  34. package/dest/api/contract.js +53 -0
  35. package/dest/api/crypto.d.ts +2 -0
  36. package/dest/api/crypto.d.ts.map +1 -0
  37. package/dest/api/crypto.js +1 -0
  38. package/dest/api/deployment.d.ts +5 -4
  39. package/dest/api/deployment.d.ts.map +1 -1
  40. package/dest/api/deployment.js +4 -3
  41. package/dest/api/eth_address.d.ts +1 -1
  42. package/dest/api/ethereum.d.ts +2 -0
  43. package/dest/api/ethereum.d.ts.map +1 -0
  44. package/dest/api/ethereum.js +1 -0
  45. package/dest/api/events.d.ts +12 -0
  46. package/dest/api/events.d.ts.map +1 -0
  47. package/dest/api/events.js +30 -0
  48. package/dest/api/fee.d.ts +2 -2
  49. package/dest/api/fee.d.ts.map +1 -1
  50. package/dest/api/fee.js +1 -1
  51. package/dest/api/fee_testing.d.ts +2 -0
  52. package/dest/api/fee_testing.d.ts.map +1 -0
  53. package/dest/api/fee_testing.js +1 -0
  54. package/dest/api/fields.d.ts +3 -2
  55. package/dest/api/fields.d.ts.map +1 -1
  56. package/dest/api/fields.js +2 -1
  57. package/dest/api/keys.d.ts +4 -0
  58. package/dest/api/keys.d.ts.map +1 -0
  59. package/dest/api/keys.js +3 -0
  60. package/dest/api/log.d.ts +2 -1
  61. package/dest/api/log.d.ts.map +1 -1
  62. package/dest/api/log.js +1 -0
  63. package/dest/api/messaging.d.ts +3 -0
  64. package/dest/api/messaging.d.ts.map +1 -0
  65. package/dest/api/messaging.js +2 -0
  66. package/dest/api/node.d.ts +25 -0
  67. package/dest/api/node.d.ts.map +1 -0
  68. package/dest/api/node.js +22 -0
  69. package/dest/api/note.d.ts +2 -0
  70. package/dest/api/note.d.ts.map +1 -0
  71. package/dest/api/note.js +1 -0
  72. package/dest/api/protocol.d.ts +9 -0
  73. package/dest/api/protocol.d.ts.map +1 -0
  74. package/dest/api/protocol.js +8 -0
  75. package/dest/api/trees.d.ts +3 -0
  76. package/dest/api/trees.d.ts.map +1 -0
  77. package/dest/api/trees.js +2 -0
  78. package/dest/api/tx.d.ts +2 -0
  79. package/dest/api/tx.d.ts.map +1 -0
  80. package/dest/api/tx.js +1 -0
  81. package/dest/api/utils.d.ts +13 -0
  82. package/dest/api/utils.d.ts.map +1 -0
  83. package/dest/api/utils.js +12 -0
  84. package/dest/api/wallet.d.ts +5 -2
  85. package/dest/api/wallet.d.ts.map +1 -1
  86. package/dest/api/wallet.js +4 -1
  87. package/dest/authorization/call_authorization_request.d.ts +67 -0
  88. package/dest/authorization/call_authorization_request.d.ts.map +1 -0
  89. package/dest/authorization/call_authorization_request.js +49 -0
  90. package/dest/contract/base_contract_interaction.d.ts +18 -84
  91. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  92. package/dest/contract/base_contract_interaction.js +11 -136
  93. package/dest/contract/batch_call.d.ts +19 -21
  94. package/dest/contract/batch_call.d.ts.map +1 -1
  95. package/dest/contract/batch_call.js +89 -69
  96. package/dest/contract/checker.d.ts +2 -2
  97. package/dest/contract/checker.d.ts.map +1 -1
  98. package/dest/contract/checker.js +2 -2
  99. package/dest/contract/contract.d.ts +9 -8
  100. package/dest/contract/contract.d.ts.map +1 -1
  101. package/dest/contract/contract.js +10 -20
  102. package/dest/contract/contract_base.d.ts +8 -18
  103. package/dest/contract/contract_base.d.ts.map +1 -1
  104. package/dest/contract/contract_base.js +7 -14
  105. package/dest/contract/contract_function_interaction.d.ts +53 -45
  106. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  107. package/dest/contract/contract_function_interaction.js +78 -74
  108. package/dest/contract/deploy_method.d.ts +155 -62
  109. package/dest/contract/deploy_method.d.ts.map +1 -1
  110. package/dest/contract/deploy_method.js +152 -142
  111. package/dest/contract/get_gas_limits.d.ts +6 -7
  112. package/dest/contract/get_gas_limits.d.ts.map +1 -1
  113. package/dest/contract/get_gas_limits.js +9 -3
  114. package/dest/contract/interaction_options.d.ts +151 -0
  115. package/dest/contract/interaction_options.d.ts.map +1 -0
  116. package/dest/contract/interaction_options.js +53 -0
  117. package/dest/contract/protocol_contracts/auth-registry.d.ts +27 -0
  118. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  119. package/dest/contract/protocol_contracts/auth-registry.js +558 -0
  120. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +26 -0
  121. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  122. package/dest/contract/protocol_contracts/contract-class-registry.js +385 -0
  123. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +22 -0
  124. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  125. package/dest/contract/protocol_contracts/contract-instance-registry.js +465 -0
  126. package/dest/contract/protocol_contracts/fee-juice.d.ts +21 -0
  127. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  128. package/dest/contract/protocol_contracts/fee-juice.js +426 -0
  129. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  130. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  131. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +575 -0
  132. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  133. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  134. package/dest/contract/protocol_contracts/public-checks.js +583 -0
  135. package/dest/contract/wait_for_proven.d.ts +17 -0
  136. package/dest/contract/wait_for_proven.d.ts.map +1 -0
  137. package/dest/contract/wait_for_proven.js +17 -0
  138. package/dest/contract/wait_opts.d.ts +16 -0
  139. package/dest/contract/wait_opts.d.ts.map +1 -0
  140. package/dest/contract/wait_opts.js +5 -0
  141. package/dest/deployment/broadcast_function.d.ts +4 -4
  142. package/dest/deployment/broadcast_function.d.ts.map +1 -1
  143. package/dest/deployment/broadcast_function.js +28 -24
  144. package/dest/deployment/contract_deployer.d.ts +2 -2
  145. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  146. package/dest/deployment/contract_deployer.js +1 -1
  147. package/dest/deployment/publish_class.d.ts +6 -0
  148. package/dest/deployment/publish_class.d.ts.map +1 -0
  149. package/dest/deployment/publish_class.js +17 -0
  150. package/dest/deployment/publish_instance.d.ts +10 -0
  151. package/dest/deployment/publish_instance.d.ts.map +1 -0
  152. package/dest/deployment/publish_instance.js +11 -0
  153. package/dest/ethereum/portal_manager.d.ts +141 -0
  154. package/dest/ethereum/portal_manager.d.ts.map +1 -0
  155. package/dest/ethereum/portal_manager.js +345 -0
  156. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +17 -12
  157. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  158. package/dest/fee/fee_juice_payment_method_with_claim.js +27 -17
  159. package/dest/fee/fee_payment_method.d.ts +12 -8
  160. package/dest/fee/fee_payment_method.d.ts.map +1 -1
  161. package/dest/fee/private_fee_payment_method.d.ts +26 -9
  162. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  163. package/dest/fee/private_fee_payment_method.js +45 -23
  164. package/dest/fee/public_fee_payment_method.d.ts +27 -10
  165. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  166. package/dest/fee/public_fee_payment_method.js +47 -25
  167. package/dest/fee/sponsored_fee_payment.d.ts +17 -0
  168. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
  169. package/dest/fee/sponsored_fee_payment.js +34 -0
  170. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  171. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  172. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  173. package/dest/utils/abi_types.d.ts +2 -4
  174. package/dest/utils/abi_types.d.ts.map +1 -1
  175. package/dest/utils/authwit.d.ts +85 -26
  176. package/dest/utils/authwit.d.ts.map +1 -1
  177. package/dest/utils/authwit.js +234 -41
  178. package/dest/utils/cross_chain.d.ts +24 -0
  179. package/dest/utils/cross_chain.d.ts.map +1 -0
  180. package/dest/utils/cross_chain.js +30 -0
  181. package/dest/utils/fee_juice.d.ts +4 -3
  182. package/dest/utils/fee_juice.d.ts.map +1 -1
  183. package/dest/utils/fee_juice.js +4 -3
  184. package/dest/utils/field_compressed_string.d.ts +1 -1
  185. package/dest/utils/field_compressed_string.d.ts.map +1 -1
  186. package/dest/utils/field_compressed_string.js +1 -1
  187. package/dest/utils/node.d.ts +13 -2
  188. package/dest/utils/node.d.ts.map +1 -1
  189. package/dest/utils/node.js +47 -1
  190. package/dest/utils/pub_key.d.ts +2 -2
  191. package/dest/utils/pub_key.d.ts.map +1 -1
  192. package/dest/utils/pub_key.js +2 -3
  193. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +31 -0
  194. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
  195. package/dest/wallet/account_entrypoint_meta_payment_method.js +61 -0
  196. package/dest/wallet/account_manager.d.ts +63 -0
  197. package/dest/wallet/account_manager.d.ts.map +1 -0
  198. package/dest/wallet/account_manager.js +107 -0
  199. package/dest/wallet/capabilities.d.ts +444 -0
  200. package/dest/wallet/capabilities.d.ts.map +1 -0
  201. package/dest/wallet/capabilities.js +3 -0
  202. package/dest/wallet/deploy_account_method.d.ts +80 -0
  203. package/dest/wallet/deploy_account_method.d.ts.map +1 -0
  204. package/dest/wallet/deploy_account_method.js +79 -0
  205. package/dest/wallet/index.d.ts +4 -17
  206. package/dest/wallet/index.d.ts.map +1 -1
  207. package/dest/wallet/index.js +3 -20
  208. package/dest/wallet/wallet.d.ts +2590 -0
  209. package/dest/wallet/wallet.d.ts.map +1 -0
  210. package/dest/wallet/wallet.js +291 -0
  211. package/package.json +47 -36
  212. package/src/account/account.ts +72 -0
  213. package/src/account/account_contract.ts +66 -0
  214. package/src/account/account_with_secret_key.ts +63 -0
  215. package/src/account/index.ts +5 -8
  216. package/src/account/signerless_account.ts +46 -0
  217. package/src/api/abi.ts +26 -0
  218. package/src/api/account.ts +8 -5
  219. package/src/api/addresses.ts +1 -0
  220. package/src/api/authorization.ts +15 -0
  221. package/src/api/block.ts +2 -0
  222. package/src/api/contract.ts +88 -0
  223. package/src/api/crypto.ts +1 -0
  224. package/src/api/deployment.ts +4 -3
  225. package/src/api/ethereum.ts +10 -0
  226. package/src/api/events.ts +44 -0
  227. package/src/api/fee.ts +1 -1
  228. package/src/api/fee_testing.ts +1 -0
  229. package/src/api/fields.ts +2 -1
  230. package/src/api/keys.ts +8 -0
  231. package/src/api/log.ts +1 -0
  232. package/src/api/messaging.ts +2 -0
  233. package/src/api/node.ts +24 -0
  234. package/src/api/note.ts +1 -0
  235. package/src/api/protocol.ts +9 -0
  236. package/src/api/trees.ts +2 -0
  237. package/src/api/tx.ts +15 -0
  238. package/src/api/utils.ts +14 -0
  239. package/src/api/wallet.ts +72 -5
  240. package/src/authorization/call_authorization_request.ts +63 -0
  241. package/src/contract/base_contract_interaction.ts +40 -171
  242. package/src/contract/batch_call.ts +108 -57
  243. package/src/contract/checker.ts +8 -3
  244. package/src/contract/contract.ts +14 -21
  245. package/src/contract/contract_base.ts +9 -26
  246. package/src/contract/contract_function_interaction.ts +135 -106
  247. package/src/contract/deploy_method.ts +307 -143
  248. package/src/contract/get_gas_limits.ts +15 -8
  249. package/src/contract/interaction_options.ts +208 -0
  250. package/src/contract/protocol_contracts/auth-registry.ts +351 -0
  251. package/src/contract/protocol_contracts/contract-class-registry.ts +241 -0
  252. package/src/contract/protocol_contracts/contract-instance-registry.ts +302 -0
  253. package/src/contract/protocol_contracts/fee-juice.ts +264 -0
  254. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +332 -0
  255. package/src/contract/protocol_contracts/public-checks.ts +316 -0
  256. package/src/contract/wait_for_proven.ts +38 -0
  257. package/src/contract/wait_opts.ts +21 -0
  258. package/src/deployment/broadcast_function.ts +58 -58
  259. package/src/deployment/contract_deployer.ts +4 -3
  260. package/src/deployment/publish_class.ts +34 -0
  261. package/src/deployment/publish_instance.ts +23 -0
  262. package/src/{api/ethereum → ethereum}/portal_manager.ts +166 -89
  263. package/src/fee/fee_juice_payment_method_with_claim.ts +49 -34
  264. package/src/fee/fee_payment_method.ts +11 -7
  265. package/src/fee/private_fee_payment_method.ts +80 -58
  266. package/src/fee/public_fee_payment_method.ts +94 -68
  267. package/src/fee/sponsored_fee_payment.ts +46 -0
  268. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  269. package/src/utils/abi_types.ts +1 -1
  270. package/src/utils/authwit.ts +274 -54
  271. package/src/utils/cross_chain.ts +53 -0
  272. package/src/utils/fee_juice.ts +5 -5
  273. package/src/utils/field_compressed_string.ts +1 -1
  274. package/src/utils/node.ts +63 -1
  275. package/src/utils/pub_key.ts +3 -4
  276. package/src/wallet/account_entrypoint_meta_payment_method.ts +74 -0
  277. package/src/wallet/account_manager.ts +146 -0
  278. package/src/wallet/capabilities.ts +491 -0
  279. package/src/wallet/deploy_account_method.ts +150 -0
  280. package/src/wallet/index.ts +3 -33
  281. package/src/wallet/wallet.ts +533 -0
  282. package/dest/account/contract.d.ts +0 -37
  283. package/dest/account/contract.d.ts.map +0 -1
  284. package/dest/account/interface.d.ts +0 -31
  285. package/dest/account/interface.d.ts.map +0 -1
  286. package/dest/account/interface.js +0 -4
  287. package/dest/account/wallet.d.ts +0 -11
  288. package/dest/account/wallet.d.ts.map +0 -1
  289. package/dest/account/wallet.js +0 -3
  290. package/dest/account_manager/deploy_account_method.d.ts +0 -15
  291. package/dest/account_manager/deploy_account_method.d.ts.map +0 -1
  292. package/dest/account_manager/deploy_account_method.js +0 -43
  293. package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
  294. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
  295. package/dest/account_manager/deploy_account_sent_tx.js +0 -29
  296. package/dest/account_manager/index.d.ts +0 -108
  297. package/dest/account_manager/index.d.ts.map +0 -1
  298. package/dest/account_manager/index.js +0 -159
  299. package/dest/api/cheat_codes.d.ts +0 -26
  300. package/dest/api/cheat_codes.d.ts.map +0 -1
  301. package/dest/api/cheat_codes.js +0 -25
  302. package/dest/api/entrypoint.d.ts +0 -2
  303. package/dest/api/entrypoint.d.ts.map +0 -1
  304. package/dest/api/entrypoint.js +0 -1
  305. package/dest/api/ethereum/anvil_test_watcher.d.ts +0 -32
  306. package/dest/api/ethereum/anvil_test_watcher.d.ts.map +0 -1
  307. package/dest/api/ethereum/anvil_test_watcher.js +0 -133
  308. package/dest/api/ethereum/chain_monitor.d.ts +0 -25
  309. package/dest/api/ethereum/chain_monitor.d.ts.map +0 -1
  310. package/dest/api/ethereum/chain_monitor.js +0 -74
  311. package/dest/api/ethereum/cheat_codes.d.ts +0 -63
  312. package/dest/api/ethereum/cheat_codes.d.ts.map +0 -1
  313. package/dest/api/ethereum/cheat_codes.js +0 -162
  314. package/dest/api/ethereum/index.d.ts +0 -7
  315. package/dest/api/ethereum/index.d.ts.map +0 -1
  316. package/dest/api/ethereum/index.js +0 -6
  317. package/dest/api/ethereum/l1_contracts.d.ts +0 -3
  318. package/dest/api/ethereum/l1_contracts.d.ts.map +0 -1
  319. package/dest/api/ethereum/l1_contracts.js +0 -13
  320. package/dest/api/ethereum/portal_manager.d.ts +0 -136
  321. package/dest/api/ethereum/portal_manager.d.ts.map +0 -1
  322. package/dest/api/ethereum/portal_manager.js +0 -286
  323. package/dest/api/interfaces/pxe.d.ts +0 -2
  324. package/dest/api/interfaces/pxe.d.ts.map +0 -1
  325. package/dest/api/interfaces/pxe.js +0 -1
  326. package/dest/api/log_id.d.ts +0 -2
  327. package/dest/api/log_id.d.ts.map +0 -1
  328. package/dest/api/log_id.js +0 -1
  329. package/dest/api/tx_hash.d.ts +0 -2
  330. package/dest/api/tx_hash.d.ts.map +0 -1
  331. package/dest/api/tx_hash.js +0 -1
  332. package/dest/contract/deploy_proven_tx.d.ts +0 -21
  333. package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
  334. package/dest/contract/deploy_proven_tx.js +0 -19
  335. package/dest/contract/deploy_sent_tx.d.ts +0 -45
  336. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  337. package/dest/contract/deploy_sent_tx.js +0 -43
  338. package/dest/contract/index.d.ts +0 -45
  339. package/dest/contract/index.d.ts.map +0 -1
  340. package/dest/contract/index.js +0 -43
  341. package/dest/contract/protocol_contracts.d.ts +0 -9
  342. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  343. package/dest/contract/protocol_contracts.js +0 -26
  344. package/dest/contract/proven_tx.d.ts +0 -17
  345. package/dest/contract/proven_tx.d.ts.map +0 -1
  346. package/dest/contract/proven_tx.js +0 -22
  347. package/dest/contract/sent_tx.d.ts +0 -61
  348. package/dest/contract/sent_tx.d.ts.map +0 -1
  349. package/dest/contract/sent_tx.js +0 -102
  350. package/dest/contract/unsafe_contract.d.ts +0 -15
  351. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  352. package/dest/contract/unsafe_contract.js +0 -6
  353. package/dest/deployment/deploy_instance.d.ts +0 -10
  354. package/dest/deployment/deploy_instance.d.ts.map +0 -1
  355. package/dest/deployment/deploy_instance.js +0 -14
  356. package/dest/deployment/index.d.ts +0 -2
  357. package/dest/deployment/index.d.ts.map +0 -1
  358. package/dest/deployment/index.js +0 -1
  359. package/dest/deployment/register_class.d.ts +0 -6
  360. package/dest/deployment/register_class.d.ts.map +0 -1
  361. package/dest/deployment/register_class.js +0 -22
  362. package/dest/entrypoint/default_entrypoint.d.ts +0 -12
  363. package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
  364. package/dest/entrypoint/default_entrypoint.js +0 -28
  365. package/dest/entrypoint/default_multi_call_entrypoint.d.ts +0 -15
  366. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +0 -1
  367. package/dest/entrypoint/default_multi_call_entrypoint.js +0 -130
  368. package/dest/entrypoint/entrypoint.d.ts +0 -35
  369. package/dest/entrypoint/entrypoint.d.ts.map +0 -1
  370. package/dest/entrypoint/entrypoint.js +0 -4
  371. package/dest/entrypoint/payload.d.ts +0 -128
  372. package/dest/entrypoint/payload.d.ts.map +0 -1
  373. package/dest/entrypoint/payload.js +0 -143
  374. package/dest/fee/fee_juice_payment_method.d.ts +0 -14
  375. package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
  376. package/dest/fee/fee_juice_payment_method.js +0 -20
  377. package/dest/index.d.ts +0 -66
  378. package/dest/index.d.ts.map +0 -1
  379. package/dest/index.js +0 -69
  380. package/dest/rpc_clients/index.d.ts +0 -3
  381. package/dest/rpc_clients/index.d.ts.map +0 -1
  382. package/dest/rpc_clients/index.js +0 -2
  383. package/dest/rpc_clients/node/index.d.ts +0 -12
  384. package/dest/rpc_clients/node/index.d.ts.map +0 -1
  385. package/dest/rpc_clients/node/index.js +0 -78
  386. package/dest/rpc_clients/pxe_client.d.ts +0 -10
  387. package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
  388. package/dest/rpc_clients/pxe_client.js +0 -23
  389. package/dest/utils/aztec_cheatcodes.d.ts +0 -59
  390. package/dest/utils/aztec_cheatcodes.d.ts.map +0 -1
  391. package/dest/utils/aztec_cheatcodes.js +0 -62
  392. package/dest/utils/index.d.ts +0 -8
  393. package/dest/utils/index.d.ts.map +0 -1
  394. package/dest/utils/index.js +0 -6
  395. package/dest/utils/pxe.d.ts +0 -4
  396. package/dest/utils/pxe.d.ts.map +0 -1
  397. package/dest/utils/pxe.js +0 -14
  398. package/dest/wallet/account_wallet.d.ts +0 -76
  399. package/dest/wallet/account_wallet.d.ts.map +0 -1
  400. package/dest/wallet/account_wallet.js +0 -231
  401. package/dest/wallet/account_wallet_with_private_key.d.ts +0 -26
  402. package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
  403. package/dest/wallet/base_wallet.d.ts +0 -73
  404. package/dest/wallet/base_wallet.d.ts.map +0 -1
  405. package/dest/wallet/base_wallet.js +0 -123
  406. package/dest/wallet/signerless_wallet.d.ts +0 -25
  407. package/dest/wallet/signerless_wallet.d.ts.map +0 -1
  408. package/dest/wallet/signerless_wallet.js +0 -36
  409. package/src/account/contract.ts +0 -56
  410. package/src/account/interface.ts +0 -36
  411. package/src/account/wallet.ts +0 -13
  412. package/src/account_manager/deploy_account_method.ts +0 -86
  413. package/src/account_manager/deploy_account_sent_tx.ts +0 -42
  414. package/src/account_manager/index.ts +0 -229
  415. package/src/api/cheat_codes.ts +0 -35
  416. package/src/api/entrypoint.ts +0 -1
  417. package/src/api/ethereum/anvil_test_watcher.ts +0 -158
  418. package/src/api/ethereum/chain_monitor.ts +0 -88
  419. package/src/api/ethereum/cheat_codes.ts +0 -184
  420. package/src/api/ethereum/index.ts +0 -19
  421. package/src/api/ethereum/l1_contracts.ts +0 -21
  422. package/src/api/interfaces/pxe.ts +0 -1
  423. package/src/api/log_id.ts +0 -1
  424. package/src/api/tx_hash.ts +0 -1
  425. package/src/contract/deploy_proven_tx.ts +0 -34
  426. package/src/contract/deploy_sent_tx.ts +0 -74
  427. package/src/contract/index.ts +0 -48
  428. package/src/contract/protocol_contracts.ts +0 -35
  429. package/src/contract/proven_tx.ts +0 -42
  430. package/src/contract/sent_tx.ts +0 -141
  431. package/src/contract/unsafe_contract.ts +0 -19
  432. package/src/deployment/deploy_instance.ts +0 -31
  433. package/src/deployment/index.ts +0 -1
  434. package/src/deployment/register_class.ts +0 -44
  435. package/src/entrypoint/default_entrypoint.ts +0 -39
  436. package/src/entrypoint/default_multi_call_entrypoint.ts +0 -93
  437. package/src/entrypoint/entrypoint.ts +0 -39
  438. package/src/entrypoint/payload.ts +0 -238
  439. package/src/fee/fee_juice_payment_method.ts +0 -26
  440. package/src/index.ts +0 -106
  441. package/src/rpc_clients/index.ts +0 -2
  442. package/src/rpc_clients/node/index.ts +0 -77
  443. package/src/rpc_clients/pxe_client.ts +0 -25
  444. package/src/utils/aztec_cheatcodes.ts +0 -77
  445. package/src/utils/index.ts +0 -21
  446. package/src/utils/pxe.ts +0 -17
  447. package/src/wallet/account_wallet.ts +0 -242
  448. package/src/wallet/account_wallet_with_private_key.ts +0 -40
  449. package/src/wallet/base_wallet.ts +0 -198
  450. package/src/wallet/signerless_wallet.ts +0 -52
@@ -1,146 +1,244 @@
1
- import type { Fr } from '@aztec/foundation/fields';
2
- import { type ContractArtifact, type FunctionArtifact, type FunctionCall, getInitializer } from '@aztec/stdlib/abi';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
+ import { type ContractArtifact, type FunctionAbi, type FunctionArtifact, getInitializer } from '@aztec/stdlib/abi';
3
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
3
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
5
  import {
5
6
  type ContractInstanceWithAddress,
6
7
  computePartialAddress,
7
8
  getContractClassFromArtifact,
8
- getContractInstanceFromDeployParams,
9
+ getContractInstanceFromInstantiationParams,
9
10
  } from '@aztec/stdlib/contract';
10
- import type { GasSettings } from '@aztec/stdlib/gas';
11
11
  import type { PublicKeys } from '@aztec/stdlib/keys';
12
- import type { Capsule, TxExecutionRequest } from '@aztec/stdlib/tx';
13
-
14
- import type { Wallet } from '../account/index.js';
15
- import { deployInstance } from '../deployment/deploy_instance.js';
16
- import { registerContractClass } from '../deployment/register_class.js';
17
- import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
18
- import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
19
- import type { Contract } from './contract.js';
12
+ import { type Capsule, TxHash, type TxProfileResult, type TxReceipt, collectOffchainEffects } from '@aztec/stdlib/tx';
13
+ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
14
+
15
+ import { publishContractClass } from '../deployment/publish_class.js';
16
+ import { publishInstance } from '../deployment/publish_instance.js';
17
+ import type { SendOptions, Wallet } from '../wallet/wallet.js';
18
+ import { BaseContractInteraction } from './base_contract_interaction.js';
20
19
  import type { ContractBase } from './contract_base.js';
21
20
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
22
- import { DeployProvenTx } from './deploy_proven_tx.js';
23
- import { DeploySentTx } from './deploy_sent_tx.js';
21
+ import { getGasLimits } from './get_gas_limits.js';
22
+ import {
23
+ NO_WAIT,
24
+ type NoWait,
25
+ type ProfileInteractionOptions,
26
+ type RequestInteractionOptions,
27
+ type SendInteractionOptionsWithoutWait,
28
+ type SimulationInteractionFeeOptions,
29
+ type SimulationReturn,
30
+ toProfileOptions,
31
+ toSendOptions,
32
+ toSimulateOptions,
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;
24
52
 
25
53
  /**
26
54
  * Options for deploying a contract on the Aztec network.
27
- * Allows specifying a contract address salt, and additional send method options.
55
+ * Allows specifying a contract address salt and different options to tweak contract publication
56
+ * and initialization
28
57
  */
29
- // docs:start:deploy_options
30
- export type DeployOptions = {
58
+ export type RequestDeployOptions = RequestInteractionOptions & {
31
59
  /** An optional salt value used to deterministically calculate the contract address. */
32
60
  contractAddressSalt?: Fr;
33
- /** Set to true to *not* include the sender in the address computation. */
34
- universalDeploy?: boolean;
35
- /** Skip contract class registration. */
36
- skipClassRegistration?: boolean;
37
- /** Skip public deployment, instead just privately initialize the contract. */
38
- skipPublicDeployment?: boolean;
61
+ /**
62
+ * Deployer address that will be used for the deployed contract's address computation.
63
+ * If set to 0, the sender's address won't be mixed in
64
+ */
65
+ deployer?: AztecAddress;
66
+ /** Skip contract class publication. */
67
+ skipClassPublication?: boolean;
68
+ /** Skip publication, instead just privately initialize the contract. */
69
+ skipInstancePublication?: boolean;
39
70
  /** Skip contract initialization. */
40
71
  skipInitialization?: boolean;
41
- } & SendMethodOptions;
42
- // docs:end:deploy_options
43
- // TODO(@spalladino): Add unit tests for this class!
72
+ /** Skip contract registration in the wallet */
73
+ skipRegistration?: boolean;
74
+ };
75
+
76
+ /**
77
+ * Base deployment options without wait parameter.
78
+ */
79
+ export type DeployOptionsWithoutWait = Omit<RequestDeployOptions, 'deployer'> & {
80
+ /**
81
+ * Set to true to *not* include the sender in the address computation. This option
82
+ * is mutually exclusive with "deployer"
83
+ */
84
+ universalDeploy?: boolean;
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
+ };
99
+
100
+ /**
101
+ * Options for simulating the deployment of a contract
102
+ * Allows skipping certain validations and computing gas estimations
103
+ */
104
+ export type SimulateDeployOptions = Omit<DeployOptionsWithoutWait, 'fee'> & {
105
+ /** The fee options for the transaction. */
106
+ fee?: SimulationInteractionFeeOptions;
107
+ /** Simulate without checking for the validity of the resulting transaction,
108
+ * e.g. whether it emits any existing nullifiers. */
109
+ skipTxValidation?: boolean;
110
+ /** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
111
+ skipFeeEnforcement?: boolean;
112
+ /** Whether to include metadata such as offchain effects and performance statistics
113
+ * (e.g. timing information of the different circuits and oracles) in
114
+ * the simulation result, instead of just the return value of the function */
115
+ includeMetadata?: boolean;
116
+ };
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;
44
140
 
45
141
  /**
46
- * Contract interaction for deployment. Handles class registration, public instance deployment,
47
- * and initialization of the contract. Extends the BaseContractInteraction class.
142
+ * Contract interaction for deployment.
143
+ * Handles class publication, instance publication, and initialization of the contract.
144
+ *
145
+ * Note that for some contracts, a tx is not required as part of its "creation":
146
+ * If there are no public functions, and if there are no initialization functions,
147
+ * then technically the contract has already been "created", and all of the contract's
148
+ * functions (private and utility) can be interacted-with immediately, without any
149
+ * "deployment tx".
48
150
  */
49
- export class DeployMethod<TContract extends ContractBase = Contract> extends BaseContractInteraction {
151
+ export class DeployMethod<TContract extends ContractBase = ContractBase> extends BaseContractInteraction {
50
152
  /** The contract instance to be deployed. */
51
153
  private instance?: ContractInstanceWithAddress = undefined;
52
154
 
53
155
  /** Constructor function to call. */
54
- private constructorArtifact: FunctionArtifact | undefined;
156
+ private constructorArtifact: FunctionAbi | undefined;
55
157
 
56
158
  constructor(
57
159
  private publicKeys: PublicKeys,
58
160
  wallet: Wallet,
59
- private artifact: ContractArtifact,
60
- private postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
161
+ protected artifact: ContractArtifact,
162
+ protected postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
61
163
  private args: any[] = [],
62
164
  constructorNameOrArtifact?: string | FunctionArtifact,
165
+ authWitnesses: AuthWitness[] = [],
166
+ capsules: Capsule[] = [],
63
167
  ) {
64
- super(wallet);
168
+ super(wallet, authWitnesses, capsules);
65
169
  this.constructorArtifact = getInitializer(artifact, constructorNameOrArtifact);
66
170
  }
67
171
 
68
172
  /**
69
- * Create a contract deployment transaction, given the deployment options.
70
- * This function internally calls `request()` and `sign()` methods to prepare
71
- * the transaction for deployment. The resulting signed transaction can be
72
- * later sent using the `send()` method.
73
- *
74
- * @param options - An object containing optional deployment settings, contractAddressSalt, and from.
75
- * @returns A Promise resolving to an object containing the signed transaction data and other relevant information.
173
+ * Returns the execution payload that allows this operation to happen on chain.
174
+ * @param options - Configuration options.
175
+ * @returns The execution payload for this operation
76
176
  */
77
- public async create(options: DeployOptions = {}): Promise<TxExecutionRequest> {
78
- return this.wallet.createTxExecutionRequest(await this.request(options));
79
- }
177
+ public async request(options?: RequestDeployOptions): Promise<ExecutionPayload> {
178
+ const publication = await this.getPublicationExecutionPayload(options);
80
179
 
81
- // REFACTOR: Having a `request` method with different semantics than the ones in the other
82
- // derived ContractInteractions is confusing. We should unify the flow of all ContractInteractions.
180
+ if (!options?.skipRegistration) {
181
+ await this.wallet.registerContract(await this.getInstance(options), this.artifact);
182
+ }
83
183
 
84
- /**
85
- * Returns an array of function calls that represent this operation. Useful as a building
86
- * block for constructing batch requests.
87
- * @param options - Deployment options.
88
- * @returns An array of function calls.
89
- * @remarks This method does not have the same return type as the `request` in the ContractInteraction object,
90
- * it returns a promise for an array instead of a function call directly.
91
- */
92
- public async request(options: DeployOptions = {}): Promise<ExecutionRequestInit> {
93
- const deployment = await this.getDeploymentFunctionCalls(options);
94
-
95
- // NOTE: MEGA HACK. Remove with #10007
96
- // register the contract after generating deployment function calls in order to publicly register the class and (optioanlly) emit its bytecode
97
- //
98
- // TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
99
- // Note that we need to run this registerContract here so it's available when computeFeeOptionsFromEstimatedGas
100
- // runs, since it needs the contract to have been registered in order to estimate gas for its initialization,
101
- // in case the initializer is public. This hints at the need of having "transient" contracts scoped to a
102
- // simulation, so we can run the simulation with a set of contracts, but only "commit" them to the wallet
103
- // once this tx has gone through.
104
- await this.wallet.registerContract({ artifact: this.artifact, instance: await this.getInstance(options) });
105
-
106
- const bootstrap = await this.getInitializeFunctionCalls(options);
107
-
108
- if (deployment.calls.length + bootstrap.calls.length === 0) {
109
- throw new Error(`No function calls needed to deploy contract ${this.artifact.name}`);
184
+ const initialization = await this.getInitializationExecutionPayload(options);
185
+ const feeExecutionPayload = options?.fee?.paymentMethod
186
+ ? await options.fee.paymentMethod.getExecutionPayload()
187
+ : undefined;
188
+ const finalExecutionPayload = feeExecutionPayload
189
+ ? mergeExecutionPayloads([feeExecutionPayload, publication, initialization])
190
+ : mergeExecutionPayloads([publication, initialization]);
191
+ if (!finalExecutionPayload.calls.length) {
192
+ throw new Error(`No transactions are needed to publish or initialize contract ${this.artifact.name}`);
110
193
  }
111
194
 
112
- const calls = [...deployment.calls, ...bootstrap.calls];
113
- const authWitnesses = [...(deployment.authWitnesses ?? []), ...(bootstrap.authWitnesses ?? [])];
114
- const hashedArguments = [...(deployment.hashedArguments ?? []), ...(bootstrap.hashedArguments ?? [])];
115
- const capsules = [...(deployment.capsules ?? []), ...(bootstrap.capsules ?? [])];
116
- const { cancellable, nonce, fee: userFee } = options;
195
+ return finalExecutionPayload;
196
+ }
117
197
 
118
- const request = { calls, authWitnesses, hashedArguments, capsules, cancellable, fee: userFee, nonce };
198
+ convertDeployOptionsToRequestOptions(options: DeployOptionsWithoutWait): RequestDeployOptions {
199
+ return {
200
+ ...options,
201
+ deployer: !options?.universalDeploy ? options.from : undefined,
202
+ };
203
+ }
119
204
 
120
- const fee = await this.getFeeOptions(request);
121
- return { ...request, fee };
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;
122
220
  }
123
221
 
124
222
  /**
125
- * Register this contract in the PXE and returns the Contract object.
223
+ * Adds this contract to the wallet and returns the Contract object.
126
224
  * @param options - Deployment options.
127
225
  */
128
- public async register(options: DeployOptions = {}): Promise<TContract> {
226
+ public async register(options?: RequestDeployOptions): Promise<TContract> {
129
227
  const instance = await this.getInstance(options);
130
- await this.wallet.registerContract({ artifact: this.artifact, instance });
131
- return this.postDeployCtor(instance.address, this.wallet);
228
+ await this.wallet.registerContract(instance, this.artifact);
229
+ return this.postDeployCtor(instance, this.wallet);
132
230
  }
133
231
 
134
232
  /**
135
- * Returns calls for registration of the class and deployment of the instance, depending on the provided options.
136
- * @param options - Deployment options.
137
- * @returns A function call array with potentially requests to the class registerer and instance deployer.
233
+ * Returns an execution payload for:
234
+ * - publication of the contract class and
235
+ * - publication of the contract instance to enable public execution
236
+ * depending on the provided options.
237
+ * @param options - Contract creation options.
238
+ * @returns An execution payload with potentially calls (and bytecode capsule) to the class registry and instance registry.
138
239
  */
139
- protected async getDeploymentFunctionCalls(
140
- options: DeployOptions = {},
141
- ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
142
- const calls: FunctionCall[] = [];
143
- const capsules: Capsule[] = [];
240
+ protected async getPublicationExecutionPayload(options?: RequestDeployOptions): Promise<ExecutionPayload> {
241
+ const calls: ExecutionPayload[] = [];
144
242
 
145
243
  // Set contract instance object so it's available for populating the DeploySendTx object
146
244
  const instance = await this.getInstance(options);
@@ -154,30 +252,32 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
154
252
  );
155
253
  }
156
254
 
157
- // Register the contract class if it hasn't been published already.
158
- if (!options.skipClassRegistration) {
159
- if ((await this.wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
160
- this.log.debug(
161
- `Skipping registration of already registered contract class ${contractClass.id.toString()} for ${instance.address.toString()}`,
162
- );
163
- } else {
255
+ // Publish the contract class if it hasn't been published already.
256
+ if (!options?.skipClassPublication) {
257
+ const classMetadata = await this.wallet.getContractClassMetadata(contractClass.id);
258
+ if (!classMetadata.isContractClassPubliclyRegistered) {
164
259
  this.log.info(
165
- `Creating request for registering contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`,
260
+ `Creating request for publishing contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`,
166
261
  );
167
- const registerContractClassInteraction = await registerContractClass(this.wallet, this.artifact);
262
+ const registerContractClassInteraction = await publishContractClass(this.wallet, this.artifact);
168
263
  calls.push(await registerContractClassInteraction.request());
169
- capsules.push(...registerContractClassInteraction.getCapsules());
264
+ } else {
265
+ this.log.debug(
266
+ `Skipping contract class publication for ${contractClass.id.toString()} as it is already registered`,
267
+ );
170
268
  }
171
269
  }
172
270
 
173
- // Deploy the contract via the instance deployer.
174
- if (!options.skipPublicDeployment) {
175
- const deploymentInteraction = await deployInstance(this.wallet, instance);
271
+ // Publish the contract instance:
272
+ if (!options?.skipInstancePublication) {
273
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/15596):
274
+ // Read the artifact, and if there are no public functions, warn the caller that publication of the
275
+ // contract instance is not necessary (until such time as they wish to update the instance (i.e. change its class_id)).
276
+ const deploymentInteraction = publishInstance(this.wallet, instance);
176
277
  calls.push(await deploymentInteraction.request());
177
- capsules.push(...deploymentInteraction.getCapsules());
178
278
  }
179
279
 
180
- return { calls, capsules };
280
+ return mergeExecutionPayloads(calls);
181
281
  }
182
282
 
183
283
  /**
@@ -185,78 +285,116 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
185
285
  * @param options - Deployment options.
186
286
  * @returns - An array of function calls.
187
287
  */
188
- protected async getInitializeFunctionCalls(
189
- options: DeployOptions,
190
- ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
191
- const { address } = await this.getInstance(options);
192
- const calls: FunctionCall[] = [];
193
- const capsules: Capsule[] = [];
194
- if (this.constructorArtifact && !options.skipInitialization) {
288
+ protected async getInitializationExecutionPayload(options?: RequestDeployOptions): Promise<ExecutionPayload> {
289
+ const executionsPayloads: ExecutionPayload[] = [];
290
+ if (this.constructorArtifact && !options?.skipInitialization) {
291
+ const { address } = await this.getInstance(options);
195
292
  const constructorCall = new ContractFunctionInteraction(
196
293
  this.wallet,
197
294
  address,
198
295
  this.constructorArtifact,
199
296
  this.args,
200
297
  );
201
- calls.push(await constructorCall.request());
202
- capsules.push(...constructorCall.getCapsules());
298
+ executionsPayloads.push(await constructorCall.request());
203
299
  }
204
- return { calls, capsules };
300
+ return mergeExecutionPayloads(executionsPayloads);
205
301
  }
206
302
 
207
303
  /**
208
- * Send the contract deployment transaction using the provided options.
209
- * This function extends the 'send' method from the ContractFunctionInteraction class,
210
- * allowing us to send a transaction specifically for contract deployment.
304
+ * Send a contract deployment transaction (initialize and/or publish) using the provided options.
305
+ * By default, waits for the transaction to be mined and returns the deployed contract instance.
211
306
  *
212
307
  * @param options - An object containing various deployment options such as contractAddressSalt and from.
213
- * @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)
214
309
  */
215
- public override send(options: DeployOptions = {}): DeploySentTx<TContract> {
216
- const txHashPromise = super.send(options).getTxHash();
217
- this.log.debug(`Sent deployment tx of ${this.artifact.name} contract`);
218
- return new DeploySentTx(this.wallet, txHashPromise, 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;
219
341
  }
220
342
 
221
343
  /**
222
- * Builds the contract instance to be deployed and returns it.
344
+ * Builds the contract instance and returns it.
223
345
  *
224
- * @param options - An object containing various deployment options.
346
+ * @param options - An object containing various initialization and publication options.
225
347
  * @returns An instance object.
226
348
  */
227
- public async getInstance(options: DeployOptions = {}): Promise<ContractInstanceWithAddress> {
349
+ public async getInstance(options?: RequestDeployOptions): Promise<ContractInstanceWithAddress> {
228
350
  if (!this.instance) {
229
- this.instance = await getContractInstanceFromDeployParams(this.artifact, {
351
+ this.instance = await getContractInstanceFromInstantiationParams(this.artifact, {
230
352
  constructorArgs: this.args,
231
- salt: options.contractAddressSalt,
353
+ salt: options?.contractAddressSalt ?? Fr.random(),
232
354
  publicKeys: this.publicKeys,
233
355
  constructorArtifact: this.constructorArtifact,
234
- deployer: options.universalDeploy ? AztecAddress.ZERO : this.wallet.getAddress(),
356
+ deployer: options?.deployer ? options.deployer : AztecAddress.ZERO,
235
357
  });
236
358
  }
237
359
  return this.instance;
238
360
  }
239
361
 
240
362
  /**
241
- * Prove the request.
242
- * @param options - Deployment options.
243
- * @returns The proven tx.
363
+ * Simulate the deployment
364
+ *
365
+ * @param options - An optional object containing additional configuration for the simulation.
366
+ * @returns A simulation result object containing metadata of the execution, including gas
367
+ * estimations (if requested via options), execution statistics and emitted offchain effects
244
368
  */
245
- public override async prove(options: DeployOptions): Promise<DeployProvenTx<TContract>> {
246
- const txProvingResult = await this.proveInternal(options);
247
- return new DeployProvenTx(this.wallet, txProvingResult.toTx(), this.postDeployCtor, () =>
248
- this.getInstance(options),
369
+ public async simulate(options: SimulateDeployOptions): Promise<SimulationReturn<true>> {
370
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
371
+ const simulatedTx = await this.wallet.simulateTx(executionPayload, toSimulateOptions(options));
372
+
373
+ const { gasLimits, teardownGasLimits } = getGasLimits(simulatedTx, options.fee?.estimatedGasPadding);
374
+ this.log.verbose(
375
+ `Estimated gas limits for tx: DA=${gasLimits.daGas} L2=${gasLimits.l2Gas} teardownDA=${teardownGasLimits.daGas} teardownL2=${teardownGasLimits.l2Gas}`,
249
376
  );
377
+ return {
378
+ stats: simulatedTx.stats!,
379
+ offchainEffects: collectOffchainEffects(simulatedTx.privateExecutionResult),
380
+ result: undefined,
381
+ estimatedGas: { gasLimits, teardownGasLimits },
382
+ };
250
383
  }
251
384
 
252
385
  /**
253
- * Estimates gas cost for this deployment operation.
254
- * @param options - Options.
386
+ * Simulate a deployment and profile the gate count for each function in the transaction.
387
+ * @param options - Same options as `send`, plus extra profiling options.
388
+ *
389
+ * @returns An object containing the function return value and profile result.
255
390
  */
256
- public override estimateGas(
257
- options?: Omit<DeployOptions, 'estimateGas' | 'skipPublicSimulation'>,
258
- ): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>> {
259
- return super.estimateGas(options);
391
+ public async profile(options: DeployOptionsWithoutWait & ProfileInteractionOptions): Promise<TxProfileResult> {
392
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
393
+ return await this.wallet.profileTx(executionPayload, {
394
+ ...toProfileOptions(options),
395
+ profileMode: options.profileMode,
396
+ skipProofGeneration: options.skipProofGeneration,
397
+ });
260
398
  }
261
399
 
262
400
  /** Return this deployment address. */
@@ -268,4 +406,30 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
268
406
  public get partialAddress() {
269
407
  return this.instance && computePartialAddress(this.instance);
270
408
  }
409
+
410
+ /**
411
+ * Augments this DeployMethod with additional metadata, such as authWitnesses and capsules.
412
+ * @param options - An object containing the metadata to add to the interaction
413
+ * @returns A new DeployMethod with the added metadata, but calling the same original function in the same manner
414
+ */
415
+ public with({
416
+ authWitnesses = [],
417
+ capsules = [],
418
+ }: {
419
+ /** The authWitnesses to add to the deployment */
420
+ authWitnesses?: AuthWitness[];
421
+ /** The capsules to add to the deployment */
422
+ capsules?: Capsule[];
423
+ }): DeployMethod {
424
+ return new DeployMethod(
425
+ this.publicKeys,
426
+ this.wallet,
427
+ this.artifact,
428
+ this.postDeployCtor,
429
+ this.args,
430
+ this.constructorArtifact?.name,
431
+ this.authWitnesses.concat(authWitnesses),
432
+ this.capsules.concat(capsules),
433
+ );
434
+ }
271
435
  }
@@ -1,9 +1,9 @@
1
- import type { Gas } from '@aztec/stdlib/gas';
1
+ import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
2
+ import { Gas } from '@aztec/stdlib/gas';
2
3
  import type { TxSimulationResult } from '@aztec/stdlib/tx';
3
4
 
4
5
  /**
5
6
  * Returns suggested total and teardown gas limits for a simulated tx.
6
- * Note that public gas usage is only accounted for if the publicOutput is present.
7
7
  * @param pad - Percentage to pad the suggested gas limits by, (as decimal, e.g., 0.10 for 10%).
8
8
  */
9
9
  export function getGasLimits(
@@ -11,16 +11,23 @@ export function getGasLimits(
11
11
  pad = 0.1,
12
12
  ): {
13
13
  /**
14
- * Total gas used across private and public
14
+ * Gas limit for the tx, excluding teardown gas
15
15
  */
16
- totalGas: Gas;
16
+ gasLimits: Gas;
17
17
  /**
18
- * Teardown gas used
18
+ * Gas limit for the teardown phase
19
19
  */
20
- teardownGas: Gas;
20
+ teardownGasLimits: Gas;
21
21
  } {
22
+ // Total gas does not use the teardown gas limit, but the actual total gas used by the tx.
23
+ const gasLimits = simulationResult.gasUsed.totalGas.mul(1 + pad);
24
+ const teardownGasLimits = simulationResult.gasUsed.teardownGas.mul(1 + pad);
25
+
26
+ if (gasLimits.l2Gas > AVM_MAX_PROCESSABLE_L2_GAS) {
27
+ throw new Error('Transaction consumes more gas than the AVM maximum processable gas');
28
+ }
22
29
  return {
23
- totalGas: simulationResult.gasUsed.totalGas.mul(1 + pad),
24
- teardownGas: simulationResult.gasUsed.teardownGas.mul(1 + pad),
30
+ gasLimits,
31
+ teardownGasLimits,
25
32
  };
26
33
  }