SDK reference
Every method on the client, read from the SDK's own source. One page per surface: pick one below, or start with the SDK guide.
const sl = new SecondLayer() · @secondlayer/sdk
sl.batch · sl.contextBatched reads and the agent snapshot2 methodssl.streamsOrdered events, cursors, dumps14 methodssl.indexDecoded rows, sBTC, PoX-5, Runes54 methodssl.subgraphsDeploy, read rows, operations19 methodssl.webhooksCreate, deliveries, replay15 methodssl.archiveVerify, quote, fetch11 methodssl.contractsFind by trait, ABI2 methodssl.instanceStatus, diagnose2 methods
Helpers you import directly
consumerHealthLiveness for a consume loop.parseRetryAfterParse a
Retry-After header: delta-seconds or an HTTP-date.resolveApiKeyResolve the bearer credential; the key follows the host.verifyTransactionProofVerify a transaction-inclusion proof.verifyWebhookSignatureVerify a Secondlayer webhook delivery signature.All 46 helpersDecoders, type guards, signature and proof checksErrors
SecondLayerError root of the family
├─ ApiError Error thrown by SecondLayer when an API request fails.
│ ├─ AuthError 401
│ ├─ RateLimitError 429
│ ├─ StreamsServerError Thrown on a 5xx from the Streams API, and on a failed signing-key fetch.
│ └─ ValidationError Thrown on a 4xx the caller can fix (bad cursor, bad params).
├─ ArchiveAuthError Thrown on a 401 from the archive ops host (quote/fetch/credits).
├─ ArchiveGateNotConfiguredError Thrown on a 503 when the archive fetch gate is unconfigured.
├─ ArchiveSignatureError Thrown when an archive manifest signature is missing or does not verify.
├─ InsufficientArchiveCreditsError Thrown on a 402 from archive fetch — prepaid credits do not cover the quote.
└─ StreamsSignatureError Thrown when response signature verification is enabled and fails.