@walletmesh/aztec-rpc-wallet 0.4.1 → 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.
Files changed (94) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/client/aztec-dapp-wallet.d.ts +6 -6
  4. package/dist/client/aztec-dapp-wallet.d.ts.map +1 -1
  5. package/dist/client/aztec-dapp-wallet.js +7 -7
  6. package/dist/client/aztec-router-provider.d.ts +1 -1
  7. package/dist/client/aztec-router-provider.d.ts.map +1 -1
  8. package/dist/client/aztec-router-provider.js +1 -1
  9. package/dist/client/helpers.d.ts.map +1 -1
  10. package/dist/client/helpers.js +2 -2
  11. package/dist/client/register-serializers.js +1 -1
  12. package/dist/index.d.ts +18 -18
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +8 -8
  15. package/dist/types.d.ts +11 -9
  16. package/dist/types.d.ts.map +1 -1
  17. package/dist/types.js +1 -1
  18. package/dist/wallet/create-node.d.ts +1 -1
  19. package/dist/wallet/create-node.d.ts.map +1 -1
  20. package/dist/wallet/create-node.js +1 -1
  21. package/dist/wallet/handlers/account.d.ts +1 -1
  22. package/dist/wallet/handlers/account.d.ts.map +1 -1
  23. package/dist/wallet/handlers/account.js +1 -1
  24. package/dist/wallet/handlers/contract-interaction.d.ts +1 -1
  25. package/dist/wallet/handlers/contract-interaction.d.ts.map +1 -1
  26. package/dist/wallet/handlers/contract-interaction.js +6 -5
  27. package/dist/wallet/handlers/contract.d.ts.map +1 -1
  28. package/dist/wallet/handlers/contract.js +1 -1
  29. package/dist/wallet/handlers/event.d.ts +1 -1
  30. package/dist/wallet/handlers/event.d.ts.map +1 -1
  31. package/dist/wallet/handlers/event.js +1 -1
  32. package/dist/wallet/handlers/index.d.ts.map +1 -1
  33. package/dist/wallet/handlers/index.js +2 -2
  34. package/dist/wallet/handlers/node.d.ts +1 -1
  35. package/dist/wallet/handlers/node.d.ts.map +1 -1
  36. package/dist/wallet/handlers/node.js +1 -1
  37. package/dist/wallet/handlers/senders.d.ts +1 -1
  38. package/dist/wallet/handlers/senders.d.ts.map +1 -1
  39. package/dist/wallet/handlers/senders.js +1 -1
  40. package/dist/wallet/handlers/transaction.d.ts +5 -4
  41. package/dist/wallet/handlers/transaction.d.ts.map +1 -1
  42. package/dist/wallet/handlers/transaction.js +9 -6
  43. package/dist/wallet/serializers.d.ts +1 -1
  44. package/dist/wallet/serializers.d.ts.map +1 -1
  45. package/dist/wallet/serializers.js +26 -23
  46. package/docs/README.md +1 -1
  47. package/docs/classes/AztecDappWallet.md +47 -47
  48. package/docs/classes/AztecRouterProvider.md +4 -4
  49. package/docs/classes/AztecWalletError.md +34 -10
  50. package/docs/classes/ContractArtifactCache.md +4 -4
  51. package/docs/functions/connectAztec.md +2 -2
  52. package/docs/functions/createAztecWallet.md +2 -2
  53. package/docs/functions/createAztecWalletNode.md +2 -2
  54. package/docs/functions/registerAztecSerializers.md +2 -2
  55. package/docs/functions/registerWalletAztecSerializers.md +2 -2
  56. package/docs/globals.md +2 -2
  57. package/docs/interfaces/AztecHandlerContext.md +5 -5
  58. package/docs/interfaces/AztecWalletContext.md +5 -5
  59. package/docs/interfaces/AztecWalletMethodMap.md +41 -37
  60. package/docs/type-aliases/AztecChainId.md +2 -2
  61. package/docs/variables/ALL_AZTEC_METHODS.md +2 -2
  62. package/docs/variables/AztecWalletErrorMap.md +2 -2
  63. package/docs/variables/AztecWalletSerializer.md +2 -2
  64. package/package.json +11 -11
  65. package/src/client/aztec-dapp-wallet.test.ts +7 -7
  66. package/src/client/aztec-dapp-wallet.ts +15 -14
  67. package/src/client/aztec-router-provider.test.ts +2 -2
  68. package/src/client/aztec-router-provider.ts +1 -1
  69. package/src/client/helpers.test.ts +3 -3
  70. package/src/client/helpers.ts +1 -2
  71. package/src/client/register-serializers.ts +1 -1
  72. package/src/contractArtifactCache.test.ts +1 -1
  73. package/src/index.test.ts +1 -1
  74. package/src/index.ts +21 -28
  75. package/src/types.ts +20 -20
  76. package/src/wallet/create-node.test.ts +3 -3
  77. package/src/wallet/create-node.ts +3 -4
  78. package/src/wallet/handlers/account.test.ts +6 -6
  79. package/src/wallet/handlers/account.ts +2 -2
  80. package/src/wallet/handlers/contract-interaction.test.ts +6 -7
  81. package/src/wallet/handlers/contract-interaction.ts +9 -8
  82. package/src/wallet/handlers/contract.test.ts +5 -5
  83. package/src/wallet/handlers/contract.ts +1 -1
  84. package/src/wallet/handlers/event.test.ts +4 -4
  85. package/src/wallet/handlers/event.ts +2 -2
  86. package/src/wallet/handlers/index.ts +1 -1
  87. package/src/wallet/handlers/node.test.ts +5 -6
  88. package/src/wallet/handlers/node.ts +2 -2
  89. package/src/wallet/handlers/senders.test.ts +4 -4
  90. package/src/wallet/handlers/senders.ts +2 -2
  91. package/src/wallet/handlers/transaction.test.ts +19 -13
  92. package/src/wallet/handlers/transaction.ts +10 -7
  93. package/src/wallet/serializers.test.ts +15 -62
  94. package/src/wallet/serializers.ts +44 -40
@@ -15,25 +15,26 @@ import type {
15
15
  } from '@aztec/aztec.js';
16
16
  import { Contract, DeploySentTx, SentTx } from '@aztec/aztec.js';
17
17
  import type { IntentAction, IntentInnerHash } from '@aztec/aztec.js/utils';
18
+ import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
19
+ import type { AuthWitnessProvider, FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
20
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
21
+ import { createLogger } from '@aztec/foundation/log';
22
+ import type { NodeInfo } from '@aztec/stdlib/contract';
23
+ import type { GasFees } from '@aztec/stdlib/gas';
18
24
  import type {
25
+ ContractClassMetadata,
26
+ ContractMetadata,
19
27
  EventMetadataDefinition,
20
28
  PXEInfo,
21
- ContractMetadata,
22
- ContractClassMetadata,
23
29
  } from '@aztec/stdlib/interfaces/client';
24
- import type { NodeInfo } from '@aztec/stdlib/contract';
25
- import type { GasFees } from '@aztec/stdlib/gas';
26
30
  import type {
27
31
  PrivateExecutionResult,
32
+ SimulationOverrides,
28
33
  TxProfileResult,
29
34
  TxProvingResult,
30
35
  TxSimulationResult,
31
36
  UtilitySimulationResult,
32
37
  } from '@aztec/stdlib/tx';
33
- import type { ExecutionPayload } from '@aztec/entrypoints/payload';
34
- import type { FeeOptions, TxExecutionOptions, AuthWitnessProvider } from '@aztec/entrypoints/interfaces';
35
- import { DefaultAccountEntrypoint } from '@aztec/entrypoints/account';
36
- import { createLogger } from '@aztec/foundation/log';
37
38
 
38
39
  import type { AztecChainId } from '../types.js';
39
40
  import type { AztecRouterProvider } from './aztec-router-provider.js';
@@ -515,9 +516,9 @@ export class AztecDappWallet implements Wallet {
515
516
  * Implements {@link Wallet.simulateTx}.
516
517
  * @param txRequest - The {@link TxExecutionRequest} to simulate.
517
518
  * @param simulatePublic - Whether to simulate public parts of the transaction.
518
- * @param msgSender - Optional {@link AztecAddress} of the message sender for simulation context.
519
519
  * @param skipTxValidation - Optional flag to skip transaction validation during simulation.
520
520
  * @param skipFeeEnforcement - Optional flag to skip fee enforcement during simulation.
521
+ * @param overrides - Optional {@link SimulationOverrides} for simulation context (includes msgSender).
521
522
  * @param scopes - Optional array of {@link AztecAddress} scopes for the simulation.
522
523
  * @returns A promise that resolves to the {@link TxSimulationResult}.
523
524
  * @see {@link AztecWalletMethodMap.aztec_simulateTx}
@@ -525,25 +526,25 @@ export class AztecDappWallet implements Wallet {
525
526
  async simulateTx(
526
527
  txRequest: TxExecutionRequest,
527
528
  simulatePublic: boolean,
528
- msgSender?: AztecAddress,
529
529
  skipTxValidation?: boolean,
530
530
  skipFeeEnforcement?: boolean,
531
+ overrides?: SimulationOverrides,
531
532
  scopes?: AztecAddress[],
532
533
  ): Promise<TxSimulationResult> {
533
534
  const params: {
534
535
  txRequest: TxExecutionRequest;
535
536
  simulatePublic?: boolean;
536
- msgSender?: AztecAddress;
537
537
  skipTxValidation?: boolean;
538
538
  skipFeeEnforcement?: boolean;
539
+ overrides?: SimulationOverrides;
539
540
  scopes?: AztecAddress[];
540
541
  } = {
541
542
  txRequest,
542
543
  };
543
544
  if (simulatePublic !== undefined) params.simulatePublic = simulatePublic;
544
- if (msgSender !== undefined) params.msgSender = msgSender;
545
545
  if (skipTxValidation !== undefined) params.skipTxValidation = skipTxValidation;
546
546
  if (skipFeeEnforcement !== undefined) params.skipFeeEnforcement = skipFeeEnforcement;
547
+ if (overrides !== undefined) params.overrides = overrides;
547
548
  if (scopes !== undefined) params.scopes = scopes;
548
549
 
549
550
  const result = await this.routerProvider.call(this.chainId, {
@@ -764,7 +765,7 @@ export class AztecDappWallet implements Wallet {
764
765
  },
765
766
  });
766
767
 
767
- const txHashPromise = Promise.resolve(result as TxHash);
768
+ const txHashPromise = () => Promise.resolve(result as TxHash);
768
769
  return new SentTx(this, txHashPromise);
769
770
  }
770
771
 
@@ -828,7 +829,7 @@ export class AztecDappWallet implements Wallet {
828
829
  })) as { txHash: TxHash; contractAddress: AztecAddress };
829
830
 
830
831
  // Create a promise that resolves with the transaction hash
831
- const txHashPromise = Promise.resolve(result.txHash);
832
+ const txHashPromise = () => Promise.resolve(result.txHash);
832
833
 
833
834
  // Create the post-deploy constructor function
834
835
  const postDeployCtor = async (address: AztecAddress, wallet: Wallet) => {
@@ -1,5 +1,3 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { AztecRouterProvider } from './aztec-router-provider.js';
3
1
  import { AztecAddress, CompleteAddress } from '@aztec/aztec.js';
4
2
  // import { jsonStringify } from '@aztec/foundation/json-rpc'; // Unused
5
3
  import type {
@@ -8,6 +6,8 @@ import type {
8
6
  JSONRPCTransport,
9
7
  // JSONRPCMethodMap, // Unused
10
8
  } from '@walletmesh/jsonrpc';
9
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
10
+ import { AztecRouterProvider } from './aztec-router-provider.js';
11
11
 
12
12
  // Define a minimal method map for testing purposes
13
13
  // import type { JSONRPCParams } from '@walletmesh/jsonrpc'; // Unused
@@ -1,5 +1,5 @@
1
- import { WalletRouterProvider } from '@walletmesh/router';
2
1
  import type { JSONRPCTransport } from '@walletmesh/jsonrpc';
2
+ import { WalletRouterProvider } from '@walletmesh/router';
3
3
  import { registerAztecSerializers } from './register-serializers.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { ALL_AZTEC_METHODS, connectAztec } from './helpers.js';
3
- import { createAztecWallet, type AztecDappWallet } from './aztec-dapp-wallet.js';
4
1
  import type { WalletRouterProvider } from '@walletmesh/router'; // Removed SessionData
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
3
+ import { type AztecDappWallet, createAztecWallet } from './aztec-dapp-wallet.js';
4
+ import { ALL_AZTEC_METHODS, connectAztec } from './helpers.js';
5
5
 
6
6
  // Mock the aztec-dapp-wallet module
7
7
  vi.mock('./aztec-dapp-wallet.js', () => ({
@@ -1,8 +1,8 @@
1
+ import { createLogger } from '@aztec/foundation/log';
1
2
  import type { AztecChainId } from '../types.js';
2
3
  import type { AztecDappWallet } from './aztec-dapp-wallet.js';
3
4
  import { createAztecWallet } from './aztec-dapp-wallet.js';
4
5
  import type { AztecRouterProvider } from './aztec-router-provider.js';
5
- import { createLogger } from '@aztec/foundation/log';
6
6
 
7
7
  const logger = createLogger('aztec-rpc-wallet:helpers');
8
8
 
@@ -88,4 +88,3 @@ export async function connectAztec(
88
88
 
89
89
  return { sessionId, wallet };
90
90
  }
91
-
@@ -1,6 +1,6 @@
1
1
  import type { WalletRouterProvider } from '@walletmesh/router';
2
- import { AztecWalletSerializer } from '../wallet/serializers.js';
3
2
  import type { AztecWalletMethodMap } from '../types.js';
3
+ import { AztecWalletSerializer } from '../wallet/serializers.js';
4
4
 
5
5
  /**
6
6
  * Registers the {@link AztecWalletSerializer} for all relevant Aztec JSON-RPC methods
@@ -1,5 +1,5 @@
1
- import { describe, expect, it, vi, beforeEach, type Mock } from 'vitest';
2
1
  import type { AztecAddress, ContractArtifact, Fr, Wallet } from '@aztec/aztec.js';
2
+ import { beforeEach, describe, expect, it, type Mock, vi } from 'vitest';
3
3
  import { ContractArtifactCache } from './contractArtifactCache.js';
4
4
  import { AztecWalletError } from './errors.js';
5
5
 
package/src/index.test.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { describe, it, expect } from 'vitest';
1
+ import { describe, expect, it } from 'vitest';
2
2
  import * as exports from './index.js';
3
3
 
4
4
  describe('index exports', () => {
package/src/index.ts CHANGED
@@ -5,27 +5,12 @@
5
5
  * This package provides both wallet-side and dApp-side implementations for Aztec integration.
6
6
  */
7
7
 
8
- // Wallet-side exports
9
- /**
10
- * Creates an Aztec wallet node that can be used with WalletRouter.
11
- * This is the wallet-side implementation that handles JSON-RPC requests.
12
- * @see {@link createAztecWalletNode}
13
- */
14
- export { createAztecWalletNode } from './wallet/create-node.js';
15
-
16
- /**
17
- * Context interface provided to all handler functions in the wallet implementation.
18
- * @see {@link AztecHandlerContext}
19
- */
20
- export type { AztecHandlerContext } from './wallet/handlers/index.js';
21
-
22
8
  // Client-side exports
23
9
  /**
24
10
  * DApp-side wallet class that implements the aztec.js Wallet interface.
25
11
  * @see {@link AztecDappWallet}
26
12
  */
27
13
  export { AztecDappWallet, createAztecWallet } from './client/aztec-dapp-wallet.js';
28
-
29
14
  /**
30
15
  * Extended WalletRouterProvider with built-in Aztec serialization support.
31
16
  * Use this instead of the base WalletRouterProvider for automatic serialization
@@ -33,7 +18,6 @@ export { AztecDappWallet, createAztecWallet } from './client/aztec-dapp-wallet.j
33
18
  * @see {@link AztecRouterProvider}
34
19
  */
35
20
  export { AztecRouterProvider } from './client/aztec-router-provider.js';
36
-
37
21
  /**
38
22
  * Helper constants and functions for connecting to Aztec wallets.
39
23
  * - ALL_AZTEC_METHODS: Complete list of all available Aztec methods
@@ -43,13 +27,25 @@ export {
43
27
  ALL_AZTEC_METHODS,
44
28
  connectAztec,
45
29
  } from './client/helpers.js';
46
-
47
30
  /**
48
31
  * Helper function to register Aztec serializers with a WalletRouterProvider.
49
32
  * This enables proper serialization of Aztec types when using the router.
50
33
  * @see {@link registerAztecSerializers}
51
34
  */
52
35
  export { registerAztecSerializers } from './client/register-serializers.js';
36
+ // Utilities
37
+ /**
38
+ * Cache utility for managing contract artifacts in wallet implementations.
39
+ * @see {@link ContractArtifactCache}
40
+ */
41
+ export { ContractArtifactCache } from './contractArtifactCache.js';
42
+ // Error utilities
43
+ /**
44
+ * Error handling utilities for Aztec wallet operations.
45
+ * - AztecWalletError: Custom error class for Aztec wallet errors
46
+ * - AztecWalletErrorMap: Map of error codes to error messages
47
+ */
48
+ export { AztecWalletError, AztecWalletErrorMap } from './errors.js';
53
49
 
54
50
  // Shared types
55
51
  /**
@@ -63,21 +59,18 @@ export type {
63
59
  AztecWalletContext,
64
60
  AztecWalletMethodMap,
65
61
  } from './types.js';
66
-
67
- // Utilities
62
+ // Wallet-side exports
68
63
  /**
69
- * Cache utility for managing contract artifacts in wallet implementations.
70
- * @see {@link ContractArtifactCache}
64
+ * Creates an Aztec wallet node that can be used with WalletRouter.
65
+ * This is the wallet-side implementation that handles JSON-RPC requests.
66
+ * @see {@link createAztecWalletNode}
71
67
  */
72
- export { ContractArtifactCache } from './contractArtifactCache.js';
73
-
74
- // Error utilities
68
+ export { createAztecWalletNode } from './wallet/create-node.js';
75
69
  /**
76
- * Error handling utilities for Aztec wallet operations.
77
- * - AztecWalletError: Custom error class for Aztec wallet errors
78
- * - AztecWalletErrorMap: Map of error codes to error messages
70
+ * Context interface provided to all handler functions in the wallet implementation.
71
+ * @see {@link AztecHandlerContext}
79
72
  */
80
- export { AztecWalletError, AztecWalletErrorMap } from './errors.js';
73
+ export type { AztecHandlerContext } from './wallet/handlers/index.js';
81
74
 
82
75
  // Re-export serializers
83
76
  /**
package/src/types.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import type {
2
+ AccountWallet,
2
3
  AuthWitness,
3
4
  AztecAddress,
5
+ CompleteAddress,
4
6
  Fr,
7
+ L2Block,
5
8
  PXE,
9
+ Tx,
6
10
  TxExecutionRequest,
7
11
  TxHash,
8
12
  TxReceipt,
9
- L2Block,
10
- CompleteAddress,
11
- AccountWallet,
12
- Tx,
13
13
  } from '@aztec/aztec.js';
14
14
  import type { IntentAction, IntentInnerHash } from '@aztec/aztec.js/utils';
15
15
  import type { ExecutionPayload } from '@aztec/entrypoints/payload';
@@ -25,25 +25,23 @@ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
25
25
  * methods, their parameters, and return types. This is central to the typed RPC system.
26
26
  */
27
27
 
28
- import type {
29
- PrivateExecutionResult,
30
- TxProfileResult,
31
- TxProvingResult,
32
- TxSimulationResult,
33
- UtilitySimulationResult,
34
- } from '@aztec/stdlib/tx';
35
-
36
28
  import type { ContractArtifact } from '@aztec/stdlib/abi';
37
-
29
+ import type { ContractInstanceWithAddress, NodeInfo } from '@aztec/stdlib/contract';
30
+ import type { GasFees } from '@aztec/stdlib/gas';
38
31
  import type {
39
32
  ContractClassMetadata,
40
33
  ContractMetadata,
41
34
  EventMetadataDefinition,
42
35
  PXEInfo,
43
36
  } from '@aztec/stdlib/interfaces/client';
44
-
45
- import type { GasFees } from '@aztec/stdlib/gas';
46
- import type { ContractInstanceWithAddress, NodeInfo } from '@aztec/stdlib/contract';
37
+ import type {
38
+ PrivateExecutionResult,
39
+ SimulationOverrides,
40
+ TxProfileResult,
41
+ TxProvingResult,
42
+ TxSimulationResult,
43
+ UtilitySimulationResult,
44
+ } from '@aztec/stdlib/tx';
47
45
 
48
46
  import type { WalletMethodMap } from '@walletmesh/router';
49
47
  import type { ContractArtifactCache } from './contractArtifactCache.js';
@@ -318,18 +316,20 @@ export interface AztecWalletMethodMap extends WalletMethodMap {
318
316
  * @param params - A tuple containing the simulation parameters.
319
317
  * @param params.0 txRequest - The {@link TxExecutionRequest} to simulate.
320
318
  * @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`.
319
+ * @param params.2 skipTxValidation - Optional: Flag to skip validation. Defaults to `false`.
320
+ * @param params.3 skipFeeEnforcement - Optional: Flag to skip fee enforcement. Defaults to `false`.
321
+ * @param params.4 overrides - Optional: {@link SimulationOverrides} for simulation context (includes msgSender).
322
+ * @param params.5 scopes - Optional: Array of {@link AztecAddress} scopes for the simulation.
324
323
  * @returns result - The {@link TxSimulationResult}.
325
324
  */
326
325
  aztec_simulateTx: {
327
326
  params: [
328
327
  TxExecutionRequest,
329
328
  (boolean | undefined)?, // simulatePublic
330
- (AztecAddress | undefined)?, // msgSender
331
329
  (boolean | undefined)?, // skipTxValidation
332
330
  (boolean | undefined)?, // skipFeeEnforcement
331
+ (SimulationOverrides | undefined)?, // overrides (includes msgSender)
332
+ (AztecAddress[] | undefined)?, // scopes
333
333
  ];
334
334
  result: TxSimulationResult;
335
335
  };
@@ -1,9 +1,9 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { createAztecWalletNode } from './create-node.js';
3
- import { JSONRPCNode } from '@walletmesh/jsonrpc';
4
1
  import type { AccountWallet, PXE } from '@aztec/aztec.js';
5
2
  import type { JSONRPCTransport } from '@walletmesh/jsonrpc';
3
+ import { JSONRPCNode } from '@walletmesh/jsonrpc';
4
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
6
5
  import { ContractArtifactCache } from '../contractArtifactCache.js';
6
+ import { createAztecWalletNode } from './create-node.js';
7
7
  import type { AztecHandlerContext } from './handlers/index.js';
8
8
 
9
9
  // Mock dependencies
@@ -6,11 +6,10 @@
6
6
  */
7
7
 
8
8
  import type { AccountWallet, PXE } from '@aztec/aztec.js';
9
- import { JSONRPCNode, type JSONRPCTransport, type JSONRPCEventMap } from '@walletmesh/jsonrpc';
10
-
11
- import type { AztecWalletMethodMap } from '../types.js';
9
+ import { type JSONRPCEventMap, JSONRPCNode, type JSONRPCTransport } from '@walletmesh/jsonrpc';
12
10
  import { ContractArtifactCache } from '../contractArtifactCache.js';
13
- import { createAztecHandlers, type AztecHandlerContext } from './handlers/index.js';
11
+ import type { AztecWalletMethodMap } from '../types.js';
12
+ import { type AztecHandlerContext, createAztecHandlers } from './handlers/index.js';
14
13
  import { registerAztecSerializers } from './serializers.js';
15
14
 
16
15
  /**
@@ -1,17 +1,17 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { createAccountHandlers } from './account.js';
3
1
  import type {
4
2
  AccountWallet,
5
- PXE,
3
+ AuthWitness,
6
4
  AztecAddress,
7
5
  CompleteAddress,
8
- AuthWitness,
9
6
  FunctionSelector,
10
7
  FunctionType,
8
+ PXE,
11
9
  } from '@aztec/aztec.js';
12
- import type { AztecHandlerContext } from './index.js';
13
- import type { ContractArtifactCache } from '../../contractArtifactCache.js';
14
10
  import { Fr } from '@aztec/aztec.js';
11
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
12
+ import type { ContractArtifactCache } from '../../contractArtifactCache.js';
13
+ import { createAccountHandlers } from './account.js';
14
+ import type { AztecHandlerContext } from './index.js';
15
15
 
16
16
  // Mock dependencies
17
17
  const createMockWallet = () =>
@@ -1,6 +1,6 @@
1
- import type { AztecHandlerContext } from './index.js';
2
- import type { AztecWalletMethodMap } from '../../types.js';
3
1
  import { createLogger } from '@aztec/foundation/log';
2
+ import type { AztecWalletMethodMap } from '../../types.js';
3
+ import type { AztecHandlerContext } from './index.js';
4
4
 
5
5
  const logger = createLogger('aztec-rpc-wallet:account');
6
6
 
@@ -1,10 +1,9 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
1
+ import { AztecAddress, FeeJuicePaymentMethod, Fr, TxHash, type TxReceipt } from '@aztec/aztec.js';
2
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
3
+ import { GasFees } from '@aztec/stdlib/gas';
4
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
2
5
  import { createContractInteractionHandlers } from './contract-interaction.js';
3
6
  import type { AztecHandlerContext } from './index.js';
4
- import { AztecAddress, Fr, type TxReceipt, TxHash } from '@aztec/aztec.js';
5
- import { GasFees } from '@aztec/stdlib/gas';
6
- import { FeeJuicePaymentMethod } from '@aztec/aztec.js';
7
- import type { ExecutionPayload } from '@aztec/entrypoints/payload';
8
7
 
9
8
  // Mock the aztec.js module
10
9
  vi.mock('@aztec/aztec.js', async () => {
@@ -39,7 +38,7 @@ describe('createContractInteractionHandlers', () => {
39
38
  mockContext = {
40
39
  wallet: {
41
40
  getAddress: vi.fn().mockReturnValue(mockAddress),
42
- getCurrentBaseFees: vi.fn().mockResolvedValue(new GasFees(new Fr(100n), new Fr(100n))),
41
+ getCurrentBaseFees: vi.fn().mockResolvedValue(new GasFees(100n, 100n)),
43
42
  createTxExecutionRequest: vi.fn().mockResolvedValue({}),
44
43
  simulateTx: vi.fn().mockResolvedValue({ privateExecutionResult: {} }),
45
44
  proveTx: vi.fn().mockResolvedValue({ toTx: vi.fn().mockReturnValue({}) }),
@@ -225,7 +224,7 @@ describe('createContractInteractionHandlers', () => {
225
224
  const callOrder: string[] = [];
226
225
  vi.mocked(mockContext.wallet.getCurrentBaseFees).mockImplementation(async () => {
227
226
  callOrder.push('getCurrentBaseFees');
228
- return new GasFees(new Fr(100n), new Fr(100n));
227
+ return new GasFees(100n, 100n);
229
228
  });
230
229
  vi.mocked(mockDeployMethod.prove).mockImplementation(async () => {
231
230
  callOrder.push('prove');
@@ -1,11 +1,11 @@
1
- import type { AztecHandlerContext } from './index.js';
2
- import type { AztecWalletMethodMap } from '../../types.js';
3
- import { Contract, FeeJuicePaymentMethod, Fr, type DeployOptions, type TxHash } from '@aztec/aztec.js';
4
- import type { ExecutionPayload } from '@aztec/entrypoints/payload';
1
+ import { Contract, type DeployOptions, FeeJuicePaymentMethod, Fr, type TxHash } from '@aztec/aztec.js';
5
2
  import type { FeeOptions, TxExecutionOptions } from '@aztec/entrypoints/interfaces';
6
- import { GasSettings } from '@aztec/stdlib/gas';
3
+ import type { ExecutionPayload } from '@aztec/entrypoints/payload';
7
4
  import { createLogger } from '@aztec/foundation/log';
5
+ import { GasSettings } from '@aztec/stdlib/gas';
8
6
  import type { TxExecutionRequest, TxSimulationResult } from '@aztec/stdlib/tx';
7
+ import type { AztecWalletMethodMap } from '../../types.js';
8
+ import type { AztecHandlerContext } from './index.js';
9
9
 
10
10
  const logger = createLogger('aztec-rpc-wallet:contract-interaction:handler');
11
11
 
@@ -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,11 +236,12 @@ 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
  };
242
- if (txOpts.nonce) {
243
- opts.nonce = txOpts.nonce;
243
+ if (txOpts.txNonce) {
244
+ opts.txNonce = txOpts.txNonce;
244
245
  }
245
246
  if (txOpts.cancellable) {
246
247
  opts.cancellable = txOpts.cancellable;
@@ -1,12 +1,12 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { createContractHandlers } from './contract.js';
3
- import type { AccountWallet, PXE, AztecAddress } from '@aztec/aztec.js';
1
+ import type { AccountWallet, AztecAddress, PXE } from '@aztec/aztec.js';
2
+ import { Fr } from '@aztec/aztec.js';
4
3
  import type { ContractArtifact } from '@aztec/stdlib/abi';
5
4
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
6
5
  import type { ContractClassMetadata, ContractMetadata } from '@aztec/stdlib/interfaces/client';
7
- import type { AztecHandlerContext } from './index.js';
6
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
8
7
  import type { ContractArtifactCache } from '../../contractArtifactCache.js';
9
- import { Fr } from '@aztec/aztec.js';
8
+ import { createContractHandlers } from './contract.js';
9
+ import type { AztecHandlerContext } from './index.js';
10
10
 
11
11
  // Mock dependencies
12
12
  const createMockWallet = () =>
@@ -1,8 +1,8 @@
1
+ import { createLogger } from '@aztec/foundation/log';
1
2
  import type { ContractArtifact } from '@aztec/stdlib/abi';
2
3
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
3
4
  import type { AztecWalletMethodMap } from '../../types.js';
4
5
  import type { AztecHandlerContext } from './index.js';
5
- import { createLogger } from '@aztec/foundation/log';
6
6
 
7
7
  const logger = createLogger('aztec-rpc-wallet:contract');
8
8
 
@@ -1,9 +1,9 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { createEventHandlers } from './event.js';
3
- import type { AccountWallet, PXE, AztecAddress } from '@aztec/aztec.js';
1
+ import type { AccountWallet, AztecAddress, PXE } from '@aztec/aztec.js';
4
2
  import type { EventMetadataDefinition } from '@aztec/stdlib/interfaces/client';
5
- import type { AztecHandlerContext } from './index.js';
3
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
6
4
  import type { ContractArtifactCache } from '../../contractArtifactCache.js';
5
+ import { createEventHandlers } from './event.js';
6
+ import type { AztecHandlerContext } from './index.js';
7
7
 
8
8
  // Mock dependencies
9
9
  const createMockWallet = () =>
@@ -1,6 +1,6 @@
1
- import type { AztecHandlerContext } from './index.js';
2
- import type { AztecWalletMethodMap } from '../../types.js';
3
1
  import { createLogger } from '@aztec/foundation/log';
2
+ import type { AztecWalletMethodMap } from '../../types.js';
3
+ import type { AztecHandlerContext } from './index.js';
4
4
 
5
5
  const logger = createLogger('aztec-rpc-wallet:event');
6
6
 
@@ -4,12 +4,12 @@ import type { ContractArtifactCache } from '../../contractArtifactCache.js';
4
4
  import type { AztecWalletMethodMap } from '../../types.js';
5
5
 
6
6
  import { createAccountHandlers } from './account.js';
7
- import { createTransactionHandlers } from './transaction.js';
8
7
  import { createContractHandlers } from './contract.js';
9
8
  import { createContractInteractionHandlers } from './contract-interaction.js';
10
9
  import { createEventHandlers } from './event.js';
11
10
  import { createNodeHandlers } from './node.js';
12
11
  import { createSenderHandlers } from './senders.js';
12
+ import { createTransactionHandlers } from './transaction.js';
13
13
 
14
14
  /**
15
15
  * Defines the context object that is passed to all Aztec wallet JSON-RPC method handlers.
@@ -1,13 +1,12 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { createNodeHandlers } from './node.js';
3
- import type { AccountWallet, PXE } from '@aztec/aztec.js';
1
+ import type { AccountWallet, L2Block, PXE } from '@aztec/aztec.js';
2
+ import { Fr } from '@aztec/aztec.js';
4
3
  import type { NodeInfo } from '@aztec/stdlib/contract';
5
4
  import type { GasFees } from '@aztec/stdlib/gas';
6
5
  import type { PXEInfo } from '@aztec/stdlib/interfaces/client';
7
- import type { L2Block } from '@aztec/aztec.js';
8
- import type { AztecHandlerContext } from './index.js';
6
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
9
7
  import type { ContractArtifactCache } from '../../contractArtifactCache.js';
10
- import { Fr } from '@aztec/aztec.js';
8
+ import type { AztecHandlerContext } from './index.js';
9
+ import { createNodeHandlers } from './node.js';
11
10
 
12
11
  // Mock dependencies
13
12
  const createMockWallet = () =>
@@ -1,6 +1,6 @@
1
- import type { AztecHandlerContext } from './index.js';
2
- import type { AztecWalletMethodMap } from '../../types.js';
3
1
  import { createLogger } from '@aztec/foundation/log';
2
+ import type { AztecWalletMethodMap } from '../../types.js';
3
+ import type { AztecHandlerContext } from './index.js';
4
4
 
5
5
  const logger = createLogger('aztec-rpc-wallet:node');
6
6
 
@@ -1,8 +1,8 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { createSenderHandlers } from './senders.js';
3
- import type { AccountWallet, PXE, AztecAddress } from '@aztec/aztec.js';
4
- import type { AztecHandlerContext } from './index.js';
1
+ import type { AccountWallet, AztecAddress, PXE } from '@aztec/aztec.js';
2
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
5
3
  import type { ContractArtifactCache } from '../../contractArtifactCache.js';
4
+ import type { AztecHandlerContext } from './index.js';
5
+ import { createSenderHandlers } from './senders.js';
6
6
 
7
7
  // Mock dependencies
8
8
  const createMockWallet = () =>
@@ -1,6 +1,6 @@
1
- import type { AztecHandlerContext } from './index.js';
2
- import type { AztecWalletMethodMap } from '../../types.js';
3
1
  import { createLogger } from '@aztec/foundation/log';
2
+ import type { AztecWalletMethodMap } from '../../types.js';
3
+ import type { AztecHandlerContext } from './index.js';
4
4
 
5
5
  const logger = createLogger('aztec-rpc-wallet:senders');
6
6