The SDK for autonomous economic agents. Give an agent an identity, a wallet, and the ability to find, negotiate with, and settle with other agents - peer-to-peer, with perfect privacy and ultra-fast finality
This report presents the forensic synthetic code analysis of unicity-sphere/sphere-sdk, a TypeScript project with 5,422 GitHub stars. SynthScan v2.0 examined 158,548 lines of code across 427 source files, recording 478 pattern matches distributed across 8 syntactic categories. The overall adjusted score of 5.3 places this repository in the Low AI signal band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 478 distinct pattern matches across 8 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | eslint.config.js | 22 | // ── token-engine boundary ─────────────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/nodejs/storage/FileTokenStorageProvider.ts | 235 | // ── Lazy inventory port (sdk-changes S2) — default whole-blob adapter ────── | COMMENT |
| MEDIUM | impl/shared/ipfs/ipfs-storage-provider.ts | 598 | // ── Lazy inventory port (sdk-changes S2) — default whole-blob adapter ────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 129 | // ── provider lifecycle ────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 192 | // ── persisted sync state (per network + identity) ─────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 234 | // ── inventory sync (§5.1) ─────────────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 307 | // ── lazy inventory port (S2) ──────────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 403 | // ── recovery (§5.3, sdk-changes S2) ───────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 468 | // ── whole-blob surface (thin: the hot path is the lazy port above) ────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 157 | // ── persisted state (per network + identity) ──────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 207 | // ── deliver (S3: upload → deposit) ────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 295 | // ── incoming (S3: mailbox pull) ───────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 404 | // ── ack (claim / reject) ──────────────────────────────────────────────────── | COMMENT |
| MEDIUM | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 456 | // ── wake (optional hook — §9: a nudge, never a correctness dependency) ────── | COMMENT |
| MEDIUM | impl/browser/storage/IndexedDBTokenStorageProvider.ts | 284 | // ── Lazy inventory port (sdk-changes S2) — default whole-blob adapter ────── | COMMENT |
| MEDIUM | wallet-api/codec.ts | 194 | // ── mailbox (§6/§16) ────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/codec.ts | 270 | // ── payment requests (§10/§16) ──────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/codec.ts | 336 | // ── history (§10/§16) ───────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/types.ts | 13 | // ── collaborator ports (DI — no singletons) ────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/types.ts | 82 | // ── client config / identity ───────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/types.ts | 154 | // ── REST result shapes (§16) ────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/types.ts | 215 | // ── mailbox (§6/§16) ────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/types.ts | 274 | // ── history (§10/§16) ───────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/types.ts | 311 | // ── payment requests (§10/§16) ──────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 305 | // ── storage keys (scoped per network + pubkey + device) ──────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 331 | // ── auth (ARCHITECTURE §4) ────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 444 | // ── request core ──────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 600 | // ── inventory / blobs (§16) ───────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 692 | // ── mailbox (§6/§16) ──────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 745 | // ── history (§10/§16) ─────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 765 | // ── payment requests (§10/§16) ────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 830 | // ── intents (E.3) ─────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 920 | // ── intent progress: the E.4 burn checkpoint (sphere-sdk#501) ──────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 920 | // ── intent progress: the E.4 burn checkpoint (sphere-sdk#501) ──────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 1086 | // ── syncEpoch (§5.4/§9) ───────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/client.ts | 1107 | // ── realtime (§9) ─────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/wake-supervisor.ts | 112 | // ── connect / drop ────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | wallet-api/wake-supervisor.ts | 188 | // ── liveness watchdog ──────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | oracle/oracle-provider.ts | 36 | // ── v2 token-engine config surface ───────────────────────────────────────── | COMMENT |
| MEDIUM | tests/unit/token-engine/FakeTokenEngine.ts | 229 | // ── internals ────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 208 | // ── Session 1 ───────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 380 | // NON-EMPTY and the wallet-api cursor is warm. ────────────────────────────── | COMMENT |
| MEDIUM | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 391 | // its client is dead at init: every request throws. ─────────────────────── | COMMENT |
| MEDIUM | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 403 | // advanced it; the live load does). ─────────────────────────────────────── | COMMENT |
| MEDIUM | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 434 | // send POSTs one dedupKey'd §10 record (the server is the durable log). ───── | COMMENT |
| MEDIUM | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 451 | // exhaustion. ───────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | …act/wallet-api-token-storage-provider.contract.test.ts | 60 | // ── the shared S7 contract ───────────────────────────────────────────────────── | COMMENT |
| MEDIUM | …act/wallet-api-token-storage-provider.contract.test.ts | 75 | // ── remote-only S2 semantics ─────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 286 | // ── test hooks / counters ──────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 315 | // ── lifecycle ──────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 340 | // ── test hooks ─────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 583 | // ── owner state ────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 606 | // ── HTTP plumbing ──────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 699 | // ── auth (§4) ──────────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 839 | // ── inventory (§5.1, §16) ──────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 907 | // ── blobs (§5.2) ───────────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 1020 | // ── apply-delta (§5.3) ────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 1217 | // ── mailbox (§6, §16) ──────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 1591 | // ── history (§10, §16) ─────────────────────────────────────────────────────── | COMMENT |
| MEDIUM | tests/support/fake-wallet-api.ts | 1685 | // ── payment requests (§10, §16 — backend M4) ───────────────────────────────── | COMMENT |
| 31 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/unit/modules/AccountingModule.events.test.ts | 898 | // Step 1: Pre-populate ledger with an on-chain entry that says "back" | COMMENT |
| LOW | tests/unit/modules/AccountingModule.events.test.ts | 912 | // Step 2: Build an incoming transfer where the transport memo says "F" (forward) | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 346 | // Step 1: Add token | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 351 | // Step 2: Remove token (spent) - creates tombstone | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 356 | // Step 3: Re-add same token (Nostr re-delivery) → rejected | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 366 | // Step 1: Add token | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 370 | // Step 2: Remove token (spent) - creates tombstone | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 374 | // Step 3: Add token with new state (legitimate new state after transfer back) | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 689 | // Step 1: Party A proposes swap to party B | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 699 | // Step 2: Party B should have received the proposal | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 704 | // Step 3: Party B accepts the proposal | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 755 | // Step 6: Both parties verify payout | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 765 | // Step 7: Assert both in 'completed' state | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 783 | // Step 1: Party A proposes | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 788 | // Step 2: Party B receives proposal | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 792 | // Step 3: Party B rejects | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 796 | // Step 4: Party A receives rejection DM -> transitions to 'cancelled' | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 826 | // Step 1: Party A proposes | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 832 | // Step 2: Party B accepts | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 845 | // Step 4: Escrow times out and sends swap_cancelled | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 849 | // Step 5: Assert both parties in 'cancelled' state | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 890 | // Step 2: Party A cancels before depositing | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 893 | // Step 3: Assert party A's swap is 'cancelled' | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 981 | // Step 3: Party B accepts all three | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 987 | // Step 4: All three should progress independently | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 727 | // Step 5: Escrow detects both deposits | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 875 | // Step 1: Party A proposes, party B accepts | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 957 | // Step 1: Party A proposes all three swaps | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 969 | // Step 2: Party B should have received all three proposals | COMMENT |
| LOW⚡ | tests/integration/wallet-clear-indexeddb.test.ts | 117 | // Step 1: destroy() — shuts down providers | COMMENT |
| LOW⚡ | tests/integration/wallet-clear-indexeddb.test.ts | 122 | // Step 2: disconnect providers (as SphereProvider does) | COMMENT |
| LOW⚡ | tests/integration/wallet-clear-indexeddb.test.ts | 128 | // Step 3: Sphere.clear() internals — yield + clear | COMMENT |
| LOW | docs/QUICKSTART-NODEJS.md | 208 | // Step 1: Create base providers | COMMENT |
| LOW | docs/QUICKSTART-NODEJS.md | 247 | // Step 2: Compose wallet-api providers (required for v2 mailbox delivery) | COMMENT |
| LOW | docs/INTEGRATION.md | 30 | ### Step 1: Create Base Providers | COMMENT |
| LOW | docs/INTEGRATION.md | 91 | ### Step 2: Compose v2 Wallet-Api Providers | COMMENT |
| LOW | docs/INTEGRATION.md | 119 | ### Step 3: Alternative Composition (Bring Your Own Storage) | COMMENT |
| LOW | docs/INTEGRATION.md | 136 | ### Step 4: Initialize the Wallet | COMMENT |
| LOW⚡ | docs/INTEGRATION.md | 165 | // Step 1: Base providers | COMMENT |
| LOW⚡ | docs/INTEGRATION.md | 173 | // Step 2: Compose with wallet-api | COMMENT |
| LOW⚡ | docs/INTEGRATION.md | 180 | // Step 3: Initialize wallet | COMMENT |
| LOW⚡ | docs/INTEGRATION.md | 186 | // Step 4: Use v2 payments (sender-driven, certified on-chain, delivered via mailbox) | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 31 | // Step 1: Create base providers (storage + transport + oracle) | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 37 | // Step 2: Wrap with wallet-api for v2 mailbox delivery and token storage | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 44 | // Step 3: Initialize wallet | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 74 | // Step 1: Create base providers | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 80 | // Step 2: Wrap with wallet-api for v2 delivery | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 87 | // Step 3: Initialize wallet | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 151 | // Step 1: Create base providers | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 157 | // Step 2: Wrap with wallet-api for v2 delivery | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 164 | // Step 3: Initialize wallet | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 212 | // Step 1: Create base providers | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 218 | // Step 2: Wrap with wallet-api for v2 delivery | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 225 | // Step 3: Initialize wallet | COMMENT |
| LOW | docs/QUICKSTART-BROWSER.md | 266 | // Step 1: Base providers (required for network, oracle, transport) | COMMENT |
| LOW | docs/QUICKSTART-BROWSER.md | 307 | // Step 2: Wrap with wallet-api for v2 mailbox delivery (REQUIRED for v2) | COMMENT |
| LOW | docs/QUICKSTART-BROWSER.md | 314 | // Step 3: Initialize wallet with the composed providers | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 696 | // Step 1: Create base providers | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 702 | // Step 2: Wrap with wallet-api for v2 delivery | COMMENT |
| LOW⚡ | docs/QUICKSTART-BROWSER.md | 709 | // Step 3: Initialize wallet | COMMENT |
| 80 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/unit/modules/AccountingModule.events.test.ts | 898 | // Step 1: Pre-populate ledger with an on-chain entry that says "back" | COMMENT |
| LOW | tests/unit/modules/AccountingModule.events.test.ts | 912 | // Step 2: Build an incoming transfer where the transport memo says "F" (forward) | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 346 | // Step 1: Add token | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 351 | // Step 2: Remove token (spent) - creates tombstone | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 356 | // Step 3: Re-add same token (Nostr re-delivery) → rejected | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 366 | // Step 1: Add token | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 370 | // Step 2: Remove token (spent) - creates tombstone | COMMENT |
| LOW⚡ | tests/unit/modules/PaymentsModule.tombstone.test.ts | 374 | // Step 3: Add token with new state (legitimate new state after transfer back) | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 689 | // Step 1: Party A proposes swap to party B | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 699 | // Step 2: Party B should have received the proposal | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 704 | // Step 3: Party B accepts the proposal | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 755 | // Step 6: Both parties verify payout | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 765 | // Step 7: Assert both in 'completed' state | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 783 | // Step 1: Party A proposes | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 788 | // Step 2: Party B receives proposal | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 792 | // Step 3: Party B rejects | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 796 | // Step 4: Party A receives rejection DM -> transitions to 'cancelled' | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 826 | // Step 1: Party A proposes | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 832 | // Step 2: Party B accepts | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 845 | // Step 4: Escrow times out and sends swap_cancelled | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 849 | // Step 5: Assert both parties in 'cancelled' state | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 890 | // Step 2: Party A cancels before depositing | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 893 | // Step 3: Assert party A's swap is 'cancelled' | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 981 | // Step 3: Party B accepts all three | COMMENT |
| LOW⚡ | tests/integration/swap-lifecycle.test.ts | 987 | // Step 4: All three should progress independently | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 727 | // Step 5: Escrow detects both deposits | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 875 | // Step 1: Party A proposes, party B accepts | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 957 | // Step 1: Party A proposes all three swaps | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 969 | // Step 2: Party B should have received all three proposals | COMMENT |
| LOW⚡ | tests/integration/wallet-clear-indexeddb.test.ts | 117 | // Step 1: destroy() — shuts down providers | COMMENT |
| LOW⚡ | tests/integration/wallet-clear-indexeddb.test.ts | 122 | // Step 2: disconnect providers (as SphereProvider does) | COMMENT |
| LOW⚡ | tests/integration/wallet-clear-indexeddb.test.ts | 128 | // Step 3: Sphere.clear() internals — yield + clear | COMMENT |
| LOW | registry/TokenRegistry.ts | 215 | // Step 1: Try loading from cache | COMMENT |
| LOW | registry/TokenRegistry.ts | 229 | // Step 2: Cache miss — wait for first remote fetch (only when auto-refresh is enabled) | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 502 | // Step 7: Load auto-return dedup ledger — prune and crash recovery | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 510 | // Step 8: Populate invoice-transfer index (§5.4.4) | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 567 | // Step 9: Subscribe to PaymentsModule events (MUST come after index build) | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 574 | // Step 10: Subscribe to CommunicationsModule DM events if available | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 1067 | // Step 14: Fire 'invoice:created' event | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 1076 | // Step 15: Return result | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 1478 | // Step 1: Verify invoice exists | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 1488 | // Step 2: Check if terminal — reconstruct from frozen balances | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2653 | // Step 1: Invoice must exist | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2660 | // Step 2: Invoice must be in a terminal state (CLOSED or CANCELLED) | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2672 | // Step 3: Caller must be a target | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2682 | // Step 4: CommunicationsModule must be available | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2692 | // Step 5: Validate memo length | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2702 | // Step 6: Get frozen balances | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2927 | // Step 1: Invoice must exist | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2934 | // Step 2: Invoice must be in CANCELLED state (not CLOSED) | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2944 | // Step 3: Caller must be a target | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2954 | // Step 4: CommunicationsModule must be available | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 2964 | // Step 5: Validate reason and dealDescription length | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 6233 | // Step 2: Write token_scan_state | COMMENT |
| LOW⚡ | modules/accounting/AccountingModule.ts | 6240 | // Step 3: Write INV_LEDGER_INDEX | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 366 | // Step 1: Clear all in-memory state | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 437 | // Step 4: Load terminal sets | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 454 | // Step 5: Load frozen balances | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 489 | // Step 6: Load auto-return settings | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 808 | // Step 1: Validate CreateInvoiceRequest (§8.1) | COMMENT |
| 52 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | tests/unit/modules/SwapModule.storage.test.ts | 80 | const setCallKeys = mocks.storage.set.mock.calls.map((c: any[]) => c[0] as string); | CODE |
| CRITICAL | tests/unit/modules/SwapModule.storage.test.ts | 85 | const swapRecordCall = mocks.storage.set.mock.calls.find( | CODE |
| CRITICAL | tests/unit/modules/SwapModule.storage.test.ts | 160 | const indexCall = mocks.storage.set.mock.calls.find( | CODE |
| CRITICAL | tests/unit/modules/SwapModule.storage.test.ts | 250 | const removeCallKeys = mocks.storage.remove.mock.calls.map((c: any[]) => c[0] as string); | CODE |
| CRITICAL | tests/unit/modules/SwapModule.lifecycle.test.ts | 133 | const calledEvents = mocks.accounting.on.mock.calls.map((call: any[]) => call[0]); | CODE |
| CRITICAL | tests/unit/modules/SwapModule.lifecycle.test.ts | 152 | const accountingUnsubs = mocks.accounting.on.mock.results.map((r: any) => r.value); | CODE |
| CRITICAL | …odules/AccountingModule.payInvoice-provisional.test.ts | 378 | const setCallsDuring = mocks.storage.set.mock.calls.slice(setCallsBefore); | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | constants.ts | 161 | export function isNetworkScopedAddressKey(key: string): boolean { | CODE |
| LOW | impl/nodejs/transport/index.ts | 29 | export function createNodeWebSocketFactory(): WebSocketFactory { | CODE |
| LOW | impl/nodejs/transport/index.ts | 42 | export function createNostrTransportProvider( | CODE |
| LOW | impl/nodejs/ipfs/index.ts | 23 | export function createNodeIpfsStorageProvider( | CODE |
| LOW | impl/nodejs/oracle/index.ts | 77 | export function createNodeTrustBaseLoader( | CODE |
| LOW | impl/nodejs/oracle/index.ts | 91 | export function createUnicityAggregatorProvider( | CODE |
| LOW | impl/nodejs/storage/FileTokenStorageProvider.ts | 339 | export function createFileTokenStorageProvider(config: FileTokenStorageConfig | string): FileTokenStorageProvider { | CODE |
| LOW | impl/nodejs/storage/FileStorageProvider.ts | 239 | export function createFileStorageProvider(config: FileStorageProviderConfig | string): FileStorageProvider { | CODE |
| LOW | impl/shared/ipfs/ipns-record-manager.ts | 127 | export function verifySequenceProgression( | CODE |
| LOW | impl/shared/wallet-api/WalletApiTokenStorageProvider.ts | 599 | export function createWalletApiTokenStorageProvider( | CODE |
| LOW | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 489 | export function createWalletApiMailboxProvider( | CODE |
| LOW | impl/browser/transport/index.ts | 43 | export function createNostrTransportProvider( | CODE |
| LOW | impl/browser/ipfs/index.ts | 26 | export function createBrowserIpfsStorageProvider(config?: IpfsStorageConfig): IpfsStorageProvider { | CODE |
| LOW | impl/browser/oracle/index.ts | 77 | export function createBrowserTrustBaseLoader( | CODE |
| LOW | impl/browser/oracle/index.ts | 91 | export function createUnicityAggregatorProvider( | CODE |
| LOW | impl/browser/storage/IndexedDBTokenStorageProvider.ts | 631 | export function createIndexedDBTokenStorageProvider( | CODE |
| LOW | impl/browser/storage/IndexedDBStorageProvider.ts | 404 | export function createIndexedDBStorageProvider( | CODE |
| LOW | impl/browser/storage/LocalStorageProvider.ts | 267 | export function createLocalStorageProvider( | CODE |
| LOW | impl/browser/connect/ExtensionTransport.ts | 30 | export function isExtensionConnectEnvelope(data: unknown): data is ExtensionConnectEnvelope { | CODE |
| LOW | types/txf.ts | 311 | export function forkedKeyFromTokenIdAndState(tokenId: string, stateHash: string): string { | CODE |
| LOW | core/crypto.ts | 418 | export function generateAddressFromMasterKey( | CODE |
| LOW | core/crypto.ts | 556 | export function recoverPubkeyFromSignature(message: string, signature: string): string { | CODE |
| LOW | core/delivery-envelope.ts | 67 | export function deriveDeliveryEncryptionKey(privKeyHex: string, peerPubkeyHex: string): Uint8Array { | CODE |
| LOW | core/transport-resolver.ts | 71 | export function createTransportAddressResolver( | CODE |
| LOW | wallet-api/codec.ts | 273 | export function parsePaymentRequestRecord(raw: unknown, what: string): PaymentRequestRecord { | CODE |
| LOW | serialization/txf-serializer.ts | 71 | export function normalizeSdkTokenToStorage(sdkTokenJson: unknown): TxfToken { | CODE |
| LOW | serialization/txf-serializer.ts | 637 | export function hasUncommittedTransactions(token: Token): boolean { | CODE |
| LOW | serialization/txf-serializer.ts | 665 | export function countCommittedTransactions(token: Token): number { | CODE |
| LOW | serialization/wallet-text.ts | 162 | export function serializeEncryptedWalletToText(params: { | CODE |
| LOW | serialization/wallet-text.ts | 316 | export function parseAndDecryptWalletText( | CODE |
| LOW | serialization/wallet-dat.ts | 254 | function findEncryptedKeyForDescriptor( | CODE |
| LOW | …ts/unit/impl/shared/ipfs/ipfs-storage-provider.test.ts | 681 | async function createInitializedProvider(): Promise<IpfsStorageProvider> { | CODE |
| LOW | …/unit/transport/NostrTransportProvider.nametag.test.ts | 20 | function deriveNametagEncryptionKey(privateKeyHex: string): Uint8Array { | CODE |
| LOW | tests/unit/transport/NostrTransportProvider.test.ts | 545 | function createProviderWithStorage(storage: { get: ReturnType<typeof vi.fn>; set: ReturnType<typeof vi.fn> }) { | CODE |
| LOW | tests/unit/core/Sphere.nametag-sync.test.ts | 311 | function createMockTransportWithRecovery(options: { | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 94 | export function createMockAccountingModule(): MockAccountingModule { | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 204 | export function createMockCommunicationsModule(): MockCommunicationsModule { | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 266 | export function createMockStorageProvider(): MockStorageProvider { | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 638 | export function createMockAnnounceResultDM(swapId: string, depositInvoiceId?: string): string { | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 657 | export function createMockInvoiceDeliveryDM( | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 711 | export function createMockSwapCancelledDM( | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 745 | export function createMockPaymentConfirmationDM(swapId: string, party?: string): string { | CODE |
| LOW | tests/unit/modules/swap-test-helpers.ts | 761 | export function createMockBounceNotificationDM( | CODE |
| LOW | …ts/unit/modules/AccountingModule.autoTerminate.test.ts | 72 | function makeIncomingTransferWithDirection( | CODE |
| LOW | …s/unit/modules/AccountingModule.deliveryOrders.test.ts | 123 | function tokenInvoiceMapEntriesFor( | CODE |
| LOW | …odules/AccountingModule.payInvoice-provisional.test.ts | 82 | function makeTermsWithWalletAsTarget(overrides?: Partial<InvoiceTerms>): InvoiceTerms { | CODE |
| LOW | …ts/unit/modules/PaymentsModule.journey-backlog.test.ts | 313 | function persistentLocalTokenStorage(cell: { data: TxfStorageDataBase | null }): TokenStorageProvider<TxfStorageDataBase | CODE |
| LOW | tests/unit/modules/accounting-test-helpers.ts | 263 | export function createMockStorageProvider(): MockStorageProvider { | CODE |
| LOW | tests/unit/modules/accounting-test-helpers.ts | 333 | export function createMockTokenStorageProvider(): MockTokenStorageProvider { | CODE |
| LOW | tests/unit/modules/accounting-test-helpers.ts | 407 | export function createMockCommunicationsModule(): MockCommunicationsModule { | CODE |
| LOW | tests/unit/modules/accounting-test-helpers.ts | 831 | export function createTestAccountingModule(overrides?: { | CODE |
| LOW | tests/contract/storage-provider.contract.ts | 35 | export function describeStorageProviderContract( | CODE |
| LOW | tests/contract/delivery-provider.contract.ts | 85 | export function describeDeliveryProviderContract( | CODE |
| LOW | tests/integration/swap-lifecycle.test.ts | 561 | function configureAccountingForDeposit( | CODE |
| LOW | tests/integration/swap-lifecycle.test.ts | 599 | function configureAccountingForPayout( | CODE |
| LOW | tests/integration/wallet-clear-indexeddb.test.ts | 142 | function simulateStrictModeLeakedConnection(dbName: string): Promise<IDBDatabase> { | CODE |
| LOW | tests/harness/fake-differential.test.ts | 38 | async function assertServedByRealObjectStore( | CODE |
| LOW | token-engine/unicity-id.ts | 136 | export function createUnicityIdMinterFromDeps(deps: UnicityIdMinterDeps): IUnicityIdMinter { | CODE |
| LOW | modules/accounting/memo.ts | 389 | export function parseInvoiceMemoForOnChain( | CODE |
| LOW | modules/accounting/balance-computer.ts | 131 | function getOrCreateSenderAcc( | CODE |
| 7 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tsup.config.ts | 1 | import { defineConfig } from 'tsup'; | COMMENT |
| LOW | tsup.shared.js | 1 | // Shared tsup build configuration (sphere-sdk#548). | COMMENT |
| LOW | index.ts | 341 | // Networks | COMMENT |
| LOW | index.ts | 561 | // Master-key provider status re-export (already re-exported via ./types barrel, | COMMENT |
| LOW | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 221 | // S6: bundle the sender's nametag + memo into ONE recipient-addressed | COMMENT |
| LOW | impl/shared/wallet-api/WalletApiMailboxProvider.ts | 261 | stateHash: keys.stateHash, | COMMENT |
| LOW | core/Sphere.ts | 2401 | // wallet-api JWT, clear caches, and cause needless network traffic + inventory | COMMENT |
| LOW | core/Sphere.ts | 2541 | // own clients in the background. | COMMENT |
| LOW | …sts/unit/impl/browser/IndexedDBStorageProvider.test.ts | 181 | }); | COMMENT |
| LOW | …nit/impl/browser/IndexedDBTokenStorageProvider.test.ts | 221 | expect(countTokens(load.data!)).toBe(0); | COMMENT |
| LOW | …ransport/MultiAddressTransportMux.sharedClient.test.ts | 441 | // the host transport). The Mux did NOT construct a second. | COMMENT |
| LOW | tests/unit/modules/SwapModule.errors.test.ts | 181 | // ========================================================================= | COMMENT |
| LOW | tests/unit/modules/SwapModule.manifest.test.ts | 201 | // This ensures the client SDK produces the same swap_id as the escrow service | COMMENT |
| LOW | …s/unit/modules/AccountingModule.deliveryOrders.test.ts | 441 | // design — see _handleIncomingTransfer). This protects against a | COMMENT |
| LOW | tests/unit/modules/AccountingModule.events.test.ts | 781 | // | COMMENT |
| LOW | …odules/AccountingModule.payInvoice-provisional.test.ts | 401 | }); | COMMENT |
| LOW | tests/unit/modules/SwapModule.deposit.test.ts | 221 | // UT-SWAP-DEP-009 — Regression: party-currency vs. asset-position skew | COMMENT |
| LOW | …/contract/wallet-api-mailbox-provider.contract.test.ts | 141 | COMMENT | |
| LOW | tests/integration/swap-lifecycle.test.ts | 1001 | expect(idsB.size).toBe(3); | COMMENT |
| LOW | tests/integration/swap-lifecycle.test.ts | 1181 | // swap to 'completed' — exercises the direct-mutation `completed → failed` | COMMENT |
| LOW | tests/integration/kv-network-isolation-extra.test.ts | 181 | // enumeration — getFullKey('') resolves to the bare base prefix ('sphere_'), | COMMENT |
| LOW | tests/integration/sphere-network-isolation.e2e.test.ts | 221 | (Sphere as unknown as { instance: Sphere | null }).instance = null; | COMMENT |
| LOW | tests/integration/wallet-password.test.ts | 221 | // De-flake regression: an unauthenticated AES-CBC decrypt with the WRONG | COMMENT |
| LOW | tests/harness/live/live-address-switch-strand.test.ts | 261 | // A sends a VALID slice to B: a REAL split/mint certified by the gateway, the | COMMENT |
| LOW | tests/support/fake-wallet-api.ts | 1061 | // §5.3 step 2 — validate every added blob through the §8.2 pipeline | COMMENT |
| LOW | docs/CONNECT.md | 321 | COMMENT | |
| LOW | modules/accounting/serialization.ts | 61 | // Build the canonical object with keys in strict alphabetical order. | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 501 | // ------------------------------------------------------------------ | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 621 | try { this.unsubscribeDMs?.(); } catch { /* ignore */ } | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 1301 | // Step 4: Check for duplicate (token already imported) | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 1341 | } | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 1401 | this.balanceCache.delete(hashedKey); | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 2781 | // Per the InvoiceReceiptAsset type, we use netBalance as netAmount. | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 3941 | // payouts. Without this branch, post-restart | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 3961 | } | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 4341 | // an mt: entry IF an on-chain entry already exists, but the | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 4481 | COMMENT | |
| LOW | modules/accounting/AccountingModule.ts | 4621 | paymentDirection = ref.paymentDirection; | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 4661 | confirmed, | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 4681 | // that haven't graduated to a real invoice import within the TTL. | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 4741 | // for this invoiceId. The counter is also re-checked INSIDE the | COMMENT |
| LOW | modules/accounting/AccountingModule.ts | 4781 | } | COMMENT |
| LOW | modules/accounting/balance-computer.ts | 481 | entry.coinId, | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 1301 | chainPubkey: deps.identity.chainPubkey, | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 1621 | // the next poll tick). Scheduled on a TRACKED macrotask so destroy() | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 1761 | // Use mutable result for building the transfer | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 1781 | // #664). We still throw (keep-open + resume is the exit), but re-tag the | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 1921 | // On-chain memo: the structured invoice ref ({inv:{id,dir}}) for invoice | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 2121 | COMMENT | |
| LOW | modules/payments/PaymentsModule.ts | 2221 | } catch (error) { | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 2261 | // it manually); | COMMENT |
| LOW | modules/payments/PaymentsModule.ts | 4141 | * path) — the in-session cache is left intact and the pull retries next load. | COMMENT |
| LOW | modules/swap/SwapModule.ts | 1541 | // sorts each target's assets by coinId hash for deterministic invoice IDs. | COMMENT |
| LOW | modules/swap/SwapModule.ts | 1821 | // Storage failure rollback. Note the partial-failure window: | COMMENT |
| LOW | modules/swap/SwapModule.ts | 1901 | if (!targetStatus.coinAssets[0].isCovered) { | COMMENT |
| LOW | modules/swap/SwapModule.ts | 1961 | COMMENT | |
| LOW | modules/swap/SwapModule.ts | 1981 | // SECURITY: fail-CLOSED when payoutTokenIds is empty AND there are | COMMENT |
| LOW | modules/swap/SwapModule.ts | 2581 | // Snapshot fields mutated before transitionProgress so we can fully revert | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | transport/NostrTransportProvider.ts | 246 | // Create NostrClient with robust connection handling: | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/unit/core/utils.test.ts | 222 | expect(extractFromText(text, pattern)).toBe('John Doe'); | CODE |
| LOW | tests/unit/token-engine/FakeTokenEngine.ts | 298 | // fake-token state: CBOR array[ tokenId, stateId, owner, genesisData?, transferMemo? ] | COMMENT |