import { Script, LockingScript } from "@bsv/sdk"; export interface BitComProtocol { protocol: string; script: number[]; pos: number; } export interface BitComDecoded { protocols: BitComProtocol[]; scriptPrefix: number[]; } /** * BitCom template for handling multi-protocol Bitcoin transactions * * BitCom allows multiple protocols to be embedded in a single transaction output * using the pipe ('|') delimiter to separate different protocol sections. */ export default class BitCom { protocols: BitComProtocol[]; scriptPrefix: number[]; constructor(protocols?: BitComProtocol[], scriptPrefix?: number[]); /** * Decodes a script to extract BitCom protocol data * * @param script - The script to decode * @returns BitComDecoded - The decoded BitCom structure, or null if no OP_RETURN found */ static decode(script: Script | LockingScript): BitComDecoded | null; /** * Creates a locking script from the BitCom structure * * @returns LockingScript - The BitCom locking script */ lock(): LockingScript; /** * Finds the position of OP_RETURN in the script * * @param scriptBytes - The script bytes to search * @param from - Starting position * @returns number - Position of OP_RETURN, or -1 if not found */ static findReturn(scriptBytes: number[], from: number): number; /** * Converts various input types to a Script object * * @param data - The data to convert (Script, LockingScript, or byte array) * @returns Script - The converted script, or null if conversion fails */ static toScript(data: Script | LockingScript | number[]): Script | null; }