@walletmesh/aztec-rpc-wallet 0.3.0 → 0.4.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 (185) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +290 -228
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/client/aztec-dapp-wallet.d.ts +401 -0
  5. package/dist/client/aztec-dapp-wallet.d.ts.map +1 -0
  6. package/dist/client/aztec-dapp-wallet.js +705 -0
  7. package/dist/client/aztec-router-provider.d.ts +58 -0
  8. package/dist/client/aztec-router-provider.d.ts.map +1 -0
  9. package/dist/client/aztec-router-provider.js +62 -0
  10. package/dist/client/helpers.d.ts +44 -0
  11. package/dist/client/helpers.d.ts.map +1 -0
  12. package/dist/client/helpers.js +79 -0
  13. package/dist/client/register-serializers.d.ts +41 -0
  14. package/dist/client/register-serializers.d.ts.map +1 -0
  15. package/dist/client/register-serializers.js +97 -0
  16. package/dist/contractArtifactCache.d.ts +49 -32
  17. package/dist/contractArtifactCache.d.ts.map +1 -1
  18. package/dist/contractArtifactCache.js +47 -34
  19. package/dist/errors.d.ts +50 -8
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +50 -10
  22. package/dist/index.d.ts +53 -40
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +52 -17
  25. package/dist/types.d.ts +345 -268
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/types.js +10 -8
  28. package/dist/wallet/create-node.d.ts +73 -0
  29. package/dist/wallet/create-node.d.ts.map +1 -0
  30. package/dist/wallet/create-node.js +99 -0
  31. package/dist/wallet/handlers/account.d.ts +67 -0
  32. package/dist/wallet/handlers/account.d.ts.map +1 -0
  33. package/dist/wallet/handlers/account.js +85 -0
  34. package/dist/wallet/handlers/contract-interaction.d.ts +77 -0
  35. package/dist/wallet/handlers/contract-interaction.d.ts.map +1 -0
  36. package/dist/wallet/handlers/contract-interaction.js +219 -0
  37. package/dist/wallet/handlers/contract.d.ts +96 -0
  38. package/dist/wallet/handlers/contract.d.ts.map +1 -0
  39. package/dist/wallet/handlers/contract.js +146 -0
  40. package/dist/wallet/handlers/event.d.ts +62 -0
  41. package/dist/wallet/handlers/event.d.ts.map +1 -0
  42. package/dist/wallet/handlers/event.js +85 -0
  43. package/dist/wallet/handlers/index.d.ts +88 -0
  44. package/dist/wallet/handlers/index.d.ts.map +1 -0
  45. package/dist/wallet/handlers/index.js +47 -0
  46. package/dist/wallet/handlers/node.d.ts +117 -0
  47. package/dist/wallet/handlers/node.d.ts.map +1 -0
  48. package/dist/wallet/handlers/node.js +196 -0
  49. package/dist/wallet/handlers/senders.d.ts +70 -0
  50. package/dist/wallet/handlers/senders.d.ts.map +1 -0
  51. package/dist/wallet/handlers/senders.js +92 -0
  52. package/dist/wallet/handlers/transaction.d.ts +123 -0
  53. package/dist/wallet/handlers/transaction.d.ts.map +1 -0
  54. package/dist/wallet/handlers/transaction.js +191 -0
  55. package/dist/wallet/serializers.d.ts +75 -0
  56. package/dist/wallet/serializers.d.ts.map +1 -0
  57. package/dist/wallet/serializers.js +501 -0
  58. package/docs/README.md +290 -229
  59. package/docs/classes/AztecDappWallet.md +1304 -0
  60. package/docs/classes/AztecRouterProvider.md +1058 -0
  61. package/docs/classes/AztecWalletError.md +124 -47
  62. package/docs/classes/ContractArtifactCache.md +48 -31
  63. package/docs/functions/connectAztec.md +62 -0
  64. package/docs/functions/createAztecWallet.md +46 -0
  65. package/docs/functions/createAztecWalletNode.md +96 -0
  66. package/docs/functions/registerAztecSerializers.md +61 -0
  67. package/docs/functions/registerWalletAztecSerializers.md +39 -0
  68. package/docs/globals.md +16 -14
  69. package/docs/interfaces/AztecHandlerContext.md +54 -0
  70. package/docs/interfaces/AztecWalletContext.md +50 -0
  71. package/docs/interfaces/AztecWalletMethodMap.md +471 -470
  72. package/docs/type-aliases/AztecChainId.md +16 -3
  73. package/docs/variables/ALL_AZTEC_METHODS.md +20 -0
  74. package/docs/variables/AztecWalletErrorMap.md +9 -4
  75. package/docs/variables/AztecWalletSerializer.md +45 -0
  76. package/package.json +9 -9
  77. package/src/client/aztec-dapp-wallet.test.ts +628 -0
  78. package/src/client/aztec-dapp-wallet.ts +879 -0
  79. package/src/client/aztec-router-provider.test.ts +235 -0
  80. package/src/client/aztec-router-provider.ts +64 -0
  81. package/src/client/helpers.test.ts +187 -0
  82. package/src/client/helpers.ts +91 -0
  83. package/src/client/register-serializers.ts +108 -0
  84. package/src/contractArtifactCache.test.ts +21 -10
  85. package/src/contractArtifactCache.ts +54 -35
  86. package/src/errors.ts +58 -10
  87. package/src/index.test.ts +2 -6
  88. package/src/index.ts +73 -37
  89. package/src/types.ts +379 -217
  90. package/src/wallet/create-node.test.ts +332 -0
  91. package/src/wallet/create-node.ts +120 -0
  92. package/src/wallet/handlers/account.test.ts +172 -0
  93. package/src/wallet/handlers/account.ts +99 -0
  94. package/src/wallet/handlers/contract-interaction.test.ts +248 -0
  95. package/src/wallet/handlers/contract-interaction.ts +269 -0
  96. package/src/wallet/handlers/contract.test.ts +245 -0
  97. package/src/wallet/handlers/contract.ts +174 -0
  98. package/src/wallet/handlers/event.test.ts +216 -0
  99. package/src/wallet/handlers/event.ts +99 -0
  100. package/src/wallet/handlers/index.ts +84 -0
  101. package/src/wallet/handlers/node.test.ts +304 -0
  102. package/src/wallet/handlers/node.ts +230 -0
  103. package/src/wallet/handlers/senders.test.ts +172 -0
  104. package/src/wallet/handlers/senders.ts +106 -0
  105. package/src/wallet/handlers/transaction.test.ts +371 -0
  106. package/src/wallet/handlers/transaction.ts +239 -0
  107. package/src/wallet/serializers.test.ts +253 -0
  108. package/src/wallet/serializers.ts +586 -0
  109. package/typedoc.json +23 -1
  110. package/dist/aztecRemoteWallet.d.ts +0 -70
  111. package/dist/aztecRemoteWallet.d.ts.map +0 -1
  112. package/dist/aztecRemoteWallet.js +0 -335
  113. package/dist/chainProvider.d.ts +0 -56
  114. package/dist/chainProvider.d.ts.map +0 -1
  115. package/dist/chainProvider.js +0 -98
  116. package/dist/handlers/aztecAccountWallet.d.ts +0 -4
  117. package/dist/handlers/aztecAccountWallet.d.ts.map +0 -1
  118. package/dist/handlers/aztecAccountWallet.js +0 -296
  119. package/dist/handlers/transactions.d.ts +0 -21
  120. package/dist/handlers/transactions.d.ts.map +0 -1
  121. package/dist/handlers/transactions.js +0 -98
  122. package/dist/handlers.d.ts +0 -27
  123. package/dist/handlers.d.ts.map +0 -1
  124. package/dist/handlers.js +0 -55
  125. package/dist/provider.d.ts +0 -105
  126. package/dist/provider.d.ts.map +0 -1
  127. package/dist/provider.js +0 -160
  128. package/dist/serializers/account.d.ts +0 -164
  129. package/dist/serializers/account.d.ts.map +0 -1
  130. package/dist/serializers/account.js +0 -244
  131. package/dist/serializers/contract.d.ts +0 -62
  132. package/dist/serializers/contract.d.ts.map +0 -1
  133. package/dist/serializers/contract.js +0 -130
  134. package/dist/serializers/index.d.ts +0 -21
  135. package/dist/serializers/index.d.ts.map +0 -1
  136. package/dist/serializers/index.js +0 -154
  137. package/dist/serializers/log.d.ts +0 -66
  138. package/dist/serializers/log.d.ts.map +0 -1
  139. package/dist/serializers/log.js +0 -222
  140. package/dist/serializers/note.d.ts +0 -124
  141. package/dist/serializers/note.d.ts.map +0 -1
  142. package/dist/serializers/note.js +0 -208
  143. package/dist/serializers/transaction.d.ts +0 -99
  144. package/dist/serializers/transaction.d.ts.map +0 -1
  145. package/dist/serializers/transaction.js +0 -275
  146. package/dist/wallet.d.ts +0 -62
  147. package/dist/wallet.d.ts.map +0 -1
  148. package/dist/wallet.js +0 -77
  149. package/docs/classes/AztecChainProvider.md +0 -553
  150. package/docs/classes/AztecChainWallet.md +0 -409
  151. package/docs/classes/AztecProvider.md +0 -1112
  152. package/docs/interfaces/AztecWalletBaseMethodMap.md +0 -135
  153. package/docs/interfaces/AztecWalletEventMap.md +0 -17
  154. package/docs/type-aliases/AztecChainWalletMiddleware.md +0 -13
  155. package/docs/type-aliases/AztecWalletContext.md +0 -29
  156. package/docs/type-aliases/AztecWalletMethodHandler.md +0 -37
  157. package/docs/type-aliases/AztecWalletMiddleware.md +0 -13
  158. package/docs/type-aliases/AztecWalletRouterClient.md +0 -13
  159. package/docs/type-aliases/TransactionFunctionCall.md +0 -33
  160. package/docs/type-aliases/TransactionParams.md +0 -27
  161. package/src/aztecRemoteWallet.test.ts +0 -504
  162. package/src/aztecRemoteWallet.ts +0 -467
  163. package/src/chainProvider.test.ts +0 -401
  164. package/src/chainProvider.ts +0 -116
  165. package/src/handlers/aztecAccountWallet.test.ts +0 -649
  166. package/src/handlers/aztecAccountWallet.ts +0 -532
  167. package/src/handlers/transactions.ts +0 -124
  168. package/src/handlers.test.ts +0 -270
  169. package/src/handlers.ts +0 -70
  170. package/src/provider.test.ts +0 -274
  171. package/src/provider.ts +0 -189
  172. package/src/serializers/account.test.ts +0 -125
  173. package/src/serializers/account.ts +0 -301
  174. package/src/serializers/contract.test.ts +0 -24
  175. package/src/serializers/contract.ts +0 -183
  176. package/src/serializers/index.test.ts +0 -136
  177. package/src/serializers/index.ts +0 -191
  178. package/src/serializers/log.test.ts +0 -286
  179. package/src/serializers/log.ts +0 -292
  180. package/src/serializers/note.test.ts +0 -125
  181. package/src/serializers/note.ts +0 -250
  182. package/src/serializers/transaction.test.ts +0 -320
  183. package/src/serializers/transaction.ts +0 -409
  184. package/src/wallet.test.ts +0 -275
  185. package/src/wallet.ts +0 -94
package/dist/types.d.ts CHANGED
@@ -1,368 +1,445 @@
1
- import type { AuthWitness, AztecAddress, ContractArtifact, ContractInstanceWithAddress, ExtendedNote, Fr, PXE, TxExecutionRequest, TxHash, TxReceipt, L2Block, LogFilter, Point, SiblingPath, PartialAddress, CompleteAddress, NodeInfo, AccountWallet, Tx } from '@aztec/aztec.js';
1
+ import type { AuthWitness, AztecAddress, Fr, PXE, TxExecutionRequest, TxHash, TxReceipt, L2Block, CompleteAddress, AccountWallet, Tx } from '@aztec/aztec.js';
2
2
  import type { IntentAction, IntentInnerHash } from '@aztec/aztec.js/utils';
3
- import type { ExecutionRequestInit } from '@aztec/aztec.js/entrypoint';
4
- import type { AbiDecoded } from '@aztec/foundation/abi';
5
- import type { InBlock, NotesFilter, EventMetadataDefinition, PrivateExecutionResult, TxEffect, TxProvingResult, UniqueNote, PXEInfo, TxSimulationResult, GetPublicLogsResponse, GetContractClassLogsResponse, ContractMetadata, ContractClassMetadata } from '@aztec/circuit-types';
6
- import type { GasFees, L1_TO_L2_MSG_TREE_HEIGHT } from '@aztec/circuits.js';
7
- import type { JSONRPCEventMap, JSONRPCMiddleware } from '@walletmesh/jsonrpc';
8
- import type { JSONRPCWalletClient, WalletMethodMap } from '@walletmesh/router';
9
- import type { ContractArtifactCache } from './contractArtifactCache.js';
3
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
10
4
  /**
11
- * Represents a single function call to a contract.
12
- * @public
5
+ * @module @walletmesh/aztec-rpc-wallet/types
6
+ *
7
+ * This module defines core types and interfaces used throughout the Aztec RPC Wallet package.
8
+ * Key definitions include:
9
+ * - {@link AztecChainId}: A type-safe representation of Aztec chain identifiers.
10
+ * - {@link AztecWalletContext}: The context object passed to wallet-side RPC method handlers.
11
+ * - {@link AztecWalletMethodMap}: A comprehensive map detailing all supported Aztec JSON-RPC
12
+ * methods, their parameters, and return types. This is central to the typed RPC system.
13
13
  */
14
- export type TransactionFunctionCall = {
15
- /** The address of the contract to interact with */
16
- contractAddress: string;
17
- /** The name of the function to call */
18
- functionName: string;
19
- /** The arguments to pass to the function */
20
- args: unknown[];
21
- };
14
+ import type { PrivateExecutionResult, TxProfileResult, TxProvingResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
15
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
16
+ import type { ContractClassMetadata, ContractMetadata, EventMetadataDefinition, PXEInfo } from '@aztec/stdlib/interfaces/client';
17
+ import type { GasFees } from '@aztec/stdlib/gas';
18
+ import type { ContractInstanceWithAddress, NodeInfo } from '@aztec/stdlib/contract';
19
+ import type { WalletMethodMap } from '@walletmesh/router';
20
+ import type { ContractArtifactCache } from './contractArtifactCache.js';
22
21
  /**
23
- * Parameters for sending transactions.
24
- * @public
22
+ * Type-safe Aztec chain ID format following the CAIP-2 standard.
23
+ *
24
+ * Format: `aztec:{reference}` where reference is typically:
25
+ * - "mainnet" for the main Aztec network
26
+ * - A numeric chain ID for test networks (e.g., "31337" for local development)
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const mainnetChainId: AztecChainId = "aztec:mainnet";
31
+ * const localChainId: AztecChainId = "aztec:31337";
32
+ * ```
25
33
  */
26
- export type TransactionParams = {
27
- /** Array of function calls to execute */
28
- functionCalls: TransactionFunctionCall[];
29
- /** Optional array of authorization witnesses for the transaction */
30
- authwits?: string[];
31
- };
32
- export declare const BASE_WALLET_METHODS: (keyof AztecWalletBaseMethodMap)[];
34
+ export type AztecChainId = `aztec:${string}`;
33
35
  /**
34
- * A mapping of JSON-RPC methods to their parameters and return types for Aztec Wallets.
36
+ * Defines the context object provided to all Aztec wallet-side JSON-RPC method handlers.
37
+ * This context aggregates essential dependencies required by handlers to perform their operations.
35
38
  *
36
- * This extends the base WalletMethodMap with Aztec-specific methods.
37
- * @public
39
+ * @see {@link createAztecWalletNode} where this context is constructed and provided to handlers.
38
40
  */
39
- export interface AztecWalletBaseMethodMap extends WalletMethodMap {
41
+ export interface AztecWalletContext {
40
42
  /**
41
- * Connects to the Aztec network.
42
- * @returns A boolean indicating if the connection was successful
43
+ * The `aztec.js` {@link AccountWallet} instance. This wallet holds the user's account keys
44
+ * and provides methods for signing, creating transactions, and interacting with the PXE.
43
45
  */
44
- aztec_connect: {
45
- result: boolean;
46
- };
47
- /**
48
- * Gets the account address from the wallet.
49
- * @returns The account address as a string
50
- */
51
- aztec_getAccount: {
52
- result: string;
53
- };
54
- /**
55
- * Sends transactions to the Aztec network.
56
- * @param params - The transactions to execute and optional authorization witnesses
57
- * @returns The transaction hash as a string
58
- */
59
- aztec_sendTransaction: {
60
- params: TransactionParams;
61
- result: string;
62
- };
46
+ wallet: AccountWallet;
63
47
  /**
64
- * Simulates a transaction without executing it.
65
- * @param params - The transaction to simulate
66
- * @returns The simulation result
48
+ * The `aztec.js` {@link PXE} (Private Execution Environment) client instance.
49
+ * This is used for interacting with the Aztec network, such as simulating transactions,
50
+ * getting node information, fetching blocks, and managing private state.
67
51
  */
68
- aztec_simulateTransaction: {
69
- params: TransactionFunctionCall;
70
- result: unknown;
71
- };
52
+ pxe: PXE;
72
53
  /**
73
- * Returns the list of supported methods for the wallet.
74
- * @returns An array of supported methods
54
+ * An instance of {@link ContractArtifactCache} used for caching contract artifacts.
55
+ * This helps optimize performance by avoiding redundant fetches of artifact data.
75
56
  */
76
- wm_getSupportedMethods: {
77
- result: string[];
78
- };
79
- }
80
- export interface AztecWalletEventMap extends JSONRPCEventMap {
57
+ cache: ContractArtifactCache;
81
58
  }
82
59
  /**
83
- * Holds the context passed through RPC middleware.
84
- * @public
85
- */
86
- export type AztecWalletContext = Record<string, unknown> & {
87
- /** The PXE instance for the wallet */
88
- pxe: PXE;
89
- wallet: AccountWallet;
90
- contractArtifactCache: ContractArtifactCache;
91
- };
92
- /**
93
- * Type for Aztec Router Wallet middleware.
94
- * @public
95
- */
96
- export type AztecWalletMiddleware = JSONRPCMiddleware<AztecWalletBaseMethodMap, AztecWalletContext>;
97
- /**
98
- * Type for Aztec Chain Wallet middleware.
99
- */
100
- export type AztecChainWalletMiddleware = JSONRPCMiddleware<AztecWalletMethodMap, AztecWalletContext>;
101
- /**
102
- * Type for Aztec wallet router client.
103
- * @public
60
+ * A constant array defining a set of base wallet methods.
61
+ * These methods might be intended for initial wallet discovery or basic connection negotiation.
62
+ * Note: Current connection helpers like `connectAztec` default to `ALL_AZTEC_METHODS`.
63
+ * The `aztec_connect` method listed here is not currently defined in {@link AztecWalletMethodMap}.
64
+ *
65
+ * @readonly
104
66
  */
105
- export type AztecWalletRouterClient = JSONRPCWalletClient<AztecWalletMethodMap>;
67
+ export declare const BASE_WALLET_METHODS: readonly ["wm_getSupportedMethods", "aztec_connect", "aztec_getAddress"];
106
68
  /**
107
- * Type for Aztec wallet RPC method map.
108
- * This extends the AztecWalletBaseMethodMap with the methods used in by Aztec's `AccountWallet`
69
+ * Defines the complete map of all JSON-RPC methods supported by the Aztec RPC Wallet.
70
+ * This interface extends the base {@link WalletMethodMap} from `@walletmesh/router`
71
+ * and specifies the parameter (`params`) and return (`result`) types for each Aztec-specific method.
72
+ *
73
+ * This map is crucial for:
74
+ * - Type safety in both client-side calls and wallet-side handlers.
75
+ * - Guiding the implementation of serializers and deserializers.
76
+ * - Documentation generation, as it serves as a single source of truth for method signatures.
77
+ *
78
+ * Methods are loosely grouped by functionality (Chain/Node, Account, Sender, etc.).
79
+ * "wm_" prefixed methods are typically WalletMesh-specific extensions or conveniences.
80
+ *
81
+ * @see {@link AztecDappWallet} for the client-side implementation that calls these methods.
82
+ * @see {@link createAztecHandlers} for the wallet-side implementation that handles these methods.
109
83
  */
110
- export interface AztecWalletMethodMap extends AztecWalletBaseMethodMap {
84
+ export interface AztecWalletMethodMap extends WalletMethodMap {
85
+ /**
86
+ * Retrieves a list of all JSON-RPC methods supported by this wallet implementation.
87
+ * Allows clients to discover the capabilities of the wallet.
88
+ * @param params - No parameters.
89
+ * @returns result - An array of strings, where each string is a supported method name.
90
+ */
91
+ wm_getSupportedMethods: {
92
+ params: [];
93
+ result: string[];
94
+ };
95
+ /**
96
+ * Retrieves a specific L2 block by its number.
97
+ * @param params - A tuple containing the block number.
98
+ * @param params.0 blockNumber - The number of the block to retrieve.
99
+ * @returns result - The {@link L2Block} data, or null/undefined if not found (behavior depends on PXE).
100
+ */
111
101
  aztec_getBlock: {
112
- params: {
113
- number: number;
114
- };
102
+ params: [number];
115
103
  result: L2Block;
116
104
  };
105
+ /**
106
+ * Retrieves the current (latest) L2 block number.
107
+ * @param params - No parameters.
108
+ * @returns result - The current block number.
109
+ */
117
110
  aztec_getBlockNumber: {
111
+ params: [];
118
112
  result: number;
119
113
  };
114
+ /**
115
+ * Retrieves the chain ID of the connected Aztec network.
116
+ * @param params - No parameters.
117
+ * @returns result - The chain ID as an {@link Fr}.
118
+ */
120
119
  aztec_getChainId: {
121
- result: number;
120
+ params: [];
121
+ result: Fr;
122
122
  };
123
+ /**
124
+ * Retrieves the version of the connected PXE (Private Execution Environment) or node.
125
+ * @param params - No parameters.
126
+ * @returns result - The version as an {@link Fr}.
127
+ */
123
128
  aztec_getVersion: {
124
- result: number;
129
+ params: [];
130
+ result: Fr;
125
131
  };
132
+ /**
133
+ * Retrieves comprehensive information about the connected Aztec node.
134
+ * @param params - No parameters.
135
+ * @returns result - A {@link NodeInfo} object.
136
+ */
126
137
  aztec_getNodeInfo: {
138
+ params: [];
127
139
  result: NodeInfo;
128
140
  };
141
+ /**
142
+ * Retrieves the latest L2 block number that has been proven.
143
+ * @param params - No parameters.
144
+ * @returns result - The latest proven block number.
145
+ */
129
146
  aztec_getProvenBlockNumber: {
147
+ params: [];
130
148
  result: number;
131
149
  };
150
+ /**
151
+ * Retrieves information about the PXE service, including capabilities and version.
152
+ * @param params - No parameters.
153
+ * @returns result - A {@link PXEInfo} object.
154
+ */
132
155
  aztec_getPXEInfo: {
156
+ params: [];
133
157
  result: PXEInfo;
134
158
  };
159
+ /**
160
+ * Retrieves the current base gas fees on the network.
161
+ * @param params - No parameters.
162
+ * @returns result - A {@link GasFees} object.
163
+ */
135
164
  aztec_getCurrentBaseFees: {
165
+ params: [];
136
166
  result: GasFees;
137
167
  };
138
- aztec_setScopes: {
139
- params: {
140
- scopes: AztecAddress[];
141
- };
142
- result: boolean;
143
- };
144
- aztec_getScopes: {
145
- result: AztecAddress[];
146
- };
147
- aztec_isL1ToL2MessageSynced: {
148
- params: {
149
- l1ToL2Message: Fr;
150
- };
151
- result: boolean;
152
- };
153
- aztec_getL1ToL2MembershipWitness: {
154
- params: {
155
- contractAddress: AztecAddress;
156
- messageHash: Fr;
157
- secret: Fr;
158
- };
159
- result: [bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>];
160
- };
161
- aztec_addCapsule: {
162
- params: {
163
- capsule: Fr[];
164
- };
165
- result: boolean;
166
- };
168
+ /**
169
+ * Retrieves the primary {@link AztecAddress} of the wallet's account.
170
+ * @param params - No parameters.
171
+ * @returns result - The wallet's {@link AztecAddress}.
172
+ */
167
173
  aztec_getAddress: {
174
+ params: [];
168
175
  result: AztecAddress;
169
176
  };
177
+ /**
178
+ * Retrieves the {@link CompleteAddress} of the wallet's account, including public keys.
179
+ * @param params - No parameters.
180
+ * @returns result - The wallet's {@link CompleteAddress}.
181
+ */
170
182
  aztec_getCompleteAddress: {
183
+ params: [];
171
184
  result: CompleteAddress;
172
185
  };
173
- aztec_registerAccount: {
174
- params: {
175
- secretKey: Fr;
176
- partialAddress: PartialAddress;
177
- };
178
- result: CompleteAddress;
179
- };
180
- aztec_getRegisteredAccounts: {
181
- result: CompleteAddress[];
182
- };
183
- aztec_addAuthWitness: {
184
- params: {
185
- authWitness: AuthWitness;
186
- };
187
- result: boolean;
188
- };
189
- aztec_getAuthWitness: {
190
- params: {
191
- messageHash: Fr;
192
- };
193
- result: Fr[];
194
- };
186
+ /**
187
+ * Creates an {@link AuthWitness} (authorization witness) for a given message hash or intent.
188
+ * Used for delegating actions.
189
+ * @param params - A tuple containing the intent to authorize.
190
+ * @param params.0 intent - The message hash ({@link Fr} or `Buffer`), {@link IntentInnerHash}, or {@link IntentAction} to authorize.
191
+ * @returns result - The created {@link AuthWitness}.
192
+ */
195
193
  aztec_createAuthWit: {
196
- params: {
197
- intent: Fr | Buffer | IntentAction | IntentInnerHash;
198
- };
194
+ params: [Fr | Buffer | IntentAction | IntentInnerHash];
199
195
  result: AuthWitness;
200
196
  };
201
197
  /**
202
- * Registers a contact in the user's PXE
203
- * @param params - The sender (contact) address to register
204
- * @returns True if registration was successful
198
+ * Registers a new authorized sender {@link AztecAddress}.
199
+ * @param params - A tuple containing the sender's address.
200
+ * @param params.0 senderAddress - The {@link AztecAddress} to authorize.
201
+ * @returns result - The registered {@link AztecAddress}.
205
202
  */
206
203
  aztec_registerSender: {
207
- params: {
208
- sender: AztecAddress;
209
- };
204
+ params: [AztecAddress];
210
205
  result: AztecAddress;
211
206
  };
207
+ /**
208
+ * Retrieves a list of all currently authorized sender {@link AztecAddress}es.
209
+ * @param params - No parameters.
210
+ * @returns result - An array of authorized {@link AztecAddress}es.
211
+ */
212
212
  aztec_getSenders: {
213
+ params: [];
213
214
  result: AztecAddress[];
214
215
  };
216
+ /**
217
+ * Removes an {@link AztecAddress} from the list of authorized senders.
218
+ * @param params - A tuple containing the sender's address.
219
+ * @param params.0 senderAddress - The {@link AztecAddress} to de-authorize.
220
+ * @returns result - `true` if removal was successful.
221
+ */
215
222
  aztec_removeSender: {
216
- params: {
217
- sender: AztecAddress;
218
- };
223
+ params: [AztecAddress];
219
224
  result: boolean;
220
225
  };
226
+ /**
227
+ * Retrieves a list of all {@link AztecAddress}es of contracts known to the PXE/wallet.
228
+ * @param params - No parameters.
229
+ * @returns result - An array of contract {@link AztecAddress}es.
230
+ */
221
231
  aztec_getContracts: {
232
+ params: [];
222
233
  result: AztecAddress[];
223
234
  };
235
+ /**
236
+ * Retrieves {@link ContractMetadata} for a specific deployed contract.
237
+ * @param params - A tuple containing the contract's address.
238
+ * @param params.0 contractAddress - The {@link AztecAddress} of the contract.
239
+ * @returns result - The {@link ContractMetadata} for the specified contract.
240
+ */
224
241
  aztec_getContractMetadata: {
225
- params: {
226
- address: AztecAddress;
227
- };
242
+ params: [AztecAddress];
228
243
  result: ContractMetadata;
229
244
  };
245
+ /**
246
+ * Retrieves {@link ContractClassMetadata} for a specific contract class.
247
+ * @param params - A tuple containing the class ID and an optional flag.
248
+ * @param params.0 classId - The {@link Fr} ID of the contract class.
249
+ * @param params.1 includeArtifact - Optional: Boolean indicating whether to include the full {@link ContractArtifact}.
250
+ * @returns result - The {@link ContractClassMetadata}.
251
+ */
230
252
  aztec_getContractClassMetadata: {
231
- params: {
232
- id: Fr;
233
- includeArtifact?: boolean;
234
- };
253
+ params: [Fr, boolean | undefined];
235
254
  result: ContractClassMetadata;
236
255
  };
237
256
  /**
238
- * Registers a contract instance in the user's PXE.
239
- * @param params - The contract details to register
240
- * @returns True if registration was successful
257
+ * Registers a deployed contract instance with the wallet.
258
+ * @param params - A tuple containing the instance and optional artifact.
259
+ * @param params.0 instance - The {@link ContractInstanceWithAddress} to register.
260
+ * @param params.1 artifact - Optional: The {@link ContractArtifact} for the instance.
261
+ * @returns result - `true` if registration was successful.
241
262
  */
242
263
  aztec_registerContract: {
243
- params: {
244
- instance: ContractInstanceWithAddress;
245
- artifact?: ContractArtifact | undefined;
246
- };
264
+ params: [ContractInstanceWithAddress, ContractArtifact | undefined];
247
265
  result: boolean;
248
266
  };
249
267
  /**
250
- * Registers a contract class in the user's PXE.
251
- * @param params - The contract artifact to register
252
- * @returns True if registration was successful
268
+ * Registers a contract class (bytecode and ABI) with the wallet.
269
+ * @param params - A tuple containing the artifact.
270
+ * @param params.0 artifact - The {@link ContractArtifact} to register.
271
+ * @returns result - `true` if registration was successful.
253
272
  */
254
273
  aztec_registerContractClass: {
255
- params: {
256
- artifact: ContractArtifact;
257
- };
274
+ params: [ContractArtifact];
258
275
  result: boolean;
259
276
  };
260
- aztec_getPublicStorageAt: {
261
- params: {
262
- contract: AztecAddress;
263
- storageSlot: Fr;
264
- };
265
- result: any;
266
- };
267
- aztec_sendTx: {
268
- params: {
269
- tx: Tx;
270
- };
271
- result: TxHash;
272
- };
273
- aztec_createTxExecutionRequest: {
274
- params: {
275
- exec: ExecutionRequestInit;
276
- };
277
- result: TxExecutionRequest;
278
- };
277
+ /**
278
+ * Generates proofs for a transaction execution request.
279
+ * @param params - A tuple containing the request and optional private execution result.
280
+ * @param params.0 txRequest - The {@link TxExecutionRequest} to prove.
281
+ * @param params.1 privateExecutionResult - Optional: {@link PrivateExecutionResult} from a prior private simulation.
282
+ * @returns result - The {@link TxProvingResult}, including the proven transaction.
283
+ */
279
284
  aztec_proveTx: {
280
- params: {
281
- txRequest: TxExecutionRequest;
282
- privateExecutionResult: PrivateExecutionResult;
283
- };
285
+ params: [TxExecutionRequest, (PrivateExecutionResult | undefined)?];
284
286
  result: TxProvingResult;
285
287
  };
286
- aztec_getTxEffect: {
287
- params: {
288
- txHash: TxHash;
289
- };
290
- result: InBlock<TxEffect>;
288
+ /**
289
+ * Sends a proven {@link Tx} (transaction) to the network.
290
+ * @param params - A tuple containing the proven transaction.
291
+ * @param params.0 tx - The proven {@link Tx} object to send.
292
+ * @returns result - The {@link TxHash} of the sent transaction.
293
+ */
294
+ aztec_sendTx: {
295
+ params: [Tx];
296
+ result: TxHash;
291
297
  };
298
+ /**
299
+ * Retrieves the {@link TxReceipt} for a transaction.
300
+ * @param params - A tuple containing the transaction hash.
301
+ * @param params.0 txHash - The {@link TxHash} of the transaction.
302
+ * @returns result - The {@link TxReceipt}.
303
+ */
292
304
  aztec_getTxReceipt: {
293
- params: {
294
- txHash: TxHash;
295
- };
305
+ params: [TxHash];
296
306
  result: TxReceipt;
297
307
  };
308
+ /**
309
+ * Simulates a {@link TxExecutionRequest} without sending it to the network.
310
+ * @param params - A tuple containing the simulation parameters.
311
+ * @param params.0 txRequest - The {@link TxExecutionRequest} to simulate.
312
+ * @param params.1 simulatePublic - Optional: Whether to simulate public parts. Defaults to `false`.
313
+ * @param params.2 msgSender - Optional: {@link AztecAddress} for simulation context.
314
+ * @param params.3 skipTxValidation - Optional: Flag to skip validation. Defaults to `false`.
315
+ * @param params.4 skipFeeEnforcement - Optional: Flag to skip fee enforcement. Defaults to `false`.
316
+ * @returns result - The {@link TxSimulationResult}.
317
+ */
298
318
  aztec_simulateTx: {
299
- params: {
300
- txRequest: TxExecutionRequest;
301
- simulatePublic: boolean;
302
- msgSender?: AztecAddress;
303
- skipTxValidation?: boolean;
304
- enforceFeePayment?: boolean;
305
- profile?: boolean;
306
- };
319
+ params: [
320
+ TxExecutionRequest,
321
+ (boolean | undefined)?,
322
+ (AztecAddress | undefined)?,
323
+ (boolean | undefined)?,
324
+ (boolean | undefined)?
325
+ ];
307
326
  result: TxSimulationResult;
308
327
  };
309
- aztec_simulateUnconstrained: {
310
- params: {
311
- functionName: string;
312
- args: unknown[];
313
- to: AztecAddress;
314
- from?: AztecAddress;
315
- };
316
- result: AbiDecoded;
317
- };
318
- aztec_getNotes: {
319
- params: {
320
- filter: NotesFilter;
321
- };
322
- result: UniqueNote[];
323
- };
324
- aztec_addNote: {
325
- params: {
326
- note: ExtendedNote;
327
- };
328
- result: boolean;
329
- };
330
- aztec_addNullifiedNote: {
331
- params: {
332
- note: ExtendedNote;
333
- };
334
- result: boolean;
335
- };
336
- aztec_getPublicLogs: {
337
- params: {
338
- filter: LogFilter;
339
- };
340
- result: GetPublicLogsResponse;
328
+ /**
329
+ * Profiles a {@link TxExecutionRequest} for performance analysis.
330
+ * @param params - A tuple containing the profiling parameters.
331
+ * @param params.0 txRequest - The {@link TxExecutionRequest} to profile.
332
+ * @param params.1 profileMode - Optional: Profiling mode ('gates', 'execution-steps', 'full'). Defaults to 'gates'.
333
+ * @param params.2 skipProofGeneration - Optional: Flag to skip proof generation. Defaults to `false`.
334
+ * @param params.3 msgSender - Optional: {@link AztecAddress} for profiling context.
335
+ * @returns result - The {@link TxProfileResult}.
336
+ */
337
+ aztec_profileTx: {
338
+ params: [
339
+ TxExecutionRequest,
340
+ ('gates' | 'execution-steps' | 'full' | undefined)?,
341
+ (boolean | undefined)?,
342
+ (AztecAddress | undefined)?
343
+ ];
344
+ result: TxProfileResult;
341
345
  };
342
- aztec_getContractClassLogs: {
343
- params: {
344
- filter: LogFilter;
345
- };
346
- result: GetContractClassLogsResponse;
346
+ /**
347
+ * Simulates a utility (view) function call.
348
+ * @param params - A tuple containing the utility call parameters.
349
+ * @param params.0 functionName - Name of the utility function.
350
+ * @param params.1 args - Arguments for the function.
351
+ * @param params.2 to - {@link AztecAddress} of the contract/account.
352
+ * @param params.3 authWits - Optional: Array of {@link AuthWitness}.
353
+ * @param params.4 from - Optional: Sender {@link AztecAddress}.
354
+ * @returns result - The {@link UtilitySimulationResult}.
355
+ */
356
+ aztec_simulateUtility: {
357
+ params: [
358
+ string,
359
+ unknown[],
360
+ AztecAddress,
361
+ (AuthWitness[] | undefined)?,
362
+ (AztecAddress | undefined)?
363
+ ];
364
+ result: UtilitySimulationResult;
347
365
  };
366
+ /**
367
+ * Retrieves private (encrypted) events from the blockchain.
368
+ * @param params - A tuple containing the query parameters.
369
+ * @param params.0 contractAddress - {@link AztecAddress} of the emitting contract.
370
+ * @param params.1 eventMetadata - {@link EventMetadataDefinition} for the event.
371
+ * @param params.2 fromBlock - Starting block number.
372
+ * @param params.3 numBlocks - Number of blocks to scan.
373
+ * @param params.4 recipients - Array of recipient {@link AztecAddress}es.
374
+ * @returns result - An array of decoded private event data (type `unknown[]`, actual type depends on `eventMetadata`).
375
+ */
348
376
  aztec_getPrivateEvents: {
349
- params: {
350
- event: EventMetadataDefinition;
351
- from: number;
352
- limit: number;
353
- vpks?: Point[];
354
- };
377
+ params: [
378
+ AztecAddress,
379
+ EventMetadataDefinition,
380
+ number,
381
+ number,
382
+ AztecAddress[]
383
+ ];
355
384
  result: unknown[];
356
385
  };
386
+ /**
387
+ * Retrieves public (unencrypted) events from the blockchain.
388
+ * @param params - A tuple containing the query parameters.
389
+ * @param params.0 eventMetadata - {@link EventMetadataDefinition} for the event.
390
+ * @param params.1 fromBlock - Starting block number.
391
+ * @param params.2 limit - Maximum number of events to return.
392
+ * @returns result - An array of decoded public event data (type `unknown[]`, actual type depends on `eventMetadata`).
393
+ */
357
394
  aztec_getPublicEvents: {
358
- params: {
359
- event: EventMetadataDefinition;
360
- from: number;
361
- limit: number;
362
- };
395
+ params: [
396
+ EventMetadataDefinition,
397
+ number,
398
+ number
399
+ ];
363
400
  result: unknown[];
364
401
  };
402
+ /**
403
+ * WalletMesh specific: Executes a contract function interaction using a pre-constructed {@link ExecutionPayload}.
404
+ * The wallet handles simulation, proving, and sending.
405
+ * @param params - A tuple containing the execution payload.
406
+ * @param params.0 executionPayload - The {@link ExecutionPayload} to execute.
407
+ * @returns result - The {@link TxHash} of the sent transaction.
408
+ */
409
+ aztec_wmExecuteTx: {
410
+ params: [executionPayload: ExecutionPayload];
411
+ result: TxHash;
412
+ };
413
+ /**
414
+ * WalletMesh specific: Deploys a new contract using its artifact and constructor arguments.
415
+ * The wallet handles address computation, proving, and sending the deployment transaction.
416
+ * @param params - A tuple containing the deployment parameters.
417
+ * @param params.0 deploymentParams - Object containing `artifact` ({@link ContractArtifact}), `args` (array),
418
+ * and optional `constructorName` (string).
419
+ * @returns result - An object with `txHash` ({@link TxHash}) and `contractAddress` ({@link AztecAddress}).
420
+ */
421
+ aztec_wmDeployContract: {
422
+ params: [
423
+ {
424
+ artifact: ContractArtifact;
425
+ args: unknown[];
426
+ constructorName?: string;
427
+ }
428
+ ];
429
+ result: {
430
+ txHash: TxHash;
431
+ contractAddress: AztecAddress;
432
+ };
433
+ };
434
+ /**
435
+ * WalletMesh specific: Simulates a contract function interaction using a pre-constructed {@link ExecutionPayload}.
436
+ * @param params - A tuple containing the execution payload.
437
+ * @param params.0 executionPayload - The {@link ExecutionPayload} to simulate.
438
+ * @returns result - The {@link TxSimulationResult}.
439
+ */
440
+ aztec_wmSimulateTx: {
441
+ params: [executionPayload: ExecutionPayload];
442
+ result: TxSimulationResult;
443
+ };
365
444
  }
366
- export type AztecWalletMethodHandler<T extends AztecWalletMethodMap, M extends keyof T, C extends AztecWalletContext> = (context: C, params: T[M]['params'], accountWallet: AccountWallet) => Promise<T[M]['result']> | T[M]['result'];
367
- export type AztecChainId = `aztec:${string}`;
368
445
  //# sourceMappingURL=types.d.ts.map