@aztec/aztec.js 0.81.0 → 0.82.1-alpha-testnet.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/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 +106 -0
  10. package/dest/account_manager/account_manager.d.ts.map +1 -0
  11. package/dest/account_manager/account_manager.js +216 -0
  12. package/dest/account_manager/deploy_account_sent_tx.d.ts +3 -3
  13. package/dest/account_manager/deploy_account_sent_tx.d.ts.map +1 -1
  14. package/dest/account_manager/deploy_account_sent_tx.js +2 -2
  15. package/dest/account_manager/index.d.ts +1 -105
  16. package/dest/account_manager/index.d.ts.map +1 -1
  17. package/dest/account_manager/index.js +1 -166
  18. package/dest/api/account.d.ts +2 -1
  19. package/dest/api/account.d.ts.map +1 -1
  20. package/dest/api/contract.d.ts +4 -1
  21. package/dest/api/contract.d.ts.map +1 -1
  22. package/dest/api/contract.js +3 -0
  23. package/dest/api/fee.d.ts +2 -1
  24. package/dest/api/fee.d.ts.map +1 -1
  25. package/dest/api/fee.js +1 -0
  26. package/dest/api/fee_testing.d.ts +2 -0
  27. package/dest/api/fee_testing.d.ts.map +1 -0
  28. package/dest/api/fee_testing.js +1 -0
  29. package/dest/api/utils.d.ts +2 -1
  30. package/dest/api/utils.d.ts.map +1 -1
  31. package/dest/api/utils.js +2 -1
  32. package/dest/api/wallet.d.ts +1 -1
  33. package/dest/api/wallet.d.ts.map +1 -1
  34. package/dest/contract/base_contract_interaction.d.ts +22 -57
  35. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  36. package/dest/contract/base_contract_interaction.js +12 -67
  37. package/dest/contract/batch_call.d.ts +6 -18
  38. package/dest/contract/batch_call.d.ts.map +1 -1
  39. package/dest/contract/batch_call.js +25 -54
  40. package/dest/contract/contract.d.ts +1 -1
  41. package/dest/contract/contract.d.ts.map +1 -1
  42. package/dest/contract/contract_base.d.ts +1 -1
  43. package/dest/contract/contract_base.d.ts.map +1 -1
  44. package/dest/contract/contract_function_interaction.d.ts +38 -18
  45. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  46. package/dest/contract/contract_function_interaction.js +34 -41
  47. package/dest/contract/deploy_method.d.ts +7 -8
  48. package/dest/contract/deploy_method.d.ts.map +1 -1
  49. package/dest/contract/deploy_method.js +27 -32
  50. package/dest/contract/deploy_proven_tx.d.ts +2 -3
  51. package/dest/contract/deploy_proven_tx.d.ts.map +1 -1
  52. package/dest/contract/deploy_proven_tx.js +1 -1
  53. package/dest/contract/deploy_sent_tx.d.ts +2 -3
  54. package/dest/contract/deploy_sent_tx.d.ts.map +1 -1
  55. package/dest/contract/deploy_sent_tx.js +4 -4
  56. package/dest/contract/protocol_contracts.d.ts +1 -1
  57. package/dest/contract/protocol_contracts.d.ts.map +1 -1
  58. package/dest/contract/proven_tx.d.ts +3 -5
  59. package/dest/contract/proven_tx.d.ts.map +1 -1
  60. package/dest/contract/proven_tx.js +2 -6
  61. package/dest/contract/sent_tx.d.ts +4 -16
  62. package/dest/contract/sent_tx.d.ts.map +1 -1
  63. package/dest/contract/sent_tx.js +6 -37
  64. package/dest/contract/unsafe_contract.d.ts +1 -1
  65. package/dest/contract/unsafe_contract.d.ts.map +1 -1
  66. package/dest/contract/wait_for_proven.d.ts +17 -0
  67. package/dest/contract/wait_for_proven.d.ts.map +1 -0
  68. package/dest/contract/wait_for_proven.js +17 -0
  69. package/dest/deployment/broadcast_function.js +12 -8
  70. package/dest/deployment/contract_deployer.d.ts +1 -1
  71. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  72. package/dest/deployment/register_class.d.ts +1 -1
  73. package/dest/deployment/register_class.d.ts.map +1 -1
  74. package/dest/deployment/register_class.js +6 -11
  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/account_entrypoint_meta_payment_method.d.ts +31 -0
  79. package/dest/fee/account_entrypoint_meta_payment_method.d.ts.map +1 -0
  80. package/dest/fee/account_entrypoint_meta_payment_method.js +64 -0
  81. package/dest/fee/fee_juice_payment_method.d.ts +3 -3
  82. package/dest/fee/fee_juice_payment_method.d.ts.map +1 -1
  83. package/dest/fee/fee_juice_payment_method.js +3 -2
  84. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +4 -4
  85. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  86. package/dest/fee/fee_juice_payment_method_with_claim.js +6 -5
  87. package/dest/fee/private_fee_payment_method.d.ts +6 -6
  88. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  89. package/dest/fee/private_fee_payment_method.js +13 -12
  90. package/dest/fee/public_fee_payment_method.d.ts +7 -7
  91. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  92. package/dest/fee/public_fee_payment_method.js +10 -11
  93. package/dest/fee/sponsored_fee_payment.d.ts +15 -0
  94. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -0
  95. package/dest/fee/sponsored_fee_payment.js +30 -0
  96. package/dest/fee/utils.d.ts +13 -0
  97. package/dest/fee/utils.d.ts.map +1 -0
  98. package/dest/fee/utils.js +32 -0
  99. package/dest/utils/authwit.d.ts +16 -9
  100. package/dest/utils/authwit.d.ts.map +1 -1
  101. package/dest/utils/authwit.js +27 -36
  102. package/dest/wallet/account_wallet.d.ts +6 -6
  103. package/dest/wallet/account_wallet.d.ts.map +1 -1
  104. package/dest/wallet/account_wallet.js +15 -17
  105. package/dest/wallet/base_wallet.d.ts +12 -35
  106. package/dest/wallet/base_wallet.d.ts.map +1 -1
  107. package/dest/wallet/base_wallet.js +11 -64
  108. package/dest/wallet/index.d.ts +2 -2
  109. package/dest/wallet/index.d.ts.map +1 -1
  110. package/dest/wallet/index.js +1 -1
  111. package/dest/wallet/signerless_wallet.d.ts +3 -3
  112. package/dest/wallet/signerless_wallet.d.ts.map +1 -1
  113. package/dest/wallet/signerless_wallet.js +3 -6
  114. package/dest/wallet/wallet.d.ts +11 -0
  115. package/dest/wallet/wallet.d.ts.map +1 -0
  116. package/package.json +10 -8
  117. package/src/account/{contract.ts → account_contract.ts} +2 -1
  118. package/src/account/index.ts +2 -3
  119. package/src/account/interface.ts +1 -12
  120. package/src/account_manager/account_manager.ts +294 -0
  121. package/src/account_manager/deploy_account_sent_tx.ts +4 -4
  122. package/src/account_manager/index.ts +1 -237
  123. package/src/api/account.ts +2 -8
  124. package/src/api/contract.ts +5 -5
  125. package/src/api/fee.ts +2 -1
  126. package/src/api/fee_testing.ts +1 -0
  127. package/src/api/utils.ts +1 -1
  128. package/src/api/wallet.ts +7 -1
  129. package/src/contract/base_contract_interaction.ts +32 -88
  130. package/src/contract/batch_call.ts +40 -43
  131. package/src/contract/contract.ts +1 -1
  132. package/src/contract/contract_base.ts +1 -1
  133. package/src/contract/contract_function_interaction.ts +85 -56
  134. package/src/contract/deploy_method.ts +24 -26
  135. package/src/contract/deploy_proven_tx.ts +3 -4
  136. package/src/contract/deploy_sent_tx.ts +6 -6
  137. package/src/contract/protocol_contracts.ts +1 -1
  138. package/src/contract/proven_tx.ts +4 -22
  139. package/src/contract/sent_tx.ts +6 -47
  140. package/src/contract/unsafe_contract.ts +1 -1
  141. package/src/contract/wait_for_proven.ts +38 -0
  142. package/src/deployment/broadcast_function.ts +40 -40
  143. package/src/deployment/contract_deployer.ts +1 -1
  144. package/src/deployment/register_class.ts +9 -22
  145. package/src/ethereum/portal_manager.ts +73 -24
  146. package/src/fee/account_entrypoint_meta_payment_method.ts +90 -0
  147. package/src/fee/fee_juice_payment_method.ts +4 -5
  148. package/src/fee/fee_juice_payment_method_with_claim.ts +24 -20
  149. package/src/fee/private_fee_payment_method.ts +29 -28
  150. package/src/fee/public_fee_payment_method.ts +29 -29
  151. package/src/fee/sponsored_fee_payment.ts +38 -0
  152. package/src/fee/utils.ts +39 -0
  153. package/src/utils/authwit.ts +26 -37
  154. package/src/wallet/account_wallet.ts +18 -17
  155. package/src/wallet/base_wallet.ts +27 -88
  156. package/src/wallet/index.ts +2 -2
  157. package/src/wallet/signerless_wallet.ts +9 -8
  158. package/src/wallet/wallet.ts +34 -0
  159. package/dest/account/contract.d.ts.map +0 -1
  160. package/dest/account/wallet.d.ts +0 -11
  161. package/dest/account/wallet.d.ts.map +0 -1
  162. package/dest/account_manager/deploy_account_method.d.ts +0 -15
  163. package/dest/account_manager/deploy_account_method.d.ts.map +0 -1
  164. package/dest/account_manager/deploy_account_method.js +0 -36
  165. package/dest/api/entrypoint.d.ts +0 -2
  166. package/dest/api/entrypoint.d.ts.map +0 -1
  167. package/dest/api/entrypoint.js +0 -1
  168. package/dest/entrypoint/default_entrypoint.d.ts +0 -12
  169. package/dest/entrypoint/default_entrypoint.d.ts.map +0 -1
  170. package/dest/entrypoint/default_entrypoint.js +0 -28
  171. package/dest/entrypoint/default_multi_call_entrypoint.d.ts +0 -15
  172. package/dest/entrypoint/default_multi_call_entrypoint.d.ts.map +0 -1
  173. package/dest/entrypoint/default_multi_call_entrypoint.js +0 -130
  174. package/dest/entrypoint/entrypoint.d.ts +0 -39
  175. package/dest/entrypoint/entrypoint.d.ts.map +0 -1
  176. package/dest/entrypoint/entrypoint.js +0 -20
  177. package/dest/entrypoint/payload.d.ts +0 -128
  178. package/dest/entrypoint/payload.d.ts.map +0 -1
  179. package/dest/entrypoint/payload.js +0 -143
  180. package/dest/fee/fee_payment_method.d.ts +0 -22
  181. package/dest/fee/fee_payment_method.d.ts.map +0 -1
  182. package/dest/fee/fee_payment_method.js +0 -3
  183. package/src/account/wallet.ts +0 -13
  184. package/src/account_manager/deploy_account_method.ts +0 -67
  185. package/src/api/entrypoint.ts +0 -1
  186. package/src/entrypoint/default_entrypoint.ts +0 -39
  187. package/src/entrypoint/default_multi_call_entrypoint.ts +0 -93
  188. package/src/entrypoint/entrypoint.ts +0 -60
  189. package/src/entrypoint/payload.ts +0 -238
  190. package/src/fee/fee_payment_method.ts +0 -22
  191. /package/dest/account/{contract.js → account_contract.js} +0 -0
  192. /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,M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C;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,106 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { CompleteAddress, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
+ import type { GasSettings } from '@aztec/stdlib/gas';
4
+ import type { PXE } from '@aztec/stdlib/interfaces/client';
5
+ import type { AccountContract } from '../account/account_contract.js';
6
+ import type { Salt } from '../account/index.js';
7
+ import type { AccountInterface } from '../account/interface.js';
8
+ import { 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;
27
+ private pxe;
28
+ private secretKey;
29
+ private accountContract;
30
+ private instance;
31
+ /**
32
+ * Deployment salt for the account contract
33
+ */
34
+ readonly salt: Salt;
35
+ private constructor();
36
+ static create(pxe: PXE, secretKey: Fr, accountContract: AccountContract, salt?: Salt): Promise<AccountManager>;
37
+ protected getPublicKeys(): import("@aztec/stdlib/keys").PublicKeys;
38
+ protected getPublicKeysHash(): Fr | Promise<Fr>;
39
+ /**
40
+ * Returns the entrypoint for this account as defined by its account contract.
41
+ * @returns An entrypoint.
42
+ */
43
+ getAccount(): Promise<AccountInterface>;
44
+ /**
45
+ * Gets the calculated complete address associated with this account.
46
+ * Does not require the account to be deployed or registered.
47
+ * @returns The address, partial address, and encryption public key.
48
+ */
49
+ getCompleteAddress(): Promise<CompleteAddress>;
50
+ /**
51
+ * Gets the address for this given account.
52
+ * Does not require the account to be deployed or registered.
53
+ * @returns The address.
54
+ */
55
+ getAddress(): import("../index.js").AztecAddress;
56
+ /**
57
+ * Returns the contract instance definition associated with this account.
58
+ * Does not require the account to be deployed or registered.
59
+ * @returns ContractInstance instance.
60
+ */
61
+ getInstance(): ContractInstanceWithAddress;
62
+ /**
63
+ * Returns a Wallet instance associated with this account. Use it to create Contract
64
+ * instances to be interacted with from this account.
65
+ * @returns A Wallet instance.
66
+ */
67
+ getWallet(): Promise<AccountWalletWithSecretKey>;
68
+ /**
69
+ * Registers this account in the PXE Service and returns the associated wallet. Registering
70
+ * the account on the PXE Service is required for managing private state associated with it.
71
+ * Use the returned wallet to create Contract instances to be interacted with from this account.
72
+ * @param opts - Options to wait for the account to be synched.
73
+ * @returns A Wallet instance.
74
+ */
75
+ register(): Promise<AccountWalletWithSecretKey>;
76
+ /**
77
+ * Deploys the account contract that backs this account.
78
+ * Does not register the associated class nor publicly deploy the instance by default.
79
+ * Uses the salt provided in the constructor or a randomly generated one.
80
+ * Registers the account in the PXE Service before deploying the contract.
81
+ * @param opts - Fee options to be used for the deployment.
82
+ * @returns A SentTx object that can be waited to get the associated Wallet.
83
+ */
84
+ deploy(opts?: DeployAccountOptions): DeployAccountSentTx;
85
+ /**
86
+ * Estimates the gas needed to deploy the account contract that backs this account.
87
+ * This method is here to ensure that the fee payment method is correctly set up in case
88
+ * the account contract needs to pay for its own deployment.
89
+ * @param opts - Fee options to be used for the deployment.
90
+ * @returns The gas estimations for the account contract deployment and initialization.
91
+ */
92
+ estimateDeploymentGas(opts?: DeployAccountOptions): Promise<Pick<GasSettings, 'gasLimits' | 'teardownGasLimits'>>;
93
+ /**
94
+ * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
95
+ * Uses the salt provided in the constructor or a randomly generated one. If no initialization
96
+ * is required it skips the transaction, and only registers the account in the PXE Service.
97
+ * @param opts - Options to wait for the tx to be mined.
98
+ * @returns A Wallet instance.
99
+ */
100
+ waitSetup(opts?: DeployAccountOptions & WaitOpts): Promise<AccountWalletWithSecretKey>;
101
+ /**
102
+ * Returns whether this account contract has a constructor and needs deployment.
103
+ */
104
+ isDeployable(): Promise<boolean>;
105
+ }
106
+ //# 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":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,KAAK,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE3F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAG3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGxE,OAAO,EAAE,0BAA0B,EAAoB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,aAAa,EACb,KAAK,GAAG,uBAAuB,GAAG,sBAAsB,GAAG,oBAAoB,CAChF,GAAG;IACF;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,qBAAa,cAAc;;IAEvB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,QAAQ;IAChB;;OAEG;aACa,IAAI,EAAE,IAAI;IAR5B,OAAO;WAWM,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,IAAI;IAoB1F,SAAS,CAAC,aAAa;IAIvB,SAAS,CAAC,iBAAiB;IAI3B;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAMpD;;;;OAIG;IACI,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAIrD;;;;OAIG;IACI,UAAU;IAIjB;;;;OAIG;IACI,WAAW,IAAI,2BAA2B;IAIjD;;;;OAIG;IACU,SAAS,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAK7D;;;;;;OAMG;IACU,QAAQ,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAqF5D;;;;;;;OAOG;IACI,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,mBAAmB;IA2B/D;;;;;;OAMG;IACU,qBAAqB,CAChC,IAAI,CAAC,EAAE,oBAAoB,GAC1B,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB,CAAC,CAAC;IAgBhE;;;;;;OAMG;IACU,SAAS,CAAC,IAAI,GAAE,oBAAoB,GAAG,QAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAKpH;;OAEG;IACU,YAAY;CAG1B"}
@@ -0,0 +1,216 @@
1
+ import { DefaultMultiCallEntrypoint } from '@aztec/entrypoints/multicall';
2
+ import { Fr } from '@aztec/foundation/fields';
3
+ import { CompleteAddress } from '@aztec/stdlib/contract';
4
+ import { getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
5
+ import { deriveKeys } from '@aztec/stdlib/keys';
6
+ import { Contract } from '../contract/contract.js';
7
+ import { DeployMethod } from '../contract/deploy_method.js';
8
+ import { DefaultWaitOpts } from '../contract/sent_tx.js';
9
+ import { AccountEntrypointMetaPaymentMethod } from '../fee/account_entrypoint_meta_payment_method.js';
10
+ import { FeeJuicePaymentMethod } from '../index.js';
11
+ import { AccountWalletWithSecretKey, SignerlessWallet } from '../wallet/index.js';
12
+ import { DeployAccountSentTx } from './deploy_account_sent_tx.js';
13
+ /**
14
+ * Manages a user account. Provides methods for calculating the account's address, deploying the account contract,
15
+ * and creating and registering the user wallet in the PXE Service.
16
+ */ export class AccountManager {
17
+ pxe;
18
+ secretKey;
19
+ accountContract;
20
+ instance;
21
+ salt;
22
+ constructor(pxe, secretKey, accountContract, instance, /**
23
+ * Deployment salt for the account contract
24
+ */ salt){
25
+ this.pxe = pxe;
26
+ this.secretKey = secretKey;
27
+ this.accountContract = accountContract;
28
+ this.instance = instance;
29
+ this.salt = salt;
30
+ }
31
+ static async create(pxe, secretKey, accountContract, salt) {
32
+ const { publicKeys } = await deriveKeys(secretKey);
33
+ salt = salt !== undefined ? new Fr(salt) : Fr.random();
34
+ const { constructorName, constructorArgs } = await accountContract.getDeploymentFunctionAndArgs() ?? {
35
+ constructorName: undefined,
36
+ constructorArgs: undefined
37
+ };
38
+ const artifact = await accountContract.getContractArtifact();
39
+ const instance = await getContractInstanceFromDeployParams(artifact, {
40
+ constructorArtifact: constructorName,
41
+ constructorArgs,
42
+ salt: salt,
43
+ publicKeys
44
+ });
45
+ return new AccountManager(pxe, secretKey, accountContract, instance, salt);
46
+ }
47
+ getPublicKeys() {
48
+ return this.instance.publicKeys;
49
+ }
50
+ getPublicKeysHash() {
51
+ return this.getPublicKeys().hash();
52
+ }
53
+ /**
54
+ * Returns the entrypoint for this account as defined by its account contract.
55
+ * @returns An entrypoint.
56
+ */ async getAccount() {
57
+ const nodeInfo = await this.pxe.getNodeInfo();
58
+ const completeAddress = await this.getCompleteAddress();
59
+ return this.accountContract.getInterface(completeAddress, nodeInfo);
60
+ }
61
+ /**
62
+ * Gets the calculated complete address associated with this account.
63
+ * Does not require the account to be deployed or registered.
64
+ * @returns The address, partial address, and encryption public key.
65
+ */ getCompleteAddress() {
66
+ return CompleteAddress.fromSecretKeyAndInstance(this.secretKey, this.instance);
67
+ }
68
+ /**
69
+ * Gets the address for this given account.
70
+ * Does not require the account to be deployed or registered.
71
+ * @returns The address.
72
+ */ getAddress() {
73
+ return this.instance.address;
74
+ }
75
+ /**
76
+ * Returns the contract instance definition associated with this account.
77
+ * Does not require the account to be deployed or registered.
78
+ * @returns ContractInstance instance.
79
+ */ getInstance() {
80
+ return this.instance;
81
+ }
82
+ /**
83
+ * Returns a Wallet instance associated with this account. Use it to create Contract
84
+ * instances to be interacted with from this account.
85
+ * @returns A Wallet instance.
86
+ */ async getWallet() {
87
+ const entrypoint = await this.getAccount();
88
+ return new AccountWalletWithSecretKey(this.pxe, entrypoint, this.secretKey, this.salt);
89
+ }
90
+ /**
91
+ * Registers this account in the PXE Service and returns the associated wallet. Registering
92
+ * the account on the PXE Service is required for managing private state associated with it.
93
+ * Use the returned wallet to create Contract instances to be interacted with from this account.
94
+ * @param opts - Options to wait for the account to be synched.
95
+ * @returns A Wallet instance.
96
+ */ async register() {
97
+ await this.pxe.registerContract({
98
+ artifact: await this.accountContract.getContractArtifact(),
99
+ instance: this.getInstance()
100
+ });
101
+ await this.pxe.registerAccount(this.secretKey, (await this.getCompleteAddress()).partialAddress);
102
+ return this.getWallet();
103
+ }
104
+ /**
105
+ * Returns the pre-populated deployment method to deploy the account contract that backs this account.
106
+ * If no wallet is provided, it uses a signerless wallet with the multi call entrypoint
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 DeployMethod(this.getPublicKeys(), wallet, artifact, (address)=>Contract.at(address, artifact, wallet), constructorArgs, constructorName);
131
+ }
132
+ /**
133
+ * Returns a FeePaymentMethod that routes the original one provided as an argument
134
+ * through the account's entrypoint. This allows an account contract to pay
135
+ * for its own deployment and initialization.
136
+ *
137
+ * For more details on how the fee payment routing works see documentation of AccountEntrypointMetaPaymentMethod class.
138
+ *
139
+ * @param originalPaymentMethod - originalPaymentMethod The original payment method to be wrapped.
140
+ * @returns A FeePaymentMethod that routes the original one through the account's entrypoint (AccountEntrypointMetaPaymentMethod)
141
+ */ async #getSelfPaymentMethod(originalPaymentMethod) {
142
+ const artifact = await this.accountContract.getContractArtifact();
143
+ const wallet = await this.getWallet();
144
+ const address = wallet.getAddress();
145
+ return new AccountEntrypointMetaPaymentMethod(artifact, wallet, 'entrypoint', address, originalPaymentMethod ?? new FeeJuicePaymentMethod(address));
146
+ }
147
+ /**
148
+ * Deploys the account contract that backs this account.
149
+ * Does not register the associated class nor publicly deploy the instance by default.
150
+ * Uses the salt provided in the constructor or a randomly generated one.
151
+ * Registers the account in the PXE Service before deploying the contract.
152
+ * @param opts - Fee options to be used for the deployment.
153
+ * @returns A SentTx object that can be waited to get the associated Wallet.
154
+ */ deploy(opts) {
155
+ let deployMethod;
156
+ const sentTx = this.#getDeployMethod(opts?.deployWallet).then((method)=>{
157
+ deployMethod = method;
158
+ if (!opts?.deployWallet && opts?.fee) {
159
+ return this.#getSelfPaymentMethod(opts?.fee?.paymentMethod);
160
+ }
161
+ }).then((maybeWrappedPaymentMethod)=>{
162
+ let fee = opts?.fee;
163
+ if (maybeWrappedPaymentMethod) {
164
+ fee = {
165
+ ...opts?.fee,
166
+ paymentMethod: maybeWrappedPaymentMethod
167
+ };
168
+ }
169
+ return deployMethod.send({
170
+ contractAddressSalt: new Fr(this.salt),
171
+ skipClassRegistration: opts?.skipClassRegistration ?? true,
172
+ skipPublicDeployment: opts?.skipPublicDeployment ?? true,
173
+ skipInitialization: opts?.skipInitialization ?? false,
174
+ universalDeploy: true,
175
+ fee
176
+ });
177
+ }).then((tx)=>tx.getTxHash());
178
+ return new DeployAccountSentTx(this.pxe, sentTx, this.getWallet());
179
+ }
180
+ /**
181
+ * Estimates the gas needed to deploy the account contract that backs this account.
182
+ * This method is here to ensure that the fee payment method is correctly set up in case
183
+ * the account contract needs to pay for its own deployment.
184
+ * @param opts - Fee options to be used for the deployment.
185
+ * @returns The gas estimations for the account contract deployment and initialization.
186
+ */ async estimateDeploymentGas(opts) {
187
+ const deployMethod = await this.#getDeployMethod(opts?.deployWallet);
188
+ const fee = !opts?.deployWallet && opts?.fee ? {
189
+ ...opts.fee,
190
+ paymentMethod: await this.#getSelfPaymentMethod(opts.fee.paymentMethod)
191
+ } : opts?.fee;
192
+ return deployMethod.estimateGas({
193
+ contractAddressSalt: new Fr(this.salt),
194
+ skipClassRegistration: opts?.skipClassRegistration ?? true,
195
+ skipPublicDeployment: opts?.skipPublicDeployment ?? true,
196
+ skipInitialization: opts?.skipInitialization ?? false,
197
+ universalDeploy: true,
198
+ fee
199
+ });
200
+ }
201
+ /**
202
+ * Deploys the account contract that backs this account if needed and awaits the tx to be mined.
203
+ * Uses the salt provided in the constructor or a randomly generated one. If no initialization
204
+ * is required it skips the transaction, and only registers the account in the PXE Service.
205
+ * @param opts - Options to wait for the tx to be mined.
206
+ * @returns A Wallet instance.
207
+ */ async waitSetup(opts = DefaultWaitOpts) {
208
+ await (await this.isDeployable() ? this.deploy(opts).wait(opts) : this.register());
209
+ return this.getWallet();
210
+ }
211
+ /**
212
+ * Returns whether this account contract has a constructor and needs deployment.
213
+ */ async isDeployable() {
214
+ return await this.accountContract.getDeploymentFunctionAndArgs() !== undefined;
215
+ }
216
+ }
@@ -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,3 @@
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
- }
105
- export { DeployAccountMethod } from './deploy_account_method.js';
1
+ export { AccountManager, type DeployAccountOptions } from './account_manager.js';
106
2
  export { type DeployAccountTxReceipt, DeployAccountSentTx } from './deploy_account_sent_tx.js';
107
3
  //# 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,0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