Skip to content

Documentation / @etherfold/core / createHttpIngestion

Function: createHttpIngestion() ​

createHttpIngestion(options): IngestionTarget

Defined in: packages/core/src/ingestClient.ts:73

The ADR-0004 wire, over HTTP.

Its entire job is turning a status code into one of the three things a sender can act on, and it is the only place in this package that knows which code means what:

  • 200 -- applied, and the body says where the next batch starts.
  • 409 -- the one RESUMABLE refusal. Returned as a CursorCorrection rather than thrown, because it is not an error: it is how a fetcher holding no cursor is told where it really is.
  • anything else 4xx (400 malformed or foreign, 401 bad token, 404 a name this server was not built with, 501 no processor) -- IngestionRefusedError. No block number makes these right, so a sender that retried them would retry forever.
  • 5xx, or no answer at all -- IngestionUnavailableError, which IS worth retrying. The batch may or may not have been applied; the sender does not need to know, because the cursor settles it on the next attempt.

The body is written with serializeWireBatch, never JSON.stringify: a decoded log's args hold a BigInt for every uint256 an ABI declares, which JSON.stringify throws on outright.

Parameters ​

options ​

HttpIngestionOptions

Returns ​

IngestionTarget