@aztec-labs/aztec.js 6.0.0-nightly.20260829

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 (275) hide show
  1. package/README.md +44 -0
  2. package/dest/account/account.d.ts +44 -0
  3. package/dest/account/account.d.ts.map +1 -0
  4. package/dest/account/account.js +31 -0
  5. package/dest/account/account_contract.d.ts +49 -0
  6. package/dest/account/account_contract.d.ts.map +1 -0
  7. package/dest/account/account_contract.js +20 -0
  8. package/dest/account/index.d.ts +11 -0
  9. package/dest/account/index.d.ts.map +1 -0
  10. package/dest/account/index.js +6 -0
  11. package/dest/api/abi.d.ts +4 -0
  12. package/dest/api/abi.d.ts.map +1 -0
  13. package/dest/api/abi.js +1 -0
  14. package/dest/api/account.d.ts +5 -0
  15. package/dest/api/account.d.ts.map +1 -0
  16. package/dest/api/account.js +3 -0
  17. package/dest/api/addresses.d.ts +4 -0
  18. package/dest/api/addresses.d.ts.map +1 -0
  19. package/dest/api/addresses.js +3 -0
  20. package/dest/api/authorization.d.ts +5 -0
  21. package/dest/api/authorization.d.ts.map +1 -0
  22. package/dest/api/authorization.js +4 -0
  23. package/dest/api/block.d.ts +3 -0
  24. package/dest/api/block.d.ts.map +1 -0
  25. package/dest/api/block.js +2 -0
  26. package/dest/api/contract.d.ts +48 -0
  27. package/dest/api/contract.d.ts.map +1 -0
  28. package/dest/api/contract.js +46 -0
  29. package/dest/api/crypto.d.ts +2 -0
  30. package/dest/api/crypto.d.ts.map +1 -0
  31. package/dest/api/crypto.js +1 -0
  32. package/dest/api/deployment.d.ts +4 -0
  33. package/dest/api/deployment.d.ts.map +1 -0
  34. package/dest/api/deployment.js +3 -0
  35. package/dest/api/eth_address.d.ts +2 -0
  36. package/dest/api/eth_address.d.ts.map +1 -0
  37. package/dest/api/eth_address.js +1 -0
  38. package/dest/api/ethereum.d.ts +2 -0
  39. package/dest/api/ethereum.d.ts.map +1 -0
  40. package/dest/api/ethereum.js +1 -0
  41. package/dest/api/event_cursor.d.ts +44 -0
  42. package/dest/api/event_cursor.d.ts.map +1 -0
  43. package/dest/api/event_cursor.js +42 -0
  44. package/dest/api/events.d.ts +36 -0
  45. package/dest/api/events.d.ts.map +1 -0
  46. package/dest/api/events.js +59 -0
  47. package/dest/api/fee.d.ts +6 -0
  48. package/dest/api/fee.d.ts.map +1 -0
  49. package/dest/api/fee.js +4 -0
  50. package/dest/api/fee_testing.d.ts +2 -0
  51. package/dest/api/fee_testing.d.ts.map +1 -0
  52. package/dest/api/fee_testing.js +1 -0
  53. package/dest/api/fields.d.ts +4 -0
  54. package/dest/api/fields.d.ts.map +1 -0
  55. package/dest/api/fields.js +3 -0
  56. package/dest/api/keys.d.ts +4 -0
  57. package/dest/api/keys.d.ts.map +1 -0
  58. package/dest/api/keys.js +3 -0
  59. package/dest/api/log.d.ts +3 -0
  60. package/dest/api/log.d.ts.map +1 -0
  61. package/dest/api/log.js +2 -0
  62. package/dest/api/messaging.d.ts +3 -0
  63. package/dest/api/messaging.d.ts.map +1 -0
  64. package/dest/api/messaging.js +2 -0
  65. package/dest/api/node.d.ts +25 -0
  66. package/dest/api/node.d.ts.map +1 -0
  67. package/dest/api/node.js +22 -0
  68. package/dest/api/note.d.ts +2 -0
  69. package/dest/api/note.d.ts.map +1 -0
  70. package/dest/api/note.js +1 -0
  71. package/dest/api/protocol.d.ts +6 -0
  72. package/dest/api/protocol.d.ts.map +1 -0
  73. package/dest/api/protocol.js +5 -0
  74. package/dest/api/trees.d.ts +3 -0
  75. package/dest/api/trees.d.ts.map +1 -0
  76. package/dest/api/trees.js +2 -0
  77. package/dest/api/tx.d.ts +3 -0
  78. package/dest/api/tx.d.ts.map +1 -0
  79. package/dest/api/tx.js +1 -0
  80. package/dest/api/utils.d.ts +13 -0
  81. package/dest/api/utils.d.ts.map +1 -0
  82. package/dest/api/utils.js +12 -0
  83. package/dest/api/wallet.d.ts +8 -0
  84. package/dest/api/wallet.d.ts.map +1 -0
  85. package/dest/api/wallet.js +7 -0
  86. package/dest/authorization/call_authorization_request.d.ts +46 -0
  87. package/dest/authorization/call_authorization_request.d.ts.map +1 -0
  88. package/dest/authorization/call_authorization_request.js +72 -0
  89. package/dest/contract/base_contract_interaction.d.ts +32 -0
  90. package/dest/contract/base_contract_interaction.d.ts.map +1 -0
  91. package/dest/contract/base_contract_interaction.js +24 -0
  92. package/dest/contract/batch_call.d.ts +27 -0
  93. package/dest/contract/batch_call.d.ts.map +1 -0
  94. package/dest/contract/batch_call.js +152 -0
  95. package/dest/contract/checker.d.ts +11 -0
  96. package/dest/contract/checker.d.ts.map +1 -0
  97. package/dest/contract/checker.js +107 -0
  98. package/dest/contract/contract.d.ts +33 -0
  99. package/dest/contract/contract.d.ts.map +1 -0
  100. package/dest/contract/contract.js +36 -0
  101. package/dest/contract/contract_base.d.ts +51 -0
  102. package/dest/contract/contract_base.d.ts.map +1 -0
  103. package/dest/contract/contract_base.js +38 -0
  104. package/dest/contract/contract_function_interaction.d.ts +67 -0
  105. package/dest/contract/contract_function_interaction.d.ts.map +1 -0
  106. package/dest/contract/contract_function_interaction.js +218 -0
  107. package/dest/contract/deploy_method.d.ts +433 -0
  108. package/dest/contract/deploy_method.d.ts.map +1 -0
  109. package/dest/contract/deploy_method.js +471 -0
  110. package/dest/contract/fastforward_contract_update.d.ts +25 -0
  111. package/dest/contract/fastforward_contract_update.d.ts.map +1 -0
  112. package/dest/contract/fastforward_contract_update.js +57 -0
  113. package/dest/contract/interaction_options.d.ts +213 -0
  114. package/dest/contract/interaction_options.d.ts.map +1 -0
  115. package/dest/contract/interaction_options.js +87 -0
  116. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +18 -0
  117. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  118. package/dest/contract/protocol_contracts/contract-class-registry.js +137 -0
  119. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +25 -0
  120. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  121. package/dest/contract/protocol_contracts/contract-instance-registry.js +366 -0
  122. package/dest/contract/protocol_contracts/fee-juice.d.ts +24 -0
  123. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  124. package/dest/contract/protocol_contracts/fee-juice.js +383 -0
  125. package/dest/contract/wait_for_proven.d.ts +18 -0
  126. package/dest/contract/wait_for_proven.d.ts.map +1 -0
  127. package/dest/contract/wait_for_proven.js +17 -0
  128. package/dest/contract/wait_opts.d.ts +21 -0
  129. package/dest/contract/wait_opts.d.ts.map +1 -0
  130. package/dest/contract/wait_opts.js +5 -0
  131. package/dest/deployment/contract_deployer.d.ts +28 -0
  132. package/dest/deployment/contract_deployer.d.ts.map +1 -0
  133. package/dest/deployment/contract_deployer.js +35 -0
  134. package/dest/deployment/publish_class.d.ts +6 -0
  135. package/dest/deployment/publish_class.d.ts.map +1 -0
  136. package/dest/deployment/publish_class.js +17 -0
  137. package/dest/deployment/publish_instance.d.ts +10 -0
  138. package/dest/deployment/publish_instance.d.ts.map +1 -0
  139. package/dest/deployment/publish_instance.js +11 -0
  140. package/dest/ethereum/portal_manager.d.ts +146 -0
  141. package/dest/ethereum/portal_manager.d.ts.map +1 -0
  142. package/dest/ethereum/portal_manager.js +415 -0
  143. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +23 -0
  144. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -0
  145. package/dest/fee/fee_juice_payment_method_with_claim.js +46 -0
  146. package/dest/fee/fee_payment_method.d.ts +26 -0
  147. package/dest/fee/fee_payment_method.d.ts.map +1 -0
  148. package/dest/fee/fee_payment_method.js +3 -0
  149. package/dest/fee/private_fee_payment_method.d.ts +69 -0
  150. package/dest/fee/private_fee_payment_method.d.ts.map +1 -0
  151. package/dest/fee/private_fee_payment_method.js +122 -0
  152. package/dest/fee/public_fee_payment_method.d.ts +59 -0
  153. package/dest/fee/public_fee_payment_method.d.ts.map +1 -0
  154. package/dest/fee/public_fee_payment_method.js +116 -0
  155. package/dest/fee/sponsored_fee_payment.d.ts +17 -0
  156. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
  157. package/dest/fee/sponsored_fee_payment.js +33 -0
  158. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  159. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  160. package/dest/scripts/generate_protocol_contract_types.js +128 -0
  161. package/dest/test/fixtures.d.ts +13 -0
  162. package/dest/test/fixtures.d.ts.map +1 -0
  163. package/dest/test/fixtures.js +185 -0
  164. package/dest/utils/abi_types.d.ts +32 -0
  165. package/dest/utils/abi_types.d.ts.map +1 -0
  166. package/dest/utils/abi_types.js +1 -0
  167. package/dest/utils/authwit.d.ts +119 -0
  168. package/dest/utils/authwit.d.ts.map +1 -0
  169. package/dest/utils/authwit.js +266 -0
  170. package/dest/utils/cross_chain.d.ts +28 -0
  171. package/dest/utils/cross_chain.d.ts.map +1 -0
  172. package/dest/utils/cross_chain.js +26 -0
  173. package/dest/utils/fee_juice.d.ts +8 -0
  174. package/dest/utils/fee_juice.d.ts.map +1 -0
  175. package/dest/utils/fee_juice.js +10 -0
  176. package/dest/utils/field_compressed_string.d.ts +17 -0
  177. package/dest/utils/field_compressed_string.d.ts.map +1 -0
  178. package/dest/utils/field_compressed_string.js +15 -0
  179. package/dest/utils/node.d.ts +24 -0
  180. package/dest/utils/node.d.ts.map +1 -0
  181. package/dest/utils/node.js +80 -0
  182. package/dest/utils/pub_key.d.ts +9 -0
  183. package/dest/utils/pub_key.d.ts.map +1 -0
  184. package/dest/utils/pub_key.js +8 -0
  185. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +33 -0
  186. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -0
  187. package/dest/wallet/account_entrypoint_meta_payment_method.js +63 -0
  188. package/dest/wallet/account_manager.d.ts +73 -0
  189. package/dest/wallet/account_manager.d.ts.map +1 -0
  190. package/dest/wallet/account_manager.js +102 -0
  191. package/dest/wallet/capabilities.d.ts +456 -0
  192. package/dest/wallet/capabilities.d.ts.map +1 -0
  193. package/dest/wallet/capabilities.js +3 -0
  194. package/dest/wallet/deploy_account_method.d.ts +97 -0
  195. package/dest/wallet/deploy_account_method.d.ts.map +1 -0
  196. package/dest/wallet/deploy_account_method.js +127 -0
  197. package/dest/wallet/index.d.ts +5 -0
  198. package/dest/wallet/index.d.ts.map +1 -0
  199. package/dest/wallet/index.js +4 -0
  200. package/dest/wallet/tx_simulation_result_with_app_offset.d.ts +40 -0
  201. package/dest/wallet/tx_simulation_result_with_app_offset.d.ts.map +1 -0
  202. package/dest/wallet/tx_simulation_result_with_app_offset.js +65 -0
  203. package/dest/wallet/wallet.d.ts +1451 -0
  204. package/dest/wallet/wallet.d.ts.map +1 -0
  205. package/dest/wallet/wallet.js +430 -0
  206. package/package.json +138 -0
  207. package/src/account/account.ts +72 -0
  208. package/src/account/account_contract.ts +80 -0
  209. package/src/account/index.ts +12 -0
  210. package/src/api/README.md +7 -0
  211. package/src/api/abi.ts +42 -0
  212. package/src/api/account.ts +12 -0
  213. package/src/api/addresses.ts +3 -0
  214. package/src/api/authorization.ts +15 -0
  215. package/src/api/block.ts +2 -0
  216. package/src/api/contract.ts +86 -0
  217. package/src/api/crypto.ts +1 -0
  218. package/src/api/deployment.ts +3 -0
  219. package/src/api/eth_address.ts +1 -0
  220. package/src/api/ethereum.ts +10 -0
  221. package/src/api/event_cursor.ts +60 -0
  222. package/src/api/events.ts +79 -0
  223. package/src/api/fee.ts +5 -0
  224. package/src/api/fee_testing.ts +1 -0
  225. package/src/api/fields.ts +3 -0
  226. package/src/api/keys.ts +8 -0
  227. package/src/api/log.ts +2 -0
  228. package/src/api/messaging.ts +2 -0
  229. package/src/api/node.ts +30 -0
  230. package/src/api/note.ts +1 -0
  231. package/src/api/protocol.ts +6 -0
  232. package/src/api/trees.ts +2 -0
  233. package/src/api/tx.ts +20 -0
  234. package/src/api/utils.ts +14 -0
  235. package/src/api/wallet.ts +83 -0
  236. package/src/authorization/call_authorization_request.ts +93 -0
  237. package/src/contract/base_contract_interaction.ts +62 -0
  238. package/src/contract/batch_call.ts +188 -0
  239. package/src/contract/checker.ts +122 -0
  240. package/src/contract/contract.ts +52 -0
  241. package/src/contract/contract_base.ts +73 -0
  242. package/src/contract/contract_function_interaction.ts +297 -0
  243. package/src/contract/deploy_method.ts +877 -0
  244. package/src/contract/fastforward_contract_update.ts +71 -0
  245. package/src/contract/interaction_options.ts +301 -0
  246. package/src/contract/protocol_contracts/contract-class-registry.ts +104 -0
  247. package/src/contract/protocol_contracts/contract-instance-registry.ts +241 -0
  248. package/src/contract/protocol_contracts/fee-juice.ts +257 -0
  249. package/src/contract/wait_for_proven.ts +43 -0
  250. package/src/contract/wait_opts.ts +26 -0
  251. package/src/deployment/contract_deployer.ts +40 -0
  252. package/src/deployment/publish_class.ts +34 -0
  253. package/src/deployment/publish_instance.ts +24 -0
  254. package/src/ethereum/portal_manager.ts +539 -0
  255. package/src/fee/fee_juice_payment_method_with_claim.ts +63 -0
  256. package/src/fee/fee_payment_method.ts +26 -0
  257. package/src/fee/private_fee_payment_method.ts +145 -0
  258. package/src/fee/public_fee_payment_method.ts +145 -0
  259. package/src/fee/sponsored_fee_payment.ts +45 -0
  260. package/src/scripts/generate_protocol_contract_types.ts +160 -0
  261. package/src/test/fixtures.ts +126 -0
  262. package/src/utils/abi_types.ts +32 -0
  263. package/src/utils/authwit.ts +327 -0
  264. package/src/utils/cross_chain.ts +55 -0
  265. package/src/utils/fee_juice.ts +14 -0
  266. package/src/utils/field_compressed_string.ts +27 -0
  267. package/src/utils/node.ts +110 -0
  268. package/src/utils/pub_key.ts +12 -0
  269. package/src/wallet/account_entrypoint_meta_payment_method.ts +76 -0
  270. package/src/wallet/account_manager.ts +164 -0
  271. package/src/wallet/capabilities.ts +505 -0
  272. package/src/wallet/deploy_account_method.ts +234 -0
  273. package/src/wallet/index.ts +4 -0
  274. package/src/wallet/tx_simulation_result_with_app_offset.ts +100 -0
  275. package/src/wallet/wallet.ts +668 -0
@@ -0,0 +1,26 @@
1
+ import type { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
2
+ import type { GasSettings } from '@aztec-labs/stdlib/gas';
3
+ import type { ExecutionPayload } from '@aztec-labs/stdlib/tx';
4
+ /**
5
+ * Holds information about how the fee for a transaction is to be paid.
6
+ */
7
+ export interface FeePaymentMethod {
8
+ /** The asset used to pay the fee. */
9
+ getAsset(): Promise<AztecAddress>;
10
+ /**
11
+ * Returns the data to be added to the final execution request
12
+ * to pay the fee in the given asset
13
+ * @returns The function calls to pay the fee.
14
+ */
15
+ getExecutionPayload(): Promise<ExecutionPayload>;
16
+ /**
17
+ * The expected fee payer for this tx.
18
+ */
19
+ getFeePayer(): Promise<AztecAddress>;
20
+ /**
21
+ * The gas settings (if any) used to compute the
22
+ * execution payload of the payment method
23
+ */
24
+ getGasSettings(): GasSettings | undefined;
25
+ }
26
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVlX3BheW1lbnRfbWV0aG9kLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmVlL2ZlZV9wYXltZW50X21ldGhvZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNyRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUMxRCxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRTlEOztHQUVHO0FBQ0gsTUFBTSxXQUFXLGdCQUFnQjtJQUMvQixxQ0FBcUM7SUFDckMsUUFBUSxJQUFJLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQztJQUNsQzs7OztPQUlHO0lBQ0gsbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDakQ7O09BRUc7SUFDSCxXQUFXLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDO0lBQ3JDOzs7T0FHRztJQUNILGNBQWMsSUFBSSxXQUFXLEdBQUcsU0FBUyxDQUFDO0NBQzNDIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/fee_payment_method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACjD;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,IAAI,WAAW,GAAG,SAAS,CAAC;CAC3C"}
@@ -0,0 +1,3 @@
1
+ /**
2
+ * Holds information about how the fee for a transaction is to be paid.
3
+ */ export { };
@@ -0,0 +1,69 @@
1
+ import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
2
+ import type { GasSettings } from '@aztec-labs/stdlib/gas';
3
+ import { ExecutionPayload } from '@aztec-labs/stdlib/tx';
4
+ import type { Wallet } from '../wallet/wallet.js';
5
+ import type { FeePaymentMethod } from './fee_payment_method.js';
6
+ /**
7
+ * Holds information about how the fee for a transaction is to be paid.
8
+ * @deprecated Is not supported on mainnet. Use {@link FeeJuicePaymentMethodWithClaim} or `SponsoredFeePaymentMethod` instead.
9
+ */
10
+ export declare class PrivateFeePaymentMethod implements FeePaymentMethod {
11
+ /**
12
+ * Address which will hold the fee payment.
13
+ */
14
+ private paymentContract;
15
+ /**
16
+ * Address of the account that will pay the fee
17
+ */
18
+ private sender;
19
+ /**
20
+ * A wallet to perform the simulation to get the accepted asset
21
+ */
22
+ private wallet;
23
+ /**
24
+ * Gas settings used to compute the maximum fee the user is willing to pay
25
+ */
26
+ protected gasSettings: GasSettings;
27
+ /**
28
+ * If true, the max fee will be set to 1.
29
+ * TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
30
+ */
31
+ private setMaxFeeToOne;
32
+ private assetPromise;
33
+ constructor(
34
+ /**
35
+ * Address which will hold the fee payment.
36
+ */
37
+ paymentContract: AztecAddress,
38
+ /**
39
+ * Address of the account that will pay the fee
40
+ */
41
+ sender: AztecAddress,
42
+ /**
43
+ * A wallet to perform the simulation to get the accepted asset
44
+ */
45
+ wallet: Wallet,
46
+ /**
47
+ * Gas settings used to compute the maximum fee the user is willing to pay
48
+ */
49
+ gasSettings: GasSettings,
50
+ /**
51
+ * If true, the max fee will be set to 1.
52
+ * TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
53
+ */
54
+ setMaxFeeToOne?: boolean);
55
+ /**
56
+ * The asset used to pay the fee.
57
+ * @returns The asset used to pay the fee.
58
+ */
59
+ getAsset(): Promise<AztecAddress>;
60
+ getFeePayer(): Promise<AztecAddress>;
61
+ /**
62
+ * Creates an execution payload to pay the fee using a private function through an FPC in the desired asset
63
+ * @param gasSettings - The gas settings.
64
+ * @returns An execution payload that contains the required function calls and auth witnesses.
65
+ */
66
+ getExecutionPayload(): Promise<ExecutionPayload>;
67
+ getGasSettings(): GasSettings | undefined;
68
+ }
69
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9mZWVfcGF5bWVudF9tZXRob2QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9mZWUvcHJpdmF0ZV9mZWVfcGF5bWVudF9tZXRob2QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5nc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IsQ0FBQyxDQW9DckQ7SUFFRCxjQUFjLElBQUksV0FBVyxHQUFHLFNBQVMsQ0FFeEM7Q0FDRiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"private_fee_payment_method.d.ts","sourceRoot":"","sources":["../../src/fee/private_fee_payment_method.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAI5D;;OAEG;IACH,OAAO,CAAC,eAAe;IAEvB;;OAEG;IACH,OAAO,CAAC,MAAM;IAEd;;OAEG;IACH,OAAO,CAAC,MAAM;IACd;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,WAAW;IAClC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAzBxB,OAAO,CAAC,YAAY,CAAsC;IAE1D;IACE;;OAEG;IACK,eAAe,EAAE,YAAY;IAErC;;OAEG;IACK,MAAM,EAAE,YAAY;IAE5B;;OAEG;IACK,MAAM,EAAE,MAAM;IACtB;;OAEG;IACO,WAAW,EAAE,WAAW;IAClC;;;OAGG;IACK,cAAc,UAAQ,EAC5B;IAEJ;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAqCtC;IAED,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAEnC;IAED;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAoCrD;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
@@ -0,0 +1,122 @@
1
+ import { Fr } from '@aztec-labs/foundation/curves/bn254';
2
+ import { FunctionCall, FunctionSelector, FunctionType, decodeFromAbi, getFunctionReturnType } from '@aztec-labs/stdlib/abi';
3
+ import { ExecutionPayload } from '@aztec-labs/stdlib/tx';
4
+ import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
5
+ import { NO_FROM } from '../contract/interaction_options.js';
6
+ /**
7
+ * Holds information about how the fee for a transaction is to be paid.
8
+ * @deprecated Is not supported on mainnet. Use {@link FeeJuicePaymentMethodWithClaim} or `SponsoredFeePaymentMethod` instead.
9
+ */ export class PrivateFeePaymentMethod {
10
+ paymentContract;
11
+ sender;
12
+ wallet;
13
+ gasSettings;
14
+ setMaxFeeToOne;
15
+ assetPromise;
16
+ constructor(/**
17
+ * Address which will hold the fee payment.
18
+ */ paymentContract, /**
19
+ * Address of the account that will pay the fee
20
+ */ sender, /**
21
+ * A wallet to perform the simulation to get the accepted asset
22
+ */ wallet, /**
23
+ * Gas settings used to compute the maximum fee the user is willing to pay
24
+ */ gasSettings, /**
25
+ * If true, the max fee will be set to 1.
26
+ * TODO(#7694): Remove this param once the lacking feature in TXE is implemented.
27
+ */ setMaxFeeToOne = false){
28
+ this.paymentContract = paymentContract;
29
+ this.sender = sender;
30
+ this.wallet = wallet;
31
+ this.gasSettings = gasSettings;
32
+ this.setMaxFeeToOne = setMaxFeeToOne;
33
+ this.assetPromise = null;
34
+ }
35
+ /**
36
+ * The asset used to pay the fee.
37
+ * @returns The asset used to pay the fee.
38
+ */ async getAsset() {
39
+ if (!this.assetPromise) {
40
+ const abi = {
41
+ name: 'get_accepted_asset',
42
+ functionType: FunctionType.PRIVATE,
43
+ isOnlySelf: false,
44
+ isStatic: false,
45
+ parameters: [],
46
+ returnType: {
47
+ kind: 'struct',
48
+ path: 'authwit::aztec::protocol_types::address::aztec_address::AztecAddress',
49
+ fields: [
50
+ {
51
+ name: 'inner',
52
+ type: {
53
+ kind: 'field'
54
+ }
55
+ }
56
+ ]
57
+ },
58
+ errorTypes: {},
59
+ isInitializer: false
60
+ };
61
+ const interaction = new ContractFunctionInteraction(this.wallet, this.paymentContract, abi, []);
62
+ const executionPayload = await interaction.request();
63
+ this.assetPromise = this.wallet.simulateTx(executionPayload, {
64
+ from: NO_FROM,
65
+ skipFeeEnforcement: true
66
+ }).then((simulationResult)=>{
67
+ const rawReturnValues = simulationResult.getPrivateReturnValues().values;
68
+ return decodeFromAbi(getFunctionReturnType(abi), rawReturnValues);
69
+ });
70
+ }
71
+ return this.assetPromise;
72
+ }
73
+ getFeePayer() {
74
+ return Promise.resolve(this.paymentContract);
75
+ }
76
+ /**
77
+ * Creates an execution payload to pay the fee using a private function through an FPC in the desired asset
78
+ * @param gasSettings - The gas settings.
79
+ * @returns An execution payload that contains the required function calls and auth witnesses.
80
+ */ async getExecutionPayload() {
81
+ // We assume 1:1 exchange rate between fee juice and token. But in reality you would need to convert feeLimit
82
+ // (maxFee) to be in token denomination.
83
+ const maxFee = this.setMaxFeeToOne ? Fr.ONE : this.gasSettings.getFeeLimit();
84
+ const txNonce = Fr.random();
85
+ const witness = await this.wallet.createAuthWit(this.sender, {
86
+ caller: this.paymentContract,
87
+ call: FunctionCall.from({
88
+ name: 'transfer_to_public',
89
+ to: await this.getAsset(),
90
+ selector: await FunctionSelector.fromSignature('transfer_to_public((Field),(Field),u128,Field)'),
91
+ type: FunctionType.PRIVATE,
92
+ hideMsgSender: false,
93
+ isStatic: false,
94
+ args: [
95
+ this.sender.toField(),
96
+ this.paymentContract.toField(),
97
+ maxFee,
98
+ txNonce
99
+ ]
100
+ })
101
+ });
102
+ return new ExecutionPayload([
103
+ FunctionCall.from({
104
+ name: 'fee_entrypoint_private',
105
+ to: this.paymentContract,
106
+ selector: await FunctionSelector.fromSignature('fee_entrypoint_private(u128,Field)'),
107
+ type: FunctionType.PRIVATE,
108
+ hideMsgSender: false,
109
+ isStatic: false,
110
+ args: [
111
+ maxFee,
112
+ txNonce
113
+ ]
114
+ })
115
+ ], [
116
+ witness
117
+ ], [], [], this.paymentContract);
118
+ }
119
+ getGasSettings() {
120
+ return this.gasSettings;
121
+ }
122
+ }
@@ -0,0 +1,59 @@
1
+ import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
2
+ import { GasSettings } from '@aztec-labs/stdlib/gas';
3
+ import { ExecutionPayload } from '@aztec-labs/stdlib/tx';
4
+ import type { Wallet } from '../wallet/wallet.js';
5
+ import type { FeePaymentMethod } from './fee_payment_method.js';
6
+ /**
7
+ * Holds information about how the fee for a transaction is to be paid.
8
+ * @deprecated Is not supported on mainnet. Use {@link FeeJuicePaymentMethodWithClaim} or `SponsoredFeePaymentMethod` instead.
9
+ */
10
+ export declare class PublicFeePaymentMethod implements FeePaymentMethod {
11
+ /**
12
+ * Address which will hold the fee payment.
13
+ */
14
+ protected paymentContract: AztecAddress;
15
+ /**
16
+ * An auth witness provider to authorize fee payments
17
+ */
18
+ protected sender: AztecAddress;
19
+ /**
20
+ * A wallet to perform the simulation to get the accepted asset
21
+ */
22
+ protected wallet: Wallet;
23
+ /**
24
+ * Gas settings used to compute the maximum fee the user is willing to pay
25
+ */
26
+ protected gasSettings: GasSettings;
27
+ private assetPromise;
28
+ constructor(
29
+ /**
30
+ * Address which will hold the fee payment.
31
+ */
32
+ paymentContract: AztecAddress,
33
+ /**
34
+ * An auth witness provider to authorize fee payments
35
+ */
36
+ sender: AztecAddress,
37
+ /**
38
+ * A wallet to perform the simulation to get the accepted asset
39
+ */
40
+ wallet: Wallet,
41
+ /**
42
+ * Gas settings used to compute the maximum fee the user is willing to pay
43
+ */
44
+ gasSettings: GasSettings);
45
+ /**
46
+ * The asset used to pay the fee.
47
+ * @returns The asset used to pay the fee.
48
+ */
49
+ getAsset(): Promise<AztecAddress>;
50
+ getFeePayer(): Promise<AztecAddress>;
51
+ /**
52
+ * Creates an execution payload to pay the fee using a public function through an FPC in the desired asset
53
+ * @param gasSettings - The gas settings.
54
+ * @returns An execution payload that contains the required function calls.
55
+ */
56
+ getExecutionPayload(): Promise<ExecutionPayload>;
57
+ getGasSettings(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AEnC;IAED;;;;OAIG;IACG,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA0CrD;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
@@ -0,0 +1,116 @@
1
+ import { Fr } from '@aztec-labs/foundation/curves/bn254';
2
+ import { FunctionCall, FunctionSelector, FunctionType, decodeFromAbi, getFunctionReturnType } from '@aztec-labs/stdlib/abi';
3
+ import { ExecutionPayload } from '@aztec-labs/stdlib/tx';
4
+ import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
5
+ import { NO_FROM } from '../contract/interaction_options.js';
6
+ import { SetPublicAuthwitContractInteraction } from '../utils/authwit.js';
7
+ /**
8
+ * Holds information about how the fee for a transaction is to be paid.
9
+ * @deprecated Is not supported on mainnet. Use {@link FeeJuicePaymentMethodWithClaim} or `SponsoredFeePaymentMethod` instead.
10
+ */ export class PublicFeePaymentMethod {
11
+ paymentContract;
12
+ sender;
13
+ wallet;
14
+ gasSettings;
15
+ assetPromise;
16
+ constructor(/**
17
+ * Address which will hold the fee payment.
18
+ */ paymentContract, /**
19
+ * An auth witness provider to authorize fee payments
20
+ */ sender, /**
21
+ * A wallet to perform the simulation to get the accepted asset
22
+ */ wallet, /**
23
+ * Gas settings used to compute the maximum fee the user is willing to pay
24
+ */ gasSettings){
25
+ this.paymentContract = paymentContract;
26
+ this.sender = sender;
27
+ this.wallet = wallet;
28
+ this.gasSettings = gasSettings;
29
+ this.assetPromise = null;
30
+ }
31
+ /**
32
+ * The asset used to pay the fee.
33
+ * @returns The asset used to pay the fee.
34
+ */ async getAsset() {
35
+ if (!this.assetPromise) {
36
+ const abi = {
37
+ name: 'get_accepted_asset',
38
+ functionType: FunctionType.PRIVATE,
39
+ isOnlySelf: false,
40
+ isStatic: false,
41
+ parameters: [],
42
+ returnType: {
43
+ kind: 'struct',
44
+ path: 'authwit::aztec::protocol_types::address::aztec_address::AztecAddress',
45
+ fields: [
46
+ {
47
+ name: 'inner',
48
+ type: {
49
+ kind: 'field'
50
+ }
51
+ }
52
+ ]
53
+ },
54
+ errorTypes: {},
55
+ isInitializer: false
56
+ };
57
+ const interaction = new ContractFunctionInteraction(this.wallet, this.paymentContract, abi, []);
58
+ const executionPayload = await interaction.request();
59
+ this.assetPromise = this.wallet.simulateTx(executionPayload, {
60
+ from: NO_FROM,
61
+ skipFeeEnforcement: true
62
+ }).then((simulationResult)=>{
63
+ const rawReturnValues = simulationResult.getPrivateReturnValues().values;
64
+ return decodeFromAbi(getFunctionReturnType(abi), rawReturnValues);
65
+ });
66
+ }
67
+ return this.assetPromise;
68
+ }
69
+ getFeePayer() {
70
+ return Promise.resolve(this.paymentContract);
71
+ }
72
+ /**
73
+ * Creates an execution payload to pay the fee using a public function through an FPC in the desired asset
74
+ * @param gasSettings - The gas settings.
75
+ * @returns An execution payload that contains the required function calls.
76
+ */ async getExecutionPayload() {
77
+ const txNonce = Fr.random();
78
+ const maxFee = this.gasSettings.getFeeLimit();
79
+ const intent = {
80
+ caller: this.paymentContract,
81
+ call: FunctionCall.from({
82
+ name: 'transfer_in_public',
83
+ to: await this.getAsset(),
84
+ selector: await FunctionSelector.fromSignature('transfer_in_public((Field),(Field),u128,Field)'),
85
+ type: FunctionType.PUBLIC,
86
+ hideMsgSender: false,
87
+ isStatic: false,
88
+ args: [
89
+ this.sender.toField(),
90
+ this.paymentContract.toField(),
91
+ maxFee,
92
+ txNonce
93
+ ]
94
+ })
95
+ };
96
+ const setPublicAuthWitInteraction = await SetPublicAuthwitContractInteraction.create(this.wallet, this.sender, intent, true);
97
+ return new ExecutionPayload([
98
+ ...(await setPublicAuthWitInteraction.request()).calls,
99
+ FunctionCall.from({
100
+ name: 'fee_entrypoint_public',
101
+ to: this.paymentContract,
102
+ selector: await FunctionSelector.fromSignature('fee_entrypoint_public(u128,Field)'),
103
+ type: FunctionType.PRIVATE,
104
+ hideMsgSender: false,
105
+ isStatic: false,
106
+ args: [
107
+ maxFee,
108
+ txNonce
109
+ ]
110
+ })
111
+ ], [], [], [], this.paymentContract);
112
+ }
113
+ getGasSettings() {
114
+ return this.gasSettings;
115
+ }
116
+ }
@@ -0,0 +1,17 @@
1
+ import type { FeePaymentMethod } from '@aztec-labs/aztec.js/fee';
2
+ import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
3
+ import type { GasSettings } from '@aztec-labs/stdlib/gas';
4
+ import { ExecutionPayload } from '@aztec-labs/stdlib/tx';
5
+ /**
6
+ * A fee payment method that uses a contract that blindly sponsors transactions.
7
+ * This contract is expected to be prefunded in testing environments.
8
+ */
9
+ export declare class SponsoredFeePaymentMethod implements FeePaymentMethod {
10
+ private paymentContract;
11
+ constructor(paymentContract: AztecAddress);
12
+ getAsset(): Promise<AztecAddress>;
13
+ getFeePayer(): Promise<AztecAddress>;
14
+ getExecutionPayload(): Promise<ExecutionPayload>;
15
+ getGasSettings(): GasSettings | undefined;
16
+ }
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3BvbnNvcmVkX2ZlZV9wYXltZW50LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZmVlL3Nwb25zb3JlZF9mZWVfcGF5bWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRWpFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNoRSxPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUMxRCxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV6RDs7O0dBR0c7QUFDSCxxQkFBYSx5QkFBMEIsWUFBVyxnQkFBZ0I7SUFDcEQsT0FBTyxDQUFDLGVBQWU7SUFBbkMsWUFBb0IsZUFBZSxFQUFFLFlBQVksRUFBSTtJQUVyRCxRQUFRLElBQUksT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUVoQztJQUVELFdBQVcsSUFBSSxPQUFPLENBQUMsWUFBWSxDQUFDLENBRW5DO0lBRUssbUJBQW1CLElBQUksT0FBTyxDQUFDLGdCQUFnQixDQUFDLENBa0JyRDtJQUVELGNBQWMsSUFBSSxXQUFXLEdBQUcsU0FBUyxDQUV4QztDQUNGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sponsored_fee_payment.d.ts","sourceRoot":"","sources":["../../src/fee/sponsored_fee_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IACpD,OAAO,CAAC,eAAe;IAAnC,YAAoB,eAAe,EAAE,YAAY,EAAI;IAErD,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAEhC;IAED,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC,CAEnC;IAEK,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAkBrD;IAED,cAAc,IAAI,WAAW,GAAG,SAAS,CAExC;CACF"}
@@ -0,0 +1,33 @@
1
+ import { FunctionCall, FunctionSelector, FunctionType } from '@aztec-labs/stdlib/abi';
2
+ import { ExecutionPayload } from '@aztec-labs/stdlib/tx';
3
+ /**
4
+ * A fee payment method that uses a contract that blindly sponsors transactions.
5
+ * This contract is expected to be prefunded in testing environments.
6
+ */ export class SponsoredFeePaymentMethod {
7
+ paymentContract;
8
+ constructor(paymentContract){
9
+ this.paymentContract = paymentContract;
10
+ }
11
+ getAsset() {
12
+ throw new Error('Asset is not required for sponsored fpc.');
13
+ }
14
+ getFeePayer() {
15
+ return Promise.resolve(this.paymentContract);
16
+ }
17
+ async getExecutionPayload() {
18
+ return new ExecutionPayload([
19
+ FunctionCall.from({
20
+ name: 'sponsor_unconditionally',
21
+ to: this.paymentContract,
22
+ selector: await FunctionSelector.fromSignature('sponsor_unconditionally()'),
23
+ type: FunctionType.PRIVATE,
24
+ hideMsgSender: false,
25
+ isStatic: false,
26
+ args: []
27
+ })
28
+ ], [], [], [], this.paymentContract);
29
+ }
30
+ getGasSettings() {
31
+ return;
32
+ }
33
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGVfcHJvdG9jb2xfY29udHJhY3RfdHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY3JpcHRzL2dlbmVyYXRlX3Byb3RvY29sX2NvbnRyYWN0X3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate_protocol_contract_types.d.ts","sourceRoot":"","sources":["../../src/scripts/generate_protocol_contract_types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Generates type-safe contract wrappers for protocol contracts.
3
+ * These wrappers use a minimal artifact (without bytecode) since PXE already has the full artifacts registered.
4
+ */ import { generateTypescriptContractInterface } from '@aztec-labs/builder/codegen';
5
+ import { fileURLToPath } from '@aztec-labs/foundation/url';
6
+ import { FunctionType, getAllFunctionAbis, getFunctionReturnType, loadContractArtifact } from '@aztec-labs/stdlib/abi';
7
+ import { promises as fs } from 'fs';
8
+ import path from 'path';
9
+ const log = console.log;
10
+ const artifactsPkgRoot = path.dirname(fileURLToPath(import.meta.resolve('@aztec/protocol-contracts-artifacts/package.json')));
11
+ const srcPath = path.join(artifactsPkgRoot, 'artifacts');
12
+ const outputDir = path.join(import.meta.dirname, '../contract/protocol_contracts');
13
+ function toKebabCase(str) {
14
+ return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
15
+ }
16
+ function functionTypeToEnum(type) {
17
+ switch(type){
18
+ case FunctionType.PRIVATE:
19
+ return 'FunctionType.PRIVATE';
20
+ case FunctionType.PUBLIC:
21
+ return 'FunctionType.PUBLIC';
22
+ case FunctionType.UTILITY:
23
+ return 'FunctionType.UTILITY';
24
+ }
25
+ }
26
+ function generateFunctionAbiJson(abi) {
27
+ const baseObj = {
28
+ name: abi.name,
29
+ isOnlySelf: abi.isOnlySelf,
30
+ isStatic: abi.isStatic,
31
+ isInitializer: abi.isInitializer,
32
+ parameters: abi.parameters,
33
+ returnType: getFunctionReturnType(abi),
34
+ errorTypes: abi.errorTypes
35
+ };
36
+ const jsonStr = JSON.stringify(baseObj);
37
+ return jsonStr.replace('{', `{ functionType: ${functionTypeToEnum(abi.functionType)},`);
38
+ }
39
+ function generateProtocolContractArtifact(input) {
40
+ const allAbis = getAllFunctionAbis(input);
41
+ const functionAbis = input.functions.map((f)=>allAbis.find((abi)=>abi.name === f.name));
42
+ const nonDispatchAbis = input.nonDispatchPublicFunctions;
43
+ const functionsArray = functionAbis.map((abi)=>`{ ...${generateFunctionAbiJson(abi)}, bytecode: Buffer.from([]), debugSymbols: '' }`).join(',\n ');
44
+ const nonDispatchArray = nonDispatchAbis.map((abi)=>generateFunctionAbiJson(abi)).join(',\n ');
45
+ return `{
46
+ name: '${input.name}',
47
+ aztecVersion: '${input.aztecVersion}',
48
+ functions: [
49
+ ${functionsArray}
50
+ ],
51
+ nonDispatchPublicFunctions: [
52
+ ${nonDispatchArray}
53
+ ],
54
+ outputs: { structs: {}, globals: {} },
55
+ storageLayout: {},
56
+ fileMap: {},
57
+ }`;
58
+ }
59
+ async function generateProtocolContractInterface(input, protocolContractName) {
60
+ const baseInterface = await generateTypescriptContractInterface(input);
61
+ // Match everything between "public declare methods: {" and the closing "};"
62
+ const methodsMatch = baseInterface.match(/public declare methods: \{([\s\S]*?)\n \};/);
63
+ if (!methodsMatch) {
64
+ throw new Error('Could not extract methods from generated interface');
65
+ }
66
+ const artifactCode = generateProtocolContractArtifact(input);
67
+ const contractName = `${input.name}Contract`;
68
+ return `
69
+ /* Autogenerated file, do not edit! */
70
+
71
+ /* eslint-disable */
72
+ import { ProtocolContractAddress } from '@aztec-labs/protocol-contracts';
73
+ import { FunctionType } from '@aztec-labs/stdlib/abi';
74
+
75
+ import type { ContractArtifact } from '../../api/abi.js';
76
+ import { PublicKeys } from '../../api/keys.js';
77
+ import type { AztecAddressLike, EthAddressLike, FieldLike, FunctionSelectorLike, OptionLike, WrappedFieldLike } from '../../utils/abi_types.js';
78
+ import { ContractBase, type ContractMethod } from '../contract_base.js';
79
+ import { ContractFunctionInteraction } from '../contract_function_interaction.js';
80
+ import type { Wallet } from '../../wallet/wallet.js';
81
+
82
+ const ${contractName}Artifact: ContractArtifact = ${artifactCode};
83
+
84
+ export class ${contractName} extends ContractBase {
85
+ private constructor(wallet: Wallet) {
86
+ super(ProtocolContractAddress.${protocolContractName}, ${contractName}Artifact, wallet);
87
+ }
88
+
89
+ /** Returns an interface to the canonical ${contractName} instance, bound to the given wallet. */
90
+ public static withWallet(wallet: Wallet): ${contractName} {
91
+ return new ${contractName}(wallet);
92
+ }
93
+
94
+ /** @deprecated Use \`withWallet\` instead. */
95
+ public static at(wallet: Wallet): ${contractName} {
96
+ return ${contractName}.withWallet(wallet);
97
+ }
98
+
99
+ public declare methods: {${methodsMatch[1]}
100
+ };
101
+ }
102
+ `;
103
+ }
104
+ async function main() {
105
+ await fs.rm(outputDir, {
106
+ recursive: true,
107
+ force: true
108
+ });
109
+ await fs.mkdir(outputDir, {
110
+ recursive: true
111
+ });
112
+ const srcNames = JSON.parse(await fs.readFile(path.join(artifactsPkgRoot, 'protocol_contracts.json'), 'utf8'));
113
+ for (const srcName of srcNames){
114
+ // srcName is like "auth_registry_contract-AuthRegistry", split to get the contract name
115
+ const name = srcName.split('-')[1];
116
+ const artifactPath = path.join(srcPath, `${srcName}.json`);
117
+ const json = JSON.parse(await fs.readFile(artifactPath, 'utf8'));
118
+ const contractArtifact = loadContractArtifact(json);
119
+ const content = await generateProtocolContractInterface(contractArtifact, name);
120
+ const fileName = `${toKebabCase(name)}.ts`;
121
+ await fs.writeFile(path.join(outputDir, fileName), content);
122
+ log(`Generated ${fileName}`);
123
+ }
124
+ }
125
+ main().catch((err)=>{
126
+ console.error('Error generating protocol contract types:', err);
127
+ process.exit(1);
128
+ });
@@ -0,0 +1,13 @@
1
+ import { type ContractArtifact } from '@aztec-labs/stdlib/abi';
2
+ /**
3
+ * A minimal but representative `ContractArtifact` shared by unit tests in this package. Covers
4
+ * every function shape the tests exercise: a private initializer (`constructor`), the standard
5
+ * `public_dispatch` entry, a private function with mixed-visibility params (`bar`), a utility
6
+ * function (`qux`), and two functions exercising Noir `Option<Field>` parameters (`optionEcho`,
7
+ * `mixedParams`).
8
+ *
9
+ * We deliberately do not depend on `@aztec-labs/noir-test-contracts.js` here: that package depends on
10
+ * `@aztec-labs/aztec.js`, so importing from it would create a workspace cycle.
11
+ */
12
+ export declare const testContractArtifact: ContractArtifact;
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZml4dHVyZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0L2ZpeHR1cmVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxLQUFLLGdCQUFnQixFQUFnQixNQUFNLHdCQUF3QixDQUFDO0FBRzdFOzs7Ozs7Ozs7R0FTRztBQUNILGVBQU8sTUFBTSxvQkFBb0IsRUFBRSxnQkE4R2xDLENBQUMifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/test/fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,wBAAwB,CAAC;AAG7E;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBA8GlC,CAAC"}