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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/README.md +1 -1
  2. package/dest/account/account.d.ts +3 -4
  3. package/dest/account/account.d.ts.map +1 -1
  4. package/dest/account/account.js +1 -1
  5. package/dest/account/account_contract.d.ts +2 -2
  6. package/dest/account/account_contract.d.ts.map +1 -1
  7. package/dest/account/account_with_secret_key.d.ts +3 -4
  8. package/dest/account/account_with_secret_key.d.ts.map +1 -1
  9. package/dest/account/index.d.ts +2 -2
  10. package/dest/account/index.d.ts.map +1 -1
  11. package/dest/account/interface.d.ts +2 -2
  12. package/dest/account/interface.d.ts.map +1 -1
  13. package/dest/account/signerless_account.d.ts +3 -4
  14. package/dest/account/signerless_account.d.ts.map +1 -1
  15. package/dest/api/abi.d.ts +1 -1
  16. package/dest/api/account.d.ts +2 -1
  17. package/dest/api/account.d.ts.map +1 -1
  18. package/dest/api/account.js +1 -0
  19. package/dest/api/addresses.d.ts +1 -1
  20. package/dest/api/authorization.d.ts +1 -1
  21. package/dest/api/block.d.ts +1 -1
  22. package/dest/api/contract.d.ts +5 -5
  23. package/dest/api/contract.d.ts.map +1 -1
  24. package/dest/api/contract.js +3 -3
  25. package/dest/api/crypto.d.ts +1 -1
  26. package/dest/api/deployment.d.ts +1 -1
  27. package/dest/api/eth_address.d.ts +1 -1
  28. package/dest/api/ethereum.d.ts +1 -1
  29. package/dest/api/events.d.ts +1 -1
  30. package/dest/api/fee.d.ts +1 -1
  31. package/dest/api/fee_testing.d.ts +1 -1
  32. package/dest/api/fields.d.ts +3 -2
  33. package/dest/api/fields.d.ts.map +1 -1
  34. package/dest/api/fields.js +2 -1
  35. package/dest/api/keys.d.ts +1 -1
  36. package/dest/api/log.d.ts +1 -1
  37. package/dest/api/messaging.d.ts +1 -1
  38. package/dest/api/node.d.ts +1 -1
  39. package/dest/api/note.d.ts +2 -2
  40. package/dest/api/note.d.ts.map +1 -1
  41. package/dest/api/note.js +1 -1
  42. package/dest/api/protocol.d.ts +1 -1
  43. package/dest/api/trees.d.ts +1 -1
  44. package/dest/api/tx.d.ts +2 -2
  45. package/dest/api/tx.d.ts.map +1 -1
  46. package/dest/api/tx.js +1 -1
  47. package/dest/api/utils.d.ts +1 -1
  48. package/dest/api/wallet.d.ts +2 -3
  49. package/dest/api/wallet.d.ts.map +1 -1
  50. package/dest/api/wallet.js +1 -2
  51. package/dest/authorization/call_authorization_request.d.ts +2 -23
  52. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  53. package/dest/contract/base_contract_interaction.d.ts +2 -3
  54. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  55. package/dest/contract/base_contract_interaction.js +1 -1
  56. package/dest/contract/batch_call.d.ts +8 -9
  57. package/dest/contract/batch_call.d.ts.map +1 -1
  58. package/dest/contract/batch_call.js +51 -33
  59. package/dest/contract/checker.d.ts +1 -1
  60. package/dest/contract/contract.d.ts +2 -2
  61. package/dest/contract/contract.d.ts.map +1 -1
  62. package/dest/contract/contract.js +4 -5
  63. package/dest/contract/contract_base.d.ts +5 -12
  64. package/dest/contract/contract_base.d.ts.map +1 -1
  65. package/dest/contract/contract_base.js +5 -12
  66. package/dest/contract/contract_function_interaction.d.ts +4 -4
  67. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  68. package/dest/contract/contract_function_interaction.js +9 -6
  69. package/dest/contract/deploy_method.d.ts +9 -8
  70. package/dest/contract/deploy_method.d.ts.map +1 -1
  71. package/dest/contract/deploy_method.js +9 -7
  72. package/dest/contract/deploy_sent_tx.d.ts +12 -7
  73. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  74. package/dest/contract/deploy_sent_tx.js +10 -4
  75. package/dest/contract/get_gas_limits.d.ts +1 -1
  76. package/dest/contract/interaction_options.d.ts +5 -5
  77. package/dest/contract/interaction_options.d.ts.map +1 -1
  78. package/dest/contract/interaction_options.js +4 -10
  79. package/dest/contract/protocol_contracts.d.ts +1 -1
  80. package/dest/contract/sent_tx.d.ts +2 -3
  81. package/dest/contract/sent_tx.d.ts.map +1 -1
  82. package/dest/contract/sent_tx.js +1 -1
  83. package/dest/contract/unsafe_contract.d.ts +1 -1
  84. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  85. package/dest/contract/unsafe_contract.js +1 -1
  86. package/dest/contract/wait_for_proven.d.ts +2 -2
  87. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  88. package/dest/deployment/broadcast_function.d.ts +1 -1
  89. package/dest/deployment/broadcast_function.js +1 -1
  90. package/dest/deployment/contract_deployer.d.ts +1 -1
  91. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  92. package/dest/deployment/contract_deployer.js +1 -1
  93. package/dest/deployment/publish_class.d.ts +1 -1
  94. package/dest/deployment/publish_class.js +1 -1
  95. package/dest/deployment/publish_instance.d.ts +1 -1
  96. package/dest/ethereum/portal_manager.d.ts +4 -6
  97. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  98. package/dest/ethereum/portal_manager.js +40 -14
  99. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +2 -2
  100. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  101. package/dest/fee/fee_juice_payment_method_with_claim.js +3 -3
  102. package/dest/fee/fee_payment_method.d.ts +2 -2
  103. package/dest/fee/fee_payment_method.d.ts.map +1 -1
  104. package/dest/fee/private_fee_payment_method.d.ts +2 -2
  105. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  106. package/dest/fee/private_fee_payment_method.js +4 -4
  107. package/dest/fee/public_fee_payment_method.d.ts +2 -2
  108. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  109. package/dest/fee/public_fee_payment_method.js +4 -4
  110. package/dest/fee/sponsored_fee_payment.d.ts +2 -2
  111. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
  112. package/dest/fee/sponsored_fee_payment.js +2 -2
  113. package/dest/utils/abi_types.d.ts +2 -2
  114. package/dest/utils/abi_types.d.ts.map +1 -1
  115. package/dest/utils/authwit.d.ts +7 -7
  116. package/dest/utils/authwit.d.ts.map +1 -1
  117. package/dest/utils/authwit.js +22 -11
  118. package/dest/utils/cross_chain.d.ts +2 -2
  119. package/dest/utils/cross_chain.d.ts.map +1 -1
  120. package/dest/utils/fee_juice.d.ts +2 -2
  121. package/dest/utils/fee_juice.js +2 -2
  122. package/dest/utils/field_compressed_string.d.ts +1 -1
  123. package/dest/utils/field_compressed_string.d.ts.map +1 -1
  124. package/dest/utils/field_compressed_string.js +1 -1
  125. package/dest/utils/node.d.ts +2 -2
  126. package/dest/utils/node.d.ts.map +1 -1
  127. package/dest/utils/pub_key.d.ts +2 -2
  128. package/dest/utils/pub_key.d.ts.map +1 -1
  129. package/dest/utils/pub_key.js +2 -3
  130. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +2 -2
  131. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  132. package/dest/wallet/account_entrypoint_meta_payment_method.js +2 -2
  133. package/dest/wallet/account_manager.d.ts +2 -5
  134. package/dest/wallet/account_manager.d.ts.map +1 -1
  135. package/dest/wallet/account_manager.js +2 -2
  136. package/dest/wallet/deploy_account_method.d.ts +5 -5
  137. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  138. package/dest/wallet/deploy_account_method.js +2 -2
  139. package/dest/wallet/index.d.ts +1 -2
  140. package/dest/wallet/index.d.ts.map +1 -1
  141. package/dest/wallet/index.js +0 -1
  142. package/dest/wallet/wallet.d.ts +686 -1148
  143. package/dest/wallet/wallet.d.ts.map +1 -1
  144. package/dest/wallet/wallet.js +37 -41
  145. package/package.json +13 -12
  146. package/src/account/account.ts +2 -3
  147. package/src/account/account_contract.ts +1 -1
  148. package/src/account/account_with_secret_key.ts +1 -1
  149. package/src/account/index.ts +1 -1
  150. package/src/account/interface.ts +1 -1
  151. package/src/account/signerless_account.ts +2 -3
  152. package/src/api/account.ts +1 -0
  153. package/src/api/contract.ts +4 -3
  154. package/src/api/fields.ts +2 -1
  155. package/src/api/note.ts +1 -1
  156. package/src/api/tx.ts +2 -0
  157. package/src/api/wallet.ts +5 -7
  158. package/src/authorization/call_authorization_request.ts +1 -1
  159. package/src/contract/base_contract_interaction.ts +2 -3
  160. package/src/contract/batch_call.ts +65 -48
  161. package/src/contract/contract.ts +7 -5
  162. package/src/contract/contract_base.ts +5 -15
  163. package/src/contract/contract_function_interaction.ts +10 -11
  164. package/src/contract/deploy_method.ts +13 -12
  165. package/src/contract/deploy_sent_tx.ts +17 -10
  166. package/src/contract/interaction_options.ts +5 -11
  167. package/src/contract/sent_tx.ts +2 -3
  168. package/src/contract/unsafe_contract.ts +1 -1
  169. package/src/deployment/broadcast_function.ts +1 -1
  170. package/src/deployment/contract_deployer.ts +3 -2
  171. package/src/deployment/publish_class.ts +1 -1
  172. package/src/ethereum/portal_manager.ts +58 -28
  173. package/src/fee/fee_juice_payment_method_with_claim.ts +4 -2
  174. package/src/fee/fee_payment_method.ts +1 -1
  175. package/src/fee/private_fee_payment_method.ts +5 -3
  176. package/src/fee/public_fee_payment_method.ts +5 -3
  177. package/src/fee/sponsored_fee_payment.ts +3 -1
  178. package/src/utils/abi_types.ts +1 -1
  179. package/src/utils/authwit.ts +21 -15
  180. package/src/utils/cross_chain.ts +1 -1
  181. package/src/utils/fee_juice.ts +2 -2
  182. package/src/utils/field_compressed_string.ts +1 -1
  183. package/src/utils/pub_key.ts +3 -4
  184. package/src/wallet/account_entrypoint_meta_payment_method.ts +2 -1
  185. package/src/wallet/account_manager.ts +2 -2
  186. package/src/wallet/deploy_account_method.ts +4 -3
  187. package/src/wallet/index.ts +0 -1
  188. package/src/wallet/wallet.ts +81 -80
  189. package/dest/wallet/base_wallet.d.ts +0 -91
  190. package/dest/wallet/base_wallet.d.ts.map +0 -1
  191. package/dest/wallet/base_wallet.js +0 -238
  192. package/src/wallet/base_wallet.ts +0 -350
@@ -5,7 +5,7 @@ import {
5
5
  FunctionSelector,
6
6
  getAllFunctionAbis,
7
7
  } from '@aztec/stdlib/abi';
8
- import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/stdlib/contract';
8
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9
9
 
10
10
  import type { Wallet } from '../wallet/wallet.js';
11
11
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
@@ -38,8 +38,8 @@ export class ContractBase {
38
38
  public methods: { [name: string]: ContractMethod } = {};
39
39
 
40
40
  protected constructor(
41
- /** The deployed contract instance definition. */
42
- public readonly instance: ContractInstanceWithAddress,
41
+ /** The contract's address. */
42
+ public readonly address: AztecAddress,
43
43
  /** The Application Binary Interface for the contract. */
44
44
  public readonly artifact: ContractArtifact,
45
45
  /** The wallet used for interacting with this contract. */
@@ -47,7 +47,7 @@ export class ContractBase {
47
47
  ) {
48
48
  getAllFunctionAbis(artifact).forEach((f: FunctionAbi) => {
49
49
  const interactionFunction = (...args: any[]) => {
50
- return new ContractFunctionInteraction(this.wallet, this.instance.address, f, args);
50
+ return new ContractFunctionInteraction(this.wallet, this.address, f, args);
51
51
  };
52
52
 
53
53
  this.methods[f.name] = Object.assign(interactionFunction, {
@@ -62,22 +62,12 @@ export class ContractBase {
62
62
  });
63
63
  }
64
64
 
65
- /** Address of the contract. */
66
- public get address() {
67
- return this.instance.address;
68
- }
69
-
70
- /** Partial address of the contract. */
71
- public get partialAddress() {
72
- return computePartialAddress(this.instance);
73
- }
74
-
75
65
  /**
76
66
  * Creates a new instance of the contract wrapper attached to a different wallet.
77
67
  * @param wallet - Wallet to use for sending txs.
78
68
  * @returns A new contract instance.
79
69
  */
80
70
  public withWallet(wallet: Wallet): this {
81
- return new ContractBase(this.instance, this.artifact, wallet) as this;
71
+ return new ContractBase(this.address, this.artifact, wallet) as this;
82
72
  }
83
73
  }
@@ -1,8 +1,8 @@
1
- import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
2
1
  import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi, encodeArguments } from '@aztec/stdlib/abi';
3
2
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
4
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
4
  import { type Capsule, type HashedValues, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
5
+ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
6
6
 
7
7
  import type { Wallet } from '../wallet/wallet.js';
8
8
  import { BaseContractInteraction } from './base_contract_interaction.js';
@@ -103,25 +103,24 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
103
103
  ): Promise<SimulationReturn<typeof options.includeMetadata>> {
104
104
  // docs:end:simulate
105
105
  if (this.functionDao.functionType == FunctionType.UTILITY) {
106
- const utilityResult = await this.wallet.simulateUtility(
107
- this.functionDao.name,
108
- this.args,
109
- this.contractAddress,
110
- options.authWitnesses ?? [],
111
- );
106
+ const call = await this.getFunctionCall();
107
+ const utilityResult = await this.wallet.simulateUtility(call, options.authWitnesses ?? []);
108
+
109
+ // Decode the raw field elements to the actual return type
110
+ const returnValue = utilityResult.result ? decodeFromAbi(this.functionDao.returnTypes, utilityResult.result) : [];
112
111
 
113
112
  if (options.includeMetadata) {
114
113
  return {
115
114
  stats: utilityResult.stats,
116
- result: utilityResult.result,
115
+ result: returnValue,
117
116
  };
118
117
  } else {
119
- return utilityResult.result;
118
+ return returnValue;
120
119
  }
121
120
  }
122
121
 
123
122
  const executionPayload = await this.request(options);
124
- const simulatedTx = await this.wallet.simulateTx(executionPayload, await toSimulateOptions(options));
123
+ const simulatedTx = await this.wallet.simulateTx(executionPayload, toSimulateOptions(options));
125
124
 
126
125
  let rawReturnValues;
127
126
  if (this.functionDao.functionType == FunctionType.PRIVATE) {
@@ -168,7 +167,7 @@ export class ContractFunctionInteraction extends BaseContractInteraction {
168
167
  }
169
168
 
170
169
  const executionPayload = await this.request(options);
171
- return await this.wallet.profileTx(executionPayload, await toProfileOptions(options));
170
+ return await this.wallet.profileTx(executionPayload, toProfileOptions(options));
172
171
  }
173
172
 
174
173
  /**
@@ -1,5 +1,4 @@
1
- import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/entrypoints/payload';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { type ContractArtifact, type FunctionAbi, type FunctionArtifact, getInitializer } from '@aztec/stdlib/abi';
4
3
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
5
4
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -11,12 +10,12 @@ import {
11
10
  } from '@aztec/stdlib/contract';
12
11
  import type { PublicKeys } from '@aztec/stdlib/keys';
13
12
  import { type Capsule, type TxProfileResult, collectOffchainEffects } from '@aztec/stdlib/tx';
13
+ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
14
14
 
15
15
  import { publishContractClass } from '../deployment/publish_class.js';
16
16
  import { publishInstance } from '../deployment/publish_instance.js';
17
17
  import type { Wallet } from '../wallet/wallet.js';
18
18
  import { BaseContractInteraction } from './base_contract_interaction.js';
19
- import type { Contract } from './contract.js';
20
19
  import type { ContractBase } from './contract_base.js';
21
20
  import { ContractFunctionInteraction } from './contract_function_interaction.js';
22
21
  import { DeploySentTx } from './deploy_sent_tx.js';
@@ -51,6 +50,8 @@ export type RequestDeployOptions = RequestInteractionOptions & {
51
50
  skipInstancePublication?: boolean;
52
51
  /** Skip contract initialization. */
53
52
  skipInitialization?: boolean;
53
+ /** Skip contract registration in the wallet */
54
+ skipRegistration?: boolean;
54
55
  };
55
56
 
56
57
  /**
@@ -63,8 +64,6 @@ export type DeployOptions = Omit<RequestDeployOptions, 'deployer'> & {
63
64
  */
64
65
  universalDeploy?: boolean;
65
66
  } & Pick<SendInteractionOptions, 'from' | 'fee'>;
66
- // docs:end:deploy_options
67
- // TODO(@spalladino): Add unit tests for this class!
68
67
 
69
68
  /**
70
69
  * Options for simulating the deployment of a contract
@@ -96,7 +95,7 @@ export type SimulateDeployOptions = Omit<DeployOptions, 'fee'> & {
96
95
  *
97
96
  * Extends the BaseContractInteraction class.
98
97
  */
99
- export class DeployMethod<TContract extends ContractBase = Contract> extends BaseContractInteraction {
98
+ export class DeployMethod<TContract extends ContractBase = ContractBase> extends BaseContractInteraction {
100
99
  /** The contract instance to be deployed. */
101
100
  private instance?: ContractInstanceWithAddress = undefined;
102
101
 
@@ -107,7 +106,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
107
106
  private publicKeys: PublicKeys,
108
107
  wallet: Wallet,
109
108
  protected artifact: ContractArtifact,
110
- protected postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
109
+ protected postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
111
110
  private args: any[] = [],
112
111
  constructorNameOrArtifact?: string | FunctionArtifact,
113
112
  authWitnesses: AuthWitness[] = [],
@@ -125,7 +124,9 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
125
124
  public async request(options?: RequestDeployOptions): Promise<ExecutionPayload> {
126
125
  const publication = await this.getPublicationExecutionPayload(options);
127
126
 
128
- await this.wallet.registerContract(await this.getInstance(options), this.artifact);
127
+ if (!options?.skipRegistration) {
128
+ await this.wallet.registerContract(await this.getInstance(options), this.artifact);
129
+ }
129
130
 
130
131
  const initialization = await this.getInitializationExecutionPayload(options);
131
132
  const feeExecutionPayload = options?.fee?.paymentMethod
@@ -155,7 +156,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
155
156
  public async register(options?: RequestDeployOptions): Promise<TContract> {
156
157
  const instance = await this.getInstance(options);
157
158
  await this.wallet.registerContract(instance, this.artifact);
158
- return this.postDeployCtor(instance.address, this.wallet);
159
+ return this.postDeployCtor(instance, this.wallet);
159
160
  }
160
161
 
161
162
  /**
@@ -239,7 +240,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
239
240
  public override send(options: DeployOptions): DeploySentTx<TContract> {
240
241
  const sendTx = async () => {
241
242
  const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
242
- const sendOptions = await toSendOptions(options);
243
+ const sendOptions = toSendOptions(options);
243
244
  return this.wallet.sendTx(executionPayload, sendOptions);
244
245
  };
245
246
  this.log.debug(`Sent deployment tx of ${this.artifact.name} contract`);
@@ -274,7 +275,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
274
275
  */
275
276
  public async simulate(options: SimulateDeployOptions): Promise<SimulationReturn<true>> {
276
277
  const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
277
- const simulatedTx = await this.wallet.simulateTx(executionPayload, await toSimulateOptions(options));
278
+ const simulatedTx = await this.wallet.simulateTx(executionPayload, toSimulateOptions(options));
278
279
 
279
280
  const { gasLimits, teardownGasLimits } = getGasLimits(simulatedTx, options.fee?.estimatedGasPadding);
280
281
  this.log.verbose(
@@ -297,7 +298,7 @@ export class DeployMethod<TContract extends ContractBase = Contract> extends Bas
297
298
  public async profile(options: DeployOptions & ProfileInteractionOptions): Promise<TxProfileResult> {
298
299
  const executionPayload = await this.request(this.convertDeployOptionsToRequestOptions(options));
299
300
  return await this.wallet.profileTx(executionPayload, {
300
- ...(await toProfileOptions(options)),
301
+ ...toProfileOptions(options),
301
302
  profileMode: options.profileMode,
302
303
  skipProofGeneration: options.skipProofGeneration,
303
304
  });
@@ -1,11 +1,9 @@
1
1
  import { createLogger } from '@aztec/foundation/log';
2
2
  import type { FieldsOf } from '@aztec/foundation/types';
3
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
3
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
4
  import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
6
5
 
7
6
  import type { Wallet } from '../wallet/wallet.js';
8
- import type { Contract } from './contract.js';
9
7
  import type { ContractBase } from './contract_base.js';
10
8
  import { SentTx, type WaitOpts } from './sent_tx.js';
11
9
 
@@ -16,27 +14,37 @@ export type DeployedWaitOpts = WaitOpts & {
16
14
  };
17
15
 
18
16
  /** Extends a transaction receipt with a contract instance that represents the newly deployed contract. */
19
- export type DeployTxReceipt<TContract extends ContractBase = Contract> = FieldsOf<TxReceipt> & {
17
+ export type DeployTxReceipt<TContract extends ContractBase = ContractBase> = FieldsOf<TxReceipt> & {
20
18
  /** Instance of the newly deployed contract. */
21
19
  contract: TContract;
20
+ /** The deployed contract instance with address and metadata. */
21
+ instance: ContractInstanceWithAddress;
22
22
  };
23
23
 
24
24
  /**
25
25
  * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
26
26
  */
27
- export class DeploySentTx<TContract extends Contract = Contract> extends SentTx {
27
+ export class DeploySentTx<TContract extends ContractBase = ContractBase> extends SentTx {
28
28
  private log = createLogger('aztecjs:deploy_sent_tx');
29
29
 
30
30
  constructor(
31
31
  wallet: Wallet,
32
32
  sendTx: () => Promise<TxHash>,
33
- private postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
33
+ private postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
34
34
  /** A getter for the deployed contract instance */
35
- public instanceGetter: () => Promise<ContractInstanceWithAddress>,
35
+ private instanceGetter: () => Promise<ContractInstanceWithAddress>,
36
36
  ) {
37
37
  super(wallet, sendTx);
38
38
  }
39
39
 
40
+ /**
41
+ * Returns the contract instance for this deployment.
42
+ * @returns The deployed contract instance with address and metadata.
43
+ */
44
+ public async getInstance(): Promise<ContractInstanceWithAddress> {
45
+ return await this.instanceGetter();
46
+ }
47
+
40
48
  /**
41
49
  * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
42
50
  * @param opts - Options for configuring the waiting for the tx to be mined.
@@ -44,8 +52,7 @@ export class DeploySentTx<TContract extends Contract = Contract> extends SentTx
44
52
  */
45
53
  public async deployed(opts?: DeployedWaitOpts): Promise<TContract> {
46
54
  const receipt = await this.wait(opts);
47
- const instance = await this.instanceGetter();
48
- this.log.info(`Contract ${instance.address.toString()} successfully deployed.`);
55
+ this.log.info(`Contract ${receipt.instance.address.toString()} successfully deployed.`);
49
56
  return receipt.contract;
50
57
  }
51
58
 
@@ -62,7 +69,7 @@ export class DeploySentTx<TContract extends Contract = Contract> extends SentTx
62
69
  throw new Error(`A wallet is required for creating a contract instance`);
63
70
  }
64
71
  const instance = await this.instanceGetter();
65
- const contract = (await this.postDeployCtor(instance.address, contractWallet)) as TContract;
66
- return { ...receipt, contract };
72
+ const contract = this.postDeployCtor(instance, contractWallet) as TContract;
73
+ return { ...receipt, contract, instance };
67
74
  }
68
75
  }
@@ -87,7 +87,7 @@ export type SimulateInteractionOptions = Omit<SendInteractionOptions, 'fee'> & {
87
87
  export type ProfileInteractionOptions = SimulateInteractionOptions & {
88
88
  /** Whether to return gates information or the bytecode/witnesses. */
89
89
  profileMode: 'gates' | 'execution-steps' | 'full';
90
- /** Whether to generate a ClientIVC proof or not */
90
+ /** Whether to generate a Chonk proof or not */
91
91
  skipProofGeneration?: boolean;
92
92
  };
93
93
 
@@ -114,13 +114,10 @@ export type SimulationReturn<T extends boolean | undefined> = T extends true
114
114
  * Transforms and cleans up the higher level SendInteractionOptions defined by the interaction into
115
115
  * SendOptions, which are the ones that can be serialized and forwarded to the wallet
116
116
  */
117
- export async function toSendOptions(options: SendInteractionOptions): Promise<SendOptions> {
117
+ export function toSendOptions(options: SendInteractionOptions): SendOptions {
118
118
  return {
119
119
  ...options,
120
120
  fee: {
121
- // If this interaction includes a fee payment method, pass the fee payer
122
- // as a hint to the wallet
123
- embeddedPaymentMethodFeePayer: await options.fee?.paymentMethod?.getFeePayer(),
124
121
  // If a payment method that includes gas settings was used,
125
122
  // try to reuse as much as possible while still allowing
126
123
  // manual override. CAREFUL: this can cause mismatches during proving
@@ -136,13 +133,10 @@ export async function toSendOptions(options: SendInteractionOptions): Promise<Se
136
133
  * Transforms and cleans up the higher level SimulateInteractionOptions defined by the interaction into
137
134
  * SimulateOptions, which are the ones that can be serialized and forwarded to the wallet
138
135
  */
139
- export async function toSimulateOptions(options: SimulateInteractionOptions): Promise<SimulateOptions> {
136
+ export function toSimulateOptions(options: SimulateInteractionOptions): SimulateOptions {
140
137
  return {
141
138
  ...options,
142
139
  fee: {
143
- // If this interaction includes a fee payment method, pass the fee payer
144
- // as a hint to the wallet
145
- embeddedPaymentMethodFeePayer: await options.fee?.paymentMethod?.getFeePayer(),
146
140
  // If a payment method that includes gas settings was used,
147
141
  // try to reuse as much as possible while still allowing
148
142
  // manual override. CAREFUL: this can cause mismatches during proving
@@ -160,9 +154,9 @@ export async function toSimulateOptions(options: SimulateInteractionOptions): Pr
160
154
  * Transforms and cleans up the higher level ProfileInteractionOptions defined by the interaction into
161
155
  * ProfileOptions, which are the ones that can be serialized and forwarded to the wallet
162
156
  */
163
- export async function toProfileOptions(options: ProfileInteractionOptions): Promise<ProfileOptions> {
157
+ export function toProfileOptions(options: ProfileInteractionOptions): ProfileOptions {
164
158
  return {
165
- ...(await toSimulateOptions(options)),
159
+ ...toSimulateOptions(options),
166
160
  profileMode: options.profileMode,
167
161
  skipProofGeneration: options.skipProofGeneration,
168
162
  };
@@ -1,6 +1,5 @@
1
1
  import { promiseWithResolvers } from '@aztec/foundation/promise';
2
2
  import { retryUntil } from '@aztec/foundation/retry';
3
- import type { FieldsOf } from '@aztec/foundation/types';
4
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
4
  import { TxHash, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
6
5
 
@@ -20,7 +19,7 @@ export type WaitOpts = {
20
19
 
21
20
  export const DefaultWaitOpts: WaitOpts = {
22
21
  ignoreDroppedReceiptsFor: 5,
23
- timeout: 60,
22
+ timeout: 300,
24
23
  interval: 1,
25
24
  };
26
25
 
@@ -88,7 +87,7 @@ export class SentTx {
88
87
  * @param opts - Options for configuring the waiting for the tx to be mined.
89
88
  * @returns The transaction receipt.
90
89
  */
91
- public async wait(opts?: WaitOpts): Promise<FieldsOf<TxReceipt>> {
90
+ public async wait(opts?: WaitOpts): Promise<TxReceipt> {
92
91
  const receipt = await this.waitForReceipt(opts);
93
92
  if (receipt.status !== TxStatus.SUCCESS && !opts?.dontThrowOnRevert) {
94
93
  throw new Error(
@@ -14,6 +14,6 @@ export class UnsafeContract extends ContractBase {
14
14
  /** The wallet used for interacting with this contract. */
15
15
  wallet: Wallet,
16
16
  ) {
17
- super(instance, artifact, wallet);
17
+ super(instance.address, artifact, wallet);
18
18
  }
19
19
  }
@@ -4,7 +4,7 @@ import {
4
4
  MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS,
5
5
  } from '@aztec/constants';
6
6
  import { padArrayEnd } from '@aztec/foundation/collection';
7
- import { Fr } from '@aztec/foundation/fields';
7
+ import { Fr } from '@aztec/foundation/curves/bn254';
8
8
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
9
9
  import { type ContractArtifact, FunctionSelector, FunctionType, bufferAsFields } from '@aztec/stdlib/abi';
10
10
  import {
@@ -1,5 +1,5 @@
1
1
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
3
  import { PublicKeys } from '@aztec/stdlib/keys';
4
4
 
5
5
  import { Contract } from '../contract/contract.js';
@@ -28,7 +28,8 @@ export class ContractDeployer {
28
28
  * @returns A DeployMethod instance configured with the ABI, PXE, and constructor arguments.
29
29
  */
30
30
  public deploy(...args: any[]) {
31
- const postDeployCtor = (address: AztecAddress, wallet: Wallet) => Contract.at(address, this.artifact, wallet);
31
+ const postDeployCtor = (instance: ContractInstanceWithAddress, wallet: Wallet) =>
32
+ Contract.at(instance.address, this.artifact, wallet);
32
33
  return new DeployMethod(
33
34
  this.publicKeys ?? PublicKeys.default(),
34
35
  this.wallet,
@@ -2,7 +2,7 @@ import {
2
2
  CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT,
3
3
  MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS,
4
4
  } from '@aztec/constants';
5
- import { Fr } from '@aztec/foundation/fields';
5
+ import { Fr } from '@aztec/foundation/curves/bn254';
6
6
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
7
7
  import { type ContractArtifact, bufferAsFields } from '@aztec/stdlib/abi';
8
8
  import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
@@ -1,8 +1,8 @@
1
- import type { ExtendedViemWalletClient, ViemContract } from '@aztec/ethereum';
1
+ import type { ExtendedViemWalletClient, ViemContract } from '@aztec/ethereum/types';
2
2
  import { extractEvent } from '@aztec/ethereum/utils';
3
- import { sha256ToField } from '@aztec/foundation/crypto';
3
+ import { sha256ToField } from '@aztec/foundation/crypto/sha256';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import { EthAddress } from '@aztec/foundation/eth-address';
5
- import { Fr } from '@aztec/foundation/fields';
6
6
  import type { Logger } from '@aztec/foundation/log';
7
7
  import type { SiblingPath } from '@aztec/foundation/trees';
8
8
  import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
@@ -132,7 +132,7 @@ export class L1FeeJuicePortalManager {
132
132
  constructor(
133
133
  portalAddress: EthAddress,
134
134
  tokenAddress: EthAddress,
135
- handlerAddress: EthAddress,
135
+ handlerAddress: EthAddress | undefined,
136
136
  private readonly extendedClient: ExtendedViemWalletClient,
137
137
  private readonly logger: Logger,
138
138
  ) {
@@ -157,9 +157,9 @@ export class L1FeeJuicePortalManager {
157
157
  */
158
158
  public async bridgeTokensPublic(to: AztecAddress, amount: bigint | undefined, mint = false): Promise<L2AmountClaim> {
159
159
  const [claimSecret, claimSecretHash] = await generateClaimSecret();
160
- const mintableAmount = await this.tokenManager.getMintAmount();
161
- const amountToBridge = amount ?? mintableAmount;
160
+ const amountToBridge = amount ?? (await this.tokenManager.getMintAmount());
162
161
  if (mint) {
162
+ const mintableAmount = await this.tokenManager.getMintAmount();
163
163
  if (amountToBridge !== mintableAmount) {
164
164
  throw new Error(`Minting amount must be ${mintableAmount}`);
165
165
  }
@@ -177,17 +177,32 @@ export class L1FeeJuicePortalManager {
177
177
  hash: await this.contract.write.depositToAztecPublic(args),
178
178
  });
179
179
 
180
- this.logger.info('Deposited to Aztec public successfully');
180
+ this.logger.info('Deposited to Aztec public successfully', { txReceipt });
181
181
 
182
182
  const log = extractEvent(
183
183
  txReceipt.logs,
184
184
  this.contract.address,
185
185
  this.contract.abi,
186
186
  'DepositToAztecPublic',
187
- log =>
188
- log.args.secretHash === claimSecretHash.toString() &&
189
- log.args.amount === amountToBridge &&
190
- log.args.to === to.toString(),
187
+ log => {
188
+ // Normalize hex strings for comparison (case-insensitive, handle different formats)
189
+ const normalizeHex = (val: string | bigint | number) => {
190
+ const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
191
+ return hexStr.toLowerCase();
192
+ };
193
+
194
+ const secretHashMatch = normalizeHex(log.args.secretHash) === normalizeHex(claimSecretHash.toString());
195
+ const amountMatch = log.args.amount === amountToBridge;
196
+ const toMatch = normalizeHex(log.args.to) === normalizeHex(to.toString());
197
+
198
+ this.logger.debug(
199
+ `Event filter matching: secretHash=${secretHashMatch} (${log.args.secretHash} vs ${claimSecretHash.toString()}), ` +
200
+ `amount=${amountMatch} (${log.args.amount} vs ${amountToBridge}), ` +
201
+ `to=${toMatch} (${log.args.to} vs ${to.toString()})`,
202
+ );
203
+
204
+ return secretHashMatch && amountMatch && toMatch;
205
+ },
191
206
  this.logger,
192
207
  );
193
208
 
@@ -218,17 +233,12 @@ export class L1FeeJuicePortalManager {
218
233
  if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
219
234
  throw new Error('Portal or token not deployed on L1');
220
235
  }
221
- if (!feeAssetHandlerAddress || feeAssetHandlerAddress.isZero()) {
222
- throw new Error('Handler not deployed on L1, or handler address is zero');
223
- }
224
236
 
225
- return new L1FeeJuicePortalManager(
226
- feeJuicePortalAddress,
227
- feeJuiceAddress,
228
- feeAssetHandlerAddress,
229
- extendedClient,
230
- logger,
231
- );
237
+ // Handler is optional - it's only needed for minting tokens during testing
238
+ const handlerAddress =
239
+ feeAssetHandlerAddress && !feeAssetHandlerAddress.isZero() ? feeAssetHandlerAddress : undefined;
240
+
241
+ return new L1FeeJuicePortalManager(feeJuicePortalAddress, feeJuiceAddress, handlerAddress, extendedClient, logger);
232
242
  }
233
243
  }
234
244
 
@@ -282,10 +292,19 @@ export class L1ToL2TokenPortalManager {
282
292
  this.portal.address,
283
293
  this.portal.abi,
284
294
  'DepositToAztecPublic',
285
- log =>
286
- log.args.secretHash === claimSecretHash.toString() &&
287
- log.args.amount === amount &&
288
- log.args.to === to.toString(),
295
+ log => {
296
+ // Normalize hex strings for comparison (case-insensitive, handle different formats)
297
+ const normalizeHex = (val: string | bigint | number) => {
298
+ const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
299
+ return hexStr.toLowerCase();
300
+ };
301
+
302
+ return (
303
+ normalizeHex(log.args.secretHash) === normalizeHex(claimSecretHash.toString()) &&
304
+ log.args.amount === amount &&
305
+ normalizeHex(log.args.to) === normalizeHex(to.toString())
306
+ );
307
+ },
289
308
  this.logger,
290
309
  );
291
310
 
@@ -323,7 +342,18 @@ export class L1ToL2TokenPortalManager {
323
342
  this.portal.address,
324
343
  this.portal.abi,
325
344
  'DepositToAztecPrivate',
326
- log => log.args.amount === amount && log.args.secretHashForL2MessageConsumption === claimSecretHash.toString(),
345
+ log => {
346
+ // Normalize hex strings for comparison (case-insensitive, handle different formats)
347
+ const normalizeHex = (val: string | bigint | number) => {
348
+ const hexStr = typeof val === 'string' ? val : `0x${val.toString(16).padStart(64, '0')}`;
349
+ return hexStr.toLowerCase();
350
+ };
351
+
352
+ return (
353
+ log.args.amount === amount &&
354
+ normalizeHex(log.args.secretHashForL2MessageConsumption) === normalizeHex(claimSecretHash.toString())
355
+ );
356
+ },
327
357
  this.logger,
328
358
  );
329
359
 
@@ -394,7 +424,7 @@ export class L1TokenPortalManager extends L1ToL2TokenPortalManager {
394
424
  );
395
425
 
396
426
  const messageLeafId = getL2ToL1MessageLeafId({ leafIndex: messageIndex, siblingPath });
397
- const isConsumedBefore = await this.outbox.read.hasMessageBeenConsumedAtBlock([blockNumber, messageLeafId]);
427
+ const isConsumedBefore = await this.outbox.read.hasMessageBeenConsumedAtCheckpoint([blockNumber, messageLeafId]);
398
428
  if (isConsumedBefore) {
399
429
  throw new Error(
400
430
  `L1 to L2 message at block ${blockNumber} index ${messageIndex} height ${siblingPath.pathSize} has already been consumed`,
@@ -415,7 +445,7 @@ export class L1TokenPortalManager extends L1ToL2TokenPortalManager {
415
445
  hash: await this.extendedClient.writeContract(withdrawRequest),
416
446
  });
417
447
 
418
- const isConsumedAfter = await this.outbox.read.hasMessageBeenConsumedAtBlock([blockNumber, messageLeafId]);
448
+ const isConsumedAfter = await this.outbox.read.hasMessageBeenConsumedAtCheckpoint([blockNumber, messageLeafId]);
419
449
  if (!isConsumedAfter) {
420
450
  throw new Error(
421
451
  `L1 to L2 message at block ${blockNumber} index ${messageIndex} height ${siblingPath.pathSize} not consumed after withdrawal`,
@@ -1,9 +1,9 @@
1
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
3
  import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
5
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
5
  import type { GasSettings } from '@aztec/stdlib/gas';
6
+ import { ExecutionPayload } from '@aztec/stdlib/tx';
7
7
 
8
8
  import type { L2AmountClaim } from '../ethereum/portal_manager.js';
9
9
  import type { FeePaymentMethod } from './fee_payment_method.js';
@@ -45,6 +45,8 @@ export class FeeJuicePaymentMethodWithClaim implements FeePaymentMethod {
45
45
  ],
46
46
  [],
47
47
  [],
48
+ [],
49
+ this.sender, // feePayer
48
50
  );
49
51
  }
50
52
 
@@ -1,6 +1,6 @@
1
- import type { ExecutionPayload } from '@aztec/entrypoints/payload';
2
1
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
2
  import type { GasSettings } from '@aztec/stdlib/gas';
3
+ import type { ExecutionPayload } from '@aztec/stdlib/tx';
4
4
 
5
5
  /**
6
6
  * Holds information about how the fee for a transaction is to be paid.
@@ -1,8 +1,8 @@
1
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
4
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
4
  import type { GasSettings } from '@aztec/stdlib/gas';
5
+ import { ExecutionPayload } from '@aztec/stdlib/tx';
6
6
 
7
7
  import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
8
8
  import type { Wallet } from '../wallet/wallet.js';
@@ -49,7 +49,7 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
49
49
  const abi = {
50
50
  name: 'get_accepted_asset',
51
51
  functionType: FunctionType.PRIVATE,
52
- isInternal: false,
52
+ isOnlySelf: false,
53
53
  isStatic: false,
54
54
  parameters: [],
55
55
  returnTypes: [
@@ -129,6 +129,8 @@ export class PrivateFeePaymentMethod implements FeePaymentMethod {
129
129
  ],
130
130
  [witness],
131
131
  [],
132
+ [],
133
+ this.paymentContract, // feePayer
132
134
  );
133
135
  }
134
136
 
@@ -1,8 +1,8 @@
1
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
2
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
2
  import { type FunctionAbi, FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
4
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
4
  import { GasSettings } from '@aztec/stdlib/gas';
5
+ import { ExecutionPayload } from '@aztec/stdlib/tx';
6
6
 
7
7
  import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
8
8
  import { SetPublicAuthwitContractInteraction } from '../utils/authwit.js';
@@ -43,7 +43,7 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
43
43
  const abi = {
44
44
  name: 'get_accepted_asset',
45
45
  functionType: FunctionType.PRIVATE,
46
- isInternal: false,
46
+ isOnlySelf: false,
47
47
  isStatic: false,
48
48
  parameters: [],
49
49
  returnTypes: [
@@ -129,6 +129,8 @@ export class PublicFeePaymentMethod implements FeePaymentMethod {
129
129
  ],
130
130
  [],
131
131
  [],
132
+ [],
133
+ this.paymentContract, // feePayer
132
134
  );
133
135
  }
134
136