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

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 (326) hide show
  1. package/README.md +1 -1
  2. package/dest/account/account.d.ts +59 -0
  3. package/dest/account/account.d.ts.map +1 -0
  4. package/dest/account/account.js +59 -0
  5. package/dest/account/account_contract.d.ts +7 -7
  6. package/dest/account/account_contract.d.ts.map +1 -1
  7. package/dest/account/account_contract.js +0 -1
  8. package/dest/account/account_with_secret_key.d.ts +24 -0
  9. package/dest/account/account_with_secret_key.d.ts.map +1 -0
  10. package/dest/{wallet/account_wallet_with_private_key.js → account/account_with_secret_key.js} +5 -5
  11. package/dest/account/index.d.ts +3 -6
  12. package/dest/account/index.d.ts.map +1 -1
  13. package/dest/account/index.js +1 -4
  14. package/dest/account/interface.d.ts +2 -2
  15. package/dest/account/interface.d.ts.map +1 -1
  16. package/dest/account/signerless_account.d.ts +23 -0
  17. package/dest/account/signerless_account.d.ts.map +1 -0
  18. package/dest/account/signerless_account.js +27 -0
  19. package/dest/api/abi.d.ts +2 -1
  20. package/dest/api/abi.d.ts.map +1 -1
  21. package/dest/api/account.d.ts +6 -3
  22. package/dest/api/account.d.ts.map +1 -1
  23. package/dest/api/account.js +4 -1
  24. package/dest/api/addresses.d.ts +2 -1
  25. package/dest/api/addresses.d.ts.map +1 -1
  26. package/dest/api/addresses.js +1 -0
  27. package/dest/api/authorization.d.ts +3 -1
  28. package/dest/api/authorization.d.ts.map +1 -1
  29. package/dest/api/authorization.js +2 -0
  30. package/dest/api/block.d.ts +3 -0
  31. package/dest/api/block.d.ts.map +1 -0
  32. package/dest/api/block.js +2 -0
  33. package/dest/api/contract.d.ts +8 -9
  34. package/dest/api/contract.d.ts.map +1 -1
  35. package/dest/api/contract.js +6 -6
  36. package/dest/api/crypto.d.ts +2 -0
  37. package/dest/api/crypto.d.ts.map +1 -0
  38. package/dest/api/crypto.js +1 -0
  39. package/dest/api/deployment.d.ts +1 -1
  40. package/dest/api/eth_address.d.ts +1 -1
  41. package/dest/api/ethereum.d.ts +1 -2
  42. package/dest/api/ethereum.d.ts.map +1 -1
  43. package/dest/api/ethereum.js +0 -1
  44. package/dest/api/events.d.ts +12 -0
  45. package/dest/api/events.d.ts.map +1 -0
  46. package/dest/api/events.js +30 -0
  47. package/dest/api/fee.d.ts +2 -3
  48. package/dest/api/fee.d.ts.map +1 -1
  49. package/dest/api/fee.js +0 -1
  50. package/dest/api/fee_testing.d.ts +1 -1
  51. package/dest/api/fields.d.ts +3 -2
  52. package/dest/api/fields.d.ts.map +1 -1
  53. package/dest/api/fields.js +2 -1
  54. package/dest/api/keys.d.ts +4 -0
  55. package/dest/api/keys.d.ts.map +1 -0
  56. package/dest/api/keys.js +3 -0
  57. package/dest/api/log.d.ts +2 -1
  58. package/dest/api/log.d.ts.map +1 -1
  59. package/dest/api/log.js +1 -0
  60. package/dest/api/messaging.d.ts +3 -0
  61. package/dest/api/messaging.d.ts.map +1 -0
  62. package/dest/api/messaging.js +2 -0
  63. package/dest/api/node.d.ts +21 -0
  64. package/dest/api/node.d.ts.map +1 -0
  65. package/dest/api/node.js +18 -0
  66. package/dest/api/note.d.ts +2 -0
  67. package/dest/api/note.d.ts.map +1 -0
  68. package/dest/api/note.js +1 -0
  69. package/dest/api/protocol.d.ts +3 -0
  70. package/dest/api/protocol.d.ts.map +1 -0
  71. package/dest/api/protocol.js +2 -0
  72. package/dest/api/trees.d.ts +3 -0
  73. package/dest/api/trees.d.ts.map +1 -0
  74. package/dest/api/trees.js +2 -0
  75. package/dest/api/tx.d.ts +2 -0
  76. package/dest/api/tx.d.ts.map +1 -0
  77. package/dest/api/tx.js +1 -0
  78. package/dest/api/utils.d.ts +11 -7
  79. package/dest/api/utils.d.ts.map +1 -1
  80. package/dest/api/utils.js +10 -5
  81. package/dest/api/wallet.d.ts +4 -2
  82. package/dest/api/wallet.d.ts.map +1 -1
  83. package/dest/api/wallet.js +3 -1
  84. package/dest/authorization/call_authorization_request.d.ts +2 -23
  85. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  86. package/dest/contract/base_contract_interaction.d.ts +7 -50
  87. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  88. package/dest/contract/base_contract_interaction.js +6 -106
  89. package/dest/contract/batch_call.d.ts +14 -23
  90. package/dest/contract/batch_call.d.ts.map +1 -1
  91. package/dest/contract/batch_call.js +72 -64
  92. package/dest/contract/checker.d.ts +1 -1
  93. package/dest/contract/contract.d.ts +3 -3
  94. package/dest/contract/contract.d.ts.map +1 -1
  95. package/dest/contract/contract.js +5 -16
  96. package/dest/contract/contract_base.d.ts +5 -12
  97. package/dest/contract/contract_base.d.ts.map +1 -1
  98. package/dest/contract/contract_base.js +5 -12
  99. package/dest/contract/contract_function_interaction.d.ts +32 -43
  100. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  101. package/dest/contract/contract_function_interaction.js +47 -56
  102. package/dest/contract/deploy_method.d.ts +69 -61
  103. package/dest/contract/deploy_method.d.ts.map +1 -1
  104. package/dest/contract/deploy_method.js +72 -88
  105. package/dest/contract/deploy_sent_tx.d.ts +12 -8
  106. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  107. package/dest/contract/deploy_sent_tx.js +15 -12
  108. package/dest/contract/get_gas_limits.d.ts +1 -1
  109. package/dest/contract/interaction_options.d.ts +76 -21
  110. package/dest/contract/interaction_options.d.ts.map +1 -1
  111. package/dest/contract/interaction_options.js +45 -3
  112. package/dest/contract/protocol_contracts.d.ts +1 -1
  113. package/dest/contract/sent_tx.d.ts +5 -6
  114. package/dest/contract/sent_tx.d.ts.map +1 -1
  115. package/dest/contract/sent_tx.js +6 -6
  116. package/dest/contract/unsafe_contract.d.ts +1 -1
  117. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  118. package/dest/contract/unsafe_contract.js +1 -1
  119. package/dest/contract/wait_for_proven.d.ts +4 -4
  120. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  121. package/dest/contract/wait_for_proven.js +2 -2
  122. package/dest/deployment/broadcast_function.d.ts +1 -1
  123. package/dest/deployment/broadcast_function.js +1 -1
  124. package/dest/deployment/contract_deployer.d.ts +1 -1
  125. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  126. package/dest/deployment/contract_deployer.js +1 -1
  127. package/dest/deployment/publish_class.d.ts +1 -1
  128. package/dest/deployment/publish_class.js +1 -1
  129. package/dest/deployment/publish_instance.d.ts +2 -2
  130. package/dest/deployment/publish_instance.d.ts.map +1 -1
  131. package/dest/deployment/publish_instance.js +2 -5
  132. package/dest/ethereum/portal_manager.d.ts +7 -10
  133. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  134. package/dest/ethereum/portal_manager.js +43 -19
  135. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +14 -9
  136. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  137. package/dest/fee/fee_juice_payment_method_with_claim.js +24 -15
  138. package/dest/fee/fee_payment_method.d.ts +26 -0
  139. package/dest/fee/fee_payment_method.d.ts.map +1 -0
  140. package/dest/fee/fee_payment_method.js +3 -0
  141. package/dest/fee/private_fee_payment_method.d.ts +24 -7
  142. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  143. package/dest/fee/private_fee_payment_method.js +38 -17
  144. package/dest/fee/public_fee_payment_method.d.ts +24 -7
  145. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  146. package/dest/fee/public_fee_payment_method.js +41 -18
  147. package/dest/fee/sponsored_fee_payment.d.ts +4 -2
  148. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
  149. package/dest/fee/sponsored_fee_payment.js +6 -2
  150. package/dest/utils/abi_types.d.ts +2 -2
  151. package/dest/utils/abi_types.d.ts.map +1 -1
  152. package/dest/utils/authwit.d.ts +80 -28
  153. package/dest/utils/authwit.d.ts.map +1 -1
  154. package/dest/utils/authwit.js +231 -25
  155. package/dest/utils/cross_chain.d.ts +24 -0
  156. package/dest/utils/cross_chain.d.ts.map +1 -0
  157. package/dest/utils/cross_chain.js +30 -0
  158. package/dest/utils/fee_juice.d.ts +4 -3
  159. package/dest/utils/fee_juice.d.ts.map +1 -1
  160. package/dest/utils/fee_juice.js +4 -3
  161. package/dest/utils/field_compressed_string.d.ts +1 -1
  162. package/dest/utils/field_compressed_string.d.ts.map +1 -1
  163. package/dest/utils/field_compressed_string.js +1 -1
  164. package/dest/utils/node.d.ts +2 -2
  165. package/dest/utils/node.d.ts.map +1 -1
  166. package/dest/utils/pub_key.d.ts +2 -2
  167. package/dest/utils/pub_key.d.ts.map +1 -1
  168. package/dest/utils/pub_key.js +2 -3
  169. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +34 -0
  170. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
  171. package/dest/wallet/account_entrypoint_meta_payment_method.js +76 -0
  172. package/dest/wallet/account_manager.d.ts +66 -0
  173. package/dest/wallet/account_manager.d.ts.map +1 -0
  174. package/dest/wallet/account_manager.js +113 -0
  175. package/dest/wallet/deploy_account_method.d.ts +52 -0
  176. package/dest/wallet/deploy_account_method.d.ts.map +1 -0
  177. package/dest/wallet/deploy_account_method.js +77 -0
  178. package/dest/wallet/index.d.ts +2 -16
  179. package/dest/wallet/index.d.ts.map +1 -1
  180. package/dest/wallet/index.js +1 -19
  181. package/dest/wallet/wallet.d.ts +2012 -7
  182. package/dest/wallet/wallet.d.ts.map +1 -1
  183. package/dest/wallet/wallet.js +198 -3
  184. package/package.json +29 -24
  185. package/src/account/account.ts +96 -0
  186. package/src/account/account_contract.ts +5 -7
  187. package/src/{wallet/account_wallet_with_private_key.ts → account/account_with_secret_key.ts} +7 -9
  188. package/src/account/index.ts +2 -5
  189. package/src/account/interface.ts +1 -1
  190. package/src/account/signerless_account.ts +45 -0
  191. package/src/api/abi.ts +11 -0
  192. package/src/api/account.ts +5 -2
  193. package/src/api/addresses.ts +1 -0
  194. package/src/api/authorization.ts +11 -0
  195. package/src/api/block.ts +2 -0
  196. package/src/api/contract.ts +20 -11
  197. package/src/api/crypto.ts +1 -0
  198. package/src/api/ethereum.ts +0 -1
  199. package/src/api/events.ts +44 -0
  200. package/src/api/fee.ts +1 -2
  201. package/src/api/fields.ts +2 -1
  202. package/src/api/keys.ts +8 -0
  203. package/src/api/log.ts +1 -0
  204. package/src/api/messaging.ts +2 -0
  205. package/src/api/node.ts +20 -0
  206. package/src/api/note.ts +1 -0
  207. package/src/api/protocol.ts +2 -0
  208. package/src/api/trees.ts +2 -0
  209. package/src/api/tx.ts +13 -0
  210. package/src/api/utils.ts +12 -19
  211. package/src/api/wallet.ts +31 -5
  212. package/src/authorization/call_authorization_request.ts +1 -1
  213. package/src/contract/base_contract_interaction.ts +9 -139
  214. package/src/contract/batch_call.ts +87 -79
  215. package/src/contract/contract.ts +8 -16
  216. package/src/contract/contract_base.ts +5 -15
  217. package/src/contract/contract_function_interaction.ts +72 -105
  218. package/src/contract/deploy_method.ts +123 -104
  219. package/src/contract/deploy_sent_tx.ts +19 -18
  220. package/src/contract/interaction_options.ts +121 -25
  221. package/src/contract/sent_tx.ts +6 -7
  222. package/src/contract/unsafe_contract.ts +1 -1
  223. package/src/contract/wait_for_proven.ts +4 -4
  224. package/src/deployment/broadcast_function.ts +1 -1
  225. package/src/deployment/contract_deployer.ts +3 -2
  226. package/src/deployment/publish_class.ts +1 -1
  227. package/src/deployment/publish_instance.ts +3 -8
  228. package/src/ethereum/portal_manager.ts +62 -40
  229. package/src/fee/fee_juice_payment_method_with_claim.ts +30 -19
  230. package/src/fee/fee_payment_method.ts +26 -0
  231. package/src/fee/private_fee_payment_method.ts +64 -43
  232. package/src/fee/public_fee_payment_method.ts +77 -51
  233. package/src/fee/sponsored_fee_payment.ts +9 -1
  234. package/src/utils/abi_types.ts +1 -1
  235. package/src/utils/authwit.ts +257 -39
  236. package/src/utils/cross_chain.ts +53 -0
  237. package/src/utils/fee_juice.ts +5 -4
  238. package/src/utils/field_compressed_string.ts +1 -1
  239. package/src/utils/pub_key.ts +3 -4
  240. package/src/wallet/account_entrypoint_meta_payment_method.ts +106 -0
  241. package/src/wallet/account_manager.ts +154 -0
  242. package/src/wallet/deploy_account_method.ts +126 -0
  243. package/src/wallet/index.ts +1 -32
  244. package/src/wallet/wallet.ts +358 -29
  245. package/dest/account_manager/account_manager.d.ts +0 -119
  246. package/dest/account_manager/account_manager.d.ts.map +0 -1
  247. package/dest/account_manager/account_manager.js +0 -202
  248. package/dest/account_manager/deploy_account_sent_tx.d.ts +0 -30
  249. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +0 -1
  250. package/dest/account_manager/deploy_account_sent_tx.js +0 -29
  251. package/dest/account_manager/index.d.ts +0 -3
  252. package/dest/account_manager/index.d.ts.map +0 -1
  253. package/dest/account_manager/index.js +0 -2
  254. package/dest/api/interfaces.d.ts +0 -2
  255. package/dest/api/interfaces.d.ts.map +0 -1
  256. package/dest/api/interfaces.js +0 -1
  257. package/dest/api/log_id.d.ts +0 -2
  258. package/dest/api/log_id.d.ts.map +0 -1
  259. package/dest/api/log_id.js +0 -1
  260. package/dest/api/rpc.d.ts +0 -3
  261. package/dest/api/rpc.d.ts.map +0 -1
  262. package/dest/api/rpc.js +0 -2
  263. package/dest/api/tx_hash.d.ts +0 -2
  264. package/dest/api/tx_hash.d.ts.map +0 -1
  265. package/dest/api/tx_hash.js +0 -1
  266. package/dest/contract/deploy_proven_tx.d.ts +0 -21
  267. package/dest/contract/deploy_proven_tx.d.ts.map +0 -1
  268. package/dest/contract/deploy_proven_tx.js +0 -21
  269. package/dest/contract/proven_tx.d.ts +0 -21
  270. package/dest/contract/proven_tx.d.ts.map +0 -1
  271. package/dest/contract/proven_tx.js +0 -23
  272. package/dest/ethereum/l1_contracts.d.ts +0 -3
  273. package/dest/ethereum/l1_contracts.d.ts.map +0 -1
  274. package/dest/ethereum/l1_contracts.js +0 -13
  275. package/dest/fee/account_entrypoint_meta_payment_method.d.ts +0 -31
  276. package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +0 -1
  277. package/dest/fee/account_entrypoint_meta_payment_method.js +0 -64
  278. package/dest/fee/fee_juice_payment_method.d.ts +0 -14
  279. package/dest/fee/fee_juice_payment_method.d.ts.map +0 -1
  280. package/dest/fee/fee_juice_payment_method.js +0 -21
  281. package/dest/fee/utils.d.ts +0 -13
  282. package/dest/fee/utils.d.ts.map +0 -1
  283. package/dest/fee/utils.js +0 -32
  284. package/dest/index.d.ts +0 -59
  285. package/dest/index.d.ts.map +0 -1
  286. package/dest/index.js +0 -62
  287. package/dest/rpc_clients/node/index.d.ts +0 -12
  288. package/dest/rpc_clients/node/index.d.ts.map +0 -1
  289. package/dest/rpc_clients/node/index.js +0 -72
  290. package/dest/rpc_clients/pxe_client.d.ts +0 -10
  291. package/dest/rpc_clients/pxe_client.d.ts.map +0 -1
  292. package/dest/rpc_clients/pxe_client.js +0 -23
  293. package/dest/utils/pxe.d.ts +0 -4
  294. package/dest/utils/pxe.d.ts.map +0 -1
  295. package/dest/utils/pxe.js +0 -14
  296. package/dest/wallet/account_wallet.d.ts +0 -74
  297. package/dest/wallet/account_wallet.d.ts.map +0 -1
  298. package/dest/wallet/account_wallet.js +0 -232
  299. package/dest/wallet/account_wallet_with_private_key.d.ts +0 -26
  300. package/dest/wallet/account_wallet_with_private_key.d.ts.map +0 -1
  301. package/dest/wallet/base_wallet.d.ts +0 -48
  302. package/dest/wallet/base_wallet.d.ts.map +0 -1
  303. package/dest/wallet/base_wallet.js +0 -70
  304. package/dest/wallet/signerless_wallet.d.ts +0 -23
  305. package/dest/wallet/signerless_wallet.d.ts.map +0 -1
  306. package/dest/wallet/signerless_wallet.js +0 -33
  307. package/src/account_manager/account_manager.ts +0 -276
  308. package/src/account_manager/deploy_account_sent_tx.ts +0 -46
  309. package/src/account_manager/index.ts +0 -2
  310. package/src/api/interfaces.ts +0 -1
  311. package/src/api/log_id.ts +0 -1
  312. package/src/api/rpc.ts +0 -2
  313. package/src/api/tx_hash.ts +0 -1
  314. package/src/contract/deploy_proven_tx.ts +0 -45
  315. package/src/contract/proven_tx.ts +0 -36
  316. package/src/ethereum/l1_contracts.ts +0 -21
  317. package/src/fee/account_entrypoint_meta_payment_method.ts +0 -89
  318. package/src/fee/fee_juice_payment_method.ts +0 -25
  319. package/src/fee/utils.ts +0 -39
  320. package/src/index.ts +0 -85
  321. package/src/rpc_clients/node/index.ts +0 -77
  322. package/src/rpc_clients/pxe_client.ts +0 -25
  323. package/src/utils/pxe.ts +0 -17
  324. package/src/wallet/account_wallet.ts +0 -246
  325. package/src/wallet/base_wallet.ts +0 -141
  326. package/src/wallet/signerless_wallet.ts +0 -56
@@ -1,34 +1,363 @@
1
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
2
- import type { PXE } from '@aztec/stdlib/interfaces/client';
1
+ import type { ChainInfo } from '@aztec/entrypoints/interfaces';
2
+ import { BlockNumber, BlockNumberPositiveSchema } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
4
+ import {
5
+ type AbiDecoded,
6
+ AbiTypeSchema,
7
+ type ContractArtifact,
8
+ ContractArtifactSchema,
9
+ type EventMetadataDefinition,
10
+ type FunctionCall,
11
+ FunctionType,
12
+ } from '@aztec/stdlib/abi';
13
+ import { AuthWitness } from '@aztec/stdlib/auth-witness';
14
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
15
+ import {
16
+ type ContractClassMetadata,
17
+ ContractClassWithIdSchema,
18
+ type ContractInstanceWithAddress,
19
+ ContractInstanceWithAddressSchema,
20
+ type ContractMetadata,
21
+ } from '@aztec/stdlib/contract';
22
+ import { Gas } from '@aztec/stdlib/gas';
23
+ import { AbiDecodedSchema, type ApiSchemaFor, type ZodFor, optional, schemas } from '@aztec/stdlib/schemas';
24
+ import {
25
+ Capsule,
26
+ HashedValues,
27
+ TxHash,
28
+ TxProfileResult,
29
+ TxReceipt,
30
+ TxSimulationResult,
31
+ UtilitySimulationResult,
32
+ inTxSchema,
33
+ } from '@aztec/stdlib/tx';
34
+ import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
3
35
 
4
- import type { AccountInterface } from '../account/interface.js';
5
- import type { IntentAction, IntentInnerHash } from '../utils/authwit.js';
36
+ import { z } from 'zod';
37
+
38
+ import type {
39
+ FeeEstimationOptions,
40
+ GasSettingsOption,
41
+ ProfileInteractionOptions,
42
+ SendInteractionOptions,
43
+ SimulateInteractionOptions,
44
+ } from '../contract/interaction_options.js';
45
+ import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
46
+
47
+ /**
48
+ * A wrapper type that allows any item to be associated with an alias.
49
+ */
50
+ export type Aliased<T> = {
51
+ /**
52
+ * The alias
53
+ */
54
+ alias: string;
55
+ /**
56
+ * The item being aliased.
57
+ */
58
+ item: T;
59
+ };
60
+
61
+ /**
62
+ * Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with
63
+ * a simplified version that only hints at the wallet wether the interaction contains a
64
+ * fee payment method or not
65
+ */
66
+ export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
67
+ /** The fee options */
68
+ fee?: GasSettingsOption & FeeEstimationOptions;
69
+ };
70
+
71
+ /**
72
+ * Options for profiling interactions with the wallet. Overrides the fee settings of an interaction with
73
+ * a simplified version that only hints at the wallet wether the interaction contains a
74
+ * fee payment method or not
75
+ */
76
+ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
77
+ /** The fee options */
78
+ fee?: GasSettingsOption;
79
+ };
80
+
81
+ /**
82
+ * Options for sending/proving interactions with the wallet. Overrides the fee settings of an interaction with
83
+ * a simplified version that only hints at the wallet wether the interaction contains a
84
+ * fee payment method or not
85
+ */
86
+ export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
87
+ /** The fee options */
88
+ fee?: GasSettingsOption;
89
+ };
90
+
91
+ /**
92
+ * Helper type that represents all methods that can be batched.
93
+ */
94
+ export type BatchableMethods = Pick<
95
+ Wallet,
96
+ 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility' | 'simulateTx'
97
+ >;
98
+
99
+ /**
100
+ * From the batchable methods, we create a type that represents a method call with its name and arguments.
101
+ * This is what the wallet will accept as arguments to the `batch` method.
102
+ */
103
+ export type BatchedMethod<T extends keyof BatchableMethods> = {
104
+ /** The method name */
105
+ name: T;
106
+ /** The method arguments */
107
+ args: Parameters<BatchableMethods[T]>;
108
+ };
109
+
110
+ /**
111
+ * Helper type to extract the return type of a batched method
112
+ */
113
+ export type BatchedMethodResult<T> =
114
+ T extends BatchedMethod<infer K> ? Awaited<ReturnType<BatchableMethods[K]>> : never;
115
+
116
+ /**
117
+ * Wrapper type for batch results that includes the method name for discriminated union deserialization.
118
+ * Each result is wrapped as \{ name: 'methodName', result: ActualResult \} to allow proper deserialization
119
+ * when AztecAddress and TxHash would otherwise be ambiguous (both are hex strings).
120
+ */
121
+ export type BatchedMethodResultWrapper<T extends BatchedMethod<keyof BatchableMethods>> = {
122
+ /** The method name */
123
+ name: T['name'];
124
+ /** The method result */
125
+ result: BatchedMethodResult<T>;
126
+ };
127
+
128
+ /**
129
+ * Maps a tuple of BatchedMethod to a tuple of their wrapped return types
130
+ */
131
+ export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods>[]> = {
132
+ [K in keyof T]: BatchedMethodResultWrapper<T[K]>;
133
+ };
134
+
135
+ /**
136
+ * Filter options when querying private events.
137
+ */
138
+ export type PrivateEventFilter = {
139
+ /** The address of the contract that emitted the events. */
140
+ contractAddress: AztecAddress;
141
+ /** Addresses of accounts that are in scope for this filter. */
142
+ scopes: AztecAddress[];
143
+ /** Transaction in which the events were emitted. */
144
+ txHash?: TxHash;
145
+ /** The block number from which to start fetching events (inclusive).
146
+ * Optional. If provided, it must be greater or equal than 1.
147
+ * Defaults to the initial L2 block number (INITIAL_L2_BLOCK_NUM).
148
+ * */
149
+ fromBlock?: BlockNumber;
150
+ /** The block number until which to fetch logs (not inclusive).
151
+ * Optional. If provided, it must be greater than fromBlock.
152
+ * Defaults to the latest known block to PXE + 1.
153
+ */
154
+ toBlock?: BlockNumber;
155
+ };
156
+
157
+ /**
158
+ * An ABI decoded private event with associated metadata.
159
+ */
160
+ export type PrivateEvent<T> = {
161
+ /** The ABI decoded event */
162
+ event: T;
163
+ /** Metadata describing event context information such as tx and block */
164
+ metadata: InTx;
165
+ };
6
166
 
7
167
  /**
8
168
  * The wallet interface.
9
169
  */
10
- export type Wallet = AccountInterface &
11
- Pick<
12
- PXE,
13
- | 'simulateTx'
14
- | 'simulateUtility'
15
- | 'profileTx'
16
- | 'sendTx'
17
- | 'getContractClassMetadata'
18
- | 'getContractMetadata'
19
- | 'registerContract'
20
- | 'registerContractClass'
21
- | 'proveTx'
22
- | 'getNodeInfo'
23
- | 'getPXEInfo'
24
- | 'getCurrentBaseFees'
25
- | 'updateContract'
26
- | 'registerSender'
27
- | 'getSenders'
28
- | 'removeSender'
29
- | 'getTxReceipt'
30
- | 'getPrivateEvents'
31
- | 'getPublicEvents'
32
- > & {
33
- createAuthWit(intent: IntentInnerHash | IntentAction): Promise<AuthWitness>;
34
- };
170
+ export type Wallet = {
171
+ getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
172
+ getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
173
+ getPrivateEvents<T>(
174
+ eventMetadata: EventMetadataDefinition,
175
+ eventFilter: PrivateEventFilter,
176
+ ): Promise<PrivateEvent<T>[]>;
177
+ getChainInfo(): Promise<ChainInfo>;
178
+ getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
179
+ registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
180
+ getAddressBook(): Promise<Aliased<AztecAddress>[]>;
181
+ getAccounts(): Promise<Aliased<AztecAddress>[]>;
182
+ registerContract(
183
+ instance: ContractInstanceWithAddress,
184
+ artifact?: ContractArtifact,
185
+ secretKey?: Fr,
186
+ ): Promise<ContractInstanceWithAddress>;
187
+ simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
188
+ simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
189
+ profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
190
+ sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
191
+ createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | IntentInnerHash | CallIntent): Promise<AuthWitness>;
192
+ batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
193
+ };
194
+
195
+ export const FunctionCallSchema = z.object({
196
+ name: z.string(),
197
+ to: schemas.AztecAddress,
198
+ selector: schemas.FunctionSelector,
199
+ type: z.nativeEnum(FunctionType),
200
+ isStatic: z.boolean(),
201
+ hideMsgSender: z.boolean(),
202
+ args: z.array(schemas.Fr),
203
+ returnTypes: z.array(AbiTypeSchema),
204
+ });
205
+
206
+ export const ExecutionPayloadSchema = z.object({
207
+ calls: z.array(FunctionCallSchema),
208
+ authWitnesses: z.array(AuthWitness.schema),
209
+ capsules: z.array(Capsule.schema),
210
+ extraHashedArgs: z.array(HashedValues.schema),
211
+ feePayer: optional(schemas.AztecAddress),
212
+ });
213
+
214
+ export const GasSettingsOptionSchema = z.object({
215
+ gasSettings: optional(
216
+ z.object({
217
+ gasLimits: optional(Gas.schema),
218
+ teardownGasLimits: optional(Gas.schema),
219
+ maxFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
220
+ maxPriorityFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
221
+ }),
222
+ ),
223
+ });
224
+
225
+ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
226
+ estimatedGasPadding: optional(z.number()),
227
+ estimateGas: optional(z.boolean()),
228
+ });
229
+
230
+ export const SendOptionsSchema = z.object({
231
+ from: schemas.AztecAddress,
232
+ authWitnesses: optional(z.array(AuthWitness.schema)),
233
+ capsules: optional(z.array(Capsule.schema)),
234
+ fee: optional(GasSettingsOptionSchema),
235
+ });
236
+
237
+ export const SimulateOptionsSchema = z.object({
238
+ from: schemas.AztecAddress,
239
+ authWitnesses: optional(z.array(AuthWitness.schema)),
240
+ capsules: optional(z.array(Capsule.schema)),
241
+ fee: optional(WalletSimulationFeeOptionSchema),
242
+ skipTxValidation: optional(z.boolean()),
243
+ skipFeeEnforcement: optional(z.boolean()),
244
+ includeMetadata: optional(z.boolean()),
245
+ });
246
+
247
+ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
248
+ profileMode: z.enum(['gates', 'execution-steps', 'full']),
249
+ skipProofGeneration: optional(z.boolean()),
250
+ });
251
+
252
+ export const MessageHashOrIntentSchema = z.union([
253
+ schemas.Fr,
254
+ z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
255
+ z.object({
256
+ caller: schemas.AztecAddress,
257
+ call: FunctionCallSchema,
258
+ }),
259
+ ]);
260
+
261
+ export const BatchedMethodSchema = z.union([
262
+ z.object({
263
+ name: z.literal('registerSender'),
264
+ args: z.tuple([schemas.AztecAddress, optional(z.string())]),
265
+ }),
266
+ z.object({
267
+ name: z.literal('registerContract'),
268
+ args: z.tuple([ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
269
+ }),
270
+ z.object({
271
+ name: z.literal('sendTx'),
272
+ args: z.tuple([ExecutionPayloadSchema, SendOptionsSchema]),
273
+ }),
274
+ z.object({
275
+ name: z.literal('simulateUtility'),
276
+ args: z.tuple([FunctionCallSchema, optional(z.array(AuthWitness.schema))]),
277
+ }),
278
+ z.object({
279
+ name: z.literal('simulateTx'),
280
+ args: z.tuple([ExecutionPayloadSchema, SimulateOptionsSchema]),
281
+ }),
282
+ ]);
283
+
284
+ export const ContractMetadataSchema = z.object({
285
+ contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
286
+ isContractInitialized: z.boolean(),
287
+ isContractPublished: z.boolean(),
288
+ }) satisfies ZodFor<ContractMetadata>;
289
+
290
+ export const ContractClassMetadataSchema = z.object({
291
+ contractClass: z.union([ContractClassWithIdSchema, z.undefined()]),
292
+ isContractClassPubliclyRegistered: z.boolean(),
293
+ artifact: z.union([ContractArtifactSchema, z.undefined()]),
294
+ }) satisfies ZodFor<ContractClassMetadata>;
295
+
296
+ export const EventMetadataDefinitionSchema = z.object({
297
+ eventSelector: schemas.EventSelector,
298
+ abiType: AbiTypeSchema,
299
+ fieldNames: z.array(z.string()),
300
+ });
301
+
302
+ export const PrivateEventSchema: ZodFor<PrivateEvent<AbiDecoded>> = z.object({
303
+ event: AbiDecodedSchema,
304
+ metadata: inTxSchema(),
305
+ });
306
+
307
+ export const PrivateEventFilterSchema = z.object({
308
+ contractAddress: schemas.AztecAddress,
309
+ scopes: z.array(schemas.AztecAddress),
310
+ txHash: optional(TxHash.schema),
311
+ fromBlock: optional(BlockNumberPositiveSchema),
312
+ toBlock: optional(BlockNumberPositiveSchema),
313
+ });
314
+
315
+ export const WalletSchema: ApiSchemaFor<Wallet> = {
316
+ getChainInfo: z
317
+ .function()
318
+ .args()
319
+ .returns(z.object({ chainId: schemas.Fr, version: schemas.Fr })),
320
+ getContractClassMetadata: z.function().args(schemas.Fr, optional(z.boolean())).returns(ContractClassMetadataSchema),
321
+ getContractMetadata: z.function().args(schemas.AztecAddress).returns(ContractMetadataSchema),
322
+ getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
323
+ getPrivateEvents: z
324
+ .function()
325
+ .args(EventMetadataDefinitionSchema, PrivateEventFilterSchema)
326
+ .returns(z.array(PrivateEventSchema)),
327
+ registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
328
+ getAddressBook: z
329
+ .function()
330
+ .args()
331
+ .returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
332
+ getAccounts: z
333
+ .function()
334
+ .args()
335
+ .returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
336
+ registerContract: z
337
+ .function()
338
+ .args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
339
+ .returns(ContractInstanceWithAddressSchema),
340
+ simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
341
+ simulateUtility: z
342
+ .function()
343
+ .args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
344
+ .returns(UtilitySimulationResult.schema),
345
+ profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
346
+ sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
347
+ createAuthWit: z.function().args(schemas.AztecAddress, MessageHashOrIntentSchema).returns(AuthWitness.schema),
348
+ // @ts-expect-error - ApiSchemaFor cannot properly type generic methods with readonly arrays
349
+ batch: z
350
+ .function()
351
+ .args(z.array(BatchedMethodSchema))
352
+ .returns(
353
+ z.array(
354
+ z.discriminatedUnion('name', [
355
+ z.object({ name: z.literal('registerSender'), result: schemas.AztecAddress }),
356
+ z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
357
+ z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
358
+ z.object({ name: z.literal('simulateUtility'), result: UtilitySimulationResult.schema }),
359
+ z.object({ name: z.literal('simulateTx'), result: TxSimulationResult.schema }),
360
+ ]),
361
+ ),
362
+ ),
363
+ };
@@ -1,119 +0,0 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { CompleteAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { PXE } from '@aztec/stdlib/interfaces/client';
4
- import type { AccountContract } from '../account/account_contract.js';
5
- import type { Salt } from '../account/index.js';
6
- import type { AccountInterface } from '../account/interface.js';
7
- import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
8
- import { type WaitOpts } from '../contract/sent_tx.js';
9
- import { AccountEntrypointMetaPaymentMethod } from '../fee/account_entrypoint_meta_payment_method.js';
10
- import { AztecAddress, type FeePaymentMethod } from '../index.js';
11
- import { AccountWalletWithSecretKey, type Wallet } from '../wallet/index.js';
12
- import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
13
- /**
14
- * Options to deploy an account contract.
15
- */
16
- export type DeployAccountOptions = Pick<DeployOptions, 'fee' | 'skipClassPublication' | 'skipInstancePublication' | 'skipInitialization'> & {
17
- /**
18
- * Wallet used for any txs to initialize and/or publish the account contract. Must be funded in order to pay for the fee.
19
- */
20
- deployWallet?: Wallet;
21
- };
22
- /**
23
- * Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
24
- * and creating and registering the user wallet in the PXE Service.
25
- */
26
- export declare class AccountManager {
27
- private pxe;
28
- private secretKey;
29
- private accountContract;
30
- private instance;
31
- /**
32
- * Contract instantiation salt for the account contract
33
- */
34
- readonly salt: Salt;
35
- private constructor();
36
- static create(pxe: PXE, secretKey: Fr, accountContract: AccountContract, salt?: Salt): Promise<AccountManager>;
37
- protected getPublicKeys(): import("@aztec/stdlib/keys").PublicKeys;
38
- protected getPublicKeysHash(): Fr | Promise<Fr>;
39
- /**
40
- * Returns the entrypoint for this account as defined by its account contract.
41
- * @returns An entrypoint.
42
- */
43
- getAccount(): Promise<AccountInterface>;
44
- /**
45
- * Gets the calculated complete address associated with this account.
46
- * Does not require the account to have been published for public execution.
47
- * @returns The address, partial address, and encryption public key.
48
- */
49
- getCompleteAddress(): Promise<CompleteAddress>;
50
- /**
51
- * Gets the address for this given account.
52
- * Does not require the account to have been published for public execution.
53
- * @returns The address.
54
- */
55
- getAddress(): AztecAddress;
56
- /**
57
- * Returns the contract instance definition associated with this account.
58
- * Does not require the account to have been published for public execution.
59
- * @returns ContractInstance instance.
60
- */
61
- getInstance(): ContractInstanceWithAddress;
62
- /**
63
- * Returns a Wallet instance associated with this account. Use it to create Contract
64
- * instances to be interacted with from this account.
65
- * @returns A Wallet instance.
66
- */
67
- getWallet(): Promise<AccountWalletWithSecretKey>;
68
- /**
69
- * Add this account in the PXE Service and returns the associated wallet. Adding
70
- * the account to the PXE Service is required for managing private state associated with it.
71
- * Use the returned wallet to create Contract instances to be interacted with from this account.
72
- * @param opts - Options to wait for the account to be synched.
73
- * @returns A Wallet instance.
74
- */
75
- register(): Promise<AccountWalletWithSecretKey>;
76
- /**
77
- * Returns the pre-populated ContractSetupMethods which can prepare a tx to
78
- * initialize and/or publish this account's account contract (depending on the contract's design).
79
- * If no wallet is provided, it uses a signerless wallet with the multi call entrypoint
80
- * @param deployWallet - Wallet used for any txs that are needed to
81
- * set up the account contract for use.
82
- * @returns A ContractSetupMethods instance that can set up this account contract for use
83
- */
84
- getDeployMethod(deployWallet?: Wallet): Promise<DeployMethod>;
85
- /**
86
- * Returns a FeePaymentMethod that routes the original one provided as an argument
87
- * through the account's entrypoint. This allows an account contract to pay
88
- * for its own deployment and initialization.
89
- *
90
- * For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
91
- *
92
- * @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
93
- * @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
94
- */
95
- getSelfPaymentMethod(originalPaymentMethod?: FeePaymentMethod): Promise<AccountEntrypointMetaPaymentMethod>;
96
- /**
97
- * Submits a tx to initialize and/or publish this account's account contract
98
- * (depending on the contract's design).
99
- * Doesn't necessarily publish the class nor publish the instance.
100
- * Uses the salt provided in the constructor or a randomly generated one.
101
- * Adds the account to the PXE Service first.
102
- * @param opts - Fee options to be used for the deployment.
103
- * @returns A SentTx object that can be waited to get the associated Wallet.
104
- */
105
- deploy(opts?: DeployAccountOptions): DeployAccountSentTx;
106
- /**
107
- * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
108
- * Uses the salt provided in the constructor or a randomly generated one. If no initialization
109
- * is required it skips the transaction, and only registers the account in the PXE Service.
110
- * @param opts - Options to wait for the tx to be mined.
111
- * @returns A Wallet instance.
112
- */
113
- waitSetup(opts?: DeployAccountOptions & WaitOpts): Promise<AccountWalletWithSecretKey>;
114
- /**
115
- * Returns whether this account contract has an initializer function.
116
- */
117
- hasInitializer(): Promise<boolean>;
118
- }
119
- //# sourceMappingURL=account_manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"account_manager.d.ts","sourceRoot":"","sources":["../../src/account_manager/account_manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,KAAK,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE3F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,kCAAkC,EAAE,MAAM,kDAAkD,CAAC;AACtG,OAAO,EAAE,YAAY,EAAyB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAoB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,aAAa,EACb,KAAK,GAAG,sBAAsB,GAAG,yBAAyB,GAAG,oBAAoB,CAClF,GAAG;IACF;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,QAAQ;IAChB;;OAEG;aACa,IAAI,EAAE,IAAI;IAR5B,OAAO;WAWM,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,IAAI;IAoB1F,SAAS,CAAC,aAAa;IAIvB,SAAS,CAAC,iBAAiB;IAI3B;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAMpD;;;;OAIG;IACI,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIrD;;;;OAIG;IACI,UAAU;IAIjB;;;;OAIG;IACI,WAAW,IAAI,2BAA2B;IAIjD;;;;OAIG;IACU,SAAS,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAK7D;;;;;;OAMG;IACU,QAAQ,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAW5D;;;;;;;OAOG;IACU,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAgD1E;;;;;;;;;OASG;IACU,oBAAoB,CAAC,qBAAqB,CAAC,EAAE,gBAAgB;IAa1E;;;;;;;;OAQG;IACI,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,mBAAmB;IA6B/D;;;;;;OAMG;IACU,SAAS,CAAC,IAAI,GAAE,oBAAoB,GAAG,QAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAKpH;;OAEG;IACU,cAAc;CAG5B"}