Skip to main content

@overcast-xyz/core

Enumerations

EnumerationDescription
ACTIONSAction discriminant bound into every signed operation message, so a payload can never be verified under another action's discriminant. Mirrors OperationPayload::action in operation.rsappend-only: never reuse or renumber a value.
SignatureCurve-

Classes

ClassDescription
AssetRegistryAn in-memory lookup from (domain, asset address) to its curated Asset metadata.
CloseOfferOperationThe signed body of an off-chain operation. Each subclass binds an action discriminant (actionByte) to a payload byte layout (payloadBytes), and digest folds both — with the shared metadata — into the canonical 32-byte message the signer commits to.
ConfigErrorEvery way one host's config was unreadable, in one throw.
CreateOfferOperationThe signed body of an off-chain operation. Each subclass binds an action discriminant (actionByte) to a payload byte layout (payloadBytes), and digest folds both — with the shared metadata — into the canonical 32-byte message the signer commits to.
DirectEd25519SignerThe default RawSigner: an in-process key over @noble/ed25519, a pure-JS implementation that runs identically in Node, browsers and other runtimes (no dependency on Node's built-in crypto). Built from a 32-byte seed (the leading half of an ed25519 secret key); createProtocolSigner derives that seed from the config's privateKey.
DirectSecp256k1Signer-
ExerciseOperationA taker delegating exercise_option. Unlike the offer operations this is not a content-addressed struct: the taker commits to the two offer ids, the exercise amount, and the opaque settlement metadata.
HexErrorThrown when a string is not well-formed hex of the expected width. A distinct class so callers validating untrusted input (a CLI prompt, a wire payload) can tell a malformed value from a genuine failure.
HttpOvercastViewAn OvercastView backed by the Overcast backend's REST API.
MemoryStoreIn-memory reference implementation of the storage ports. Backs both the trusted write side (OvercastStore) and the public read side (OvercastView); a real deployment swaps this for a database-backed store implementing the same interfaces.
MissingSignerErrorThrown when a write is attempted on an app that was built without an OvercastChainSigner — i.e. a read-only app, whose OvercastConfig carries no key material to sign with.
MultiOvercastAppOne handle over several chains at once: hand it the factories and it builds each chain's OvercastApp, then hands any one of them back at its original type.
OperationThe signed body of an off-chain operation. Each subclass binds an action discriminant (actionByte) to a payload byte layout (payloadBytes), and digest folds both — with the shared metadata — into the canonical 32-byte message the signer commits to.
OvercastAppThe full Overcast SDK surface for a settlement layer, organised by where each operation lands so the effect of a call is clear from how you reach it:
OvercastAssetsAn AssetRegistry pinned to one domain and one address boundary — the shape a single-chain consumer actually wants.
OvercastChainClientConcrete OvercastChain: a SigningWriter (signer + transaction writer, build → sign → submit) with the layer's OvercastReader folded in, so on-chain reads and signed writes live behind a single object. Built by OvercastApp from the pieces a ProtocolFactory resolves.
OvercastChainSignerOwns the signing key + connection for a settlement layer and turns a built transaction into a confirmed on-chain result. Signs transactions — for signing arbitrary protocol payloads (off-chain authorization) see OvercastProtocolSigner.
OvercastCuratorEverything needed to turn raw protocol records into curated (display, wire) shapes and back: the per-domain address boundaries (OvercastUtilsRegistry) and the per-domain asset metadata (AssetRegistry).
OvercastHttpErrorThrown when a backend read fails — either the server answered with a non-2xx status (the status and, where present, the backend's own error message are surfaced) or the request never reached it (network / timeout, status undefined). The originating axios error is kept as Error.cause.
OvercastIndexerDrives the store off the chain through three modes. Each is a step that supervise runs in a loop:
OvercastProtocolSignerSigns protocol payloads — not chain transactions. Where an OvercastChainSigner turns a built transaction into an on-chain result, a protocol signer produces a detached signature over an Operation's digest, used for the protocol's off-chain authorization (e.g. authorizing an offer).
OvercastUtilsRegistryEvery settlement layer's OvercastUtils, keyed by the protocol domain separator — OptionDetails.domain, the same domain an indexed event and every projection row carries.
ProtocolFactoryThe single chain-specific entry point: builds every per-layer piece the SDK composes into an OvercastApp — the on-chain OvercastReader, the transaction-building OvercastWriter, the OvercastChainSigner and the OvercastIndexerClient. A settlement layer implements this one factory (e.g. a Solana factory) and is good to go; the rest of the SDK stays chain-agnostic.
RedeemOperationA maker delegating redeem_option. Mirrors ExerciseOperation: the maker commits to the two offer ids, the redeemed amount, and the opaque settlement metadata. Its payload layout is identical to the exercise payload — the action discriminant keeps their signed messages disjoint.
RfqClientThe realtime RFQ channel: a typed socket.io client that registers with the backend, emits request/response (ack-style) calls, and surfaces server broadcasts through the on* callbacks. Owned by OvercastApp as its rfq field; the on-chain write/read sides live on the app itself.
RfqErrorError thrown when a request/response (ack-style) call fails — either the server returned { ok: false } with a stable RfqErrorCode, or no ack arrived before the timeout elapsed.
SettlementLayerRegistryThe set of settlement layers a chain implements, keyed by type. Built by the chain's ProtocolFactory (which layers exist is a per-chain fact) and surfaced to consumers as app.settlement.
SigningWriterComposes a transaction-building OvercastWriter with an OvercastChainSigner: each operation builds the layer's transaction(s) via writer, then signs + submits them via signer, yielding the signer's receipts. The result is itself an OvercastWriter<receipt>, so callers no longer juggle the build-then-submit two-step.
WithdrawOperationPayload byte layout: asset (32B)

Interfaces

InterfaceDescription
AppOptions-
AssetFilterFilter for OvercastView.listAssets.
AssetQuery-
AuthorizedKeyFilterFilter for OvercastView.listAuthorizedKeys. All clauses are AND-ed.
AuthorizedKeyQuery-
ClientToServerEventsClient→server events, keyed by event name. socket.io models request/response as a trailing ack callback argument; each here resolves to an RfqAck. Use as the second type parameter on a client Socket<...> and the first on the server Server<...>.
ConfigFieldEntryOne field of a ConfigSchema, as configFields yields it.
ConfigSourceWhere a host's values come from, and what it calls them when one is wrong.
CuratedOfferOffer over CuratedOptionDetails.
LogFnOne level's log method.
LoggerThe logging surface this package depends on. Declared here rather than re-exported from LogTape so the published API stays decoupled from the backend's own versioning.
LoggingOptions-
MultiAppOptions-
OfferClosureHow an offer's indexed events left it — the facts the raw Offer does not carry, the same way OptionTotals lives outside the raw MarketOption. An offer is consumed or refunded on-chain, never both.
OfferFilterFilter for the offer listings. All clauses are AND-ed.
OfferQuery-
OperationParams-
OptionFilterFilter for OvercastView.listOptions. All clauses are AND-ed.
OptionQuery-
OvercastChainThe protocol's on-chain surface: authoritative reads (OvercastReader) and signed writes (OvercastWriter, yielding one TxStep<L["receipt"]> per transaction the operation took — see SigningWriter), merged into one object. Everything here touches the settlement layer directly — it costs gas, needs the signer, and is chain-specific — as opposed to the cheap, curated backend reads exposed on app.api (an OvercastView).
OvercastEventHistory-
OvercastIndexerClient-
OvercastLayerDescribes a single settlement layer by bundling the three types that vary between implementations, so the rest of the SDK threads one generic (L) instead of repeating <T, R, C> everywhere. Each consumer derives what it needs via indexed access (L["tx"], L["receipt"], L["config"]).
OvercastReader-
OvercastSettlementLayerThe logic for one settlement layer on a given chain (L): the config (Bytes32) an offer commits to, and — for layers that have one — a convenience helper for the exercise/redeem metadata.
OvercastStoreThe permissioned write surface. Wired only into trusted processes: - the OvercastIndexer, which streams on-chain events via insertEvents; - the RFQ service, which persists validated off-chain RFQs / quotes.
OvercastUtilsA settlement layer's address boundary: the complete set of conversions between the chain's own address encoding and the canonical Bytes32 slots that core works in.
OvercastViewThe non-permissioned read surface, returning curated (display, JSON-safe) shapes. This is the interface shared across backend and frontend: a database implementation runs the query in-process, while a thin HTTP implementation in the frontend serializes the same query objects to the backend. Keep every argument and result JSON-serializable so both implementations stay honest.
OvercastWriterThe Overcast protocol's write operations, parameterised by the layer L they run against and by what each call yields (the read counterpart is OvercastReader).
PageA single page of results plus the cursor to fetch the next one.
PaginationCursor / offset pagination. Prefer the opaque cursor (keyset pagination): it is stable while new rows are inserted and stays fast on large tables. offset is offered only as a convenience for simple, shallow UI paging.
RawSigner-
ReadConfigOptionsOptions for readConfig.
RfqAckGeneric ack returned from the request/response (ack-style) handlers. Kept as a generic interface (rather than a zod schema) so callers can parameterize the data shape per event; see ClientToServerEvents.
RfqClientOptions-
RfqFilterFilter for OvercastView.listRfqs. All clauses are AND-ed.
RfqQuery-
ServerToClientEventsServer→client broadcasts, keyed by event name. Use as the first type parameter on a client Socket<...> and the second on the server Server<...>, so .on(...) / .emit(...) are checked on both ends.
SettlementParamsThe inputs a settlement-consulting write (exerciseOption / redeemOption) takes beyond the option and amount. Grouped into one object because the last of them is chain-specific: settlement is typed as the layer's OvercastLayer.settlementContext, so a context shape the chain doesn't model fails to compile rather than being smuggled in as a list of addresses.
SignedOperation-
SortOrder-
StoredQuoteA persisted quote, mirroring the curated newQuote broadcast payload.
StoredRfqA persisted RFQ, mirroring the curated newRfq broadcast payload.
UserDepositFilterFilter for OvercastView.listUserDeposits. All clauses are AND-ed.
UserDepositQuery-

Type Aliases

Type AliasDescription
AcceptQuoteInputInput to RfqClient.acceptQuote. Either sign a fresh offer for the acceptor's side over the quote's details, or accept against an existing on-chain offer by chainOfferId — the two are mutually exclusive.
AcceptQuotePayload-
ActionNameAn ACTIONS variant by name ("CreateOffer", …, "Withdraw").
AddressAn address in one settlement layer's own string encoding — a base58 pubkey on Solana, a checksummed 0x… address on an EVM chain.
AssetCurated metadata describing a tradeable asset (see assetSchema).
AssetKeyAn asset's identity as one string: "<domain>:<address>", the key an AssetRegistry files a domain-scoped asset under.
AuthorizedKeyAn Ed25519 signing key an account has delegated to, projected by the indexer from that (owner, key) pair's AuthorizedKeySet / AuthorizedKeyRemoved events. A revoked key is retained with active: false rather than dropped, so the record doubles as the pair's authorization history — hence both timestamps are optional and independent (removedAt is set on a key that was authorized and later revoked, and re-authorizing it flips active back without clearing it). Already JSON-safe (no assets, no native amounts), so it needs no curated counterpart.
AuthorizedKeyRemoved-
AuthorizedKeySet-
Bytes32A 32-byte value as a 0x-prefixed, lower-case hex string: the protocol's canonical, cross-chain representation of everything it identifies — assets, accounts, settlement layers, salts, digests, and the content-addresses of offers and options.
CancelRfqPayload-
ChainNameA unique name of a chain used to identify it across the OvercastApp's stack — the key a MultiOvercastApp files each chain's app under, and the value on every OvercastConfig.
CheckpointA position in the chain's log. Totally ordered by (ledgerState, txIdx).
CheckpointKindWhich indexer cursor a checkpoint belongs to: backfill plus one per tail, named after the Commitment it writes. - backfill — the historical sweep's descending paging cursor ("lowest point swept so far"), advanced page by page towards the start checkpoint. - live / finalized — a tail's ascending frontier ("newest head fully swept"), advanced after each sweep. live is reorg-able, finalized canonical.
CommitmentThe confidence level of a chain head or an indexed event. live comes from the low-latency live tail and is still reorg-able; finalized is settled and canonical. The finalization sweep upgrades a row from live to finalized; a live write never downgrades one.
ConfigFieldOne string-configurable field of a layer config, as configField returns it: a parser producing V, and ConfigMeta registered alongside.
ConfigMetaHow one field of a layer config is named and documented in the places a string is all a host has: a --flag, an environment variable, a .env file, a secret manager.
ConfigSchemaA config schema: one z.object whose every field is a ConfigField.
ConfigShapeThe string-configurable slice of a layer config C, as the shape a ConfigSchema is built from.
CreateRfqPayloadCreateRfqPayloadWire with rich bigint option details. domain is excluded: the RfqClient stamps the domain it is registered under.
CreateRfqPayloadWire-
CuratedMarketOptionMarketOption over CuratedOptionDetails, enriched with the indexer-aggregated OptionTotals and OptionCreation as decimal strings (wire form). The raw MarketOption carries neither totals nor creation facts — they are derived from the option's on-chain events and only surfaced here, on the display-facing shape.
CuratedOptionDetailsSee curatedOptionDetailsSchema.
Deposited-
DepositParamsParameters for a deposit into a user's protocol escrow vault.
Equivalenttrue when A and B are mutually assignable (structurally equivalent). Preferred over invariant equality for comparing a z.infer object against a composed type like Omit<…> & Record<…>: those are the same shape but not token-identical, so a strict equality check reports a false mismatch. The tuple wrappers stop the conditionals distributing over unions.
EventPageOne bounded page of a OvercastIndexerClient.getEvents scan.
ExpectCompile-time assertion that its argument is exactly true (pair it with Equivalent). Instantiate it in a throwaway type _ = Expect<Equivalent<X, Y>> to fail the build when X and Y drift apart — used to pin hand-written wire DTOs to their canonical types. Works via the constraint: a false argument violates T extends true and is a compile error, even when _ is unused.
FactoryByNameThe factory in T filed under N. This is what the literal name buys: a runtime key turned back into one specific factory type, so a lookup yields EvmFactory — not ProtocolFactory<EvmLayer>, and not a union — with everything chain-specific on it still reachable.
FactoryLayerThe OvercastLayer a factory type builds for — FactoryLayer<EvmFactory> is EvmLayer. Recovered by inference rather than declared, so a chain package needs no extra type-level bookkeeping to join a multi-app.
FactoryNamesThe union of ChainNames a factory tuple covers, as literals — "evm" or "solana" for the pair in MultiOvercastApp's example.
FeePaid-
HexRaw bytes of any length as a 0x-prefixed, lower-case hex string. The widest of the hex types: Bytes32 narrows it, and the only value in the protocol that needs the wider form is a 64-byte signature.
Indexed-
IndexedEvents-
InputConfig-
KnownSettlementLayer-
LogFieldsStructured fields attached to a log line.
LogLevelsatisfies above is the guard that lets levels pass through untranslated: if LogTape ever renames a level, this stops compiling instead of failing at configure time.
MarketOption-
MarketOptionCreated-
MetadataOpaque, layer-defined bytes forwarded to a settlement layer uninterpreted.
MultiAppAny one of a multi-app's apps, as the union of their exact types (OvercastApp<EvmLayer> or OvercastApp<SolanaLayer>) rather than one app over the union layer — so it needs no cast to produce and stays honest about which app is which.
MultiAppsEvery app a multi-app holds, keyed by its factory's ChainName.
MultiFactoriesEvery factory in T, keyed by its ChainName.
NewRfqPayload-
Offer-
OfferCancelled-
OfferCreated-
OfferStatusAn offer's lifecycle (see offerStatus): - open — still matchable: not consumed, not withdrawn, not past expiry. - expired — nothing closed it, but its own deadline has passed, so the program will no longer match it. Evaluated against the reader's clock. - matched — consumed by an option (named by matchedOptionId). - cancelled — withdrawn by its creator, escrow refunded.
OfferStatusFilterSelects offers by lifecycle: one concrete OfferStatus, or closed as shorthand for "anything but open" (expired, matched or cancelled) — so an order-book view and its history are one scalar apart.
OperationConsumed-
OperationReplayProtectionKeyCleared-
OptionBorrowed-
OptionCreationCreation-time facts about a MarketOption that the on-chain option account doesn't hold: the indexer reads them off the option's MarketOptionCreated event. Like OptionTotals they live separately from the canonical, content-addressed option (they play no part in its id) and are only surfaced on the curated, display-facing option.
OptionDetails-
OptionDetailsWire-
OptionExercised-
OptionRedeemed-
OptionRepaid-
OptionSide-
OptionStateWhere a MarketOption sits in its lifecycle — derived from its window and its OptionTotals by optionState, and surfaced on the curated option. The four states are exhaustive and mutually exclusive; each one names what the protocol will let a party do next: - pending — the exercise window hasn't opened yet (now < startTimestamp); neither party can act. - exercisable — inside the window with exercise claims left, so the taker can still exercise. - redeemable — exercise is closed (expired, or every exercise claim burnt) and collateral-return claims remain, so the maker can redeem. - finished — every collateral-return claim is burnt: both escrows are drained and nothing further can happen.
OptionTotalsRunning burn totals for a MarketOption, aggregated by the indexer from the option's OptionExercised / OptionRedeemed events. These are not part of the canonical, content-addressed option (they don't exist on the on-chain account — the chain derives them from the claim mint supplies), so they live separately and are only surfaced on the curated, display-facing option.
OvercastConfigConnection, identity and backend configuration for one chain.
OvercastConfigOverridesThe chain-agnostic slice of an OvercastConfig — what a caller states once and merges over a factory's own config (AppOptions.config, MultiAppOptions.config).
OvercastStorageConvenience alias for an implementation that backs both ports — the typical single concrete store (memory, Postgres, …). Consumers should still depend on the narrowest port they need (OvercastStore or OvercastView).
Permissions-
ProtocolConfig-
ProtocolConfigUpdated-
ProtocolFactoriesA tuple of factories, one per chain — what a MultiOvercastApp is built from and stays parameterised by.
ProtocolInitialized-
ProtocolPaused-
ProtocolStateThe protocol's single global on-chain record: the mutable ProtocolConfig governance can change, plus the domain fixed at genesis. Read with OvercastReader.getProtocolState.
QuoteAcceptedPayload-
QuoteNewPayload-
QuoteStatusLifecycle of a quote submitted against an RFQ.
RegisterPayload-
RfqErrorCode-
RfqErrorInfo-
RfqStatusLifecycle of an RFQ. Carried now so the model is ready for reconciliation.
SettlementConfigThe config shape layer K decodes to — the value OvercastLayer.settlements maps that key to, and what resolve(K).read(id) returns.
SettlementConfigMapA chain's settlement layers as a map from each layer's type key to the shape read() decodes that layer's on-chain config account into. Every chain must cover the KnownSettlementLayer subset (so physical / oracle are always present and always keys of keyof settlements), and may add its own extra keys. The mapped values are the per-layer config types, which is what lets SettlementLayerRegistry.resolve return a precisely-typed layer.
SettlementKeyThe union of settlement-layer type keys a chain implements — the keys of its OvercastLayer.settlements map (always including the KnownSettlementLayer subset). Keys the SettlementLayerRegistry and every SettlementSelection.
SettlementLayersThe structural view of SettlementLayerRegistry — same members, minus the private fields.
SettlementSelectionHow a caller picks a settlement layer for an offer: a bare type key (→ the layer's default config) or a { type, config } pair naming a custom config. Keyed by SettlementKey, so selecting a layer the chain doesn't implement fails to compile.
SignedOperationWire-
StoredRfqRequest-
SubmitQuotePayloadSubmitQuotePayloadWire with rich bigint option details.
SubmitQuotePayloadWire-
TxDetailsChain-specific parsed detail of an already-submitted transaction, as returned by an indexer lookup (OvercastIndexerClient.getTransactionInfo). Opaque at the core level; each chain narrows it (e.g. Solana's ParsedTransactionWithMeta).
TxHashA submitted transaction's unique on-chain identifier (signature / hash).
TxInfoThe outcome of submitting a transaction to a settlement layer. Returned by ["submit"] and, by extension, by every SigningWriter method — as one TxStep per transaction the operation took, since an operation is not always a single transaction.
UnsignedTransactionAn optional description of the transaction
UserDepositA user's live escrow vault balance for one asset, aggregated by the indexer from that account/asset pair's Deposited / Withdrawn events.
UserDepositWireA UserDeposit in wire form: the canonical slots kept as they are, with the native amount as a decimal string so the shape survives JSON.stringify.
UUIDA backend-minted handle for an off-chain record — an RFQ or a quote. This is usually just a uuid TODO: make this type safe uuid
Withdrawn-
WithdrawParamsParameters for a withdrawal from a user's protocol escrow vault.
WithIdA stored value paired with its content-address: the sha256 of the value's canonical byte layout (see getId). Cross-chain by construction — the same offer has the same id everywhere — and an address on no chain at all; each layer merely uses the bytes its own way, as a PDA seed on Solana or a mapping key on an EVM chain.

Variables

VariableDescription
acceptQuotePayloadSchemaAccept a quote — either by signing a fresh offer operation (operation + salt + expiry) or by referencing an already on-chain offer id. Carries no bigint, so the one schema is both the wire and the client-facing shape.
AMOUNT_ENCODED_LENByte width of a token amount in the serialization: a 256-bit (u256) word.
assetSchemaCurated metadata describing a tradeable asset, keyed by the pair (domain, address) — the protocol domain the asset lives on plus its on-chain address in that layer's own encoding (Address). This is display data, so the address is spelled the way a human reads it, not as the canonical Bytes32 slot core hashes. Resolving one from the other is OvercastUtils.formatAddress's job, which is why every curation entry point takes the layer's utils.
BYTES32_LENByte width of a Bytes32: an asset, an account, a salt, a digest.
bytes32SchemaA canonical 32-byte slot. Validated here — a wire payload is untrusted.
cancelRfqPayloadSchema-
COMMON_CONFIG_SCHEMAThe OvercastConfig fields that mean the same thing on every chain, so every layer schema can spread its shape in rather than restating them.
CONFIG_FIELDThe brand configField stamps a parser with, so that a schema field declared any other way does not typecheck.
configMetaEvery ConfigMeta in the process, keyed by the schema it belongs to.
createRfqPayloadWireSchemaCreateRfqPayload with its option details in wire form.
curatedOptionDetailsSchemaOptionDetails with its asset fields resolved to Asset and its native amounts as decimal strings (wire form). Defined as a zod schema so it can validate broadcast DTOs; the type is inferred from it.
DEFAULT_BACKEND-
DEFAULT_EXPIRY_DURATION-
DEFAULT_TRANSPORT-
domainSchemaThe deployment a socket payload belongs to. Its own field rather than read off an option's terms: an RFQ's details are partial (a chainRef RFQ has none), so the terms cannot be relied on to name it.
hexSchemaRaw bytes of any length, e.g. a 64-byte signature.
hexUtilsThe address boundary of the protocol's own encoding: here an address simply is its canonical Bytes32 slot, spelled in hex.
jsonSinkOne JSON object per line, keyed the way hosted log aggregators expect: severity as a string (GCP Cloud Logging and Datadog both read it; pino's numeric level: 30 is what made these logs unreadable in the cloud) and message as the rendered text.
LOG_LEVELSLevel names, ordered least → most severe. These are LogTape's own names, so they pass straight through to it with no translation step. Note warning, not warn — the method is still Logger.warn.
loggerDefault root logger for ad-hoc use.
METER_NAMEInstrumentation scope name grouping every instrument this package emits.
newRfqPayloadSchema-
OPERATION_PREFIXDomain-separation prefix distinguishing operation messages from the content-addressed struct ids (offer_id, option_id) derived in utils.ts. Must match OPERATION_PREFIX in the on-chain operation.rs.
OPERATION_VERSION-
optionDetailsWireSchemaOptionDetails with its native bigint amounts as decimal strings — the JSON-safe wire form.
optionSideSchema-
quoteAcceptedPayloadSchema-
quoteNewPayloadSchema-
registerPayloadSchema-
rfqErrorCodeSchemaStable error codes surfaced on *:error events.
rfqErrorSchemaThe { code, message } error carried on acks and the error event.
rfqOptionsSchemaRFQ options bag. responder is an optional allowlist of ids permitted to respond; unknown keys pass through so future options don't need a schema bump.
SIGNATURE_LENByte width of an ed25519 signature — the one value wider than a slot.
signedOperationSchemaA SignedOperation: the ed25519 signature over an operation's digest, the key that produced it, and the operation params (expiry + replay salt) it commits to. Sent wherever a payload authorizes a delegated, off-chain-signed action. Carries no bigint, so this one schema is both the wire and the client-facing shape.
SLOT_ENCODED_LENByte width of every identified value in this layout: assets, accounts, ids.
submitQuotePayloadWireSchemaSubmitQuotePayload with its option details in wire form.
ZERO_BYTES32The all-zero slot: the protocol's None for an optional address.

Functions

FunctionDescription
amountFromWireParse a decimal-string wire amount back to a native bigint.
amountLEA token amount as a 256-bit little-endian word.
amountToWireSerialize a native amount to its decimal-string wire form.
assetKeyThe AssetKey for a domain-scoped asset.
buildOfferBuild the correctly-shaped Offer for a side. Both carry the same terms and salt, and an expiry defaulted via defaultExpiry.
buildPermissionsBitmap-
bytes32ToBytesDecode a Bytes32 to its raw 32 bytes, throwing on any other width.
bytesToHexEncode raw bytes as a lower-case Hex string.
completeOptionDetailsComplete an RFQ's (partial, curated) option terms with a market maker's quoted premium to produce the canonical, signable OptionDetails a quote is submitted over. Asset fields are resolved back to their addresses and the decimal-string amounts to native bigints.
concatConcatenate byte chunks into a single Uint8Array.
configChoicesThe values field accepts, when it accepts a closed set of them — so a host that generates flags can offer `--transport polling
configFieldDeclare one field of a config schema: how its string is parsed, and how the hosts reading it name and describe it.
configFieldMetaOne named field's metadata, for a host that has to read a single field on its own rather than the whole schema — the CLI asking whether a wallet identity was supplied before it decides which client to build.
configFieldsA schema's fields in declaration order, each with its registered metadata.
configureLoggingRoutes this package's log records to a destination. Until this is called (or LogTape is configured directly by the host) records are discarded.
createLoggerCreates a namespaced logger. Pass a colon-separated name to scope a subsystem, e.g. createLogger("indexer:backfill").
createProtocolSignerResolve the OvercastProtocolSigner for a config: the explicit OvercastConfig.protocolSigner override if supplied, otherwise one wrapping a DirectEd25519Signer built from the config's privateKey. Returns undefined for a read-only config (no override and no key) — nothing to sign protocol payloads with.
curateMarketOptionCurate a MarketOption, folding in the indexer-aggregated OptionTotals (sourced from the option's exercise / redeem events) and its OptionCreation facts (from the MarketOptionCreated event) since the raw option carries neither, plus the lifecycle OptionState the totals imply. now (unix seconds) is accepted so a caller curating a whole page evaluates every option against one clock reading.
curateOfferCurate an Offer, folding in the lifecycle its OfferClosure and expiry imply. closure defaults to "nothing closed it" for callers curating an offer they just built (an RFQ payload, a signing preview) and have no event history for; now (unix seconds) is accepted so a caller curating a whole page evaluates every offer against one clock reading.
curateOptionDetailsResolve every asset field of OptionDetails against the registry, on the domain the details themselves name. An asset with no curated metadata defaults to a bare Asset carrying just the address (see AssetRegistry.getOrDefault) rather than throwing — the terms are canonical either way, and curation only annotates them.
defaultExpiryReturns a default expiry timestamp in seconds, calculates the current time in seconds and adds the default expiry duration to it
defaultOperationParams-
envSourceValues from environment variables under one prefix, e.g. OVERCAST_ for a CLI's single global namespace or BASE_ for one chain of a multi-chain backend. Pass "" for unprefixed names.
flagKeyThe key a flag parser hands this field's value back under — --core-address becomes coreAddress, and a field with no flag falls back to its env suffix.
flagsThenEnvValues from parsed CLI flags first, then the environment under prefix — the precedence a command line has: what was typed beats what was exported.
formatAssetAmountFormat a native amount as a display string, e.g. 1.5 SOL.
formatUnitsConvert a native integer bigint to a whole-token (display) decimal string, exactly — e.g. formatUnits(1_500_000_000n, 9)"1.5". Trailing fractional zeros are trimmed.
getIdContent-addressed id for one of the local Overcast types, matching the on-chain HashId derivation. Discriminates the input by shape: an option references both of the offers it consumed, an offer does not.
getLogLevelReturns the currently active log level, or null if logging is silenced.
getMeterResolves a Meter from the registered MeterProvider.
hexToBytesDecode a hex string to its raw bytes. Re-validates rather than trusting the brand — a Hex can always have been minted by a cast — because these bytes feed signed preimages, where a silent truncation produces a digest no chain will match.
i64LEi64, little-endian (8 bytes).
isBytes32Whether value is well-formed hex of exactly 32 bytes (a Bytes32).
isHexWhether value is well-formed hex: 0x followed by an even number of hex digits, and — when byteLength is given — exactly that many bytes.
marketOptionBytesMarketOption byte layout (374 bytes): tag(0x01) · details(245) · taker(32) · maker(32) · settlement_offer(32) · collateral_offer(32).
offerBytesOffer byte layout (351 bytes): tag(0x00) · side(1) · salt(32) · creator(32) · option_details(245) · expiry(i64) · counterparty(32).
offerStatusDerive an offer's OfferStatus from the events that closed it and its own deadline. now is unix seconds — the same unit as Offer.expiry — and defaults to the local clock.
omitUndefinedDrop the keys whose value is undefined.
optionStateDerive an option's OptionState from its window and its running OptionTotals. now is unix seconds — the same unit as OptionDetails.startTimestamp / endTimestamp — and defaults to the local clock.
parseBytes32Validate an untrusted string as a Bytes32 — 32 bytes exactly — or throw. Use this at every boundary that hands core an asset, account, salt or content-address: a truncated value would otherwise hash to an id no chain agrees with, and fail somewhere far from its origin.
parseHexValidate an untrusted string as Hex and normalize it to lower case, or throw a HexError. The entry point for anything crossing a boundary the type system doesn't cover: a wire payload, a CLI argument, an environment variable.
parsePermissions-
parseUnitsConvert a whole-token (display) decimal string to an exact native integer bigint. e.g. parseUnits("1.5", 9)1_500_000_000n. Throws if the value is malformed or specifies more fractional digits than decimals supports (which would silently truncate).
permissionNames-
randomSaltA fresh 32-byte salt for an offer or an operation: raw entropy, in a slot.
rawBytesToBytes32Encode exactly 32 raw bytes as a Bytes32, throwing on any other length. The width is checked rather than assumed: this is the seam a layer's OvercastUtils.toBytes32 returns through, and a short slot would shift every following field of a serialized struct.
readConfigRead schema's fields out of source into the overrides a layer factory is built with.
serializeAmountsConvert the native bigint amounts of an OptionDetails (possibly partial — RFQ requests omit some terms) to their decimal-string wire form, leaving every other field untouched.
setLogLevelSets the active log level, re-applying the current destination. Takes effect immediately for every logger, including ones already created. Pass null to silence logging.
Sleep-
slotA Bytes32 as its raw 32 bytes — the only address/id primitive this layout needs, because assets, accounts, salts and content-addresses are all the same 32-byte slot on every chain.
toDisplayAmountConvert a native integer amount to a whole-token (display) decimal string, exactly — e.g. 1_500_000_000n SOL (9 decimals) → "1.5".
toNativeAmountConvert a whole-token (display) amount — given as a decimal string to avoid float loss — to an exact native integer amount, using the asset's decimals. e.g. "1.5" SOL (9 decimals) → 1_500_000_000n.
u32LEu32, little-endian (4 bytes).
u64LEu64, little-endian (8 bytes). Native bigint so values stay exact.
uncurateMarketOptionStrip a CuratedMarketOption back to the raw, canonical MarketOption. The curated-only enrichments (totals, creation facts, derived state) are dropped rather than carried along — they are not part of the option's identity, and getId must see exactly the canonical shape.
uncurateOfferStrip a CuratedOffer back to the raw, canonical Offer — the shape getId and the signers must see. The curated-only lifecycle (status, matchedOptionId) is dropped: it is derived, not part of the offer's identity.
uncurateOptionDetailsStrip a CuratedOptionDetails back to the raw OptionDetails (asset fields → their addresses). Used by clients that receive a curated broadcast but need the canonical, signable details.