@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
@@ -0,0 +1,163 @@
1
+ import type { FieldsOf } from '@aztec/foundation/types';
2
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import type { GasSettings } from '@aztec/stdlib/gas';
5
+ import type { Capsule, OffchainEffect, SimulationStats } from '@aztec/stdlib/tx';
6
+
7
+ import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
8
+ import type { ProfileOptions, SendOptions, SimulateOptions } from '../wallet/index.js';
9
+
10
+ /**
11
+ * Options used to tweak the simulation and add gas estimation capabilities
12
+ */
13
+ export type FeeEstimationOptions = {
14
+ /** Whether to modify the fee settings of the simulation with high gas limit to figure out actual gas settings. */
15
+ estimateGas?: boolean;
16
+ /** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
17
+ estimatedGasPadding?: number;
18
+ };
19
+
20
+ /**
21
+ * Interactions allow configuring a custom fee payment method that gets bundled with the transaction before
22
+ * sending it to the wallet
23
+ */
24
+ export type FeePaymentMethodOption = {
25
+ /** Fee payment method to embed in the interaction */
26
+ paymentMethod?: FeePaymentMethod;
27
+ };
28
+
29
+ /**
30
+ * User-defined partial gas settings for the interaction. This type is completely optional since
31
+ * the wallet will fill in the missing options
32
+ */
33
+ export type GasSettingsOption = {
34
+ /** The gas settings */
35
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
36
+ };
37
+
38
+ /** Fee options as set by a user. */
39
+ export type InteractionFeeOptions = GasSettingsOption & FeePaymentMethodOption;
40
+
41
+ /** Fee options that can be set for simulation *only* */
42
+ export type SimulationInteractionFeeOptions = InteractionFeeOptions & FeeEstimationOptions;
43
+
44
+ /**
45
+ * Represents the options to configure a request from a contract interaction.
46
+ * Allows specifying additional auth witnesses and capsules to use during execution
47
+ */
48
+ export type RequestInteractionOptions = {
49
+ /** Extra authwits to use during execution */
50
+ authWitnesses?: AuthWitness[];
51
+ /** Extra capsules to use during execution */
52
+ capsules?: Capsule[];
53
+ /** Fee payment method to embed in the interaction request */
54
+ fee?: FeePaymentMethodOption;
55
+ };
56
+
57
+ /**
58
+ * Represents options for calling a (constrained) function in a contract.
59
+ */
60
+ export type SendInteractionOptions = RequestInteractionOptions & {
61
+ /** The sender's Aztec address. */
62
+ from: AztecAddress;
63
+ /** The fee options for the transaction. */
64
+ fee?: InteractionFeeOptions;
65
+ };
66
+
67
+ /**
68
+ * Represents the options for simulating a contract function interaction.
69
+ * Allows specifying the address from which the method should be called.
70
+ * Disregarded for simulation of public functions
71
+ */
72
+ export type SimulateInteractionOptions = Omit<SendInteractionOptions, 'fee'> & {
73
+ /** The fee options for the transaction. */
74
+ fee?: SimulationInteractionFeeOptions;
75
+ /** Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers. */
76
+ skipTxValidation?: boolean;
77
+ /** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
78
+ skipFeeEnforcement?: boolean;
79
+ /** Whether to include metadata such as offchain effects and performance statistics (e.g. timing information of the different circuits and oracles) in
80
+ * the simulation result, instead of just the return value of the function */
81
+ includeMetadata?: boolean;
82
+ };
83
+
84
+ /**
85
+ * Represents the options for profiling an interaction.
86
+ */
87
+ export type ProfileInteractionOptions = SimulateInteractionOptions & {
88
+ /** Whether to return gates information or the bytecode/witnesses. */
89
+ profileMode: 'gates' | 'execution-steps' | 'full';
90
+ /** Whether to generate a Chonk proof or not */
91
+ skipProofGeneration?: boolean;
92
+ };
93
+
94
+ /**
95
+ * Represents the result type of a simulation.
96
+ * By default, it will just be the return value of the simulated function
97
+ * If `includeMetadata` is set to true in `SimulateInteractionOptions` on the input of `simulate(...)`,
98
+ * it will provide extra information.
99
+ */
100
+ export type SimulationReturn<T extends boolean | undefined> = T extends true
101
+ ? {
102
+ /** Additional stats about the simulation */
103
+ stats: SimulationStats;
104
+ /** Offchain effects generated during the simulation */
105
+ offchainEffects: OffchainEffect[];
106
+ /** Return value of the function */
107
+ result: any;
108
+ /** Gas estimation results */
109
+ estimatedGas: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>;
110
+ }
111
+ : any;
112
+
113
+ /**
114
+ * Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into
115
+ * SendOptions, which are the ones that can be serialized and forwarded to the wallet
116
+ */
117
+ export function toSendOptions(options: SendInteractionOptions): SendOptions {
118
+ return {
119
+ ...options,
120
+ fee: {
121
+ // If a payment method that includes gas settings was used,
122
+ // try to reuse as much as possible while still allowing
123
+ // manual override. CAREFUL: this can cause mismatches during proving
124
+ gasSettings: {
125
+ ...options.fee?.paymentMethod?.getGasSettings(),
126
+ ...options.fee?.gasSettings,
127
+ },
128
+ },
129
+ };
130
+ }
131
+
132
+ /**
133
+ * Transforms and cleans up the higher level SimulateInteractionOptions defined by the interaction into
134
+ * SimulateOptions, which are the ones that can be serialized and forwarded to the wallet
135
+ */
136
+ export function toSimulateOptions(options: SimulateInteractionOptions): SimulateOptions {
137
+ return {
138
+ ...options,
139
+ fee: {
140
+ // If a payment method that includes gas settings was used,
141
+ // try to reuse as much as possible while still allowing
142
+ // manual override. CAREFUL: this can cause mismatches during proving
143
+ gasSettings: {
144
+ ...options.fee?.paymentMethod?.getGasSettings(),
145
+ ...options.fee?.gasSettings,
146
+ },
147
+ estimateGas: options.fee?.estimateGas,
148
+ estimatedGasPadding: options.fee?.estimatedGasPadding,
149
+ },
150
+ };
151
+ }
152
+
153
+ /**
154
+ * Transforms and cleans up the higher level ProfileInteractionOptions defined by the interaction into
155
+ * ProfileOptions, which are the ones that can be serialized and forwarded to the wallet
156
+ */
157
+ export function toProfileOptions(options: ProfileInteractionOptions): ProfileOptions {
158
+ return {
159
+ ...toSimulateOptions(options),
160
+ profileMode: options.profileMode,
161
+ skipProofGeneration: options.skipProofGeneration,
162
+ };
163
+ }
@@ -1,30 +1,30 @@
1
1
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
2
 
3
- import type { Wallet } from '../wallet/index.js';
3
+ import type { Wallet } from '../wallet/wallet.js';
4
4
  import { UnsafeContract } from './unsafe_contract.js';
5
5
 
6
- /** Returns a Contract wrapper for the class registerer. */
7
- export async function getRegistererContract(wallet: Wallet) {
8
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegisterer);
6
+ /** Returns a Contract wrapper for the contract class registry. */
7
+ export async function getClassRegistryContract(wallet: Wallet) {
8
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegistry);
9
9
  if (!contractInstance) {
10
- throw new Error("ContractClassRegisterer is not registered in this wallet's instance");
10
+ throw new Error("ContractClassRegistry is not registered in this wallet's instance");
11
11
  }
12
12
  const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
13
13
 
14
14
  return new UnsafeContract(contractInstance!, artifact!, wallet);
15
15
  }
16
16
 
17
- /** Returns a Contract wrapper for the instance deployer. */
18
- export async function getDeployerContract(wallet: Wallet) {
19
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceDeployer);
17
+ /** Returns a Contract wrapper for the contract instance registry. */
18
+ export async function getInstanceRegistryContract(wallet: Wallet) {
19
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceRegistry);
20
20
  if (!contractInstance) {
21
- throw new Error("ContractInstanceDeployer is not registered in this wallet's instance");
21
+ throw new Error("ContractInstanceRegistry is not registered in this wallet's instance");
22
22
  }
23
23
  const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
24
24
  return new UnsafeContract(contractInstance!, artifact!, wallet);
25
25
  }
26
26
 
27
- /** Returns a Contract wrapper for the fee juice */
27
+ /** Returns a Contract wrapper for the fee juice contract */
28
28
  export async function getFeeJuice(wallet: Wallet) {
29
29
  const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
30
30
  if (!contractInstance) {
@@ -1,7 +1,10 @@
1
+ import { promiseWithResolvers } from '@aztec/foundation/promise';
1
2
  import { retryUntil } from '@aztec/foundation/retry';
2
3
  import type { FieldsOf } from '@aztec/foundation/types';
3
- import type { AztecNode, GetPublicLogsResponse, PXE } from '@aztec/stdlib/interfaces/client';
4
- import { type TxHash, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
4
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import { TxHash, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
6
+
7
+ import type { Wallet } from '../wallet/wallet.js';
5
8
 
6
9
  /** Options related to waiting for a tx. */
7
10
  export type WaitOpts = {
@@ -9,24 +12,16 @@ export type WaitOpts = {
9
12
  ignoreDroppedReceiptsFor?: number;
10
13
  /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
11
14
  timeout?: number;
12
- /** The maximum time (in seconds) to wait for the transaction to be proven. Defaults to 600. */
13
- provenTimeout?: number;
14
15
  /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
15
16
  interval?: number;
16
- /** Whether to wait for the tx to be proven. */
17
- proven?: boolean;
18
- /** Whether to include information useful for debugging/testing in the receipt. */
19
- debug?: boolean;
20
17
  /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
21
18
  dontThrowOnRevert?: boolean;
22
19
  };
23
20
 
24
21
  export const DefaultWaitOpts: WaitOpts = {
25
22
  ignoreDroppedReceiptsFor: 5,
26
- timeout: 60,
27
- provenTimeout: 600,
23
+ timeout: 300,
28
24
  interval: 1,
29
- debug: false,
30
25
  };
31
26
 
32
27
  /**
@@ -34,7 +29,27 @@ export const DefaultWaitOpts: WaitOpts = {
34
29
  * its hash, receipt, and mining status.
35
30
  */
36
31
  export class SentTx {
37
- constructor(protected pxeOrNode: PXE | AztecNode, protected txHashPromise: Promise<TxHash>) {}
32
+ protected sendTxPromise: Promise<void>;
33
+ protected sendTxError?: Error;
34
+ protected txHash?: TxHash;
35
+
36
+ constructor(
37
+ protected walletOrNode: Wallet | AztecNode,
38
+ sendTx: () => Promise<TxHash>,
39
+ ) {
40
+ const { promise, resolve } = promiseWithResolvers<void>();
41
+ this.sendTxPromise = promise;
42
+ sendTx()
43
+ .then(txHash => {
44
+ this.txHash = txHash;
45
+ resolve();
46
+ })
47
+ .catch(err => {
48
+ this.sendTxError = err;
49
+ // Calling resolve instead of reject here because we want to throw the error when getTxHash is called.
50
+ resolve();
51
+ });
52
+ }
38
53
 
39
54
  /**
40
55
  * Retrieves the transaction hash of the SentTx instance.
@@ -43,8 +58,17 @@ export class SentTx {
43
58
  * @returns A promise that resolves to the transaction hash of the SentTx instance.
44
59
  * TODO(#7717): Don't throw here.
45
60
  */
46
- public getTxHash(): Promise<TxHash> {
47
- return this.txHashPromise;
61
+ public async getTxHash(): Promise<TxHash> {
62
+ // Make sure sendTx has been resolved, which can be triggered when it returns a txHash or when it throws an error.
63
+ await this.sendTxPromise;
64
+
65
+ // If sendTx threw an error, throw it.
66
+ if (this.sendTxError) {
67
+ throw this.sendTxError;
68
+ }
69
+
70
+ // sendTx returned a txHash if it's been resolved and no error was set.
71
+ return Promise.resolve(this.txHash!);
48
72
  }
49
73
 
50
74
  /**
@@ -56,7 +80,7 @@ export class SentTx {
56
80
  */
57
81
  public async getReceipt(): Promise<TxReceipt> {
58
82
  const txHash = await this.getTxHash();
59
- return await this.pxeOrNode.getTxReceipt(txHash);
83
+ return await this.walletOrNode.getTxReceipt(txHash);
60
84
  }
61
85
 
62
86
  /**
@@ -68,35 +92,12 @@ export class SentTx {
68
92
  const receipt = await this.waitForReceipt(opts);
69
93
  if (receipt.status !== TxStatus.SUCCESS && !opts?.dontThrowOnRevert) {
70
94
  throw new Error(
71
- `Transaction ${await this.getTxHash()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`,
95
+ `Transaction ${(await this.getTxHash()).toString()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`,
72
96
  );
73
97
  }
74
- if (opts?.proven && receipt.blockNumber !== undefined) {
75
- await this.waitForProven(receipt.blockNumber, opts);
76
- }
77
- if (opts?.debug) {
78
- const txHash = await this.getTxHash();
79
- const { data: tx } = (await this.pxeOrNode.getTxEffect(txHash))!;
80
- receipt.debugInfo = {
81
- noteHashes: tx.noteHashes,
82
- nullifiers: tx.nullifiers,
83
- publicDataWrites: tx.publicDataWrites,
84
- l2ToL1Msgs: tx.l2ToL1Msgs,
85
- };
86
- }
87
98
  return receipt;
88
99
  }
89
100
 
90
- /**
91
- * Gets public logs emitted by this tx.
92
- * @remarks This function will wait for the tx to be mined if it hasn't been already.
93
- * @returns The requested logs.
94
- */
95
- public async getPublicLogs(): Promise<GetPublicLogsResponse> {
96
- await this.wait();
97
- return this.pxeOrNode.getPublicLogs({ txHash: await this.getTxHash() });
98
- }
99
-
100
101
  protected async waitForReceipt(opts?: WaitOpts): Promise<TxReceipt> {
101
102
  const txHash = await this.getTxHash();
102
103
  const startTime = Date.now();
@@ -104,7 +105,7 @@ export class SentTx {
104
105
 
105
106
  return await retryUntil(
106
107
  async () => {
107
- const txReceipt = await this.pxeOrNode.getTxReceipt(txHash);
108
+ const txReceipt = await this.walletOrNode.getTxReceipt(txHash);
108
109
  // If receipt is not yet available, try again
109
110
  if (txReceipt.status === TxStatus.PENDING) {
110
111
  return undefined;
@@ -126,16 +127,4 @@ export class SentTx {
126
127
  opts?.interval ?? DefaultWaitOpts.interval,
127
128
  );
128
129
  }
129
-
130
- protected async waitForProven(minedBlock: number, opts?: WaitOpts) {
131
- return await retryUntil(
132
- async () => {
133
- const provenBlock = await this.pxeOrNode.getProvenBlockNumber();
134
- return provenBlock >= minedBlock ? provenBlock : undefined;
135
- },
136
- 'isProven',
137
- opts?.provenTimeout ?? DefaultWaitOpts.provenTimeout,
138
- opts?.interval ?? DefaultWaitOpts.interval,
139
- );
140
- }
141
130
  }
@@ -1,7 +1,7 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
2
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
3
 
4
- import type { Wallet } from '../wallet/index.js';
4
+ import type { Wallet } from '../wallet/wallet.js';
5
5
  import { ContractBase } from './contract_base.js';
6
6
 
7
7
  /** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
@@ -14,6 +14,6 @@ export class UnsafeContract extends ContractBase {
14
14
  /** The wallet used for interacting with this contract. */
15
15
  wallet: Wallet,
16
16
  ) {
17
- super(instance, artifact, wallet);
17
+ super(instance.address, artifact, wallet);
18
18
  }
19
19
  }
@@ -0,0 +1,38 @@
1
+ import { retryUntil } from '@aztec/foundation/retry';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { TxReceipt } from '@aztec/stdlib/tx';
4
+
5
+ import { DefaultWaitOpts } from './sent_tx.js';
6
+
7
+ /**
8
+ * Options for waiting for a transaction to be proven.
9
+ */
10
+ export type WaitForProvenOpts = {
11
+ /** Time to wait for the tx to be proven before timing out */
12
+ provenTimeout?: number;
13
+ /** Elapsed time between polls to the node */
14
+ interval?: number;
15
+ };
16
+
17
+ export const DefaultWaitForProvenOpts: WaitForProvenOpts = {
18
+ provenTimeout: 600,
19
+ interval: DefaultWaitOpts.interval,
20
+ };
21
+
22
+ /**
23
+ * Wait for a transaction to be proven by polling the node
24
+ */
25
+ export async function waitForProven(node: AztecNode, receipt: TxReceipt, opts?: WaitForProvenOpts) {
26
+ if (!receipt.blockNumber) {
27
+ throw new Error(`Cannot wait for proven: receipt of tx ${receipt.txHash} does not have a block number`);
28
+ }
29
+ return await retryUntil(
30
+ async () => {
31
+ const provenBlock = await node.getProvenBlockNumber();
32
+ return provenBlock >= receipt.blockNumber! ? provenBlock : undefined;
33
+ },
34
+ 'isProven',
35
+ opts?.provenTimeout ?? DefaultWaitForProvenOpts.provenTimeout,
36
+ opts?.interval ?? DefaultWaitForProvenOpts.interval,
37
+ );
38
+ }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
3
+ CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT,
3
4
  MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
4
- REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT,
5
5
  } from '@aztec/constants';
6
6
  import { padArrayEnd } from '@aztec/foundation/collection';
7
7
  import { Fr } from '@aztec/foundation/fields';
@@ -10,17 +10,17 @@ import { type ContractArtifact, FunctionSelector, FunctionType, bufferAsFields }
10
10
  import {
11
11
  computeVerificationKeyHash,
12
12
  createPrivateFunctionMembershipProof,
13
- createUnconstrainedFunctionMembershipProof,
13
+ createUtilityFunctionMembershipProof,
14
14
  getContractClassFromArtifact,
15
15
  } from '@aztec/stdlib/contract';
16
16
  import { Capsule } from '@aztec/stdlib/tx';
17
17
 
18
18
  import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
19
- import { getRegistererContract } from '../contract/protocol_contracts.js';
19
+ import { getClassRegistryContract } from '../contract/protocol_contracts.js';
20
20
  import type { Wallet } from '../wallet/index.js';
21
21
 
22
22
  /**
23
- * Sets up a call to broadcast a private function's bytecode via the ClassRegisterer contract.
23
+ * Sets up a call to broadcast a private function's bytecode via the ClassRegistry contract.
24
24
  * Note that this is not required for users to call the function, but is rather a convenience to make
25
25
  * this code publicly available so dapps or wallets do not need to redistribute it.
26
26
  * @param wallet - Wallet to send the transaction.
@@ -51,43 +51,43 @@ export async function broadcastPrivateFunction(
51
51
  artifactTreeLeafIndex,
52
52
  artifactMetadataHash,
53
53
  functionMetadataHash,
54
- unconstrainedFunctionsArtifactTreeRoot,
54
+ utilityFunctionsTreeRoot,
55
55
  privateFunctionTreeSiblingPath,
56
56
  privateFunctionTreeLeafIndex,
57
57
  } = await createPrivateFunctionMembershipProof(selector, artifact);
58
58
 
59
59
  const vkHash = await computeVerificationKeyHash(privateFunctionArtifact);
60
60
 
61
- const registerer = await getRegistererContract(wallet);
62
- const fn = registerer.methods.broadcast_private_function(
63
- contractClass.id,
64
- artifactMetadataHash,
65
- unconstrainedFunctionsArtifactTreeRoot,
66
- privateFunctionTreeSiblingPath,
67
- privateFunctionTreeLeafIndex,
68
- padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
69
- artifactTreeLeafIndex,
70
- // eslint-disable-next-line camelcase
71
- { selector, metadata_hash: functionMetadataHash, vk_hash: vkHash },
72
- );
73
-
61
+ const classRegistry = await getClassRegistryContract(wallet);
74
62
  const bytecode = bufferAsFields(
75
63
  privateFunctionArtifact.bytecode,
76
64
  MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
77
65
  );
78
- fn.addCapsule(
79
- new Capsule(
80
- ProtocolContractAddress.ContractClassRegisterer,
81
- new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
82
- bytecode,
83
- ),
84
- );
85
-
86
- return fn;
66
+ return classRegistry.methods
67
+ .broadcast_private_function(
68
+ contractClass.id,
69
+ artifactMetadataHash,
70
+ utilityFunctionsTreeRoot,
71
+ privateFunctionTreeSiblingPath,
72
+ privateFunctionTreeLeafIndex,
73
+ padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
74
+ artifactTreeLeafIndex,
75
+ // eslint-disable-next-line camelcase
76
+ { selector, metadata_hash: functionMetadataHash, vk_hash: vkHash },
77
+ )
78
+ .with({
79
+ capsules: [
80
+ new Capsule(
81
+ ProtocolContractAddress.ContractClassRegistry,
82
+ new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT),
83
+ bytecode,
84
+ ),
85
+ ],
86
+ });
87
87
  }
88
88
 
89
89
  /**
90
- * Sets up a call to broadcast an unconstrained function's bytecode via the ClassRegisterer contract.
90
+ * Sets up a call to broadcast a utility function's bytecode via the ClassRegistry contract.
91
91
  * Note that this is not required for users to call the function, but is rather a convenience to make
92
92
  * this code publicly available so dapps or wallets do not need to redistribute it.
93
93
  * @param wallet - Wallet to send the transaction.
@@ -95,22 +95,22 @@ export async function broadcastPrivateFunction(
95
95
  * @param selector - Selector of the function to be broadcast.
96
96
  * @returns A ContractFunctionInteraction object that can be used to send the transaction.
97
97
  */
98
- export async function broadcastUnconstrainedFunction(
98
+ export async function broadcastUtilityFunction(
99
99
  wallet: Wallet,
100
100
  artifact: ContractArtifact,
101
101
  selector: FunctionSelector,
102
102
  ): Promise<ContractFunctionInteraction> {
103
103
  const contractClass = await getContractClassFromArtifact(artifact);
104
- const unconstrainedFunctions = artifact.functions.filter(fn => fn.functionType === FunctionType.UNCONSTRAINED);
105
- const unconstrainedFunctionsAndSelectors = await Promise.all(
106
- unconstrainedFunctions.map(async fn => ({
104
+ const utilityFunctions = artifact.functions.filter(fn => fn.functionType === FunctionType.UTILITY);
105
+ const utilityFunctionsAndSelectors = await Promise.all(
106
+ utilityFunctions.map(async fn => ({
107
107
  f: fn,
108
108
  selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters),
109
109
  })),
110
110
  );
111
- const unconstrainedFunctionArtifact = unconstrainedFunctionsAndSelectors.find(fn => selector.equals(fn.selector))?.f;
112
- if (!unconstrainedFunctionArtifact) {
113
- throw new Error(`Unconstrained function with selector ${selector.toString()} not found`);
111
+ const utilityFunctionArtifact = utilityFunctionsAndSelectors.find(fn => selector.equals(fn.selector))?.f;
112
+ if (!utilityFunctionArtifact) {
113
+ throw new Error(`Utility function with selector ${selector.toString()} not found`);
114
114
  }
115
115
 
116
116
  const {
@@ -119,30 +119,30 @@ export async function broadcastUnconstrainedFunction(
119
119
  artifactTreeSiblingPath,
120
120
  functionMetadataHash,
121
121
  privateFunctionsArtifactTreeRoot,
122
- } = await createUnconstrainedFunctionMembershipProof(selector, artifact);
123
-
124
- const registerer = await getRegistererContract(wallet);
125
- const fn = registerer.methods.broadcast_unconstrained_function(
126
- contractClass.id,
127
- artifactMetadataHash,
128
- privateFunctionsArtifactTreeRoot,
129
- padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
130
- artifactTreeLeafIndex,
131
- // eslint-disable-next-line camelcase
132
- { selector, metadata_hash: functionMetadataHash },
133
- );
122
+ } = await createUtilityFunctionMembershipProof(selector, artifact);
134
123
 
124
+ const classRegistry = await getClassRegistryContract(wallet);
135
125
  const bytecode = bufferAsFields(
136
- unconstrainedFunctionArtifact.bytecode,
126
+ utilityFunctionArtifact.bytecode,
137
127
  MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
138
128
  );
139
- fn.addCapsule(
140
- new Capsule(
141
- ProtocolContractAddress.ContractClassRegisterer,
142
- new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
143
- bytecode,
144
- ),
145
- );
146
-
147
- return fn;
129
+ return classRegistry.methods
130
+ .broadcast_utility_function(
131
+ contractClass.id,
132
+ artifactMetadataHash,
133
+ privateFunctionsArtifactTreeRoot,
134
+ padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
135
+ artifactTreeLeafIndex,
136
+ // eslint-disable-next-line camelcase
137
+ { selector, metadata_hash: functionMetadataHash },
138
+ )
139
+ .with({
140
+ capsules: [
141
+ new Capsule(
142
+ ProtocolContractAddress.ContractClassRegistry,
143
+ new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT),
144
+ bytecode,
145
+ ),
146
+ ],
147
+ });
148
148
  }
@@ -1,10 +1,10 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
3
  import { PublicKeys } from '@aztec/stdlib/keys';
4
4
 
5
- import type { Wallet } from '../account/wallet.js';
6
5
  import { Contract } from '../contract/contract.js';
7
6
  import { DeployMethod } from '../contract/deploy_method.js';
7
+ import type { Wallet } from '../wallet/wallet.js';
8
8
 
9
9
  /**
10
10
  * A class for deploying contract.
@@ -28,7 +28,8 @@ export class ContractDeployer {
28
28
  * @returns A DeployMethod instance configured with the ABI, PXE, and constructor arguments.
29
29
  */
30
30
  public deploy(...args: any[]) {
31
- const postDeployCtor = (address: AztecAddress, wallet: Wallet) => Contract.at(address, this.artifact, wallet);
31
+ const postDeployCtor = (instance: ContractInstanceWithAddress, wallet: Wallet) =>
32
+ Contract.at(instance.address, this.artifact, wallet);
32
33
  return new DeployMethod(
33
34
  this.publicKeys ?? PublicKeys.default(),
34
35
  this.wallet,
@@ -0,0 +1,34 @@
1
+ import {
2
+ CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT,
3
+ MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS,
4
+ } from '@aztec/constants';
5
+ import { Fr } from '@aztec/foundation/fields';
6
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
7
+ import { type ContractArtifact, bufferAsFields } from '@aztec/stdlib/abi';
8
+ import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
9
+ import { Capsule } from '@aztec/stdlib/tx';
10
+
11
+ import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
12
+ import { getClassRegistryContract } from '../contract/protocol_contracts.js';
13
+ import type { Wallet } from '../wallet/index.js';
14
+
15
+ /** Sets up a call to publish a contract class given its artifact. */
16
+ export async function publishContractClass(
17
+ wallet: Wallet,
18
+ artifact: ContractArtifact,
19
+ ): Promise<ContractFunctionInteraction> {
20
+ const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment, packedBytecode } =
21
+ await getContractClassFromArtifact(artifact);
22
+ const classRegistry = await getClassRegistryContract(wallet);
23
+
24
+ const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
25
+ return classRegistry.methods.publish(artifactHash, privateFunctionsRoot, publicBytecodeCommitment).with({
26
+ capsules: [
27
+ new Capsule(
28
+ ProtocolContractAddress.ContractClassRegistry,
29
+ new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT),
30
+ encodedBytecode,
31
+ ),
32
+ ],
33
+ });
34
+ }