UNPKG

@bsv/overlay

Version:
85 lines 2.68 kB
import { LookupFormula } from './LookupFormula.js'; import { Script, LookupQuestion } from '@bsv/sdk'; export type AdmissionMode = 'locking-script' | 'whole-tx'; export type SpendNotificationMode = 'none' | 'txid' | 'script' | 'whole-tx'; export type OutputAdmittedByTopic = { mode: 'locking-script'; txid: string; outputIndex: number; topic: string; satoshis: number; lockingScript: Script; offChainValues?: number[]; } | { mode: 'whole-tx'; atomicBEEF: number[]; outputIndex: number; topic: string; offChainValues?: number[]; }; export type OutputSpent = { mode: 'none'; txid: string; outputIndex: number; topic: string; } | { mode: 'txid'; txid: string; outputIndex: number; topic: string; spendingTxid: string; } | { mode: 'script'; txid: string; outputIndex: number; topic: string; spendingTxid: string; inputIndex: number; unlockingScript: Script; sequenceNumber: number; offChainValues?: number[]; } | { mode: 'whole-tx'; txid: string; outputIndex: number; topic: string; spendingAtomicBEEF: number[]; offChainValues?: number[]; }; export interface LookupServiceMetaData { name: string; shortDescription: string; iconURL?: string; version?: string; informationURL?: string; } export interface LookupService { readonly admissionMode: AdmissionMode; readonly spendNotificationMode: SpendNotificationMode; /** * Invoked when a Topic Manager admits a new UTXO. * The payload shape depends on this.admissionMode. */ outputAdmittedByTopic: (payload: OutputAdmittedByTopic) => Promise<void> | void; /** * Invoked when a previously-admitted UTXO is spent. * The payload shape depends on this.spendNotificationMode. */ outputSpent?: (payload: OutputSpent) => Promise<void> | void; /** * Called when a Topic Manager decides that **historical retention** of the * specified UTXO is no longer required. */ outputNoLongerRetainedInHistory?: (txid: string, outputIndex: number, topic: string) => Promise<void> | void; /** * LEGAL EVICTION: * Permanently remove the referenced UTXO from all indices maintained by the * Lookup Service. After eviction the service MUST NOT reference the output * in any future lookup answer. */ outputEvicted: (txid: string, outputIndex: number) => Promise<void> | void; lookup: (question: LookupQuestion) => Promise<LookupFormula>; getDocumentation: () => Promise<string>; getMetaData: () => Promise<LookupServiceMetaData>; } //# sourceMappingURL=LookupService.d.ts.map