@walletmesh/aztec-rpc-wallet 0.5.0 → 0.5.4
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 +7 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/wallet/handlers/contract-interaction.d.ts.map +1 -1
- package/dist/wallet/handlers/contract-interaction.js +3 -2
- package/dist/wallet/handlers/index.d.ts.map +1 -1
- package/dist/wallet/serializers.js +2 -2
- package/docs/README.md +1 -1
- package/docs/classes/AztecDappWallet.md +40 -40
- package/docs/classes/AztecRouterProvider.md +3 -3
- package/docs/classes/AztecWalletError.md +11 -11
- package/docs/classes/ContractArtifactCache.md +4 -4
- package/docs/functions/connectAztec.md +2 -2
- package/docs/functions/createAztecWallet.md +2 -2
- package/docs/functions/createAztecWalletNode.md +2 -2
- package/docs/functions/registerAztecSerializers.md +2 -2
- package/docs/functions/registerWalletAztecSerializers.md +2 -2
- package/docs/globals.md +2 -2
- package/docs/interfaces/AztecHandlerContext.md +5 -5
- package/docs/interfaces/AztecWalletContext.md +5 -5
- package/docs/interfaces/AztecWalletMethodMap.md +33 -33
- package/docs/type-aliases/AztecChainId.md +2 -2
- package/docs/variables/ALL_AZTEC_METHODS.md +2 -2
- package/docs/variables/AztecWalletErrorMap.md +2 -2
- package/docs/variables/AztecWalletSerializer.md +2 -2
- package/package.json +6 -6
- package/src/client/aztec-dapp-wallet.test.ts +1 -3
- package/src/wallet/handlers/contract-interaction.ts +2 -1
- package/src/wallet/handlers/transaction.test.ts +1 -4
- package/src/wallet/serializers.test.ts +12 -57
- package/src/wallet/serializers.ts +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
[**@walletmesh/aztec-rpc-wallet v0.5.
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.5.4**](../README.md)
|
2
2
|
|
3
3
|
***
|
4
4
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
> `const` `readonly` **AztecWalletErrorMap**: `Record`\<`AztecWalletErrorType`, \{ `code`: `number`; `message`: `string`; \}\>
|
10
10
|
|
11
|
-
Defined in: [aztec/rpc-wallet/src/errors.ts:59](https://github.com/WalletMesh/walletmesh-packages/blob/
|
11
|
+
Defined in: [aztec/rpc-wallet/src/errors.ts:59](https://github.com/WalletMesh/walletmesh-packages/blob/441c37c9745b2e99f43add247d17e8d0e84a0495/aztec/rpc-wallet/src/errors.ts#L59)
|
12
12
|
|
13
13
|
A map associating each AztecWalletErrorType with a specific JSON-RPC error code
|
14
14
|
and a human-readable message. This map is used by the [AztecWalletError](../classes/AztecWalletError.md) class
|
@@ -1,4 +1,4 @@
|
|
1
|
-
[**@walletmesh/aztec-rpc-wallet v0.5.
|
1
|
+
[**@walletmesh/aztec-rpc-wallet v0.5.4**](../README.md)
|
2
2
|
|
3
3
|
***
|
4
4
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
> `const` **AztecWalletSerializer**: [`JSONRPCSerializer`](https://github.com/WalletMesh/walletmesh-packages/tree/main/core/jsonrpc/docs/interfaces/JSONRPCSerializer.md)\<`JSONRPCParams`, `unknown`\>
|
10
10
|
|
11
|
-
Defined in: [aztec/rpc-wallet/src/wallet/serializers.ts:263](https://github.com/WalletMesh/walletmesh-packages/blob/
|
11
|
+
Defined in: [aztec/rpc-wallet/src/wallet/serializers.ts:263](https://github.com/WalletMesh/walletmesh-packages/blob/441c37c9745b2e99f43add247d17e8d0e84a0495/aztec/rpc-wallet/src/wallet/serializers.ts#L263)
|
12
12
|
|
13
13
|
A comprehensive [JSONRPCSerializer](https://github.com/WalletMesh/walletmesh-packages/tree/main/core/jsonrpc/docs/interfaces/JSONRPCSerializer.md) for all Aztec wallet methods.
|
14
14
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@walletmesh/aztec-rpc-wallet",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.4",
|
4
4
|
"description": "",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -21,11 +21,11 @@
|
|
21
21
|
"typedoc-plugin-markdown": "^4.8.1"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@aztec/aztec.js": "
|
25
|
-
"@aztec/blob-lib": "
|
26
|
-
"@aztec/entrypoints": "
|
27
|
-
"@aztec/foundation": "
|
28
|
-
"@aztec/stdlib": "
|
24
|
+
"@aztec/aztec.js": "2.0.3",
|
25
|
+
"@aztec/blob-lib": "2.0.3",
|
26
|
+
"@aztec/entrypoints": "2.0.3",
|
27
|
+
"@aztec/foundation": "2.0.3",
|
28
|
+
"@aztec/stdlib": "2.0.3",
|
29
29
|
"zod": "^3.25.76",
|
30
30
|
"@walletmesh/jsonrpc": "^0.5.2",
|
31
31
|
"@walletmesh/router": "^0.5.2"
|
@@ -540,10 +540,9 @@ describe('AztecDappWallet', () => {
|
|
540
540
|
it('should call aztec_simulateTx', async () => {
|
541
541
|
const txRequest = { request: {} } as unknown as TxExecutionRequest;
|
542
542
|
const simulatedTx = { tx: txRequest, privateReturnValues: [] };
|
543
|
-
const msgSender = await AztecAddress.random();
|
544
543
|
provider.call.mockResolvedValue(simulatedTx);
|
545
544
|
|
546
|
-
const result = await wallet.simulateTx(txRequest, true, false, false
|
545
|
+
const result = await wallet.simulateTx(txRequest, true, false, false );
|
547
546
|
|
548
547
|
expect(provider.call).toHaveBeenCalledWith(testChainId, {
|
549
548
|
method: 'aztec_simulateTx',
|
@@ -552,7 +551,6 @@ describe('AztecDappWallet', () => {
|
|
552
551
|
simulatePublic: true,
|
553
552
|
skipTxValidation: false,
|
554
553
|
skipFeeEnforcement: false,
|
555
|
-
overrides: { msgSender },
|
556
554
|
},
|
557
555
|
});
|
558
556
|
expect(result).toEqual(simulatedTx);
|
@@ -143,7 +143,7 @@ export function createContractInteractionHandlers() {
|
|
143
143
|
logger.debug('Proving result:', provingResult);
|
144
144
|
|
145
145
|
logger.debug('Creating transaction from proving result...');
|
146
|
-
const tx = provingResult.toTx();
|
146
|
+
const tx = await provingResult.toTx();
|
147
147
|
logger.debug('Transaction created:', tx);
|
148
148
|
|
149
149
|
logger.debug('Sending transaction to network...');
|
@@ -236,6 +236,7 @@ export function createContractInteractionHandlers() {
|
|
236
236
|
const contractAddressSalt = Fr.random();
|
237
237
|
const txOpts = await getTxOptions(ctx);
|
238
238
|
const opts: DeployOptions = {
|
239
|
+
from: ctx.wallet.getAddress(),
|
239
240
|
contractAddressSalt,
|
240
241
|
fee: await getFeeOptions(ctx),
|
241
242
|
};
|
@@ -185,8 +185,6 @@ describe('Transaction Handlers', () => {
|
|
185
185
|
const simulatePublic = true;
|
186
186
|
const skipTxValidation = true;
|
187
187
|
const skipFeeEnforcement = true;
|
188
|
-
const msgSender = '0x1234567890abcdef' as unknown as AztecAddress;
|
189
|
-
const overrides = { msgSender };
|
190
188
|
|
191
189
|
const expectedSimulation = {
|
192
190
|
txRequest,
|
@@ -201,7 +199,6 @@ describe('Transaction Handlers', () => {
|
|
201
199
|
simulatePublic,
|
202
200
|
skipTxValidation,
|
203
201
|
skipFeeEnforcement,
|
204
|
-
overrides,
|
205
202
|
]);
|
206
203
|
|
207
204
|
expect(mockWallet.simulateTx).toHaveBeenCalledWith(
|
@@ -209,7 +206,7 @@ describe('Transaction Handlers', () => {
|
|
209
206
|
simulatePublic,
|
210
207
|
skipTxValidation,
|
211
208
|
skipFeeEnforcement,
|
212
|
-
|
209
|
+
undefined
|
213
210
|
);
|
214
211
|
expect(result).toBe(expectedSimulation);
|
215
212
|
});
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import type { ContractArtifact } from '@aztec/aztec.js';
|
2
2
|
import { AuthWitness, AztecAddress, Fr } from '@aztec/aztec.js';
|
3
3
|
import { ExecutionPayload } from '@aztec/entrypoints/payload';
|
4
|
-
import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
4
|
+
import { emptyFunctionArtifact, FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
5
|
+
import { randomContractArtifact } from '@aztec/stdlib/testing';
|
5
6
|
import { Capsule, HashedValues } from '@aztec/stdlib/tx';
|
6
7
|
import { describe, expect, it } from 'vitest';
|
7
8
|
import { AztecWalletSerializer } from './serializers.js';
|
@@ -95,40 +96,15 @@ describe('ExecutionPayload Serialization', () => {
|
|
95
96
|
describe('DeployContract Serialization', () => {
|
96
97
|
it('should serialize and deserialize aztec_wmDeployContract params correctly', async () => {
|
97
98
|
// Create a minimal valid ContractArtifact
|
98
|
-
const artifact: ContractArtifact =
|
99
|
-
name: 'TestContract',
|
100
|
-
functions: [
|
101
|
-
{
|
102
|
-
name: 'constructor',
|
103
|
-
functionType: FunctionType.PRIVATE,
|
104
|
-
isInternal: false,
|
105
|
-
isStatic: false,
|
106
|
-
isInitializer: true,
|
107
|
-
parameters: [
|
108
|
-
{
|
109
|
-
name: 'owner',
|
110
|
-
type: { kind: 'field' },
|
111
|
-
visibility: 'private',
|
112
|
-
},
|
113
|
-
],
|
114
|
-
returnTypes: [],
|
115
|
-
errorTypes: {},
|
116
|
-
bytecode: Buffer.from('test'),
|
117
|
-
debugSymbols: '',
|
118
|
-
},
|
119
|
-
],
|
120
|
-
nonDispatchPublicFunctions: [],
|
121
|
-
outputs: {
|
122
|
-
structs: {},
|
123
|
-
globals: {},
|
124
|
-
},
|
125
|
-
storageLayout: {},
|
126
|
-
notes: {},
|
127
|
-
fileMap: {},
|
128
|
-
};
|
99
|
+
const artifact: ContractArtifact = await randomContractArtifact();
|
129
100
|
|
130
101
|
const args = [AztecAddress.random().toString(), '12345'];
|
131
102
|
const constructorName = 'constructor';
|
103
|
+
const functionArtifact = emptyFunctionArtifact();
|
104
|
+
functionArtifact.name = constructorName;
|
105
|
+
functionArtifact.functionType = FunctionType.PUBLIC;
|
106
|
+
functionArtifact.isInitializer = true;
|
107
|
+
artifact.functions.push(functionArtifact);
|
132
108
|
|
133
109
|
// Test params serialization
|
134
110
|
const params = { artifact, args, constructorName };
|
@@ -151,9 +127,10 @@ describe('DeployContract Serialization', () => {
|
|
151
127
|
constructorName?: string;
|
152
128
|
};
|
153
129
|
|
130
|
+
|
154
131
|
// Verify the artifact structure
|
155
132
|
expect(result.artifact).toBeDefined();
|
156
|
-
expect(result.artifact.name).toBe(
|
133
|
+
expect(result.artifact.name).toBe(artifact.name);
|
157
134
|
expect(result.artifact.functions).toHaveLength(1);
|
158
135
|
expect(result.artifact.functions[0]?.name).toBe('constructor');
|
159
136
|
expect(result.artifact.functions[0]?.isInitializer).toBe(true);
|
@@ -166,18 +143,7 @@ describe('DeployContract Serialization', () => {
|
|
166
143
|
});
|
167
144
|
|
168
145
|
it('should handle aztec_wmDeployContract without constructorName', async () => {
|
169
|
-
const artifact: ContractArtifact =
|
170
|
-
name: 'TestContract',
|
171
|
-
functions: [],
|
172
|
-
nonDispatchPublicFunctions: [],
|
173
|
-
outputs: {
|
174
|
-
structs: {},
|
175
|
-
globals: {},
|
176
|
-
},
|
177
|
-
storageLayout: {},
|
178
|
-
notes: {},
|
179
|
-
fileMap: {},
|
180
|
-
};
|
146
|
+
const artifact: ContractArtifact = await randomContractArtifact();
|
181
147
|
|
182
148
|
const args: unknown[] = [];
|
183
149
|
|
@@ -218,18 +184,7 @@ describe('DeployContract Serialization', () => {
|
|
218
184
|
});
|
219
185
|
|
220
186
|
it('should validate args array in aztec_wmDeployContract', async () => {
|
221
|
-
const artifact: ContractArtifact =
|
222
|
-
name: 'TestContract',
|
223
|
-
functions: [],
|
224
|
-
nonDispatchPublicFunctions: [],
|
225
|
-
outputs: {
|
226
|
-
structs: {},
|
227
|
-
globals: {},
|
228
|
-
},
|
229
|
-
storageLayout: {},
|
230
|
-
notes: {},
|
231
|
-
fileMap: {},
|
232
|
-
};
|
187
|
+
const artifact: ContractArtifact = await randomContractArtifact();
|
233
188
|
|
234
189
|
// Test with various types in args array
|
235
190
|
const args = ['string value', 123, true, { nested: 'object' }, ['array', 'of', 'values'], null];
|
@@ -69,7 +69,7 @@ import type { AztecWalletMethodMap } from '../types.js';
|
|
69
69
|
const ContractMetadataSchema = z.object({
|
70
70
|
contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
|
71
71
|
isContractInitialized: z.boolean(),
|
72
|
-
|
72
|
+
isContractPublished: z.boolean(),
|
73
73
|
}) satisfies ZodFor<ContractMetadata>;
|
74
74
|
|
75
75
|
const ContractClassMetadataSchema = z.object({
|