Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SDK API

The SDK API is organized by invocation context — each page documents the wrappers available during that entry point.

  • Common — available in all contexts (ServiceData, Preimages)
  • Refine — RefineContext, RefineFetcher, RefinePreimages, Machine
  • Accumulate — AccumulateContext, AccumulateFetcher, AccumulatePreimages
  • Authorize — AuthorizeContext, AuthorizeFetcher
  • Utilities — Logger, LogMsg, ByteBuf, Decoder, Byte Types
  • Host Calls (ecalli) — raw host call reference table

The test-time SDK surface (under @fluffylabs/as-lan/test) is documented on the Testing page. It includes:

  • RefineCall / AccumulateCall — chainable builders that encode args and invoke a service entrypoint.
  • OperandItem / TransferItem — chainable builders for the encoded AccumulateItem blobs that TestAccumulate.setItem(i, ...) expects.
  • Assert, Test, TestSuite, runTestSuites, unpackResult, strBlob — the test framework primitives.
  • TestEcalli, TestGas, TestFetch, TestLookup, TestStorage, TestAccumulate, TestPreimages, TestPrivileged, TestServices, TestMachine, TestExportSegment, TestHistoricalLookup, TestTransfer, TestInfo — mock-stub configuration classes.

Example services

Each example in examples/ is a self-contained service that exercises a particular slice of the SDK. Browse the source for end-to-end patterns.

  • fibonacci — minimal refine + accumulate, starter template.
  • authorizer — standalone is_authorized service with gating logic.
  • ecalli-test — dispatches every ecalli host call for smoke-testing the SDK surface.
  • all-ecalli — self-authorizing service that invokes every ecalli across refine, accumulate, and authorize entry points.
  • pastebin — open-submission paste service. Refine hashes the payload with Blake2b-256; accumulate solicits the preimage and records metadata in a storage-backed ring buffer plus a slot-bucketed TTL index. Preimage bytes arrive via the xtpreimages block extrinsic — accumulate never calls provide. Good reference for the solicit-only preimage lifecycle and slot-bucket cleanup patterns.
  • library — hosts reusable PVM verification blobs as SPI-encoded preimages keyed by name, resolved and executed via ctx.nestedPvmFromSpiChecked(...).
  • nested-pvm-spi — minimal smoke test for the inner PVM: loads an embedded SPI blob and runs it through ctx.nestedPvmFromSpiChecked.