adapter.ts lets xdrcheck replay run the corpus against an indexer. It speaks the same JSON
protocol as the Go adapters (xcc.adapter/1, docs/adapter-protocol.md): one
JSON request per line on stdin, one response per line on stdout, logs on stderr. It is the TypeScript twin of
the Go template go/adapters/minimal. Any program that reads and writes those JSON
lines works; TypeScript is the example.
It reports two observation kinds:
- receipts: how many transactions the indexer holds for each ledger;
- transactions: each transaction’s hash, apply-order index, success and fee charged.
not_applicable and costs nothing.
Run it
Node 24 runs the file as it is (type stripping, no build step). The one dependency is@stellar/stellar-sdk 17.4.0, pinned by package-lock.json.
check.sh (or make check-adapter-ts) does all three and fails when either check fails. Each failure, with what the ledger holds, what the
indexer held and the command that reproduces it, is in reports/adapter-ts/REPORT.md.
Make it yours
The “indexer” here reads each ledger of the SEP-54 directory the harness serves and keeps its facts in memory. Each place markedREPLACE is where your adapter calls your indexer instead:
- describe (
DESCRIBE): your adapter’s name, the inputs your indexer reads (sep54-dir,sep54-s3,rpc), the protocol range it claims (envelope), and the kinds it models. Declare only what is true. - prepare: create a fresh, empty store for the session under
params.workdir. - ingest: start your indexer on
params.inputandparams.range, wait until its own progress marker reachesrange.endor it stops, and report the facts behind the status (completed,halted,crashed,timeout; see adapter-protocol.md §4.3). Never decide a status from log text. - observe: one query per kind against your store, one fact per stored record, values exactly as stored. A ledger you hold nothing for is left out: that is how a drop is seen.
- teardown: drop the store.
corpus/schema/adapter-protocol.schema.json and
observation.schema.json are the contract; xdrcheck replay --selftest validates every message against them.
When the selftest or the replay fails, the causes and fixes are the same as for the Go template
(go/adapters/minimal, “When it fails”). The adapter’s stderr
is in the report directory’s logs/.
Limits: xdrcheck replay runs on Linux only, and the harness judges only the kinds the adapter declares. The
template keeps its “indexer” in memory; your adapter must read back what your indexer stored, not what it was
sent.