@xyo-network/xl1-statement-graph-sdk
v0.5.3
Published
Chain-facing SDK for the XYO Statement Graph — finalized-scan replay source, verified writer, and replay-contract checkpointing over structural XL1 viewer/datalake interfaces.
Keywords
Readme
@xyo-network/xl1-statement-graph-sdk
Chain-facing SDK for the XYO Statement Graph (see the repository WHITEPAPER). Everything chain-shaped is a STRUCTURAL interface (FinalizedBlockViewer, BodyStore, StatementBroadcaster) — a real XL1 gateway viewer and REST datalake runner satisfy them directly, and the testing package's fakes exercise every behavior deterministically.
- Bridge:
decodeHydratedBlock— XL1 hydrated blocks → committed-order abstract transactions plus non-transaction block carriers, with the D7-critical rule thattxIndexcounts the FULL committed block payload array before filtering. - Scan (
scanFinalizedStatements): forward finalized walk with same-block elevated Claim hydration. Every transaction Bound Witness and every carrier consumed by the scan is canonical root-hash verified: required elevated Claims, configured auxiliary items, and co-committed objects named by verified Claims when strict body/schema equality is enabled. Unrelated non-transaction carriers do not affect Statement Graph replay.ClaimCarrierIntegrityErrorstops scanning on missing/mismatched Claim carriers, relevant non-Claim mismatches raiseBlockCarrierIntegrityError, and the datalake is never a Claim-event fallback. Verified object/auxiliary carriers take precedence over off-chain resolution. Bulk range completeness, per-block fallback, head-regression checks,AbortSignal, strict object-body verification,indexedSchemaPolicy, and auxiliary candidates remain supported. - Writer:
buildClaim({source, subject, hashes}), sharedprepareStatements,insertVerified(insert → readback hash check), andpublishStatements— Claims occupy only the elevated/on-chain partition and use XL1 root hashes; referenced object identity remains dataHash-based. Every named object must be co-committed or the whole Claim transaction is rejected. Objects whose client metadata makes root hash differ from dataHash are rejected because they cannot satisfy that commitment. The on-chain/off-chain transport partitions are disjoint and order-independent. - Checkpoint: format version 2,
ReplayContract-scoped and fail-closed with observable causes (missing/corrupt/contract-mismatch). Stored and directly suppliedresumeFromvalues pass the same runtime parser before records or horizons are trusted. Fold version 4 and the new wire marker force older pre-subject/pre-atomic checkpoints to rescan from their declared floor; retained unresolved Claim references cannot resume under current semantics. The generic protocol still models unresolved event bodies for non-XL1/local backings, but finalized scans turn missing elevated carriers into fatal integrity errors.
Account-mode transaction building (buildTransaction + addTransactionToChain) stays at the consumer boundary for now — publishStatements targets the universal addPayloadsToChain path both browser and Node gateways expose.
License
LGPL-3.0-only © XY Labs / XYO Foundation
