glassnode-api - v0.29.3
    Preparing search index...

    Interface GlassnodeHooks

    Structured observability hooks (the hooks config option). Every hook is optional and is called synchronously with one event object; its return value is ignored and never awaited, so an async hook does not delay the request. A hook that throws, or returns a promise that rejects, never changes the call's outcome or retries: the error is swallowed (and passed to the logger, if one is configured, as 'Hook <name> failed:', error). Keep hooks fast — offload slow work (e.g. exporting telemetry) instead of doing it inline. Events are read-only: see GlassnodeHookEventBase.

    Hooks fire only once a call has passed argument validation: a GlassnodeInputError or a GlassnodeConfigError fires none.

    Order per call: onRequest → (onResponse) → [onRetry → onRequest → (onResponse)]… → onError if the call fails. A successful call ends with an onResponse whose ok is true and no onError; a 200 whose body fails parsing or schema validation is followed by onError.

    interface GlassnodeHooks {
        onError?: (event: GlassnodeErrorEvent) => void;
        onRequest?: (event: GlassnodeHookEventBase) => void;
        onResponse?: (event: GlassnodeResponseEvent) => void;
        onRetry?: (event: GlassnodeRetryEvent) => void;
    }
    Index
    onError?: (event: GlassnodeErrorEvent) => void

    Once, when the call fails (including a cancellation and a response validation error).

    onRequest?: (event: GlassnodeHookEventBase) => void

    Before each attempt is sent.

    onResponse?: (event: GlassnodeResponseEvent) => void

    When an attempt gets an HTTP response (any status).

    onRetry?: (event: GlassnodeRetryEvent) => void

    Before the wait that precedes a retry.