@aztec/aztec.js 0.76.4 → 0.77.0-testnet-ignition.21

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 (274) hide show
  1. package/dest/account/contract.d.ts +9 -5
  2. package/dest/account/contract.d.ts.map +1 -1
  3. package/dest/account/contract.js +15 -2
  4. package/dest/account/index.d.ts +2 -2
  5. package/dest/account/index.d.ts.map +1 -1
  6. package/dest/account/index.js +8 -1
  7. package/dest/account/interface.d.ts +5 -4
  8. package/dest/account/interface.d.ts.map +1 -1
  9. package/dest/account/interface.js +4 -3
  10. package/dest/account/wallet.d.ts +4 -3
  11. package/dest/account/wallet.d.ts.map +1 -1
  12. package/dest/account/wallet.js +3 -2
  13. package/dest/account_manager/deploy_account_method.d.ts +5 -5
  14. package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
  15. package/dest/account_manager/deploy_account_method.js +22 -25
  16. package/dest/account_manager/deploy_account_sent_tx.d.ts +4 -3
  17. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
  18. package/dest/account_manager/deploy_account_sent_tx.js +16 -17
  19. package/dest/account_manager/index.d.ts +20 -11
  20. package/dest/account_manager/index.d.ts.map +1 -1
  21. package/dest/account_manager/index.js +89 -87
  22. package/dest/api/abi.d.ts +2 -3
  23. package/dest/api/abi.d.ts.map +1 -1
  24. package/dest/api/abi.js +1 -3
  25. package/dest/api/account.d.ts +1 -2
  26. package/dest/api/account.d.ts.map +1 -1
  27. package/dest/api/account.js +1 -2
  28. package/dest/api/addresses.d.ts +2 -2
  29. package/dest/api/addresses.d.ts.map +1 -1
  30. package/dest/api/addresses.js +2 -3
  31. package/dest/api/cheat_codes.d.ts +4 -4
  32. package/dest/api/cheat_codes.d.ts.map +1 -1
  33. package/dest/api/cheat_codes.js +10 -15
  34. package/dest/api/deployment.js +0 -1
  35. package/dest/api/entrypoint.js +0 -1
  36. package/dest/api/eth_address.js +0 -1
  37. package/dest/api/ethereum/anvil_test_watcher.d.ts +10 -6
  38. package/dest/api/ethereum/anvil_test_watcher.d.ts.map +1 -1
  39. package/dest/api/ethereum/anvil_test_watcher.js +43 -18
  40. package/dest/api/ethereum/chain_monitor.d.ts +6 -2
  41. package/dest/api/ethereum/chain_monitor.d.ts.map +1 -1
  42. package/dest/api/ethereum/chain_monitor.js +24 -8
  43. package/dest/api/ethereum/cheat_codes.d.ts +14 -3
  44. package/dest/api/ethereum/cheat_codes.d.ts.map +1 -1
  45. package/dest/api/ethereum/cheat_codes.js +106 -53
  46. package/dest/api/ethereum/index.d.ts +1 -1
  47. package/dest/api/ethereum/index.d.ts.map +1 -1
  48. package/dest/api/ethereum/index.js +1 -2
  49. package/dest/api/ethereum/l1_contracts.d.ts +1 -1
  50. package/dest/api/ethereum/l1_contracts.d.ts.map +1 -1
  51. package/dest/api/ethereum/l1_contracts.js +4 -6
  52. package/dest/api/ethereum/portal_manager.d.ts +16 -12
  53. package/dest/api/ethereum/portal_manager.d.ts.map +1 -1
  54. package/dest/api/ethereum/portal_manager.js +134 -115
  55. package/dest/api/fee.d.ts +0 -1
  56. package/dest/api/fee.d.ts.map +1 -1
  57. package/dest/api/fee.js +0 -2
  58. package/dest/api/fields.js +0 -1
  59. package/dest/api/interfaces/pxe.d.ts +1 -1
  60. package/dest/api/interfaces/pxe.d.ts.map +1 -1
  61. package/dest/api/interfaces/pxe.js +1 -2
  62. package/dest/api/log.js +0 -1
  63. package/dest/api/log_id.d.ts +1 -1
  64. package/dest/api/log_id.d.ts.map +1 -1
  65. package/dest/api/log_id.js +1 -2
  66. package/dest/api/tx_hash.d.ts +1 -1
  67. package/dest/api/tx_hash.d.ts.map +1 -1
  68. package/dest/api/tx_hash.js +1 -2
  69. package/dest/api/wallet.d.ts +1 -1
  70. package/dest/api/wallet.d.ts.map +1 -1
  71. package/dest/api/wallet.js +1 -2
  72. package/dest/contract/base_contract_interaction.d.ts +21 -5
  73. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  74. package/dest/contract/base_contract_interaction.js +97 -55
  75. package/dest/contract/batch_call.d.ts +3 -2
  76. package/dest/contract/batch_call.d.ts.map +1 -1
  77. package/dest/contract/batch_call.js +64 -40
  78. package/dest/contract/checker.d.ts +1 -1
  79. package/dest/contract/checker.d.ts.map +1 -1
  80. package/dest/contract/checker.js +29 -20
  81. package/dest/contract/contract.d.ts +4 -4
  82. package/dest/contract/contract.d.ts.map +1 -1
  83. package/dest/contract/contract.js +30 -28
  84. package/dest/contract/contract_base.d.ts +5 -5
  85. package/dest/contract/contract_base.d.ts.map +1 -1
  86. package/dest/contract/contract_base.js +22 -31
  87. package/dest/contract/contract_function_interaction.d.ts +9 -8
  88. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  89. package/dest/contract/contract_function_interaction.js +63 -51
  90. package/dest/contract/deploy_method.d.ts +14 -11
  91. package/dest/contract/deploy_method.d.ts.map +1 -1
  92. package/dest/contract/deploy_method.js +115 -87
  93. package/dest/contract/deploy_proven_tx.d.ts +6 -4
  94. package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
  95. package/dest/contract/deploy_proven_tx.js +8 -11
  96. package/dest/contract/deploy_sent_tx.d.ts +8 -6
  97. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  98. package/dest/contract/deploy_sent_tx.js +19 -22
  99. package/dest/contract/get_gas_limits.d.ts +2 -2
  100. package/dest/contract/get_gas_limits.d.ts.map +1 -1
  101. package/dest/contract/get_gas_limits.js +2 -4
  102. package/dest/contract/index.js +2 -4
  103. package/dest/{deployment → contract}/protocol_contracts.d.ts +4 -2
  104. package/dest/contract/protocol_contracts.d.ts.map +1 -0
  105. package/dest/contract/protocol_contracts.js +26 -0
  106. package/dest/contract/proven_tx.d.ts +3 -2
  107. package/dest/contract/proven_tx.d.ts.map +1 -1
  108. package/dest/contract/proven_tx.js +8 -11
  109. package/dest/contract/sent_tx.d.ts +3 -2
  110. package/dest/contract/sent_tx.d.ts.map +1 -1
  111. package/dest/contract/sent_tx.js +33 -35
  112. package/dest/contract/unsafe_contract.d.ts +3 -3
  113. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  114. package/dest/contract/unsafe_contract.js +2 -10
  115. package/dest/deployment/broadcast_function.d.ts +3 -3
  116. package/dest/deployment/broadcast_function.d.ts.map +1 -1
  117. package/dest/deployment/broadcast_function.js +39 -32
  118. package/dest/deployment/contract_deployer.d.ts +3 -3
  119. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  120. package/dest/deployment/contract_deployer.js +16 -15
  121. package/dest/deployment/deploy_instance.d.ts +3 -3
  122. package/dest/deployment/deploy_instance.d.ts.map +1 -1
  123. package/dest/deployment/deploy_instance.js +3 -5
  124. package/dest/deployment/index.js +0 -1
  125. package/dest/deployment/register_class.d.ts +3 -3
  126. package/dest/deployment/register_class.d.ts.map +1 -1
  127. package/dest/deployment/register_class.js +19 -14
  128. package/dest/entrypoint/default_entrypoint.d.ts +2 -2
  129. package/dest/entrypoint/default_entrypoint.d.ts.map +1 -1
  130. package/dest/entrypoint/default_entrypoint.js +11 -9
  131. package/dest/entrypoint/default_multi_call_entrypoint.d.ts +2 -2
  132. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
  133. package/dest/entrypoint/default_multi_call_entrypoint.js +68 -25
  134. package/dest/entrypoint/entrypoint.d.ts +7 -3
  135. package/dest/entrypoint/entrypoint.d.ts.map +1 -1
  136. package/dest/entrypoint/entrypoint.js +0 -1
  137. package/dest/entrypoint/payload.d.ts +8 -5
  138. package/dest/entrypoint/payload.d.ts.map +1 -1
  139. package/dest/entrypoint/payload.js +78 -85
  140. package/dest/fee/fee_juice_payment_method.d.ts +3 -3
  141. package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
  142. package/dest/fee/fee_juice_payment_method.js +5 -4
  143. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +5 -4
  144. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  145. package/dest/fee/fee_juice_payment_method_with_claim.js +18 -20
  146. package/dest/fee/fee_payment_method.d.ts +3 -3
  147. package/dest/fee/fee_payment_method.d.ts.map +1 -1
  148. package/dest/fee/fee_payment_method.js +3 -2
  149. package/dest/fee/private_fee_payment_method.d.ts +5 -5
  150. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  151. package/dest/fee/private_fee_payment_method.js +40 -38
  152. package/dest/fee/public_fee_payment_method.d.ts +5 -5
  153. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  154. package/dest/fee/public_fee_payment_method.js +38 -35
  155. package/dest/index.d.ts +25 -12
  156. package/dest/index.d.ts.map +1 -1
  157. package/dest/index.js +24 -14
  158. package/dest/rpc_clients/index.js +0 -1
  159. package/dest/rpc_clients/node/index.d.ts +2 -1
  160. package/dest/rpc_clients/node/index.d.ts.map +1 -1
  161. package/dest/rpc_clients/node/index.js +35 -18
  162. package/dest/rpc_clients/pxe_client.d.ts +2 -2
  163. package/dest/rpc_clients/pxe_client.d.ts.map +1 -1
  164. package/dest/rpc_clients/pxe_client.js +9 -7
  165. package/dest/utils/abi_types.d.ts +4 -1
  166. package/dest/utils/abi_types.d.ts.map +1 -1
  167. package/dest/utils/abi_types.js +1 -2
  168. package/dest/utils/authwit.d.ts +3 -2
  169. package/dest/utils/authwit.d.ts.map +1 -1
  170. package/dest/utils/authwit.js +18 -17
  171. package/dest/utils/aztec_cheatcodes.d.ts +4 -2
  172. package/dest/utils/aztec_cheatcodes.d.ts.map +1 -1
  173. package/dest/utils/aztec_cheatcodes.js +32 -41
  174. package/dest/utils/field_compressed_string.js +3 -5
  175. package/dest/utils/index.d.ts +1 -1
  176. package/dest/utils/index.d.ts.map +1 -1
  177. package/dest/utils/index.js +1 -2
  178. package/dest/utils/node.d.ts +3 -3
  179. package/dest/utils/node.d.ts.map +1 -1
  180. package/dest/utils/node.js +4 -6
  181. package/dest/utils/pub_key.d.ts +2 -1
  182. package/dest/utils/pub_key.d.ts.map +1 -1
  183. package/dest/utils/pub_key.js +2 -4
  184. package/dest/utils/pxe.d.ts +2 -2
  185. package/dest/utils/pxe.d.ts.map +1 -1
  186. package/dest/utils/pxe.js +3 -5
  187. package/dest/wallet/account_wallet.d.ts +8 -5
  188. package/dest/wallet/account_wallet.d.ts.map +1 -1
  189. package/dest/wallet/account_wallet.js +120 -83
  190. package/dest/wallet/account_wallet_with_private_key.d.ts +5 -5
  191. package/dest/wallet/account_wallet_with_private_key.d.ts.map +1 -1
  192. package/dest/wallet/account_wallet_with_private_key.js +10 -16
  193. package/dest/wallet/base_wallet.d.ts +19 -10
  194. package/dest/wallet/base_wallet.d.ts.map +1 -1
  195. package/dest/wallet/base_wallet.js +12 -13
  196. package/dest/wallet/index.d.ts +3 -3
  197. package/dest/wallet/index.d.ts.map +1 -1
  198. package/dest/wallet/index.js +2 -4
  199. package/dest/wallet/signerless_wallet.d.ts +7 -4
  200. package/dest/wallet/signerless_wallet.d.ts.map +1 -1
  201. package/dest/wallet/signerless_wallet.js +4 -6
  202. package/package.json +10 -14
  203. package/src/account/contract.ts +22 -5
  204. package/src/account/index.ts +2 -2
  205. package/src/account/interface.ts +5 -4
  206. package/src/account/wallet.ts +4 -3
  207. package/src/account_manager/deploy_account_method.ts +5 -5
  208. package/src/account_manager/deploy_account_sent_tx.ts +4 -3
  209. package/src/account_manager/index.ts +51 -24
  210. package/src/api/abi.ts +10 -3
  211. package/src/api/account.ts +8 -3
  212. package/src/api/addresses.ts +2 -2
  213. package/src/api/cheat_codes.ts +6 -6
  214. package/src/api/ethereum/anvil_test_watcher.ts +31 -7
  215. package/src/api/ethereum/chain_monitor.ts +9 -2
  216. package/src/api/ethereum/cheat_codes.ts +65 -24
  217. package/src/api/ethereum/index.ts +5 -1
  218. package/src/api/ethereum/l1_contracts.ts +1 -1
  219. package/src/api/ethereum/portal_manager.ts +27 -32
  220. package/src/api/fee.ts +0 -1
  221. package/src/api/interfaces/pxe.ts +1 -1
  222. package/src/api/log_id.ts +1 -1
  223. package/src/api/tx_hash.ts +1 -1
  224. package/src/api/wallet.ts +1 -1
  225. package/src/contract/base_contract_interaction.ts +35 -9
  226. package/src/contract/batch_call.ts +9 -7
  227. package/src/contract/checker.ts +1 -1
  228. package/src/contract/contract.ts +11 -4
  229. package/src/contract/contract_base.ts +3 -3
  230. package/src/contract/contract_function_interaction.ts +24 -13
  231. package/src/contract/deploy_method.ts +27 -18
  232. package/src/contract/deploy_proven_tx.ts +6 -4
  233. package/src/contract/deploy_sent_tx.ts +8 -6
  234. package/src/contract/get_gas_limits.ts +2 -2
  235. package/src/contract/protocol_contracts.ts +35 -0
  236. package/src/contract/proven_tx.ts +3 -2
  237. package/src/contract/sent_tx.ts +3 -2
  238. package/src/contract/unsafe_contract.ts +3 -3
  239. package/src/deployment/broadcast_function.ts +47 -40
  240. package/src/deployment/contract_deployer.ts +4 -3
  241. package/src/deployment/deploy_instance.ts +5 -5
  242. package/src/deployment/register_class.ts +25 -18
  243. package/src/entrypoint/default_entrypoint.ts +5 -5
  244. package/src/entrypoint/default_multi_call_entrypoint.ts +5 -4
  245. package/src/entrypoint/entrypoint.ts +7 -3
  246. package/src/entrypoint/payload.ts +11 -6
  247. package/src/fee/fee_juice_payment_method.ts +5 -3
  248. package/src/fee/fee_juice_payment_method_with_claim.ts +11 -10
  249. package/src/fee/fee_payment_method.ts +3 -3
  250. package/src/fee/private_fee_payment_method.ts +10 -11
  251. package/src/fee/public_fee_payment_method.ts +11 -11
  252. package/src/index.ts +35 -58
  253. package/src/rpc_clients/node/index.ts +2 -1
  254. package/src/rpc_clients/pxe_client.ts +2 -2
  255. package/src/utils/abi_types.ts +4 -7
  256. package/src/utils/authwit.ts +5 -2
  257. package/src/utils/aztec_cheatcodes.ts +5 -3
  258. package/src/utils/field_compressed_string.ts +1 -1
  259. package/src/utils/index.ts +1 -1
  260. package/src/utils/node.ts +3 -3
  261. package/src/utils/pub_key.ts +3 -2
  262. package/src/utils/pxe.ts +2 -2
  263. package/src/wallet/account_wallet.ts +8 -5
  264. package/src/wallet/account_wallet_with_private_key.ts +5 -4
  265. package/src/wallet/base_wallet.ts +37 -46
  266. package/src/wallet/index.ts +3 -3
  267. package/src/wallet/signerless_wallet.ts +7 -4
  268. package/dest/deployment/protocol_contracts.d.ts.map +0 -1
  269. package/dest/deployment/protocol_contracts.js +0 -14
  270. package/dest/fee/no_fee_payment_method.d.ts +0 -13
  271. package/dest/fee/no_fee_payment_method.d.ts.map +0 -1
  272. package/dest/fee/no_fee_payment_method.js +0 -17
  273. package/src/deployment/protocol_contracts.ts +0 -17
  274. package/src/fee/no_fee_payment_method.ts +0 -23
@@ -1,4 +1,4 @@
1
- import { type L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
1
+ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
2
2
  import { retryUntil } from '@aztec/foundation/retry';
3
3
 
4
4
  import { createPXEClient } from '../../rpc_clients/index.js';
@@ -1,23 +1,19 @@
1
- import { type PXE, type SiblingPath } from '@aztec/circuit-types';
2
- import { type AztecAddress, EthAddress, Fr } from '@aztec/circuits.js';
3
- import { computeSecretHash } from '@aztec/circuits.js/hash';
1
+ import type { ViemPublicClient, ViemWalletClient } from '@aztec/ethereum';
4
2
  import { extractEvent } from '@aztec/ethereum/utils';
5
3
  import { sha256ToField } from '@aztec/foundation/crypto';
6
- import { type Logger } from '@aztec/foundation/log';
4
+ import { EthAddress } from '@aztec/foundation/eth-address';
5
+ import { Fr } from '@aztec/foundation/fields';
6
+ import type { Logger } from '@aztec/foundation/log';
7
+ import type { SiblingPath } from '@aztec/foundation/trees';
7
8
  import { FeeJuicePortalAbi, OutboxAbi, TestERC20Abi, TokenPortalAbi } from '@aztec/l1-artifacts';
9
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
10
+ import { computeSecretHash } from '@aztec/stdlib/hash';
11
+ import type { PXE } from '@aztec/stdlib/interfaces/client';
8
12
 
9
- import {
10
- type Account,
11
- type Chain,
12
- type GetContractReturnType,
13
- type Hex,
14
- type HttpTransport,
15
- type PublicClient,
16
- type WalletClient,
17
- getContract,
18
- toFunctionSelector,
19
- } from 'viem';
13
+ import { type GetContractReturnType, type Hex, getContract, toFunctionSelector } from 'viem';
20
14
 
15
+ // docs:start:claim_type
16
+ // docs:start:claim_type_amount
21
17
  /** L1 to L2 message info to claim it on L2. */
22
18
  export type L2Claim = {
23
19
  /** Secret for claiming. */
@@ -29,9 +25,11 @@ export type L2Claim = {
29
25
  /** Leaf index in the L1 to L2 message tree. */
30
26
  messageLeafIndex: bigint;
31
27
  };
28
+ // docs:end:claim_type
32
29
 
33
30
  /** L1 to L2 message info that corresponds to an amount to claim. */
34
31
  export type L2AmountClaim = L2Claim & { /** Amount to claim */ claimAmount: bigint };
32
+ // docs:end:claim_type_amount
35
33
 
36
34
  /** L1 to L2 message info that corresponds to an amount to claim with associated recipient. */
37
35
  export type L2AmountClaimWithRecipient = L2AmountClaim & {
@@ -53,13 +51,13 @@ export async function generateClaimSecret(logger?: Logger): Promise<[Fr, Fr]> {
53
51
 
54
52
  /** Helper for managing an ERC20 on L1. */
55
53
  export class L1TokenManager {
56
- private contract: GetContractReturnType<typeof TestERC20Abi, WalletClient<HttpTransport, Chain, Account>>;
54
+ private contract: GetContractReturnType<typeof TestERC20Abi, ViemWalletClient>;
57
55
 
58
56
  public constructor(
59
57
  /** Address of the ERC20 contract. */
60
58
  public readonly address: EthAddress,
61
- private publicClient: PublicClient<HttpTransport, Chain>,
62
- private walletClient: WalletClient<HttpTransport, Chain, Account>,
59
+ private publicClient: ViemPublicClient,
60
+ private walletClient: ViemWalletClient,
63
61
  private logger: Logger,
64
62
  ) {
65
63
  this.contract = getContract({
@@ -107,16 +105,13 @@ export class L1TokenManager {
107
105
  /** Helper for interacting with the FeeJuicePortal on L1. */
108
106
  export class L1FeeJuicePortalManager {
109
107
  private readonly tokenManager: L1TokenManager;
110
- private readonly contract: GetContractReturnType<
111
- typeof FeeJuicePortalAbi,
112
- WalletClient<HttpTransport, Chain, Account>
113
- >;
108
+ private readonly contract: GetContractReturnType<typeof FeeJuicePortalAbi, ViemWalletClient>;
114
109
 
115
110
  constructor(
116
111
  portalAddress: EthAddress,
117
112
  tokenAddress: EthAddress,
118
- private readonly publicClient: PublicClient<HttpTransport, Chain>,
119
- private readonly walletClient: WalletClient<HttpTransport, Chain, Account>,
113
+ private readonly publicClient: ViemPublicClient,
114
+ private readonly walletClient: ViemWalletClient,
120
115
  private readonly logger: Logger,
121
116
  ) {
122
117
  this.tokenManager = new L1TokenManager(tokenAddress, publicClient, walletClient, logger);
@@ -187,8 +182,8 @@ export class L1FeeJuicePortalManager {
187
182
  */
188
183
  public static async new(
189
184
  pxe: PXE,
190
- publicClient: PublicClient<HttpTransport, Chain>,
191
- walletClient: WalletClient<HttpTransport, Chain, Account>,
185
+ publicClient: ViemPublicClient,
186
+ walletClient: ViemWalletClient,
192
187
  logger: Logger,
193
188
  ): Promise<L1FeeJuicePortalManager> {
194
189
  const {
@@ -205,14 +200,14 @@ export class L1FeeJuicePortalManager {
205
200
 
206
201
  /** Helper for interacting with a test TokenPortal on L1 for sending tokens to L2. */
207
202
  export class L1ToL2TokenPortalManager {
208
- protected readonly portal: GetContractReturnType<typeof TokenPortalAbi, WalletClient<HttpTransport, Chain, Account>>;
203
+ protected readonly portal: GetContractReturnType<typeof TokenPortalAbi, ViemWalletClient>;
209
204
  protected readonly tokenManager: L1TokenManager;
210
205
 
211
206
  constructor(
212
207
  portalAddress: EthAddress,
213
208
  tokenAddress: EthAddress,
214
- protected publicClient: PublicClient<HttpTransport, Chain>,
215
- protected walletClient: WalletClient<HttpTransport, Chain, Account>,
209
+ protected publicClient: ViemPublicClient,
210
+ protected walletClient: ViemWalletClient,
216
211
  protected logger: Logger,
217
212
  ) {
218
213
  this.tokenManager = new L1TokenManager(tokenAddress, publicClient, walletClient, logger);
@@ -323,14 +318,14 @@ export class L1ToL2TokenPortalManager {
323
318
 
324
319
  /** Helper for interacting with a test TokenPortal on L1 for both withdrawing from and bridging to L2. */
325
320
  export class L1TokenPortalManager extends L1ToL2TokenPortalManager {
326
- private readonly outbox: GetContractReturnType<typeof OutboxAbi, WalletClient<HttpTransport, Chain, Account>>;
321
+ private readonly outbox: GetContractReturnType<typeof OutboxAbi, ViemWalletClient>;
327
322
 
328
323
  constructor(
329
324
  portalAddress: EthAddress,
330
325
  tokenAddress: EthAddress,
331
326
  outboxAddress: EthAddress,
332
- publicClient: PublicClient<HttpTransport, Chain>,
333
- walletClient: WalletClient<HttpTransport, Chain, Account>,
327
+ publicClient: ViemPublicClient,
328
+ walletClient: ViemWalletClient,
334
329
  logger: Logger,
335
330
  ) {
336
331
  super(portalAddress, tokenAddress, publicClient, walletClient, logger);
package/src/api/fee.ts CHANGED
@@ -3,4 +3,3 @@ export { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
3
3
  export { PrivateFeePaymentMethod } from '../fee/private_fee_payment_method.js';
4
4
  export { PublicFeePaymentMethod } from '../fee/public_fee_payment_method.js';
5
5
  export { FeeJuicePaymentMethodWithClaim } from '../fee/fee_juice_payment_method_with_claim.js';
6
- export { NoFeePaymentMethod } from '../fee/no_fee_payment_method.js';
@@ -1 +1 @@
1
- export { PXE } from '@aztec/circuit-types/interfaces';
1
+ export type { PXE } from '@aztec/stdlib/interfaces/client';
package/src/api/log_id.ts CHANGED
@@ -1 +1 @@
1
- export { LogId } from '@aztec/circuit-types/log_id';
1
+ export { LogId } from '@aztec/stdlib/logs';
@@ -1 +1 @@
1
- export { TxHash } from '@aztec/circuit-types/tx_hash';
1
+ export { TxHash } from '@aztec/stdlib/tx';
package/src/api/wallet.ts CHANGED
@@ -2,6 +2,6 @@ export {
2
2
  AccountWallet,
3
3
  AccountWalletWithSecretKey as AccountWalletWithSecretKey,
4
4
  SignerlessWallet,
5
- Wallet,
5
+ type Wallet,
6
6
  getWallet,
7
7
  } from '../wallet/index.js';
@@ -1,11 +1,12 @@
1
- import { type TxExecutionRequest, type TxProvingResult } from '@aztec/circuit-types';
2
- import { type Fr, GasSettings } from '@aztec/circuits.js';
1
+ import type { Fr } from '@aztec/foundation/fields';
3
2
  import { createLogger } from '@aztec/foundation/log';
3
+ import { GasSettings } from '@aztec/stdlib/gas';
4
+ import type { Capsule, TxExecutionRequest, TxProvingResult } from '@aztec/stdlib/tx';
4
5
 
5
- import { type Wallet } from '../account/wallet.js';
6
- import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
7
- import { type FeeOptions, type UserFeeOptions } from '../entrypoint/payload.js';
8
- import { NoFeePaymentMethod } from '../fee/no_fee_payment_method.js';
6
+ import type { Wallet } from '../account/wallet.js';
7
+ import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
8
+ import type { FeeOptions, UserFeeOptions } from '../entrypoint/payload.js';
9
+ import { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
9
10
  import { getGasLimits } from './get_gas_limits.js';
10
11
  import { ProvenTx } from './proven_tx.js';
11
12
  import { SentTx } from './sent_tx.js';
@@ -32,6 +33,8 @@ export type SendMethodOptions = {
32
33
  export abstract class BaseContractInteraction {
33
34
  protected log = createLogger('aztecjs:contract_interaction');
34
35
 
36
+ private capsules: Capsule[] = [];
37
+
35
38
  constructor(protected wallet: Wallet) {}
36
39
 
37
40
  /**
@@ -102,7 +105,7 @@ export abstract class BaseContractInteraction {
102
105
  true /*simulatePublic*/,
103
106
  undefined /* msgSender */,
104
107
  undefined /* skipTxValidation */,
105
- false /* enforceFeePayment */,
108
+ true /* skipFeeEnforcement */,
106
109
  );
107
110
  const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
108
111
  simulationResult,
@@ -118,7 +121,7 @@ export abstract class BaseContractInteraction {
118
121
  protected async getDefaultFeeOptions(fee: UserFeeOptions | undefined): Promise<FeeOptions> {
119
122
  const maxFeesPerGas =
120
123
  fee?.gasSettings?.maxFeesPerGas ?? (await this.wallet.getCurrentBaseFees()).mul(1 + (fee?.baseFeePadding ?? 0.5));
121
- const paymentMethod = fee?.paymentMethod ?? new NoFeePaymentMethod();
124
+ const paymentMethod = fee?.paymentMethod ?? new FeeJuicePaymentMethod(this.wallet.getAddress());
122
125
  const gasSettings: GasSettings = GasSettings.default({ ...fee?.gasSettings, maxFeesPerGas });
123
126
  this.log.debug(`Using L2 gas settings`, gasSettings);
124
127
  return { gasSettings, paymentMethod };
@@ -149,7 +152,7 @@ export abstract class BaseContractInteraction {
149
152
  true /*simulatePublic*/,
150
153
  undefined /* msgSender */,
151
154
  undefined /* skipTxValidation */,
152
- false /* enforceFeePayment */,
155
+ true /* skipFeeEnforcement */,
153
156
  );
154
157
  const { totalGas: gasLimits, teardownGas: teardownGasLimits } = getGasLimits(
155
158
  simulationResult,
@@ -163,4 +166,27 @@ export abstract class BaseContractInteraction {
163
166
 
164
167
  return { gasSettings, paymentMethod };
165
168
  }
169
+
170
+ /**
171
+ * Add data passed to the oracle calls during this contract interaction.
172
+ * @param capsule - Data passed to oracle calls.
173
+ */
174
+ public addCapsule(capsule: Capsule) {
175
+ this.capsules.push(capsule);
176
+ }
177
+
178
+ /**
179
+ * Add data passed to the oracle calls during this contract interaction.
180
+ * @param capsules - Data passed to oracle calls.
181
+ */
182
+ public addCapsules(capsules: Capsule[]) {
183
+ this.capsules.push(...capsules);
184
+ }
185
+
186
+ /**
187
+ * Return all capsules added for this function interaction.
188
+ */
189
+ public getCapsules() {
190
+ return this.capsules;
191
+ }
166
192
  }
@@ -1,7 +1,7 @@
1
- import { type FunctionCall, type TxExecutionRequest } from '@aztec/circuit-types';
2
- import { FunctionType, decodeFromAbi } from '@aztec/foundation/abi';
1
+ import { type FunctionCall, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
2
+ import type { TxExecutionRequest } from '@aztec/stdlib/tx';
3
3
 
4
- import { type Wallet } from '../account/index.js';
4
+ import type { Wallet } from '../account/index.js';
5
5
  import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
6
6
  import type { SimulateMethodOptions } from './contract_function_interaction.js';
7
7
 
@@ -19,8 +19,9 @@ export class BatchCall extends BaseContractInteraction {
19
19
  */
20
20
  public async create(opts?: SendMethodOptions): Promise<TxExecutionRequest> {
21
21
  const calls = this.calls;
22
- const fee = await this.getFeeOptions({ calls, ...opts });
23
- return await this.wallet.createTxExecutionRequest({ calls, ...opts, fee });
22
+ const capsules = this.getCapsules();
23
+ const fee = await this.getFeeOptions({ calls, capsules, ...opts });
24
+ return await this.wallet.createTxExecutionRequest({ calls, capsules, ...opts, fee });
24
25
  }
25
26
 
26
27
  /**
@@ -59,8 +60,9 @@ export class BatchCall extends BaseContractInteraction {
59
60
  );
60
61
 
61
62
  const calls = indexedCalls.map(([call]) => call);
62
- const fee = await this.getFeeOptions({ calls, ...options });
63
- const txRequest = await this.wallet.createTxExecutionRequest({ calls, ...options, fee });
63
+ const capsules = this.getCapsules();
64
+ const fee = await this.getFeeOptions({ calls, capsules, ...options });
65
+ const txRequest = await this.wallet.createTxExecutionRequest({ calls, capsules, ...options, fee });
64
66
 
65
67
  const unconstrainedCalls = unconstrained.map(
66
68
  async ([call, index]) =>
@@ -1,4 +1,4 @@
1
- import { type AbiType, type BasicType, type ContractArtifact, type StructType } from '@aztec/foundation/abi';
1
+ import type { AbiType, BasicType, ContractArtifact, StructType } from '@aztec/stdlib/abi';
2
2
 
3
3
  /**
4
4
  * Represents a type derived from input type T with the 'kind' property removed.
@@ -1,8 +1,9 @@
1
- import { PublicKeys } from '@aztec/circuits.js';
2
- import { type ContractArtifact } from '@aztec/foundation/abi';
3
- import { type AztecAddress } from '@aztec/foundation/aztec-address';
1
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
2
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
4
+ import { PublicKeys } from '@aztec/stdlib/keys';
4
5
 
5
- import { type Wallet } from '../account/index.js';
6
+ import type { Wallet } from '../account/index.js';
6
7
  import { ContractBase } from './contract_base.js';
7
8
  import { DeployMethod } from './deploy_method.js';
8
9
 
@@ -26,6 +27,12 @@ export class Contract extends ContractBase {
26
27
  if (instance === undefined) {
27
28
  throw new Error(`Contract instance at ${address.toString()} has not been registered in the wallet's PXE`);
28
29
  }
30
+ const thisContractClass = await getContractClassFromArtifact(artifact);
31
+ if (!thisContractClass.id.equals(instance.currentContractClassId)) {
32
+ // wallet holds an outdated version of this contract
33
+ await wallet.updateContract(address, artifact);
34
+ instance.currentContractClassId = thisContractClass.id;
35
+ }
29
36
  return new Contract(instance, artifact, wallet);
30
37
  }
31
38
 
@@ -1,13 +1,13 @@
1
- import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/circuits.js';
2
1
  import {
3
2
  type ContractArtifact,
4
3
  type ContractNote,
5
4
  type FieldLayout,
6
5
  type FunctionArtifact,
7
6
  FunctionSelector,
8
- } from '@aztec/foundation/abi';
7
+ } from '@aztec/stdlib/abi';
8
+ import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/stdlib/contract';
9
9
 
10
- import { type Wallet } from '../account/index.js';
10
+ import type { Wallet } from '../account/index.js';
11
11
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
12
12
 
13
13
  /**
@@ -1,30 +1,33 @@
1
- import type { FunctionCall, PrivateKernelProverProfileResult, TxExecutionRequest } from '@aztec/circuit-types';
2
- import { type AztecAddress, type GasSettings } from '@aztec/circuits.js';
3
1
  import {
4
2
  type FunctionAbi,
3
+ FunctionCall,
5
4
  FunctionSelector,
6
5
  FunctionType,
7
6
  decodeFromAbi,
8
7
  encodeArguments,
9
- } from '@aztec/foundation/abi';
8
+ } from '@aztec/stdlib/abi';
9
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
10
+ import type { PrivateKernelProverProfileResult } from '@aztec/stdlib/kernel';
11
+ import type { TxExecutionRequest } from '@aztec/stdlib/tx';
10
12
 
11
- import { type Wallet } from '../account/wallet.js';
13
+ import type { Wallet } from '../account/wallet.js';
14
+ import { FeeJuicePaymentMethod } from '../fee/fee_juice_payment_method.js';
12
15
  import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
13
16
 
14
- export { SendMethodOptions };
17
+ export type { SendMethodOptions };
15
18
 
16
19
  /**
17
20
  * Represents the options for simulating a contract function interaction.
18
21
  * Allows specifying the address from which the view method should be called.
19
22
  * Disregarded for simulation of public functions
20
23
  */
21
- export type SimulateMethodOptions = {
24
+ export type SimulateMethodOptions = Pick<SendMethodOptions, 'fee'> & {
22
25
  /** The sender's Aztec address. */
23
26
  from?: AztecAddress;
24
- /** Gas settings for the simulation. */
25
- gasSettings?: GasSettings;
26
27
  /** Simulate without checking for the validity of the resulting transaction, e.g. whether it emits any existing nullifiers. */
27
28
  skipTxValidation?: boolean;
29
+ /** Whether to ensure the fee payer is not empty and has enough balance to pay for the fee. */
30
+ skipFeeEnforcement?: boolean;
28
31
  };
29
32
 
30
33
  /**
@@ -65,9 +68,10 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
65
68
  throw new Error("Can't call `create` on an unconstrained function.");
66
69
  }
67
70
  const calls = [await this.request()];
68
- const fee = await this.getFeeOptions({ calls, ...opts });
71
+ const capsules = this.getCapsules();
72
+ const fee = await this.getFeeOptions({ calls, capsules, ...opts });
69
73
  const { nonce, cancellable } = opts;
70
- return await this.wallet.createTxExecutionRequest({ calls, fee, nonce, cancellable });
74
+ return await this.wallet.createTxExecutionRequest({ calls, fee, nonce, cancellable, capsules });
71
75
  }
72
76
 
73
77
  // docs:start:request
@@ -106,8 +110,15 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
106
110
  return this.wallet.simulateUnconstrained(this.functionDao.name, this.args, this.contractAddress, options?.from);
107
111
  }
108
112
 
109
- const txRequest = await this.create();
110
- const simulatedTx = await this.wallet.simulateTx(txRequest, true, options?.from, options?.skipTxValidation);
113
+ const fee = options.fee ?? { paymentMethod: new FeeJuicePaymentMethod(AztecAddress.ZERO) };
114
+ const txRequest = await this.create({ fee });
115
+ const simulatedTx = await this.wallet.simulateTx(
116
+ txRequest,
117
+ true /* simulatePublic */,
118
+ options.from,
119
+ options.skipTxValidation,
120
+ options.skipFeeEnforcement ?? true,
121
+ );
111
122
 
112
123
  let rawReturnValues;
113
124
  if (this.functionDao.functionType == FunctionType.PRIVATE) {
@@ -138,7 +149,7 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
138
149
  throw new Error("Can't profile an unconstrained function.");
139
150
  }
140
151
 
141
- const txRequest = await this.create();
152
+ const txRequest = await this.create({ fee: options.fee });
142
153
  const simulatedTx = await this.wallet.simulateTx(
143
154
  txRequest,
144
155
  true,
@@ -1,22 +1,23 @@
1
- import { type FunctionCall, type TxExecutionRequest } from '@aztec/circuit-types';
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import { type ContractArtifact, type FunctionArtifact, type FunctionCall, getInitializer } from '@aztec/stdlib/abi';
3
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
2
4
  import {
3
- AztecAddress,
4
5
  type ContractInstanceWithAddress,
5
- type PublicKeys,
6
6
  computePartialAddress,
7
7
  getContractClassFromArtifact,
8
8
  getContractInstanceFromDeployParams,
9
- } from '@aztec/circuits.js';
10
- import { type ContractArtifact, type FunctionArtifact, getInitializer } from '@aztec/foundation/abi';
11
- import { type Fr } from '@aztec/foundation/fields';
9
+ } from '@aztec/stdlib/contract';
10
+ import type { GasSettings } from '@aztec/stdlib/gas';
11
+ import type { PublicKeys } from '@aztec/stdlib/keys';
12
+ import type { Capsule, TxExecutionRequest } from '@aztec/stdlib/tx';
12
13
 
13
- import { type Wallet } from '../account/index.js';
14
+ import type { Wallet } from '../account/index.js';
14
15
  import { deployInstance } from '../deployment/deploy_instance.js';
15
16
  import { registerContractClass } from '../deployment/register_class.js';
16
- import { type ExecutionRequestInit } from '../entrypoint/entrypoint.js';
17
+ import type { ExecutionRequestInit } from '../entrypoint/entrypoint.js';
17
18
  import { BaseContractInteraction, type SendMethodOptions } from './base_contract_interaction.js';
18
- import { type Contract } from './contract.js';
19
- import { type ContractBase } from './contract_base.js';
19
+ import type { Contract } from './contract.js';
20
+ import type { ContractBase } from './contract_base.js';
20
21
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
21
22
  import { DeployProvenTx } from './deploy_proven_tx.js';
22
23
  import { DeploySentTx } from './deploy_sent_tx.js';
@@ -111,9 +112,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
111
112
  const calls = [...deployment.calls, ...bootstrap.calls];
112
113
  const authWitnesses = [...(deployment.authWitnesses ?? []), ...(bootstrap.authWitnesses ?? [])];
113
114
  const hashedArguments = [...(deployment.hashedArguments ?? []), ...(bootstrap.hashedArguments ?? [])];
115
+ const capsules = [...(deployment.capsules ?? []), ...(bootstrap.capsules ?? [])];
114
116
  const { cancellable, nonce, fee: userFee } = options;
115
117
 
116
- const request = { calls, authWitnesses, hashedArguments, cancellable, fee: userFee, nonce };
118
+ const request = { calls, authWitnesses, hashedArguments, capsules, cancellable, fee: userFee, nonce };
117
119
 
118
120
  const fee = await this.getFeeOptions(request);
119
121
  return { ...request, fee };
@@ -136,8 +138,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
136
138
  */
137
139
  protected async getDeploymentFunctionCalls(
138
140
  options: DeployOptions = {},
139
- ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments'>> {
141
+ ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
140
142
  const calls: FunctionCall[] = [];
143
+ const capsules: Capsule[] = [];
141
144
 
142
145
  // Set contract instance object so it's available for populating the DeploySendTx object
143
146
  const instance = await this.getInstance(options);
@@ -145,9 +148,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
145
148
  // Obtain contract class from artifact and check it matches the reported one by the instance.
146
149
  // TODO(@spalladino): We're unnecessarily calculating the contract class multiple times here.
147
150
  const contractClass = await getContractClassFromArtifact(this.artifact);
148
- if (!instance.contractClassId.equals(contractClass.id)) {
151
+ if (!instance.currentContractClassId.equals(contractClass.id)) {
149
152
  throw new Error(
150
- `Contract class mismatch when deploying contract: got ${instance.contractClassId.toString()} from instance and ${contractClass.id.toString()} from artifact`,
153
+ `Contract class mismatch when deploying contract: got ${instance.currentContractClassId.toString()} from instance and ${contractClass.id.toString()} from artifact`,
151
154
  );
152
155
  }
153
156
 
@@ -163,6 +166,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
163
166
  );
164
167
  const registerContractClassInteraction = await registerContractClass(this.wallet, this.artifact);
165
168
  calls.push(await registerContractClassInteraction.request());
169
+ capsules.push(...registerContractClassInteraction.getCapsules());
166
170
  }
167
171
  }
168
172
 
@@ -170,9 +174,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
170
174
  if (!options.skipPublicDeployment) {
171
175
  const deploymentInteraction = await deployInstance(this.wallet, instance);
172
176
  calls.push(await deploymentInteraction.request());
177
+ capsules.push(...deploymentInteraction.getCapsules());
173
178
  }
174
179
 
175
- return { calls };
180
+ return { calls, capsules };
176
181
  }
177
182
 
178
183
  /**
@@ -182,9 +187,10 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
182
187
  */
183
188
  protected async getInitializeFunctionCalls(
184
189
  options: DeployOptions,
185
- ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments'>> {
190
+ ): Promise<Pick<ExecutionRequestInit, 'calls' | 'authWitnesses' | 'hashedArguments' | 'capsules'>> {
186
191
  const { address } = await this.getInstance(options);
187
192
  const calls: FunctionCall[] = [];
193
+ const capsules: Capsule[] = [];
188
194
  if (this.constructorArtifact && !options.skipInitialization) {
189
195
  const constructorCall = new ContractFunctionInteraction(
190
196
  this.wallet,
@@ -193,8 +199,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
193
199
  this.args,
194
200
  );
195
201
  calls.push(await constructorCall.request());
202
+ capsules.push(...constructorCall.getCapsules());
196
203
  }
197
- return { calls };
204
+ return { calls, capsules };
198
205
  }
199
206
 
200
207
  /**
@@ -246,7 +253,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
246
253
  * Estimates gas cost for this deployment operation.
247
254
  * @param options - Options.
248
255
  */
249
- public override estimateGas(options?: Omit<DeployOptions, 'estimateGas' | 'skipPublicSimulation'>) {
256
+ public override estimateGas(
257
+ options?: Omit<DeployOptions, 'estimateGas' | 'skipPublicSimulation'>,
258
+ ): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>> {
250
259
  return super.estimateGas(options);
251
260
  }
252
261
 
@@ -1,8 +1,10 @@
1
- import { type PXE, type Tx } from '@aztec/circuit-types';
2
- import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
1
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
+ import type { PXE } from '@aztec/stdlib/interfaces/client';
4
+ import type { Tx } from '@aztec/stdlib/tx';
3
5
 
4
- import { type Wallet } from '../account/index.js';
5
- import { type Contract } from './contract.js';
6
+ import type { Wallet } from '../account/index.js';
7
+ import type { Contract } from './contract.js';
6
8
  import { DeploySentTx } from './deploy_sent_tx.js';
7
9
  import { ProvenTx } from './proven_tx.js';
8
10
 
@@ -1,11 +1,13 @@
1
- import { type PXE, type TxHash, type TxReceipt } from '@aztec/circuit-types';
2
- import { type AztecAddress, type ContractInstanceWithAddress } from '@aztec/circuits.js';
3
1
  import { createLogger } from '@aztec/foundation/log';
4
- import { type FieldsOf } from '@aztec/foundation/types';
2
+ import type { FieldsOf } from '@aztec/foundation/types';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
+ import type { PXE } from '@aztec/stdlib/interfaces/client';
6
+ import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
5
7
 
6
- import { type Wallet } from '../account/index.js';
7
- import { type Contract } from './contract.js';
8
- import { type ContractBase } from './contract_base.js';
8
+ import type { Wallet } from '../account/index.js';
9
+ import type { Contract } from './contract.js';
10
+ import type { ContractBase } from './contract_base.js';
9
11
  import { SentTx, type WaitOpts } from './sent_tx.js';
10
12
 
11
13
  /** Options related to waiting for a deployment tx. */
@@ -1,5 +1,5 @@
1
- import { type TxSimulationResult } from '@aztec/circuit-types';
2
- import { type Gas } from '@aztec/circuits.js';
1
+ import type { Gas } from '@aztec/stdlib/gas';
2
+ import type { TxSimulationResult } from '@aztec/stdlib/tx';
3
3
 
4
4
  /**
5
5
  * Returns suggested total and teardown gas limits for a simulated tx.
@@ -0,0 +1,35 @@
1
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+
3
+ import type { Wallet } from '../wallet/index.js';
4
+ import { UnsafeContract } from './unsafe_contract.js';
5
+
6
+ /** Returns a Contract wrapper for the class registerer. */
7
+ export async function getRegistererContract(wallet: Wallet) {
8
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegisterer);
9
+ if (!contractInstance) {
10
+ throw new Error("ContractClassRegisterer is not registered in this wallet's instance");
11
+ }
12
+ const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
13
+
14
+ return new UnsafeContract(contractInstance!, artifact!, wallet);
15
+ }
16
+
17
+ /** Returns a Contract wrapper for the instance deployer. */
18
+ export async function getDeployerContract(wallet: Wallet) {
19
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceDeployer);
20
+ if (!contractInstance) {
21
+ throw new Error("ContractInstanceDeployer is not registered in this wallet's instance");
22
+ }
23
+ const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
24
+ return new UnsafeContract(contractInstance!, artifact!, wallet);
25
+ }
26
+
27
+ /** Returns a Contract wrapper for the fee juice */
28
+ export async function getFeeJuice(wallet: Wallet) {
29
+ const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
30
+ if (!contractInstance) {
31
+ throw new Error("FeeJuice is not registered in this wallet's instance");
32
+ }
33
+ const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
34
+ return new UnsafeContract(contractInstance!, artifact!, wallet);
35
+ }
@@ -1,6 +1,7 @@
1
- import { type PXE, Tx } from '@aztec/circuit-types';
1
+ import type { PXE } from '@aztec/stdlib/interfaces/client';
2
+ import { Tx } from '@aztec/stdlib/tx';
2
3
 
3
- import { type Wallet } from '../account/index.js';
4
+ import type { Wallet } from '../account/index.js';
4
5
  import { SentTx } from './sent_tx.js';
5
6
 
6
7
  /**
@@ -1,6 +1,7 @@
1
- import { type GetPublicLogsResponse, type PXE, type TxHash, type TxReceipt, TxStatus } from '@aztec/circuit-types';
2
1
  import { retryUntil } from '@aztec/foundation/retry';
3
- import { type FieldsOf } from '@aztec/foundation/types';
2
+ import type { FieldsOf } from '@aztec/foundation/types';
3
+ import type { GetPublicLogsResponse, PXE } from '@aztec/stdlib/interfaces/client';
4
+ import { type TxHash, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
4
5
 
5
6
  /** Options related to waiting for a tx. */
6
7
  export type WaitOpts = {