Skip to main content

Crate hopper_sdk

Crate hopper_sdk 

Source
Expand description

§Hopper SDK. Off-chain companion for the Hopper framework

This crate is the symmetric off-chain half of Hopper. Where hopper-core, hopper-runtime, and hopper-macros-proc own the on-chain safety surface, hopper-sdk owns the off-chain consumer surface: indexers, explorers, wallets, back-ends, and clients.

§Why this exists

Neither Pinocchio, Anchor zero-copy, nor Quasar ships a symmetric off-chain SDK that understands the framework’s own wire shapes. Clients for those frameworks tend to re-implement borsh/IDL decoders from scratch and always lag on-chain semantics. Hopper closes that loop:

  • Receipts are a first-class wire format (64-byte fixed, documented in the program manifest). This crate parses them and narrates them.
  • Layout fingerprints are mutual. A client can verify the on-chain account header matches the layout_id it was compiled against before any decoding. No “surprise layout change” incidents.
  • Segment-aware partial reads. Because Hopper knows field offsets at the segment level, clients can load just the bytes they need. the same property the on-chain side uses to minimize CU cost.
  • Manifest-driven builders. Instructions and account lists come out of the ProgramManifest so the on-chain definition is the single source of truth.

§Module map

  • receipt. Decode the Hopper 64-byte receipt wire format and convert it into structured data or a human-readable narrative.
  • reader. Segment-aware partial account readers that only pull the fields the caller asked for. Rejects mismatched layout_id.
  • builder. Instruction and account-list builder driven by the ProgramManifest. Zero borsh dependency.
  • diff. Snapshot-to-snapshot diff producer symmetric with hopper-core::diff.
  • fingerprint. Runtime layout_id verification helpers.

§Relationship to hopper-schema

This crate is a consumer of the ProgramManifest types defined in hopper-schema. It does not duplicate the schema. it operates over it.

Re-exports§

pub use fingerprint::FingerprintCheck;
pub use fingerprint::FingerprintError;
pub use reader::ReaderError;
pub use reader::SegmentReader;
pub use receipt::DecodedReceipt;
pub use receipt::ReceiptError;
pub use receipt::ReceiptWire;
pub use receipt::narrative::Narrator;
pub use receipt::narrative::ReceiptNarrative;

Modules§

builder
Manifest-driven instruction builder
diff
Snapshot diff
fingerprint
Layout fingerprint verification
reader
Segment-aware partial account reader
receipt
Receipt decoder

Enums§

SdkError
SDK-level error surface. All sub-errors lift into this enum for easy ?-propagation in consumer code.