@aztec/aztec.js 0.76.4-devnet-test-rc3 → 0.77.0-testnet-ignition.17

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 +5 -5
  32. package/dest/api/cheat_codes.d.ts.map +1 -1
  33. package/dest/api/cheat_codes.js +11 -16
  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 -6
  44. package/dest/api/ethereum/cheat_codes.d.ts.map +1 -1
  45. package/dest/api/ethereum/cheat_codes.js +106 -71
  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 +27 -14
  156. package/dest/index.d.ts.map +1 -1
  157. package/dest/index.js +26 -16
  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 +7 -7
  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 +64 -52
  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 +37 -63
  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,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 = {
@@ -1,7 +1,7 @@
1
- import { type ContractInstanceWithAddress } from '@aztec/circuits.js';
2
- import { type ContractArtifact } from '@aztec/foundation/abi';
1
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
2
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
3
 
4
- import { type Wallet } from '../wallet/index.js';
4
+ import type { Wallet } from '../wallet/index.js';
5
5
  import { ContractBase } from './contract_base.js';
6
6
 
7
7
  /** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
@@ -1,21 +1,23 @@
1
1
  import {
2
2
  ARTIFACT_FUNCTION_TREE_MAX_HEIGHT,
3
- AztecAddress,
4
3
  MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
5
- REGISTERER_CONTRACT_ADDRESS,
6
4
  REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT,
5
+ } from '@aztec/constants';
6
+ import { padArrayEnd } from '@aztec/foundation/collection';
7
+ import { Fr } from '@aztec/foundation/fields';
8
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
9
+ import { type ContractArtifact, FunctionSelector, FunctionType, bufferAsFields } from '@aztec/stdlib/abi';
10
+ import {
7
11
  computeVerificationKeyHash,
8
12
  createPrivateFunctionMembershipProof,
9
13
  createUnconstrainedFunctionMembershipProof,
10
14
  getContractClassFromArtifact,
11
- } from '@aztec/circuits.js';
12
- import { type ContractArtifact, FunctionSelector, FunctionType, bufferAsFields } from '@aztec/foundation/abi';
13
- import { padArrayEnd } from '@aztec/foundation/collection';
14
- import { Fr } from '@aztec/foundation/fields';
15
+ } from '@aztec/stdlib/contract';
16
+ import { Capsule } from '@aztec/stdlib/tx';
15
17
 
16
- import { type ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
17
- import { type Wallet } from '../wallet/index.js';
18
- import { getRegistererContract } from './protocol_contracts.js';
18
+ import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
19
+ import { getRegistererContract } from '../contract/protocol_contracts.js';
20
+ import type { Wallet } from '../wallet/index.js';
19
21
 
20
22
  /**
21
23
  * Sets up a call to broadcast a private function's bytecode via the ClassRegisterer contract.
@@ -55,31 +57,33 @@ export async function broadcastPrivateFunction(
55
57
  } = await createPrivateFunctionMembershipProof(selector, artifact);
56
58
 
57
59
  const vkHash = await computeVerificationKeyHash(privateFunctionArtifact);
60
+
61
+ const registerer = await getRegistererContract(wallet);
62
+ const fn = registerer.methods.broadcast_private_function(
63
+ contractClass.id,
64
+ artifactMetadataHash,
65
+ unconstrainedFunctionsArtifactTreeRoot,
66
+ privateFunctionTreeSiblingPath,
67
+ privateFunctionTreeLeafIndex,
68
+ padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
69
+ artifactTreeLeafIndex,
70
+ // eslint-disable-next-line camelcase
71
+ { selector, metadata_hash: functionMetadataHash, vk_hash: vkHash },
72
+ );
73
+
58
74
  const bytecode = bufferAsFields(
59
75
  privateFunctionArtifact.bytecode,
60
76
  MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
61
77
  );
62
-
63
- await wallet.storeCapsule(
64
- AztecAddress.fromNumber(REGISTERER_CONTRACT_ADDRESS),
65
- new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
66
- bytecode,
67
- );
68
-
69
- const registerer = await getRegistererContract(wallet);
70
- return Promise.resolve(
71
- registerer.methods.broadcast_private_function(
72
- contractClass.id,
73
- artifactMetadataHash,
74
- unconstrainedFunctionsArtifactTreeRoot,
75
- privateFunctionTreeSiblingPath,
76
- privateFunctionTreeLeafIndex,
77
- padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT),
78
- artifactTreeLeafIndex,
79
- // eslint-disable-next-line camelcase
80
- { selector, metadata_hash: functionMetadataHash, vk_hash: vkHash },
78
+ fn.addCapsule(
79
+ new Capsule(
80
+ ProtocolContractAddress.ContractClassRegisterer,
81
+ new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
82
+ bytecode,
81
83
  ),
82
84
  );
85
+
86
+ return fn;
83
87
  }
84
88
 
85
89
  /**
@@ -117,19 +121,8 @@ export async function broadcastUnconstrainedFunction(
117
121
  privateFunctionsArtifactTreeRoot,
118
122
  } = await createUnconstrainedFunctionMembershipProof(selector, artifact);
119
123
 
120
- const bytecode = bufferAsFields(
121
- unconstrainedFunctionArtifact.bytecode,
122
- MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
123
- );
124
-
125
- await wallet.storeCapsule(
126
- AztecAddress.fromNumber(REGISTERER_CONTRACT_ADDRESS),
127
- new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
128
- bytecode,
129
- );
130
-
131
124
  const registerer = await getRegistererContract(wallet);
132
- return registerer.methods.broadcast_unconstrained_function(
125
+ const fn = registerer.methods.broadcast_unconstrained_function(
133
126
  contractClass.id,
134
127
  artifactMetadataHash,
135
128
  privateFunctionsArtifactTreeRoot,
@@ -138,4 +131,18 @@ export async function broadcastUnconstrainedFunction(
138
131
  // eslint-disable-next-line camelcase
139
132
  { selector, metadata_hash: functionMetadataHash },
140
133
  );
134
+
135
+ const bytecode = bufferAsFields(
136
+ unconstrainedFunctionArtifact.bytecode,
137
+ MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
138
+ );
139
+ fn.addCapsule(
140
+ new Capsule(
141
+ ProtocolContractAddress.ContractClassRegisterer,
142
+ new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
143
+ bytecode,
144
+ ),
145
+ );
146
+
147
+ return fn;
141
148
  }
@@ -1,7 +1,8 @@
1
- import { type AztecAddress, PublicKeys } from '@aztec/circuits.js';
2
- import { type ContractArtifact } from '@aztec/foundation/abi';
1
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
2
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
+ import { PublicKeys } from '@aztec/stdlib/keys';
3
4
 
4
- import { type Wallet } from '../account/wallet.js';
5
+ import type { Wallet } from '../account/wallet.js';
5
6
  import { Contract } from '../contract/contract.js';
6
7
  import { DeployMethod } from '../contract/deploy_method.js';
7
8
 
@@ -1,8 +1,8 @@
1
- import { type ContractInstanceWithAddress } from '@aztec/circuits.js';
1
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
2
2
 
3
- import { type ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
4
- import { type Wallet } from '../wallet/index.js';
5
- import { getDeployerContract } from './protocol_contracts.js';
3
+ import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
4
+ import { getDeployerContract } from '../contract/protocol_contracts.js';
5
+ import type { Wallet } from '../wallet/index.js';
6
6
 
7
7
  /**
8
8
  * Sets up a call to the canonical deployer contract to publicly deploy a contract instance.
@@ -14,7 +14,7 @@ export async function deployInstance(
14
14
  instance: ContractInstanceWithAddress,
15
15
  ): Promise<ContractFunctionInteraction> {
16
16
  const deployerContract = await getDeployerContract(wallet);
17
- const { salt, contractClassId, publicKeys, deployer } = instance;
17
+ const { salt, currentContractClassId: contractClassId, publicKeys, deployer } = instance;
18
18
  const isUniversalDeploy = deployer.isZero();
19
19
  if (!isUniversalDeploy && !wallet.getAddress().equals(deployer)) {
20
20
  throw new Error(
@@ -1,16 +1,13 @@
1
- import {
2
- AztecAddress,
3
- Fr,
4
- MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS,
5
- REGISTERER_CONTRACT_ADDRESS,
6
- REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT,
7
- getContractClassFromArtifact,
8
- } from '@aztec/circuits.js';
9
- import { type ContractArtifact, bufferAsFields } from '@aztec/foundation/abi';
1
+ import { MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS, REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT } from '@aztec/constants';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
+ import { type ContractArtifact, bufferAsFields } from '@aztec/stdlib/abi';
5
+ import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
6
+ import { Capsule } from '@aztec/stdlib/tx';
10
7
 
11
- import { type ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
12
- import { type Wallet } from '../wallet/index.js';
13
- import { getRegistererContract } from './protocol_contracts.js';
8
+ import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
9
+ import { getRegistererContract } from '../contract/protocol_contracts.js';
10
+ import type { Wallet } from '../wallet/index.js';
14
11
 
15
12
  const defaultEmitPublicBytecode =
16
13
  // guard against `process` not being defined (e.g. in the browser)
@@ -26,12 +23,22 @@ export async function registerContractClass(
26
23
  ): Promise<ContractFunctionInteraction> {
27
24
  const { artifactHash, privateFunctionsRoot, publicBytecodeCommitment, packedBytecode } =
28
25
  await getContractClassFromArtifact(artifact);
29
- const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
30
26
  const registerer = await getRegistererContract(wallet);
31
- await wallet.storeCapsule(
32
- AztecAddress.fromNumber(REGISTERER_CONTRACT_ADDRESS),
33
- new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
34
- encodedBytecode,
27
+ const fn = registerer.methods.register(
28
+ artifactHash,
29
+ privateFunctionsRoot,
30
+ publicBytecodeCommitment,
31
+ emitPublicBytecode,
35
32
  );
36
- return registerer.methods.register(artifactHash, privateFunctionsRoot, publicBytecodeCommitment, emitPublicBytecode);
33
+
34
+ const encodedBytecode = bufferAsFields(packedBytecode, MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS);
35
+ fn.addCapsule(
36
+ new Capsule(
37
+ ProtocolContractAddress.ContractClassRegisterer,
38
+ new Fr(REGISTERER_CONTRACT_BYTECODE_CAPSULE_SLOT),
39
+ encodedBytecode,
40
+ ),
41
+ );
42
+
43
+ return fn;
37
44
  }
@@ -1,8 +1,7 @@
1
- import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
2
- import { TxContext } from '@aztec/circuits.js';
3
- import { FunctionType } from '@aztec/foundation/abi';
1
+ import { FunctionType } from '@aztec/stdlib/abi';
2
+ import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
4
3
 
5
- import { type EntrypointInterface, type ExecutionRequestInit } from './entrypoint.js';
4
+ import type { EntrypointInterface, ExecutionRequestInit } from './entrypoint.js';
6
5
 
7
6
  /**
8
7
  * Default implementation of the entrypoint interface. It calls a function on a contract directly
@@ -11,7 +10,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
11
10
  constructor(private chainId: number, private protocolVersion: number) {}
12
11
 
13
12
  async createTxExecutionRequest(exec: ExecutionRequestInit): Promise<TxExecutionRequest> {
14
- const { fee, calls, authWitnesses = [], hashedArguments = [] } = exec;
13
+ const { fee, calls, authWitnesses = [], hashedArguments = [], capsules = [] } = exec;
15
14
 
16
15
  if (calls.length > 1) {
17
16
  throw new Error(`Expected a single call, got ${calls.length}`);
@@ -33,6 +32,7 @@ export class DefaultEntrypoint implements EntrypointInterface {
33
32
  txContext,
34
33
  [...hashedArguments, entrypointHashedValues],
35
34
  authWitnesses,
35
+ capsules,
36
36
  ),
37
37
  );
38
38
  }
@@ -1,7 +1,7 @@
1
- import { HashedValues, TxExecutionRequest } from '@aztec/circuit-types';
2
- import { type AztecAddress, TxContext } from '@aztec/circuits.js';
3
- import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/foundation/abi';
4
1
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+ import { type FunctionAbi, FunctionSelector, encodeArguments } from '@aztec/stdlib/abi';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import { HashedValues, TxContext, TxExecutionRequest } from '@aztec/stdlib/tx';
5
5
 
6
6
  import { type EntrypointInterface, EntrypointPayload, type ExecutionRequestInit } from './entrypoint.js';
7
7
 
@@ -16,7 +16,7 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
16
16
  ) {}
17
17
 
18
18
  async createTxExecutionRequest(executions: ExecutionRequestInit): Promise<TxExecutionRequest> {
19
- const { fee, calls, authWitnesses = [], hashedArguments = [] } = executions;
19
+ const { fee, calls, authWitnesses = [], hashedArguments = [], capsules = [] } = executions;
20
20
  const payload = await EntrypointPayload.fromAppExecution(calls);
21
21
  const abi = this.getEntrypointAbi();
22
22
  const entrypointHashedArgs = await HashedValues.fromValues(encodeArguments(abi, [payload]));
@@ -28,6 +28,7 @@ export class DefaultMultiCallEntrypoint implements EntrypointInterface {
28
28
  txContext: new TxContext(this.chainId, this.version, fee.gasSettings),
29
29
  argsOfCalls: [...payload.hashedArguments, ...hashedArguments, entrypointHashedArgs],
30
30
  authWitnesses,
31
+ capsules,
31
32
  });
32
33
 
33
34
  return Promise.resolve(txRequest);
@@ -1,9 +1,11 @@
1
- import { type AuthWitness, type FunctionCall, type HashedValues, type TxExecutionRequest } from '@aztec/circuit-types';
2
- import { type Fr } from '@aztec/circuits.js';
1
+ import type { Fr } from '@aztec/foundation/fields';
2
+ import type { FunctionCall } from '@aztec/stdlib/abi';
3
+ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
4
+ import type { Capsule, HashedValues, TxExecutionRequest } from '@aztec/stdlib/tx';
3
5
 
4
6
  import { EntrypointPayload, type FeeOptions, computeCombinedPayloadHash } from './payload.js';
5
7
 
6
- export { EntrypointPayload, FeeOptions, computeCombinedPayloadHash };
8
+ export { EntrypointPayload, type FeeOptions, computeCombinedPayloadHash };
7
9
 
8
10
  export { DefaultEntrypoint } from './default_entrypoint.js';
9
11
  export { DefaultMultiCallEntrypoint } from './default_multi_call_entrypoint.js';
@@ -16,6 +18,8 @@ export type ExecutionRequestInit = {
16
18
  authWitnesses?: AuthWitness[];
17
19
  /** Any transient hashed arguments for this execution */
18
20
  hashedArguments?: HashedValues[];
21
+ /** Data passed through an oracle for this execution. */
22
+ capsules?: Capsule[];
19
23
  /** How the fee is going to be payed */
20
24
  fee: FeeOptions;
21
25
  /** An optional nonce. Used to repeat a previous tx with a higher fee so that the first one is cancelled */
@@ -1,12 +1,15 @@
1
- import { FunctionCall, HashedValues } from '@aztec/circuit-types';
2
- import { type AztecAddress, Fr, type GasSettings, GeneratorIndex } from '@aztec/circuits.js';
3
- import { FunctionType } from '@aztec/foundation/abi';
1
+ import { GeneratorIndex } from '@aztec/constants';
4
2
  import { padArrayEnd } from '@aztec/foundation/collection';
5
3
  import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
6
- import { type Tuple } from '@aztec/foundation/serialize';
7
- import { type FieldsOf } from '@aztec/foundation/types';
4
+ import { Fr } from '@aztec/foundation/fields';
5
+ import type { Tuple } from '@aztec/foundation/serialize';
6
+ import type { FieldsOf } from '@aztec/foundation/types';
7
+ import { FunctionCall, FunctionType } from '@aztec/stdlib/abi';
8
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9
+ import type { GasSettings } from '@aztec/stdlib/gas';
10
+ import { HashedValues } from '@aztec/stdlib/tx';
8
11
 
9
- import { type FeePaymentMethod } from '../fee/fee_payment_method.js';
12
+ import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
10
13
 
11
14
  /**
12
15
  * Fee payment options for a transaction.
@@ -18,6 +21,7 @@ export type FeeOptions = {
18
21
  gasSettings: GasSettings;
19
22
  };
20
23
 
24
+ // docs:start:user_fee_options
21
25
  /** Fee options as set by a user. */
22
26
  export type UserFeeOptions = {
23
27
  /** The fee payment method to use */
@@ -31,6 +35,7 @@ export type UserFeeOptions = {
31
35
  /** Percentage to pad the estimated gas limits by, if empty, defaults to 0.1. Only relevant if estimateGas is set. */
32
36
  estimatedGasPadding?: number;
33
37
  };
38
+ // docs:end:user_fee_options
34
39
 
35
40
  // These must match the values defined in:
36
41
  // - noir-projects/aztec-nr/aztec/src/entrypoint/app.nr
@@ -1,13 +1,15 @@
1
- import { type FunctionCall } from '@aztec/circuit-types';
2
- import { type AztecAddress } from '@aztec/circuits.js';
3
1
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+ import type { FunctionCall } from '@aztec/stdlib/abi';
3
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
 
5
- import { type FeePaymentMethod } from './fee_payment_method.js';
5
+ import type { FeePaymentMethod } from './fee_payment_method.js';
6
6
 
7
+ // docs:start:fee_juice_method
7
8
  /**
8
9
  * Pay fee directly in the Fee Juice.
9
10
  */
10
11
  export class FeeJuicePaymentMethod implements FeePaymentMethod {
12
+ // docs:end:fee_juice_method
11
13
  constructor(protected sender: AztecAddress) {}
12
14
 
13
15
  getAsset() {
@@ -1,10 +1,11 @@
1
- import { type FunctionCall } from '@aztec/circuit-types';
2
- import { type AztecAddress, Fr, FunctionSelector } from '@aztec/circuits.js';
3
- import { FunctionType, U128 } from '@aztec/foundation/abi';
1
+ import { Fr } from '@aztec/foundation/fields';
4
2
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
5
- import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
3
+ import type { FunctionCall } from '@aztec/stdlib/abi';
4
+ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
6
5
 
7
- import { type L2AmountClaim } from '../api/ethereum/portal_manager.js';
6
+ import type { L2AmountClaim } from '../api/ethereum/portal_manager.js';
7
+ import { getFeeJuice } from '../contract/protocol_contracts.js';
8
+ import type { Wallet } from '../wallet/index.js';
8
9
  import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
9
10
 
10
11
  /**
@@ -12,10 +13,10 @@ import { FeeJuicePaymentMethod } from './fee_juice_payment_method.js';
12
13
  */
13
14
  export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod {
14
15
  constructor(
15
- sender: AztecAddress,
16
+ private senderWallet: Wallet,
16
17
  private claim: Pick<L2AmountClaim, 'claimAmount' | 'claimSecret' | 'messageLeafIndex'>,
17
18
  ) {
18
- super(sender);
19
+ super(senderWallet.getAddress());
19
20
  }
20
21
 
21
22
  /**
@@ -23,7 +24,7 @@ export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod {
23
24
  * @returns A function call
24
25
  */
25
26
  override async getFunctionCalls(): Promise<FunctionCall[]> {
26
- const canonicalFeeJuice = await getCanonicalFeeJuice();
27
+ const canonicalFeeJuice = await getFeeJuice(this.senderWallet);
27
28
  const selector = await FunctionSelector.fromNameAndParameters(
28
29
  canonicalFeeJuice.artifact.functions.find(f => f.name === 'claim')!,
29
30
  );
@@ -35,8 +36,8 @@ export class FeeJuicePaymentMethodWithClaim extends FeeJuicePaymentMethod {
35
36
  selector,
36
37
  isStatic: false,
37
38
  args: [
38
- this.sender.toField(),
39
- ...new U128(this.claim.claimAmount).toFields(),
39
+ this.senderWallet.getAddress().toField(),
40
+ new Fr(this.claim.claimAmount),
40
41
  this.claim.claimSecret,
41
42
  new Fr(this.claim.messageLeafIndex),
42
43
  ],