@unlink-xyz/core 0.1.3-canary.8cf3cb2 → 0.1.3-canary.97d3cc6

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 (115) hide show
  1. package/dist/clients/http.d.ts +0 -6
  2. package/dist/clients/http.d.ts.map +1 -1
  3. package/dist/clients/http.js +0 -8
  4. package/dist/clients/indexer.d.ts +0 -1
  5. package/dist/clients/indexer.d.ts.map +1 -1
  6. package/dist/clients/indexer.js +0 -1
  7. package/dist/index.d.ts +1 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -3
  10. package/dist/key-derivation/bip39.d.ts.map +1 -1
  11. package/dist/key-derivation/bip39.js +0 -1
  12. package/dist/keys.d.ts +1 -4
  13. package/dist/keys.d.ts.map +1 -1
  14. package/dist/keys.js +0 -4
  15. package/dist/prover/registry.d.ts +1 -1
  16. package/dist/prover/registry.js +3 -3
  17. package/dist/state/merkle/index.d.ts +1 -1
  18. package/dist/state/merkle/index.d.ts.map +1 -1
  19. package/dist/state/merkle/index.js +1 -1
  20. package/dist/state/merkle/merkle-tree.d.ts +0 -8
  21. package/dist/state/merkle/merkle-tree.d.ts.map +1 -1
  22. package/dist/state/merkle/merkle-tree.js +0 -8
  23. package/dist/state/store/index.d.ts +1 -2
  24. package/dist/state/store/index.d.ts.map +1 -1
  25. package/dist/state/store/index.js +0 -1
  26. package/dist/state/store/job-store.d.ts.map +1 -1
  27. package/dist/state/store/job-store.js +1 -4
  28. package/dist/state/store/jobs.d.ts +0 -13
  29. package/dist/state/store/jobs.d.ts.map +1 -1
  30. package/dist/state/store/leaf-store.d.ts.map +1 -1
  31. package/dist/state/store/leaf-store.js +3 -0
  32. package/dist/state/store/note-store.d.ts +7 -3
  33. package/dist/state/store/note-store.d.ts.map +1 -1
  34. package/dist/state/store/note-store.js +33 -19
  35. package/dist/state/store/nullifier-store.d.ts.map +1 -1
  36. package/dist/state/store/nullifier-store.js +2 -0
  37. package/dist/state/store/records.d.ts +2 -25
  38. package/dist/state/store/records.d.ts.map +1 -1
  39. package/dist/state/store/root-store.d.ts.map +1 -1
  40. package/dist/state/store/root-store.js +4 -0
  41. package/dist/state/store/store.d.ts +27 -45
  42. package/dist/state/store/store.d.ts.map +1 -1
  43. package/dist/state/store/store.js +0 -3
  44. package/dist/transactions/deposit.d.ts +16 -9
  45. package/dist/transactions/deposit.d.ts.map +1 -1
  46. package/dist/transactions/deposit.js +153 -107
  47. package/dist/transactions/index.d.ts +4 -5
  48. package/dist/transactions/index.d.ts.map +1 -1
  49. package/dist/transactions/index.js +2 -5
  50. package/dist/transactions/note-sync.d.ts +26 -3
  51. package/dist/transactions/note-sync.d.ts.map +1 -1
  52. package/dist/transactions/note-sync.js +4 -16
  53. package/dist/transactions/reconcile.d.ts +10 -8
  54. package/dist/transactions/reconcile.d.ts.map +1 -1
  55. package/dist/transactions/reconcile.js +4 -49
  56. package/dist/transactions/transact.d.ts +27 -8
  57. package/dist/transactions/transact.d.ts.map +1 -1
  58. package/dist/transactions/transact.js +504 -292
  59. package/dist/transactions/types.d.ts +114 -0
  60. package/dist/transactions/types.d.ts.map +1 -0
  61. package/dist/tsconfig.tsbuildinfo +1 -1
  62. package/dist/utils/crypto.d.ts +5 -5
  63. package/dist/utils/crypto.d.ts.map +1 -1
  64. package/dist/utils/validators.d.ts +10 -8
  65. package/dist/utils/validators.d.ts.map +1 -1
  66. package/dist/utils/validators.js +0 -16
  67. package/package.json +2 -2
  68. package/dist/history/index.d.ts +0 -3
  69. package/dist/history/index.d.ts.map +0 -1
  70. package/dist/history/index.js +0 -2
  71. package/dist/history/service.d.ts +0 -46
  72. package/dist/history/service.d.ts.map +0 -1
  73. package/dist/history/service.js +0 -354
  74. package/dist/history/types.d.ts +0 -21
  75. package/dist/history/types.d.ts.map +0 -1
  76. package/dist/state/store/history-store.d.ts +0 -24
  77. package/dist/state/store/history-store.d.ts.map +0 -1
  78. package/dist/state/store/history-store.js +0 -53
  79. package/dist/transactions/note-selection.d.ts +0 -17
  80. package/dist/transactions/note-selection.d.ts.map +0 -1
  81. package/dist/transactions/note-selection.js +0 -196
  82. package/dist/transactions/transaction-planner.d.ts +0 -34
  83. package/dist/transactions/transaction-planner.d.ts.map +0 -1
  84. package/dist/transactions/transaction-planner.js +0 -114
  85. package/dist/transactions/types/deposit.d.ts +0 -45
  86. package/dist/transactions/types/deposit.d.ts.map +0 -1
  87. package/dist/transactions/types/deposit.js +0 -1
  88. package/dist/transactions/types/domain.d.ts +0 -65
  89. package/dist/transactions/types/domain.d.ts.map +0 -1
  90. package/dist/transactions/types/domain.js +0 -4
  91. package/dist/transactions/types/index.d.ts +0 -18
  92. package/dist/transactions/types/index.d.ts.map +0 -1
  93. package/dist/transactions/types/index.js +0 -17
  94. package/dist/transactions/types/options.d.ts +0 -37
  95. package/dist/transactions/types/options.d.ts.map +0 -1
  96. package/dist/transactions/types/options.js +0 -1
  97. package/dist/transactions/types/planning.d.ts +0 -80
  98. package/dist/transactions/types/planning.d.ts.map +0 -1
  99. package/dist/transactions/types/planning.js +0 -1
  100. package/dist/transactions/types/state-stores.d.ts +0 -51
  101. package/dist/transactions/types/state-stores.d.ts.map +0 -1
  102. package/dist/transactions/types/state-stores.js +0 -1
  103. package/dist/transactions/types/transact.d.ts +0 -61
  104. package/dist/transactions/types/transact.d.ts.map +0 -1
  105. package/dist/transactions/types/transact.js +0 -1
  106. package/dist/utils/format.d.ts +0 -25
  107. package/dist/utils/format.d.ts.map +0 -1
  108. package/dist/utils/format.js +0 -33
  109. package/dist/utils/notes.d.ts +0 -15
  110. package/dist/utils/notes.d.ts.map +0 -1
  111. package/dist/utils/notes.js +0 -14
  112. package/dist/utils/random.d.ts +0 -13
  113. package/dist/utils/random.d.ts.map +0 -1
  114. package/dist/utils/random.js +0 -27
  115. /package/dist/{history → transactions}/types.js +0 -0
@@ -1,10 +1,4 @@
1
1
  export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
2
- /**
3
- * Resolve fetch implementation from options or global.
4
- * @param providedFetch - Optional fetch implementation
5
- * @returns Fetch function or undefined if not available
6
- */
7
- export declare function resolveFetch(providedFetch?: FetchLike): typeof fetch | undefined;
8
2
  export type JsonHttpDeps = {
9
3
  fetch: FetchLike;
10
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../clients/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,aAAa,CAAC,EAAE,SAAS,GACxB,OAAO,KAAK,GAAG,SAAS,CAE1B;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAClD,CAAC;AAEF,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAA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YAAY,GACjB,cAAc,CA+ChB"}
@@ -1,12 +1,4 @@
1
1
  import ky, { HTTPError, TimeoutError } from "ky";
2
- /**
3
- * Resolve fetch implementation from options or global.
4
- * @param providedFetch - Optional fetch implementation
5
- * @returns Fetch function or undefined if not available
6
- */
7
- export function resolveFetch(providedFetch) {
8
- return providedFetch ?? (typeof fetch === "function" ? fetch : undefined);
9
- }
10
2
  export class HttpError extends Error {
11
3
  status;
12
4
  body;
@@ -6,7 +6,6 @@ export type CommitmentRecord = {
6
6
  root: string;
7
7
  txHash: string;
8
8
  insertedAt: number;
9
- eventType: string;
10
9
  };
11
10
  export type IndexerNullifierRecord = {
12
11
  nullifier: string;
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../clients/indexer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAe3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AASF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAQF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;I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;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAOF,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB;iCAyB9D,sBAAsB,GAC7B,OAAO,CAAC,uBAAuB,CAAC;0BAgBzB,mBAAmB,GAC1B,OAAO,CAAC,gBAAgB,CAAC;yBAQlB,kBAAkB,GACzB,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;+BAcR,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;EAQ5D"}
@@ -11,7 +11,6 @@ export function createIndexerClient(baseUrl, deps) {
11
11
  root: record.root,
12
12
  txHash: record.tx_hash,
13
13
  insertedAt: record.inserted_at,
14
- eventType: record.event_type ?? "unknown",
15
14
  });
16
15
  const normalizeNullifierRecord = (record) => ({
17
16
  nullifier: record.nullifier,
package/dist/index.d.ts CHANGED
@@ -10,12 +10,10 @@ export * from "./utils/validators.js";
10
10
  export * from "./utils/bigint.js";
11
11
  export * from "./utils/secure-memory.js";
12
12
  export * from "./utils/amounts.js";
13
- export * from "./utils/notes.js";
14
- export * from "./utils/format.js";
15
13
  export * from "./account/zkAccount.js";
16
14
  export * from "./key-derivation/index.js";
17
- export * from "./history/index.js";
18
15
  export * from "./transactions/index.js";
16
+ export { createJobReconciler } from "./transactions/reconcile.js";
19
17
  export { serviceConfig } from "./config.js";
20
18
  export type { ServiceConfig } from "./config.js";
21
19
  export * from "./clients/broadcaster.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,iBAAiB,CAAuB;AAEnE,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,iBAAiB,CAAuB;AAEnE,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -11,12 +11,10 @@ export * from "./utils/validators.js";
11
11
  export * from "./utils/bigint.js";
12
12
  export * from "./utils/secure-memory.js";
13
13
  export * from "./utils/amounts.js";
14
- export * from "./utils/notes.js";
15
- export * from "./utils/format.js";
16
14
  export * from "./account/zkAccount.js";
17
15
  export * from "./key-derivation/index.js";
18
- export * from "./history/index.js";
19
16
  export * from "./transactions/index.js";
17
+ export { createJobReconciler } from "./transactions/reconcile.js";
20
18
  export { serviceConfig } from "./config.js";
21
19
  export * from "./clients/broadcaster.js";
22
20
  export * from "./clients/indexer.js";
@@ -1 +1 @@
1
- {"version":3,"file":"bip39.d.ts","sourceRoot":"","sources":["../../key-derivation/bip39.ts"],"names":[],"mappings":"AAsBA,qBAAa,QAAQ;IACnB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAE,GAAG,GAAG,GAAG,GAAG,GAAS,GAAG,MAAM;IAIxD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAW,GAAG,MAAM;IAK9D,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAK1C,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAK9C;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;IAWzE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;CAOvE"}
1
+ {"version":3,"file":"bip39.d.ts","sourceRoot":"","sources":["../../key-derivation/bip39.ts"],"names":[],"mappings":"AAqBA,qBAAa,QAAQ;IACnB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAE,GAAG,GAAG,GAAG,GAAG,GAAS,GAAG,MAAM;IAIxD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1C;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAW,GAAG,MAAM;IAK9D,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAK1C,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAK9C;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;IAWzE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM;CAOvE"}
@@ -1,4 +1,3 @@
1
- import { Buffer } from "buffer";
2
1
  import { entropyToMnemonic, generateMnemonic, mnemonicToEntropy, mnemonicToSeedSync, validateMnemonic, } from "@scure/bip39";
3
2
  import { wordlist } from "@scure/bip39/wordlists/english.js";
4
3
  import { HDKey } from "ethereum-cryptography/hdkey";
package/dist/keys.d.ts CHANGED
@@ -1,10 +1,7 @@
1
- export declare const RESERVED_PREFIXES: readonly ["meta:", "history:", "notes:", "leaves:", "roots:", "nullifiers:", "ciphertexts:", "jobs:", "proof_cache:", "cfg:", "idx:", "locks:"];
1
+ export declare const RESERVED_PREFIXES: readonly ["meta:", "notes:", "leaves:", "roots:", "nullifiers:", "ciphertexts:", "jobs:", "proof_cache:", "cfg:", "idx:", "locks:"];
2
2
  /** Canonical builders for storage key namespaces used across core */
3
3
  export declare const keys: {
4
4
  note: (c: number, i: number) => string;
5
- historyEntry: (id: string) => string;
6
- historyPrefix: (chainId: number, mpk: string) => string;
7
- historyMeta: (chainId: number, mpk: string) => string;
8
5
  leaf: (c: number, i: number) => string;
9
6
  ciphertext: (c: number, i: number) => string;
10
7
  /** Track note indices that remain unspent for a given master public key (mpk acts as the account identifier). */
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../keys.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,iJAapB,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,IAAI;cACL,MAAM,KAAK,MAAM;uBACR,MAAM;6BACA,MAAM,OAAO,MAAM;2BACrB,MAAM,OAAO,MAAM;cAEhC,MAAM,KAAK,MAAM;oBACX,MAAM,KAAK,MAAM;IACjC,iHAAiH;iBACpG,MAAM,OAAO,MAAM,KAAK,MAAM;uBAExB,MAAM,OAAO,MAAM;sBACpB,MAAM,KAAK,MAAM;qBAClB,MAAM,KAAK,MAAM;mBACnB,MAAM,KAAK,MAAM;cACtB,MAAM,SAAS,MAAM;oBACf,MAAM;oBACN,MAAM;gBACV,MAAM;mBACH,MAAM,KAAK,MAAM;mBACjB,MAAM;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,QAQtC"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../keys.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,qIAYpB,CAAC;AAEX,qEAAqE;AACrE,eAAO,MAAM,IAAI;cACL,MAAM,KAAK,MAAM;cACjB,MAAM,KAAK,MAAM;oBACX,MAAM,KAAK,MAAM;IACjC,iHAAiH;iBACpG,MAAM,OAAO,MAAM,KAAK,MAAM;uBAExB,MAAM,OAAO,MAAM;sBACpB,MAAM,KAAK,MAAM;qBAClB,MAAM,KAAK,MAAM;mBACnB,MAAM,KAAK,MAAM;cACtB,MAAM,SAAS,MAAM;oBACf,MAAM;oBACN,MAAM;gBACV,MAAM;mBACH,MAAM,KAAK,MAAM;mBACjB,MAAM;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,QAQtC"}
package/dist/keys.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { KeyValidationError } from "./errors.js";
2
2
  export const RESERVED_PREFIXES = [
3
3
  "meta:",
4
- "history:",
5
4
  "notes:",
6
5
  "leaves:",
7
6
  "roots:",
@@ -16,9 +15,6 @@ export const RESERVED_PREFIXES = [
16
15
  /** Canonical builders for storage key namespaces used across core */
17
16
  export const keys = {
18
17
  note: (c, i) => `notes:${c}:${i}`,
19
- historyEntry: (id) => `history:${id}`,
20
- historyPrefix: (chainId, mpk) => `history:${chainId}:${mpk}:`,
21
- historyMeta: (chainId, mpk) => `history:${chainId}:${mpk}:__meta__`,
22
18
  leaf: (c, i) => `leaves:${c}:${i}`,
23
19
  ciphertext: (c, i) => `ciphertexts:${c}:${i}`,
24
20
  /** Track note indices that remain unspent for a given master public key (mpk acts as the account identifier). */
@@ -15,7 +15,7 @@ export interface CircuitConfig {
15
15
  export type CircuitKey = "3x3" | "2x3" | "1x2" | "1x1";
16
16
  /**
17
17
  * Registry of available circuits
18
- * Auto-generated from zk/circom/circuits.json
18
+ * Auto-generated from circuits/circuits.json
19
19
  */
20
20
  export declare const CIRCUIT_REGISTRY: Record<CircuitKey, CircuitConfig>;
21
21
  /**
@@ -1,10 +1,10 @@
1
1
  // AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
2
2
  // Generated by scripts/generate-registry.ts
3
- // Source: zk/circom/circuits.json
4
- // Generated at: 2025-12-19T15:41:15.358Z
3
+ // Source: circuits/circuits.json
4
+ // Generated at: 2025-12-11T11:18:32.030Z
5
5
  /**
6
6
  * Registry of available circuits
7
- * Auto-generated from zk/circom/circuits.json
7
+ * Auto-generated from circuits/circuits.json
8
8
  */
9
9
  export const CIRCUIT_REGISTRY = {
10
10
  "3x3": {
@@ -1,3 +1,3 @@
1
- export { createLocalMerkleTree, createMerkleTrees, resolveMerkleTrees, type LocalMerkleTree, type LocalMerkleTrees, type MerkleProof, } from "./merkle-tree.js";
1
+ export { createLocalMerkleTree, createMerkleTrees, type LocalMerkleTree, type LocalMerkleTrees, type MerkleProof, } from "./merkle-tree.js";
2
2
  export { hydrateChain, rebuildTreeFromStore, type HydrateChainParams, } from "./hydrator.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../state/merkle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../state/merkle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC"}
@@ -1,2 +1,2 @@
1
- export { createLocalMerkleTree, createMerkleTrees, resolveMerkleTrees, } from "./merkle-tree.js";
1
+ export { createLocalMerkleTree, createMerkleTrees, } from "./merkle-tree.js";
2
2
  export { hydrateChain, rebuildTreeFromStore, } from "./hydrator.js";
@@ -31,12 +31,4 @@ export type LocalMerkleTrees = {
31
31
  reset(chainId: number): void;
32
32
  };
33
33
  export declare function createMerkleTrees(): LocalMerkleTrees;
34
- /**
35
- * Resolve merkle trees from options or create new instance.
36
- * @param opts - Options object that may contain merkle trees
37
- * @returns Merkle trees instance
38
- */
39
- export declare function resolveMerkleTrees(opts?: {
40
- merkleTrees?: LocalMerkleTrees;
41
- }): LocalMerkleTrees;
42
34
  //# sourceMappingURL=merkle-tree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"merkle-tree.d.ts","sourceRoot":"","sources":["../../../state/merkle/merkle-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAGf,MAAM,aAAa,CAAC;AAYrB,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,EAAE,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAaF,wBAAgB,qBAAqB;qBAUX,MAAM,KAAG,aAAa;;;qBAsBtB,MAAM;+BAQI,MAAM,KAAG,cAAc;mBAUxC,MAAM;;;EAiBxB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IAClD,WAAW,CAAC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,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;IAClD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;IACvD,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC;IAClE,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,gBAAgB,CAwCpD"}
@@ -102,11 +102,3 @@ export function createMerkleTrees() {
102
102
  },
103
103
  };
104
104
  }
105
- /**
106
- * Resolve merkle trees from options or create new instance.
107
- * @param opts - Options object that may contain merkle trees
108
- * @returns Merkle trees instance
109
- */
110
- export function resolveMerkleTrees(opts) {
111
- return opts?.merkleTrees ?? createMerkleTrees();
112
- }
@@ -1,10 +1,9 @@
1
- export { createStateStore, type StateStore } from "./store.js";
1
+ export { createStateStore } from "./store.js";
2
2
  export { createLeafStore } from "./leaf-store.js";
3
3
  export { createNoteStore } from "./note-store.js";
4
4
  export { createNullifierStore } from "./nullifier-store.js";
5
5
  export { createRootStore } from "./root-store.js";
6
6
  export { createCiphertextStore } from "./ciphertext-store.js";
7
- export { createHistoryStore } from "./history-store.js";
8
7
  export { createJobStore } from "./job-store.js";
9
8
  export { DEFAULT_JOB_TIMEOUT_MS, type JobStatus, type PendingJobKind, type PendingJobRecord, type PendingDepositJob, type PendingTransactJob, type PendingTransactContext, type PendingTransactOutput, } from "./jobs.js";
10
9
  export type { LeafRecord, NoteInsert, NoteRecord, NullifierRecord, RootRecord, } from "./records.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../state/store/index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AAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,WAAW,CAAC;AACnB,YAAY,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,GACX,MAAM,cAAc,CAAC"}
@@ -4,6 +4,5 @@ export { createNoteStore } from "./note-store.js";
4
4
  export { createNullifierStore } from "./nullifier-store.js";
5
5
  export { createRootStore } from "./root-store.js";
6
6
  export { createCiphertextStore } from "./ciphertext-store.js";
7
- export { createHistoryStore } from "./history-store.js";
8
7
  export { createJobStore } from "./job-store.js";
9
8
  export { DEFAULT_JOB_TIMEOUT_MS, } from "./jobs.js";
@@ -1 +1 @@
1
- {"version":3,"file":"job-store.d.ts","sourceRoot":"","sources":["../../../state/store/job-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,gBAAgB,EAGjB,MAAM,kBAAkB,CAAC;AA+G1B,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO;uBAElB,gBAAgB;2BASZ,MAAM;6BAKzB;QACN,IAAI,CAAC,EAAE,cAAc,CAAC;QACtB,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;KACxB;8BAe6B,MAAM;EAIzC"}
1
+ {"version":3,"file":"job-store.d.ts","sourceRoot":"","sources":["../../../state/store/job-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAO9C,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACd,gBAAgB,EAGjB,MAAM,kBAAkB,CAAC;AA4G1B,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO;uBAElB,gBAAgB;2BASZ,MAAM;6BAKzB;QACN,IAAI,CAAC,EAAE,cAAc,CAAC;QACtB,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;KACxB;8BAe6B,MAAM;EAIzC"}
@@ -1,6 +1,6 @@
1
1
  import { keys } from "../../keys.js";
2
2
  import { decodeJson, encodeJson, getJson } from "../../utils/json-codec.js";
3
- import { ensureAddress, ensureChainId, ensureMpk, ensurePositiveInt, } from "../../utils/validators.js";
3
+ import { ensureAddress, ensureChainId, ensurePositiveInt, } from "../../utils/validators.js";
4
4
  import { DEFAULT_JOB_TIMEOUT_MS } from "../store/jobs.js";
5
5
  const VALID_STATUSES = [
6
6
  "pending",
@@ -74,9 +74,6 @@ function validateJob(job) {
74
74
  throw new Error("relayId is required");
75
75
  }
76
76
  ensureChainId(job.chainId);
77
- if (job.mpk !== undefined) {
78
- ensureMpk(job.mpk);
79
- }
80
77
  assertStatus(job.status);
81
78
  assertKind(job.kind);
82
79
  ensurePositiveInt("job createdAt", job.createdAt);
@@ -4,8 +4,6 @@ export type PendingJobBase = {
4
4
  relayId: string;
5
5
  kind: PendingJobKind;
6
6
  chainId: number;
7
- /** Master public key (hex string) for correlating jobs with history/account views. */
8
- mpk?: string;
9
7
  status: JobStatus;
10
8
  broadcasterRelayId?: string | null;
11
9
  txHash?: string | null;
@@ -13,17 +11,6 @@ export type PendingJobBase = {
13
11
  lastCheckedAt?: number;
14
12
  timeoutMs: number;
15
13
  error?: string | null;
16
- /**
17
- * Optional history preview so UIs can show pending/failed history rows before notes are indexed.
18
- * Amount deltas follow HistoryAmount semantics (positive receive, negative send).
19
- */
20
- historyPreview?: {
21
- kind: "Deposit" | "Receive" | "Send" | "SelfSend" | "Withdraw";
22
- amounts: Array<{
23
- token: string;
24
- delta: string;
25
- }>;
26
- };
27
14
  };
28
15
  export type PendingDepositJob = PendingJobBase & {
29
16
  kind: "deposit";
@@ -1 +1 @@
1
- {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../state/store/jobs.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,WAAW,GACX,cAAc,GACd,WA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AU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAM9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAI5C;;OAEG;yBACwB,MAAM;EAQpC"}
1
+ {"version":3,"file":"leaf-store.d.ts","sourceRoot":"","sources":["../../../state/store/leaf-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAM9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAM5C;;OAEG;yBACwB,MAAM;EASpC"}
@@ -15,12 +15,15 @@ export function createLeafStore(storage) {
15
15
  * Load a leaf commitment by tree index.
16
16
  */
17
17
  async getLeaf(chainId, index) {
18
+ ensureChainId(chainId);
19
+ ensurePositiveInt("leaf index", index);
18
20
  return getJson(storage, keys.leaf(chainId, index));
19
21
  },
20
22
  /**
21
23
  * Remove all cached leaves for a chain.
22
24
  */
23
25
  async clearLeaves(chainId) {
26
+ ensureChainId(chainId);
24
27
  const prefix = `leaves:${chainId}:`;
25
28
  const entries = await storage.iter({ prefix });
26
29
  if (entries.length === 0)
@@ -4,9 +4,7 @@ export declare const emptyBytes: () => Uint8Array<ArrayBuffer>;
4
4
  export declare function createNoteStore(storage: Storage): {
5
5
  /**
6
6
  * Upsert a note record and maintain the unspent-note index for fast balance queries.
7
- * If the note already exists and is marked as spent, preserve spentAt unless the caller
8
- * provides an explicit spentAt value (eg. upgrading from a local observation time to an
9
- * on-chain timestamp from the indexer).
7
+ * If the note already exists and is marked as spent, preserve the spentAt field.
10
8
  */
11
9
  putNote(note: NoteInsert): Promise<void>;
12
10
  /**
@@ -30,5 +28,11 @@ export declare function createNoteStore(storage: Storage): {
30
28
  * Drop the spent marker from a cached note, returning it to the unspent index.
31
29
  */
32
30
  markNoteUnspent(chainId: number, index: number): Promise<NoteRecord>;
31
+ /**
32
+ * Aggregate unspent note balances per token for a given master public key.
33
+ */
34
+ getZkBalances(mpk: string, options?: {
35
+ chainId?: number;
36
+ }): Promise<Record<string, bigint>>;
33
37
  };
34
38
  //# sourceMappingURL=note-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../state/store/note-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAevD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,UAAU,+BAA0B,CAAC;AAElD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IA2D5C;;;;;OAKG;kBACiB,UAAU;IAW9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAI5C;;OAEG;wBAEQ;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;IAkBH;;OAEG;2BAC0B,MAAM,SAAS,MAAM;IAalD;;OAEG;6BAC4B,MAAM,SAAS,MAAM;EAgBvD"}
1
+ {"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../state/store/note-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAavD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElE,eAAO,MAAM,UAAU,+BAA0B,CAAC;AAElD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAyC5C;;;OAGG;kBACiB,UAAU;IAW9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;IAM5C;;OAEG;wBAEQ;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB;IAyBH;;OAEG;2BAC0B,MAAM,SAAS,MAAM;IAgBlD;;OAEG;6BAC4B,MAAM,SAAS,MAAM;IAgBpD;;OAEG;uBACsB,MAAM,YAAW;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;EAiBjE"}
@@ -9,23 +9,9 @@ export function createNoteStore(storage) {
9
9
  ensurePositiveInt("note index", record.index);
10
10
  ensureMpk(record.mpk);
11
11
  ensureBigIntString("note value", record.value);
12
- if (record.createdAt !== undefined) {
13
- ensurePositiveInt("note createdAt", record.createdAt);
14
- }
15
12
  if (record.spentAt !== undefined) {
16
13
  ensurePositiveInt("note spentAt", record.spentAt);
17
14
  }
18
- if (record.createdTxHash !== undefined &&
19
- record.createdTxHash.length === 0) {
20
- throw new CoreError("note createdTxHash must be a non-empty string");
21
- }
22
- if (record.createdEventType !== undefined &&
23
- record.createdEventType.length === 0) {
24
- throw new CoreError("note createdEventType must be a non-empty string");
25
- }
26
- if (record.spentTxHash !== undefined && record.spentTxHash.length === 0) {
27
- throw new CoreError("note spentTxHash must be a non-empty string");
28
- }
29
15
  const noteKey = keys.note(record.chainId, record.index);
30
16
  const previous = await getJson(storage, noteKey);
31
17
  const ops = [
@@ -55,15 +41,13 @@ export function createNoteStore(storage) {
55
41
  const store = {
56
42
  /**
57
43
  * Upsert a note record and maintain the unspent-note index for fast balance queries.
58
- * If the note already exists and is marked as spent, preserve spentAt unless the caller
59
- * provides an explicit spentAt value (eg. upgrading from a local observation time to an
60
- * on-chain timestamp from the indexer).
44
+ * If the note already exists and is marked as spent, preserve the spentAt field.
61
45
  */
62
46
  async putNote(note) {
63
47
  const noteKey = keys.note(note.chainId, note.index);
64
48
  const existing = await getJson(storage, noteKey);
65
- if (existing?.spentAt !== undefined && note.spentAt === undefined) {
66
- // Preserve spentAt if caller doesn't provide a value.
49
+ if (existing?.spentAt !== undefined) {
50
+ // Preserve spentAt if note was already marked as spent
67
51
  await persistNote({ ...note, spentAt: existing.spentAt });
68
52
  }
69
53
  else {
@@ -74,6 +58,8 @@ export function createNoteStore(storage) {
74
58
  * Fetch a note by (chainId, index) if it exists in local storage.
75
59
  */
76
60
  async getNote(chainId, index) {
61
+ ensureChainId(chainId);
62
+ ensurePositiveInt("note index", index);
77
63
  return getJson(storage, keys.note(chainId, index));
78
64
  },
79
65
  /**
@@ -81,6 +67,12 @@ export function createNoteStore(storage) {
81
67
  */
82
68
  async listNotes(options = {}) {
83
69
  const { chainId, mpk, token, includeSpent = true } = options;
70
+ if (chainId !== undefined) {
71
+ ensureChainId(chainId);
72
+ }
73
+ if (mpk !== undefined) {
74
+ ensureMpk(mpk);
75
+ }
84
76
  const prefix = chainId !== undefined ? `notes:${chainId}:` : "notes:";
85
77
  const entries = await storage.iter({ prefix });
86
78
  const filtered = entries
@@ -96,6 +88,9 @@ export function createNoteStore(storage) {
96
88
  * Mark a cached note as spent by setting its timestamp and re-indexing metadata.
97
89
  */
98
90
  async markNoteSpent(chainId, index, spentAt = Date.now()) {
91
+ ensureChainId(chainId);
92
+ ensurePositiveInt("note index", index);
93
+ ensurePositiveInt("note spentAt", spentAt);
99
94
  const existing = await store.getNote(chainId, index);
100
95
  if (!existing) {
101
96
  throw new CoreError("note not found");
@@ -111,6 +106,8 @@ export function createNoteStore(storage) {
111
106
  * Drop the spent marker from a cached note, returning it to the unspent index.
112
107
  */
113
108
  async markNoteUnspent(chainId, index) {
109
+ ensureChainId(chainId);
110
+ ensurePositiveInt("note index", index);
114
111
  const existing = await store.getNote(chainId, index);
115
112
  if (!existing) {
116
113
  throw new CoreError("note not found");
@@ -123,6 +120,23 @@ export function createNoteStore(storage) {
123
120
  await persistNote(updated);
124
121
  return updated;
125
122
  },
123
+ /**
124
+ * Aggregate unspent note balances per token for a given master public key.
125
+ */
126
+ async getZkBalances(mpk, options = {}) {
127
+ ensureMpk(mpk);
128
+ const notes = await store.listNotes({
129
+ chainId: options.chainId,
130
+ mpk,
131
+ includeSpent: false,
132
+ });
133
+ const totals = {};
134
+ for (const note of notes) {
135
+ const amount = BigInt(note.value);
136
+ totals[note.token] = (totals[note.token] ?? 0n) + amount;
137
+ }
138
+ return totals;
139
+ },
126
140
  };
127
141
  return store;
128
142
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nullifier-store.d.ts","sourceRoot":"","sources":["../../../state/store/nullifier-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO;IAEjD;;OAEG;4BAC2B,eAAe;IAS7C;;OAEG;0BACyB,MAAM,SAAS,MAAM;IAIjD;;OAEG;6BAC4B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;EAM1D"}
1
+ {"version":3,"file":"nullifier-store.d.ts","sourceRoot":"","sources":["../../../state/store/nullifier-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO;IAEjD;;OAEG;4BAC2B,eAAe;IAS7C;;OAEG;0BACyB,MAAM,SAAS,MAAM;IAKjD;;OAEG;6BAC4B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;EAO1D"}
@@ -14,12 +14,14 @@ export function createNullifierStore(storage) {
14
14
  * Lookup a previously observed nullifier by value.
15
15
  */
16
16
  async getNullifier(chainId, value) {
17
+ ensureChainId(chainId);
17
18
  return getJson(storage, keys.nullifier(chainId, value));
18
19
  },
19
20
  /**
20
21
  * Count all nullifiers stored locally for a given chain.
21
22
  */
22
23
  async countNullifiers(chainId) {
24
+ ensureChainId(chainId);
23
25
  const prefix = `nullifiers:${chainId}:`;
24
26
  const entries = await storage.iter({ prefix });
25
27
  return entries.length;
@@ -22,33 +22,10 @@ export type NoteRecord = {
22
22
  random: string;
23
23
  /** Nullifier that will be revealed when the note is spent. */
24
24
  nullifier: string;
25
- /**
26
- * Transaction hash that inserted this note commitment on-chain.
27
- * Derived from the indexer commitment record.
28
- */
29
- createdTxHash?: string;
30
- /**
31
- * Indexer event type associated with the commitment insertion.
32
- * Typically "deposit" or "transact" once supported by the indexer.
33
- */
34
- createdEventType?: string;
35
- /** Optional timestamp (ms) when this note was created/observed by the indexer. */
36
- createdAt?: number;
37
- /**
38
- * Optional timestamp (ms) when the note was marked as spent.
39
- * Prefer an on-chain/indexer-derived time when available; otherwise it may be a local observation time.
40
- */
41
- spentAt?: number;
42
- /** Transaction hash that spent this note (via its nullifier), when known. */
43
- spentTxHash?: string;
44
- };
45
- export type NoteInsert = Omit<NoteRecord, "spentAt"> & {
46
- /**
47
- * Optional timestamp (ms) when the note was marked as spent.
48
- * When omitted, existing spentAt (if any) is preserved by the note store.
49
- */
25
+ /** Optional timestamp when the note was marked as spent. */
50
26
  spentAt?: number;
51
27
  };
28
+ export type NoteInsert = Omit<NoteRecord, 'spentAt'>;
52
29
  /**
53
30
  * Details about a nullifier observed on-chain, whether or not we own the note.
54
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../../state/store/records.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,0DAA0D;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,MAAM,SAAS,MAAM;EAI/C"}
1
+ {"version":3,"file":"root-store.d.ts","sourceRoot":"","sources":["../../../state/store/root-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO;IAE5C;;OAEG;kBACiB,UAAU;IAU9B;;OAEG;qBACoB,MAAM,SAAS,MAAM;EAQ/C"}
@@ -20,6 +20,10 @@ export function createRootStore(storage) {
20
20
  * Retrieve a root snapshot by Merkle root value.
21
21
  */
22
22
  async getRoot(chainId, value) {
23
+ ensureChainId(chainId);
24
+ if (typeof value !== "string" || value.length === 0) {
25
+ throw new CoreError("root value must be a non-empty string");
26
+ }
23
27
  return getJson(storage, keys.root(chainId, value));
24
28
  },
25
29
  };