@aztec/aztec.js 0.0.1-commit.b655e406 → 0.0.1-commit.c0b82b2

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 (261) hide show
  1. package/dest/account/account.d.ts +26 -42
  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 +20 -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 +7 -9
  13. package/dest/account/signerless_account.d.ts.map +1 -1
  14. package/dest/account/signerless_account.js +8 -11
  15. package/dest/api/abi.d.ts +1 -1
  16. package/dest/api/account.d.ts +3 -4
  17. package/dest/api/account.d.ts.map +1 -1
  18. package/dest/api/account.js +2 -3
  19. package/dest/api/addresses.d.ts +1 -1
  20. package/dest/api/authorization.d.ts +2 -2
  21. package/dest/api/authorization.d.ts.map +1 -1
  22. package/dest/api/authorization.js +1 -1
  23. package/dest/api/block.d.ts +1 -1
  24. package/dest/api/contract.d.ts +19 -13
  25. package/dest/api/contract.d.ts.map +1 -1
  26. package/dest/api/contract.js +17 -11
  27. package/dest/api/crypto.d.ts +1 -1
  28. package/dest/api/deployment.d.ts +1 -2
  29. package/dest/api/deployment.d.ts.map +1 -1
  30. package/dest/api/deployment.js +0 -1
  31. package/dest/api/eth_address.d.ts +1 -1
  32. package/dest/api/ethereum.d.ts +1 -1
  33. package/dest/api/events.d.ts +10 -6
  34. package/dest/api/events.d.ts.map +1 -1
  35. package/dest/api/events.js +30 -20
  36. package/dest/api/fee.d.ts +1 -1
  37. package/dest/api/fee_testing.d.ts +1 -1
  38. package/dest/api/fields.d.ts +4 -2
  39. package/dest/api/fields.d.ts.map +1 -1
  40. package/dest/api/fields.js +3 -1
  41. package/dest/api/keys.d.ts +2 -2
  42. package/dest/api/keys.js +1 -1
  43. package/dest/api/log.d.ts +1 -1
  44. package/dest/api/messaging.d.ts +1 -1
  45. package/dest/api/node.d.ts +8 -4
  46. package/dest/api/node.d.ts.map +1 -1
  47. package/dest/api/node.js +7 -3
  48. package/dest/api/note.d.ts +2 -2
  49. package/dest/api/note.d.ts.map +1 -1
  50. package/dest/api/note.js +1 -1
  51. package/dest/api/protocol.d.ts +7 -1
  52. package/dest/api/protocol.d.ts.map +1 -1
  53. package/dest/api/protocol.js +6 -0
  54. package/dest/api/trees.d.ts +1 -1
  55. package/dest/api/tx.d.ts +2 -2
  56. package/dest/api/tx.d.ts.map +1 -1
  57. package/dest/api/tx.js +1 -1
  58. package/dest/api/utils.d.ts +1 -1
  59. package/dest/api/wallet.d.ts +3 -3
  60. package/dest/api/wallet.d.ts.map +1 -1
  61. package/dest/api/wallet.js +2 -2
  62. package/dest/authorization/call_authorization_request.d.ts +2 -2
  63. package/dest/authorization/call_authorization_request.d.ts.map +1 -1
  64. package/dest/contract/base_contract_interaction.d.ts +8 -11
  65. package/dest/contract/base_contract_interaction.d.ts.map +1 -1
  66. package/dest/contract/base_contract_interaction.js +5 -17
  67. package/dest/contract/batch_call.d.ts +8 -9
  68. package/dest/contract/batch_call.d.ts.map +1 -1
  69. package/dest/contract/batch_call.js +59 -36
  70. package/dest/contract/checker.d.ts +1 -1
  71. package/dest/contract/contract.d.ts +2 -2
  72. package/dest/contract/contract.d.ts.map +1 -1
  73. package/dest/contract/contract.js +4 -5
  74. package/dest/contract/contract_base.d.ts +6 -10
  75. package/dest/contract/contract_base.d.ts.map +1 -1
  76. package/dest/contract/contract_base.js +5 -12
  77. package/dest/contract/contract_function_interaction.d.ts +5 -14
  78. package/dest/contract/contract_function_interaction.d.ts.map +1 -1
  79. package/dest/contract/contract_function_interaction.js +18 -12
  80. package/dest/contract/deploy_method.d.ts +85 -24
  81. package/dest/contract/deploy_method.d.ts.map +1 -1
  82. package/dest/contract/deploy_method.js +71 -36
  83. package/dest/contract/get_gas_limits.d.ts +1 -1
  84. package/dest/contract/get_gas_limits.js +3 -3
  85. package/dest/contract/interaction_options.d.ts +51 -7
  86. package/dest/contract/interaction_options.d.ts.map +1 -1
  87. package/dest/contract/interaction_options.js +12 -11
  88. package/dest/contract/protocol_contracts/auth-registry.d.ts +36 -0
  89. package/dest/contract/protocol_contracts/auth-registry.d.ts.map +1 -0
  90. package/dest/contract/protocol_contracts/auth-registry.js +1005 -0
  91. package/dest/contract/protocol_contracts/contract-class-registry.d.ts +15 -0
  92. package/dest/contract/protocol_contracts/contract-class-registry.d.ts.map +1 -0
  93. package/dest/contract/protocol_contracts/contract-class-registry.js +139 -0
  94. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts +22 -0
  95. package/dest/contract/protocol_contracts/contract-instance-registry.d.ts.map +1 -0
  96. package/dest/contract/protocol_contracts/contract-instance-registry.js +465 -0
  97. package/dest/contract/protocol_contracts/fee-juice.d.ts +21 -0
  98. package/dest/contract/protocol_contracts/fee-juice.d.ts.map +1 -0
  99. package/dest/contract/protocol_contracts/fee-juice.js +434 -0
  100. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts +34 -0
  101. package/dest/contract/protocol_contracts/multi-call-entrypoint.d.ts.map +1 -0
  102. package/dest/contract/protocol_contracts/multi-call-entrypoint.js +601 -0
  103. package/dest/contract/protocol_contracts/public-checks.d.ts +26 -0
  104. package/dest/contract/protocol_contracts/public-checks.d.ts.map +1 -0
  105. package/dest/contract/protocol_contracts/public-checks.js +609 -0
  106. package/dest/contract/wait_for_proven.d.ts +2 -2
  107. package/dest/contract/wait_for_proven.d.ts.map +1 -1
  108. package/dest/contract/wait_for_proven.js +1 -1
  109. package/dest/contract/wait_opts.d.ts +16 -0
  110. package/dest/contract/wait_opts.d.ts.map +1 -0
  111. package/dest/contract/wait_opts.js +5 -0
  112. package/dest/deployment/contract_deployer.d.ts +1 -1
  113. package/dest/deployment/contract_deployer.d.ts.map +1 -1
  114. package/dest/deployment/contract_deployer.js +1 -1
  115. package/dest/deployment/publish_class.d.ts +1 -1
  116. package/dest/deployment/publish_class.js +3 -3
  117. package/dest/deployment/publish_instance.d.ts +2 -2
  118. package/dest/deployment/publish_instance.d.ts.map +1 -1
  119. package/dest/deployment/publish_instance.js +3 -3
  120. package/dest/ethereum/portal_manager.d.ts +7 -6
  121. package/dest/ethereum/portal_manager.d.ts.map +1 -1
  122. package/dest/ethereum/portal_manager.js +48 -22
  123. package/dest/fee/fee_juice_payment_method_with_claim.d.ts +2 -2
  124. package/dest/fee/fee_juice_payment_method_with_claim.d.ts.map +1 -1
  125. package/dest/fee/fee_juice_payment_method_with_claim.js +9 -9
  126. package/dest/fee/fee_payment_method.d.ts +2 -2
  127. package/dest/fee/fee_payment_method.d.ts.map +1 -1
  128. package/dest/fee/private_fee_payment_method.d.ts +2 -2
  129. package/dest/fee/private_fee_payment_method.d.ts.map +1 -1
  130. package/dest/fee/private_fee_payment_method.js +14 -14
  131. package/dest/fee/public_fee_payment_method.d.ts +2 -2
  132. package/dest/fee/public_fee_payment_method.d.ts.map +1 -1
  133. package/dest/fee/public_fee_payment_method.js +14 -14
  134. package/dest/fee/sponsored_fee_payment.d.ts +2 -2
  135. package/dest/fee/sponsored_fee_payment.d.ts.map +1 -1
  136. package/dest/fee/sponsored_fee_payment.js +5 -5
  137. package/dest/scripts/generate_protocol_contract_types.d.ts +2 -0
  138. package/dest/scripts/generate_protocol_contract_types.d.ts.map +1 -0
  139. package/dest/scripts/generate_protocol_contract_types.js +120 -0
  140. package/dest/utils/abi_types.d.ts +2 -2
  141. package/dest/utils/abi_types.d.ts.map +1 -1
  142. package/dest/utils/authwit.d.ts +14 -12
  143. package/dest/utils/authwit.d.ts.map +1 -1
  144. package/dest/utils/authwit.js +27 -20
  145. package/dest/utils/cross_chain.d.ts +2 -2
  146. package/dest/utils/cross_chain.d.ts.map +1 -1
  147. package/dest/utils/fee_juice.d.ts +2 -2
  148. package/dest/utils/fee_juice.js +2 -2
  149. package/dest/utils/field_compressed_string.d.ts +1 -1
  150. package/dest/utils/field_compressed_string.d.ts.map +1 -1
  151. package/dest/utils/field_compressed_string.js +1 -1
  152. package/dest/utils/node.d.ts +13 -2
  153. package/dest/utils/node.d.ts.map +1 -1
  154. package/dest/utils/node.js +46 -0
  155. package/dest/utils/pub_key.d.ts +2 -2
  156. package/dest/utils/pub_key.d.ts.map +1 -1
  157. package/dest/utils/pub_key.js +1 -1
  158. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts +6 -9
  159. package/dest/wallet/account_entrypoint_meta_payment_method.d.ts.map +1 -1
  160. package/dest/wallet/account_entrypoint_meta_payment_method.js +29 -44
  161. package/dest/wallet/account_manager.d.ts +3 -9
  162. package/dest/wallet/account_manager.d.ts.map +1 -1
  163. package/dest/wallet/account_manager.js +6 -12
  164. package/dest/wallet/capabilities.d.ts +452 -0
  165. package/dest/wallet/capabilities.d.ts.map +1 -0
  166. package/dest/wallet/capabilities.js +3 -0
  167. package/dest/wallet/deploy_account_method.d.ts +49 -10
  168. package/dest/wallet/deploy_account_method.d.ts.map +1 -1
  169. package/dest/wallet/deploy_account_method.js +35 -7
  170. package/dest/wallet/index.d.ts +2 -2
  171. package/dest/wallet/index.d.ts.map +1 -1
  172. package/dest/wallet/index.js +1 -1
  173. package/dest/wallet/wallet.d.ts +1853 -1533
  174. package/dest/wallet/wallet.d.ts.map +1 -1
  175. package/dest/wallet/wallet.js +223 -124
  176. package/package.json +27 -15
  177. package/src/account/account.ts +35 -60
  178. package/src/account/account_contract.ts +7 -8
  179. package/src/account/account_with_secret_key.ts +34 -9
  180. package/src/account/index.ts +3 -2
  181. package/src/account/signerless_account.ts +15 -15
  182. package/src/api/account.ts +10 -3
  183. package/src/api/authorization.ts +1 -0
  184. package/src/api/contract.ts +26 -10
  185. package/src/api/deployment.ts +0 -1
  186. package/src/api/events.ts +35 -27
  187. package/src/api/fields.ts +3 -1
  188. package/src/api/keys.ts +2 -2
  189. package/src/api/node.ts +7 -3
  190. package/src/api/note.ts +1 -1
  191. package/src/api/protocol.ts +7 -0
  192. package/src/api/tx.ts +4 -0
  193. package/src/api/wallet.ts +52 -9
  194. package/src/authorization/call_authorization_request.ts +1 -1
  195. package/src/contract/base_contract_interaction.ts +27 -16
  196. package/src/contract/batch_call.ts +62 -48
  197. package/src/contract/contract.ts +7 -5
  198. package/src/contract/contract_base.ts +5 -15
  199. package/src/contract/contract_function_interaction.ts +26 -17
  200. package/src/contract/deploy_method.ts +175 -47
  201. package/src/contract/get_gas_limits.ts +3 -3
  202. package/src/contract/interaction_options.ts +59 -13
  203. package/src/contract/protocol_contracts/auth-registry.ts +553 -0
  204. package/src/contract/protocol_contracts/contract-class-registry.ts +99 -0
  205. package/src/contract/protocol_contracts/contract-instance-registry.ts +302 -0
  206. package/src/contract/protocol_contracts/fee-juice.ts +266 -0
  207. package/src/contract/protocol_contracts/multi-call-entrypoint.ts +336 -0
  208. package/src/contract/protocol_contracts/public-checks.ts +320 -0
  209. package/src/contract/wait_for_proven.ts +1 -1
  210. package/src/contract/wait_opts.ts +21 -0
  211. package/src/deployment/contract_deployer.ts +3 -2
  212. package/src/deployment/publish_class.ts +3 -3
  213. package/src/deployment/publish_instance.ts +3 -6
  214. package/src/ethereum/portal_manager.ts +65 -34
  215. package/src/fee/fee_juice_payment_method_with_claim.ts +9 -7
  216. package/src/fee/fee_payment_method.ts +1 -1
  217. package/src/fee/private_fee_payment_method.ts +12 -10
  218. package/src/fee/public_fee_payment_method.ts +13 -11
  219. package/src/fee/sponsored_fee_payment.ts +6 -4
  220. package/src/scripts/generate_protocol_contract_types.ts +150 -0
  221. package/src/utils/abi_types.ts +1 -1
  222. package/src/utils/authwit.ts +40 -22
  223. package/src/utils/cross_chain.ts +1 -1
  224. package/src/utils/fee_juice.ts +2 -2
  225. package/src/utils/field_compressed_string.ts +1 -1
  226. package/src/utils/node.ts +62 -0
  227. package/src/utils/pub_key.ts +2 -2
  228. package/src/wallet/account_entrypoint_meta_payment_method.ts +29 -60
  229. package/src/wallet/account_manager.ts +7 -15
  230. package/src/wallet/capabilities.ts +500 -0
  231. package/src/wallet/deploy_account_method.ts +78 -16
  232. package/src/wallet/index.ts +1 -1
  233. package/src/wallet/wallet.ts +387 -166
  234. package/dest/account/interface.d.ts +0 -19
  235. package/dest/account/interface.d.ts.map +0 -1
  236. package/dest/account/interface.js +0 -5
  237. package/dest/contract/deploy_sent_tx.d.ts +0 -43
  238. package/dest/contract/deploy_sent_tx.d.ts.map +0 -1
  239. package/dest/contract/deploy_sent_tx.js +0 -40
  240. package/dest/contract/protocol_contracts.d.ts +0 -9
  241. package/dest/contract/protocol_contracts.d.ts.map +0 -1
  242. package/dest/contract/protocol_contracts.js +0 -26
  243. package/dest/contract/sent_tx.d.ts +0 -51
  244. package/dest/contract/sent_tx.d.ts.map +0 -1
  245. package/dest/contract/sent_tx.js +0 -90
  246. package/dest/contract/unsafe_contract.d.ts +0 -15
  247. package/dest/contract/unsafe_contract.d.ts.map +0 -1
  248. package/dest/contract/unsafe_contract.js +0 -6
  249. package/dest/deployment/broadcast_function.d.ts +0 -24
  250. package/dest/deployment/broadcast_function.d.ts.map +0 -1
  251. package/dest/deployment/broadcast_function.js +0 -74
  252. package/dest/wallet/base_wallet.d.ts +0 -91
  253. package/dest/wallet/base_wallet.d.ts.map +0 -1
  254. package/dest/wallet/base_wallet.js +0 -238
  255. package/src/account/interface.ts +0 -25
  256. package/src/contract/deploy_sent_tx.ts +0 -68
  257. package/src/contract/protocol_contracts.ts +0 -35
  258. package/src/contract/sent_tx.ts +0 -130
  259. package/src/contract/unsafe_contract.ts +0 -19
  260. package/src/deployment/broadcast_function.ts +0 -148
  261. package/src/wallet/base_wallet.ts +0 -350
@@ -1,19 +0,0 @@
1
- import type { AuthWitnessProvider, EntrypointInterface } from '@aztec/entrypoints/interfaces';
2
- import type { Fr } from '@aztec/foundation/fields';
3
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
- import type { CompleteAddress } from '@aztec/stdlib/contract';
5
- /**
6
- * Handler for interfacing with an account. Knows how to create transaction execution
7
- * requests and authorize actions for its corresponding account.
8
- */
9
- export interface AccountInterface extends EntrypointInterface, AuthWitnessProvider {
10
- /** Returns the complete address for this account. */
11
- getCompleteAddress(): CompleteAddress;
12
- /** Returns the address for this account. */
13
- getAddress(): AztecAddress;
14
- /** Returns the chain id for this account */
15
- getChainId(): Fr;
16
- /** Returns the rollup version for this account */
17
- getVersion(): Fr;
18
- }
19
- //# sourceMappingURL=interface.d.ts.map
@@ -1 +0,0 @@
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,5 +0,0 @@
1
- // docs:start:account-interface
2
- /**
3
- * Handler for interfacing with an account. Knows how to create transaction execution
4
- * requests and authorize actions for its corresponding account.
5
- */ export { }; // docs:end:account-interface
@@ -1,43 +0,0 @@
1
- import type { FieldsOf } from '@aztec/foundation/types';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
4
- import type { TxHash, TxReceipt } from '@aztec/stdlib/tx';
5
- import type { Wallet } from '../wallet/wallet.js';
6
- import type { Contract } from './contract.js';
7
- import type { ContractBase } from './contract_base.js';
8
- import { SentTx, type WaitOpts } from './sent_tx.js';
9
- /** Options related to waiting for a deployment tx. */
10
- export type DeployedWaitOpts = WaitOpts & {
11
- /** Wallet to use for creating a contract instance. Uses the one set in the deployer constructor if not set. */
12
- wallet?: Wallet;
13
- };
14
- /** Extends a transaction receipt with a contract instance that represents the newly deployed contract. */
15
- export type DeployTxReceipt<TContract extends ContractBase = Contract> = FieldsOf<TxReceipt> & {
16
- /** Instance of the newly deployed contract. */
17
- contract: TContract;
18
- };
19
- /**
20
- * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
21
- */
22
- export declare class DeploySentTx<TContract extends Contract = Contract> extends SentTx {
23
- private postDeployCtor;
24
- /** A getter for the deployed contract instance */
25
- instanceGetter: () => Promise<ContractInstanceWithAddress>;
26
- private log;
27
- constructor(wallet: Wallet, sendTx: () => Promise<TxHash>, postDeployCtor: (address: AztecAddress, wallet: Wallet) => Promise<TContract>,
28
- /** A getter for the deployed contract instance */
29
- instanceGetter: () => Promise<ContractInstanceWithAddress>);
30
- /**
31
- * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
32
- * @param opts - Options for configuring the waiting for the tx to be mined.
33
- * @returns The deployed contract instance.
34
- */
35
- deployed(opts?: DeployedWaitOpts): Promise<TContract>;
36
- /**
37
- * Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
38
- * @param opts - Options for configuring the waiting for the tx to be mined.
39
- * @returns The transaction receipt with the deployed contract instance.
40
- */
41
- wait(opts?: DeployedWaitOpts): Promise<DeployTxReceipt<TContract>>;
42
- }
43
- //# sourceMappingURL=deploy_sent_tx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy_sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/deploy_sent_tx.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BAA2B,CAAC;IAKnE;;;;OAIG;IACU,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;IAOlE;;;;OAIG;IACmB,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;CAWzF"}
@@ -1,40 +0,0 @@
1
- import { createLogger } from '@aztec/foundation/log';
2
- import { SentTx } from './sent_tx.js';
3
- /**
4
- * A contract deployment transaction sent to the network, extending SentTx with methods to publish a contract instance.
5
- */ export class DeploySentTx extends SentTx {
6
- postDeployCtor;
7
- instanceGetter;
8
- log;
9
- constructor(wallet, sendTx, postDeployCtor, /** A getter for the deployed contract instance */ instanceGetter){
10
- super(wallet, sendTx), this.postDeployCtor = postDeployCtor, this.instanceGetter = instanceGetter, this.log = createLogger('aztecjs:deploy_sent_tx');
11
- }
12
- /**
13
- * Awaits for the tx to be mined and returns the contract instance. Throws if tx is not mined.
14
- * @param opts - Options for configuring the waiting for the tx to be mined.
15
- * @returns The deployed contract instance.
16
- */ async deployed(opts) {
17
- const receipt = await this.wait(opts);
18
- const instance = await this.instanceGetter();
19
- this.log.info(`Contract ${instance.address.toString()} successfully deployed.`);
20
- return receipt.contract;
21
- }
22
- /**
23
- * Awaits for the tx to be mined and returns the receipt along with a contract instance. Throws if tx is not mined.
24
- * @param opts - Options for configuring the waiting for the tx to be mined.
25
- * @returns The transaction receipt with the deployed contract instance.
26
- */ async wait(opts) {
27
- const receipt = await super.wait(opts);
28
- // In the case of DeploySentTx we have a guarantee that this.walletOrNode is a Wallet so we can cast it to Wallet.
29
- const contractWallet = opts?.wallet ?? this.walletOrNode;
30
- if (!contractWallet) {
31
- throw new Error(`A wallet is required for creating a contract instance`);
32
- }
33
- const instance = await this.instanceGetter();
34
- const contract = await this.postDeployCtor(instance.address, contractWallet);
35
- return {
36
- ...receipt,
37
- contract
38
- };
39
- }
40
- }
@@ -1,9 +0,0 @@
1
- import type { Wallet } from '../wallet/wallet.js';
2
- import { UnsafeContract } from './unsafe_contract.js';
3
- /** Returns a Contract wrapper for the contract class registry. */
4
- export declare function getClassRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
5
- /** Returns a Contract wrapper for the contract instance registry. */
6
- export declare function getInstanceRegistryContract(wallet: Wallet): Promise<UnsafeContract>;
7
- /** Returns a Contract wrapper for the fee juice contract */
8
- export declare function getFeeJuice(wallet: Wallet): Promise<UnsafeContract>;
9
- //# sourceMappingURL=protocol_contracts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"protocol_contracts.d.ts","sourceRoot":"","sources":["../../src/contract/protocol_contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,kEAAkE;AAClE,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,2BAQ5D;AAED,qEAAqE;AACrE,wBAAsB,2BAA2B,CAAC,MAAM,EAAE,MAAM,2BAO/D;AAED,4DAA4D;AAC5D,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,2BAO/C"}
@@ -1,26 +0,0 @@
1
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
- import { UnsafeContract } from './unsafe_contract.js';
3
- /** Returns a Contract wrapper for the contract class registry. */ export async function getClassRegistryContract(wallet) {
4
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractClassRegistry);
5
- if (!contractInstance) {
6
- throw new Error("ContractClassRegistry is not registered in this wallet's instance");
7
- }
8
- const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
9
- return new UnsafeContract(contractInstance, artifact, wallet);
10
- }
11
- /** Returns a Contract wrapper for the contract instance registry. */ export async function getInstanceRegistryContract(wallet) {
12
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.ContractInstanceRegistry);
13
- if (!contractInstance) {
14
- throw new Error("ContractInstanceRegistry is not registered in this wallet's instance");
15
- }
16
- const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
17
- return new UnsafeContract(contractInstance, artifact, wallet);
18
- }
19
- /** Returns a Contract wrapper for the fee juice contract */ export async function getFeeJuice(wallet) {
20
- const { contractInstance } = await wallet.getContractMetadata(ProtocolContractAddress.FeeJuice);
21
- if (!contractInstance) {
22
- throw new Error("FeeJuice is not registered in this wallet's instance");
23
- }
24
- const { artifact } = await wallet.getContractClassMetadata(contractInstance.currentContractClassId, true);
25
- return new UnsafeContract(contractInstance, artifact, wallet);
26
- }
@@ -1,51 +0,0 @@
1
- import type { FieldsOf } from '@aztec/foundation/types';
2
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
- import { TxHash, type TxReceipt } from '@aztec/stdlib/tx';
4
- import type { Wallet } from '../wallet/wallet.js';
5
- /** Options related to waiting for a tx. */
6
- export type WaitOpts = {
7
- /** The amount of time to ignore TxStatus.DROPPED receipts (in seconds) due to the presumption that it is being propagated by the p2p network. Defaults to 5. */
8
- ignoreDroppedReceiptsFor?: number;
9
- /** The maximum time (in seconds) to wait for the transaction to be mined. Defaults to 60. */
10
- timeout?: number;
11
- /** The time interval (in seconds) between retries to fetch the transaction receipt. Defaults to 1. */
12
- interval?: number;
13
- /** Whether to accept a revert as a status code for the tx when waiting for it. If false, will throw if the tx reverts. */
14
- dontThrowOnRevert?: boolean;
15
- };
16
- export declare const DefaultWaitOpts: WaitOpts;
17
- /**
18
- * The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
19
- * its hash, receipt, and mining status.
20
- */
21
- export declare class SentTx {
22
- protected walletOrNode: Wallet | AztecNode;
23
- protected sendTxPromise: Promise<void>;
24
- protected sendTxError?: Error;
25
- protected txHash?: TxHash;
26
- constructor(walletOrNode: Wallet | AztecNode, sendTx: () => Promise<TxHash>);
27
- /**
28
- * Retrieves the transaction hash of the SentTx instance.
29
- * The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
30
- *
31
- * @returns A promise that resolves to the transaction hash of the SentTx instance.
32
- * TODO(#7717): Don't throw here.
33
- */
34
- getTxHash(): Promise<TxHash>;
35
- /**
36
- * Retrieve the transaction receipt associated with the current SentTx instance.
37
- * The function fetches the transaction hash using 'getTxHash' and then queries
38
- * the PXE to get the corresponding transaction receipt.
39
- *
40
- * @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
41
- */
42
- getReceipt(): Promise<TxReceipt>;
43
- /**
44
- * Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
45
- * @param opts - Options for configuring the waiting for the tx to be mined.
46
- * @returns The transaction receipt.
47
- */
48
- wait(opts?: WaitOpts): Promise<FieldsOf<TxReceipt>>;
49
- protected waitForReceipt(opts?: WaitOpts): Promise<TxReceipt>;
50
- }
51
- //# sourceMappingURL=sent_tx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sent_tx.d.ts","sourceRoot":"","sources":["../../src/contract/sent_tx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,kBAAkB,CAAC;AAEpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,2CAA2C;AAC3C,MAAM,MAAM,QAAQ,GAAG;IACrB,gKAAgK;IAChK,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sGAAsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0HAA0H;IAC1H,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,QAI7B,CAAC;AAEF;;;GAGG;AACH,qBAAa,MAAM;IAMf,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS;IAL5C,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,SAAS,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC9B,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGd,YAAY,EAAE,MAAM,GAAG,SAAS,EAC1C,MAAM,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;IAgB/B;;;;;;OAMG;IACU,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAazC;;;;;;OAMG;IACU,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAK7C;;;;OAIG;IACU,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;cAUhD,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CA6BpE"}
@@ -1,90 +0,0 @@
1
- import { promiseWithResolvers } from '@aztec/foundation/promise';
2
- import { retryUntil } from '@aztec/foundation/retry';
3
- import { TxStatus } from '@aztec/stdlib/tx';
4
- export const DefaultWaitOpts = {
5
- ignoreDroppedReceiptsFor: 5,
6
- timeout: 60,
7
- interval: 1
8
- };
9
- /**
10
- * The SentTx class represents a sent transaction through the PXE (or directly to a node) providing methods to fetch
11
- * its hash, receipt, and mining status.
12
- */ export class SentTx {
13
- walletOrNode;
14
- sendTxPromise;
15
- sendTxError;
16
- txHash;
17
- constructor(walletOrNode, sendTx){
18
- this.walletOrNode = walletOrNode;
19
- const { promise, resolve } = promiseWithResolvers();
20
- this.sendTxPromise = promise;
21
- sendTx().then((txHash)=>{
22
- this.txHash = txHash;
23
- resolve();
24
- }).catch((err)=>{
25
- this.sendTxError = err;
26
- // Calling resolve instead of reject here because we want to throw the error when getTxHash is called.
27
- resolve();
28
- });
29
- }
30
- /**
31
- * Retrieves the transaction hash of the SentTx instance.
32
- * The function internally awaits for the 'txHashPromise' to resolve, and then returns the resolved transaction hash.
33
- *
34
- * @returns A promise that resolves to the transaction hash of the SentTx instance.
35
- * TODO(#7717): Don't throw here.
36
- */ async getTxHash() {
37
- // Make sure sendTx has been resolved, which can be triggered when it returns a txHash or when it throws an error.
38
- await this.sendTxPromise;
39
- // If sendTx threw an error, throw it.
40
- if (this.sendTxError) {
41
- throw this.sendTxError;
42
- }
43
- // sendTx returned a txHash if it's been resolved and no error was set.
44
- return Promise.resolve(this.txHash);
45
- }
46
- /**
47
- * Retrieve the transaction receipt associated with the current SentTx instance.
48
- * The function fetches the transaction hash using 'getTxHash' and then queries
49
- * the PXE to get the corresponding transaction receipt.
50
- *
51
- * @returns A promise that resolves to a TxReceipt object representing the fetched transaction receipt.
52
- */ async getReceipt() {
53
- const txHash = await this.getTxHash();
54
- return await this.walletOrNode.getTxReceipt(txHash);
55
- }
56
- /**
57
- * Awaits for a tx to be mined and returns the receipt. Throws if tx is not mined.
58
- * @param opts - Options for configuring the waiting for the tx to be mined.
59
- * @returns The transaction receipt.
60
- */ async wait(opts) {
61
- const receipt = await this.waitForReceipt(opts);
62
- if (receipt.status !== TxStatus.SUCCESS && !opts?.dontThrowOnRevert) {
63
- throw new Error(`Transaction ${(await this.getTxHash()).toString()} was ${receipt.status}. Reason: ${receipt.error ?? 'unknown'}`);
64
- }
65
- return receipt;
66
- }
67
- async waitForReceipt(opts) {
68
- const txHash = await this.getTxHash();
69
- const startTime = Date.now();
70
- const ignoreDroppedReceiptsFor = opts?.ignoreDroppedReceiptsFor ?? DefaultWaitOpts.ignoreDroppedReceiptsFor;
71
- return await retryUntil(async ()=>{
72
- const txReceipt = await this.walletOrNode.getTxReceipt(txHash);
73
- // If receipt is not yet available, try again
74
- if (txReceipt.status === TxStatus.PENDING) {
75
- return undefined;
76
- }
77
- // If the tx was "dropped", either return it or ignore based on timing.
78
- // We can ignore it at first because the transaction may have been sent to node 1, and now we're asking node 2 for the receipt.
79
- // If we don't allow a short grace period, we could incorrectly return a TxReceipt with status DROPPED.
80
- if (txReceipt.status === TxStatus.DROPPED) {
81
- const elapsedSeconds = (Date.now() - startTime) / 1000;
82
- if (!ignoreDroppedReceiptsFor || elapsedSeconds > ignoreDroppedReceiptsFor) {
83
- return txReceipt;
84
- }
85
- return undefined;
86
- }
87
- return txReceipt;
88
- }, 'isMined', opts?.timeout ?? DefaultWaitOpts.timeout, opts?.interval ?? DefaultWaitOpts.interval);
89
- }
90
- }
@@ -1,15 +0,0 @@
1
- import type { ContractArtifact } from '@aztec/stdlib/abi';
2
- import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
- import type { Wallet } from '../wallet/wallet.js';
4
- import { ContractBase } from './contract_base.js';
5
- /** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */
6
- export declare class UnsafeContract extends ContractBase {
7
- constructor(
8
- /** The deployed contract instance definition. */
9
- instance: ContractInstanceWithAddress,
10
- /** The Application Binary Interface for the contract. */
11
- artifact: ContractArtifact,
12
- /** The wallet used for interacting with this contract. */
13
- wallet: Wallet);
14
- }
15
- //# sourceMappingURL=unsafe_contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unsafe_contract.d.ts","sourceRoot":"","sources":["../../src/contract/unsafe_contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,iHAAiH;AACjH,qBAAa,cAAe,SAAQ,YAAY;;IAE5C,iDAAiD;IACjD,QAAQ,EAAE,2BAA2B;IACrC,yDAAyD;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,0DAA0D;IAC1D,MAAM,EAAE,MAAM;CAIjB"}
@@ -1,6 +0,0 @@
1
- import { ContractBase } from './contract_base.js';
2
- /** Unsafe constructor for ContractBase that bypasses the check that the instance is registered in the wallet. */ export class UnsafeContract extends ContractBase {
3
- constructor(/** The deployed contract instance definition. */ instance, /** The Application Binary Interface for the contract. */ artifact, /** The wallet used for interacting with this contract. */ wallet){
4
- super(instance, artifact, wallet);
5
- }
6
- }
@@ -1,24 +0,0 @@
1
- import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
2
- import type { ContractFunctionInteraction } from '../contract/contract_function_interaction.js';
3
- import type { Wallet } from '../wallet/index.js';
4
- /**
5
- * Sets up a call to broadcast a private function's bytecode via the ClassRegistry contract.
6
- * Note that this is not required for users to call the function, but is rather a convenience to make
7
- * this code publicly available so dapps or wallets do not need to redistribute it.
8
- * @param wallet - Wallet to send the transaction.
9
- * @param artifact - Contract artifact that contains the function to be broadcast.
10
- * @param selector - Selector of the function to be broadcast.
11
- * @returns A ContractFunctionInteraction object that can be used to send the transaction.
12
- */
13
- export declare function broadcastPrivateFunction(wallet: Wallet, artifact: ContractArtifact, selector: FunctionSelector): Promise<ContractFunctionInteraction>;
14
- /**
15
- * Sets up a call to broadcast a utility function's bytecode via the ClassRegistry contract.
16
- * Note that this is not required for users to call the function, but is rather a convenience to make
17
- * this code publicly available so dapps or wallets do not need to redistribute it.
18
- * @param wallet - Wallet to send the transaction.
19
- * @param artifact - Contract artifact that contains the function to be broadcast.
20
- * @param selector - Selector of the function to be broadcast.
21
- * @returns A ContractFunctionInteraction object that can be used to send the transaction.
22
- */
23
- export declare function broadcastUtilityFunction(wallet: Wallet, artifact: ContractArtifact, selector: FunctionSelector): Promise<ContractFunctionInteraction>;
24
- //# sourceMappingURL=broadcast_function.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broadcast_function.d.ts","sourceRoot":"","sources":["../../src/deployment/broadcast_function.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgC,MAAM,mBAAmB,CAAC;AAS1G,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CAoDtC;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,2BAA2B,CAAC,CA8CtC"}
@@ -1,74 +0,0 @@
1
- import { ARTIFACT_FUNCTION_TREE_MAX_HEIGHT, CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS } from '@aztec/constants';
2
- import { padArrayEnd } from '@aztec/foundation/collection';
3
- import { Fr } from '@aztec/foundation/fields';
4
- import { ProtocolContractAddress } from '@aztec/protocol-contracts';
5
- import { FunctionSelector, FunctionType, bufferAsFields } from '@aztec/stdlib/abi';
6
- import { computeVerificationKeyHash, createPrivateFunctionMembershipProof, createUtilityFunctionMembershipProof, getContractClassFromArtifact } from '@aztec/stdlib/contract';
7
- import { Capsule } from '@aztec/stdlib/tx';
8
- import { getClassRegistryContract } from '../contract/protocol_contracts.js';
9
- /**
10
- * Sets up a call to broadcast a private function's bytecode via the ClassRegistry contract.
11
- * Note that this is not required for users to call the function, but is rather a convenience to make
12
- * this code publicly available so dapps or wallets do not need to redistribute it.
13
- * @param wallet - Wallet to send the transaction.
14
- * @param artifact - Contract artifact that contains the function to be broadcast.
15
- * @param selector - Selector of the function to be broadcast.
16
- * @returns A ContractFunctionInteraction object that can be used to send the transaction.
17
- */ export async function broadcastPrivateFunction(wallet, artifact, selector) {
18
- const contractClass = await getContractClassFromArtifact(artifact);
19
- const privateFunctions = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PRIVATE);
20
- const functionsAndSelectors = await Promise.all(privateFunctions.map(async (fn)=>({
21
- f: fn,
22
- selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters)
23
- })));
24
- const privateFunctionArtifact = functionsAndSelectors.find((fn)=>selector.equals(fn.selector))?.f;
25
- if (!privateFunctionArtifact) {
26
- throw new Error(`Private function with selector ${selector.toString()} not found`);
27
- }
28
- const { artifactTreeSiblingPath, artifactTreeLeafIndex, artifactMetadataHash, functionMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex } = await createPrivateFunctionMembershipProof(selector, artifact);
29
- const vkHash = await computeVerificationKeyHash(privateFunctionArtifact);
30
- const classRegistry = await getClassRegistryContract(wallet);
31
- const bytecode = bufferAsFields(privateFunctionArtifact.bytecode, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS);
32
- return classRegistry.methods.broadcast_private_function(contractClass.id, artifactMetadataHash, utilityFunctionsTreeRoot, privateFunctionTreeSiblingPath, privateFunctionTreeLeafIndex, padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT), artifactTreeLeafIndex, // eslint-disable-next-line camelcase
33
- {
34
- selector,
35
- metadata_hash: functionMetadataHash,
36
- vk_hash: vkHash
37
- }).with({
38
- capsules: [
39
- new Capsule(ProtocolContractAddress.ContractClassRegistry, new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT), bytecode)
40
- ]
41
- });
42
- }
43
- /**
44
- * Sets up a call to broadcast a utility function's bytecode via the ClassRegistry contract.
45
- * Note that this is not required for users to call the function, but is rather a convenience to make
46
- * this code publicly available so dapps or wallets do not need to redistribute it.
47
- * @param wallet - Wallet to send the transaction.
48
- * @param artifact - Contract artifact that contains the function to be broadcast.
49
- * @param selector - Selector of the function to be broadcast.
50
- * @returns A ContractFunctionInteraction object that can be used to send the transaction.
51
- */ export async function broadcastUtilityFunction(wallet, artifact, selector) {
52
- const contractClass = await getContractClassFromArtifact(artifact);
53
- const utilityFunctions = artifact.functions.filter((fn)=>fn.functionType === FunctionType.UTILITY);
54
- const utilityFunctionsAndSelectors = await Promise.all(utilityFunctions.map(async (fn)=>({
55
- f: fn,
56
- selector: await FunctionSelector.fromNameAndParameters(fn.name, fn.parameters)
57
- })));
58
- const utilityFunctionArtifact = utilityFunctionsAndSelectors.find((fn)=>selector.equals(fn.selector))?.f;
59
- if (!utilityFunctionArtifact) {
60
- throw new Error(`Utility function with selector ${selector.toString()} not found`);
61
- }
62
- const { artifactMetadataHash, artifactTreeLeafIndex, artifactTreeSiblingPath, functionMetadataHash, privateFunctionsArtifactTreeRoot } = await createUtilityFunctionMembershipProof(selector, artifact);
63
- const classRegistry = await getClassRegistryContract(wallet);
64
- const bytecode = bufferAsFields(utilityFunctionArtifact.bytecode, MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS);
65
- return classRegistry.methods.broadcast_utility_function(contractClass.id, artifactMetadataHash, privateFunctionsArtifactTreeRoot, padArrayEnd(artifactTreeSiblingPath, Fr.ZERO, ARTIFACT_FUNCTION_TREE_MAX_HEIGHT), artifactTreeLeafIndex, // eslint-disable-next-line camelcase
66
- {
67
- selector,
68
- metadata_hash: functionMetadataHash
69
- }).with({
70
- capsules: [
71
- new Capsule(ProtocolContractAddress.ContractClassRegistry, new Fr(CONTRACT_CLASS_REGISTRY_BYTECODE_CAPSULE_SLOT), bytecode)
72
- ]
73
- });
74
- }
@@ -1,91 +0,0 @@
1
- import { AccountFeePaymentMethodOptions } from '@aztec/entrypoints/account';
2
- import type { ChainInfo } from '@aztec/entrypoints/interfaces';
3
- import { ExecutionPayload } from '@aztec/entrypoints/payload';
4
- import { Fr } from '@aztec/foundation/fields';
5
- import type { ContractArtifact, EventMetadataDefinition } from '@aztec/stdlib/abi';
6
- import type { AuthWitness } from '@aztec/stdlib/auth-witness';
7
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import { type ContractClassMetadata, type ContractInstanceWithAddress, type ContractInstantiationData, type ContractMetadata } from '@aztec/stdlib/contract';
9
- import { GasSettings } from '@aztec/stdlib/gas';
10
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
11
- import type { TxExecutionRequest, TxHash, TxProfileResult, TxReceipt, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
12
- import type { Account } from '../account/account.js';
13
- import type { FeePaymentMethod } from '../fee/fee_payment_method.js';
14
- import type { CallIntent, IntentInnerHash } from '../utils/authwit.js';
15
- import type { Aliased, BatchResults, BatchableMethods, BatchedMethod, ContractInstanceAndArtifact, ProfileOptions, SendOptions, SimulateOptions, UserFeeOptions, Wallet } from './wallet.js';
16
- /**
17
- * Options to configure fee payment for a transaction
18
- */
19
- export type FeeOptions = {
20
- /**
21
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
22
- * doesn't already include one
23
- */
24
- walletFeePaymentMethod?: FeePaymentMethod;
25
- /** Configuration options for the account to properly handle the selected fee payment method */
26
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
27
- /** The gas settings to use for the transaction */
28
- gasSettings: GasSettings;
29
- };
30
- /**
31
- * A base class for Wallet implementations
32
- */
33
- export declare abstract class BaseWallet implements Wallet {
34
- protected readonly pxe: any;
35
- protected readonly aztecNode: AztecNode;
36
- protected log: import("@aztec/foundation/log").Logger;
37
- protected baseFeePadding: number;
38
- protected cancellableTransactions: boolean;
39
- protected constructor(pxe: any, aztecNode: AztecNode);
40
- protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
41
- abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
42
- /**
43
- * Returns the list of aliased contacts associated with the wallet.
44
- * This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
45
- * - Senders: Addresses we check during synching in case they sent us notes,
46
- * - Contacts: more general concept akin to a phone's contact list.
47
- * @returns The aliased collection of AztecAddresses that form this wallet's address book
48
- */
49
- getAddressBook(): Promise<Aliased<AztecAddress>[]>;
50
- getChainInfo(): Promise<ChainInfo>;
51
- protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
52
- createAuthWit(from: AztecAddress, messageHashOrIntent: Fr | Buffer | IntentInnerHash | CallIntent): Promise<AuthWitness>;
53
- batch<const T extends readonly BatchedMethod<keyof BatchableMethods>[]>(methods: T): Promise<BatchResults<T>>;
54
- /**
55
- * Returns default values for the transaction fee options
56
- * if they were omitted by the user.
57
- * @param from - The address where the transaction is being sent from
58
- * @param userFeeOptions - User-provided fee options, which might be incomplete
59
- * @returns - Populated fee options that can be used to create a transaction execution request
60
- */
61
- protected getDefaultFeeOptions(from: AztecAddress, userFeeOptions?: UserFeeOptions): Promise<FeeOptions>;
62
- /**
63
- * Returns unreasonably high gas limits in order to execute a simulation
64
- * with the goal of estimating its gas cost. It will otherwise try to respect
65
- * the user-specified fee options, filling the gaps with default values as needed.
66
- * @param from - The address where the transaction is being sent from
67
- * @param userFeeOptions - User-provided fee options to use as a basis for the fully populated `FeeOptions` type.
68
- */
69
- protected getFeeOptionsForGasEstimation(from: AztecAddress, userFeeOptions?: UserFeeOptions): Promise<{
70
- gasSettings: GasSettings;
71
- /**
72
- * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
73
- * doesn't already include one
74
- */
75
- walletFeePaymentMethod?: FeePaymentMethod;
76
- /** Configuration options for the account to properly handle the selected fee payment method */
77
- accountFeePaymentMethodOptions: AccountFeePaymentMethodOptions;
78
- }>;
79
- registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
80
- registerContract(instanceData: AztecAddress | ContractInstanceWithAddress | ContractInstantiationData | ContractInstanceAndArtifact, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
81
- simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
82
- profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
83
- sendTx(executionPayload: ExecutionPayload, opts: SendOptions): Promise<TxHash>;
84
- protected contextualizeError(err: Error, ...context: string[]): Error;
85
- simulateUtility(functionName: string, args: any[], to: AztecAddress, authwits?: AuthWitness[], from?: AztecAddress): Promise<UtilitySimulationResult>;
86
- getContractClassMetadata(id: Fr, includeArtifact?: boolean): Promise<ContractClassMetadata>;
87
- getContractMetadata(address: AztecAddress): Promise<ContractMetadata>;
88
- getTxReceipt(txHash: TxHash): Promise<TxReceipt>;
89
- getPrivateEvents<T>(contractAddress: AztecAddress, event: EventMetadataDefinition, from: number, limit: number, recipients?: AztecAddress[]): Promise<T[]>;
90
- }
91
- //# sourceMappingURL=base_wallet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base_wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/base_wallet.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,8BAA8B,EAAwC,MAAM,4BAA4B,CAAC;AAClH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAA0B,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EAItB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAO,WAAW,EAAE,MAAM,mBAAmB,CAAC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