@permissionless-technologies/upp-sdk 0.5.4 → 0.5.6

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 (90) hide show
  1. package/dist/{chunk-Q6BLTPWV.js → chunk-2NKFTLPD.js} +3 -3
  2. package/dist/{chunk-Q6BLTPWV.js.map → chunk-2NKFTLPD.js.map} +1 -1
  3. package/dist/{chunk-EHGH6TAW.js → chunk-37RFFZU2.js} +3 -3
  4. package/dist/{chunk-EHGH6TAW.js.map → chunk-37RFFZU2.js.map} +1 -1
  5. package/dist/{chunk-UQIM2KT3.js → chunk-4E23V3AT.js} +29 -4
  6. package/dist/chunk-4E23V3AT.js.map +1 -0
  7. package/dist/{chunk-53JACDGZ.js → chunk-A6IYQ7UF.js} +3 -3
  8. package/dist/chunk-A6IYQ7UF.js.map +1 -0
  9. package/dist/{chunk-7T4CUE6E.js → chunk-AVSR443A.js} +3 -3
  10. package/dist/{chunk-7T4CUE6E.js.map → chunk-AVSR443A.js.map} +1 -1
  11. package/dist/{chunk-UFEDJJSH.cjs → chunk-BCSMUH4L.cjs} +30 -3
  12. package/dist/chunk-BCSMUH4L.cjs.map +1 -0
  13. package/dist/{chunk-IYRCJAME.cjs → chunk-C3HXJ5A6.cjs} +9 -9
  14. package/dist/{chunk-IYRCJAME.cjs.map → chunk-C3HXJ5A6.cjs.map} +1 -1
  15. package/dist/{chunk-DD4NT4D7.js → chunk-CRUJLZV7.js} +4 -3
  16. package/dist/chunk-CRUJLZV7.js.map +1 -0
  17. package/dist/{chunk-DTEAFJG7.js → chunk-FTEXUSHR.js} +4 -4
  18. package/dist/{chunk-DTEAFJG7.js.map → chunk-FTEXUSHR.js.map} +1 -1
  19. package/dist/chunk-FW2U6TKQ.js +498 -0
  20. package/dist/chunk-FW2U6TKQ.js.map +1 -0
  21. package/dist/{chunk-6TFDBBAQ.js → chunk-H4NDMIPF.js} +3 -3
  22. package/dist/{chunk-6TFDBBAQ.js.map → chunk-H4NDMIPF.js.map} +1 -1
  23. package/dist/{chunk-4T5DWZBN.cjs → chunk-HVSP62AH.cjs} +22 -36
  24. package/dist/chunk-HVSP62AH.cjs.map +1 -0
  25. package/dist/{chunk-7BNJV2ZS.cjs → chunk-LKXC3OQT.cjs} +14 -14
  26. package/dist/{chunk-7BNJV2ZS.cjs.map → chunk-LKXC3OQT.cjs.map} +1 -1
  27. package/dist/{chunk-HB43C26P.cjs → chunk-NGXEIUQ6.cjs} +4 -4
  28. package/dist/chunk-NGXEIUQ6.cjs.map +1 -0
  29. package/dist/{chunk-O2SKZZAP.cjs → chunk-P6E3LE7T.cjs} +4 -3
  30. package/dist/chunk-P6E3LE7T.cjs.map +1 -0
  31. package/dist/chunk-PGIV2GDM.cjs +511 -0
  32. package/dist/chunk-PGIV2GDM.cjs.map +1 -0
  33. package/dist/{chunk-4W7BBQ4H.js → chunk-UHMHZQZV.js} +6 -20
  34. package/dist/chunk-UHMHZQZV.js.map +1 -0
  35. package/dist/{chunk-I5EKGD4P.cjs → chunk-XNSMPNY6.cjs} +4 -4
  36. package/dist/{chunk-I5EKGD4P.cjs.map → chunk-XNSMPNY6.cjs.map} +1 -1
  37. package/dist/{chunk-U3YFYMWF.cjs → chunk-XSJ5VVH4.cjs} +5 -5
  38. package/dist/{chunk-U3YFYMWF.cjs.map → chunk-XSJ5VVH4.cjs.map} +1 -1
  39. package/dist/{chunk-SWTNJPK5.cjs → chunk-Y6WCXYOC.cjs} +11 -11
  40. package/dist/{chunk-SWTNJPK5.cjs.map → chunk-Y6WCXYOC.cjs.map} +1 -1
  41. package/dist/core/index.cjs +62 -66
  42. package/dist/core/index.d.cts +2 -5
  43. package/dist/core/index.d.ts +2 -5
  44. package/dist/core/index.js +6 -6
  45. package/dist/crypto-FWREDAVI.js +8 -0
  46. package/dist/crypto-FWREDAVI.js.map +1 -0
  47. package/dist/crypto-IZKHHFDU.cjs +42 -0
  48. package/dist/crypto-IZKHHFDU.cjs.map +1 -0
  49. package/dist/{index-BRgBwiBM.d.ts → index-DLvLv3mg.d.ts} +11 -23
  50. package/dist/{index-D6YhhbRP.d.cts → index-DOiHUft6.d.cts} +3 -4
  51. package/dist/{index-DHW5lKcd.d.ts → index-DY0XAmFw.d.ts} +3 -4
  52. package/dist/{index-brLSTa0y.d.cts → index-KTJgQUxb.d.cts} +11 -23
  53. package/dist/index.cjs +126 -126
  54. package/dist/index.d.cts +4 -7
  55. package/dist/index.d.ts +4 -7
  56. package/dist/index.js +9 -9
  57. package/dist/indexer/index.cjs +62 -11
  58. package/dist/indexer/index.d.cts +196 -12
  59. package/dist/indexer/index.d.ts +196 -12
  60. package/dist/indexer/index.js +4 -1
  61. package/dist/keys/index.cjs +17 -17
  62. package/dist/keys/index.js +3 -3
  63. package/dist/react/index.cjs +214 -690
  64. package/dist/react/index.cjs.map +1 -1
  65. package/dist/react/index.d.cts +138 -6
  66. package/dist/react/index.d.ts +138 -6
  67. package/dist/react/index.js +193 -669
  68. package/dist/react/index.js.map +1 -1
  69. package/dist/{transfer-CKA4PU2C.js → transfer-2UYFZMIK.js} +3 -3
  70. package/dist/{transfer-CKA4PU2C.js.map → transfer-2UYFZMIK.js.map} +1 -1
  71. package/dist/{transfer-QFTVCREE.cjs → transfer-6OW3XKVC.cjs} +9 -9
  72. package/dist/{transfer-QFTVCREE.cjs.map → transfer-6OW3XKVC.cjs.map} +1 -1
  73. package/dist/{transfer-p-NXHdGY.d.cts → transfer-C1XU_z-6.d.cts} +46 -156
  74. package/dist/{transfer-BxiDgCvx.d.ts → transfer-DgjxZlR7.d.ts} +46 -156
  75. package/dist/utils/index.cjs +44 -44
  76. package/dist/utils/index.d.cts +186 -5
  77. package/dist/utils/index.d.ts +186 -5
  78. package/dist/utils/index.js +4 -4
  79. package/package.json +1 -1
  80. package/src/deployments/31337.json +2 -1
  81. package/dist/chunk-4T5DWZBN.cjs.map +0 -1
  82. package/dist/chunk-4W7BBQ4H.js.map +0 -1
  83. package/dist/chunk-53JACDGZ.js.map +0 -1
  84. package/dist/chunk-DD4NT4D7.js.map +0 -1
  85. package/dist/chunk-HB43C26P.cjs.map +0 -1
  86. package/dist/chunk-O2SKZZAP.cjs.map +0 -1
  87. package/dist/chunk-UFEDJJSH.cjs.map +0 -1
  88. package/dist/chunk-UQIM2KT3.js.map +0 -1
  89. package/dist/stark-BcTD1OaJ.d.cts +0 -185
  90. package/dist/stark-BcTD1OaJ.d.ts +0 -185
@@ -1,9 +1,9 @@
1
- export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-DD4NT4D7.js';
1
+ export { buildTransfer, buildUPPTransferCircuitInputs, computeNullifier, formatOutputForContract, getMerkleProofsForNotes, syncMerkleTree } from './chunk-CRUJLZV7.js';
2
2
  import './chunk-KR4GB6VC.js';
3
3
  import './chunk-6IEYWJVS.js';
4
4
  import './chunk-2BSIUEPO.js';
5
5
  import './chunk-GPF72JFR.js';
6
6
  import './chunk-5QSSX3KR.js';
7
7
  import './chunk-Z6ZWNWWR.js';
8
- //# sourceMappingURL=transfer-CKA4PU2C.js.map
9
- //# sourceMappingURL=transfer-CKA4PU2C.js.map
8
+ //# sourceMappingURL=transfer-2UYFZMIK.js.map
9
+ //# sourceMappingURL=transfer-2UYFZMIK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-CKA4PU2C.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-2UYFZMIK.js"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkO2SKZZAP_cjs = require('./chunk-O2SKZZAP.cjs');
3
+ var chunkP6E3LE7T_cjs = require('./chunk-P6E3LE7T.cjs');
4
4
  require('./chunk-IX7HV5TE.cjs');
5
5
  require('./chunk-XVIICZKW.cjs');
6
6
  require('./chunk-VVW5VVY3.cjs');
@@ -12,27 +12,27 @@ require('./chunk-G7VZBCD6.cjs');
12
12
 
13
13
  Object.defineProperty(exports, "buildTransfer", {
14
14
  enumerable: true,
15
- get: function () { return chunkO2SKZZAP_cjs.buildTransfer; }
15
+ get: function () { return chunkP6E3LE7T_cjs.buildTransfer; }
16
16
  });
17
17
  Object.defineProperty(exports, "buildUPPTransferCircuitInputs", {
18
18
  enumerable: true,
19
- get: function () { return chunkO2SKZZAP_cjs.buildUPPTransferCircuitInputs; }
19
+ get: function () { return chunkP6E3LE7T_cjs.buildUPPTransferCircuitInputs; }
20
20
  });
21
21
  Object.defineProperty(exports, "computeNullifier", {
22
22
  enumerable: true,
23
- get: function () { return chunkO2SKZZAP_cjs.computeNullifier; }
23
+ get: function () { return chunkP6E3LE7T_cjs.computeNullifier; }
24
24
  });
25
25
  Object.defineProperty(exports, "formatOutputForContract", {
26
26
  enumerable: true,
27
- get: function () { return chunkO2SKZZAP_cjs.formatOutputForContract; }
27
+ get: function () { return chunkP6E3LE7T_cjs.formatOutputForContract; }
28
28
  });
29
29
  Object.defineProperty(exports, "getMerkleProofsForNotes", {
30
30
  enumerable: true,
31
- get: function () { return chunkO2SKZZAP_cjs.getMerkleProofsForNotes; }
31
+ get: function () { return chunkP6E3LE7T_cjs.getMerkleProofsForNotes; }
32
32
  });
33
33
  Object.defineProperty(exports, "syncMerkleTree", {
34
34
  enumerable: true,
35
- get: function () { return chunkO2SKZZAP_cjs.syncMerkleTree; }
35
+ get: function () { return chunkP6E3LE7T_cjs.syncMerkleTree; }
36
36
  });
37
- //# sourceMappingURL=transfer-QFTVCREE.cjs.map
38
- //# sourceMappingURL=transfer-QFTVCREE.cjs.map
37
+ //# sourceMappingURL=transfer-6OW3XKVC.cjs.map
38
+ //# sourceMappingURL=transfer-6OW3XKVC.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-QFTVCREE.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"transfer-6OW3XKVC.cjs"}
@@ -2,9 +2,6 @@ import { Address, Hex, PublicClient } from 'viem';
2
2
  import { d as buildMerkleTree, a as MerkleProof } from './merkle-mteVOlDf.cjs';
3
3
  import { a as M31Digest } from './keccak-m31-B_AqBbRF.cjs';
4
4
  import * as _permissionless_technologies_upc_sdk from '@permissionless-technologies/upc-sdk';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { ReactNode } from 'react';
7
- import { M as MasterKeys, b as StarkMasterKeys } from './types-CJSbxv4q.cjs';
8
5
 
9
6
  /**
10
7
  * Core type definitions for UPP SDK
@@ -14,6 +11,48 @@ import { M as MasterKeys, b as StarkMasterKeys } from './types-CJSbxv4q.cjs';
14
11
  * Note version - increment when note structure changes
15
12
  */
16
13
  declare const NOTE_VERSION = 5;
14
+ /** Note lifecycle status */
15
+ type NoteStatus = 'pending' | 'confirmed' | 'spent';
16
+ /** Which proof system created/guards a note */
17
+ type ProofSystem = 'snark' | 'stark';
18
+ /**
19
+ * A shielded note (UTXO) - Post-quantum hash-based
20
+ *
21
+ * Commitment = Poseidon(amount, ownerHash, blinding, origin, token)
22
+ * where ownerHash = Poseidon(spendingSecret)
23
+ */
24
+ interface ShieldedNote {
25
+ /** Amount of tokens */
26
+ amount: bigint;
27
+ /** Random blinding factor */
28
+ blinding: bigint;
29
+ /** Commitment hash (hex) */
30
+ commitment: string;
31
+ /** Spending secret for this note (hex) - proves ownership via hash preimage */
32
+ ownerSecret: string;
33
+ /** Owner hash = Poseidon(ownerSecret) - what's committed on-chain (hex) */
34
+ ownerHash: string;
35
+ /** Position in Merkle tree */
36
+ leafIndex: number;
37
+ /** Origin address (original depositor) as hex */
38
+ origin: string;
39
+ /** Token address as hex */
40
+ token: string;
41
+ /** Transaction hash */
42
+ txHash?: string;
43
+ /** Note status */
44
+ status: NoteStatus;
45
+ /** Timestamp */
46
+ timestamp: number;
47
+ /** Which proof system created this note (defaults to 'snark' for legacy notes) */
48
+ proofSystem?: ProofSystem;
49
+ /** Block number where note was created (from IndexedNote) */
50
+ blockNumber?: number;
51
+ /** Ephemeral public key X (R.x — used as viewing key nonce, for ECDH-based notes) */
52
+ ephemeralX?: string;
53
+ /** Ephemeral public key Y (R.y, for ECDH-based notes) */
54
+ ephemeralY?: string;
55
+ }
17
56
  /**
18
57
  * A private note in the Universal Private Pool
19
58
  */
@@ -1264,40 +1303,12 @@ declare function generateMultiOriginASPProof(aspId: bigint, origin: bigint, allO
1264
1303
  */
1265
1304
  declare function generateASPProof(aspId: bigint, origin: bigint, approvedOrigins?: bigint[]): Promise<ASPProof>;
1266
1305
 
1267
- /** Which proof system created/guards a note */
1268
- type ProofSystemType = 'snark' | 'stark';
1269
1306
  /**
1270
- * A shielded note (UTXO) - Post-quantum hash-based
1307
+ * Note cryptographic operations create and encrypt shielded notes
1271
1308
  *
1272
- * Commitment = Poseidon(amount, ownerHash, blinding, origin, token)
1273
- * where ownerHash = Poseidon(spendingSecret)
1309
+ * Framework-agnostic. Pure async functions for note creation and
1310
+ * AES-GCM encryption using the viewing secret as symmetric key.
1274
1311
  */
1275
- interface ShieldedNote {
1276
- /** Amount of tokens */
1277
- amount: bigint;
1278
- /** Random blinding factor */
1279
- blinding: bigint;
1280
- /** Commitment hash (hex) */
1281
- commitment: string;
1282
- /** Spending secret for this note (hex) - proves ownership via hash preimage */
1283
- ownerSecret: string;
1284
- /** Owner hash = Poseidon(ownerSecret) - what's committed on-chain (hex) */
1285
- ownerHash: string;
1286
- /** Position in Merkle tree */
1287
- leafIndex: number;
1288
- /** Origin address (original depositor) as hex */
1289
- origin: string;
1290
- /** Token address as hex */
1291
- token: string;
1292
- /** Transaction hash */
1293
- txHash?: string;
1294
- /** Note status */
1295
- status: 'pending' | 'confirmed' | 'spent';
1296
- /** Timestamp */
1297
- timestamp: number;
1298
- /** Which proof system created this note (defaults to 'snark' for legacy notes) */
1299
- proofSystem?: ProofSystemType;
1300
- }
1301
1312
  /**
1302
1313
  * Note creation result (BLS12-381, hash-based ownership)
1303
1314
  *
@@ -1317,127 +1328,6 @@ interface NoteCreationResult {
1317
1328
  origin: bigint;
1318
1329
  token: bigint;
1319
1330
  }
1320
- /**
1321
- * Indexer configuration for advanced usage
1322
- */
1323
- interface IndexerConfig {
1324
- /** Enable IndexedDB storage (default: true if available) */
1325
- useIndexedDB?: boolean;
1326
- /** Custom storage prefix for multi-account support */
1327
- storagePrefix?: string;
1328
- /** Batch size for RPC scanning (default: 200, adapts on rate limits) */
1329
- batchSize?: number;
1330
- /** Sync interval for live sync in ms (default: 30000) */
1331
- liveSyncIntervalMs?: number;
1332
- /** Starting block for new accounts (skips blocks before account creation) */
1333
- fromBlock?: number;
1334
- /** Pool contract address (required for indexer) */
1335
- contractAddress?: Address;
1336
- /** UPPSwapModule proxy address (swap events come from this contract, not the pool) */
1337
- swapModuleAddress?: Address;
1338
- }
1339
- /**
1340
- * Context type for UPP Account
1341
- */
1342
- interface UPPAccountContextType {
1343
- /** SNARK master keys (null if not setup) */
1344
- masterKeys: MasterKeys | null;
1345
- /** STARK master keys (null if not setup) */
1346
- starkMasterKeys: StarkMasterKeys | null;
1347
- /** Connected wallet address */
1348
- ethAddress: string | null;
1349
- /** Owner hash (public identifier, hex) — SNARK */
1350
- ownerHash: string | null;
1351
- /** Stealth address (bech32m encoded, 0zk prefix) — SNARK */
1352
- stealthAddress: string | null;
1353
- /** STARK stealth address (bech32m encoded, 0zs prefix) */
1354
- starkStealthAddress: string | null;
1355
- /** All notes */
1356
- notes: ShieldedNote[];
1357
- /** Unspent notes */
1358
- unspentNotes: ShieldedNote[];
1359
- /** Total balance of unspent notes */
1360
- balance: bigint;
1361
- /** Whether account is set up */
1362
- isSetup: boolean;
1363
- /** Whether SDK is loading/initializing */
1364
- isLoading: boolean;
1365
- /** Whether crypto is ready */
1366
- cryptoReady: boolean;
1367
- /** Whether sync is in progress */
1368
- isSyncing: boolean;
1369
- /** Last synced block number */
1370
- lastSyncedBlock: number;
1371
- /** Set up a new account from wallet signature (low-level) */
1372
- setupAccount: (signature: Hex) => Promise<void>;
1373
- /** Connect private account via EIP-712 wallet signature (requires wagmi signTypedData) */
1374
- connect: (password?: string) => Promise<void>;
1375
- /** Whether a connect operation is in progress */
1376
- isConnecting: boolean;
1377
- /** Clear account and logout */
1378
- logout: () => void;
1379
- /** Alias for logout */
1380
- disconnect: () => void;
1381
- /** Add a note to the account */
1382
- addNote: (note: ShieldedNote) => void;
1383
- /** Mark a note as spent */
1384
- markNoteSpent: (commitment: string) => void;
1385
- /** Create note for self (e.g., shield or change output) */
1386
- createNoteForSelf: (amount: bigint, origin: bigint, token: bigint) => Promise<NoteCreationResult>;
1387
- /** Get owner hash */
1388
- getOwnerHash: () => bigint | null;
1389
- /** Select optimal circuit for a given amount */
1390
- selectOptimalCircuit: (requiredAmount: bigint, tokenAddress?: string) => {
1391
- circuit: '1x2' | '2x2' | null;
1392
- selectedNotes: ShieldedNote[];
1393
- error?: string;
1394
- };
1395
- /** Sync notes from blockchain (requires client to be passed in) */
1396
- syncNotes: (contractAddress: Address, client: any) => Promise<number>;
1397
- /** Start live sync (polls for new notes at interval) */
1398
- startLiveSync: (contractAddress: Address, client: any) => void;
1399
- /** Stop live sync */
1400
- stopLiveSync: () => void;
1401
- /** Whether live sync is active */
1402
- isLiveSyncing: boolean;
1403
- }
1404
- /**
1405
- * Function signature for EIP-712 typed data signing.
1406
- * Compatible with wagmi's signTypedDataAsync.
1407
- */
1408
- type SignTypedDataFn = (args: {
1409
- domain: {
1410
- name: string;
1411
- version: string;
1412
- chainId: number;
1413
- };
1414
- types: Record<string, Array<{
1415
- name: string;
1416
- type: string;
1417
- }>>;
1418
- primaryType: string;
1419
- message: Record<string, unknown>;
1420
- }) => Promise<Hex>;
1421
- interface UPPAccountProviderProps {
1422
- children: ReactNode;
1423
- /** Ethereum address of connected wallet */
1424
- ethAddress?: string;
1425
- /** Chain ID */
1426
- chainId?: number;
1427
- /** Indexer configuration */
1428
- indexerConfig?: IndexerConfig;
1429
- /** EIP-712 signing function (from wagmi's useSignTypedData().signTypedDataAsync) */
1430
- signTypedData?: SignTypedDataFn;
1431
- /** Public client for chain fingerprint validation (e.g. from wagmi usePublicClient) */
1432
- publicClient?: any;
1433
- /** Active proof system — filters unspentNotes and balance to only show spendable notes */
1434
- activeProofSystem?: ProofSystemType;
1435
- }
1436
- declare function UPPAccountProvider({ children, ethAddress, chainId, indexerConfig, signTypedData, publicClient: publicClientProp, activeProofSystem, }: UPPAccountProviderProps): react_jsx_runtime.JSX.Element;
1437
- /**
1438
- * Hook to access UPP Account context
1439
- */
1440
- declare function useUPPAccount(): UPPAccountContextType;
1441
1331
 
1442
1332
  /**
1443
1333
  * Transfer Module
@@ -1597,4 +1487,4 @@ declare function formatOutputForContract(note: NoteCreationResult): {
1597
1487
  encryptedNote: Hex;
1598
1488
  };
1599
1489
 
1600
- export { type TransferParams as $, type ASPProof as A, type ShieldParams as B, CIRCUIT_CDN_BASE as C, DEMO_ASP_ID as D, type EncryptedNote as E, type SpendableNote as F, type StarkNote as G, type StarkProof as H, type StarkStealthMetaAddress as I, type Stealth1x2CircuitInputs as J, type Stealth2x2CircuitInputs as K, type StealthAddress as L, type MergeParams as M, NOTE_VERSION as N, type StealthCircuitInputs as O, type PlonkProvingStage as P, type StealthCircuitType as Q, RATE_PRECISION as R, STATE_TREE_DEPTH as S, type StealthMetaAddress as T, type SwapFillEvent as U, type SwapFillParams as V, type SwapOrder as W, type SwapOrderEvent as X, type SwapOrderParams as Y, type TransferBuildResult as Z, type TransferContext as _, type ASPRoot as a, type TransferStage as a0, type UPPCircuitInputs as a1, type UPPCircuitType as a2, type UPPTransferCircuitInputs as a3, type UPPWithdrawCircuitInputs as a4, type WithdrawParams as a5, buildASPTree as a6, buildTransfer as a7, buildUPPTransferCircuitInputs as a8, computeCancelKeyHash as a9, getUPPCircuitArtifacts as aA, isFillerASPAccepted as aB, isOrderActive as aC, removeCancelSecret as aD, storeCancelSecret as aE, syncMerkleTree as aF, verifyASPProof as aG, verifyProof as aH, type NoteCreationResult as aI, type PlonkProofStruct as aJ, type ShieldedNote as aK, useUPPAccount as aL, UPPAccountProvider as aM, type UPPAccountContextType as aN, type ProofSystemType as aO, type IndexerConfig as aP, type SignTypedDataFn as aQ, ASP_TREE_DEPTH as aR, computeFillPercentage as aa, computeGiveAmount as ab, computeMultiOriginASPRoot as ac, computeNullifier as ad, computeRate as ae, computeSingleOriginASPRoot as af, computeTakeAmount as ag, computeTotalBuyAmount as ah, createDemoASPRoot as ai, filterOrdersByASP as aj, filterOrdersByTokenPair as ak, formatOutputForContract as al, formatProofForContract as am, formatRate as an, generateASPProof as ao, generateCancelSecret as ap, generateMultiOriginASPProof as aq, generateProof as ar, generateSingleOriginASPProof as as, generateStealthProof as at, generateUPPProof as au, generateUPPProofAsync as av, getCancelSecret as aw, getMerkleProofsForNotes as ax, getOwnOrderIds as ay, getStealthCircuitArtifacts as az, ASP_TREE_DEPTH$1 as b, CIRCUIT_VERSION as c, CircuitArtifactCache as d, type CircuitArtifacts as e, type CircuitCacheStatus as f, type CircuitType as g, type Commitment as h, DEMO_ASP_NAME as i, type DownloadProgress as j, type MergeRecord as k, type MerkleProofWithNote as l, type Note as m, type NoteWithAmount as n, type Nullifier as o, type Proof as p, type ProofResult as q, ProofWorkerManager as r, type ProofWorkerRequest as s, type ProofWorkerResponse as t, type ResolvedCircuitArtifacts as u, SWAP_EVENTS_ABI as v, SWAP_ORDER_CANCELLED_EVENT as w, SWAP_ORDER_CLAIMED_EVENT as x, SWAP_ORDER_FILLED_EVENT as y, SWAP_ORDER_PLACED_EVENT as z };
1490
+ export { type SwapOrderParams as $, type ASPProof as A, SWAP_ORDER_FILLED_EVENT as B, CIRCUIT_CDN_BASE as C, DEMO_ASP_ID as D, type EncryptedNote as E, SWAP_ORDER_PLACED_EVENT as F, type ShieldParams as G, type ShieldedNote as H, type SpendableNote as I, type StarkNote as J, type StarkProof as K, type StarkStealthMetaAddress as L, type MergeParams as M, NOTE_VERSION as N, type Stealth1x2CircuitInputs as O, type PlonkProvingStage as P, type Stealth2x2CircuitInputs as Q, RATE_PRECISION as R, STATE_TREE_DEPTH as S, type StealthAddress as T, type StealthCircuitInputs as U, type StealthCircuitType as V, type StealthMetaAddress as W, type SwapFillEvent as X, type SwapFillParams as Y, type SwapOrder as Z, type SwapOrderEvent as _, type ASPRoot as a, type TransferBuildResult as a0, type TransferContext as a1, type TransferParams as a2, type TransferStage as a3, type UPPCircuitInputs as a4, type UPPCircuitType as a5, type UPPTransferCircuitInputs as a6, type UPPWithdrawCircuitInputs as a7, type WithdrawParams as a8, buildASPTree as a9, getMerkleProofsForNotes as aA, getOwnOrderIds as aB, getStealthCircuitArtifacts as aC, getUPPCircuitArtifacts as aD, isFillerASPAccepted as aE, isOrderActive as aF, removeCancelSecret as aG, storeCancelSecret as aH, syncMerkleTree as aI, verifyASPProof as aJ, verifyProof as aK, type NoteCreationResult as aL, type PlonkProofStruct as aM, ASP_TREE_DEPTH as aN, buildTransfer as aa, buildUPPTransferCircuitInputs as ab, computeCancelKeyHash as ac, computeFillPercentage as ad, computeGiveAmount as ae, computeMultiOriginASPRoot as af, computeNullifier as ag, computeRate as ah, computeSingleOriginASPRoot as ai, computeTakeAmount as aj, computeTotalBuyAmount as ak, createDemoASPRoot as al, filterOrdersByASP as am, filterOrdersByTokenPair as an, formatOutputForContract as ao, formatProofForContract as ap, formatRate as aq, generateASPProof as ar, generateCancelSecret as as, generateMultiOriginASPProof as at, generateProof as au, generateSingleOriginASPProof as av, generateStealthProof as aw, generateUPPProof as ax, generateUPPProofAsync as ay, getCancelSecret as az, ASP_TREE_DEPTH$1 as b, CIRCUIT_VERSION as c, CircuitArtifactCache as d, type CircuitArtifacts as e, type CircuitCacheStatus as f, type CircuitType as g, type Commitment as h, DEMO_ASP_NAME as i, type DownloadProgress as j, type MergeRecord as k, type MerkleProofWithNote as l, type Note as m, type NoteStatus as n, type NoteWithAmount as o, type Nullifier as p, type Proof as q, type ProofResult as r, type ProofSystem as s, ProofWorkerManager as t, type ProofWorkerRequest as u, type ProofWorkerResponse as v, type ResolvedCircuitArtifacts as w, SWAP_EVENTS_ABI as x, SWAP_ORDER_CANCELLED_EVENT as y, SWAP_ORDER_CLAIMED_EVENT as z };
@@ -2,9 +2,6 @@ import { Address, Hex, PublicClient } from 'viem';
2
2
  import { d as buildMerkleTree, a as MerkleProof } from './merkle-mteVOlDf.js';
3
3
  import { a as M31Digest } from './keccak-m31-B_AqBbRF.js';
4
4
  import * as _permissionless_technologies_upc_sdk from '@permissionless-technologies/upc-sdk';
5
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { ReactNode } from 'react';
7
- import { M as MasterKeys, b as StarkMasterKeys } from './types-mLybMxNR.js';
8
5
 
9
6
  /**
10
7
  * Core type definitions for UPP SDK
@@ -14,6 +11,48 @@ import { M as MasterKeys, b as StarkMasterKeys } from './types-mLybMxNR.js';
14
11
  * Note version - increment when note structure changes
15
12
  */
16
13
  declare const NOTE_VERSION = 5;
14
+ /** Note lifecycle status */
15
+ type NoteStatus = 'pending' | 'confirmed' | 'spent';
16
+ /** Which proof system created/guards a note */
17
+ type ProofSystem = 'snark' | 'stark';
18
+ /**
19
+ * A shielded note (UTXO) - Post-quantum hash-based
20
+ *
21
+ * Commitment = Poseidon(amount, ownerHash, blinding, origin, token)
22
+ * where ownerHash = Poseidon(spendingSecret)
23
+ */
24
+ interface ShieldedNote {
25
+ /** Amount of tokens */
26
+ amount: bigint;
27
+ /** Random blinding factor */
28
+ blinding: bigint;
29
+ /** Commitment hash (hex) */
30
+ commitment: string;
31
+ /** Spending secret for this note (hex) - proves ownership via hash preimage */
32
+ ownerSecret: string;
33
+ /** Owner hash = Poseidon(ownerSecret) - what's committed on-chain (hex) */
34
+ ownerHash: string;
35
+ /** Position in Merkle tree */
36
+ leafIndex: number;
37
+ /** Origin address (original depositor) as hex */
38
+ origin: string;
39
+ /** Token address as hex */
40
+ token: string;
41
+ /** Transaction hash */
42
+ txHash?: string;
43
+ /** Note status */
44
+ status: NoteStatus;
45
+ /** Timestamp */
46
+ timestamp: number;
47
+ /** Which proof system created this note (defaults to 'snark' for legacy notes) */
48
+ proofSystem?: ProofSystem;
49
+ /** Block number where note was created (from IndexedNote) */
50
+ blockNumber?: number;
51
+ /** Ephemeral public key X (R.x — used as viewing key nonce, for ECDH-based notes) */
52
+ ephemeralX?: string;
53
+ /** Ephemeral public key Y (R.y, for ECDH-based notes) */
54
+ ephemeralY?: string;
55
+ }
17
56
  /**
18
57
  * A private note in the Universal Private Pool
19
58
  */
@@ -1264,40 +1303,12 @@ declare function generateMultiOriginASPProof(aspId: bigint, origin: bigint, allO
1264
1303
  */
1265
1304
  declare function generateASPProof(aspId: bigint, origin: bigint, approvedOrigins?: bigint[]): Promise<ASPProof>;
1266
1305
 
1267
- /** Which proof system created/guards a note */
1268
- type ProofSystemType = 'snark' | 'stark';
1269
1306
  /**
1270
- * A shielded note (UTXO) - Post-quantum hash-based
1307
+ * Note cryptographic operations create and encrypt shielded notes
1271
1308
  *
1272
- * Commitment = Poseidon(amount, ownerHash, blinding, origin, token)
1273
- * where ownerHash = Poseidon(spendingSecret)
1309
+ * Framework-agnostic. Pure async functions for note creation and
1310
+ * AES-GCM encryption using the viewing secret as symmetric key.
1274
1311
  */
1275
- interface ShieldedNote {
1276
- /** Amount of tokens */
1277
- amount: bigint;
1278
- /** Random blinding factor */
1279
- blinding: bigint;
1280
- /** Commitment hash (hex) */
1281
- commitment: string;
1282
- /** Spending secret for this note (hex) - proves ownership via hash preimage */
1283
- ownerSecret: string;
1284
- /** Owner hash = Poseidon(ownerSecret) - what's committed on-chain (hex) */
1285
- ownerHash: string;
1286
- /** Position in Merkle tree */
1287
- leafIndex: number;
1288
- /** Origin address (original depositor) as hex */
1289
- origin: string;
1290
- /** Token address as hex */
1291
- token: string;
1292
- /** Transaction hash */
1293
- txHash?: string;
1294
- /** Note status */
1295
- status: 'pending' | 'confirmed' | 'spent';
1296
- /** Timestamp */
1297
- timestamp: number;
1298
- /** Which proof system created this note (defaults to 'snark' for legacy notes) */
1299
- proofSystem?: ProofSystemType;
1300
- }
1301
1312
  /**
1302
1313
  * Note creation result (BLS12-381, hash-based ownership)
1303
1314
  *
@@ -1317,127 +1328,6 @@ interface NoteCreationResult {
1317
1328
  origin: bigint;
1318
1329
  token: bigint;
1319
1330
  }
1320
- /**
1321
- * Indexer configuration for advanced usage
1322
- */
1323
- interface IndexerConfig {
1324
- /** Enable IndexedDB storage (default: true if available) */
1325
- useIndexedDB?: boolean;
1326
- /** Custom storage prefix for multi-account support */
1327
- storagePrefix?: string;
1328
- /** Batch size for RPC scanning (default: 200, adapts on rate limits) */
1329
- batchSize?: number;
1330
- /** Sync interval for live sync in ms (default: 30000) */
1331
- liveSyncIntervalMs?: number;
1332
- /** Starting block for new accounts (skips blocks before account creation) */
1333
- fromBlock?: number;
1334
- /** Pool contract address (required for indexer) */
1335
- contractAddress?: Address;
1336
- /** UPPSwapModule proxy address (swap events come from this contract, not the pool) */
1337
- swapModuleAddress?: Address;
1338
- }
1339
- /**
1340
- * Context type for UPP Account
1341
- */
1342
- interface UPPAccountContextType {
1343
- /** SNARK master keys (null if not setup) */
1344
- masterKeys: MasterKeys | null;
1345
- /** STARK master keys (null if not setup) */
1346
- starkMasterKeys: StarkMasterKeys | null;
1347
- /** Connected wallet address */
1348
- ethAddress: string | null;
1349
- /** Owner hash (public identifier, hex) — SNARK */
1350
- ownerHash: string | null;
1351
- /** Stealth address (bech32m encoded, 0zk prefix) — SNARK */
1352
- stealthAddress: string | null;
1353
- /** STARK stealth address (bech32m encoded, 0zs prefix) */
1354
- starkStealthAddress: string | null;
1355
- /** All notes */
1356
- notes: ShieldedNote[];
1357
- /** Unspent notes */
1358
- unspentNotes: ShieldedNote[];
1359
- /** Total balance of unspent notes */
1360
- balance: bigint;
1361
- /** Whether account is set up */
1362
- isSetup: boolean;
1363
- /** Whether SDK is loading/initializing */
1364
- isLoading: boolean;
1365
- /** Whether crypto is ready */
1366
- cryptoReady: boolean;
1367
- /** Whether sync is in progress */
1368
- isSyncing: boolean;
1369
- /** Last synced block number */
1370
- lastSyncedBlock: number;
1371
- /** Set up a new account from wallet signature (low-level) */
1372
- setupAccount: (signature: Hex) => Promise<void>;
1373
- /** Connect private account via EIP-712 wallet signature (requires wagmi signTypedData) */
1374
- connect: (password?: string) => Promise<void>;
1375
- /** Whether a connect operation is in progress */
1376
- isConnecting: boolean;
1377
- /** Clear account and logout */
1378
- logout: () => void;
1379
- /** Alias for logout */
1380
- disconnect: () => void;
1381
- /** Add a note to the account */
1382
- addNote: (note: ShieldedNote) => void;
1383
- /** Mark a note as spent */
1384
- markNoteSpent: (commitment: string) => void;
1385
- /** Create note for self (e.g., shield or change output) */
1386
- createNoteForSelf: (amount: bigint, origin: bigint, token: bigint) => Promise<NoteCreationResult>;
1387
- /** Get owner hash */
1388
- getOwnerHash: () => bigint | null;
1389
- /** Select optimal circuit for a given amount */
1390
- selectOptimalCircuit: (requiredAmount: bigint, tokenAddress?: string) => {
1391
- circuit: '1x2' | '2x2' | null;
1392
- selectedNotes: ShieldedNote[];
1393
- error?: string;
1394
- };
1395
- /** Sync notes from blockchain (requires client to be passed in) */
1396
- syncNotes: (contractAddress: Address, client: any) => Promise<number>;
1397
- /** Start live sync (polls for new notes at interval) */
1398
- startLiveSync: (contractAddress: Address, client: any) => void;
1399
- /** Stop live sync */
1400
- stopLiveSync: () => void;
1401
- /** Whether live sync is active */
1402
- isLiveSyncing: boolean;
1403
- }
1404
- /**
1405
- * Function signature for EIP-712 typed data signing.
1406
- * Compatible with wagmi's signTypedDataAsync.
1407
- */
1408
- type SignTypedDataFn = (args: {
1409
- domain: {
1410
- name: string;
1411
- version: string;
1412
- chainId: number;
1413
- };
1414
- types: Record<string, Array<{
1415
- name: string;
1416
- type: string;
1417
- }>>;
1418
- primaryType: string;
1419
- message: Record<string, unknown>;
1420
- }) => Promise<Hex>;
1421
- interface UPPAccountProviderProps {
1422
- children: ReactNode;
1423
- /** Ethereum address of connected wallet */
1424
- ethAddress?: string;
1425
- /** Chain ID */
1426
- chainId?: number;
1427
- /** Indexer configuration */
1428
- indexerConfig?: IndexerConfig;
1429
- /** EIP-712 signing function (from wagmi's useSignTypedData().signTypedDataAsync) */
1430
- signTypedData?: SignTypedDataFn;
1431
- /** Public client for chain fingerprint validation (e.g. from wagmi usePublicClient) */
1432
- publicClient?: any;
1433
- /** Active proof system — filters unspentNotes and balance to only show spendable notes */
1434
- activeProofSystem?: ProofSystemType;
1435
- }
1436
- declare function UPPAccountProvider({ children, ethAddress, chainId, indexerConfig, signTypedData, publicClient: publicClientProp, activeProofSystem, }: UPPAccountProviderProps): react_jsx_runtime.JSX.Element;
1437
- /**
1438
- * Hook to access UPP Account context
1439
- */
1440
- declare function useUPPAccount(): UPPAccountContextType;
1441
1331
 
1442
1332
  /**
1443
1333
  * Transfer Module
@@ -1597,4 +1487,4 @@ declare function formatOutputForContract(note: NoteCreationResult): {
1597
1487
  encryptedNote: Hex;
1598
1488
  };
1599
1489
 
1600
- export { type TransferParams as $, type ASPProof as A, type ShieldParams as B, CIRCUIT_CDN_BASE as C, DEMO_ASP_ID as D, type EncryptedNote as E, type SpendableNote as F, type StarkNote as G, type StarkProof as H, type StarkStealthMetaAddress as I, type Stealth1x2CircuitInputs as J, type Stealth2x2CircuitInputs as K, type StealthAddress as L, type MergeParams as M, NOTE_VERSION as N, type StealthCircuitInputs as O, type PlonkProvingStage as P, type StealthCircuitType as Q, RATE_PRECISION as R, STATE_TREE_DEPTH as S, type StealthMetaAddress as T, type SwapFillEvent as U, type SwapFillParams as V, type SwapOrder as W, type SwapOrderEvent as X, type SwapOrderParams as Y, type TransferBuildResult as Z, type TransferContext as _, type ASPRoot as a, type TransferStage as a0, type UPPCircuitInputs as a1, type UPPCircuitType as a2, type UPPTransferCircuitInputs as a3, type UPPWithdrawCircuitInputs as a4, type WithdrawParams as a5, buildASPTree as a6, buildTransfer as a7, buildUPPTransferCircuitInputs as a8, computeCancelKeyHash as a9, getUPPCircuitArtifacts as aA, isFillerASPAccepted as aB, isOrderActive as aC, removeCancelSecret as aD, storeCancelSecret as aE, syncMerkleTree as aF, verifyASPProof as aG, verifyProof as aH, type NoteCreationResult as aI, type PlonkProofStruct as aJ, type ShieldedNote as aK, useUPPAccount as aL, UPPAccountProvider as aM, type UPPAccountContextType as aN, type ProofSystemType as aO, type IndexerConfig as aP, type SignTypedDataFn as aQ, ASP_TREE_DEPTH as aR, computeFillPercentage as aa, computeGiveAmount as ab, computeMultiOriginASPRoot as ac, computeNullifier as ad, computeRate as ae, computeSingleOriginASPRoot as af, computeTakeAmount as ag, computeTotalBuyAmount as ah, createDemoASPRoot as ai, filterOrdersByASP as aj, filterOrdersByTokenPair as ak, formatOutputForContract as al, formatProofForContract as am, formatRate as an, generateASPProof as ao, generateCancelSecret as ap, generateMultiOriginASPProof as aq, generateProof as ar, generateSingleOriginASPProof as as, generateStealthProof as at, generateUPPProof as au, generateUPPProofAsync as av, getCancelSecret as aw, getMerkleProofsForNotes as ax, getOwnOrderIds as ay, getStealthCircuitArtifacts as az, ASP_TREE_DEPTH$1 as b, CIRCUIT_VERSION as c, CircuitArtifactCache as d, type CircuitArtifacts as e, type CircuitCacheStatus as f, type CircuitType as g, type Commitment as h, DEMO_ASP_NAME as i, type DownloadProgress as j, type MergeRecord as k, type MerkleProofWithNote as l, type Note as m, type NoteWithAmount as n, type Nullifier as o, type Proof as p, type ProofResult as q, ProofWorkerManager as r, type ProofWorkerRequest as s, type ProofWorkerResponse as t, type ResolvedCircuitArtifacts as u, SWAP_EVENTS_ABI as v, SWAP_ORDER_CANCELLED_EVENT as w, SWAP_ORDER_CLAIMED_EVENT as x, SWAP_ORDER_FILLED_EVENT as y, SWAP_ORDER_PLACED_EVENT as z };
1490
+ export { type SwapOrderParams as $, type ASPProof as A, SWAP_ORDER_FILLED_EVENT as B, CIRCUIT_CDN_BASE as C, DEMO_ASP_ID as D, type EncryptedNote as E, SWAP_ORDER_PLACED_EVENT as F, type ShieldParams as G, type ShieldedNote as H, type SpendableNote as I, type StarkNote as J, type StarkProof as K, type StarkStealthMetaAddress as L, type MergeParams as M, NOTE_VERSION as N, type Stealth1x2CircuitInputs as O, type PlonkProvingStage as P, type Stealth2x2CircuitInputs as Q, RATE_PRECISION as R, STATE_TREE_DEPTH as S, type StealthAddress as T, type StealthCircuitInputs as U, type StealthCircuitType as V, type StealthMetaAddress as W, type SwapFillEvent as X, type SwapFillParams as Y, type SwapOrder as Z, type SwapOrderEvent as _, type ASPRoot as a, type TransferBuildResult as a0, type TransferContext as a1, type TransferParams as a2, type TransferStage as a3, type UPPCircuitInputs as a4, type UPPCircuitType as a5, type UPPTransferCircuitInputs as a6, type UPPWithdrawCircuitInputs as a7, type WithdrawParams as a8, buildASPTree as a9, getMerkleProofsForNotes as aA, getOwnOrderIds as aB, getStealthCircuitArtifacts as aC, getUPPCircuitArtifacts as aD, isFillerASPAccepted as aE, isOrderActive as aF, removeCancelSecret as aG, storeCancelSecret as aH, syncMerkleTree as aI, verifyASPProof as aJ, verifyProof as aK, type NoteCreationResult as aL, type PlonkProofStruct as aM, ASP_TREE_DEPTH as aN, buildTransfer as aa, buildUPPTransferCircuitInputs as ab, computeCancelKeyHash as ac, computeFillPercentage as ad, computeGiveAmount as ae, computeMultiOriginASPRoot as af, computeNullifier as ag, computeRate as ah, computeSingleOriginASPRoot as ai, computeTakeAmount as aj, computeTotalBuyAmount as ak, createDemoASPRoot as al, filterOrdersByASP as am, filterOrdersByTokenPair as an, formatOutputForContract as ao, formatProofForContract as ap, formatRate as aq, generateASPProof as ar, generateCancelSecret as as, generateMultiOriginASPProof as at, generateProof as au, generateSingleOriginASPProof as av, generateStealthProof as aw, generateUPPProof as ax, generateUPPProofAsync as ay, getCancelSecret as az, ASP_TREE_DEPTH$1 as b, CIRCUIT_VERSION as c, CircuitArtifactCache as d, type CircuitArtifacts as e, type CircuitCacheStatus as f, type CircuitType as g, type Commitment as h, DEMO_ASP_NAME as i, type DownloadProgress as j, type MergeRecord as k, type MerkleProofWithNote as l, type Note as m, type NoteStatus as n, type NoteWithAmount as o, type Nullifier as p, type Proof as q, type ProofResult as r, type ProofSystem as s, ProofWorkerManager as t, type ProofWorkerRequest as u, type ProofWorkerResponse as v, type ResolvedCircuitArtifacts as w, SWAP_EVENTS_ABI as x, SWAP_ORDER_CANCELLED_EVENT as y, SWAP_ORDER_CLAIMED_EVENT as z };