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