@aztec/aztec.js 0.0.0-test.1 → 0.0.1-commit.5476d83

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