@aztec/aztec.js 0.81.0 → 0.82.0

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 (177) hide show
  1. package/dest/account/{contract.d.ts → account_contract.d.ts} +3 -2
  2. package/dest/account/account_contract.d.ts.map +1 -0
  3. package/dest/account/index.d.ts +2 -3
  4. package/dest/account/index.d.ts.map +1 -1
  5. package/dest/account/index.js +1 -2
  6. package/dest/account/interface.d.ts +1 -13
  7. package/dest/account/interface.d.ts.map +1 -1
  8. package/dest/account/interface.js +1 -0
  9. package/dest/account_manager/account_manager.d.ts +105 -0
  10. package/dest/account_manager/account_manager.d.ts.map +1 -0
  11. package/dest/account_manager/account_manager.js +165 -0
  12. package/dest/account_manager/deploy_account_method.d.ts +4 -4
  13. package/dest/account_manager/deploy_account_method.d.ts.map +1 -1
  14. package/dest/account_manager/deploy_account_method.js +28 -13
  15. package/dest/account_manager/deploy_account_sent_tx.d.ts +3 -3
  16. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
  17. package/dest/account_manager/deploy_account_sent_tx.js +2 -2
  18. package/dest/account_manager/index.d.ts +1 -104
  19. package/dest/account_manager/index.d.ts.map +1 -1
  20. package/dest/account_manager/index.js +1 -165
  21. package/dest/api/account.d.ts +2 -1
  22. package/dest/api/account.d.ts.map +1 -1
  23. package/dest/api/contract.d.ts +4 -1
  24. package/dest/api/contract.d.ts.map +1 -1
  25. package/dest/api/contract.js +3 -0
  26. package/dest/api/fee.d.ts +1 -1
  27. package/dest/api/fee.d.ts.map +1 -1
  28. package/dest/api/utils.d.ts +2 -1
  29. package/dest/api/utils.d.ts.map +1 -1
  30. package/dest/api/utils.js +2 -1
  31. package/dest/api/wallet.d.ts +1 -1
  32. package/dest/api/wallet.d.ts.map +1 -1
  33. package/dest/contract/base_contract_interaction.d.ts +22 -57
  34. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  35. package/dest/contract/base_contract_interaction.js +12 -67
  36. package/dest/contract/batch_call.d.ts +6 -18
  37. package/dest/contract/batch_call.d.ts.map +1 -1
  38. package/dest/contract/batch_call.js +25 -54
  39. package/dest/contract/contract.d.ts +1 -1
  40. package/dest/contract/contract.d.ts.map +1 -1
  41. package/dest/contract/contract_base.d.ts +1 -1
  42. package/dest/contract/contract_base.d.ts.map +1 -1
  43. package/dest/contract/contract_function_interaction.d.ts +38 -18
  44. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  45. package/dest/contract/contract_function_interaction.js +34 -41
  46. package/dest/contract/deploy_method.d.ts +7 -8
  47. package/dest/contract/deploy_method.d.ts.map +1 -1
  48. package/dest/contract/deploy_method.js +27 -32
  49. package/dest/contract/deploy_proven_tx.d.ts +2 -3
  50. package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
  51. package/dest/contract/deploy_sent_tx.d.ts +2 -3
  52. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  53. package/dest/contract/deploy_sent_tx.js +4 -4
  54. package/dest/contract/protocol_contracts.d.ts +1 -1
  55. package/dest/contract/protocol_contracts.d.ts.map +1 -1
  56. package/dest/contract/proven_tx.d.ts +3 -4
  57. package/dest/contract/proven_tx.d.ts.map +1 -1
  58. package/dest/contract/sent_tx.d.ts +4 -16
  59. package/dest/contract/sent_tx.d.ts.map +1 -1
  60. package/dest/contract/sent_tx.js +6 -37
  61. package/dest/contract/unsafe_contract.d.ts +1 -1
  62. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  63. package/dest/contract/wait_for_proven.d.ts +17 -0
  64. package/dest/contract/wait_for_proven.d.ts.map +1 -0
  65. package/dest/contract/wait_for_proven.js +17 -0
  66. package/dest/deployment/broadcast_function.js +12 -8
  67. package/dest/deployment/contract_deployer.d.ts +1 -1
  68. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  69. package/dest/deployment/register_class.d.ts +1 -1
  70. package/dest/deployment/register_class.d.ts.map +1 -1
  71. package/dest/deployment/register_class.js +6 -11
  72. package/dest/entrypoint/default_multi_call_entrypoint.d.ts +3 -2
  73. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +1 -1
  74. package/dest/entrypoint/default_multi_call_entrypoint.js +12 -8
  75. package/dest/ethereum/portal_manager.d.ts +20 -11
  76. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  77. package/dest/ethereum/portal_manager.js +64 -30
  78. package/dest/fee/fee_juice_payment_method.d.ts +3 -3
  79. package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
  80. package/dest/fee/fee_juice_payment_method.js +3 -2
  81. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +4 -4
  82. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  83. package/dest/fee/fee_juice_payment_method_with_claim.js +6 -5
  84. package/dest/fee/private_fee_payment_method.d.ts +6 -6
  85. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  86. package/dest/fee/private_fee_payment_method.js +13 -12
  87. package/dest/fee/public_fee_payment_method.d.ts +7 -7
  88. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  89. package/dest/fee/public_fee_payment_method.js +10 -11
  90. package/dest/fee/utils.d.ts +13 -0
  91. package/dest/fee/utils.d.ts.map +1 -0
  92. package/dest/fee/utils.js +32 -0
  93. package/dest/utils/authwit.d.ts +16 -9
  94. package/dest/utils/authwit.d.ts.map +1 -1
  95. package/dest/utils/authwit.js +26 -35
  96. package/dest/wallet/account_wallet.d.ts +6 -6
  97. package/dest/wallet/account_wallet.d.ts.map +1 -1
  98. package/dest/wallet/account_wallet.js +15 -17
  99. package/dest/wallet/base_wallet.d.ts +12 -35
  100. package/dest/wallet/base_wallet.d.ts.map +1 -1
  101. package/dest/wallet/base_wallet.js +11 -64
  102. package/dest/wallet/index.d.ts +2 -2
  103. package/dest/wallet/index.d.ts.map +1 -1
  104. package/dest/wallet/index.js +1 -1
  105. package/dest/wallet/signerless_wallet.d.ts +3 -3
  106. package/dest/wallet/signerless_wallet.d.ts.map +1 -1
  107. package/dest/wallet/signerless_wallet.js +3 -6
  108. package/dest/wallet/wallet.d.ts +11 -0
  109. package/dest/wallet/wallet.d.ts.map +1 -0
  110. package/package.json +8 -7
  111. package/src/account/{contract.ts → account_contract.ts} +2 -1
  112. package/src/account/index.ts +2 -3
  113. package/src/account/interface.ts +1 -12
  114. package/src/account_manager/account_manager.ts +235 -0
  115. package/src/account_manager/deploy_account_method.ts +35 -15
  116. package/src/account_manager/deploy_account_sent_tx.ts +4 -4
  117. package/src/account_manager/index.ts +1 -236
  118. package/src/api/account.ts +2 -8
  119. package/src/api/contract.ts +5 -5
  120. package/src/api/fee.ts +1 -1
  121. package/src/api/utils.ts +1 -1
  122. package/src/api/wallet.ts +7 -1
  123. package/src/contract/base_contract_interaction.ts +32 -88
  124. package/src/contract/batch_call.ts +40 -43
  125. package/src/contract/contract.ts +1 -1
  126. package/src/contract/contract_base.ts +1 -1
  127. package/src/contract/contract_function_interaction.ts +85 -56
  128. package/src/contract/deploy_method.ts +24 -26
  129. package/src/contract/deploy_proven_tx.ts +2 -3
  130. package/src/contract/deploy_sent_tx.ts +6 -6
  131. package/src/contract/protocol_contracts.ts +1 -1
  132. package/src/contract/proven_tx.ts +2 -3
  133. package/src/contract/sent_tx.ts +6 -47
  134. package/src/contract/unsafe_contract.ts +1 -1
  135. package/src/contract/wait_for_proven.ts +38 -0
  136. package/src/deployment/broadcast_function.ts +40 -40
  137. package/src/deployment/contract_deployer.ts +1 -1
  138. package/src/deployment/register_class.ts +9 -22
  139. package/src/entrypoint/default_multi_call_entrypoint.ts +14 -7
  140. package/src/ethereum/portal_manager.ts +73 -24
  141. package/src/fee/fee_juice_payment_method.ts +4 -5
  142. package/src/fee/fee_juice_payment_method_with_claim.ts +24 -20
  143. package/src/fee/private_fee_payment_method.ts +29 -28
  144. package/src/fee/public_fee_payment_method.ts +29 -29
  145. package/src/fee/utils.ts +39 -0
  146. package/src/utils/authwit.ts +32 -35
  147. package/src/wallet/account_wallet.ts +18 -17
  148. package/src/wallet/base_wallet.ts +27 -88
  149. package/src/wallet/index.ts +2 -2
  150. package/src/wallet/signerless_wallet.ts +9 -8
  151. package/src/wallet/wallet.ts +34 -0
  152. package/dest/account/contract.d.ts.map +0 -1
  153. package/dest/account/wallet.d.ts +0 -11
  154. package/dest/account/wallet.d.ts.map +0 -1
  155. package/dest/api/entrypoint.d.ts +0 -2
  156. package/dest/api/entrypoint.d.ts.map +0 -1
  157. package/dest/api/entrypoint.js +0 -1
  158. package/dest/entrypoint/default_entrypoint.d.ts +0 -12
  159. package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
  160. package/dest/entrypoint/default_entrypoint.js +0 -28
  161. package/dest/entrypoint/entrypoint.d.ts +0 -39
  162. package/dest/entrypoint/entrypoint.d.ts.map +0 -1
  163. package/dest/entrypoint/entrypoint.js +0 -20
  164. package/dest/entrypoint/payload.d.ts +0 -128
  165. package/dest/entrypoint/payload.d.ts.map +0 -1
  166. package/dest/entrypoint/payload.js +0 -143
  167. package/dest/fee/fee_payment_method.d.ts +0 -22
  168. package/dest/fee/fee_payment_method.d.ts.map +0 -1
  169. package/dest/fee/fee_payment_method.js +0 -3
  170. package/src/account/wallet.ts +0 -13
  171. package/src/api/entrypoint.ts +0 -1
  172. package/src/entrypoint/default_entrypoint.ts +0 -39
  173. package/src/entrypoint/entrypoint.ts +0 -60
  174. package/src/entrypoint/payload.ts +0 -238
  175. package/src/fee/fee_payment_method.ts +0 -22
  176. /package/dest/account/{contract.js → account_contract.js} +0 -0
  177. /package/dest/{account → wallet}/wallet.js +0 -0
@@ -1,7 +1,8 @@
1
+ import type { AuthWitnessProvider } from '@aztec/entrypoints/interfaces';
1
2
  import { Fr } from '@aztec/foundation/fields';
2
3
  import type { ContractArtifact } from '@aztec/stdlib/abi';
3
4
  import type { CompleteAddress, NodeInfo } from '@aztec/stdlib/contract';
4
- import type { AccountInterface, AuthWitnessProvider } from './interface.js';
5
+ import type { AccountInterface } from './interface.js';
5
6
  /**
6
7
  * An account contract instance. Knows its artifact, deployment arguments, how to create
7
8
  * transaction execution requests out of function calls, and how to authorize actions.
@@ -39,4 +40,4 @@ export interface AccountContract {
39
40
  * Compute the address of an account contract from secret and salt.
40
41
  */
41
42
  export declare function getAccountContractAddress(accountContract: AccountContract, secret: Fr, salt: Fr): Promise<import("../index.js").AztecAddress>;
42
- //# sourceMappingURL=contract.d.ts.map
43
+ //# sourceMappingURL=account_contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account_contract.d.ts","sourceRoot":"","sources":["../../src/account/account_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEjD;;OAEG;IACH,4BAA4B,IAAI,OAAO,CACnC;QACE,2DAA2D;QAC3D,eAAe,EAAE,MAAM,CAAC;QACxB,2DAA2D;QAC3D,eAAe,EAAE,GAAG,EAAE,CAAC;KACxB,GACD,SAAS,CACZ,CAAC;IAEF;;;;;;;OAOG;IACH,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IAE7E;;;OAGG;IACH,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,mBAAmB,CAAC;CACvE;AAGD;;GAEG;AACH,wBAAsB,yBAAyB,CAAC,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,+CAcrG"}
@@ -7,9 +7,8 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  import type { Fr } from '@aztec/foundation/fields';
10
- export { type AccountContract, getAccountContractAddress } from './contract.js';
11
- export { type AccountInterface, type AuthWitnessProvider } from './interface.js';
12
- export * from './wallet.js';
10
+ export { type AccountContract, getAccountContractAddress } from './account_contract.js';
11
+ export { type AccountInterface } from './interface.js';
13
12
  /** A contract deployment salt. */
14
13
  export type Salt = Fr | number | bigint;
15
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,eAAe,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACjF,cAAc,aAAa,CAAC;AAE5B,kCAAkC;AAClC,MAAM,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,eAAe,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,kCAAkC;AAClC,MAAM,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -5,5 +5,4 @@
5
5
  * on ECDSA or Schnorr signatures.
6
6
  *
7
7
  * @packageDocumentation
8
- */ export { getAccountContractAddress } from './contract.js';
9
- export * from './wallet.js';
8
+ */ export { getAccountContractAddress } from './account_contract.js';
@@ -1,19 +1,7 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
1
+ import type { AuthWitnessProvider, EntrypointInterface } from '@aztec/entrypoints/interfaces';
3
2
  import type { Fr } from '@aztec/foundation/fields';
4
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
5
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
4
  import type { CompleteAddress } from '@aztec/stdlib/contract';
7
- import type { EntrypointInterface } from '../entrypoint/entrypoint.js';
8
- /** Creates authorization witnesses. */
9
- export interface AuthWitnessProvider {
10
- /**
11
- * Computes an authentication witness from either a message hash
12
- * @param messageHash - The message hash to approve
13
- * @returns The authentication witness
14
- */
15
- createAuthWit(messageHash: Fr | Buffer): Promise<AuthWitness>;
16
- }
17
5
  /**
18
6
  * Handler for interfacing with an account. Knows how to create transaction execution
19
7
  * requests and authorize actions for its corresponding account.
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/account/interface.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,uCAAuC;AACvC,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,aAAa,CAAC,WAAW,EAAE,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/D;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB,EAAE,mBAAmB;IAChF,qDAAqD;IACrD,kBAAkB,IAAI,eAAe,CAAC;IAEtC,4CAA4C;IAC5C,UAAU,IAAI,YAAY,CAAC;IAE3B,4CAA4C;IAC5C,UAAU,IAAI,EAAE,CAAC;IAEjB,kDAAkD;IAClD,UAAU,IAAI,EAAE,CAAC;CAClB"}
1
+ {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/account/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB,EAAE,mBAAmB;IAChF,qDAAqD;IACrD,kBAAkB,IAAI,eAAe,CAAC;IAEtC,4CAA4C;IAC5C,UAAU,IAAI,YAAY,CAAC;IAE3B,4CAA4C;IAC5C,UAAU,IAAI,EAAE,CAAC;IAEjB,kDAAkD;IAClD,UAAU,IAAI,EAAE,CAAC;CAClB"}
@@ -1,3 +1,4 @@
1
+ // docs:start:account-interface
1
2
  /**
2
3
  * Handler for interfacing with an account. Knows how to create transaction execution
3
4
  * requests and authorize actions for its corresponding account.
@@ -0,0 +1,105 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { CompleteAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
+ import type { PXE } from '@aztec/stdlib/interfaces/client';
4
+ import type { AccountContract } from '../account/account_contract.js';
5
+ import type { Salt } from '../account/index.js';
6
+ import type { AccountInterface } from '../account/interface.js';
7
+ import { Contract } from '../contract/contract.js';
8
+ import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
9
+ import { type WaitOpts } from '../contract/sent_tx.js';
10
+ import { AccountWalletWithSecretKey, type Wallet } from '../wallet/index.js';
11
+ import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
12
+ /**
13
+ * Options to deploy an account contract.
14
+ */
15
+ export type DeployAccountOptions = Pick<DeployOptions, 'fee' | 'skipClassRegistration' | 'skipPublicDeployment' | 'skipInitialization'> & {
16
+ /**
17
+ * Wallet used for deploying the account contract. Must be funded in order to pay for the fee.
18
+ */
19
+ deployWallet?: Wallet;
20
+ };
21
+ /**
22
+ * Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
23
+ * and creating and registering the user wallet in the PXE Service.
24
+ */
25
+ export declare class AccountManager {
26
+ private pxe;
27
+ private secretKey;
28
+ private accountContract;
29
+ private instance;
30
+ /**
31
+ * Deployment salt for the account contract
32
+ */
33
+ readonly salt: Salt;
34
+ private constructor();
35
+ static create(pxe: PXE, secretKey: Fr, accountContract: AccountContract, salt?: Salt): Promise<AccountManager>;
36
+ protected getPublicKeys(): import("@aztec/stdlib/keys").PublicKeys;
37
+ protected getPublicKeysHash(): Fr | Promise<Fr>;
38
+ /**
39
+ * Returns the entrypoint for this account as defined by its account contract.
40
+ * @returns An entrypoint.
41
+ */
42
+ getAccount(): Promise<AccountInterface>;
43
+ /**
44
+ * Gets the calculated complete address associated with this account.
45
+ * Does not require the account to be deployed or registered.
46
+ * @returns The address, partial address, and encryption public key.
47
+ */
48
+ getCompleteAddress(): Promise<CompleteAddress>;
49
+ /**
50
+ * Gets the address for this given account.
51
+ * Does not require the account to be deployed or registered.
52
+ * @returns The address.
53
+ */
54
+ getAddress(): import("../index.js").AztecAddress;
55
+ /**
56
+ * Returns the contract instance definition associated with this account.
57
+ * Does not require the account to be deployed or registered.
58
+ * @returns ContractInstance instance.
59
+ */
60
+ getInstance(): ContractInstanceWithAddress;
61
+ /**
62
+ * Returns a Wallet instance associated with this account. Use it to create Contract
63
+ * instances to be interacted with from this account.
64
+ * @returns A Wallet instance.
65
+ */
66
+ getWallet(): Promise<AccountWalletWithSecretKey>;
67
+ /**
68
+ * Registers this account in the PXE Service and returns the associated wallet. Registering
69
+ * the account on the PXE Service is required for managing private state associated with it.
70
+ * Use the returned wallet to create Contract instances to be interacted with from this account.
71
+ * @param opts - Options to wait for the account to be synched.
72
+ * @returns A Wallet instance.
73
+ */
74
+ register(): Promise<AccountWalletWithSecretKey>;
75
+ /**
76
+ * Returns the pre-populated deployment method to deploy the account contract that backs this account.
77
+ * Typically you will not need this method and can call `deploy` directly. Use this for having finer
78
+ * grained control on when to create, simulate, and send the deployment tx.
79
+ * @param deployWallet - Wallet used for deploying the account contract.
80
+ * @returns A DeployMethod instance that deploys this account contract.
81
+ */
82
+ getDeployMethod(deployWallet?: Wallet): Promise<DeployMethod<Contract>>;
83
+ /**
84
+ * Deploys the account contract that backs this account.
85
+ * Does not register the associated class nor publicly deploy the instance by default.
86
+ * Uses the salt provided in the constructor or a randomly generated one.
87
+ * Registers the account in the PXE Service before deploying the contract.
88
+ * @param opts - Fee options to be used for the deployment.
89
+ * @returns A SentTx object that can be waited to get the associated Wallet.
90
+ */
91
+ deploy(opts?: DeployAccountOptions): DeployAccountSentTx;
92
+ /**
93
+ * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
94
+ * Uses the salt provided in the constructor or a randomly generated one. If no initialization
95
+ * is required it skips the transaction, and only registers the account in the PXE Service.
96
+ * @param opts - Options to wait for the tx to be mined.
97
+ * @returns A Wallet instance.
98
+ */
99
+ waitSetup(opts?: DeployAccountOptions & WaitOpts): Promise<AccountWalletWithSecretKey>;
100
+ /**
101
+ * Returns whether this account contract has a constructor and needs deployment.
102
+ */
103
+ isDeployable(): Promise<boolean>;
104
+ }
105
+ //# sourceMappingURL=account_manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account_manager.d.ts","sourceRoot":"","sources":["../../src/account_manager/account_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,KAAK,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE3F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,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G;IACU,SAAS,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAK7D;;;;;;OAMG;IACU,QAAQ,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAW5D;;;;;;OAMG;IACU,eAAe,CAAC,YAAY,CAAC,EAAE,MAAM;IA8ClD;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,mBAAmB;IAgB/D;;;;;;OAMG;IACU,SAAS,CAAC,IAAI,GAAE,oBAAoB,GAAG,QAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAKpH;;OAEG;IACU,YAAY;CAG1B"}
@@ -0,0 +1,165 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { CompleteAddress } from '@aztec/stdlib/contract';
3
+ import { getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
4
+ import { deriveKeys } from '@aztec/stdlib/keys';
5
+ import { Contract } from '../contract/contract.js';
6
+ import { DeployMethod } from '../contract/deploy_method.js';
7
+ import { DefaultWaitOpts } from '../contract/sent_tx.js';
8
+ import { DefaultMultiCallEntrypoint } from '../entrypoint/default_multi_call_entrypoint.js';
9
+ import { AccountWalletWithSecretKey, SignerlessWallet } from '../wallet/index.js';
10
+ import { DeployAccountMethod } from './deploy_account_method.js';
11
+ import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
12
+ /**
13
+ * Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
14
+ * and creating and registering the user wallet in the PXE Service.
15
+ */ export class AccountManager {
16
+ pxe;
17
+ secretKey;
18
+ accountContract;
19
+ instance;
20
+ salt;
21
+ constructor(pxe, secretKey, accountContract, instance, /**
22
+ * Deployment salt for the account contract
23
+ */ salt){
24
+ this.pxe = pxe;
25
+ this.secretKey = secretKey;
26
+ this.accountContract = accountContract;
27
+ this.instance = instance;
28
+ this.salt = salt;
29
+ }
30
+ static async create(pxe, secretKey, accountContract, salt) {
31
+ const { publicKeys } = await deriveKeys(secretKey);
32
+ salt = salt !== undefined ? new Fr(salt) : Fr.random();
33
+ const { constructorName, constructorArgs } = await accountContract.getDeploymentFunctionAndArgs() ?? {
34
+ constructorName: undefined,
35
+ constructorArgs: undefined
36
+ };
37
+ const artifact = await accountContract.getContractArtifact();
38
+ const instance = await getContractInstanceFromDeployParams(artifact, {
39
+ constructorArtifact: constructorName,
40
+ constructorArgs,
41
+ salt: salt,
42
+ publicKeys
43
+ });
44
+ return new AccountManager(pxe, secretKey, accountContract, instance, salt);
45
+ }
46
+ getPublicKeys() {
47
+ return this.instance.publicKeys;
48
+ }
49
+ getPublicKeysHash() {
50
+ return this.getPublicKeys().hash();
51
+ }
52
+ /**
53
+ * Returns the entrypoint for this account as defined by its account contract.
54
+ * @returns An entrypoint.
55
+ */ async getAccount() {
56
+ const nodeInfo = await this.pxe.getNodeInfo();
57
+ const completeAddress = await this.getCompleteAddress();
58
+ return this.accountContract.getInterface(completeAddress, nodeInfo);
59
+ }
60
+ /**
61
+ * Gets the calculated complete address associated with this account.
62
+ * Does not require the account to be deployed or registered.
63
+ * @returns The address, partial address, and encryption public key.
64
+ */ getCompleteAddress() {
65
+ return CompleteAddress.fromSecretKeyAndInstance(this.secretKey, this.instance);
66
+ }
67
+ /**
68
+ * Gets the address for this given account.
69
+ * Does not require the account to be deployed or registered.
70
+ * @returns The address.
71
+ */ getAddress() {
72
+ return this.instance.address;
73
+ }
74
+ /**
75
+ * Returns the contract instance definition associated with this account.
76
+ * Does not require the account to be deployed or registered.
77
+ * @returns ContractInstance instance.
78
+ */ getInstance() {
79
+ return this.instance;
80
+ }
81
+ /**
82
+ * Returns a Wallet instance associated with this account. Use it to create Contract
83
+ * instances to be interacted with from this account.
84
+ * @returns A Wallet instance.
85
+ */ async getWallet() {
86
+ const entrypoint = await this.getAccount();
87
+ return new AccountWalletWithSecretKey(this.pxe, entrypoint, this.secretKey, this.salt);
88
+ }
89
+ /**
90
+ * Registers this account in the PXE Service and returns the associated wallet. Registering
91
+ * the account on the PXE Service is required for managing private state associated with it.
92
+ * Use the returned wallet to create Contract instances to be interacted with from this account.
93
+ * @param opts - Options to wait for the account to be synched.
94
+ * @returns A Wallet instance.
95
+ */ async register() {
96
+ await this.pxe.registerContract({
97
+ artifact: await this.accountContract.getContractArtifact(),
98
+ instance: this.getInstance()
99
+ });
100
+ await this.pxe.registerAccount(this.secretKey, (await this.getCompleteAddress()).partialAddress);
101
+ return this.getWallet();
102
+ }
103
+ /**
104
+ * Returns the pre-populated deployment method to deploy the account contract that backs this account.
105
+ * Typically you will not need this method and can call `deploy` directly. Use this for having finer
106
+ * grained control on when to create, simulate, and send the deployment tx.
107
+ * @param deployWallet - Wallet used for deploying the account contract.
108
+ * @returns A DeployMethod instance that deploys this account contract.
109
+ */ async getDeployMethod(deployWallet) {
110
+ const artifact = await this.accountContract.getContractArtifact();
111
+ if (!await this.isDeployable()) {
112
+ throw new Error(`Account contract ${artifact.name} does not require deployment.`);
113
+ }
114
+ const completeAddress = await this.getCompleteAddress();
115
+ await this.pxe.registerAccount(this.secretKey, completeAddress.partialAddress);
116
+ const { constructorName, constructorArgs } = await this.accountContract.getDeploymentFunctionAndArgs() ?? {
117
+ constructorName: undefined,
118
+ constructorArgs: undefined
119
+ };
120
+ if (deployWallet) {
121
+ // If deploying using an existing wallet/account, treat it like regular contract deployment.
122
+ const thisWallet = await this.getWallet();
123
+ return new DeployMethod(this.getPublicKeys(), deployWallet, artifact, (address)=>Contract.at(address, artifact, thisWallet), constructorArgs, constructorName);
124
+ }
125
+ const { l1ChainId: chainId, protocolVersion } = await this.pxe.getNodeInfo();
126
+ // We use a signerless wallet with the multi call entrypoint in order to make multiple calls in one go.
127
+ // If we used getWallet, the deployment would get routed via the account contract entrypoint
128
+ // and it can't be used unless the contract is initialized.
129
+ const wallet = new SignerlessWallet(this.pxe, new DefaultMultiCallEntrypoint(chainId, protocolVersion));
130
+ return new DeployAccountMethod(this.accountContract.getAuthWitnessProvider(completeAddress), this.getPublicKeys(), wallet, artifact, constructorArgs, constructorName, 'entrypoint');
131
+ }
132
+ /**
133
+ * Deploys the account contract that backs this account.
134
+ * Does not register the associated class nor publicly deploy the instance by default.
135
+ * Uses the salt provided in the constructor or a randomly generated one.
136
+ * Registers the account in the PXE Service before deploying the contract.
137
+ * @param opts - Fee options to be used for the deployment.
138
+ * @returns A SentTx object that can be waited to get the associated Wallet.
139
+ */ deploy(opts) {
140
+ const sentTx = this.getDeployMethod(opts?.deployWallet).then((deployMethod)=>deployMethod.send({
141
+ contractAddressSalt: new Fr(this.salt),
142
+ skipClassRegistration: opts?.skipClassRegistration ?? true,
143
+ skipPublicDeployment: opts?.skipPublicDeployment ?? true,
144
+ skipInitialization: opts?.skipInitialization ?? false,
145
+ universalDeploy: true,
146
+ fee: opts?.fee
147
+ })).then((tx)=>tx.getTxHash());
148
+ return new DeployAccountSentTx(this.pxe, sentTx, this.getWallet());
149
+ }
150
+ /**
151
+ * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
152
+ * Uses the salt provided in the constructor or a randomly generated one. If no initialization
153
+ * is required it skips the transaction, and only registers the account in the PXE Service.
154
+ * @param opts - Options to wait for the tx to be mined.
155
+ * @returns A Wallet instance.
156
+ */ async waitSetup(opts = DefaultWaitOpts) {
157
+ await (await this.isDeployable() ? this.deploy(opts).wait(opts) : this.register());
158
+ return this.getWallet();
159
+ }
160
+ /**
161
+ * Returns whether this account contract has a constructor and needs deployment.
162
+ */ async isDeployable() {
163
+ return await this.accountContract.getDeploymentFunctionAndArgs() !== undefined;
164
+ }
165
+ }
@@ -1,15 +1,15 @@
1
+ import type { AuthWitnessProvider } from '@aztec/entrypoints/interfaces';
2
+ import { ExecutionPayload } from '@aztec/entrypoints/payload';
1
3
  import { type ContractArtifact, type FunctionArtifact } from '@aztec/stdlib/abi';
2
4
  import type { PublicKeys } from '@aztec/stdlib/keys';
3
- import type { AuthWitnessProvider } from '../account/interface.js';
4
- import type { Wallet } from '../account/wallet.js';
5
- import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
6
5
  import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
6
+ import type { Wallet } from '../wallet/wallet.js';
7
7
  /**
8
8
  * Contract interaction for deploying an account contract. Handles fee preparation and contract initialization.
9
9
  */
10
10
  export declare class DeployAccountMethod extends DeployMethod {
11
11
  #private;
12
12
  constructor(authWitnessProvider: AuthWitnessProvider, publicKeys: PublicKeys, wallet: Wallet, artifact: ContractArtifact, args?: any[], constructorNameOrArtifact?: string | FunctionArtifact, feePaymentNameOrArtifact?: string | FunctionArtifact);
13
- protected getInitializeFunctionCalls(options: DeployOptions): Promise<ContractFunctionInteraction[]>;
13
+ protected getInitializeExecutionPayload(options: DeployOptions): Promise<ExecutionPayload>;
14
14
  }
15
15
  //# sourceMappingURL=deploy_account_method.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_account_method.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAA6B,MAAM,mBAAmB,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGhF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;;gBAKjD,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,GAAE,GAAG,EAAO,EAChB,yBAAyB,CAAC,EAAE,MAAM,GAAG,gBAAgB,EACrD,wBAAwB,CAAC,EAAE,MAAM,GAAG,gBAAgB;cAkB7B,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,2BAA2B,EAAE,CAAC;CAwBpH"}
1
+ {"version":3,"file":"deploy_account_method.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_method.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAA0B,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAA6B,MAAM,mBAAmB,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;;gBAKjD,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,GAAE,GAAG,EAAO,EAChB,yBAAyB,CAAC,EAAE,MAAM,GAAG,gBAAgB,EACrD,wBAAwB,CAAC,EAAE,MAAM,GAAG,gBAAgB;cAkB7B,6BAA6B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAuC1G"}
@@ -1,8 +1,9 @@
1
+ import { EncodedAppEntrypointCalls, EncodedCallsForEntrypoint, computeCombinedPayloadHash } from '@aztec/entrypoints/encoding';
2
+ import { mergeExecutionPayloads } from '@aztec/entrypoints/payload';
1
3
  import { getFunctionArtifactByName } from '@aztec/stdlib/abi';
2
4
  import { Contract } from '../contract/contract.js';
3
5
  import { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
4
6
  import { DeployMethod } from '../contract/deploy_method.js';
5
- import { EntrypointPayload, computeCombinedPayloadHash } from '../entrypoint/payload.js';
6
7
  /**
7
8
  * Contract interaction for deploying an account contract. Handles fee preparation and contract initialization.
8
9
  */ export class DeployAccountMethod extends DeployMethod {
@@ -13,24 +14,38 @@ import { EntrypointPayload, computeCombinedPayloadHash } from '../entrypoint/pay
13
14
  this.#authWitnessProvider = authWitnessProvider;
14
15
  this.#feePaymentArtifact = typeof feePaymentNameOrArtifact === 'string' ? getFunctionArtifactByName(artifact, feePaymentNameOrArtifact) : feePaymentNameOrArtifact;
15
16
  }
16
- async getInitializeFunctionCalls(options) {
17
- const calls = await super.getInitializeFunctionCalls(options);
17
+ async getInitializeExecutionPayload(options) {
18
+ let exec = await super.getInitializeExecutionPayload(options);
18
19
  if (options.fee && this.#feePaymentArtifact) {
19
20
  const { address } = await this.getInstance();
20
- const emptyAppPayload = await EntrypointPayload.fromAppExecution([]);
21
+ const emptyAppCalls = await EncodedAppEntrypointCalls.fromAppExecution([]);
21
22
  const fee = await this.getDefaultFeeOptions(options.fee);
22
- const feePayload = await EntrypointPayload.fromFeeOptions(address, fee);
23
+ // Get the execution payload for the fee, it includes the calls and potentially authWitnesses
24
+ const { calls: feeCalls, authWitnesses: feeAuthwitnesses } = await fee.paymentMethod.getExecutionPayload(fee.gasSettings);
25
+ // Encode the calls for the fee
26
+ const feePayer = await fee.paymentMethod.getFeePayer(fee.gasSettings);
27
+ const isFeePayer = feePayer.equals(address);
28
+ const feeEncodedCalls = await EncodedCallsForEntrypoint.fromFeeCalls(feeCalls, isFeePayer);
29
+ // Get the entrypoint args
23
30
  const args = [
24
- emptyAppPayload,
25
- feePayload,
31
+ emptyAppCalls,
32
+ feeEncodedCalls,
26
33
  false
27
34
  ];
28
- const call = new ContractFunctionInteraction(this.wallet, address, this.#feePaymentArtifact, args);
29
- call.addAuthWitness(await this.#authWitnessProvider.createAuthWit(await computeCombinedPayloadHash(emptyAppPayload, feePayload)));
30
- call.addHashedArguments(emptyAppPayload.hashedArguments);
31
- call.addHashedArguments(feePayload.hashedArguments);
32
- calls.push(call);
35
+ // Compute the authwitness required to verify the combined payload
36
+ const combinedPayloadAuthWitness = await this.#authWitnessProvider.createAuthWit(await computeCombinedPayloadHash(emptyAppCalls, feeEncodedCalls));
37
+ const call = new ContractFunctionInteraction(this.wallet, address, this.#feePaymentArtifact, args, [
38
+ combinedPayloadAuthWitness,
39
+ ...feeAuthwitnesses
40
+ ], [], [
41
+ ...emptyAppCalls.hashedArguments,
42
+ ...feeEncodedCalls.hashedArguments
43
+ ]);
44
+ exec = mergeExecutionPayloads([
45
+ exec,
46
+ await call.request()
47
+ ]);
33
48
  }
34
- return calls;
49
+ return exec;
35
50
  }
36
51
  }
@@ -1,8 +1,8 @@
1
1
  import type { FieldsOf } from '@aztec/foundation/types';
2
- import type { PXE } from '@aztec/stdlib/interfaces/client';
2
+ import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
3
3
  import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
4
- import type { Wallet } from '../account/index.js';
5
4
  import { SentTx, type WaitOpts } from '../contract/sent_tx.js';
5
+ import type { Wallet } from '../wallet/wallet.js';
6
6
  /** Extends a transaction receipt with a wallet instance for the newly deployed contract. */
7
7
  export type DeployAccountTxReceipt = FieldsOf<TxReceipt> & {
8
8
  /** Wallet that corresponds to the newly deployed account contract. */
@@ -13,7 +13,7 @@ export type DeployAccountTxReceipt = FieldsOf<TxReceipt> & {
13
13
  */
14
14
  export declare class DeployAccountSentTx extends SentTx {
15
15
  private getWalletPromise;
16
- constructor(pxe: PXE, txHashPromise: Promise<TxHash>, getWalletPromise: Promise<Wallet>);
16
+ constructor(pxeOrNode: AztecNode | PXE, txHashPromise: Promise<TxHash>, getWalletPromise: Promise<Wallet>);
17
17
  /**
18
18
  * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
19
19
  * @param opts - Options for configuring the waiting for the tx to be mined.
@@ -1 +1 @@
1
- {"version":3,"file":"deploy_account_sent_tx.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_sent_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAmB,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEhF,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG;IACzD,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM;IACS,OAAO,CAAC,gBAAgB;gBAAlE,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,EAAU,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC;IAI/F;;;;OAIG;IACU,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAKxD;;;;OAIG;IACmB,IAAI,CAAC,IAAI,GAAE,QAA0B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAK9F"}
1
+ {"version":3,"file":"deploy_account_sent_tx.d.ts","sourceRoot":"","sources":["../../src/account_manager/deploy_account_sent_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAmB,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,4FAA4F;AAC5F,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG;IACzD,sEAAsE;IACtE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,MAAM;IAC2B,OAAO,CAAC,gBAAgB;gBAApF,SAAS,EAAE,SAAS,GAAG,GAAG,EAAE,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,EAAU,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC;IAIjH;;;;OAIG;IACU,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAKxD;;;;OAIG;IACmB,IAAI,CAAC,IAAI,GAAE,QAA0B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAK9F"}
@@ -3,8 +3,8 @@ import { DefaultWaitOpts, SentTx } from '../contract/sent_tx.js';
3
3
  * A deployment transaction for an account contract sent to the network, extending SentTx with methods to get the resulting wallet.
4
4
  */ export class DeployAccountSentTx extends SentTx {
5
5
  getWalletPromise;
6
- constructor(pxe, txHashPromise, getWalletPromise){
7
- super(pxe, txHashPromise), this.getWalletPromise = getWalletPromise;
6
+ constructor(pxeOrNode, txHashPromise, getWalletPromise){
7
+ super(pxeOrNode, txHashPromise), this.getWalletPromise = getWalletPromise;
8
8
  }
9
9
  /**
10
10
  * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
@@ -1,107 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
2
- import { CompleteAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { PXE } from '@aztec/stdlib/interfaces/client';
4
- import type { AccountContract } from '../account/contract.js';
5
- import type { Salt, Wallet } from '../account/index.js';
6
- import type { AccountInterface } from '../account/interface.js';
7
- import { Contract } from '../contract/contract.js';
8
- import { DeployMethod, type DeployOptions } from '../contract/deploy_method.js';
9
- import { type WaitOpts } from '../contract/sent_tx.js';
10
- import { AccountWalletWithSecretKey } from '../wallet/index.js';
11
- import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
12
- /**
13
- * Options to deploy an account contract.
14
- */
15
- export type DeployAccountOptions = Pick<DeployOptions, 'fee' | 'skipClassRegistration' | 'skipPublicDeployment' | 'skipInitialization'> & {
16
- /**
17
- * Wallet used for deploying the account contract. Must be funded in order to pay for the fee.
18
- */
19
- deployWallet?: Wallet;
20
- };
21
- /**
22
- * Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
23
- * and creating and registering the user wallet in the PXE Service.
24
- */
25
- export declare class AccountManager {
26
- private pxe;
27
- private secretKey;
28
- private accountContract;
29
- private instance;
30
- /**
31
- * Deployment salt for the account contract
32
- */
33
- readonly salt: Salt;
34
- private constructor();
35
- static create(pxe: PXE, secretKey: Fr, accountContract: AccountContract, salt?: Salt): Promise<AccountManager>;
36
- protected getPublicKeys(): import("@aztec/stdlib/keys").PublicKeys;
37
- protected getPublicKeysHash(): Fr | Promise<Fr>;
38
- /**
39
- * Returns the entrypoint for this account as defined by its account contract.
40
- * @returns An entrypoint.
41
- */
42
- getAccount(): Promise<AccountInterface>;
43
- /**
44
- * Gets the calculated complete address associated with this account.
45
- * Does not require the account to be deployed or registered.
46
- * @returns The address, partial address, and encryption public key.
47
- */
48
- getCompleteAddress(): Promise<CompleteAddress>;
49
- /**
50
- * Gets the address for this given account.
51
- * Does not require the account to be deployed or registered.
52
- * @returns The address.
53
- */
54
- getAddress(): import("../index.js").AztecAddress;
55
- /**
56
- * Returns the contract instance definition associated with this account.
57
- * Does not require the account to be deployed or registered.
58
- * @returns ContractInstance instance.
59
- */
60
- getInstance(): ContractInstanceWithAddress;
61
- /**
62
- * Returns a Wallet instance associated with this account. Use it to create Contract
63
- * instances to be interacted with from this account.
64
- * @returns A Wallet instance.
65
- */
66
- getWallet(): Promise<AccountWalletWithSecretKey>;
67
- /**
68
- * Registers this account in the PXE Service and returns the associated wallet. Registering
69
- * the account on the PXE Service is required for managing private state associated with it.
70
- * Use the returned wallet to create Contract instances to be interacted with from this account.
71
- * @param opts - Options to wait for the account to be synched.
72
- * @returns A Wallet instance.
73
- */
74
- register(): Promise<AccountWalletWithSecretKey>;
75
- /**
76
- * Returns the pre-populated deployment method to deploy the account contract that backs this account.
77
- * Typically you will not need this method and can call `deploy` directly. Use this for having finer
78
- * grained control on when to create, simulate, and send the deployment tx.
79
- * @param deployWallet - Wallet used for deploying the account contract.
80
- * @returns A DeployMethod instance that deploys this account contract.
81
- */
82
- getDeployMethod(deployWallet?: Wallet): Promise<DeployMethod<Contract>>;
83
- /**
84
- * Deploys the account contract that backs this account.
85
- * Does not register the associated class nor publicly deploy the instance by default.
86
- * Uses the salt provided in the constructor or a randomly generated one.
87
- * Registers the account in the PXE Service before deploying the contract.
88
- * @param opts - Fee options to be used for the deployment.
89
- * @returns A SentTx object that can be waited to get the associated Wallet.
90
- */
91
- deploy(opts?: DeployAccountOptions): DeployAccountSentTx;
92
- /**
93
- * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
94
- * Uses the salt provided in the constructor or a randomly generated one. If no initialization
95
- * is required it skips the transaction, and only registers the account in the PXE Service.
96
- * @param opts - Options to wait for the tx to be mined.
97
- * @returns A Wallet instance.
98
- */
99
- waitSetup(opts?: DeployAccountOptions & WaitOpts): Promise<AccountWalletWithSecretKey>;
100
- /**
101
- * Returns whether this account contract has a constructor and needs deployment.
102
- */
103
- isDeployable(): Promise<boolean>;
104
- }
1
+ export { AccountManager, type DeployAccountOptions } from './account_manager.js';
105
2
  export { DeployAccountMethod } from './deploy_account_method.js';
106
3
  export { type DeployAccountTxReceipt, DeployAccountSentTx } from './deploy_account_sent_tx.js';
107
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account_manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM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