UNPKG

caravan-x

Version:

A terminal-based utility for managing Caravan multisig wallets in regtest mode. This tool simplifies development and testing with Caravan by providing an easy-to-use interface

104 lines (103 loc) 2.67 kB
import { BitcoinService } from "../core/bitcoin"; import { CaravanService } from "../core/caravan"; import { TransactionService } from "../core/transaction"; import { BitcoinRpcClient } from "../core/rpc"; import { ConfigManager } from "../core/config"; import { MultisigCommands } from "../commands/multisig"; /** * Status of a script execution */ export declare enum ScriptExecutionStatus { NOT_STARTED = "not_started", RUNNING = "running", COMPLETED = "completed", FAILED = "failed", ABORTED = "aborted" } /** * Type of script (format) */ export declare enum ScriptType { JAVASCRIPT = "javascript",// JavaScript script using our APIs JSON = "json" } /** * Action type for declarative scripts */ export declare enum ActionType { CREATE_WALLET = "create_wallet", MINE_BLOCKS = "mine_blocks", CREATE_TRANSACTION = "create_transaction", REPLACE_TRANSACTION = "replace_transaction", SIGN_TRANSACTION = "sign_transaction", BROADCAST_TRANSACTION = "broadcast_transaction", CREATE_MULTISIG = "create_multisig", WAIT = "wait", ASSERT = "assert", CUSTOM = "custom" } /** * Script action with parameters */ export interface ScriptAction { type: ActionType; params: Record<string, any>; description?: string; } /** * Declarative script format */ export interface DeclarativeScript { name: string; description: string; version: string; actions: ScriptAction[]; variables?: Record<string, any>; } /** * Script execution options */ export interface ScriptExecutionOptions { dryRun?: boolean; verbose?: boolean; interactive?: boolean; params?: Record<string, any>; } /** * Script execution context */ export interface ScriptExecutionContext { bitcoinService: BitcoinService; caravanService: CaravanService; transactionService: TransactionService; configManager: ConfigManager; rpcClient: BitcoinRpcClient; multisigCommands: MultisigCommands; variables: Record<string, any>; wallets: Record<string, any>; transactions: Record<string, any>; blocks: string[]; log: (message: string) => void; progress: (step: number, total: number, message: string) => void; } /** * Script execution result */ export interface ScriptExecutionResult { status: ScriptExecutionStatus; startTime: Date; endTime?: Date; duration?: number; steps: { action: string; status: "success" | "failed" | "skipped"; result?: any; error?: Error; }[]; outputs: { wallets?: string[]; transactions?: string[]; blocks?: string[]; }; error?: Error; }