@aztec/aztec.js 3.0.0-canary.a9708bd → 3.0.0-devnet.2

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 (278) hide show
  1. package/dest/account/account.d.ts +60 -0
  2. package/dest/account/account.d.ts.map +1 -0
  3. package/dest/account/account.js +59 -0
  4. package/dest/account/account_contract.d.ts +5 -5
  5. package/dest/account/account_contract.d.ts.map +1 -1
  6. package/dest/account/account_contract.js +0 -1
  7. package/dest/{wallet/account_wallet_with_private_key.d.ts → account/account_with_secret_key.d.ts} +7 -8
  8. package/dest/account/account_with_secret_key.d.ts.map +1 -0
  9. package/dest/{wallet/account_wallet_with_private_key.js → account/account_with_secret_key.js} +5 -5
  10. package/dest/account/index.d.ts +1 -4
  11. package/dest/account/index.d.ts.map +1 -1
  12. package/dest/account/index.js +1 -4
  13. package/dest/account/signerless_account.d.ts +24 -0
  14. package/dest/account/signerless_account.d.ts.map +1 -0
  15. package/dest/account/signerless_account.js +27 -0
  16. package/dest/api/abi.d.ts +1 -0
  17. package/dest/api/abi.d.ts.map +1 -1
  18. package/dest/api/account.d.ts +4 -2
  19. package/dest/api/account.d.ts.map +1 -1
  20. package/dest/api/account.js +3 -1
  21. package/dest/api/addresses.d.ts +1 -0
  22. package/dest/api/addresses.d.ts.map +1 -1
  23. package/dest/api/addresses.js +1 -0
  24. package/dest/api/authorization.d.ts +2 -0
  25. package/dest/api/authorization.d.ts.map +1 -1
  26. package/dest/api/authorization.js +2 -0
  27. package/dest/api/block.d.ts +3 -0
  28. package/dest/api/block.d.ts.map +1 -0
  29. package/dest/api/block.js +2 -0
  30. package/dest/api/contract.d.ts +4 -5
  31. package/dest/api/contract.d.ts.map +1 -1
  32. package/dest/api/contract.js +3 -3
  33. package/dest/api/crypto.d.ts +2 -0
  34. package/dest/api/crypto.d.ts.map +1 -0
  35. package/dest/api/crypto.js +1 -0
  36. package/dest/api/ethereum.d.ts +0 -1
  37. package/dest/api/ethereum.d.ts.map +1 -1
  38. package/dest/api/ethereum.js +0 -1
  39. package/dest/api/events.d.ts +12 -0
  40. package/dest/api/events.d.ts.map +1 -0
  41. package/dest/api/events.js +30 -0
  42. package/dest/api/fee.d.ts +1 -2
  43. package/dest/api/fee.d.ts.map +1 -1
  44. package/dest/api/fee.js +0 -1
  45. package/dest/api/keys.d.ts +4 -0
  46. package/dest/api/keys.d.ts.map +1 -0
  47. package/dest/api/keys.js +3 -0
  48. package/dest/api/log.d.ts +1 -0
  49. package/dest/api/log.d.ts.map +1 -1
  50. package/dest/api/log.js +1 -0
  51. package/dest/api/messaging.d.ts +3 -0
  52. package/dest/api/messaging.d.ts.map +1 -0
  53. package/dest/api/messaging.js +2 -0
  54. package/dest/api/node.d.ts +21 -0
  55. package/dest/api/node.d.ts.map +1 -0
  56. package/dest/api/node.js +18 -0
  57. package/dest/api/note.d.ts +2 -0
  58. package/dest/api/note.d.ts.map +1 -0
  59. package/dest/api/note.js +1 -0
  60. package/dest/api/protocol.d.ts +3 -0
  61. package/dest/api/protocol.d.ts.map +1 -0
  62. package/dest/api/protocol.js +2 -0
  63. package/dest/api/trees.d.ts +3 -0
  64. package/dest/api/trees.d.ts.map +1 -0
  65. package/dest/api/trees.js +2 -0
  66. package/dest/api/tx.d.ts +2 -0
  67. package/dest/api/tx.d.ts.map +1 -0
  68. package/dest/api/tx.js +1 -0
  69. package/dest/api/utils.d.ts +10 -6
  70. package/dest/api/utils.d.ts.map +1 -1
  71. package/dest/api/utils.js +10 -5
  72. package/dest/api/wallet.d.ts +4 -1
  73. package/dest/api/wallet.d.ts.map +1 -1
  74. package/dest/api/wallet.js +4 -1
  75. package/dest/contract/base_contract_interaction.d.ts +6 -48
  76. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  77. package/dest/contract/base_contract_interaction.js +6 -106
  78. package/dest/contract/batch_call.d.ts +6 -14
  79. package/dest/contract/batch_call.d.ts.map +1 -1
  80. package/dest/contract/batch_call.js +42 -52
  81. package/dest/contract/contract.d.ts +1 -1
  82. package/dest/contract/contract.d.ts.map +1 -1
  83. package/dest/contract/contract.js +2 -12
  84. package/dest/contract/contract_base.d.ts +1 -1
  85. package/dest/contract/contract_base.d.ts.map +1 -1
  86. package/dest/contract/contract_function_interaction.d.ts +29 -40
  87. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  88. package/dest/contract/contract_function_interaction.js +41 -53
  89. package/dest/contract/deploy_method.d.ts +63 -56
  90. package/dest/contract/deploy_method.d.ts.map +1 -1
  91. package/dest/contract/deploy_method.js +68 -86
  92. package/dest/contract/deploy_sent_tx.d.ts +0 -1
  93. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  94. package/dest/contract/deploy_sent_tx.js +7 -10
  95. package/dest/contract/interaction_options.d.ts +74 -19
  96. package/dest/contract/interaction_options.d.ts.map +1 -1
  97. package/dest/contract/interaction_options.js +51 -3
  98. package/dest/contract/sent_tx.d.ts +3 -3
  99. package/dest/contract/sent_tx.d.ts.map +1 -1
  100. package/dest/contract/sent_tx.js +5 -5
  101. package/dest/contract/wait_for_proven.d.ts +3 -3
  102. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  103. package/dest/contract/wait_for_proven.js +2 -2
  104. package/dest/deployment/publish_instance.d.ts +1 -1
  105. package/dest/deployment/publish_instance.d.ts.map +1 -1
  106. package/dest/deployment/publish_instance.js +2 -5
  107. package/dest/ethereum/portal_manager.d.ts +3 -4
  108. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  109. package/dest/ethereum/portal_manager.js +3 -5
  110. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +12 -7
  111. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  112. package/dest/fee/fee_juice_payment_method_with_claim.js +21 -12
  113. package/dest/fee/fee_payment_method.d.ts +26 -0
  114. package/dest/fee/fee_payment_method.d.ts.map +1 -0
  115. package/dest/fee/fee_payment_method.js +3 -0
  116. package/dest/fee/private_fee_payment_method.d.ts +22 -5
  117. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  118. package/dest/fee/private_fee_payment_method.js +34 -13
  119. package/dest/fee/public_fee_payment_method.d.ts +22 -5
  120. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  121. package/dest/fee/public_fee_payment_method.js +37 -14
  122. package/dest/fee/sponsored_fee_payment.d.ts +2 -0
  123. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
  124. package/dest/fee/sponsored_fee_payment.js +4 -0
  125. package/dest/utils/authwit.d.ts +77 -25
  126. package/dest/utils/authwit.d.ts.map +1 -1
  127. package/dest/utils/authwit.js +219 -24
  128. package/dest/utils/cross_chain.d.ts +24 -0
  129. package/dest/utils/cross_chain.d.ts.map +1 -0
  130. package/dest/utils/cross_chain.js +30 -0
  131. package/dest/utils/fee_juice.d.ts +3 -2
  132. package/dest/utils/fee_juice.d.ts.map +1 -1
  133. package/dest/utils/fee_juice.js +3 -2
  134. package/dest/{fee → wallet}/account_entrypoint_meta_payment_method.d.ts +13 -10
  135. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
  136. package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
  137. package/dest/wallet/account_manager.d.ts +69 -0
  138. package/dest/wallet/account_manager.d.ts.map +1 -0
  139. package/dest/wallet/account_manager.js +113 -0
  140. package/dest/wallet/base_wallet.d.ts +78 -35
  141. package/dest/wallet/base_wallet.d.ts.map +1 -1
  142. package/dest/wallet/base_wallet.js +216 -48
  143. package/dest/wallet/deploy_account_method.d.ts +52 -0
  144. package/dest/wallet/deploy_account_method.d.ts.map +1 -0
  145. package/dest/wallet/deploy_account_method.js +77 -0
  146. package/dest/wallet/index.d.ts +2 -15
  147. package/dest/wallet/index.d.ts.map +1 -1
  148. package/dest/wallet/index.js +2 -19
  149. package/dest/wallet/wallet.d.ts +2473 -6
  150. package/dest/wallet/wallet.d.ts.map +1 -1
  151. package/dest/wallet/wallet.js +202 -3
  152. package/package.json +25 -21
  153. package/src/account/account.ts +97 -0
  154. package/src/account/account_contract.ts +4 -6
  155. package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +6 -8
  156. package/src/account/index.ts +1 -4
  157. package/src/account/signerless_account.ts +46 -0
  158. package/src/api/abi.ts +11 -0
  159. package/src/api/account.ts +4 -2
  160. package/src/api/addresses.ts +1 -0
  161. package/src/api/authorization.ts +11 -0
  162. package/src/api/block.ts +2 -0
  163. package/src/api/contract.ts +16 -8
  164. package/src/api/crypto.ts +1 -0
  165. package/src/api/ethereum.ts +0 -1
  166. package/src/api/events.ts +44 -0
  167. package/src/api/fee.ts +1 -2
  168. package/src/api/keys.ts +8 -0
  169. package/src/api/log.ts +1 -0
  170. package/src/api/messaging.ts +2 -0
  171. package/src/api/node.ts +20 -0
  172. package/src/api/note.ts +1 -0
  173. package/src/api/protocol.ts +2 -0
  174. package/src/api/trees.ts +2 -0
  175. package/src/api/tx.ts +11 -0
  176. package/src/api/utils.ts +12 -19
  177. package/src/api/wallet.ts +33 -5
  178. package/src/contract/base_contract_interaction.ts +9 -138
  179. package/src/contract/batch_call.ts +52 -61
  180. package/src/contract/contract.ts +2 -12
  181. package/src/contract/contract_function_interaction.ts +65 -97
  182. package/src/contract/deploy_method.ts +117 -99
  183. package/src/contract/deploy_sent_tx.ts +4 -10
  184. package/src/contract/interaction_options.ts +126 -24
  185. package/src/contract/sent_tx.ts +4 -4
  186. package/src/contract/wait_for_proven.ts +4 -4
  187. package/src/deployment/publish_instance.ts +3 -8
  188. package/src/ethereum/portal_manager.ts +4 -12
  189. package/src/fee/fee_juice_payment_method_with_claim.ts +26 -17
  190. package/src/fee/fee_payment_method.ts +26 -0
  191. package/src/fee/private_fee_payment_method.ts +60 -41
  192. package/src/fee/public_fee_payment_method.ts +73 -49
  193. package/src/fee/sponsored_fee_payment.ts +6 -0
  194. package/src/utils/authwit.ts +250 -38
  195. package/src/utils/cross_chain.ts +53 -0
  196. package/src/utils/fee_juice.ts +4 -3
  197. package/src/wallet/account_entrypoint_meta_payment_method.ts +105 -0
  198. package/src/wallet/account_manager.ts +154 -0
  199. package/src/wallet/base_wallet.ts +287 -78
  200. package/src/wallet/deploy_account_method.ts +125 -0
  201. package/src/wallet/index.ts +2 -32
  202. package/src/wallet/wallet.ts +357 -29
  203. package/dest/account_manager/account_manager.d.ts +0 -119
  204. package/dest/account_manager/account_manager.d.ts.map +0 -1
  205. package/dest/account_manager/account_manager.js +0 -202
  206. package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
  207. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
  208. package/dest/account_manager/deploy_account_sent_tx.js +0 -29
  209. package/dest/account_manager/index.d.ts +0 -3
  210. package/dest/account_manager/index.d.ts.map +0 -1
  211. package/dest/account_manager/index.js +0 -2
  212. package/dest/api/interfaces.d.ts +0 -2
  213. package/dest/api/interfaces.d.ts.map +0 -1
  214. package/dest/api/interfaces.js +0 -1
  215. package/dest/api/log_id.d.ts +0 -2
  216. package/dest/api/log_id.d.ts.map +0 -1
  217. package/dest/api/log_id.js +0 -1
  218. package/dest/api/rpc.d.ts +0 -3
  219. package/dest/api/rpc.d.ts.map +0 -1
  220. package/dest/api/rpc.js +0 -2
  221. package/dest/api/tx_hash.d.ts +0 -2
  222. package/dest/api/tx_hash.d.ts.map +0 -1
  223. package/dest/api/tx_hash.js +0 -1
  224. package/dest/contract/deploy_proven_tx.d.ts +0 -21
  225. package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
  226. package/dest/contract/deploy_proven_tx.js +0 -21
  227. package/dest/contract/proven_tx.d.ts +0 -21
  228. package/dest/contract/proven_tx.d.ts.map +0 -1
  229. package/dest/contract/proven_tx.js +0 -23
  230. package/dest/ethereum/l1_contracts.d.ts +0 -3
  231. package/dest/ethereum/l1_contracts.d.ts.map +0 -1
  232. package/dest/ethereum/l1_contracts.js +0 -13
  233. package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +0 -1
  234. package/dest/fee/account_entrypoint_meta_payment_method.js +0 -64
  235. package/dest/fee/fee_juice_payment_method.d.ts +0 -14
  236. package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
  237. package/dest/fee/fee_juice_payment_method.js +0 -21
  238. package/dest/fee/utils.d.ts +0 -13
  239. package/dest/fee/utils.d.ts.map +0 -1
  240. package/dest/fee/utils.js +0 -32
  241. package/dest/index.d.ts +0 -59
  242. package/dest/index.d.ts.map +0 -1
  243. package/dest/index.js +0 -62
  244. package/dest/rpc_clients/node/index.d.ts +0 -12
  245. package/dest/rpc_clients/node/index.d.ts.map +0 -1
  246. package/dest/rpc_clients/node/index.js +0 -72
  247. package/dest/rpc_clients/pxe_client.d.ts +0 -10
  248. package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
  249. package/dest/rpc_clients/pxe_client.js +0 -23
  250. package/dest/utils/pxe.d.ts +0 -4
  251. package/dest/utils/pxe.d.ts.map +0 -1
  252. package/dest/utils/pxe.js +0 -14
  253. package/dest/wallet/account_wallet.d.ts +0 -74
  254. package/dest/wallet/account_wallet.d.ts.map +0 -1
  255. package/dest/wallet/account_wallet.js +0 -232
  256. package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
  257. package/dest/wallet/signerless_wallet.d.ts +0 -23
  258. package/dest/wallet/signerless_wallet.d.ts.map +0 -1
  259. package/dest/wallet/signerless_wallet.js +0 -33
  260. package/src/account_manager/account_manager.ts +0 -276
  261. package/src/account_manager/deploy_account_sent_tx.ts +0 -46
  262. package/src/account_manager/index.ts +0 -2
  263. package/src/api/interfaces.ts +0 -1
  264. package/src/api/log_id.ts +0 -1
  265. package/src/api/rpc.ts +0 -2
  266. package/src/api/tx_hash.ts +0 -1
  267. package/src/contract/deploy_proven_tx.ts +0 -45
  268. package/src/contract/proven_tx.ts +0 -36
  269. package/src/ethereum/l1_contracts.ts +0 -21
  270. package/src/fee/account_entrypoint_meta_payment_method.ts +0 -89
  271. package/src/fee/fee_juice_payment_method.ts +0 -25
  272. package/src/fee/utils.ts +0 -39
  273. package/src/index.ts +0 -85
  274. package/src/rpc_clients/node/index.ts +0 -77
  275. package/src/rpc_clients/pxe_client.ts +0 -25
  276. package/src/utils/pxe.ts +0 -17
  277. package/src/wallet/account_wallet.ts +0 -246
  278. package/src/wallet/signerless_wallet.ts +0 -56
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The `node` module provides utilities for connecting to and interacting with an Aztec node.
3
+ *
4
+ * The primary function is {@link createAztecNodeClient}, which creates a JSON-RPC client
5
+ * that connects to a running Aztec node instance. Use {@link waitForNode} to wait for
6
+ * the node to be ready before proceeding.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
11
+ *
12
+ * const node = createAztecNodeClient('http://localhost:8080');
13
+ * await waitForNode(node);
14
+ * const blockNumber = await node.getBlockNumber();
15
+ * ```
16
+ *
17
+ * @packageDocumentation
18
+ */
19
+ export { createAztecNodeClient, waitForNode, type AztecNode } from '../utils/node.js';
20
+ export { type NodeInfo } from '@aztec/stdlib/contract';
21
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/api/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The `node` module provides utilities for connecting to and interacting with an Aztec node.
3
+ *
4
+ * The primary function is {@link createAztecNodeClient}, which creates a JSON-RPC client
5
+ * that connects to a running Aztec node instance. Use {@link waitForNode} to wait for
6
+ * the node to be ready before proceeding.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
11
+ *
12
+ * const node = createAztecNodeClient('http://localhost:8080');
13
+ * await waitForNode(node);
14
+ * const blockNumber = await node.getBlockNumber();
15
+ * ```
16
+ *
17
+ * @packageDocumentation
18
+ */ export { createAztecNodeClient, waitForNode } from '../utils/node.js';
@@ -0,0 +1,2 @@
1
+ export { UniqueNote, Comparator, Note } from '@aztec/stdlib/note';
2
+ //# sourceMappingURL=note.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note.d.ts","sourceRoot":"","sources":["../../src/api/note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ export { UniqueNote, Comparator, Note } from '@aztec/stdlib/note';
@@ -0,0 +1,3 @@
1
+ export { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+ export { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
3
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/api/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+ export { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
@@ -0,0 +1,3 @@
1
+ export { SiblingPath } from '@aztec/foundation/trees';
2
+ export { MerkleTreeId, merkleTreeIds } from '@aztec/stdlib/trees';
3
+ //# sourceMappingURL=trees.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trees.d.ts","sourceRoot":"","sources":["../../src/api/trees.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { SiblingPath } from '@aztec/foundation/trees';
2
+ export { MerkleTreeId, merkleTreeIds } from '@aztec/stdlib/trees';
@@ -0,0 +1,2 @@
1
+ export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, TxProfileResult, } from '@aztec/stdlib/tx';
2
+ //# sourceMappingURL=tx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/api/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
package/dest/api/tx.js ADDED
@@ -0,0 +1 @@
1
+ export { Tx, TxExecutionRequest, TxHash, TxReceipt, TxStatus, Capsule, HashedValues, GlobalVariables, TxProfileResult } from '@aztec/stdlib/tx';
@@ -1,9 +1,13 @@
1
- export { generatePublicKey } from '../utils/pub_key.js';
2
- export { type AztecAddressLike, type EthAddressLike, type EventSelectorLike, type FieldLike, type FunctionSelectorLike, type U128Like, type WrappedFieldLike, } from '../utils/abi_types.js';
3
- export { computeAuthWitMessageHash, computeInnerAuthWitHashFromAction, type IntentAction, type IntentInnerHash, } from '../utils/authwit.js';
4
- export { computeInnerAuthWitHash } from '@aztec/stdlib/auth-witness';
5
- export { waitForPXE } from '../utils/pxe.js';
6
- export { waitForNode, createAztecNodeClient, type AztecNode } from '../utils/node.js';
1
+ /**
2
+ * Utility functions for aztec.js.
3
+ *
4
+ * NOTE: This module contains low-usage utilities and may be deprecated in the future.
5
+ * Prefer using more specific modules:
6
+ * - Node connection utilities `@aztec/aztec.js/node`
7
+ * - Type converters → `@aztec/aztec.js/abi`
8
+ * - Key generation → `@aztec/aztec.js/keys`
9
+ * - Messaging utilities → `@aztec/aztec.js/messaging`
10
+ */
7
11
  export { getFeeJuiceBalance } from '../utils/fee_juice.js';
8
12
  export { readFieldCompressedString } from '../utils/field_compressed_string.js';
9
13
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,iCAAiC,EACjC,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC"}
package/dest/api/utils.js CHANGED
@@ -1,7 +1,12 @@
1
- export { generatePublicKey } from '../utils/pub_key.js';
2
- export { computeAuthWitMessageHash, computeInnerAuthWitHashFromAction } from '../utils/authwit.js';
3
- export { computeInnerAuthWitHash } from '@aztec/stdlib/auth-witness';
4
- export { waitForPXE } from '../utils/pxe.js';
5
- export { waitForNode, createAztecNodeClient } from '../utils/node.js';
1
+ /**
2
+ * Utility functions for aztec.js.
3
+ *
4
+ * NOTE: This module contains low-usage utilities and may be deprecated in the future.
5
+ * Prefer using more specific modules:
6
+ * - Node connection utilities → `@aztec/aztec.js/node`
7
+ * - Type converters → `@aztec/aztec.js/abi`
8
+ * - Key generation → `@aztec/aztec.js/keys`
9
+ * - Messaging utilities → `@aztec/aztec.js/messaging`
10
+ */ // Low-usage utilities - consider these internal/experimental
6
11
  export { getFeeJuiceBalance } from '../utils/fee_juice.js';
7
12
  export { readFieldCompressedString } from '../utils/field_compressed_string.js';
@@ -1,2 +1,5 @@
1
- export { AccountWallet, AccountWalletWithSecretKey, SignerlessWallet, getWallet, type Wallet, } from '../wallet/index.js';
1
+ export { type Aliased, type ContractInstanceAndArtifact, type UserFeeOptions, type SimulateOptions, type ProfileOptions, type SendOptions, type BatchableMethods, type BatchedMethod, type BatchedMethodResult, type BatchedMethodResultWrapper, type BatchResults, type Wallet, ContractInstantiationDataSchema, FunctionCallSchema, ExecutionPayloadSchema, UserFeeOptionsSchema, WalletSimulationFeeOptionSchema, SendOptionsSchema, SimulateOptionsSchema, ProfileOptionsSchema, InstanceDataSchema, MessageHashOrIntentSchema, BatchedMethodSchema, ContractMetadataSchema, ContractClassMetadataSchema, EventMetadataDefinitionSchema, WalletSchema, } from '../wallet/wallet.js';
2
+ export { type FeeOptions, BaseWallet } from '../wallet/base_wallet.js';
3
+ export { AccountManager } from '../wallet/account_manager.js';
4
+ export { type DeployAccountOptions, DeployAccountMethod } from '../wallet/deploy_account_method.js';
2
5
  //# sourceMappingURL=wallet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/api/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,gBAAgB,EAChB,SAAS,EACT,KAAK,MAAM,GACZ,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/api/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,2BAA2B,EAChC,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,+BAA+B,EAC/B,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,+BAA+B,EAC/B,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC7B,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,KAAK,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -1 +1,4 @@
1
- export { AccountWallet, AccountWalletWithSecretKey, SignerlessWallet, getWallet } from '../wallet/index.js';
1
+ export { ContractInstantiationDataSchema, FunctionCallSchema, ExecutionPayloadSchema, UserFeeOptionsSchema, WalletSimulationFeeOptionSchema, SendOptionsSchema, SimulateOptionsSchema, ProfileOptionsSchema, InstanceDataSchema, MessageHashOrIntentSchema, BatchedMethodSchema, ContractMetadataSchema, ContractClassMetadataSchema, EventMetadataDefinitionSchema, WalletSchema } from '../wallet/wallet.js';
2
+ export { BaseWallet } from '../wallet/base_wallet.js';
3
+ export { AccountManager } from '../wallet/account_manager.js';
4
+ export { DeployAccountMethod } from '../wallet/deploy_account_method.js';
@@ -1,11 +1,8 @@
1
- import type { FeeOptions, TxExecutionOptions, UserFeeOptions } from '@aztec/entrypoints/interfaces';
2
1
  import type { ExecutionPayload } from '@aztec/entrypoints/payload';
3
2
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
4
- import { GasSettings } from '@aztec/stdlib/gas';
5
- import type { Capsule, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
3
+ import type { Capsule } from '@aztec/stdlib/tx';
6
4
  import type { Wallet } from '../wallet/wallet.js';
7
- import type { RequestMethodOptions, SendMethodOptions } from './interaction_options.js';
8
- import { ProvenTx } from './proven_tx.js';
5
+ import { type RequestInteractionOptions, type SendInteractionOptions } from './interaction_options.js';
9
6
  import { SentTx } from './sent_tx.js';
10
7
  /**
11
8
  * Base class for an interaction with a contract, be it a deployment, a function call, or a batch.
@@ -17,61 +14,22 @@ export declare abstract class BaseContractInteraction {
17
14
  protected capsules: Capsule[];
18
15
  protected log: import("@aztec/foundation/log").Logger;
19
16
  constructor(wallet: Wallet, authWitnesses?: AuthWitness[], capsules?: Capsule[]);
20
- /**
21
- * Create a transaction execution request ready to be simulated.
22
- * @param options - An optional object containing additional configuration for the transaction.
23
- * @returns A transaction execution request.
24
- */
25
- abstract create(options?: SendMethodOptions): Promise<TxExecutionRequest>;
26
17
  /**
27
18
  * Returns an execution request that represents this operation.
28
19
  * Can be used as a building block for constructing batch requests.
29
20
  * @param options - An optional object containing additional configuration for the transaction.
30
21
  * @returns An execution request wrapped in promise.
31
22
  */
32
- abstract request(options?: RequestMethodOptions): Promise<ExecutionPayload>;
33
- /**
34
- * Creates a transaction execution request, simulates and proves it. Differs from .prove in
35
- * that its result does not include the wallet nor the composed tx object, but only the proving result.
36
- * This object can then be used to either create a ProvenTx ready to be sent, or directly send the transaction.
37
- * @param options - optional arguments to be used in the creation of the transaction
38
- * @returns The proving result.
39
- */
40
- protected proveInternal(options: SendMethodOptions): Promise<TxProvingResult>;
41
- /**
42
- * Proves a transaction execution request and returns a tx object ready to be sent.
43
- * @param options - optional arguments to be used in the creation of the transaction
44
- * @returns The resulting transaction
45
- */
46
- prove(options: SendMethodOptions): Promise<ProvenTx>;
23
+ abstract request(options?: RequestInteractionOptions): Promise<ExecutionPayload>;
47
24
  /**
48
25
  * Sends a transaction to the contract function with the specified options.
49
26
  * This function throws an error if called on a utility function.
50
27
  * It creates and signs the transaction if necessary, and returns a SentTx instance,
51
28
  * which can be used to track the transaction status, receipt, and events.
52
- * @param options - An optional object containing 'from' property representing
53
- * the AztecAddress of the sender. If not provided, the default address is used.
29
+ * @param options - An object containing 'from' property representing
30
+ * the AztecAddress of the sender and optional fee configuration
54
31
  * @returns A SentTx instance for tracking the transaction status and information.
55
32
  */
56
- send(options: SendMethodOptions): SentTx;
57
- /**
58
- * Estimates gas for a given tx request and returns gas limits for it.
59
- * @param options - Options.
60
- * @returns Gas limits.
61
- */
62
- estimateGas(options: Omit<SendMethodOptions, 'estimateGas'>): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>>;
63
- /**
64
- * Returns default fee options based on the user opts without running a simulation for gas estimation.
65
- * @param fee - User-provided fee options.
66
- */
67
- protected getDefaultFeeOptions(fee: UserFeeOptions | undefined): Promise<FeeOptions>;
68
- /**
69
- * Return fee options based on the user opts, estimating tx gas if needed.
70
- * @param executionPayload - Execution payload to get the fee for
71
- * @param fee - User-provided fee options.
72
- * @param options - Additional options for the transaction. They must faithfully represent the tx to get accurate fee estimates
73
- * @returns Fee options for the actual transaction.
74
- */
75
- protected getFeeOptions(executionPayload: ExecutionPayload, fee: UserFeeOptions | undefined, options: TxExecutionOptions): Promise<FeeOptions>;
33
+ send(options: SendInteractionOptions): SentTx;
76
34
  }
77
35
  //# sourceMappingURL=base_contract_interaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base_contract_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/base_contract_interaction.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGrF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;GAGG;AACH,8BAAsB,uBAAuB;IAIzC,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,aAAa,EAAE,WAAW,EAAE;IACtC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE;IAL/B,SAAS,CAAC,GAAG,yCAAgD;gBAGjD,MAAM,EAAE,MAAM,EACd,aAAa,GAAE,WAAW,EAAO,EACjC,QAAQ,GAAE,OAAO,EAAO;IAGpC;;;;OAIG;aACa,MAAM,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAEhF;;;;;OAKG;aACa,OAAO,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAElF;;;;;;OAMG;cACa,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IAWnF;;;;OAIG;IACU,KAAK,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAYjE;;;;;;;;OAQG;IACI,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM;IAU/C;;;;OAIG;IACU,WAAW,CACtB,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB,CAAC,CAAC;IAShE;;;OAGG;cACa,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAU1F;;;;;;OAMG;cACa,aAAa,CAC3B,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,cAAc,YAAK,EACxB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,UAAU,CAAC;CAkCvB"}
1
+ {"version":3,"file":"base_contract_interaction.d.ts","sourceRoot":"","sources":["../../src/contract/base_contract_interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,sBAAsB,EAAiB,MAAM,0BAA0B,CAAC;AACtH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;GAGG;AACH,8BAAsB,uBAAuB;IAIzC,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,aAAa,EAAE,WAAW,EAAE;IACtC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE;IAL/B,SAAS,CAAC,GAAG,yCAAgD;gBAGjD,MAAM,EAAE,MAAM,EACd,aAAa,GAAE,WAAW,EAAO,EACjC,QAAQ,GAAE,OAAO,EAAO;IAGpC;;;;;OAKG;aACa,OAAO,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAGvF;;;;;;;;OAQG;IACI,IAAI,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM;CASrD"}
@@ -1,10 +1,5 @@
1
- import { GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT } from '@aztec/constants';
2
1
  import { createLogger } from '@aztec/foundation/log';
3
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import { Gas, GasSettings } from '@aztec/stdlib/gas';
5
- import { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
6
- import { getGasLimits } from './get_gas_limits.js';
7
- import { ProvenTx } from './proven_tx.js';
2
+ import { toSendOptions } from './interaction_options.js';
8
3
  import { SentTx } from './sent_tx.js';
9
4
  /**
10
5
  * Base class for an interaction with a contract, be it a deployment, a function call, or a batch.
@@ -20,117 +15,22 @@ import { SentTx } from './sent_tx.js';
20
15
  this.capsules = capsules;
21
16
  this.log = createLogger('aztecjs:contract_interaction');
22
17
  }
23
- /**
24
- * Creates a transaction execution request, simulates and proves it. Differs from .prove in
25
- * that its result does not include the wallet nor the composed tx object, but only the proving result.
26
- * This object can then be used to either create a ProvenTx ready to be sent, or directly send the transaction.
27
- * @param options - optional arguments to be used in the creation of the transaction
28
- * @returns The proving result.
29
- */ async proveInternal(options) {
30
- if (options.from !== AztecAddress.ZERO && !options.from.equals(this.wallet.getAddress())) {
31
- throw new Error(`The address provided as from does not match the wallet address. Expected ${this.wallet.getAddress().toString()}, got ${options.from.toString()}.`);
32
- }
33
- const txRequest = await this.create(options);
34
- return await this.wallet.proveTx(txRequest);
35
- }
36
- // docs:start:prove
37
- /**
38
- * Proves a transaction execution request and returns a tx object ready to be sent.
39
- * @param options - optional arguments to be used in the creation of the transaction
40
- * @returns The resulting transaction
41
- */ async prove(options) {
42
- // docs:end:prove
43
- const txProvingResult = await this.proveInternal(options);
44
- return new ProvenTx(this.wallet, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
45
- }
46
18
  // docs:start:send
47
19
  /**
48
20
  * Sends a transaction to the contract function with the specified options.
49
21
  * This function throws an error if called on a utility function.
50
22
  * It creates and signs the transaction if necessary, and returns a SentTx instance,
51
23
  * which can be used to track the transaction status, receipt, and events.
52
- * @param options - An optional object containing 'from' property representing
53
- * the AztecAddress of the sender. If not provided, the default address is used.
24
+ * @param options - An object containing 'from' property representing
25
+ * the AztecAddress of the sender and optional fee configuration
54
26
  * @returns A SentTx instance for tracking the transaction status and information.
55
27
  */ send(options) {
56
28
  // docs:end:send
57
29
  const sendTx = async ()=>{
58
- const txProvingResult = await this.proveInternal(options);
59
- return this.wallet.sendTx(await txProvingResult.toTx());
30
+ const executionPayload = await this.request(options);
31
+ const sendOptions = await toSendOptions(options);
32
+ return this.wallet.sendTx(executionPayload, sendOptions);
60
33
  };
61
34
  return new SentTx(this.wallet, sendTx);
62
35
  }
63
- // docs:start:estimateGas
64
- /**
65
- * Estimates gas for a given tx request and returns gas limits for it.
66
- * @param options - Options.
67
- * @returns Gas limits.
68
- */ async estimateGas(options) {
69
- // docs:end:estimateGas
70
- const txRequest = await this.create({
71
- ...options,
72
- fee: {
73
- ...options?.fee,
74
- estimateGas: true
75
- }
76
- });
77
- return {
78
- gasLimits: txRequest.txContext.gasSettings.gasLimits,
79
- teardownGasLimits: txRequest.txContext.gasSettings.teardownGasLimits
80
- };
81
- }
82
- /**
83
- * Returns default fee options based on the user opts without running a simulation for gas estimation.
84
- * @param fee - User-provided fee options.
85
- */ async getDefaultFeeOptions(fee) {
86
- const maxFeesPerGas = fee?.gasSettings?.maxFeesPerGas ?? (await this.wallet.getCurrentBaseFees()).mul(1 + (fee?.baseFeePadding ?? 0.5));
87
- const paymentMethod = fee?.paymentMethod ?? new FeeJuicePaymentMethod(this.wallet.getAddress());
88
- const gasSettings = GasSettings.default({
89
- ...fee?.gasSettings,
90
- maxFeesPerGas
91
- });
92
- this.log.debug(`Using L2 gas settings`, gasSettings);
93
- return {
94
- gasSettings,
95
- paymentMethod
96
- };
97
- }
98
- // docs:start:getFeeOptions
99
- /**
100
- * Return fee options based on the user opts, estimating tx gas if needed.
101
- * @param executionPayload - Execution payload to get the fee for
102
- * @param fee - User-provided fee options.
103
- * @param options - Additional options for the transaction. They must faithfully represent the tx to get accurate fee estimates
104
- * @returns Fee options for the actual transaction.
105
- */ async getFeeOptions(executionPayload, fee = {}, options) {
106
- // docs:end:getFeeOptions
107
- const defaultFeeOptions = await this.getDefaultFeeOptions(fee);
108
- const paymentMethod = defaultFeeOptions.paymentMethod;
109
- const maxFeesPerGas = defaultFeeOptions.gasSettings.maxFeesPerGas;
110
- const maxPriorityFeesPerGas = defaultFeeOptions.gasSettings.maxPriorityFeesPerGas;
111
- let gasSettings = defaultFeeOptions.gasSettings;
112
- if (fee?.estimateGas) {
113
- // Use unrealistically high gas limits for estimation to avoid running out of gas.
114
- // They will be tuned down after the simulation.
115
- const gasSettingsForEstimation = new GasSettings(new Gas(GAS_ESTIMATION_DA_GAS_LIMIT, GAS_ESTIMATION_L2_GAS_LIMIT), new Gas(GAS_ESTIMATION_TEARDOWN_DA_GAS_LIMIT, GAS_ESTIMATION_TEARDOWN_L2_GAS_LIMIT), maxFeesPerGas, maxPriorityFeesPerGas);
116
- const feeForEstimation = {
117
- paymentMethod,
118
- gasSettings: gasSettingsForEstimation
119
- };
120
- const txRequest = await this.wallet.createTxExecutionRequest(executionPayload, feeForEstimation, options);
121
- const simulationResult = await this.wallet.simulateTx(txRequest, true, undefined /* skipTxValidation */ , true);
122
- const { gasLimits, teardownGasLimits } = getGasLimits(simulationResult, fee?.estimatedGasPadding);
123
- gasSettings = GasSettings.from({
124
- maxFeesPerGas,
125
- maxPriorityFeesPerGas,
126
- gasLimits,
127
- teardownGasLimits
128
- });
129
- this.log.verbose(`Estimated gas limits for tx: DA=${gasLimits.daGas} L2=${gasLimits.l2Gas} teardownDA=${teardownGasLimits.daGas} teardownL2=${teardownGasLimits.l2Gas}`);
130
- }
131
- return {
132
- gasSettings,
133
- paymentMethod
134
- };
135
- }
136
36
  }
@@ -1,25 +1,17 @@
1
1
  import { ExecutionPayload } from '@aztec/entrypoints/payload';
2
- import type { TxExecutionRequest } from '@aztec/stdlib/tx';
3
2
  import type { Wallet } from '../wallet/wallet.js';
4
3
  import { BaseContractInteraction } from './base_contract_interaction.js';
5
- import type { RequestMethodOptions, SendMethodOptions, SimulateMethodOptions } from './interaction_options.js';
4
+ import { type RequestInteractionOptions, type SimulateInteractionOptions } from './interaction_options.js';
6
5
  /** A batch of function calls to be sent as a single transaction through a wallet. */
7
6
  export declare class BatchCall extends BaseContractInteraction {
8
- protected calls: BaseContractInteraction[];
9
- constructor(wallet: Wallet, calls: BaseContractInteraction[]);
10
- /**
11
- * Create a transaction execution request that represents this batch, encoded and authenticated by the
12
- * user's wallet, ready to be simulated.
13
- * @param options - An optional object containing additional configuration for the transaction.
14
- * @returns A Promise that resolves to a transaction instance.
15
- */
16
- create(options?: SendMethodOptions): Promise<TxExecutionRequest>;
7
+ protected interactions: (BaseContractInteraction | ExecutionPayload)[];
8
+ constructor(wallet: Wallet, interactions: (BaseContractInteraction | ExecutionPayload)[]);
17
9
  /**
18
10
  * Returns an execution request that represents this operation.
19
11
  * @param options - An optional object containing additional configuration for the request generation.
20
12
  * @returns An execution payload wrapped in promise.
21
13
  */
22
- request(options?: RequestMethodOptions): Promise<ExecutionPayload>;
14
+ request(options?: RequestInteractionOptions): Promise<ExecutionPayload>;
23
15
  /**
24
16
  * Simulate a transaction and get its return values
25
17
  * Differs from prove in a few important ways:
@@ -29,7 +21,7 @@ export declare class BatchCall extends BaseContractInteraction {
29
21
  * @param options - An optional object containing additional configuration for the transaction.
30
22
  * @returns The result of the transaction as returned by the contract function.
31
23
  */
32
- simulate(options: SimulateMethodOptions): Promise<any>;
33
- private getRequests;
24
+ simulate(options: SimulateInteractionOptions): Promise<any>;
25
+ protected getExecutionPayloads(): Promise<ExecutionPayload[]>;
34
26
  }
35
27
  //# sourceMappingURL=batch_call.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch_call.d.ts","sourceRoot":"","sources":["../../src/contract/batch_call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,4BAA4B,CAAC;AAEtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAE/G,qFAAqF;AACrF,qBAAa,SAAU,SAAQ,uBAAuB;IAGlD,SAAS,CAAC,KAAK,EAAE,uBAAuB,EAAE;gBAD1C,MAAM,EAAE,MAAM,EACJ,KAAK,EAAE,uBAAuB,EAAE;IAK5C;;;;;OAKG;IACU,MAAM,CAAC,OAAO,GAAE,iBAAsD,GAAG,OAAO,CAAC,kBAAkB,CAAC;IASjH;;;;OAIG;IACU,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAWnF;;;;;;;;OAQG;IACU,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC;YA2ErD,WAAW;CAG1B"}
1
+ {"version":3,"file":"batch_call.d.ts","sourceRoot":"","sources":["../../src/contract/batch_call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,4BAA4B,CAAC;AAGtF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAEhC,MAAM,0BAA0B,CAAC;AAElC,qFAAqF;AACrF,qBAAa,SAAU,SAAQ,uBAAuB;IAGlD,SAAS,CAAC,YAAY,EAAE,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,EAAE;gBADtE,MAAM,EAAE,MAAM,EACJ,YAAY,EAAE,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,EAAE;IAKxE;;;;OAIG;IACU,OAAO,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAWxF;;;;;;;;OAQG;IACU,QAAQ,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC;cA8ExD,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAGpE"}
@@ -1,38 +1,26 @@
1
1
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
2
2
  import { FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
3
3
  import { BaseContractInteraction } from './base_contract_interaction.js';
4
+ import { toSimulateOptions } from './interaction_options.js';
4
5
  /** A batch of function calls to be sent as a single transaction through a wallet. */ export class BatchCall extends BaseContractInteraction {
5
- calls;
6
- constructor(wallet, calls){
7
- super(wallet), this.calls = calls;
8
- }
9
- /**
10
- * Create a transaction execution request that represents this batch, encoded and authenticated by the
11
- * user's wallet, ready to be simulated.
12
- * @param options - An optional object containing additional configuration for the transaction.
13
- * @returns A Promise that resolves to a transaction instance.
14
- */ async create(options = {
15
- from: this.wallet.getAddress()
16
- }) {
17
- const requestWithoutFee = await this.request(options);
18
- const { fee: userFee, txNonce, cancellable } = options;
19
- const fee = await this.getFeeOptions(requestWithoutFee, userFee, {
20
- txNonce,
21
- cancellable
22
- });
23
- return await this.wallet.createTxExecutionRequest(requestWithoutFee, fee, {
24
- txNonce,
25
- cancellable
26
- });
6
+ interactions;
7
+ constructor(wallet, interactions){
8
+ super(wallet), this.interactions = interactions;
27
9
  }
28
10
  /**
29
11
  * Returns an execution request that represents this operation.
30
12
  * @param options - An optional object containing additional configuration for the request generation.
31
13
  * @returns An execution payload wrapped in promise.
32
14
  */ async request(options = {}) {
33
- const requests = await this.getRequests();
34
- const combinedPayload = mergeExecutionPayloads(requests);
35
- return new ExecutionPayload(combinedPayload.calls, combinedPayload.authWitnesses.concat(options.authWitnesses ?? []), combinedPayload.capsules.concat(options.capsules ?? []), combinedPayload.extraHashedArgs);
15
+ const requests = await this.getExecutionPayloads();
16
+ const feeExecutionPayload = options.fee?.paymentMethod ? await options.fee.paymentMethod.getExecutionPayload() : undefined;
17
+ const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
18
+ feeExecutionPayload,
19
+ ...requests
20
+ ]) : mergeExecutionPayloads([
21
+ ...requests
22
+ ]);
23
+ return finalExecutionPayload;
36
24
  }
37
25
  /**
38
26
  * Simulate a transaction and get its return values
@@ -43,7 +31,7 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
43
31
  * @param options - An optional object containing additional configuration for the transaction.
44
32
  * @returns The result of the transaction as returned by the contract function.
45
33
  */ async simulate(options) {
46
- const { indexedExecutionPayloads, utility } = (await this.getRequests()).reduce((acc, current, index)=>{
34
+ const { indexedExecutionPayloads, utility } = (await this.getExecutionPayloads()).reduce((acc, current, index)=>{
47
35
  const call = current.calls[0];
48
36
  if (call.type === FunctionType.UTILITY) {
49
37
  acc.utility.push([
@@ -66,36 +54,38 @@ import { BaseContractInteraction } from './base_contract_interaction.js';
66
54
  });
67
55
  const payloads = indexedExecutionPayloads.map(([request])=>request);
68
56
  const combinedPayload = mergeExecutionPayloads(payloads);
69
- const requestWithoutFee = new ExecutionPayload(combinedPayload.calls, combinedPayload.authWitnesses.concat(options.authWitnesses ?? []), combinedPayload.capsules.concat(options.capsules ?? []), combinedPayload.extraHashedArgs);
70
- const { fee: userFee, txNonce, cancellable } = options;
71
- const fee = await this.getFeeOptions(requestWithoutFee, userFee, {});
72
- const txRequest = await this.wallet.createTxExecutionRequest(requestWithoutFee, fee, {
73
- txNonce,
74
- cancellable
75
- });
76
- const utilityCalls = utility.map(async ([call, index])=>[
77
- await this.wallet.simulateUtility(call.name, call.args, call.to, options?.authWitnesses, options?.from),
78
- index
79
- ]);
80
- const [utilityResults, simulatedTx] = await Promise.all([
81
- Promise.all(utilityCalls),
82
- this.wallet.simulateTx(txRequest, true, options?.skipTxValidation, false)
57
+ const executionPayload = new ExecutionPayload(combinedPayload.calls, combinedPayload.authWitnesses.concat(options.authWitnesses ?? []), combinedPayload.capsules.concat(options.capsules ?? []), combinedPayload.extraHashedArgs);
58
+ const utilityBatchPromise = utility.length > 0 ? this.wallet.batch(utility.map(([call])=>({
59
+ name: 'simulateUtility',
60
+ args: [
61
+ call.name,
62
+ call.args,
63
+ call.to,
64
+ options?.authWitnesses
65
+ ]
66
+ }))) : Promise.resolve([]);
67
+ const [utilityBatchResults, simulatedTx] = await Promise.all([
68
+ utilityBatchPromise,
69
+ indexedExecutionPayloads.length > 0 ? this.wallet.simulateTx(executionPayload, await toSimulateOptions(options)) : Promise.resolve()
83
70
  ]);
84
71
  const results = [];
85
- utilityResults.forEach(([{ result }, index])=>{
86
- results[index] = result;
87
- });
88
- indexedExecutionPayloads.forEach(([request, callIndex, resultIndex])=>{
89
- const call = request.calls[0];
90
- // As account entrypoints are private, for private functions we retrieve the return values from the first nested call
91
- // since we're interested in the first set of values AFTER the account entrypoint
92
- // For public functions we retrieve the first values directly from the public output.
93
- const rawReturnValues = call.type == FunctionType.PRIVATE ? simulatedTx.getPrivateReturnValues()?.nested?.[resultIndex].values : simulatedTx.getPublicReturnValues()?.[resultIndex].values;
94
- results[callIndex] = rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [];
72
+ utilityBatchResults.forEach((wrappedResult, utilityIndex)=>{
73
+ const [, originalIndex] = utility[utilityIndex];
74
+ results[originalIndex] = wrappedResult.result.result;
95
75
  });
76
+ if (simulatedTx) {
77
+ indexedExecutionPayloads.forEach(([request, callIndex, resultIndex])=>{
78
+ const call = request.calls[0];
79
+ // As account entrypoints are private, for private functions we retrieve the return values from the first nested call
80
+ // since we're interested in the first set of values AFTER the account entrypoint
81
+ // For public functions we retrieve the first values directly from the public output.
82
+ const rawReturnValues = call.type == FunctionType.PRIVATE ? simulatedTx.getPrivateReturnValues()?.nested?.[resultIndex].values : simulatedTx.getPublicReturnValues()?.[resultIndex].values;
83
+ results[callIndex] = rawReturnValues ? decodeFromAbi(call.returnTypes, rawReturnValues) : [];
84
+ });
85
+ }
96
86
  return results;
97
87
  }
98
- async getRequests() {
99
- return await Promise.all(this.calls.map((c)=>c.request()));
88
+ async getExecutionPayloads() {
89
+ return await Promise.all(this.interactions.map((i)=>i instanceof ExecutionPayload ? i : i.request()));
100
90
  }
101
91
  }
@@ -8,7 +8,7 @@ import { DeployMethod } from './deploy_method.js';
8
8
  * The Contract class represents a contract and provides utility methods for interacting with it.
9
9
  * It enables the creation of ContractFunctionInteraction instances for each function in the contract's ABI,
10
10
  * allowing users to call or send transactions to these functions. Additionally, the Contract class can be used
11
- * to attach the contract instance to a deployed contract on-chain through the PXE, which facilitates
11
+ * to attach the contract instance to a deployed contract onchain through the PXE, which facilitates
12
12
  * interaction with Aztec's privacy protocol.
13
13
  */
14
14
  export declare class Contract extends ContractBase {
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC;;;;;;OAMG;WACiB,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAc5G;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM;IAKtG;;;;;;;;OAQG;WACW,oBAAoB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,CAAC,EAAE,MAAM;CAK3B"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,YAAY;IACxC;;;;;;OAMG;WACiB,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAK5G;;;;;;OAMG;WACW,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,EAAE,MAAM;IAKtG;;;;;;;;OAQG;WACW,oBAAoB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,GAAG,EAAE,EACX,eAAe,CAAC,EAAE,MAAM;CAK3B"}
@@ -1,4 +1,3 @@
1
- import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
2
1
  import { PublicKeys } from '@aztec/stdlib/keys';
3
2
  import { ContractBase } from './contract_base.js';
4
3
  import { DeployMethod } from './deploy_method.js';
@@ -6,7 +5,7 @@ import { DeployMethod } from './deploy_method.js';
6
5
  * The Contract class represents a contract and provides utility methods for interacting with it.
7
6
  * It enables the creation of ContractFunctionInteraction instances for each function in the contract's ABI,
8
7
  * allowing users to call or send transactions to these functions. Additionally, the Contract class can be used
9
- * to attach the contract instance to a deployed contract on-chain through the PXE, which facilitates
8
+ * to attach the contract instance to a deployed contract onchain through the PXE, which facilitates
10
9
  * interaction with Aztec's privacy protocol.
11
10
  */ export class Contract extends ContractBase {
12
11
  /**
@@ -16,16 +15,7 @@ import { DeployMethod } from './deploy_method.js';
16
15
  * @param wallet - The wallet to use when interacting with the contract.
17
16
  * @returns A promise that resolves to a new Contract instance.
18
17
  */ static async at(address, artifact, wallet) {
19
- const instance = (await wallet.getContractMetadata(address)).contractInstance;
20
- if (instance === undefined) {
21
- throw new Error(`Contract instance at ${address.toString()} has not been registered in the wallet's PXE`);
22
- }
23
- const thisContractClass = await getContractClassFromArtifact(artifact);
24
- if (!thisContractClass.id.equals(instance.currentContractClassId)) {
25
- // wallet holds an outdated version of this contract
26
- await wallet.updateContract(address, artifact);
27
- instance.currentContractClassId = thisContractClass.id;
28
- }
18
+ const instance = await wallet.registerContract(address, artifact);
29
19
  return new Contract(instance, artifact, wallet);
30
20
  }
31
21
  /**