UNPKG

@hirosystems/chainhook-client

Version:
22 lines (21 loc) 1.25 kB
/// <reference types="node" /> import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox'; import { FastifyInstance } from 'fastify'; import { Server } from 'http'; import { ChainhookNodeOptions, EventObserverOptions, EventObserverPredicate, OnPredicatePayloadCallback } from '.'; /** * Throw this error when processing a Chainhook Payload if you believe it is a bad request. This * will cause the server to return a `400` status code. */ export declare class BadPayloadRequestError extends Error { constructor(message: string); } /** * Build the Chainhook Fastify event server. * @param observer - Event observer options * @param chainhook - Chainhook node options * @param predicates - Predicates to register * @param callback - Event callback function * @returns Fastify instance */ export declare function buildServer(observer: EventObserverOptions, chainhook: ChainhookNodeOptions, predicates: EventObserverPredicate[], callback: OnPredicatePayloadCallback): Promise<FastifyInstance<Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, TypeBoxTypeProvider>>;