@aztec/wallet-sdk 0.0.1-commit.d431d1c → 0.0.1-commit.d58ff9d0

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 (103) hide show
  1. package/README.md +318 -270
  2. package/dest/base-wallet/base_wallet.d.ts +115 -40
  3. package/dest/base-wallet/base_wallet.d.ts.map +1 -1
  4. package/dest/base-wallet/base_wallet.js +353 -105
  5. package/dest/base-wallet/get_gas_limits.d.ts +36 -0
  6. package/dest/base-wallet/get_gas_limits.d.ts.map +1 -0
  7. package/dest/base-wallet/get_gas_limits.js +55 -0
  8. package/dest/base-wallet/index.d.ts +4 -2
  9. package/dest/base-wallet/index.d.ts.map +1 -1
  10. package/dest/base-wallet/index.js +2 -0
  11. package/dest/base-wallet/utils.d.ts +52 -0
  12. package/dest/base-wallet/utils.d.ts.map +1 -0
  13. package/dest/base-wallet/utils.js +137 -0
  14. package/dest/crypto.d.ts +97 -50
  15. package/dest/crypto.d.ts.map +1 -1
  16. package/dest/crypto.js +290 -108
  17. package/dest/emoji_alphabet.d.ts +35 -0
  18. package/dest/emoji_alphabet.d.ts.map +1 -0
  19. package/dest/emoji_alphabet.js +299 -0
  20. package/dest/extension/handlers/background_connection_handler.d.ts +168 -0
  21. package/dest/extension/handlers/background_connection_handler.d.ts.map +1 -0
  22. package/dest/extension/handlers/background_connection_handler.js +294 -0
  23. package/dest/extension/handlers/content_script_connection_handler.d.ts +57 -0
  24. package/dest/extension/handlers/content_script_connection_handler.d.ts.map +1 -0
  25. package/dest/extension/handlers/content_script_connection_handler.js +193 -0
  26. package/dest/extension/handlers/index.d.ts +12 -0
  27. package/dest/extension/handlers/index.d.ts.map +1 -0
  28. package/dest/extension/handlers/index.js +10 -0
  29. package/dest/extension/handlers/internal_message_types.d.ts +65 -0
  30. package/dest/extension/handlers/internal_message_types.d.ts.map +1 -0
  31. package/dest/extension/handlers/internal_message_types.js +24 -0
  32. package/dest/extension/provider/extension_provider.d.ts +107 -0
  33. package/dest/extension/provider/extension_provider.d.ts.map +1 -0
  34. package/dest/extension/provider/extension_provider.js +160 -0
  35. package/dest/extension/provider/extension_wallet.d.ts +152 -0
  36. package/dest/extension/provider/extension_wallet.d.ts.map +1 -0
  37. package/dest/{providers/extension → extension/provider}/extension_wallet.js +134 -103
  38. package/dest/extension/provider/index.d.ts +3 -0
  39. package/dest/extension/provider/index.d.ts.map +1 -0
  40. package/dest/{providers/extension → extension/provider}/index.js +0 -2
  41. package/dest/iframe/handlers/iframe_connection_handler.d.ts +122 -0
  42. package/dest/iframe/handlers/iframe_connection_handler.d.ts.map +1 -0
  43. package/dest/iframe/handlers/iframe_connection_handler.js +239 -0
  44. package/dest/iframe/handlers/index.d.ts +2 -0
  45. package/dest/iframe/handlers/index.d.ts.map +1 -0
  46. package/dest/iframe/handlers/index.js +1 -0
  47. package/dest/iframe/provider/iframe_discovery.d.ts +25 -0
  48. package/dest/iframe/provider/iframe_discovery.d.ts.map +1 -0
  49. package/dest/iframe/provider/iframe_discovery.js +167 -0
  50. package/dest/iframe/provider/iframe_provider.d.ts +65 -0
  51. package/dest/iframe/provider/iframe_provider.d.ts.map +1 -0
  52. package/dest/iframe/provider/iframe_provider.js +257 -0
  53. package/dest/iframe/provider/iframe_wallet.d.ts +85 -0
  54. package/dest/iframe/provider/iframe_wallet.d.ts.map +1 -0
  55. package/dest/iframe/provider/iframe_wallet.js +269 -0
  56. package/dest/iframe/provider/index.d.ts +4 -0
  57. package/dest/iframe/provider/index.d.ts.map +1 -0
  58. package/dest/iframe/provider/index.js +3 -0
  59. package/dest/manager/index.d.ts +2 -8
  60. package/dest/manager/index.d.ts.map +1 -1
  61. package/dest/manager/index.js +0 -6
  62. package/dest/manager/types.d.ts +92 -9
  63. package/dest/manager/types.d.ts.map +1 -1
  64. package/dest/manager/types.js +17 -1
  65. package/dest/manager/wallet_manager.d.ts +50 -7
  66. package/dest/manager/wallet_manager.d.ts.map +1 -1
  67. package/dest/manager/wallet_manager.js +203 -43
  68. package/dest/types.d.ts +104 -11
  69. package/dest/types.d.ts.map +1 -1
  70. package/dest/types.js +32 -2
  71. package/package.json +21 -10
  72. package/src/base-wallet/base_wallet.ts +456 -167
  73. package/src/base-wallet/get_gas_limits.ts +88 -0
  74. package/src/base-wallet/index.ts +8 -1
  75. package/src/base-wallet/utils.ts +248 -0
  76. package/src/crypto.ts +341 -113
  77. package/src/emoji_alphabet.ts +317 -0
  78. package/src/extension/handlers/background_connection_handler.ts +456 -0
  79. package/src/extension/handlers/content_script_connection_handler.ts +264 -0
  80. package/src/extension/handlers/index.ts +25 -0
  81. package/src/extension/handlers/internal_message_types.ts +71 -0
  82. package/src/extension/provider/extension_provider.ts +233 -0
  83. package/src/{providers/extension → extension/provider}/extension_wallet.ts +151 -120
  84. package/src/extension/provider/index.ts +7 -0
  85. package/src/iframe/handlers/iframe_connection_handler.ts +341 -0
  86. package/src/iframe/handlers/index.ts +7 -0
  87. package/src/iframe/provider/iframe_discovery.ts +185 -0
  88. package/src/iframe/provider/iframe_provider.ts +331 -0
  89. package/src/iframe/provider/iframe_wallet.ts +323 -0
  90. package/src/iframe/provider/index.ts +3 -0
  91. package/src/manager/index.ts +2 -10
  92. package/src/manager/types.ts +95 -8
  93. package/src/manager/wallet_manager.ts +223 -45
  94. package/src/types.ts +116 -10
  95. package/dest/providers/extension/extension_provider.d.ts +0 -63
  96. package/dest/providers/extension/extension_provider.d.ts.map +0 -1
  97. package/dest/providers/extension/extension_provider.js +0 -124
  98. package/dest/providers/extension/extension_wallet.d.ts +0 -155
  99. package/dest/providers/extension/extension_wallet.d.ts.map +0 -1
  100. package/dest/providers/extension/index.d.ts +0 -6
  101. package/dest/providers/extension/index.d.ts.map +0 -1
  102. package/src/providers/extension/extension_provider.ts +0 -167
  103. package/src/providers/extension/index.ts +0 -5
@@ -0,0 +1,55 @@
1
+ import { MAX_PROCESSABLE_L2_GAS, MAX_TX_DA_GAS } from '@aztec/constants';
2
+ import { Gas } from '@aztec/stdlib/gas';
3
+ /**
4
+ * Returns suggested total and teardown gas limits for a simulated tx, clamped to the network's per-tx
5
+ * admission limits.
6
+ *
7
+ * The network only admits transactions that declare up to `maxTxGasLimits` per dimension (the
8
+ * node-advertised `txsLimits.gas`). Wallets pass the value read from their own node info, but since node info
9
+ * is remote input it is defensively clamped here to the per-tx protocol maxima so a value above them is never
10
+ * honored. If the simulated usage already exceeds the resulting admission limits the tx can never be included,
11
+ * so this throws a descriptive error instead of returning a limit the node would reject. Otherwise it pads the
12
+ * usage and clamps each dimension to the admission limit.
13
+ * @param gasUsed - The gas actually consumed during simulation.
14
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
15
+ * @param pad - Fraction to pad the suggested gas limits by (as a decimal, e.g. 0.1 for 10%). The effective
16
+ * padding shrinks to zero as usage approaches the network limit, since the network will not admit a higher
17
+ * declared limit regardless of the buffer.
18
+ */ export function getGasLimits(gasUsed, maxTxGasLimits, pad = 0.1) {
19
+ const { totalGas, teardownGas } = gasUsed;
20
+ // `maxTxGasLimits` is the node-advertised admission limit. Node info is remote input, so we defensively
21
+ // clamp to the per-tx protocol maxima so a value above them can never be honored.
22
+ const maxLimits = new Gas(Math.min(maxTxGasLimits.daGas, MAX_TX_DA_GAS), Math.min(maxTxGasLimits.l2Gas, MAX_PROCESSABLE_L2_GAS));
23
+ // The simulated usage must fit within the admission limits, otherwise the tx can never be included.
24
+ if (totalGas.daGas > maxLimits.daGas) {
25
+ throw new Error(`Transaction consumes ${totalGas.daGas} DA gas but the network only admits transactions declaring up to ${maxLimits.daGas} DA gas`);
26
+ }
27
+ if (totalGas.l2Gas > maxLimits.l2Gas) {
28
+ throw new Error(`Transaction consumes ${totalGas.l2Gas} L2 gas but the network only admits transactions declaring up to ${maxLimits.l2Gas} L2 gas`);
29
+ }
30
+ // Pad the limits by the buffer, then cap each dimension at the admission limit so the buffer cannot push a
31
+ // declared limit past what inbound validation accepts. Teardown is part of the total, so clamping it to the
32
+ // admission limit is safe.
33
+ return {
34
+ gasLimits: padGas(totalGas, pad, maxLimits),
35
+ teardownGasLimits: padGas(teardownGas, pad, maxLimits)
36
+ };
37
+ }
38
+ /** Pads each gas dimension, capping it at the network admission limit. */ function padGas(gas, pad, cap) {
39
+ const padded = gas.mul(1 + pad);
40
+ return new Gas(Math.min(padded.daGas, cap.daGas), Math.min(padded.l2Gas, cap.l2Gas));
41
+ }
42
+ /**
43
+ * Validates that caller-declared gas limits do not exceed the network's per-tx admission limits, throwing a
44
+ * descriptive error per dimension when they do. The node's inbound validation checks declared
45
+ * `gasSettings.gasLimits`, so we mirror that here to surface the rejection locally before the tx is sent.
46
+ * @param gasLimits - The gas limits the transaction will declare.
47
+ * @param maxTxGasLimits - The maximum gas a single tx may declare on this network (the node-advertised `txsLimits.gas`).
48
+ */ export function assertGasLimitsWithinNetworkLimits(gasLimits, maxTxGasLimits) {
49
+ if (gasLimits.daGas > maxTxGasLimits.daGas) {
50
+ throw new Error(`Declared DA gas limit (${gasLimits.daGas}) exceeds the maximum this network allows per tx (${maxTxGasLimits.daGas})`);
51
+ }
52
+ if (gasLimits.l2Gas > maxTxGasLimits.l2Gas) {
53
+ throw new Error(`Declared L2 gas limit (${gasLimits.l2Gas}) exceeds the maximum this network allows per tx (${maxTxGasLimits.l2Gas})`);
54
+ }
55
+ }
@@ -1,2 +1,4 @@
1
- export { BaseWallet, type FeeOptions } from './base_wallet.js';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLEtBQUssVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUMifQ==
1
+ export { BaseWallet, type CompleteFeeOptionsConfig, type FeeOptions, type SimulateViaEntrypointOptions, } from './base_wallet.js';
2
+ export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
3
+ export { getGasLimits, assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsVUFBVSxFQUNWLEtBQUssd0JBQXdCLEVBQzdCLEtBQUssVUFBVSxFQUNmLEtBQUssNEJBQTRCLEdBQ2xDLE1BQU0sa0JBQWtCLENBQUM7QUFDMUIsT0FBTyxFQUFFLGVBQWUsRUFBRSwyQkFBMkIsRUFBRSxtQ0FBbUMsRUFBRSxNQUFNLFlBQVksQ0FBQztBQUMvRyxPQUFPLEVBQUUsWUFBWSxFQUFFLGtDQUFrQyxFQUFFLE1BQU0scUJBQXFCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,4BAA4B,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,mCAAmC,EAAE,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAE,YAAY,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1 +1,3 @@
1
1
  export { BaseWallet } from './base_wallet.js';
2
+ export { simulateViaNode, buildMergedSimulationResult, extractOptimizablePublicStaticCalls } from './utils.js';
3
+ export { getGasLimits, assertGasLimitsWithinNetworkLimits } from './get_gas_limits.js';
@@ -0,0 +1,52 @@
1
+ import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
3
+ import type { ChainInfo } from '@aztec/entrypoints/interfaces';
4
+ import type { ContractNameResolver } from '@aztec/pxe/client/lazy';
5
+ import { type FunctionCall } from '@aztec/stdlib/abi';
6
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
+ import type { GasSettings } from '@aztec/stdlib/gas';
8
+ import { type BlockHeader, type ExecutionPayload, type SimulationOverrides, TxSimulationResult } from '@aztec/stdlib/tx';
9
+ /**
10
+ * Splits an execution payload into a leading prefix of public static calls
11
+ * (eligible for direct node simulation) and the remaining calls.
12
+ *
13
+ * Only a leading run of public static calls is eligible for optimization.
14
+ * Any non-public-static call may enqueue public state mutations
15
+ * (e.g. private calls can enqueue public calls), so all calls that follow
16
+ * must go through the normal simulation path to see the correct state.
17
+ *
18
+ */
19
+ export declare function extractOptimizablePublicStaticCalls(payload: ExecutionPayload): {
20
+ /** Leading public static calls eligible for direct node simulation. */
21
+ optimizableCalls: FunctionCall[];
22
+ /** All remaining calls. */
23
+ remainingCalls: FunctionCall[];
24
+ };
25
+ /**
26
+ * Simulates public static calls by splitting them into batches of MAX_ENQUEUED_CALLS_PER_CALL
27
+ * and sending each batch directly to the node.
28
+ *
29
+ * @param node - The Aztec node to simulate on.
30
+ * @param publicStaticCalls - Array of public static function calls to optimize.
31
+ * @param from - The account address making the calls.
32
+ * @param chainInfo - Chain information (chainId and version).
33
+ * @param gasSettings - Gas settings for the transaction.
34
+ * @param blockHeader - Block header to use as anchor.
35
+ * @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
36
+ * @param getContractName - Resolver for contract names (used for debug log display).
37
+ * @param overrides - Optional pre-simulation overrides applied to the ephemeral fork and contract DB.
38
+ * @returns Array of TxSimulationResult, one per batch.
39
+ */
40
+ export declare function simulateViaNode(node: AztecNode, publicStaticCalls: FunctionCall[], from: AztecAddress, chainInfo: ChainInfo, gasSettings: GasSettings, blockHeader: BlockHeader, skipFeeEnforcement: boolean | undefined, getContractName: ContractNameResolver, overrides?: SimulationOverrides): Promise<TxSimulationResult[]>;
41
+ /**
42
+ * Merges simulation results from the optimized (public static) and normal paths.
43
+ * Since optimized calls are always a leading prefix, return values are simply
44
+ * concatenated: optimized first, then normal.
45
+ * Stats are taken from the normal result only (the optimized path doesn't produce them).
46
+ *
47
+ * @param optimizedResults - Results from optimized public static call batches.
48
+ * @param normalResult - Result from normal simulation (null if all calls were optimized).
49
+ * @returns A single TxSimulationResult with return values in original call order.
50
+ */
51
+ export declare function buildMergedSimulationResult(optimizedResults: TxSimulationResult[], normalResult: TxSimulationResultWithAppOffset | null): TxSimulationResultWithAppOffset;
52
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN0RCxPQUFPLEVBQUUsK0JBQStCLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUV6RSxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUkvRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBR25FLE9BQU8sRUFBRSxLQUFLLFlBQVksRUFBb0IsTUFBTSxtQkFBbUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIs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imulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
2
+ import { MAX_ENQUEUED_CALLS_PER_CALL } from '@aztec/constants';
3
+ import { makeTuple } from '@aztec/foundation/array';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
5
+ import { displayDebugLogs } from '@aztec/pxe/client/lazy';
6
+ import { generateSimulatedProvingResult } from '@aztec/pxe/simulator';
7
+ import { ClaimedLengthArray, CountedPublicCallRequest, PrivateCircuitPublicInputs, PublicCallRequest } from '@aztec/stdlib/kernel';
8
+ import { ChonkProof } from '@aztec/stdlib/proofs';
9
+ import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx, TxContext, TxSimulationResult } from '@aztec/stdlib/tx';
10
+ /**
11
+ * Splits an execution payload into a leading prefix of public static calls
12
+ * (eligible for direct node simulation) and the remaining calls.
13
+ *
14
+ * Only a leading run of public static calls is eligible for optimization.
15
+ * Any non-public-static call may enqueue public state mutations
16
+ * (e.g. private calls can enqueue public calls), so all calls that follow
17
+ * must go through the normal simulation path to see the correct state.
18
+ *
19
+ */ export function extractOptimizablePublicStaticCalls(payload) {
20
+ const splitIndex = payload.calls.findIndex((call)=>!call.isPublicStatic());
21
+ const boundary = splitIndex === -1 ? payload.calls.length : splitIndex;
22
+ return {
23
+ optimizableCalls: payload.calls.slice(0, boundary),
24
+ remainingCalls: payload.calls.slice(boundary)
25
+ };
26
+ }
27
+ /**
28
+ * Simulates a batch of public static calls by bypassing account entrypoint and private execution,
29
+ * directly constructing a minimal Tx and calling node.simulatePublicCalls.
30
+ *
31
+ * @param node - The Aztec node to simulate on.
32
+ * @param publicStaticCalls - Array of public static function calls (max MAX_ENQUEUED_CALLS_PER_CALL).
33
+ * @param from - The account address making the calls.
34
+ * @param chainInfo - Chain information (chainId and version).
35
+ * @param gasSettings - Gas settings for the transaction.
36
+ * @param blockHeader - Block header to use as anchor.
37
+ * @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
38
+ * @param getContractName - Resolver for contract names (used for debug log display).
39
+ * @param overrides - Optional pre-simulation overrides applied to the ephemeral fork and contract DB.
40
+ * @returns TxSimulationResult with public return values.
41
+ */ async function simulateBatchViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement, getContractName, overrides) {
42
+ const txContext = new TxContext(chainInfo.chainId, chainInfo.version, gasSettings);
43
+ const publicFunctionCalldata = [];
44
+ for (const call of publicStaticCalls){
45
+ const calldata = await HashedValues.fromCalldata([
46
+ call.selector.toField(),
47
+ ...call.args
48
+ ]);
49
+ publicFunctionCalldata.push(calldata);
50
+ }
51
+ const publicCallRequests = makeTuple(MAX_ENQUEUED_CALLS_PER_CALL, (i)=>{
52
+ const call = publicStaticCalls[i];
53
+ if (!call) {
54
+ return CountedPublicCallRequest.empty();
55
+ }
56
+ const publicCallRequest = new PublicCallRequest(from, call.to, call.isStatic, publicFunctionCalldata[i].hash);
57
+ // Counter starts at 1 (minRevertibleSideEffectCounter) so all calls are revertible
58
+ return new CountedPublicCallRequest(publicCallRequest, i + 1);
59
+ });
60
+ const publicCallRequestsArray = new ClaimedLengthArray(publicCallRequests, publicStaticCalls.length);
61
+ const publicInputs = PrivateCircuitPublicInputs.from({
62
+ ...PrivateCircuitPublicInputs.empty(),
63
+ anchorBlockHeader: blockHeader,
64
+ txContext: txContext,
65
+ publicCallRequests: publicCallRequestsArray,
66
+ startSideEffectCounter: new Fr(0),
67
+ endSideEffectCounter: new Fr(publicStaticCalls.length + 1)
68
+ });
69
+ // Minimal entrypoint structure — no real private execution, just public call requests
70
+ const emptyEntrypoint = new PrivateCallExecutionResult(Buffer.alloc(0), Buffer.alloc(0), new Map(), publicInputs, [], new Map(), [], [], [], [], []);
71
+ const privateResult = new PrivateExecutionResult(emptyEntrypoint, Fr.random(), publicFunctionCalldata);
72
+ const provingResult = await generateSimulatedProvingResult(privateResult, (_contractAddress, _functionSelector)=>Promise.resolve(''), node, 1);
73
+ provingResult.publicInputs.feePayer = from;
74
+ const tx = await Tx.create({
75
+ data: provingResult.publicInputs,
76
+ chonkProof: ChonkProof.empty(),
77
+ contractClassLogFields: [],
78
+ publicFunctionCalldata: publicFunctionCalldata
79
+ });
80
+ const publicOutput = await node.simulatePublicCalls(tx, skipFeeEnforcement, overrides);
81
+ if (publicOutput.revertReason) {
82
+ throw publicOutput.revertReason;
83
+ }
84
+ // Display debug logs from the public simulation.
85
+ await displayDebugLogs(publicOutput.debugLogs, getContractName);
86
+ return new TxSimulationResult(privateResult, provingResult.publicInputs, publicOutput, undefined);
87
+ }
88
+ /**
89
+ * Simulates public static calls by splitting them into batches of MAX_ENQUEUED_CALLS_PER_CALL
90
+ * and sending each batch directly to the node.
91
+ *
92
+ * @param node - The Aztec node to simulate on.
93
+ * @param publicStaticCalls - Array of public static function calls to optimize.
94
+ * @param from - The account address making the calls.
95
+ * @param chainInfo - Chain information (chainId and version).
96
+ * @param gasSettings - Gas settings for the transaction.
97
+ * @param blockHeader - Block header to use as anchor.
98
+ * @param skipFeeEnforcement - Whether to skip fee enforcement during simulation.
99
+ * @param getContractName - Resolver for contract names (used for debug log display).
100
+ * @param overrides - Optional pre-simulation overrides applied to the ephemeral fork and contract DB.
101
+ * @returns Array of TxSimulationResult, one per batch.
102
+ */ export async function simulateViaNode(node, publicStaticCalls, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement = true, getContractName, overrides) {
103
+ const batches = [];
104
+ for(let i = 0; i < publicStaticCalls.length; i += MAX_ENQUEUED_CALLS_PER_CALL){
105
+ batches.push(publicStaticCalls.slice(i, i + MAX_ENQUEUED_CALLS_PER_CALL));
106
+ }
107
+ const results = [];
108
+ for (const batch of batches){
109
+ const result = await simulateBatchViaNode(node, batch, from, chainInfo, gasSettings, blockHeader, skipFeeEnforcement, getContractName, overrides);
110
+ results.push(result);
111
+ }
112
+ return results;
113
+ }
114
+ /**
115
+ * Merges simulation results from the optimized (public static) and normal paths.
116
+ * Since optimized calls are always a leading prefix, return values are simply
117
+ * concatenated: optimized first, then normal.
118
+ * Stats are taken from the normal result only (the optimized path doesn't produce them).
119
+ *
120
+ * @param optimizedResults - Results from optimized public static call batches.
121
+ * @param normalResult - Result from normal simulation (null if all calls were optimized).
122
+ * @returns A single TxSimulationResult with return values in original call order.
123
+ */ export function buildMergedSimulationResult(optimizedResults, normalResult) {
124
+ const optimizedReturnValues = optimizedResults.flatMap((r)=>r.publicOutput?.publicReturnValues ?? []);
125
+ const normalReturnValues = normalResult?.publicOutput?.publicReturnValues ?? [];
126
+ const allReturnValues = [
127
+ ...optimizedReturnValues,
128
+ ...normalReturnValues
129
+ ];
130
+ const baseResult = normalResult ?? optimizedResults[0];
131
+ const mergedPublicOutput = baseResult.publicOutput ? {
132
+ ...baseResult.publicOutput,
133
+ publicReturnValues: allReturnValues
134
+ } : undefined;
135
+ const merged = new TxSimulationResult(baseResult.privateExecutionResult, baseResult.publicInputs, mergedPublicOutput, normalResult?.stats);
136
+ return TxSimulationResultWithAppOffset.fromResultAndOffset(merged, normalResult?.appCallOffset ?? 0);
137
+ }
package/dest/crypto.d.ts CHANGED
@@ -36,11 +36,23 @@ export interface SecureKeyPair {
36
36
  /** Private key - keep secret, used for key derivation */
37
37
  privateKey: CryptoKey;
38
38
  }
39
+ /**
40
+ * Session keys derived from ECDH key exchange.
41
+ *
42
+ * Contains both the encryption key and the verification hash (verificationHash)
43
+ * computed from a separate HMAC key.
44
+ */
45
+ export interface SessionKeys {
46
+ /** AES-256-GCM key for message encryption/decryption */
47
+ encryptionKey: CryptoKey;
48
+ /** Hex-encoded verificationHash for verification */
49
+ verificationHash: string;
50
+ }
39
51
  /**
40
52
  * Generates an ECDH P-256 key pair for key exchange.
41
53
  *
42
- * The generated key pair can be used to derive a shared secret with another
43
- * party's public key using {@link deriveSharedKey}.
54
+ * The generated key pair can be used to derive session keys with another
55
+ * party's public key using {@link deriveSessionKeys}.
44
56
  *
45
57
  * @returns A new ECDH key pair
46
58
  *
@@ -72,65 +84,71 @@ export declare function exportPublicKey(publicKey: CryptoKey): Promise<ExportedP
72
84
  /**
73
85
  * Imports a public key from JWK format.
74
86
  *
75
- * Used to import the other party's public key for deriving a shared secret.
87
+ * Used to import the other party's public key for deriving session keys.
76
88
  *
77
89
  * @param exported - The public key in JWK format
78
- * @returns A CryptoKey that can be used with {@link deriveSharedKey}
90
+ * @returns A CryptoKey that can be used with {@link deriveSessionKeys}
79
91
  *
80
92
  * @example
81
93
  * ```typescript
82
- * // Receive exported public key from other party
83
- * const theirPublicKey = await importPublicKey(receivedPublicKey);
84
- * const sharedKey = await deriveSharedKey(myPrivateKey, theirPublicKey);
94
+ * // App side: receive wallet's public key and derive session
95
+ * const walletPublicKey = await importPublicKey(receivedWalletKey);
96
+ * const session = await deriveSessionKeys(appKeyPair, walletPublicKey, true);
85
97
  * ```
86
98
  */
87
99
  export declare function importPublicKey(exported: ExportedPublicKey): Promise<CryptoKey>;
88
100
  /**
89
- * Derives a shared AES-256-GCM key from ECDH key exchange.
101
+ * Derives session keys from ECDH key exchange using HKDF.
90
102
  *
91
- * Both parties will derive the same shared key when using their own private key
92
- * and the other party's public key. This is the core of ECDH key agreement.
103
+ * This is the main key derivation function that produces:
104
+ * 1. An AES-256-GCM encryption key (first 256 bits)
105
+ * 2. An HMAC key for verificationHash computation (second 256 bits)
106
+ * 3. A verificationHash computed as HMAC(hmacKey, "aztec-wallet-verification-verificationHash")
93
107
  *
94
- * @param privateKey - Your ECDH private key
95
- * @param publicKey - The other party's ECDH public key
96
- * @returns An AES-256-GCM key for encryption/decryption
108
+ * The keys are derived using a single HKDF call that produces 512 bits,
109
+ * then split into the two keys.
110
+ *
111
+ * @param ownKeyPair - The caller's ECDH key pair (private for ECDH, public for salt)
112
+ * @param peerPublicKey - The peer's ECDH public key (for ECDH and salt)
113
+ * @param isApp - true if caller is the app, false if caller is the wallet
114
+ * @returns Session keys containing encryption key and verificationHash
97
115
  *
98
116
  * @example
99
117
  * ```typescript
100
- * // Both parties derive the same key
101
- * const sharedKeyA = await deriveSharedKey(privateKeyA, publicKeyB);
102
- * const sharedKeyB = await deriveSharedKey(privateKeyB, publicKeyA);
103
- * // sharedKeyA and sharedKeyB are equivalent
118
+ * // App side
119
+ * const sessionA = await deriveSessionKeys(appKeyPair, walletPublicKey, true);
120
+ * // Wallet side
121
+ * const sessionB = await deriveSessionKeys(walletKeyPair, appPublicKey, false);
122
+ * // sessionA.verificationHash === sessionB.verificationHash
104
123
  * ```
105
124
  */
106
- export declare function deriveSharedKey(privateKey: CryptoKey, publicKey: CryptoKey): Promise<CryptoKey>;
125
+ export declare function deriveSessionKeys(ownKeyPair: SecureKeyPair, peerPublicKey: CryptoKey, isApp: boolean): Promise<SessionKeys>;
107
126
  /**
108
127
  * Encrypts data using AES-256-GCM.
109
128
  *
110
- * The data is JSON serialized before encryption. A random 12-byte IV is
111
- * generated for each encryption operation.
129
+ * A random 12-byte IV is generated for each encryption operation.
112
130
  *
113
131
  * AES-GCM provides both confidentiality and authenticity - any tampering
114
132
  * with the ciphertext will cause decryption to fail.
115
133
  *
116
- * @param key - The AES-GCM key (from {@link deriveSharedKey})
117
- * @param data - The data to encrypt (will be JSON serialized)
134
+ * @param key - The AES-GCM key (from {@link deriveSessionKeys})
135
+ * @param data - The string data to encrypt (caller is responsible for serialization)
118
136
  * @returns The encrypted payload with IV and ciphertext
119
137
  *
120
138
  * @example
121
139
  * ```typescript
122
- * const encrypted = await encrypt(sharedKey, { action: 'transfer', amount: 100 });
140
+ * const encrypted = await encrypt(session.encryptionKey, JSON.stringify({ action: 'transfer', amount: 100 }));
123
141
  * // encrypted.iv and encrypted.ciphertext are base64 strings
124
142
  * ```
125
143
  */
126
- export declare function encrypt(key: CryptoKey, data: unknown): Promise<EncryptedPayload>;
144
+ export declare function encrypt(key: CryptoKey, data: string): Promise<EncryptedPayload>;
127
145
  /**
128
146
  * Decrypts data using AES-256-GCM.
129
147
  *
130
148
  * The decrypted data is JSON parsed before returning.
131
149
  *
132
150
  * @typeParam T - The expected type of the decrypted data
133
- * @param key - The AES-GCM key (from {@link deriveSharedKey})
151
+ * @param key - The AES-GCM key (from {@link deriveSessionKeys})
134
152
  * @param payload - The encrypted payload from {@link encrypt}
135
153
  * @returns The decrypted and parsed data
136
154
  *
@@ -138,46 +156,75 @@ export declare function encrypt(key: CryptoKey, data: unknown): Promise<Encrypte
138
156
  *
139
157
  * @example
140
158
  * ```typescript
141
- * const decrypted = await decrypt<{ action: string; amount: number }>(sharedKey, encrypted);
159
+ * const decrypted = await decrypt<{ action: string; amount: number }>(session.encryptionKey, encrypted);
142
160
  * console.log(decrypted.action); // 'transfer'
143
161
  * ```
144
162
  */
145
163
  export declare function decrypt<T = unknown>(key: CryptoKey, payload: EncryptedPayload): Promise<T>;
146
164
  /**
147
- * Hashes a shared AES key to a hex string for verification.
148
- *
149
- * This extracts the raw key material and hashes it with SHA-256,
150
- * returning the first 16 bytes as a hex string.
151
- *
152
- * @param sharedKey - The AES-GCM shared key (must be extractable)
153
- * @returns A hex string representation of the hash
154
- *
155
- * @example
156
- * ```typescript
157
- * const hash = await hashSharedSecret(sharedKey);
158
- * const emoji = hashToEmoji(hash);
159
- * ```
165
+ * Default grid size for emoji verification display.
166
+ * 3x3 grid = 9 emojis = 72 bits of security.
160
167
  */
161
- export declare function hashSharedSecret(sharedKey: CryptoKey): Promise<string>;
168
+ export declare const DEFAULT_EMOJI_GRID_SIZE = 9;
162
169
  /**
163
170
  * Converts a hex hash to an emoji sequence for visual verification.
164
171
  *
165
- * This is used for anti-MITM verification - both the dApp and wallet
166
- * independently compute the same emoji sequence from the shared secret.
172
+ * This is used for verification - both the dApp and wallet
173
+ * independently compute the same emoji sequence from the derived keys.
167
174
  * Users can visually compare the sequences to detect interception.
168
175
  *
169
- * Similar to SAS (Short Authentication String) in ZRTP/Signal.
176
+ * With a 256-emoji alphabet and 9 emojis (3x3 grid), this provides
177
+ * 72 bits of security (9 * 8 = 72 bits), making brute-force attacks
178
+ * computationally infeasible.
170
179
  *
171
- * @param hash - Hex string from {@link hashSharedSecret}
172
- * @param length - Number of emojis to generate (default: 4)
180
+ * @param hash - Hex string from verification hash (64 chars = 32 bytes)
181
+ * @param count - Number of emojis to generate (default: 9 for 3x3 grid)
173
182
  * @returns A string of emojis representing the hash
174
183
  *
175
184
  * @example
176
185
  * ```typescript
177
- * const hash = await hashSharedSecret(sharedKey);
178
- * const emoji = hashToEmoji(hash); // e.g., "🔵🦋🎯🐼"
179
- * // Display to user for verification
186
+ * const session = await deriveSessionKeys(...);
187
+ * const emoji = hashToEmoji(session.verificationHash); // e.g., "🔵🦋🎯🐼🌟🎲🦊🐸💎"
188
+ * // Display as 3x3 grid to user for verification
180
189
  * ```
181
190
  */
182
- export declare function hashToEmoji(hash: string, length?: number): string;
183
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3J5cHRvLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY3J5cHRvLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQW1DQTs7OztHQUlHO0FBQ0gsTUFBTSxXQUFXLGlCQUFpQjtJQUNoQyxnREFBZ0Q7SUFDaEQsR0FBRyxFQUFFLE1BQU0sQ0FBQztJQUNaLGtDQUFrQztJQUNsQyxHQUFHLEVBQUUsTUFBTSxDQUFDO0lBQ1osdUNBQXVDO0lBQ3ZDLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDVix1Q0FBdUM7SUFDdkMsQ0FBQyxFQUFFLE1BQU0sQ0FBQztDQUNYO0FBRUQ7Ozs7R0FJRztBQUNILE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsdURBQXVEO0lBQ3ZELEVBQUUsRUFBRSxNQUFNLENBQUM7SUFDWCxrQ0FBa0M7SUFDbEMsVUFBVSxFQUFFLE1BQU0sQ0FBQztDQUNwQjtBQUVEOzs7OztHQUtHO0FBQ0gsTUFBTSxXQUFXLGFBQWE7SUFDNUIsaUNBQWlDO0lBQ2pDLFNBQVMsRUFBRSxTQUFTLENBQUM7S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NLENBQUMsQ0FPNUU7QUFFRDs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1CRztBQUNILHdCQUFnQixXQUFXLENBQUMsSUFBSSxFQUFFLE1BQU0sRUFBRSxNQUFNLEdBQUUsTUFBVSxHQUFHLE1BQU0sQ0FNcEUifQ==
191
+ export declare function hashToEmoji(hash: string, count?: number): string;
192
+ /**
193
+ * Derives an AES-256-GCM key from a passphrase using PBKDF2-SHA256.
194
+ *
195
+ * @param passphrase - The user-provided passphrase or PIN
196
+ * @param salt - Random salt bytes
197
+ * @param iterations - PBKDF2 iteration count (default: 2,000,000)
198
+ * @returns An AES-256-GCM CryptoKey
199
+ */
200
+ export declare function deriveKeyFromPassphrase(passphrase: string, salt: Uint8Array, iterations?: number): Promise<CryptoKey>;
201
+ /**
202
+ * Encrypts arbitrary bytes with a passphrase using PBKDF2 + AES-256-GCM.
203
+ *
204
+ * Output layout: `[salt (16)] [iv (12)] [ciphertext (...)]`
205
+ *
206
+ * @param plaintext - Data to encrypt
207
+ * @param passphrase - User passphrase or PIN
208
+ * @param iterations - PBKDF2 iteration count (default: 2,000,000)
209
+ * @returns A Uint8Array containing salt + iv + ciphertext
210
+ */
211
+ export declare function encryptWithPassphrase(plaintext: Uint8Array, passphrase: string, iterations?: number): Promise<Uint8Array>;
212
+ /**
213
+ * Decrypts data produced by {@link encryptWithPassphrase}.
214
+ *
215
+ * @param data - The encrypted blob (salt + iv + ciphertext)
216
+ * @param passphrase - The passphrase used during encryption
217
+ * @param iterations - PBKDF2 iteration count (must match encryption)
218
+ * @returns The decrypted plaintext bytes
219
+ * @throws On wrong passphrase (AES-GCM auth tag mismatch)
220
+ */
221
+ export declare function decryptWithPassphrase(data: Uint8Array, passphrase: string, iterations?: number): Promise<Uint8Array>;
222
+ /**
223
+ * Converts a Uint8Array to a base64 string.
224
+ */
225
+ export declare function uint8ToBase64(bytes: Uint8Array): string;
226
+ /**
227
+ * Converts a base64 string to a Uint8Array.
228
+ */
229
+ export declare function base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