sl.archive
Load a signed archive manifest, verify your data against it, and price and fetch what you are missing.
| latest(against, opts) | LoadedArchive | Load the latest signed archive manifest. |
| load(against, opts) | LoadedArchive | Load an archive manifest from a URL. |
| status() | ArchiveStatus | Get the archive's current operational state. |
| partitions(ref, filter) | ArchivePartition[] | List a loaded archive's partitions, optionally filtered. |
| quote(input) | ArchiveQuote | Price a fetch against your balance before you pay for it. |
| fetch(input) | ArchiveFetchResult | Get presigned download URLs for archive partitions. |
| download(partition, opts) | Uint8Array | Download a partition's bytes and verify them. |
| credits.balance() | ArchiveCreditsBalance | Get your archive credit balance. |
| credits.checkout(input) | { url: string } | Start a card checkout for a credit pack. |
| credits.refill(input) | { belowUsd: number | null; packUsd:… | Set or turn off automatic credit refill. |
| verify(input) | ArchiveVerifyResult | Check your instance's data against a signed archive. |
Load the latest signed archive manifest.
Reads <archive>/latest.json unless against names another manifest URL. The manifest's ed25519 signature is checked against the archive signing key, and a missing or invalid one throws ArchiveSignatureError. insecure: true skips the check; signature.verified on the result says whether it held.
Parameters
hover a row to find it in the codeOptions
againststring | |
opts.insecureboolean |
Returns Promise<LoadedArchive>
manifest- ArchiveManifest
origin- string
root- string
isRemote- boolean
signature- { verified: boolean; reason?: string }
Load an archive manifest from a URL.
Takes http(s) URLs only; a local path throws a ValidationError and stays on the CLI. The signature check is the same as latest.
Parameters
hover a row to find it in the codeRequired
againstrequiredstring |
Options
opts.insecureboolean |
Returns Promise<LoadedArchive>
manifest- ArchiveManifest
origin- string
root- string
isRemote- boolean
signature- { verified: boolean; reason?: string }
Get the archive's current operational state.
Reads the public status.json: fresh, lagging, stale, gap, failed-audit, or source-unavailable, plus how far the last signed publish reaches.
Returns Promise<ArchiveStatus>
schema_version- 1
network- string
state- ArchiveState
detail- Human-facing one-liner explaining the state, including WHY.
generated_at- string
archive- { snapshot_digest: string | null; coverage_to_block: number | null; promoted_at…
source- { tip_height: number | null; finalized_height: number | null; decoder_head: num…
lag- { blocks_behind_finalized: number | null; blocks_behind_tip: number | null; sec…
audit- { complete: boolean; checked_at: string; } | null
signature- string
key_id- string
List a loaded archive's partitions, optionally filtered.
Runs locally on the manifest you already loaded and makes no request. Filter by dataset (blocks, transactions, events, or state_writes when the archive publishes it) and a block range.
Parameters
hover a row to find it in the codeRequired
ref.manifestrequiredArchiveManifest | |
ref.originrequiredstring | |
ref.rootrequiredstring | |
ref.isRemoterequiredboolean | |
ref.signaturerequired{ verified: boolean; reason?: string } |
Options
filter.datasetArchiveDataset | |
filter.fromBlocknumber | |
filter.toBlocknumber |
Returns ArchivePartition[]
dataset- string
from_block- number
to_block- number
path- string
row_count- number
byte_size- number
sha256- string
Price a fetch against your balance before you pay for it.
Nothing is charged. flow is bootstrap or repair. The quote has the bundle count, the price in USD, the free repair allowance applied, your balance, and sufficient. Needs an account key (sk-sl_*), not an instance token.
Parameters
hover a row to find it in the codeRequired
pathsrequiredstring[] | |
flowrequiredArchiveFlow |
Returns Promise<ArchiveQuote>
partitions- number
bundles- number
usdMicros- number
usd- string
freeAllowanceAppliedMicros- number
allowanceRemainingBundles- number
balanceUsdMicros- number
sufficient- boolean
Get presigned download URLs for archive partitions.
Draws credits per partition bundle; your first six repair bundles each month are free. Lists longer than 64 paths go out in batches of 64. Each URL is short-lived (expiresAt); pass it to download. An empty balance throws InsufficientArchiveCreditsError with the shortfall. Needs an account key (sk-sl_*).
Parameters
hover a row to find it in the codeRequired
pathsrequiredstring[] | |
flowrequiredArchiveFlow |
Returns Promise<ArchiveFetchResult>
urls- ArchiveFetchItem[]
chargedTotalUsdMicros- number
balanceAfterUsdMicros- number
Download a partition's bytes and verify them.
The sha256 is checked against the manifest, and a mismatch throws ArchiveSignatureError. On the official archive host you must pass the presigned url from fetch, or it throws a ValidationError; any other host downloads straight from its archive tree.
Parameters
hover a row to find it in the codeRequired
partition.datasetrequiredstring | |
partition.from_blockrequirednumber | |
partition.to_blockrequirednumber | |
partition.pathrequiredstring | |
partition.row_countrequirednumber | |
partition.byte_sizerequirednumber | |
partition.sha256requiredstring |
Options
opts.urlstring |
Get your archive credit balance.
Returns creditsUsdMicros (millionths of a dollar, as a string) and your auto-refill setting. Needs an account key (sk-sl_*).
Returns Promise<ArchiveCreditsBalance>
creditsUsdMicros- string
refill- { belowUsd: number | null; packUsd: number | null; lastAt: string | null }
Start a card checkout for a credit pack.
pack is the dollar amount: 10, 25, 50, or 100. Resolves to the checkout url. Needs no account key.
Parameters
hover a row to find it in the codeRequired
emailrequiredstring | |
packrequired10 | 25 | 50 | 100 |
Set or turn off automatic credit refill.
Pass belowUsd and packUsd to buy a pack whenever the balance drops below the threshold, or { off: true } to stop. Needs an account key (sk-sl_*).
Parameters
hover a row to find it in the codeRequired
inputrequired{ belowUsd: number; packUsd: 10 | 25 | 50 | 100 } | { o… |
Check your instance's data against a signed archive.
Runs POST /v1/archive/verify on your instance: read-only, and it compares raw identity digests only (the deep semantic check is CLI-only). Resolves to clean, diverged, or unanchored; a failed signature is unanchored, never clean. Narrow the check with fromBlock and toBlock. Verification is free.
Parameters
hover a row to find it in the codeRequired
againstrequiredstring |
Options
targetstring | |
fromBlocknumber | |
toBlocknumber | |
insecureboolean | |
publicKeyPemstring |
Returns Promise<ArchiveVerifyResult>
status- "clean" | "diverged" | "unanchored"
target- string
against- string
signature- { verified: boolean; reason?: string }
coverage- { from_block: number; to_block: number }
ranges- { dataset: string; from_block: number; to_block: number; status: ArchiveVerifyR…
reason- string
ArchiveCreditsBalanceArchiveDatasetArchiveFetchItempath, url, expiresAt, chargedUsdMicrosArchiveFetchResultArchiveFlowArchiveLoadOptionsArchiveManifestnetwork, coverage, partition_size_blocks, range_digests, partitions, signature, …ArchivePartitionArchiveQuoteArchiveState"fresh" | "lagging" | "stale" | "gap" | "failed-audit" | "source-unavailable"ArchiveStatusArchiveVerifyInputArchiveVerifyRangeStatus"match" | "digest-mismatch" | "count-mismatch" | "missing"ArchiveVerifyResultLoadedArchiveRangeDigestdataset, from_block, to_block, row_count, digest, digest_specRangeDigestDataset"events" | "blocks" | "transactions" | "state_writes"