@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
@@ -1,17 +1,27 @@
1
+ import { mergeExecutionPayloads } from '@aztec/entrypoints/payload';
2
+ import { Fr } from '@aztec/foundation/fields';
1
3
  import { getInitializer } from '@aztec/stdlib/abi';
2
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import { computePartialAddress, getContractClassFromArtifact, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
4
- import { deployInstance } from '../deployment/deploy_instance.js';
5
- import { registerContractClass } from '../deployment/register_class.js';
5
+ import { computePartialAddress, getContractClassFromArtifact, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
6
+ import { collectOffchainEffects } from '@aztec/stdlib/tx';
7
+ import { publishContractClass } from '../deployment/publish_class.js';
8
+ import { publishInstance } from '../deployment/publish_instance.js';
6
9
  import { BaseContractInteraction } from './base_contract_interaction.js';
7
10
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
8
- import { DeployProvenTx } from './deploy_proven_tx.js';
9
11
  import { DeploySentTx } from './deploy_sent_tx.js';
10
- // docs:end:deploy_options
11
- // TODO(@spalladino): Add unit tests for this class!
12
+ import { getGasLimits } from './get_gas_limits.js';
13
+ import { toProfileOptions, toSendOptions, toSimulateOptions } from './interaction_options.js';
12
14
  /**
13
- * Contract interaction for deployment. Handles class registration, public instance deployment,
14
- * and initialization of the contract. Extends the BaseContractInteraction class.
15
+ * Contract interaction for deployment.
16
+ * Handles class publication, instance publication, and initialization of the contract.
17
+ *
18
+ * Note that for some contracts, a tx is not required as part of its "creation":
19
+ * If there are no public functions, and if there are no initialization functions,
20
+ * then technically the contract has already been "created", and all of the contract's
21
+ * functions (private and utility) can be interacted-with immediately, without any
22
+ * "deployment tx".
23
+ *
24
+ * Extends the BaseContractInteraction class.
15
25
  */ export class DeployMethod extends BaseContractInteraction {
16
26
  publicKeys;
17
27
  artifact;
@@ -19,99 +29,55 @@ import { DeploySentTx } from './deploy_sent_tx.js';
19
29
  args;
20
30
  /** The contract instance to be deployed. */ instance;
21
31
  /** Constructor function to call. */ constructorArtifact;
22
- constructor(publicKeys, wallet, artifact, postDeployCtor, args = [], constructorNameOrArtifact){
23
- super(wallet), this.publicKeys = publicKeys, this.artifact = artifact, this.postDeployCtor = postDeployCtor, this.args = args, this.instance = undefined;
32
+ constructor(publicKeys, wallet, artifact, postDeployCtor, args = [], constructorNameOrArtifact, authWitnesses = [], capsules = []){
33
+ super(wallet, authWitnesses, capsules), this.publicKeys = publicKeys, this.artifact = artifact, this.postDeployCtor = postDeployCtor, this.args = args, this.instance = undefined;
24
34
  this.constructorArtifact = getInitializer(artifact, constructorNameOrArtifact);
25
35
  }
26
36
  /**
27
- * Create a contract deployment transaction, given the deployment options.
28
- * This function internally calls `request()` and `sign()` methods to prepare
29
- * the transaction for deployment. The resulting signed transaction can be
30
- * later sent using the `send()` method.
31
- *
32
- * @param options - An object containing optional deployment settings, contractAddressSalt, and from.
33
- * @returns A Promise resolving to an object containing the signed transaction data and other relevant information.
34
- */ async create(options = {}) {
35
- return this.wallet.createTxExecutionRequest(await this.request(options));
36
- }
37
- // REFACTOR: Having a `request` method with different semantics than the ones in the other
38
- // derived ContractInteractions is confusing. We should unify the flow of all ContractInteractions.
39
- /**
40
- * Returns an array of function calls that represent this operation. Useful as a building
41
- * block for constructing batch requests.
42
- * @param options - Deployment options.
43
- * @returns An array of function calls.
44
- * @remarks This method does not have the same return type as the `request` in the ContractInteraction object,
45
- * it returns a promise for an array instead of a function call directly.
46
- */ async request(options = {}) {
47
- const deployment = await this.getDeploymentFunctionCalls(options);
48
- // NOTE: MEGA HACK. Remove with #10007
49
- // register the contract after generating deployment function calls in order to publicly register the class and (optioanlly) emit its bytecode
50
- //
51
- // TODO: Should we add the contracts to the DB here, or once the tx has been sent or mined?
52
- // Note that we need to run this registerContract here so it's available when computeFeeOptionsFromEstimatedGas
53
- // runs, since it needs the contract to have been registered in order to estimate gas for its initialization,
54
- // in case the initializer is public. This hints at the need of having "transient" contracts scoped to a
55
- // simulation, so we can run the simulation with a set of contracts, but only "commit" them to the wallet
56
- // once this tx has gone through.
57
- await this.wallet.registerContract({
58
- artifact: this.artifact,
59
- instance: await this.getInstance(options)
60
- });
61
- const bootstrap = await this.getInitializeFunctionCalls(options);
62
- if (deployment.calls.length + bootstrap.calls.length === 0) {
63
- throw new Error(`No function calls needed to deploy contract ${this.artifact.name}`);
37
+ * Returns the execution payload that allows this operation to happen on chain.
38
+ * @param options - Configuration options.
39
+ * @returns The execution payload for this operation
40
+ */ async request(options) {
41
+ const publication = await this.getPublicationExecutionPayload(options);
42
+ await this.wallet.registerContract(await this.getInstance(options), this.artifact);
43
+ const initialization = await this.getInitializationExecutionPayload(options);
44
+ const feeExecutionPayload = options?.fee?.paymentMethod ? await options.fee.paymentMethod.getExecutionPayload() : undefined;
45
+ const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
46
+ feeExecutionPayload,
47
+ publication,
48
+ initialization
49
+ ]) : mergeExecutionPayloads([
50
+ publication,
51
+ initialization
52
+ ]);
53
+ if (!finalExecutionPayload.calls.length) {
54
+ throw new Error(`No transactions are needed to publish or initialize contract ${this.artifact.name}`);
64
55
  }
65
- const calls = [
66
- ...deployment.calls,
67
- ...bootstrap.calls
68
- ];
69
- const authWitnesses = [
70
- ...deployment.authWitnesses ?? [],
71
- ...bootstrap.authWitnesses ?? []
72
- ];
73
- const hashedArguments = [
74
- ...deployment.hashedArguments ?? [],
75
- ...bootstrap.hashedArguments ?? []
76
- ];
77
- const capsules = [
78
- ...deployment.capsules ?? [],
79
- ...bootstrap.capsules ?? []
80
- ];
81
- const { cancellable, nonce, fee: userFee } = options;
82
- const request = {
83
- calls,
84
- authWitnesses,
85
- hashedArguments,
86
- capsules,
87
- cancellable,
88
- fee: userFee,
89
- nonce
90
- };
91
- const fee = await this.getFeeOptions(request);
56
+ return finalExecutionPayload;
57
+ }
58
+ convertDeployOptionsToRequestOptions(options) {
92
59
  return {
93
- ...request,
94
- fee
60
+ ...options,
61
+ deployer: !options?.universalDeploy ? options.from : undefined
95
62
  };
96
63
  }
97
64
  /**
98
- * Register this contract in the PXE and returns the Contract object.
65
+ * Adds this contract to the wallet and returns the Contract object.
99
66
  * @param options - Deployment options.
100
- */ async register(options = {}) {
67
+ */ async register(options) {
101
68
  const instance = await this.getInstance(options);
102
- await this.wallet.registerContract({
103
- artifact: this.artifact,
104
- instance
105
- });
69
+ await this.wallet.registerContract(instance, this.artifact);
106
70
  return this.postDeployCtor(instance.address, this.wallet);
107
71
  }
108
72
  /**
109
- * Returns calls for registration of the class and deployment of the instance, depending on the provided options.
110
- * @param options - Deployment options.
111
- * @returns A function call array with potentially requests to the class registerer and instance deployer.
112
- */ async getDeploymentFunctionCalls(options = {}) {
73
+ * Returns an execution payload for:
74
+ * - publication of the contract class and
75
+ * - publication of the contract instance to enable public execution
76
+ * depending on the provided options.
77
+ * @param options - Contract creation options.
78
+ * @returns An execution payload with potentially calls (and bytecode capsule) to the class registry and instance registry.
79
+ */ async getPublicationExecutionPayload(options) {
113
80
  const calls = [];
114
- const capsules = [];
115
81
  // Set contract instance object so it's available for populating the DeploySendTx object
116
82
  const instance = await this.getInstance(options);
117
83
  // Obtain contract class from artifact and check it matches the reported one by the instance.
@@ -120,88 +86,105 @@ import { DeploySentTx } from './deploy_sent_tx.js';
120
86
  if (!instance.currentContractClassId.equals(contractClass.id)) {
121
87
  throw new Error(`Contract class mismatch when deploying contract: got ${instance.currentContractClassId.toString()} from instance and ${contractClass.id.toString()} from artifact`);
122
88
  }
123
- // Register the contract class if it hasn't been published already.
124
- if (!options.skipClassRegistration) {
89
+ // Publish the contract class if it hasn't been published already.
90
+ if (!options?.skipClassPublication) {
125
91
  if ((await this.wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
126
- this.log.debug(`Skipping registration of already registered contract class ${contractClass.id.toString()} for ${instance.address.toString()}`);
92
+ this.log.debug(`Skipping publication of already-registered contract class ${contractClass.id.toString()} for ${instance.address.toString()}`);
127
93
  } else {
128
- this.log.info(`Creating request for registering contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`);
129
- const registerContractClassInteraction = await registerContractClass(this.wallet, this.artifact);
94
+ this.log.info(`Creating request for publishing contract class ${contractClass.id.toString()} as part of deployment for ${instance.address.toString()}`);
95
+ const registerContractClassInteraction = await publishContractClass(this.wallet, this.artifact);
130
96
  calls.push(await registerContractClassInteraction.request());
131
- capsules.push(...registerContractClassInteraction.getCapsules());
132
97
  }
133
98
  }
134
- // Deploy the contract via the instance deployer.
135
- if (!options.skipPublicDeployment) {
136
- const deploymentInteraction = await deployInstance(this.wallet, instance);
99
+ // Publish the contract instance:
100
+ if (!options?.skipInstancePublication) {
101
+ // TODO(https://github.com/AztecProtocol/aztec-packages/issues/15596):
102
+ // Read the artifact, and if there are no public functions, warn the caller that publication of the
103
+ // contract instance is not necessary (until such time as they wish to update the instance (i.e. change its class_id)).
104
+ const deploymentInteraction = await publishInstance(this.wallet, instance);
137
105
  calls.push(await deploymentInteraction.request());
138
- capsules.push(...deploymentInteraction.getCapsules());
139
106
  }
140
- return {
141
- calls,
142
- capsules
143
- };
107
+ return mergeExecutionPayloads(calls);
144
108
  }
145
109
  /**
146
110
  * Returns the calls necessary to initialize the contract.
147
111
  * @param options - Deployment options.
148
112
  * @returns - An array of function calls.
149
- */ async getInitializeFunctionCalls(options) {
150
- const { address } = await this.getInstance(options);
151
- const calls = [];
152
- const capsules = [];
153
- if (this.constructorArtifact && !options.skipInitialization) {
113
+ */ async getInitializationExecutionPayload(options) {
114
+ const executionsPayloads = [];
115
+ if (this.constructorArtifact && !options?.skipInitialization) {
116
+ const { address } = await this.getInstance(options);
154
117
  const constructorCall = new ContractFunctionInteraction(this.wallet, address, this.constructorArtifact, this.args);
155
- calls.push(await constructorCall.request());
156
- capsules.push(...constructorCall.getCapsules());
118
+ executionsPayloads.push(await constructorCall.request());
157
119
  }
158
- return {
159
- calls,
160
- capsules
161
- };
120
+ return mergeExecutionPayloads(executionsPayloads);
162
121
  }
163
122
  /**
164
- * Send the contract deployment transaction using the provided options.
123
+ * Send a contract deployment transaction (initialize and/or publish) using the provided options.
165
124
  * This function extends the 'send' method from the ContractFunctionInteraction class,
166
125
  * allowing us to send a transaction specifically for contract deployment.
167
126
  *
168
127
  * @param options - An object containing various deployment options such as contractAddressSalt and from.
169
128
  * @returns A SentTx object that returns the receipt and the deployed contract instance.
170
- */ send(options = {}) {
171
- const txHashPromise = super.send(options).getTxHash();
129
+ */ send(options) {
130
+ const sendTx = async ()=>{
131
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
132
+ const sendOptions = await toSendOptions(options);
133
+ return this.wallet.sendTx(executionPayload, sendOptions);
134
+ };
172
135
  this.log.debug(`Sent deployment tx of ${this.artifact.name} contract`);
173
- return new DeploySentTx(this.wallet, txHashPromise, this.postDeployCtor, ()=>this.getInstance(options));
136
+ return new DeploySentTx(this.wallet, sendTx, this.postDeployCtor, ()=>this.getInstance(options));
174
137
  }
175
138
  /**
176
- * Builds the contract instance to be deployed and returns it.
139
+ * Builds the contract instance and returns it.
177
140
  *
178
- * @param options - An object containing various deployment options.
141
+ * @param options - An object containing various initialization and publication options.
179
142
  * @returns An instance object.
180
- */ async getInstance(options = {}) {
143
+ */ async getInstance(options) {
181
144
  if (!this.instance) {
182
- this.instance = await getContractInstanceFromDeployParams(this.artifact, {
145
+ this.instance = await getContractInstanceFromInstantiationParams(this.artifact, {
183
146
  constructorArgs: this.args,
184
- salt: options.contractAddressSalt,
147
+ salt: options?.contractAddressSalt ?? Fr.random(),
185
148
  publicKeys: this.publicKeys,
186
149
  constructorArtifact: this.constructorArtifact,
187
- deployer: options.universalDeploy ? AztecAddress.ZERO : this.wallet.getAddress()
150
+ deployer: options?.deployer ? options.deployer : AztecAddress.ZERO
188
151
  });
189
152
  }
190
153
  return this.instance;
191
154
  }
192
155
  /**
193
- * Prove the request.
194
- * @param options - Deployment options.
195
- * @returns The proven tx.
196
- */ async prove(options) {
197
- const txProvingResult = await this.proveInternal(options);
198
- return new DeployProvenTx(this.wallet, txProvingResult.toTx(), this.postDeployCtor, ()=>this.getInstance(options));
156
+ * Simulate the deployment
157
+ *
158
+ * @param options - An optional object containing additional configuration for the simulation.
159
+ * @returns A simulation result object containing metadata of the execution, including gas
160
+ * estimations (if requested via options), execution statistics and emitted offchain effects
161
+ */ async simulate(options) {
162
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
163
+ const simulatedTx = await this.wallet.simulateTx(executionPayload, await toSimulateOptions(options));
164
+ const { gasLimits, teardownGasLimits } = getGasLimits(simulatedTx, options.fee?.estimatedGasPadding);
165
+ this.log.verbose(`Estimated gas limits for tx: DA=${gasLimits.daGas} L2=${gasLimits.l2Gas} teardownDA=${teardownGasLimits.daGas} teardownL2=${teardownGasLimits.l2Gas}`);
166
+ return {
167
+ stats: simulatedTx.stats,
168
+ offchainEffects: collectOffchainEffects(simulatedTx.privateExecutionResult),
169
+ result: undefined,
170
+ estimatedGas: {
171
+ gasLimits,
172
+ teardownGasLimits
173
+ }
174
+ };
199
175
  }
200
176
  /**
201
- * Estimates gas cost for this deployment operation.
202
- * @param options - Options.
203
- */ estimateGas(options) {
204
- return super.estimateGas(options);
177
+ * Simulate a deployment and profile the gate count for each function in the transaction.
178
+ * @param options - Same options as `send`, plus extra profiling options.
179
+ *
180
+ * @returns An object containing the function return value and profile result.
181
+ */ async profile(options) {
182
+ const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
183
+ return await this.wallet.profileTx(executionPayload, {
184
+ ...await toProfileOptions(options),
185
+ profileMode: options.profileMode,
186
+ skipProofGeneration: options.skipProofGeneration
187
+ });
205
188
  }
206
189
  /** Return this deployment address. */ get address() {
207
190
  return this.instance?.address;
@@ -209,4 +192,11 @@ import { DeploySentTx } from './deploy_sent_tx.js';
209
192
  /** Returns the partial address for this deployment. */ get partialAddress() {
210
193
  return this.instance && computePartialAddress(this.instance);
211
194
  }
195
+ /**
196
+ * Augments this DeployMethod with additional metadata, such as authWitnesses and capsules.
197
+ * @param options - An object containing the metadata to add to the interaction
198
+ * @returns A new DeployMethod with the added metadata, but calling the same original function in the same manner
199
+ */ with({ authWitnesses = [], capsules = [] }) {
200
+ return new DeployMethod(this.publicKeys, this.wallet, this.artifact, this.postDeployCtor, this.args, this.constructorArtifact?.name, this.authWitnesses.concat(authWitnesses), this.capsules.concat(capsules));
201
+ }
212
202
  }
@@ -1,9 +1,8 @@
1
1
  import type { FieldsOf } from '@aztec/foundation/types';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
4
- import type { PXE } from '@aztec/stdlib/interfaces/client';
5
4
  import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
6
- import type { Wallet } from '../account/index.js';
5
+ import type { Wallet } from '../wallet/wallet.js';
7
6
  import type { Contract } from './contract.js';
8
7
  import type { ContractBase } from './contract_base.js';
9
8
  import { SentTx, type WaitOpts } from './sent_tx.js';
@@ -18,14 +17,14 @@ export type DeployTxReceipt<TContract extends ContractBase = Contract> = FieldsO
18
17
  contract: TContract;
19
18
  };
20
19
  /**
21
- * A contract deployment transaction sent to the network, extending SentTx with methods to create a contract instance.
20
+ * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
22
21
  */
23
22
  export declare class DeploySentTx<TContract extends Contract = Contract> extends SentTx {
24
23
  private postDeployCtor;
25
24
  /** A getter for the deployed contract instance */
26
25
  instanceGetter: () => Promise<ContractInstanceWithAddress>;
27
26
  private log;
28
- constructor(pxeOrWallet: PXE | Wallet, txHashPromise: Promise<TxHash>, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
27
+ constructor(wallet: Wallet, sendTx: () => Promise<TxHash>, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
29
28
  /** A getter for the deployed contract instance */
30
29
  instanceGetter: () => Promise<ContractInstanceWithAddress>);
31
30
  /**
@@ -40,6 +39,5 @@ export declare class DeploySentTx<TContract extends Contract = Contract> extends
40
39
  * @returns The transaction receipt with the deployed contract instance.
41
40
  */
42
41
  wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>>;
43
- protected getContractObject(wallet?: Wallet): Promise<TContract>;
44
42
  }
45
43
  //# sourceMappingURL=deploy_sent_tx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAa,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErD,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,+GAA+G;IAC/G,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,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 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
  import { SentTx } from './sent_tx.js';
3
3
  /**
4
- * A contract deployment transaction sent to the network, extending SentTx with methods to create a contract instance.
4
+ * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
5
5
  */ export class DeploySentTx extends SentTx {
6
6
  postDeployCtor;
7
7
  instanceGetter;
8
8
  log;
9
- constructor(pxeOrWallet, txHashPromise, postDeployCtor, /** A getter for the deployed contract instance */ instanceGetter){
10
- super(pxeOrWallet, txHashPromise), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
9
+ constructor(wallet, sendTx, postDeployCtor, /** A getter for the deployed contract instance */ instanceGetter){
10
+ super(wallet, sendTx), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
11
11
  }
12
12
  /**
13
13
  * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
@@ -25,19 +25,16 @@ import { SentTx } from './sent_tx.js';
25
25
  * @returns The transaction receipt with the deployed contract instance.
26
26
  */ async wait(opts) {
27
27
  const receipt = await super.wait(opts);
28
- const contract = await this.getContractObject(opts?.wallet);
29
- return {
30
- ...receipt,
31
- contract
32
- };
33
- }
34
- async getContractObject(wallet) {
35
- const isWallet = (pxeOrWallet)=>!!pxeOrWallet.createTxExecutionRequest;
36
- const contractWallet = wallet ?? (isWallet(this.pxeOrNode) && this.pxeOrNode);
28
+ // In the case of DeploySentTx we have a guarantee that this.walletOrNode is a Wallet so we can cast it to Wallet.
29
+ const contractWallet = opts?.wallet ?? this.walletOrNode;
37
30
  if (!contractWallet) {
38
31
  throw new Error(`A wallet is required for creating a contract instance`);
39
32
  }
40
33
  const instance = await this.instanceGetter();
41
- return this.postDeployCtor(instance.address, contractWallet);
34
+ const contract = await this.postDeployCtor(instance.address, contractWallet);
35
+ return {
36
+ ...receipt,
37
+ contract
38
+ };
42
39
  }
43
40
  }
@@ -1,18 +1,17 @@
1
- import type { Gas } from '@aztec/stdlib/gas';
1
+ import { Gas } from '@aztec/stdlib/gas';
2
2
  import type { TxSimulationResult } from '@aztec/stdlib/tx';
3
3
  /**
4
4
  * Returns suggested total and teardown gas limits for a simulated tx.
5
- * Note that public gas usage is only accounted for if the publicOutput is present.
6
5
  * @param pad - Percentage to pad the suggested gas limits by, (as decimal, e.g., 0.10 for 10%).
7
6
  */
8
7
  export declare function getGasLimits(simulationResult: TxSimulationResult, pad?: number): {
9
8
  /**
10
- * Total gas used across private and public
9
+ * Gas limit for the tx, excluding teardown gas
11
10
  */
12
- totalGas: Gas;
11
+ gasLimits: Gas;
13
12
  /**
14
- * Teardown gas used
13
+ * Gas limit for the teardown phase
15
14
  */
16
- teardownGas: Gas;
15
+ teardownGasLimits: Gas;
17
16
  };
18
17
  //# sourceMappingURL=get_gas_limits.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get_gas_limits.d.ts","sourceRoot":"","sources":["../../src/contract/get_gas_limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,gBAAgB,EAAE,kBAAkB,EACpC,GAAG,SAAM,GACR;IACD;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC;IACd;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC;CAClB,CAKA"}
1
+ {"version":3,"file":"get_gas_limits.d.ts","sourceRoot":"","sources":["../../src/contract/get_gas_limits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,gBAAgB,EAAE,kBAAkB,EACpC,GAAG,SAAM,GACR;IACD;;OAEG;IACH,SAAS,EAAE,GAAG,CAAC;IACf;;OAEG;IACH,iBAAiB,EAAE,GAAG,CAAC;CACxB,CAYA"}
@@ -1,10 +1,16 @@
1
+ import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
1
2
  /**
2
3
  * Returns suggested total and teardown gas limits for a simulated tx.
3
- * Note that public gas usage is only accounted for if the publicOutput is present.
4
4
  * @param pad - Percentage to pad the suggested gas limits by, (as decimal, e.g., 0.10 for 10%).
5
5
  */ export function getGasLimits(simulationResult, pad = 0.1) {
6
+ // Total gas does not use the teardown gas limit, but the actual total gas used by the tx.
7
+ const gasLimits = simulationResult.gasUsed.totalGas.mul(1 + pad);
8
+ const teardownGasLimits = simulationResult.gasUsed.teardownGas.mul(1 + pad);
9
+ if (gasLimits.l2Gas > AVM_MAX_PROCESSABLE_L2_GAS) {
10
+ throw new Error('Transaction consumes more gas than the AVM maximum processable gas');
11
+ }
6
12
  return {
7
- totalGas: simulationResult.gasUsed.totalGas.mul(1 + pad),
8
- teardownGas: simulationResult.gasUsed.teardownGas.mul(1 + pad)
13
+ gasLimits,
14
+ teardownGasLimits
9
15
  };
10
16
  }
@@ -0,0 +1,114 @@
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
+ import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
7
+ import type { ProfileOptions, SendOptions, SimulateOptions } from '../wallet/index.js';
8
+ /**
9
+ * Options used to tweak the simulation and add gas estimation capabilities
10
+ */
11
+ export type FeeEstimationOptions = {
12
+ /** Whether to modify the fee settings of the simulation with high gas limit to figure out actual gas settings. */
13
+ estimateGas?: boolean;
14
+ /** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
15
+ estimatedGasPadding?: number;
16
+ };
17
+ /**
18
+ * Interactions allow configuring a custom fee payment method that gets bundled with the transaction before
19
+ * sending it to the wallet
20
+ */
21
+ export type FeePaymentMethodOption = {
22
+ /** Fee payment method to embed in the interaction */
23
+ paymentMethod?: FeePaymentMethod;
24
+ };
25
+ /**
26
+ * User-defined partial gas settings for the interaction. This type is completely optional since
27
+ * the wallet will fill in the missing options
28
+ */
29
+ export type GasSettingsOption = {
30
+ /** The gas settings */
31
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
32
+ };
33
+ /** Fee options as set by a user. */
34
+ export type InteractionFeeOptions = GasSettingsOption & FeePaymentMethodOption;
35
+ /** Fee options that can be set for simulation *only* */
36
+ export type SimulationInteractionFeeOptions = InteractionFeeOptions & FeeEstimationOptions;
37
+ /**
38
+ * Represents the options to configure a request from a contract interaction.
39
+ * Allows specifying additional auth witnesses and capsules to use during execution
40
+ */
41
+ export type RequestInteractionOptions = {
42
+ /** Extra authwits to use during execution */
43
+ authWitnesses?: AuthWitness[];
44
+ /** Extra capsules to use during execution */
45
+ capsules?: Capsule[];
46
+ /** Fee payment method to embed in the interaction request */
47
+ fee?: FeePaymentMethodOption;
48
+ };
49
+ /**
50
+ * Represents options for calling a (constrained) function in a contract.
51
+ */
52
+ export type SendInteractionOptions = RequestInteractionOptions & {
53
+ /** The sender's Aztec address. */
54
+ from: AztecAddress;
55
+ /** The fee options for the transaction. */
56
+ fee?: InteractionFeeOptions;
57
+ };
58
+ /**
59
+ * Represents the options for simulating a contract function interaction.
60
+ * Allows specifying the address from which the method should be called.
61
+ * Disregarded for simulation of public functions
62
+ */
63
+ export type SimulateInteractionOptions = Omit<SendInteractionOptions, 'fee'> & {
64
+ /** The fee options for the transaction. */
65
+ fee?: SimulationInteractionFeeOptions;
66
+ /** Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers. */
67
+ skipTxValidation?: boolean;
68
+ /** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
69
+ skipFeeEnforcement?: boolean;
70
+ /** Whether to include metadata such as offchain effects and performance statistics (e.g. timing information of the different circuits and oracles) in
71
+ * the simulation result, instead of just the return value of the function */
72
+ includeMetadata?: boolean;
73
+ };
74
+ /**
75
+ * Represents the options for profiling an interaction.
76
+ */
77
+ export type ProfileInteractionOptions = SimulateInteractionOptions & {
78
+ /** Whether to return gates information or the bytecode/witnesses. */
79
+ profileMode: 'gates' | 'execution-steps' | 'full';
80
+ /** Whether to generate a Chonk proof or not */
81
+ skipProofGeneration?: boolean;
82
+ };
83
+ /**
84
+ * Represents the result type of a simulation.
85
+ * By default, it will just be the return value of the simulated function
86
+ * If `includeMetadata` is set to true in `SimulateInteractionOptions` on the input of `simulate(...)`,
87
+ * it will provide extra information.
88
+ */
89
+ export type SimulationReturn<T extends boolean | undefined> = T extends true ? {
90
+ /** Additional stats about the simulation */
91
+ stats: SimulationStats;
92
+ /** Offchain effects generated during the simulation */
93
+ offchainEffects: OffchainEffect[];
94
+ /** Return value of the function */
95
+ result: any;
96
+ /** Gas estimation results */
97
+ estimatedGas: Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>;
98
+ } : any;
99
+ /**
100
+ * Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into
101
+ * SendOptions, which are the ones that can be serialized and forwarded to the wallet
102
+ */
103
+ export declare function toSendOptions(options: SendInteractionOptions): Promise<SendOptions>;
104
+ /**
105
+ * Transforms and cleans up the higher level SimulateInteractionOptions defined by the interaction into
106
+ * SimulateOptions, which are the ones that can be serialized and forwarded to the wallet
107
+ */
108
+ export declare function toSimulateOptions(options: SimulateInteractionOptions): Promise<SimulateOptions>;
109
+ /**
110
+ * Transforms and cleans up the higher level ProfileInteractionOptions defined by the interaction into
111
+ * ProfileOptions, which are the ones that can be serialized and forwarded to the wallet
112
+ */
113
+ export declare function toProfileOptions(options: ProfileInteractionOptions): Promise<ProfileOptions>;
114
+ //# sourceMappingURL=interaction_options.d.ts.map
@@ -0,0 +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