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

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 (392) hide show
  1. package/README.md +1 -1
  2. package/dest/account/account.d.ts +60 -0
  3. package/dest/account/account.d.ts.map +1 -0
  4. package/dest/account/account.js +59 -0
  5. package/dest/account/{contract.d.ts → account_contract.d.ts} +16 -10
  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/{wallet/account_wallet_with_private_key.d.ts → account/account_with_secret_key.d.ts} +7 -8
  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 +3 -7
  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 +1 -13
  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 +24 -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 +2 -1
  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 +5 -2
  24. package/dest/api/account.d.ts.map +1 -1
  25. package/dest/api/account.js +3 -1
  26. package/dest/api/addresses.d.ts +1 -0
  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/{contract/index.d.ts → api/contract.d.ts} +15 -11
  36. package/dest/api/contract.d.ts.map +1 -0
  37. package/dest/{contract/index.js → api/contract.js} +14 -10
  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 +4 -3
  42. package/dest/api/deployment.d.ts.map +1 -1
  43. package/dest/api/deployment.js +4 -3
  44. package/dest/api/ethereum.d.ts +2 -0
  45. package/dest/api/ethereum.d.ts.map +1 -0
  46. package/dest/api/ethereum.js +1 -0
  47. package/dest/api/events.d.ts +12 -0
  48. package/dest/api/events.d.ts.map +1 -0
  49. package/dest/api/events.js +30 -0
  50. package/dest/api/fee.d.ts +1 -1
  51. package/dest/api/fee.d.ts.map +1 -1
  52. package/dest/api/fee.js +1 -1
  53. package/dest/api/fee_testing.d.ts +2 -0
  54. package/dest/api/fee_testing.d.ts.map +1 -0
  55. package/dest/api/fee_testing.js +1 -0
  56. package/dest/api/keys.d.ts +4 -0
  57. package/dest/api/keys.d.ts.map +1 -0
  58. package/dest/api/keys.js +3 -0
  59. package/dest/api/log.d.ts +1 -0
  60. package/dest/api/log.d.ts.map +1 -1
  61. package/dest/api/log.js +1 -0
  62. package/dest/api/messaging.d.ts +3 -0
  63. package/dest/api/messaging.d.ts.map +1 -0
  64. package/dest/api/messaging.js +2 -0
  65. package/dest/api/node.d.ts +21 -0
  66. package/dest/api/node.d.ts.map +1 -0
  67. package/dest/api/node.js +18 -0
  68. package/dest/api/note.d.ts +2 -0
  69. package/dest/api/note.d.ts.map +1 -0
  70. package/dest/api/note.js +1 -0
  71. package/dest/api/protocol.d.ts +3 -0
  72. package/dest/api/protocol.d.ts.map +1 -0
  73. package/dest/api/protocol.js +2 -0
  74. package/dest/api/trees.d.ts +3 -0
  75. package/dest/api/trees.d.ts.map +1 -0
  76. package/dest/api/trees.js +2 -0
  77. package/dest/api/tx.d.ts +2 -0
  78. package/dest/api/tx.d.ts.map +1 -0
  79. package/dest/api/tx.js +1 -0
  80. package/dest/api/utils.d.ts +13 -0
  81. package/dest/api/utils.d.ts.map +1 -0
  82. package/dest/api/utils.js +12 -0
  83. package/dest/api/wallet.d.ts +4 -1
  84. package/dest/api/wallet.d.ts.map +1 -1
  85. package/dest/api/wallet.js +4 -1
  86. package/dest/authorization/call_authorization_request.d.ts +67 -0
  87. package/dest/authorization/call_authorization_request.d.ts.map +1 -0
  88. package/dest/authorization/call_authorization_request.js +49 -0
  89. package/dest/contract/base_contract_interaction.d.ts +16 -79
  90. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  91. package/dest/contract/base_contract_interaction.js +15 -128
  92. package/dest/contract/batch_call.d.ts +13 -14
  93. package/dest/contract/batch_call.d.ts.map +1 -1
  94. package/dest/contract/batch_call.js +60 -60
  95. package/dest/contract/checker.d.ts +1 -1
  96. package/dest/contract/checker.d.ts.map +1 -1
  97. package/dest/contract/checker.js +2 -2
  98. package/dest/contract/contract.d.ts +7 -6
  99. package/dest/contract/contract.d.ts.map +1 -1
  100. package/dest/contract/contract.js +7 -16
  101. package/dest/contract/contract_base.d.ts +3 -9
  102. package/dest/contract/contract_base.d.ts.map +1 -1
  103. package/dest/contract/contract_base.js +2 -2
  104. package/dest/contract/contract_function_interaction.d.ts +52 -44
  105. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  106. package/dest/contract/contract_function_interaction.js +75 -74
  107. package/dest/contract/deploy_method.d.ts +102 -57
  108. package/dest/contract/deploy_method.d.ts.map +1 -1
  109. package/dest/contract/deploy_method.js +122 -132
  110. package/dest/contract/deploy_sent_tx.d.ts +3 -5
  111. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  112. package/dest/contract/deploy_sent_tx.js +10 -13
  113. package/dest/contract/get_gas_limits.d.ts +5 -6
  114. package/dest/contract/get_gas_limits.d.ts.map +1 -1
  115. package/dest/contract/get_gas_limits.js +9 -3
  116. package/dest/contract/interaction_options.d.ts +114 -0
  117. package/dest/contract/interaction_options.d.ts.map +1 -0
  118. package/dest/contract/interaction_options.js +52 -0
  119. package/dest/contract/protocol_contracts.d.ts +6 -6
  120. package/dest/contract/protocol_contracts.d.ts.map +1 -1
  121. package/dest/contract/protocol_contracts.js +7 -7
  122. package/dest/contract/sent_tx.d.ts +8 -18
  123. package/dest/contract/sent_tx.d.ts.map +1 -1
  124. package/dest/contract/sent_tx.js +30 -42
  125. package/dest/contract/unsafe_contract.d.ts +1 -1
  126. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  127. package/dest/contract/wait_for_proven.d.ts +17 -0
  128. package/dest/contract/wait_for_proven.d.ts.map +1 -0
  129. package/dest/contract/wait_for_proven.js +17 -0
  130. package/dest/deployment/broadcast_function.d.ts +3 -3
  131. package/dest/deployment/broadcast_function.d.ts.map +1 -1
  132. package/dest/deployment/broadcast_function.js +27 -23
  133. package/dest/deployment/contract_deployer.d.ts +1 -1
  134. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  135. package/dest/deployment/publish_class.d.ts +6 -0
  136. package/dest/deployment/publish_class.d.ts.map +1 -0
  137. package/dest/deployment/publish_class.js +17 -0
  138. package/dest/deployment/publish_instance.d.ts +10 -0
  139. package/dest/deployment/publish_instance.d.ts.map +1 -0
  140. package/dest/deployment/publish_instance.js +11 -0
  141. package/dest/{api/ethereum → ethereum}/portal_manager.d.ts +29 -25
  142. package/dest/ethereum/portal_manager.d.ts.map +1 -0
  143. package/dest/{api/ethereum → ethereum}/portal_manager.js +106 -73
  144. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +16 -11
  145. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  146. package/dest/fee/fee_juice_payment_method_with_claim.js +26 -16
  147. package/dest/fee/fee_payment_method.d.ts +11 -7
  148. package/dest/fee/fee_payment_method.d.ts.map +1 -1
  149. package/dest/fee/private_fee_payment_method.d.ts +25 -8
  150. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  151. package/dest/fee/private_fee_payment_method.js +43 -21
  152. package/dest/fee/public_fee_payment_method.d.ts +26 -9
  153. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  154. package/dest/fee/public_fee_payment_method.js +45 -23
  155. package/dest/fee/sponsored_fee_payment.d.ts +17 -0
  156. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
  157. package/dest/fee/sponsored_fee_payment.js +34 -0
  158. package/dest/utils/abi_types.d.ts +0 -2
  159. package/dest/utils/abi_types.d.ts.map +1 -1
  160. package/dest/utils/authwit.d.ts +81 -24
  161. package/dest/utils/authwit.d.ts.map +1 -1
  162. package/dest/utils/authwit.js +226 -40
  163. package/dest/utils/cross_chain.d.ts +24 -0
  164. package/dest/utils/cross_chain.d.ts.map +1 -0
  165. package/dest/utils/cross_chain.js +30 -0
  166. package/dest/utils/fee_juice.d.ts +3 -2
  167. package/dest/utils/fee_juice.d.ts.map +1 -1
  168. package/dest/utils/fee_juice.js +3 -2
  169. package/dest/utils/field_compressed_string.d.ts.map +1 -1
  170. package/dest/utils/node.d.ts.map +1 -1
  171. package/dest/utils/node.js +1 -1
  172. package/dest/utils/pub_key.d.ts.map +1 -1
  173. package/dest/utils/pub_key.js +1 -2
  174. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +34 -0
  175. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
  176. package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
  177. package/dest/wallet/account_manager.d.ts +69 -0
  178. package/dest/wallet/account_manager.d.ts.map +1 -0
  179. package/dest/wallet/account_manager.js +113 -0
  180. package/dest/wallet/base_wallet.d.ts +81 -63
  181. package/dest/wallet/base_wallet.d.ts.map +1 -1
  182. package/dest/wallet/base_wallet.js +221 -106
  183. package/dest/wallet/deploy_account_method.d.ts +52 -0
  184. package/dest/wallet/deploy_account_method.d.ts.map +1 -0
  185. package/dest/wallet/deploy_account_method.js +77 -0
  186. package/dest/wallet/index.d.ts +3 -16
  187. package/dest/wallet/index.d.ts.map +1 -1
  188. package/dest/wallet/index.js +3 -20
  189. package/dest/wallet/wallet.d.ts +2478 -0
  190. package/dest/wallet/wallet.d.ts.map +1 -0
  191. package/dest/wallet/wallet.js +202 -0
  192. package/package.json +40 -32
  193. package/src/account/account.ts +97 -0
  194. package/src/account/{contract.ts → account_contract.ts} +24 -13
  195. package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +6 -8
  196. package/src/account/index.ts +3 -7
  197. package/src/account/interface.ts +1 -12
  198. package/src/account/signerless_account.ts +46 -0
  199. package/src/api/abi.ts +26 -0
  200. package/src/api/account.ts +5 -9
  201. package/src/api/addresses.ts +1 -0
  202. package/src/api/authorization.ts +14 -0
  203. package/src/api/block.ts +2 -0
  204. package/src/{contract/index.ts → api/contract.ts} +37 -13
  205. package/src/api/crypto.ts +1 -0
  206. package/src/api/deployment.ts +4 -3
  207. package/src/api/ethereum.ts +10 -0
  208. package/src/api/events.ts +44 -0
  209. package/src/api/fee.ts +1 -1
  210. package/src/api/fee_testing.ts +1 -0
  211. package/src/api/keys.ts +8 -0
  212. package/src/api/log.ts +1 -0
  213. package/src/api/messaging.ts +2 -0
  214. package/src/api/node.ts +20 -0
  215. package/src/api/note.ts +1 -0
  216. package/src/api/protocol.ts +2 -0
  217. package/src/api/trees.ts +2 -0
  218. package/src/api/tx.ts +11 -0
  219. package/src/api/utils.ts +14 -0
  220. package/src/api/wallet.ts +33 -5
  221. package/src/authorization/call_authorization_request.ts +63 -0
  222. package/src/contract/base_contract_interaction.ts +24 -166
  223. package/src/contract/batch_call.ts +81 -49
  224. package/src/contract/checker.ts +8 -3
  225. package/src/contract/contract.ts +8 -17
  226. package/src/contract/contract_base.ts +4 -11
  227. package/src/contract/contract_function_interaction.ts +136 -106
  228. package/src/contract/deploy_method.ts +199 -129
  229. package/src/contract/deploy_sent_tx.ts +9 -15
  230. package/src/contract/get_gas_limits.ts +15 -8
  231. package/src/contract/interaction_options.ts +169 -0
  232. package/src/contract/protocol_contracts.ts +10 -10
  233. package/src/contract/sent_tx.ts +40 -51
  234. package/src/contract/unsafe_contract.ts +1 -1
  235. package/src/contract/wait_for_proven.ts +38 -0
  236. package/src/deployment/broadcast_function.ts +57 -57
  237. package/src/deployment/contract_deployer.ts +1 -1
  238. package/src/deployment/publish_class.ts +34 -0
  239. package/src/deployment/publish_instance.ts +26 -0
  240. package/src/{api/ethereum → ethereum}/portal_manager.ts +120 -74
  241. package/src/fee/fee_juice_payment_method_with_claim.ts +46 -33
  242. package/src/fee/fee_payment_method.ts +11 -7
  243. package/src/fee/private_fee_payment_method.ts +77 -57
  244. package/src/fee/public_fee_payment_method.ts +91 -67
  245. package/src/fee/sponsored_fee_payment.ts +44 -0
  246. package/src/utils/authwit.ts +255 -53
  247. package/src/utils/cross_chain.ts +53 -0
  248. package/src/utils/fee_juice.ts +4 -4
  249. package/src/utils/node.ts +1 -1
  250. package/src/utils/pub_key.ts +1 -2
  251. package/src/wallet/account_entrypoint_meta_payment_method.ts +105 -0
  252. package/src/wallet/account_manager.ts +154 -0
  253. package/src/wallet/base_wallet.ts +295 -143
  254. package/src/wallet/deploy_account_method.ts +125 -0
  255. package/src/wallet/index.ts +3 -33
  256. package/src/wallet/wallet.ts +362 -0
  257. package/dest/account/contract.d.ts.map +0 -1
  258. package/dest/account/wallet.d.ts +0 -11
  259. package/dest/account/wallet.d.ts.map +0 -1
  260. package/dest/account/wallet.js +0 -3
  261. package/dest/account_manager/deploy_account_method.d.ts +0 -15
  262. package/dest/account_manager/deploy_account_method.d.ts.map +0 -1
  263. package/dest/account_manager/deploy_account_method.js +0 -43
  264. package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
  265. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
  266. package/dest/account_manager/deploy_account_sent_tx.js +0 -29
  267. package/dest/account_manager/index.d.ts +0 -108
  268. package/dest/account_manager/index.d.ts.map +0 -1
  269. package/dest/account_manager/index.js +0 -159
  270. package/dest/api/cheat_codes.d.ts +0 -26
  271. package/dest/api/cheat_codes.d.ts.map +0 -1
  272. package/dest/api/cheat_codes.js +0 -25
  273. package/dest/api/entrypoint.d.ts +0 -2
  274. package/dest/api/entrypoint.d.ts.map +0 -1
  275. package/dest/api/entrypoint.js +0 -1
  276. package/dest/api/ethereum/anvil_test_watcher.d.ts +0 -32
  277. package/dest/api/ethereum/anvil_test_watcher.d.ts.map +0 -1
  278. package/dest/api/ethereum/anvil_test_watcher.js +0 -133
  279. package/dest/api/ethereum/chain_monitor.d.ts +0 -25
  280. package/dest/api/ethereum/chain_monitor.d.ts.map +0 -1
  281. package/dest/api/ethereum/chain_monitor.js +0 -74
  282. package/dest/api/ethereum/cheat_codes.d.ts +0 -63
  283. package/dest/api/ethereum/cheat_codes.d.ts.map +0 -1
  284. package/dest/api/ethereum/cheat_codes.js +0 -162
  285. package/dest/api/ethereum/index.d.ts +0 -7
  286. package/dest/api/ethereum/index.d.ts.map +0 -1
  287. package/dest/api/ethereum/index.js +0 -6
  288. package/dest/api/ethereum/l1_contracts.d.ts +0 -3
  289. package/dest/api/ethereum/l1_contracts.d.ts.map +0 -1
  290. package/dest/api/ethereum/l1_contracts.js +0 -13
  291. package/dest/api/ethereum/portal_manager.d.ts.map +0 -1
  292. package/dest/api/interfaces/pxe.d.ts +0 -2
  293. package/dest/api/interfaces/pxe.d.ts.map +0 -1
  294. package/dest/api/interfaces/pxe.js +0 -1
  295. package/dest/api/log_id.d.ts +0 -2
  296. package/dest/api/log_id.d.ts.map +0 -1
  297. package/dest/api/log_id.js +0 -1
  298. package/dest/api/tx_hash.d.ts +0 -2
  299. package/dest/api/tx_hash.d.ts.map +0 -1
  300. package/dest/api/tx_hash.js +0 -1
  301. package/dest/contract/deploy_proven_tx.d.ts +0 -21
  302. package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
  303. package/dest/contract/deploy_proven_tx.js +0 -19
  304. package/dest/contract/index.d.ts.map +0 -1
  305. package/dest/contract/proven_tx.d.ts +0 -17
  306. package/dest/contract/proven_tx.d.ts.map +0 -1
  307. package/dest/contract/proven_tx.js +0 -22
  308. package/dest/deployment/deploy_instance.d.ts +0 -10
  309. package/dest/deployment/deploy_instance.d.ts.map +0 -1
  310. package/dest/deployment/deploy_instance.js +0 -14
  311. package/dest/deployment/index.d.ts +0 -2
  312. package/dest/deployment/index.d.ts.map +0 -1
  313. package/dest/deployment/index.js +0 -1
  314. package/dest/deployment/register_class.d.ts +0 -6
  315. package/dest/deployment/register_class.d.ts.map +0 -1
  316. package/dest/deployment/register_class.js +0 -22
  317. package/dest/entrypoint/default_entrypoint.d.ts +0 -12
  318. package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
  319. package/dest/entrypoint/default_entrypoint.js +0 -28
  320. package/dest/entrypoint/default_multi_call_entrypoint.d.ts +0 -15
  321. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +0 -1
  322. package/dest/entrypoint/default_multi_call_entrypoint.js +0 -130
  323. package/dest/entrypoint/entrypoint.d.ts +0 -35
  324. package/dest/entrypoint/entrypoint.d.ts.map +0 -1
  325. package/dest/entrypoint/entrypoint.js +0 -4
  326. package/dest/entrypoint/payload.d.ts +0 -128
  327. package/dest/entrypoint/payload.d.ts.map +0 -1
  328. package/dest/entrypoint/payload.js +0 -143
  329. package/dest/fee/fee_juice_payment_method.d.ts +0 -14
  330. package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
  331. package/dest/fee/fee_juice_payment_method.js +0 -20
  332. package/dest/index.d.ts +0 -66
  333. package/dest/index.d.ts.map +0 -1
  334. package/dest/index.js +0 -69
  335. package/dest/rpc_clients/index.d.ts +0 -3
  336. package/dest/rpc_clients/index.d.ts.map +0 -1
  337. package/dest/rpc_clients/index.js +0 -2
  338. package/dest/rpc_clients/node/index.d.ts +0 -12
  339. package/dest/rpc_clients/node/index.d.ts.map +0 -1
  340. package/dest/rpc_clients/node/index.js +0 -78
  341. package/dest/rpc_clients/pxe_client.d.ts +0 -10
  342. package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
  343. package/dest/rpc_clients/pxe_client.js +0 -23
  344. package/dest/utils/aztec_cheatcodes.d.ts +0 -59
  345. package/dest/utils/aztec_cheatcodes.d.ts.map +0 -1
  346. package/dest/utils/aztec_cheatcodes.js +0 -62
  347. package/dest/utils/index.d.ts +0 -8
  348. package/dest/utils/index.d.ts.map +0 -1
  349. package/dest/utils/index.js +0 -6
  350. package/dest/utils/pxe.d.ts +0 -4
  351. package/dest/utils/pxe.d.ts.map +0 -1
  352. package/dest/utils/pxe.js +0 -14
  353. package/dest/wallet/account_wallet.d.ts +0 -76
  354. package/dest/wallet/account_wallet.d.ts.map +0 -1
  355. package/dest/wallet/account_wallet.js +0 -231
  356. package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
  357. package/dest/wallet/signerless_wallet.d.ts +0 -25
  358. package/dest/wallet/signerless_wallet.d.ts.map +0 -1
  359. package/dest/wallet/signerless_wallet.js +0 -36
  360. package/src/account/wallet.ts +0 -13
  361. package/src/account_manager/deploy_account_method.ts +0 -86
  362. package/src/account_manager/deploy_account_sent_tx.ts +0 -42
  363. package/src/account_manager/index.ts +0 -229
  364. package/src/api/cheat_codes.ts +0 -35
  365. package/src/api/entrypoint.ts +0 -1
  366. package/src/api/ethereum/anvil_test_watcher.ts +0 -158
  367. package/src/api/ethereum/chain_monitor.ts +0 -88
  368. package/src/api/ethereum/cheat_codes.ts +0 -184
  369. package/src/api/ethereum/index.ts +0 -19
  370. package/src/api/ethereum/l1_contracts.ts +0 -21
  371. package/src/api/interfaces/pxe.ts +0 -1
  372. package/src/api/log_id.ts +0 -1
  373. package/src/api/tx_hash.ts +0 -1
  374. package/src/contract/deploy_proven_tx.ts +0 -34
  375. package/src/contract/proven_tx.ts +0 -42
  376. package/src/deployment/deploy_instance.ts +0 -31
  377. package/src/deployment/index.ts +0 -1
  378. package/src/deployment/register_class.ts +0 -44
  379. package/src/entrypoint/default_entrypoint.ts +0 -39
  380. package/src/entrypoint/default_multi_call_entrypoint.ts +0 -93
  381. package/src/entrypoint/entrypoint.ts +0 -39
  382. package/src/entrypoint/payload.ts +0 -238
  383. package/src/fee/fee_juice_payment_method.ts +0 -26
  384. package/src/index.ts +0 -106
  385. package/src/rpc_clients/index.ts +0 -2
  386. package/src/rpc_clients/node/index.ts +0 -77
  387. package/src/rpc_clients/pxe_client.ts +0 -25
  388. package/src/utils/aztec_cheatcodes.ts +0 -77
  389. package/src/utils/index.ts +0 -21
  390. package/src/utils/pxe.ts +0 -17
  391. package/src/wallet/account_wallet.ts +0 -242
  392. package/src/wallet/signerless_wallet.ts +0 -52
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into
3
+ * SendOptions, which are the ones that can be serialized and forwarded to the wallet
4
+ */ export async function toSendOptions(options) {
5
+ return {
6
+ ...options,
7
+ fee: {
8
+ // If this interaction includes a fee payment method, pass the fee payer
9
+ // as a hint to the wallet
10
+ embeddedPaymentMethodFeePayer: await options.fee?.paymentMethod?.getFeePayer(),
11
+ // If a payment method that includes gas settings was used,
12
+ // try to reuse as much as possible while still allowing
13
+ // manual override. CAREFUL: this can cause mismatches during proving
14
+ gasSettings: {
15
+ ...options.fee?.paymentMethod?.getGasSettings(),
16
+ ...options.fee?.gasSettings
17
+ }
18
+ }
19
+ };
20
+ }
21
+ /**
22
+ * Transforms and cleans up the higher level SimulateInteractionOptions defined by the interaction into
23
+ * SimulateOptions, which are the ones that can be serialized and forwarded to the wallet
24
+ */ export async function toSimulateOptions(options) {
25
+ return {
26
+ ...options,
27
+ fee: {
28
+ // If this interaction includes a fee payment method, pass the fee payer
29
+ // as a hint to the wallet
30
+ embeddedPaymentMethodFeePayer: await options.fee?.paymentMethod?.getFeePayer(),
31
+ // If a payment method that includes gas settings was used,
32
+ // try to reuse as much as possible while still allowing
33
+ // manual override. CAREFUL: this can cause mismatches during proving
34
+ gasSettings: {
35
+ ...options.fee?.paymentMethod?.getGasSettings(),
36
+ ...options.fee?.gasSettings
37
+ },
38
+ estimateGas: options.fee?.estimateGas,
39
+ estimatedGasPadding: options.fee?.estimatedGasPadding
40
+ }
41
+ };
42
+ }
43
+ /**
44
+ * Transforms and cleans up the higher level ProfileInteractionOptions defined by the interaction into
45
+ * ProfileOptions, which are the ones that can be serialized and forwarded to the wallet
46
+ */ export async function toProfileOptions(options) {
47
+ return {
48
+ ...await toSimulateOptions(options),
49
+ profileMode: options.profileMode,
50
+ skipProofGeneration: options.skipProofGeneration
51
+ };
52
+ }
@@ -1,9 +1,9 @@
1
- import type { Wallet } from '../wallet/index.js';
1
+ import type { Wallet } from '../wallet/wallet.js';
2
2
  import { UnsafeContract } from './unsafe_contract.js';
3
- /** Returns a Contract wrapper for the class registerer. */
4
- export declare function getRegistererContract(wallet: Wallet): Promise<UnsafeContract>;
5
- /** Returns a Contract wrapper for the instance deployer. */
6
- export declare function getDeployerContract(wallet: Wallet): Promise<UnsafeContract>;
7
- /** Returns a Contract wrapper for the fee juice */
3
+ /** Returns a Contract wrapper for the contract class registry. */
4
+ export declare function getClassRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
5
+ /** Returns a Contract wrapper for the contract instance registry. */
6
+ export declare function getInstanceRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
7
+ /** Returns a Contract wrapper for the fee juice contract */
8
8
  export declare function getFeeJuice(wallet: Wallet): Promise<UnsafeContract>;
9
9
  //# sourceMappingURL=protocol_contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,2DAA2D;AAC3D,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,2BAQzD;AAED,4DAA4D;AAC5D,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,2BAOvD;AAED,mDAAmD;AACnD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,2BAO/C"}
1
+ {"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,kEAAkE;AAClE,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,2BAQ5D;AAED,qEAAqE;AACrE,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,MAAM,2BAO/D;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,2BAO/C"}
@@ -1,22 +1,22 @@
1
1
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
2
  import { UnsafeContract } from './unsafe_contract.js';
3
- /** Returns a Contract wrapper for the class registerer. */ export async function getRegistererContract(wallet) {
4
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegisterer);
3
+ /** Returns a Contract wrapper for the contract class registry. */ export async function getClassRegistryContract(wallet) {
4
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegistry);
5
5
  if (!contractInstance) {
6
- throw new Error("ContractClassRegisterer is not registered in this wallet's instance");
6
+ throw new Error("ContractClassRegistry is not registered in this wallet's instance");
7
7
  }
8
8
  const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
9
9
  return new UnsafeContract(contractInstance, artifact, wallet);
10
10
  }
11
- /** Returns a Contract wrapper for the instance deployer. */ export async function getDeployerContract(wallet) {
12
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceDeployer);
11
+ /** Returns a Contract wrapper for the contract instance registry. */ export async function getInstanceRegistryContract(wallet) {
12
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceRegistry);
13
13
  if (!contractInstance) {
14
- throw new Error("ContractInstanceDeployer is not registered in this wallet's instance");
14
+ throw new Error("ContractInstanceRegistry is not registered in this wallet's instance");
15
15
  }
16
16
  const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
17
17
  return new UnsafeContract(contractInstance, artifact, wallet);
18
18
  }
19
- /** Returns a Contract wrapper for the fee juice */ export async function getFeeJuice(wallet) {
19
+ /** Returns a Contract wrapper for the fee juice contract */ export async function getFeeJuice(wallet) {
20
20
  const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
21
21
  if (!contractInstance) {
22
22
  throw new Error("FeeJuice is not registered in this wallet's instance");
@@ -1,20 +1,15 @@
1
1
  import type { FieldsOf } from '@aztec/foundation/types';
2
- import type { AztecNode, GetPublicLogsResponse, PXE } from '@aztec/stdlib/interfaces/client';
3
- import { type TxHash, type TxReceipt } from '@aztec/stdlib/tx';
2
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import { TxHash, type TxReceipt } from '@aztec/stdlib/tx';
4
+ import type { Wallet } from '../wallet/wallet.js';
4
5
  /** Options related to waiting for a tx. */
5
6
  export type WaitOpts = {
6
7
  /** The amount of time to ignore TxStatus.DROPPED receipts (in seconds) due to the presumption that it is being propagated by the p2p network. Defaults to 5. */
7
8
  ignoreDroppedReceiptsFor?: number;
8
9
  /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
9
10
  timeout?: number;
10
- /** The maximum time (in seconds) to wait for the transaction to be proven. Defaults to 600. */
11
- provenTimeout?: number;
12
11
  /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
13
12
  interval?: number;
14
- /** Whether to wait for the tx to be proven. */
15
- proven?: boolean;
16
- /** Whether to include information useful for debugging/testing in the receipt. */
17
- debug?: boolean;
18
13
  /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
19
14
  dontThrowOnRevert?: boolean;
20
15
  };
@@ -24,9 +19,11 @@ export declare const DefaultWaitOpts: WaitOpts;
24
19
  * its hash, receipt, and mining status.
25
20
  */
26
21
  export declare class SentTx {
27
- protected pxeOrNode: PXE | AztecNode;
28
- protected txHashPromise: Promise<TxHash>;
29
- constructor(pxeOrNode: PXE | AztecNode, txHashPromise: Promise<TxHash>);
22
+ protected walletOrNode: Wallet | AztecNode;
23
+ protected sendTxPromise: Promise<void>;
24
+ protected sendTxError?: Error;
25
+ protected txHash?: TxHash;
26
+ constructor(walletOrNode: Wallet | AztecNode, sendTx: () => Promise<TxHash>);
30
27
  /**
31
28
  * Retrieves the transaction hash of the SentTx instance.
32
29
  * The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
@@ -49,13 +46,6 @@ export declare class SentTx {
49
46
  * @returns The transaction receipt.
50
47
  */
51
48
  wait(opts?: WaitOpts): Promise<FieldsOf<TxReceipt>>;
52
- /**
53
- * Gets public logs emitted by this tx.
54
- * @remarks This function will wait for the tx to be mined if it hasn't been already.
55
- * @returns The requested logs.
56
- */
57
- getPublicLogs(): Promise<GetPublicLogsResponse>;
58
49
  protected waitForReceipt(opts?: WaitOpts): Promise<TxReceipt>;
59
- protected waitForProven(minedBlock: number, opts?: WaitOpts): Promise<number>;
60
50
  }
61
51
  //# sourceMappingURL=sent_tx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/sent_tx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAEzE,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG;IACrB,gKAAgK;IAChK,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+FAA+F;IAC/F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0HAA0H;IAC1H,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAM7B,CAAC;AAEF;;;GAGG;AACH,qBAAa,MAAM;IACL,SAAS,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS;IAAE,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC;gBAApE,SAAS,EAAE,GAAG,GAAG,SAAS,EAAY,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC;IAE1F;;;;;;OAMG;IACI,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC;;;;;;OAMG;IACU,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAK7C;;;;OAIG;IACU,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAuBhE;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,qBAAqB,CAAC;cAK5C,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;cA8BnD,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ;CAWlE"}
1
+ {"version":3,"file":"sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/sent_tx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG;IACrB,gKAAgK;IAChK,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0HAA0H;IAC1H,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAI7B,CAAC;AAEF;;;GAGG;AACH,qBAAa,MAAM;IAMf,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS;IAL5C,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,SAAS,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC9B,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGd,YAAY,EAAE,MAAM,GAAG,SAAS,EAC1C,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;IAgB/B;;;;;;OAMG;IACU,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAazC;;;;;;OAMG;IACU,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAK7C;;;;OAIG;IACU,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;cAUhD,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CA6BpE"}
@@ -1,21 +1,31 @@
1
+ import { promiseWithResolvers } from '@aztec/foundation/promise';
1
2
  import { retryUntil } from '@aztec/foundation/retry';
2
3
  import { TxStatus } from '@aztec/stdlib/tx';
3
4
  export const DefaultWaitOpts = {
4
5
  ignoreDroppedReceiptsFor: 5,
5
6
  timeout: 60,
6
- provenTimeout: 600,
7
- interval: 1,
8
- debug: false
7
+ interval: 1
9
8
  };
10
9
  /**
11
10
  * The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
12
11
  * its hash, receipt, and mining status.
13
12
  */ export class SentTx {
14
- pxeOrNode;
15
- txHashPromise;
16
- constructor(pxeOrNode, txHashPromise){
17
- this.pxeOrNode = pxeOrNode;
18
- this.txHashPromise = txHashPromise;
13
+ walletOrNode;
14
+ sendTxPromise;
15
+ sendTxError;
16
+ txHash;
17
+ constructor(walletOrNode, sendTx){
18
+ this.walletOrNode = walletOrNode;
19
+ const { promise, resolve } = promiseWithResolvers();
20
+ this.sendTxPromise = promise;
21
+ sendTx().then((txHash)=>{
22
+ this.txHash = txHash;
23
+ resolve();
24
+ }).catch((err)=>{
25
+ this.sendTxError = err;
26
+ // Calling resolve instead of reject here because we want to throw the error when getTxHash is called.
27
+ resolve();
28
+ });
19
29
  }
20
30
  /**
21
31
  * Retrieves the transaction hash of the SentTx instance.
@@ -23,8 +33,15 @@ export const DefaultWaitOpts = {
23
33
  *
24
34
  * @returns A promise that resolves to the transaction hash of the SentTx instance.
25
35
  * TODO(#7717): Don't throw here.
26
- */ getTxHash() {
27
- return this.txHashPromise;
36
+ */ async getTxHash() {
37
+ // Make sure sendTx has been resolved, which can be triggered when it returns a txHash or when it throws an error.
38
+ await this.sendTxPromise;
39
+ // If sendTx threw an error, throw it.
40
+ if (this.sendTxError) {
41
+ throw this.sendTxError;
42
+ }
43
+ // sendTx returned a txHash if it's been resolved and no error was set.
44
+ return Promise.resolve(this.txHash);
28
45
  }
29
46
  /**
30
47
  * Retrieve the transaction receipt associated with the current SentTx instance.
@@ -34,7 +51,7 @@ export const DefaultWaitOpts = {
34
51
  * @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
35
52
  */ async getReceipt() {
36
53
  const txHash = await this.getTxHash();
37
- return await this.pxeOrNode.getTxReceipt(txHash);
54
+ return await this.walletOrNode.getTxReceipt(txHash);
38
55
  }
39
56
  /**
40
57
  * Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
@@ -43,39 +60,16 @@ export const DefaultWaitOpts = {
43
60
  */ async wait(opts) {
44
61
  const receipt = await this.waitForReceipt(opts);
45
62
  if (receipt.status !== TxStatus.SUCCESS && !opts?.dontThrowOnRevert) {
46
- throw new Error(`Transaction ${await this.getTxHash()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`);
47
- }
48
- if (opts?.proven && receipt.blockNumber !== undefined) {
49
- await this.waitForProven(receipt.blockNumber, opts);
50
- }
51
- if (opts?.debug) {
52
- const txHash = await this.getTxHash();
53
- const { data: tx } = await this.pxeOrNode.getTxEffect(txHash);
54
- receipt.debugInfo = {
55
- noteHashes: tx.noteHashes,
56
- nullifiers: tx.nullifiers,
57
- publicDataWrites: tx.publicDataWrites,
58
- l2ToL1Msgs: tx.l2ToL1Msgs
59
- };
63
+ throw new Error(`Transaction ${(await this.getTxHash()).toString()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`);
60
64
  }
61
65
  return receipt;
62
66
  }
63
- /**
64
- * Gets public logs emitted by this tx.
65
- * @remarks This function will wait for the tx to be mined if it hasn't been already.
66
- * @returns The requested logs.
67
- */ async getPublicLogs() {
68
- await this.wait();
69
- return this.pxeOrNode.getPublicLogs({
70
- txHash: await this.getTxHash()
71
- });
72
- }
73
67
  async waitForReceipt(opts) {
74
68
  const txHash = await this.getTxHash();
75
69
  const startTime = Date.now();
76
70
  const ignoreDroppedReceiptsFor = opts?.ignoreDroppedReceiptsFor ?? DefaultWaitOpts.ignoreDroppedReceiptsFor;
77
71
  return await retryUntil(async ()=>{
78
- const txReceipt = await this.pxeOrNode.getTxReceipt(txHash);
72
+ const txReceipt = await this.walletOrNode.getTxReceipt(txHash);
79
73
  // If receipt is not yet available, try again
80
74
  if (txReceipt.status === TxStatus.PENDING) {
81
75
  return undefined;
@@ -93,10 +87,4 @@ export const DefaultWaitOpts = {
93
87
  return txReceipt;
94
88
  }, 'isMined', opts?.timeout ?? DefaultWaitOpts.timeout, opts?.interval ?? DefaultWaitOpts.interval);
95
89
  }
96
- async waitForProven(minedBlock, opts) {
97
- return await retryUntil(async ()=>{
98
- const provenBlock = await this.pxeOrNode.getProvenBlockNumber();
99
- return provenBlock >= minedBlock ? provenBlock : undefined;
100
- }, 'isProven', opts?.provenTimeout ?? DefaultWaitOpts.provenTimeout, opts?.interval ?? DefaultWaitOpts.interval);
101
- }
102
90
  }
@@ -1,6 +1,6 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
2
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { Wallet } from '../wallet/index.js';
3
+ import type { Wallet } from '../wallet/wallet.js';
4
4
  import { ContractBase } from './contract_base.js';
5
5
  /** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
6
6
  export declare class UnsafeContract extends ContractBase {
@@ -1 +1 @@
1
- {"version":3,"file":"unsafe_contract.d.ts","sourceRoot":"","sources":["../../src/contract/unsafe_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,iHAAiH;AACjH,qBAAa,cAAe,SAAQ,YAAY;;IAE5C,iDAAiD;IACjD,QAAQ,EAAE,2BAA2B;IACrC,yDAAyD;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,0DAA0D;IAC1D,MAAM,EAAE,MAAM;CAIjB"}
1
+ {"version":3,"file":"unsafe_contract.d.ts","sourceRoot":"","sources":["../../src/contract/unsafe_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,iHAAiH;AACjH,qBAAa,cAAe,SAAQ,YAAY;;IAE5C,iDAAiD;IACjD,QAAQ,EAAE,2BAA2B;IACrC,yDAAyD;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,0DAA0D;IAC1D,MAAM,EAAE,MAAM;CAIjB"}
@@ -0,0 +1,17 @@
1
+ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
2
+ import type { TxReceipt } from '@aztec/stdlib/tx';
3
+ /**
4
+ * Options for waiting for a transaction to be proven.
5
+ */
6
+ export type WaitForProvenOpts = {
7
+ /** Time to wait for the tx to be proven before timing out */
8
+ provenTimeout?: number;
9
+ /** Elapsed time between polls to the node */
10
+ interval?: number;
11
+ };
12
+ export declare const DefaultWaitForProvenOpts: WaitForProvenOpts;
13
+ /**
14
+ * Wait for a transaction to be proven by polling the node
15
+ */
16
+ export declare function waitForProven(node: AztecNode, receipt: TxReceipt, opts?: WaitForProvenOpts): Promise<number>;
17
+ //# sourceMappingURL=wait_for_proven.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait_for_proven.d.ts","sourceRoot":"","sources":["../../src/contract/wait_for_proven.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,iBAGtC,CAAC;AAEF;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,iBAAiB,mBAahG"}
@@ -0,0 +1,17 @@
1
+ import { retryUntil } from '@aztec/foundation/retry';
2
+ import { DefaultWaitOpts } from './sent_tx.js';
3
+ export const DefaultWaitForProvenOpts = {
4
+ provenTimeout: 600,
5
+ interval: DefaultWaitOpts.interval
6
+ };
7
+ /**
8
+ * Wait for a transaction to be proven by polling the node
9
+ */ export async function waitForProven(node, receipt, opts) {
10
+ if (!receipt.blockNumber) {
11
+ throw new Error(`Cannot wait for proven: receipt of tx ${receipt.txHash} does not have a block number`);
12
+ }
13
+ return await retryUntil(async ()=>{
14
+ const provenBlock = await node.getProvenBlockNumber();
15
+ return provenBlock >= receipt.blockNumber ? provenBlock : undefined;
16
+ }, 'isProven', opts?.provenTimeout ?? DefaultWaitForProvenOpts.provenTimeout, opts?.interval ?? DefaultWaitForProvenOpts.interval);
17
+ }
@@ -2,7 +2,7 @@ import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
2
2
  import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
3
3
  import type { Wallet } from '../wallet/index.js';
4
4
  /**
5
- * Sets up a call to broadcast a private function's bytecode via the ClassRegisterer contract.
5
+ * Sets up a call to broadcast a private function's bytecode via the ClassRegistry contract.
6
6
  * Note that this is not required for users to call the function, but is rather a convenience to make
7
7
  * this code publicly available so dapps or wallets do not need to redistribute it.
8
8
  * @param wallet - Wallet to send the transaction.
@@ -12,7 +12,7 @@ import type { Wallet } from '../wallet/index.js';
12
12
  */
13
13
  export declare function broadcastPrivateFunction(wallet: Wallet, artifact: ContractArtifact, selector: FunctionSelector): Promise<ContractFunctionInteraction>;
14
14
  /**
15
- * Sets up a call to broadcast an unconstrained function's bytecode via the ClassRegisterer contract.
15
+ * Sets up a call to broadcast a utility function's bytecode via the ClassRegistry contract.
16
16
  * Note that this is not required for users to call the function, but is rather a convenience to make
17
17
  * this code publicly available so dapps or wallets do not need to redistribute it.
18
18
  * @param wallet - Wallet to send the transaction.
@@ -20,5 +20,5 @@ export declare function broadcastPrivateFunction(wallet: Wallet, artifact: Contr
20
20
  * @param selector - Selector of the function to be broadcast.
21
21
  * @returns A ContractFunctionInteraction object that can be used to send the transaction.
22
22
  */
23
- export declare function broadcastUnconstrainedFunction(wallet: Wallet, artifact: ContractArtifact, selector: FunctionSelector): Promise<ContractFunctionInteraction>;
23
+ export declare function broadcastUtilityFunction(wallet: Wallet, artifact: ContractArtifact, selector: FunctionSelector): Promise<ContractFunctionInteraction>;
24
24
  //# sourceMappingURL=broadcast_function.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"broadcast_function.d.ts","sourceRoot":"","sources":["../../src/deployment/broadcast_function.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgC,MAAM,mBAAmB,CAAC;AAS1G,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CAoDtC;AAED;;;;;;;;GAQG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CA8CtC"}
1
+ {"version":3,"file":"broadcast_function.d.ts","sourceRoot":"","sources":["../../src/deployment/broadcast_function.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgC,MAAM,mBAAmB,CAAC;AAS1G,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CAoDtC;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CA8CtC"}
@@ -1,13 +1,13 @@
1
- import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS, REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT } from '@aztec/constants';
1
+ import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS } from '@aztec/constants';
2
2
  import { padArrayEnd } from '@aztec/foundation/collection';
3
3
  import { Fr } from '@aztec/foundation/fields';
4
4
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
5
5
  import { FunctionSelector, FunctionType, bufferAsFields } from '@aztec/stdlib/abi';
6
- import { computeVerificationKeyHash, createPrivateFunctionMembershipProof, createUnconstrainedFunctionMembershipProof, getContractClassFromArtifact } from '@aztec/stdlib/contract';
6
+ import { computeVerificationKeyHash, createPrivateFunctionMembershipProof, createUtilityFunctionMembershipProof, getContractClassFromArtifact } from '@aztec/stdlib/contract';
7
7
  import { Capsule } from '@aztec/stdlib/tx';
8
- import { getRegistererContract } from '../contract/protocol_contracts.js';
8
+ import { getClassRegistryContract } from '../contract/protocol_contracts.js';
9
9
  /**
10
- * Sets up a call to broadcast a private function's bytecode via the ClassRegisterer contract.
10
+ * Sets up a call to broadcast a private function's bytecode via the ClassRegistry contract.
11
11
  * Note that this is not required for users to call the function, but is rather a convenience to make
12
12
  * this code publicly available so dapps or wallets do not need to redistribute it.
13
13
  * @param wallet - Wallet to send the transaction.
@@ -25,46 +25,50 @@ import { getRegistererContract } from '../contract/protocol_contracts.js';
25
25
  if (!privateFunctionArtifact) {
26
26
  throw new Error(`Private function with selector ${selector.toString()} not found`);
27
27
  }
28
- const { artifactTreeSiblingPath, artifactTreeLeafIndex, artifactMetadataHash, functionMetadataHash, unconstrainedFunctionsArtifactTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex } = await createPrivateFunctionMembershipProof(selector, artifact);
28
+ const { artifactTreeSiblingPath, artifactTreeLeafIndex, artifactMetadataHash, functionMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex } = await createPrivateFunctionMembershipProof(selector, artifact);
29
29
  const vkHash = await computeVerificationKeyHash(privateFunctionArtifact);
30
- const registerer = await getRegistererContract(wallet);
31
- const fn = registerer.methods.broadcast_private_function(contractClass.id, artifactMetadataHash, unconstrainedFunctionsArtifactTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT), artifactTreeLeafIndex, // eslint-disable-next-line camelcase
30
+ const classRegistry = await getClassRegistryContract(wallet);
31
+ const bytecode = bufferAsFields(privateFunctionArtifact.bytecode, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS);
32
+ return classRegistry.methods.broadcast_private_function(contractClass.id, artifactMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT), artifactTreeLeafIndex, // eslint-disable-next-line camelcase
32
33
  {
33
34
  selector,
34
35
  metadata_hash: functionMetadataHash,
35
36
  vk_hash: vkHash
37
+ }).with({
38
+ capsules: [
39
+ new Capsule(ProtocolContractAddress.ContractClassRegistry, new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT), bytecode)
40
+ ]
36
41
  });
37
- const bytecode = bufferAsFields(privateFunctionArtifact.bytecode, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS);
38
- fn.addCapsule(new Capsule(ProtocolContractAddress.ContractClassRegisterer, new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT), bytecode));
39
- return fn;
40
42
  }
41
43
  /**
42
- * Sets up a call to broadcast an unconstrained function's bytecode via the ClassRegisterer contract.
44
+ * Sets up a call to broadcast a utility function's bytecode via the ClassRegistry contract.
43
45
  * Note that this is not required for users to call the function, but is rather a convenience to make
44
46
  * this code publicly available so dapps or wallets do not need to redistribute it.
45
47
  * @param wallet - Wallet to send the transaction.
46
48
  * @param artifact - Contract artifact that contains the function to be broadcast.
47
49
  * @param selector - Selector of the function to be broadcast.
48
50
  * @returns A ContractFunctionInteraction object that can be used to send the transaction.
49
- */ export async function broadcastUnconstrainedFunction(wallet, artifact, selector) {
51
+ */ export async function broadcastUtilityFunction(wallet, artifact, selector) {
50
52
  const contractClass = await getContractClassFromArtifact(artifact);
51
- const unconstrainedFunctions = artifact.functions.filter((fn)=>fn.functionType === FunctionType.UNCONSTRAINED);
52
- const unconstrainedFunctionsAndSelectors = await Promise.all(unconstrainedFunctions.map(async (fn)=>({
53
+ const utilityFunctions = artifact.functions.filter((fn)=>fn.functionType === FunctionType.UTILITY);
54
+ const utilityFunctionsAndSelectors = await Promise.all(utilityFunctions.map(async (fn)=>({
53
55
  f: fn,
54
56
  selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters)
55
57
  })));
56
- const unconstrainedFunctionArtifact = unconstrainedFunctionsAndSelectors.find((fn)=>selector.equals(fn.selector))?.f;
57
- if (!unconstrainedFunctionArtifact) {
58
- throw new Error(`Unconstrained function with selector ${selector.toString()} not found`);
58
+ const utilityFunctionArtifact = utilityFunctionsAndSelectors.find((fn)=>selector.equals(fn.selector))?.f;
59
+ if (!utilityFunctionArtifact) {
60
+ throw new Error(`Utility function with selector ${selector.toString()} not found`);
59
61
  }
60
- const { artifactMetadataHash, artifactTreeLeafIndex, artifactTreeSiblingPath, functionMetadataHash, privateFunctionsArtifactTreeRoot } = await createUnconstrainedFunctionMembershipProof(selector, artifact);
61
- const registerer = await getRegistererContract(wallet);
62
- const fn = registerer.methods.broadcast_unconstrained_function(contractClass.id, artifactMetadataHash, privateFunctionsArtifactTreeRoot, padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT), artifactTreeLeafIndex, // eslint-disable-next-line camelcase
62
+ const { artifactMetadataHash, artifactTreeLeafIndex, artifactTreeSiblingPath, functionMetadataHash, privateFunctionsArtifactTreeRoot } = await createUtilityFunctionMembershipProof(selector, artifact);
63
+ const classRegistry = await getClassRegistryContract(wallet);
64
+ const bytecode = bufferAsFields(utilityFunctionArtifact.bytecode, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS);
65
+ return classRegistry.methods.broadcast_utility_function(contractClass.id, artifactMetadataHash, privateFunctionsArtifactTreeRoot, padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT), artifactTreeLeafIndex, // eslint-disable-next-line camelcase
63
66
  {
64
67
  selector,
65
68
  metadata_hash: functionMetadataHash
69
+ }).with({
70
+ capsules: [
71
+ new Capsule(ProtocolContractAddress.ContractClassRegistry, new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT), bytecode)
72
+ ]
66
73
  });
67
- const bytecode = bufferAsFields(unconstrainedFunctionArtifact.bytecode, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS);
68
- fn.addCapsule(new Capsule(ProtocolContractAddress.ContractClassRegisterer, new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT), bytecode));
69
- return fn;
70
74
  }
@@ -1,8 +1,8 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
2
  import { PublicKeys } from '@aztec/stdlib/keys';
3
- import type { Wallet } from '../account/wallet.js';
4
3
  import { Contract } from '../contract/contract.js';
5
4
  import { DeployMethod } from '../contract/deploy_method.js';
5
+ import type { Wallet } from '../wallet/wallet.js';
6
6
  /**
7
7
  * A class for deploying contract.
8
8
  * @remarks Keeping this around even though we have Aztec.nr contract types because it can be useful for non-TS users.
@@ -1 +1 @@
1
- {"version":3,"file":"contract_deployer.d.ts","sourceRoot":"","sources":["../../src/deployment/contract_deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;;GAGG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,eAAe,CAAC;gBAHhB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,wBAAY,EACvB,eAAe,CAAC,oBAAQ;IAGlC;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAW7B"}
1
+ {"version":3,"file":"contract_deployer.d.ts","sourceRoot":"","sources":["../../src/deployment/contract_deployer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,eAAe,CAAC;gBAHhB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,YAAA,EACvB,eAAe,CAAC,EAAE,MAAM,YAAA;IAGlC;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;CAW7B"}
@@ -0,0 +1,6 @@
1
+ import { type ContractArtifact } from '@aztec/stdlib/abi';
2
+ import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
3
+ import type { Wallet } from '../wallet/index.js';
4
+ /** Sets up a call to publish a contract class given its artifact. */
5
+ export declare function publishContractClass(wallet: Wallet, artifact: ContractArtifact): Promise<ContractFunctionInteraction>;
6
+ //# sourceMappingURL=publish_class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish_class.d.ts","sourceRoot":"","sources":["../../src/deployment/publish_class.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,mBAAmB,CAAC;AAI1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,qEAAqE;AACrE,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CAetC"}
@@ -0,0 +1,17 @@
1
+ import { CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
+ import { bufferAsFields } from '@aztec/stdlib/abi';
5
+ import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
6
+ import { Capsule } from '@aztec/stdlib/tx';
7
+ import { getClassRegistryContract } from '../contract/protocol_contracts.js';
8
+ /** Sets up a call to publish a contract class given its artifact. */ export async function publishContractClass(wallet, artifact) {
9
+ const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment, packedBytecode } = await getContractClassFromArtifact(artifact);
10
+ const classRegistry = await getClassRegistryContract(wallet);
11
+ const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
12
+ return classRegistry.methods.publish(artifactHash, privateFunctionsRoot, publicBytecodeCommitment).with({
13
+ capsules: [
14
+ new Capsule(ProtocolContractAddress.ContractClassRegistry, new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT), encodedBytecode)
15
+ ]
16
+ });
17
+ }
@@ -0,0 +1,10 @@
1
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
2
+ import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
3
+ import type { Wallet } from '../wallet/wallet.js';
4
+ /**
5
+ * Sets up a call to the canonical contract instance registry to publish a contract instance.
6
+ * @param wallet - The wallet to use for the publication (setup) tx.
7
+ * @param instance - The instance to publish.
8
+ */
9
+ export declare function publishInstance(wallet: Wallet, instance: ContractInstanceWithAddress): Promise<ContractFunctionInteraction>;
10
+ //# sourceMappingURL=publish_instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish_instance.d.ts","sourceRoot":"","sources":["../../src/deployment/publish_instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,2BAA2B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CAWtC"}
@@ -0,0 +1,11 @@
1
+ import { getInstanceRegistryContract } from '../contract/protocol_contracts.js';
2
+ /**
3
+ * Sets up a call to the canonical contract instance registry to publish a contract instance.
4
+ * @param wallet - The wallet to use for the publication (setup) tx.
5
+ * @param instance - The instance to publish.
6
+ */ export async function publishInstance(wallet, instance) {
7
+ const contractInstanceRegistry = await getInstanceRegistryContract(wallet);
8
+ const { salt, currentContractClassId: contractClassId, publicKeys, deployer: instanceDeployer } = instance;
9
+ const isUniversalDeploy = instanceDeployer.isZero();
10
+ return contractInstanceRegistry.methods.publish_for_public_execution(salt, contractClassId, instance.initializationHash, publicKeys, isUniversalDeploy);
11
+ }