@aztec/aztec.js 3.0.0-devnet.5 → 3.0.0-devnet.6-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
@@ -1,8 +1,8 @@
1
1
  import type { FeePaymentMethod } from '@aztec/aztec.js/fee';
2
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
3
2
  import { FunctionSelector, FunctionType } 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
  /**
8
8
  * A fee payment method that uses a contract that blindly sponsors transactions.
@@ -35,6 +35,8 @@ export class SponsoredFeePaymentMethod implements FeePaymentMethod {
35
35
  ],
36
36
  [],
37
37
  [],
38
+ [],
39
+ this.paymentContract, // feePayer
38
40
  );
39
41
  }
40
42
 
@@ -1,5 +1,5 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
1
2
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
- import type { Fr } from '@aztec/foundation/fields';
3
3
  import type { EventSelector, FunctionSelector } from '@aztec/stdlib/abi';
4
4
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
2
- import { Fr } from '@aztec/foundation/fields';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
4
4
  import { type ABIParameterVisibility, type FunctionAbi, type FunctionCall, FunctionType } from '@aztec/stdlib/abi';
5
5
  import { AuthWitness, computeInnerAuthWitHash, computeOuterAuthWitHash } from '@aztec/stdlib/auth-witness';
@@ -22,7 +22,7 @@ export type IntentInnerHash = {
22
22
  /** The consumer */
23
23
  consumer: AztecAddress;
24
24
  /** The action to approve */
25
- innerHash: Buffer<ArrayBuffer> | Fr;
25
+ innerHash: Fr;
26
26
  };
27
27
 
28
28
  /** Intent with a call */
@@ -43,7 +43,7 @@ export type ContractFunctionInteractionCallIntent = {
43
43
 
44
44
  /** Identifies ContractFunctionInteractionCallIntents */
45
45
  function isContractFunctionIntractionCallIntent(
46
- messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
46
+ messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
47
47
  ): messageHashOrIntent is ContractFunctionInteractionCallIntent {
48
48
  return (
49
49
  'caller' in messageHashOrIntent &&
@@ -102,14 +102,12 @@ export const computeAuthWitMessageHash = async (
102
102
  * @returns The message hash for the intent
103
103
  */
104
104
  export async function getMessageHashFromIntent(
105
- messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
105
+ messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
106
106
  chainInfo: ChainInfo,
107
107
  ) {
108
108
  let messageHash: Fr;
109
109
  const { chainId, version } = chainInfo;
110
- if (Buffer.isBuffer(messageHashOrIntent)) {
111
- messageHash = Fr.fromBuffer(messageHashOrIntent);
112
- } else if (messageHashOrIntent instanceof Fr) {
110
+ if (messageHashOrIntent instanceof Fr) {
113
111
  messageHash = messageHashOrIntent;
114
112
  } else {
115
113
  messageHash = await computeAuthWitMessageHash(messageHashOrIntent, { chainId, version });
@@ -159,9 +157,6 @@ export async function lookupValidity(
159
157
  const call = isContractFunctionIntractionCallIntent(intent) ? await intent.action.getFunctionCall() : intent.call;
160
158
  innerHash = await computeInnerAuthWitHashFromAction(intent.caller, call);
161
159
  consumer = call.to;
162
- } else if (Buffer.isBuffer(intent.innerHash)) {
163
- innerHash = Fr.fromBuffer(intent.innerHash);
164
- consumer = intent.consumer;
165
160
  } else {
166
161
  ({ innerHash, consumer } = intent);
167
162
  }
@@ -174,9 +169,20 @@ export async function lookupValidity(
174
169
  name: 'lookup_validity',
175
170
  isInitializer: false,
176
171
  functionType: FunctionType.UTILITY,
177
- isInternal: false,
172
+ isOnlySelf: false,
178
173
  isStatic: false,
179
- parameters: [{ name: 'message_hash', type: { kind: 'field' }, visibility: 'private' as ABIParameterVisibility }],
174
+ parameters: [
175
+ {
176
+ name: 'consumer',
177
+ type: {
178
+ fields: [{ name: 'inner', type: { kind: 'field' } }],
179
+ kind: 'struct',
180
+ path: 'aztec::protocol_types::address::aztec_address::AztecAddress',
181
+ },
182
+ visibility: 'private' as ABIParameterVisibility,
183
+ },
184
+ { name: 'inner_hash', type: { kind: 'field' }, visibility: 'private' as ABIParameterVisibility },
185
+ ],
180
186
  returnTypes: [{ kind: 'boolean' }],
181
187
  errorTypes: {},
182
188
  } as FunctionAbi;
@@ -194,7 +200,7 @@ export async function lookupValidity(
194
200
  name: 'utility_is_consumable',
195
201
  isInitializer: false,
196
202
  functionType: FunctionType.UTILITY,
197
- isInternal: false,
203
+ isOnlySelf: false,
198
204
  isStatic: false,
199
205
  parameters: [
200
206
  {
@@ -240,7 +246,7 @@ export class SetPublicAuthwitContractInteraction extends ContractFunctionInterac
240
246
  static async create(
241
247
  wallet: Wallet,
242
248
  from: AztecAddress,
243
- messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
249
+ messageHashOrIntent: Fr | IntentInnerHash | CallIntent | ContractFunctionInteractionCallIntent,
244
250
  authorized: boolean,
245
251
  ) {
246
252
  const chainInfo = await wallet.getChainInfo();
@@ -291,7 +297,7 @@ export class SetPublicAuthwitContractInteraction extends ContractFunctionInterac
291
297
  name: 'set_authorized',
292
298
  isInitializer: false,
293
299
  functionType: FunctionType.PUBLIC,
294
- isInternal: true,
300
+ isOnlySelf: true,
295
301
  isStatic: false,
296
302
  parameters: [
297
303
  {
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { retryUntil } from '@aztec/foundation/retry';
3
3
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import { deriveStorageSlotInMap } from '@aztec/stdlib/hash';
@@ -6,7 +6,7 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
6
6
 
7
7
  /**
8
8
  * Returns the owner's fee juice balance.
9
- * Note: This is used only e2e_sandbox_example test. TODO: Consider nuking.
9
+ * Note: This is used only e2e_local_network_example test. TODO: Consider nuking.
10
10
  */
11
11
  export async function getFeeJuiceBalance(owner: AztecAddress, node: AztecNode): Promise<bigint> {
12
12
  const slot = await deriveStorageSlotInMap(new Fr(1), owner);
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
 
3
3
  /**
4
4
  * The representation of a FieldCompressedString in aztec.nr
@@ -1,5 +1,5 @@
1
- import { Grumpkin } from '@aztec/foundation/crypto';
2
- import type { GrumpkinScalar } from '@aztec/foundation/fields';
1
+ import { Grumpkin } from '@aztec/foundation/crypto/grumpkin';
2
+ import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
3
3
  import type { PublicKey } from '@aztec/stdlib/keys';
4
4
 
5
5
  /**
@@ -8,6 +8,5 @@ import type { PublicKey } from '@aztec/stdlib/keys';
8
8
  * @returns The generated public key.
9
9
  */
10
10
  export function generatePublicKey(privateKey: GrumpkinScalar): Promise<PublicKey> {
11
- const grumpkin = new Grumpkin();
12
- return grumpkin.mul(grumpkin.generator(), privateKey);
11
+ return Grumpkin.mul(Grumpkin.generator, privateKey);
13
12
  }
@@ -1,6 +1,5 @@
1
1
  import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
2
2
  import { EncodedAppEntrypointCalls } from '@aztec/entrypoints/encoding';
3
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
4
3
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
5
4
  import {
6
5
  type ContractArtifact,
@@ -12,6 +11,7 @@ import {
12
11
  } from '@aztec/stdlib/abi';
13
12
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
13
  import type { GasSettings } from '@aztec/stdlib/gas';
14
+ import { ExecutionPayload } from '@aztec/stdlib/tx';
15
15
 
16
16
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
17
17
  import type { Wallet } from './index.js';
@@ -92,6 +92,7 @@ export class AccountEntrypointMetaPaymentMethod implements FeePaymentMethod {
92
92
  [payloadAuthWitness, ...feeAuthwitnesses],
93
93
  [],
94
94
  feeEncodedCalls.hashedArguments,
95
+ feePayer,
95
96
  );
96
97
  }
97
98
 
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import {
3
3
  CompleteAddress,
4
4
  type ContractInstanceWithAddress,
@@ -138,7 +138,7 @@ export class AccountManager {
138
138
  this.getPublicKeys(),
139
139
  this.wallet,
140
140
  artifact,
141
- address => Contract.at(address, artifact, this.wallet),
141
+ instance => Contract.at(instance.address, artifact, this.wallet),
142
142
  new Fr(this.salt),
143
143
  constructorArgs,
144
144
  constructorName,
@@ -1,8 +1,9 @@
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, FunctionArtifact } from '@aztec/stdlib/abi';
4
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
5
  import type { PublicKeys } from '@aztec/stdlib/keys';
6
+ import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
6
7
 
7
8
  import type { Contract } from '../contract/contract.js';
8
9
  import type { ContractBase } from '../contract/contract_base.js';
@@ -44,7 +45,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
44
45
  publicKeys: PublicKeys,
45
46
  wallet: Wallet,
46
47
  artifact: ContractArtifact,
47
- postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
48
+ postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
48
49
  private salt: Fr,
49
50
  args: any[] = [],
50
51
  constructorNameOrArtifact?: string | FunctionArtifact,
@@ -1,3 +1,2 @@
1
1
  export * from './wallet.js';
2
- export * from './base_wallet.js';
3
2
  export * from './account_manager.js';
@@ -1,12 +1,13 @@
1
1
  import type { ChainInfo } from '@aztec/entrypoints/interfaces';
2
- import type { ExecutionPayload } from '@aztec/entrypoints/payload';
3
- import type { Fr } from '@aztec/foundation/fields';
2
+ import { BlockNumber, BlockNumberPositiveSchema } from '@aztec/foundation/branded-types';
3
+ import type { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import {
5
+ type AbiDecoded,
5
6
  AbiTypeSchema,
6
7
  type ContractArtifact,
7
8
  ContractArtifactSchema,
8
9
  type EventMetadataDefinition,
9
- FunctionAbiSchema,
10
+ type FunctionCall,
10
11
  FunctionType,
11
12
  } from '@aztec/stdlib/abi';
12
13
  import { AuthWitness } from '@aztec/stdlib/auth-witness';
@@ -16,11 +17,9 @@ import {
16
17
  ContractClassWithIdSchema,
17
18
  type ContractInstanceWithAddress,
18
19
  ContractInstanceWithAddressSchema,
19
- type ContractInstantiationData,
20
20
  type ContractMetadata,
21
21
  } from '@aztec/stdlib/contract';
22
22
  import { Gas } from '@aztec/stdlib/gas';
23
- import { PublicKeys } from '@aztec/stdlib/keys';
24
23
  import { AbiDecodedSchema, type ApiSchemaFor, type ZodFor, optional, schemas } from '@aztec/stdlib/schemas';
25
24
  import {
26
25
  Capsule,
@@ -30,11 +29,12 @@ import {
30
29
  TxReceipt,
31
30
  TxSimulationResult,
32
31
  UtilitySimulationResult,
32
+ inTxSchema,
33
33
  } from '@aztec/stdlib/tx';
34
+ import type { ExecutionPayload, InTx } from '@aztec/stdlib/tx';
34
35
 
35
36
  import { z } from 'zod';
36
37
 
37
- import type { Contract } from '../contract/contract.js';
38
38
  import type {
39
39
  FeeEstimationOptions,
40
40
  GasSettingsOption,
@@ -58,22 +58,6 @@ export type Aliased<T> = {
58
58
  item: T;
59
59
  };
60
60
 
61
- /**
62
- * A reduced representation of a Contract, only including its instance and artifact
63
- */
64
- export type ContractInstanceAndArtifact = Pick<Contract, 'artifact' | 'instance'>;
65
-
66
- /**
67
- * Options that can be provided to the wallet for configuration of the fee payment.
68
- */
69
- export type UserFeeOptions = {
70
- /**
71
- * Informs the wallet that the crafted tx already contains the necessary calls to pay for its fee
72
- * and who is paying
73
- */
74
- embeddedPaymentMethodFeePayer?: AztecAddress;
75
- } & GasSettingsOption;
76
-
77
61
  /**
78
62
  * Options for simulating interactions with the wallet. Overrides the fee settings of an interaction with
79
63
  * a simplified version that only hints at the wallet wether the interaction contains a
@@ -81,7 +65,7 @@ export type UserFeeOptions = {
81
65
  */
82
66
  export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
83
67
  /** The fee options */
84
- fee?: UserFeeOptions & FeeEstimationOptions;
68
+ fee?: GasSettingsOption & FeeEstimationOptions;
85
69
  };
86
70
 
87
71
  /**
@@ -91,7 +75,7 @@ export type SimulateOptions = Omit<SimulateInteractionOptions, 'fee'> & {
91
75
  */
92
76
  export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
93
77
  /** The fee options */
94
- fee?: UserFeeOptions;
78
+ fee?: GasSettingsOption;
95
79
  };
96
80
 
97
81
  /**
@@ -101,13 +85,16 @@ export type ProfileOptions = Omit<ProfileInteractionOptions, 'fee'> & {
101
85
  */
102
86
  export type SendOptions = Omit<SendInteractionOptions, 'fee'> & {
103
87
  /** The fee options */
104
- fee?: UserFeeOptions;
88
+ fee?: GasSettingsOption;
105
89
  };
106
90
 
107
91
  /**
108
92
  * Helper type that represents all methods that can be batched.
109
93
  */
110
- export type BatchableMethods = Pick<Wallet, 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility'>;
94
+ export type BatchableMethods = Pick<
95
+ Wallet,
96
+ 'registerContract' | 'sendTx' | 'registerSender' | 'simulateUtility' | 'simulateTx'
97
+ >;
111
98
 
112
99
  /**
113
100
  * From the batchable methods, we create a type that represents a method call with its name and arguments.
@@ -145,6 +132,38 @@ export type BatchResults<T extends readonly BatchedMethod<keyof BatchableMethods
145
132
  [K in keyof T]: BatchedMethodResultWrapper<T[K]>;
146
133
  };
147
134
 
135
+ /**
136
+ * Filter options when querying private events.
137
+ */
138
+ export type PrivateEventFilter = {
139
+ /** The address of the contract that emitted the events. */
140
+ contractAddress: AztecAddress;
141
+ /** Addresses of accounts that are in scope for this filter. */
142
+ scopes: AztecAddress[];
143
+ /** Transaction in which the events were emitted. */
144
+ txHash?: TxHash;
145
+ /** The block number from which to start fetching events (inclusive).
146
+ * Optional. If provided, it must be greater or equal than 1.
147
+ * Defaults to the initial L2 block number (INITIAL_L2_BLOCK_NUM).
148
+ * */
149
+ fromBlock?: BlockNumber;
150
+ /** The block number until which to fetch logs (not inclusive).
151
+ * Optional. If provided, it must be greater than fromBlock.
152
+ * Defaults to the latest known block to PXE + 1.
153
+ */
154
+ toBlock?: BlockNumber;
155
+ };
156
+
157
+ /**
158
+ * An ABI decoded private event with associated metadata.
159
+ */
160
+ export type PrivateEvent<T> = {
161
+ /** The ABI decoded event */
162
+ event: T;
163
+ /** Metadata describing event context information such as tx and block */
164
+ metadata: InTx;
165
+ };
166
+
148
167
  /**
149
168
  * The wallet interface.
150
169
  */
@@ -152,55 +171,27 @@ export type Wallet = {
152
171
  getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
153
172
  getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
154
173
  getPrivateEvents<T>(
155
- contractAddress: AztecAddress,
156
174
  eventMetadata: EventMetadataDefinition,
157
- from: number,
158
- numBlocks: number,
159
- recipients: AztecAddress[],
160
- ): Promise<T[]>;
175
+ eventFilter: PrivateEventFilter,
176
+ ): Promise<PrivateEvent<T>[]>;
161
177
  getChainInfo(): Promise<ChainInfo>;
162
178
  getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
163
179
  registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress>;
164
180
  getAddressBook(): Promise<Aliased<AztecAddress>[]>;
165
181
  getAccounts(): Promise<Aliased<AztecAddress>[]>;
166
182
  registerContract(
167
- instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
168
- ): Promise<ContractInstanceWithAddress>;
169
- // Overloaded definition to avoid zod issues
170
- registerContract(
171
- instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
172
- artifact: ContractArtifact,
173
- ): Promise<ContractInstanceWithAddress>;
174
- registerContract(
175
- instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact,
176
- artifact: ContractArtifact | undefined,
177
- secretKey: Fr | undefined,
183
+ instance: ContractInstanceWithAddress,
184
+ artifact?: ContractArtifact,
185
+ secretKey?: Fr,
178
186
  ): Promise<ContractInstanceWithAddress>;
179
187
  simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
180
- simulateUtility(
181
- functionName: string,
182
- args: any[],
183
- to: AztecAddress,
184
- authwits?: AuthWitness[],
185
- ): Promise<UtilitySimulationResult>;
188
+ simulateUtility(call: FunctionCall, authwits?: AuthWitness[]): Promise<UtilitySimulationResult>;
186
189
  profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
187
190
  sendTx(exec: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
188
- createAuthWit(
189
- from: AztecAddress,
190
- messageHashOrIntent: Fr | Buffer<ArrayBuffer> | IntentInnerHash | CallIntent,
191
- ): Promise<AuthWitness>;
191
+ createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | IntentInnerHash | CallIntent): Promise<AuthWitness>;
192
192
  batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
193
193
  };
194
194
 
195
- export const ContractInstantiationDataSchema = z.object({
196
- constructorArtifact: optional(z.union([FunctionAbiSchema, z.string()])),
197
- constructorArgs: optional(z.array(z.any())),
198
- skipArgsDecoding: optional(z.boolean()),
199
- salt: schemas.Fr,
200
- publicKeys: optional(PublicKeys.schema),
201
- deployer: optional(schemas.AztecAddress),
202
- });
203
-
204
195
  export const FunctionCallSchema = z.object({
205
196
  name: z.string(),
206
197
  to: schemas.AztecAddress,
@@ -217,9 +208,10 @@ export const ExecutionPayloadSchema = z.object({
217
208
  authWitnesses: z.array(AuthWitness.schema),
218
209
  capsules: z.array(Capsule.schema),
219
210
  extraHashedArgs: z.array(HashedValues.schema),
211
+ feePayer: optional(schemas.AztecAddress),
220
212
  });
221
213
 
222
- export const UserFeeOptionsSchema = z.object({
214
+ export const GasSettingsOptionSchema = z.object({
223
215
  gasSettings: optional(
224
216
  z.object({
225
217
  gasLimits: optional(Gas.schema),
@@ -228,10 +220,9 @@ export const UserFeeOptionsSchema = z.object({
228
220
  maxPriorityFeePerGas: optional(z.object({ feePerDaGas: schemas.BigInt, feePerL2Gas: schemas.BigInt })),
229
221
  }),
230
222
  ),
231
- embeddedPaymentMethodFeePayer: optional(schemas.AztecAddress),
232
223
  });
233
224
 
234
- export const WalletSimulationFeeOptionSchema = UserFeeOptionsSchema.extend({
225
+ export const WalletSimulationFeeOptionSchema = GasSettingsOptionSchema.extend({
235
226
  estimatedGasPadding: optional(z.number()),
236
227
  estimateGas: optional(z.boolean()),
237
228
  });
@@ -240,7 +231,7 @@ export const SendOptionsSchema = z.object({
240
231
  from: schemas.AztecAddress,
241
232
  authWitnesses: optional(z.array(AuthWitness.schema)),
242
233
  capsules: optional(z.array(Capsule.schema)),
243
- fee: optional(UserFeeOptionsSchema),
234
+ fee: optional(GasSettingsOptionSchema),
244
235
  });
245
236
 
246
237
  export const SimulateOptionsSchema = z.object({
@@ -258,17 +249,9 @@ export const ProfileOptionsSchema = SimulateOptionsSchema.extend({
258
249
  skipProofGeneration: optional(z.boolean()),
259
250
  });
260
251
 
261
- export const InstanceDataSchema = z.union([
262
- schemas.AztecAddress,
263
- ContractInstanceWithAddressSchema,
264
- ContractInstantiationDataSchema,
265
- z.object({ instance: ContractInstanceWithAddressSchema, artifact: ContractArtifactSchema }),
266
- ]);
267
-
268
252
  export const MessageHashOrIntentSchema = z.union([
269
253
  schemas.Fr,
270
- schemas.Buffer,
271
- z.object({ consumer: schemas.AztecAddress, innerHash: z.union([schemas.Buffer, schemas.Fr]) }),
254
+ z.object({ consumer: schemas.AztecAddress, innerHash: schemas.Fr }),
272
255
  z.object({
273
256
  caller: schemas.AztecAddress,
274
257
  call: FunctionCallSchema,
@@ -282,7 +265,7 @@ export const BatchedMethodSchema = z.union([
282
265
  }),
283
266
  z.object({
284
267
  name: z.literal('registerContract'),
285
- args: z.tuple([InstanceDataSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
268
+ args: z.tuple([ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr)]),
286
269
  }),
287
270
  z.object({
288
271
  name: z.literal('sendTx'),
@@ -290,7 +273,11 @@ export const BatchedMethodSchema = z.union([
290
273
  }),
291
274
  z.object({
292
275
  name: z.literal('simulateUtility'),
293
- args: z.tuple([z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema))]),
276
+ args: z.tuple([FunctionCallSchema, optional(z.array(AuthWitness.schema))]),
277
+ }),
278
+ z.object({
279
+ name: z.literal('simulateTx'),
280
+ args: z.tuple([ExecutionPayloadSchema, SimulateOptionsSchema]),
294
281
  }),
295
282
  ]);
296
283
 
@@ -312,6 +299,19 @@ export const EventMetadataDefinitionSchema = z.object({
312
299
  fieldNames: z.array(z.string()),
313
300
  });
314
301
 
302
+ export const PrivateEventSchema: ZodFor<PrivateEvent<AbiDecoded>> = z.object({
303
+ event: AbiDecodedSchema,
304
+ metadata: inTxSchema(),
305
+ });
306
+
307
+ export const PrivateEventFilterSchema = z.object({
308
+ contractAddress: schemas.AztecAddress,
309
+ scopes: z.array(schemas.AztecAddress),
310
+ txHash: optional(TxHash.schema),
311
+ fromBlock: optional(BlockNumberPositiveSchema),
312
+ toBlock: optional(BlockNumberPositiveSchema),
313
+ });
314
+
315
315
  export const WalletSchema: ApiSchemaFor<Wallet> = {
316
316
  getChainInfo: z
317
317
  .function()
@@ -322,8 +322,8 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
322
322
  getTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema),
323
323
  getPrivateEvents: z
324
324
  .function()
325
- .args(schemas.AztecAddress, EventMetadataDefinitionSchema, z.number(), z.number(), z.array(schemas.AztecAddress))
326
- .returns(z.array(AbiDecodedSchema)),
325
+ .args(EventMetadataDefinitionSchema, PrivateEventFilterSchema)
326
+ .returns(z.array(PrivateEventSchema)),
327
327
  registerSender: z.function().args(schemas.AztecAddress, optional(z.string())).returns(schemas.AztecAddress),
328
328
  getAddressBook: z
329
329
  .function()
@@ -335,12 +335,12 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
335
335
  .returns(z.array(z.object({ alias: z.string(), item: schemas.AztecAddress }))),
336
336
  registerContract: z
337
337
  .function()
338
- .args(InstanceDataSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
338
+ .args(ContractInstanceWithAddressSchema, optional(ContractArtifactSchema), optional(schemas.Fr))
339
339
  .returns(ContractInstanceWithAddressSchema),
340
340
  simulateTx: z.function().args(ExecutionPayloadSchema, SimulateOptionsSchema).returns(TxSimulationResult.schema),
341
341
  simulateUtility: z
342
342
  .function()
343
- .args(z.string(), z.array(z.any()), schemas.AztecAddress, optional(z.array(AuthWitness.schema)))
343
+ .args(FunctionCallSchema, optional(z.array(AuthWitness.schema)))
344
344
  .returns(UtilitySimulationResult.schema),
345
345
  profileTx: z.function().args(ExecutionPayloadSchema, ProfileOptionsSchema).returns(TxProfileResult.schema),
346
346
  sendTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(TxHash.schema),
@@ -356,6 +356,7 @@ export const WalletSchema: ApiSchemaFor<Wallet> = {
356
356
  z.object({ name: z.literal('registerContract'), result: ContractInstanceWithAddressSchema }),
357
357
  z.object({ name: z.literal('sendTx'), result: TxHash.schema }),
358
358
  z.object({ name: z.literal('simulateUtility'), result: UtilitySimulationResult.schema }),
359
+ z.object({ name: z.literal('simulateTx'), result: TxSimulationResult.schema }),
359
360
  ]),
360
361
  ),
361
362
  ),
@@ -1,91 +0,0 @@
1
- import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
2
- import type { ChainInfo } from '@aztec/entrypoints/interfaces';
3
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import type { ContractArtifact, EventMetadataDefinition } from '@aztec/stdlib/abi';
6
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
7
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import { type ContractClassMetadata, type ContractInstanceWithAddress, type ContractInstantiationData, type ContractMetadata } from '@aztec/stdlib/contract';
9
- import { GasSettings } from '@aztec/stdlib/gas';
10
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
11
- import type { TxExecutionRequest, TxHash, TxProfileResult, TxReceipt, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
12
- import type { Account } from '../account/account.js';
13
- import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
14
- import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
15
- import type { Aliased, BatchResults, BatchableMethods, BatchedMethod, ContractInstanceAndArtifact, ProfileOptions, SendOptions, SimulateOptions, UserFeeOptions, Wallet } from './wallet.js';
16
- /**
17
- * Options to configure fee payment for a transaction
18
- */
19
- export type FeeOptions = {
20
- /**
21
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
22
- * doesn't already include one
23
- */
24
- walletFeePaymentMethod?: FeePaymentMethod;
25
- /** Configuration options for the account to properly handle the selected fee payment method */
26
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
27
- /** The gas settings to use for the transaction */
28
- gasSettings: GasSettings;
29
- };
30
- /**
31
- * A base class for Wallet implementations
32
- */
33
- export declare abstract class BaseWallet implements Wallet {
34
- protected readonly pxe: any;
35
- protected readonly aztecNode: AztecNode;
36
- protected log: import("@aztec/foundation/log").Logger;
37
- protected baseFeePadding: number;
38
- protected cancellableTransactions: boolean;
39
- protected constructor(pxe: any, aztecNode: AztecNode);
40
- protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
41
- abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
42
- /**
43
- * Returns the list of aliased contacts associated with the wallet.
44
- * This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
45
- * - Senders: Addresses we check during synching in case they sent us notes,
46
- * - Contacts: more general concept akin to a phone's contact list.
47
- * @returns The aliased collection of AztecAddresses that form this wallet's address book
48
- */
49
- getAddressBook(): Promise<Aliased<AztecAddress>[]>;
50
- getChainInfo(): Promise<ChainInfo>;
51
- protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
52
- createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent): Promise<AuthWitness>;
53
- batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
54
- /**
55
- * Returns default values for the transaction fee options
56
- * if they were omitted by the user.
57
- * @param from - The address where the transaction is being sent from
58
- * @param userFeeOptions - User-provided fee options, which might be incomplete
59
- * @returns - Populated fee options that can be used to create a transaction execution request
60
- */
61
- protected getDefaultFeeOptions(from: AztecAddress, userFeeOptions?: UserFeeOptions): Promise<FeeOptions>;
62
- /**
63
- * Returns unreasonably high gas limits in order to execute a simulation
64
- * with the goal of estimating its gas cost. It will otherwise try to respect
65
- * the user-specified fee options, filling the gaps with default values as needed.
66
- * @param from - The address where the transaction is being sent from
67
- * @param userFeeOptions - User-provided fee options to use as a basis for the fully populated `FeeOptions` type.
68
- */
69
- protected getFeeOptionsForGasEstimation(from: AztecAddress, userFeeOptions?: UserFeeOptions): Promise<{
70
- gasSettings: GasSettings;
71
- /**
72
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
73
- * doesn't already include one
74
- */
75
- walletFeePaymentMethod?: FeePaymentMethod;
76
- /** Configuration options for the account to properly handle the selected fee payment method */
77
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
78
- }>;
79
- registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
80
- registerContract(instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
81
- simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
82
- profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
83
- sendTx(executionPayload: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
84
- protected contextualizeError(err: Error, ...context: string[]): Error;
85
- simulateUtility(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress): Promise<UtilitySimulationResult>;
86
- getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
87
- getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
88
- getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
89
- getPrivateEvents<T>(contractAddress: AztecAddress, event: EventMetadataDefinition, from: number, limit: number, recipients?: AztecAddress[]): Promise<T[]>;
90
- }
91
- //# sourceMappingURL=base_wallet.d.ts.map