@aztec/aztec.js 0.0.1-commit.fce3e4f → 0.0.1-commit.ff7989d6c

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 (212) hide show
  1. package/dest/account/account.d.ts +25 -40
  2. package/dest/account/account.d.ts.map +1 -1
  3. package/dest/account/account.js +19 -47
  4. package/dest/account/account_contract.d.ts +9 -10
  5. package/dest/account/account_contract.d.ts.map +1 -1
  6. package/dest/account/account_with_secret_key.d.ts +21 -9
  7. package/dest/account/account_with_secret_key.d.ts.map +1 -1
  8. package/dest/account/account_with_secret_key.js +21 -4
  9. package/dest/account/index.d.ts +4 -3
  10. package/dest/account/index.d.ts.map +1 -1
  11. package/dest/account/index.js +2 -0
  12. package/dest/account/signerless_account.d.ts +6 -7
  13. package/dest/account/signerless_account.d.ts.map +1 -1
  14. package/dest/account/signerless_account.js +8 -11
  15. package/dest/api/account.d.ts +2 -4
  16. package/dest/api/account.d.ts.map +1 -1
  17. package/dest/api/account.js +1 -3
  18. package/dest/api/authorization.d.ts +2 -2
  19. package/dest/api/authorization.d.ts.map +1 -1
  20. package/dest/api/authorization.js +1 -1
  21. package/dest/api/contract.d.ts +18 -12
  22. package/dest/api/contract.d.ts.map +1 -1
  23. package/dest/api/contract.js +16 -10
  24. package/dest/api/deployment.d.ts +1 -2
  25. package/dest/api/deployment.d.ts.map +1 -1
  26. package/dest/api/deployment.js +0 -1
  27. package/dest/api/events.d.ts +10 -6
  28. package/dest/api/events.d.ts.map +1 -1
  29. package/dest/api/events.js +30 -20
  30. package/dest/api/fields.d.ts +4 -2
  31. package/dest/api/fields.d.ts.map +1 -1
  32. package/dest/api/fields.js +3 -1
  33. package/dest/api/keys.d.ts +1 -1
  34. package/dest/api/keys.js +1 -1
  35. package/dest/api/node.d.ts +8 -4
  36. package/dest/api/node.d.ts.map +1 -1
  37. package/dest/api/node.js +7 -3
  38. package/dest/api/protocol.d.ts +7 -1
  39. package/dest/api/protocol.d.ts.map +1 -1
  40. package/dest/api/protocol.js +6 -0
  41. package/dest/api/tx.d.ts +2 -2
  42. package/dest/api/tx.d.ts.map +1 -1
  43. package/dest/api/tx.js +1 -1
  44. package/dest/api/wallet.d.ts +3 -2
  45. package/dest/api/wallet.d.ts.map +1 -1
  46. package/dest/api/wallet.js +2 -1
  47. package/dest/authorization/call_authorization_request.d.ts +23 -2
  48. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  49. package/dest/contract/base_contract_interaction.d.ts +8 -10
  50. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  51. package/dest/contract/base_contract_interaction.js +5 -17
  52. package/dest/contract/batch_call.d.ts +3 -3
  53. package/dest/contract/batch_call.d.ts.map +1 -1
  54. package/dest/contract/batch_call.js +11 -6
  55. package/dest/contract/contract_base.d.ts +4 -1
  56. package/dest/contract/contract_base.d.ts.map +1 -1
  57. package/dest/contract/contract_function_interaction.d.ts +3 -12
  58. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  59. package/dest/contract/contract_function_interaction.js +10 -7
  60. package/dest/contract/deploy_method.d.ts +77 -18
  61. package/dest/contract/deploy_method.d.ts.map +1 -1
  62. package/dest/contract/deploy_method.js +56 -30
  63. package/dest/contract/interaction_options.d.ts +49 -5
  64. package/dest/contract/interaction_options.d.ts.map +1 -1
  65. package/dest/contract/interaction_options.js +8 -1
  66. package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
  67. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  68. package/dest/contract/protocol_contracts/auth-registry.js +997 -0
  69. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +15 -0
  70. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  71. package/dest/contract/protocol_contracts/contract-class-registry.js +139 -0
  72. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +22 -0
  73. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  74. package/dest/contract/protocol_contracts/contract-instance-registry.js +465 -0
  75. package/dest/contract/protocol_contracts/fee-juice.d.ts +21 -0
  76. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  77. package/dest/contract/protocol_contracts/fee-juice.js +426 -0
  78. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  79. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  80. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +593 -0
  81. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  82. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  83. package/dest/contract/protocol_contracts/public-checks.js +601 -0
  84. package/dest/contract/wait_for_proven.d.ts +2 -2
  85. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  86. package/dest/contract/wait_for_proven.js +1 -1
  87. package/dest/contract/wait_opts.d.ts +16 -0
  88. package/dest/contract/wait_opts.d.ts.map +1 -0
  89. package/dest/contract/wait_opts.js +5 -0
  90. package/dest/deployment/publish_class.js +3 -3
  91. package/dest/deployment/publish_instance.d.ts +2 -2
  92. package/dest/deployment/publish_instance.d.ts.map +1 -1
  93. package/dest/deployment/publish_instance.js +3 -3
  94. package/dest/ethereum/portal_manager.d.ts +9 -6
  95. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  96. package/dest/ethereum/portal_manager.js +17 -18
  97. package/dest/fee/fee_juice_payment_method_with_claim.js +7 -7
  98. package/dest/fee/private_fee_payment_method.js +11 -11
  99. package/dest/fee/public_fee_payment_method.js +11 -11
  100. package/dest/fee/sponsored_fee_payment.js +3 -3
  101. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  102. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  103. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  104. package/dest/utils/abi_types.d.ts +2 -2
  105. package/dest/utils/abi_types.d.ts.map +1 -1
  106. package/dest/utils/authwit.d.ts +9 -7
  107. package/dest/utils/authwit.d.ts.map +1 -1
  108. package/dest/utils/authwit.js +6 -10
  109. package/dest/utils/cross_chain.d.ts +2 -2
  110. package/dest/utils/cross_chain.d.ts.map +1 -1
  111. package/dest/utils/fee_juice.js +1 -1
  112. package/dest/utils/field_compressed_string.js +1 -1
  113. package/dest/utils/node.d.ts +12 -1
  114. package/dest/utils/node.d.ts.map +1 -1
  115. package/dest/utils/node.js +46 -0
  116. package/dest/utils/pub_key.d.ts +2 -2
  117. package/dest/utils/pub_key.d.ts.map +1 -1
  118. package/dest/utils/pub_key.js +1 -1
  119. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +5 -8
  120. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  121. package/dest/wallet/account_entrypoint_meta_payment_method.js +28 -43
  122. package/dest/wallet/account_manager.d.ts +6 -9
  123. package/dest/wallet/account_manager.d.ts.map +1 -1
  124. package/dest/wallet/account_manager.js +6 -12
  125. package/dest/wallet/capabilities.d.ts +452 -0
  126. package/dest/wallet/capabilities.d.ts.map +1 -0
  127. package/dest/wallet/capabilities.js +3 -0
  128. package/dest/wallet/deploy_account_method.d.ts +47 -8
  129. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  130. package/dest/wallet/deploy_account_method.js +34 -6
  131. package/dest/wallet/index.d.ts +2 -1
  132. package/dest/wallet/index.d.ts.map +1 -1
  133. package/dest/wallet/index.js +1 -0
  134. package/dest/wallet/wallet.d.ts +1817 -984
  135. package/dest/wallet/wallet.d.ts.map +1 -1
  136. package/dest/wallet/wallet.js +216 -101
  137. package/package.json +25 -14
  138. package/src/account/account.ts +34 -58
  139. package/src/account/account_contract.ts +7 -8
  140. package/src/account/account_with_secret_key.ts +34 -9
  141. package/src/account/index.ts +3 -2
  142. package/src/account/signerless_account.ts +14 -13
  143. package/src/api/account.ts +9 -3
  144. package/src/api/authorization.ts +1 -0
  145. package/src/api/contract.ts +24 -9
  146. package/src/api/deployment.ts +0 -1
  147. package/src/api/events.ts +35 -27
  148. package/src/api/fields.ts +3 -1
  149. package/src/api/keys.ts +2 -2
  150. package/src/api/node.ts +7 -3
  151. package/src/api/protocol.ts +7 -0
  152. package/src/api/tx.ts +2 -0
  153. package/src/api/wallet.ts +52 -3
  154. package/src/authorization/call_authorization_request.ts +1 -1
  155. package/src/contract/base_contract_interaction.ts +27 -15
  156. package/src/contract/batch_call.ts +10 -13
  157. package/src/contract/contract_function_interaction.ts +17 -7
  158. package/src/contract/deploy_method.ts +146 -36
  159. package/src/contract/interaction_options.ts +56 -4
  160. package/src/contract/protocol_contracts/auth-registry.ts +551 -0
  161. package/src/contract/protocol_contracts/contract-class-registry.ts +99 -0
  162. package/src/contract/protocol_contracts/contract-instance-registry.ts +302 -0
  163. package/src/contract/protocol_contracts/fee-juice.ts +264 -0
  164. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +334 -0
  165. package/src/contract/protocol_contracts/public-checks.ts +318 -0
  166. package/src/contract/wait_for_proven.ts +1 -1
  167. package/src/contract/wait_opts.ts +21 -0
  168. package/src/deployment/publish_class.ts +3 -3
  169. package/src/deployment/publish_instance.ts +3 -6
  170. package/src/ethereum/portal_manager.ts +20 -24
  171. package/src/fee/fee_juice_payment_method_with_claim.ts +6 -6
  172. package/src/fee/private_fee_payment_method.ts +8 -8
  173. package/src/fee/public_fee_payment_method.ts +9 -9
  174. package/src/fee/sponsored_fee_payment.ts +3 -3
  175. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  176. package/src/utils/abi_types.ts +1 -1
  177. package/src/utils/authwit.ts +20 -8
  178. package/src/utils/cross_chain.ts +1 -1
  179. package/src/utils/fee_juice.ts +1 -1
  180. package/src/utils/field_compressed_string.ts +1 -1
  181. package/src/utils/node.ts +62 -0
  182. package/src/utils/pub_key.ts +2 -2
  183. package/src/wallet/account_entrypoint_meta_payment_method.ts +28 -60
  184. package/src/wallet/account_manager.ts +6 -14
  185. package/src/wallet/capabilities.ts +500 -0
  186. package/src/wallet/deploy_account_method.ts +75 -14
  187. package/src/wallet/index.ts +1 -0
  188. package/src/wallet/wallet.ts +375 -110
  189. package/dest/account/interface.d.ts +0 -19
  190. package/dest/account/interface.d.ts.map +0 -1
  191. package/dest/account/interface.js +0 -5
  192. package/dest/contract/deploy_sent_tx.d.ts +0 -48
  193. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  194. package/dest/contract/deploy_sent_tx.js +0 -46
  195. package/dest/contract/protocol_contracts.d.ts +0 -9
  196. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  197. package/dest/contract/protocol_contracts.js +0 -26
  198. package/dest/contract/sent_tx.d.ts +0 -51
  199. package/dest/contract/sent_tx.d.ts.map +0 -1
  200. package/dest/contract/sent_tx.js +0 -90
  201. package/dest/contract/unsafe_contract.d.ts +0 -15
  202. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  203. package/dest/contract/unsafe_contract.js +0 -6
  204. package/dest/deployment/broadcast_function.d.ts +0 -24
  205. package/dest/deployment/broadcast_function.d.ts.map +0 -1
  206. package/dest/deployment/broadcast_function.js +0 -74
  207. package/src/account/interface.ts +0 -25
  208. package/src/contract/deploy_sent_tx.ts +0 -75
  209. package/src/contract/protocol_contracts.ts +0 -35
  210. package/src/contract/sent_tx.ts +0 -130
  211. package/src/contract/unsafe_contract.ts +0 -19
  212. package/src/deployment/broadcast_function.ts +0 -148
@@ -1,34 +1,69 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { ContractArtifact, FunctionArtifact } from '@aztec/stdlib/abi';
3
3
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
5
5
  import type { PublicKeys } from '@aztec/stdlib/keys';
6
6
  import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
7
7
 
8
+ import type { Account } from '../account/account.js';
8
9
  import type { Contract } from '../contract/contract.js';
9
10
  import type { ContractBase } from '../contract/contract_base.js';
10
11
  import {
12
+ type DeployInteractionWaitOptions,
11
13
  DeployMethod,
12
14
  type DeployOptions,
15
+ type DeployOptionsWithoutWait,
13
16
  type RequestDeployOptions,
14
17
  type SimulateDeployOptions,
15
18
  } from '../contract/deploy_method.js';
19
+ import type {
20
+ FeePaymentMethodOption,
21
+ InteractionWaitOptions,
22
+ ProfileInteractionOptions,
23
+ } from '../contract/interaction_options.js';
24
+ import type { WaitOpts } from '../contract/wait_opts.js';
16
25
  import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
17
26
  import { AccountEntrypointMetaPaymentMethod } from './account_entrypoint_meta_payment_method.js';
18
- import type { Wallet } from './index.js';
27
+ import type { ProfileOptions, SendOptions, SimulateOptions, Wallet } from './index.js';
28
+
29
+ /**
30
+ * Extended fee payment method option for account deployments that includes entrypoint wrapping options
31
+ */
32
+ export type DeployAccountFeePaymentMethodOption = FeePaymentMethodOption & {
33
+ /** Optional entrypoint-specific options for wrapping execution payloads */
34
+ feeEntrypointOptions?: unknown;
35
+ };
19
36
 
20
37
  /**
21
38
  * The configuration options for the request method. Omits the contractAddressSalt, since
22
39
  * for account contracts that is fixed in the constructor
23
40
  */
24
- export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt'>;
41
+ export type RequestDeployAccountOptions = Omit<RequestDeployOptions, 'contractAddressSalt' | 'fee'> & {
42
+ /** Fee options specific to account deployment */
43
+ fee?: DeployAccountFeePaymentMethodOption;
44
+ };
45
+
46
+ /**
47
+ * Base configuration options for the send/prove methods without wait parameter. Omits:
48
+ * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
49
+ * - UniversalDeployment flag, since account contracts are always deployed with it set to true
50
+ */
51
+ export type DeployAccountOptionsWithoutWait = Omit<DeployOptionsWithoutWait, 'contractAddressSalt' | 'universalDeploy'>;
25
52
 
26
53
  /**
27
54
  * The configuration options for the send/prove methods. Omits:
28
55
  * - The contractAddressSalt, since for account contracts that is fixed in the constructor.
29
56
  * - UniversalDeployment flag, since account contracts are always deployed with it set to true
30
57
  */
31
- export type DeployAccountOptions = Omit<DeployOptions, 'contractAddressSalt' | 'universalDeploy'>;
58
+ export type DeployAccountOptions<W extends InteractionWaitOptions = undefined> = DeployAccountOptionsWithoutWait & {
59
+ /**
60
+ * Whether to wait for the transaction to be mined.
61
+ * - undefined (default): wait with default options and return TxReceipt
62
+ * - WaitOpts object: wait with custom options and return TxReceipt
63
+ * - false: return txHash immediately without waiting
64
+ */
65
+ wait?: W;
66
+ };
32
67
 
33
68
  /**
34
69
  * The configuration options for the simulate method. Omits the contractAddressSalt, since
@@ -47,6 +82,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
47
82
  artifact: ContractArtifact,
48
83
  postDeployCtor: (instance: ContractInstanceWithAddress, wallet: Wallet) => TContract,
49
84
  private salt: Fr,
85
+ private account: Account,
50
86
  args: any[] = [],
51
87
  constructorNameOrArtifact?: string | FunctionArtifact,
52
88
  ) {
@@ -61,19 +97,14 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
61
97
  * For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
62
98
  *
63
99
  * @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
100
+ * @param feeEntrypointOptions - Optional entrypoint-specific options for wrapping. If not provided, will be auto-computed based on the payment method.
64
101
  * @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
65
102
  */
66
- private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod) {
103
+ private getSelfFeePaymentMethod(originalPaymentMethod?: FeePaymentMethod, feeEntrypointOptions?: any) {
67
104
  if (!this.address) {
68
105
  throw new Error('Instance is not yet constructed. This is a bug!');
69
106
  }
70
- return new AccountEntrypointMetaPaymentMethod(
71
- this.wallet,
72
- this.artifact,
73
- 'entrypoint',
74
- this.address,
75
- originalPaymentMethod,
76
- );
107
+ return new AccountEntrypointMetaPaymentMethod(this.account, originalPaymentMethod, feeEntrypointOptions);
77
108
  }
78
109
 
79
110
  /**
@@ -97,7 +128,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
97
128
  const executionPayloads = [deploymentExecutionPayload];
98
129
  // If this is a self-deployment, manage the fee accordingly
99
130
  if (opts?.deployer?.equals(AztecAddress.ZERO)) {
100
- const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod);
131
+ const feePaymentMethod = this.getSelfFeePaymentMethod(opts?.fee?.paymentMethod, opts?.fee?.feeEntrypointOptions);
101
132
  const feeExecutionPayload = await feePaymentMethod.getExecutionPayload();
102
133
  // Notice they are reversed (fee payment usually goes first):
103
134
  // this is because we need to construct the contract BEFORE it can pay for its own fee
@@ -113,7 +144,7 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
113
144
  return mergeExecutionPayloads(executionPayloads);
114
145
  }
115
146
 
116
- override convertDeployOptionsToRequestOptions(options: DeployOptions): RequestDeployOptions {
147
+ override convertDeployOptionsToRequestOptions(options: DeployAccountOptionsWithoutWait): RequestDeployOptions {
117
148
  return {
118
149
  ...options,
119
150
  // Deployer is handled in the request method and forcibly set to undefined,
@@ -123,4 +154,34 @@ export class DeployAccountMethod<TContract extends ContractBase = Contract> exte
123
154
  deployer: options.from,
124
155
  };
125
156
  }
157
+
158
+ protected override convertDeployOptionsToSendOptions<W extends DeployInteractionWaitOptions>(
159
+ options: DeployOptions<W>,
160
+ // eslint-disable-next-line jsdoc/require-jsdoc
161
+ ): SendOptions<W extends { returnReceipt: true } ? WaitOpts : W> {
162
+ return super.convertDeployOptionsToSendOptions(this.injectContractAddressIntoScopes(options));
163
+ }
164
+
165
+ protected override convertDeployOptionsToSimulateOptions(options: SimulateDeployOptions): SimulateOptions {
166
+ return super.convertDeployOptionsToSimulateOptions(this.injectContractAddressIntoScopes(options));
167
+ }
168
+
169
+ protected override convertDeployOptionsToProfileOptions(
170
+ options: DeployOptionsWithoutWait & ProfileInteractionOptions,
171
+ ): ProfileOptions {
172
+ return super.convertDeployOptionsToProfileOptions(this.injectContractAddressIntoScopes(options));
173
+ }
174
+
175
+ /**
176
+ * Injects the contract's own address into scopes so the constructor can access its own keys.
177
+ * @param options - The deploy options to augment with the contract address.
178
+ */
179
+ // eslint-disable-next-line jsdoc/require-jsdoc
180
+ private injectContractAddressIntoScopes<T extends { additionalScopes?: AztecAddress[] }>(options: T): T {
181
+ if (!this.address) {
182
+ throw new Error('Instance not yet constructed. This is a bug!');
183
+ }
184
+ const existing = options.additionalScopes ?? [];
185
+ return { ...options, additionalScopes: [...existing, this.address] };
186
+ }
126
187
  }
@@ -1,2 +1,3 @@
1
1
  export * from './wallet.js';
2
2
  export * from './account_manager.js';
3
+ export * from './capabilities.js';