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
129 lines (128 loc) • 3.71 kB
TypeScript
import { EventEmitter } from "events";
import { BitcoinService } from "../core/bitcoin";
import { CaravanService } from "../core/caravan";
import { TransactionService } from "../core/transaction";
import { ConfigManager } from "../core/config";
import { BitcoinRpcClient } from "../core/rpc";
import { MultisigCommands } from "../commands/multisig";
import { ScriptExecutionResult, ScriptType, DeclarativeScript, ScriptExecutionOptions } from "../types/scripting";
/**
* Class for managing script execution
*/
export declare class ScriptEngine extends EventEmitter {
private readonly bitcoinService;
private readonly caravanService;
private readonly transactionService;
private readonly configManager;
private readonly rpcClient;
private readonly multisigCommands;
private templatesDir;
constructor(bitcoinService: BitcoinService, caravanService: CaravanService, transactionService: TransactionService, configManager: ConfigManager, rpcClient: BitcoinRpcClient, multisigCommands: MultisigCommands);
/**
* Get the template directory path
*/
getTemplatesDir(): string;
/**
* Load a script from file
*/
loadScript(filePath: string): Promise<string | DeclarativeScript>;
/**
* Validate a script
*/
validateScript(script: string | DeclarativeScript): {
valid: boolean;
errors: string[];
};
/**
* Validate that variable references are valid
*/
private validateVariableReferences;
/**
* Check for variable references in a string
*/
private checkVariableReferencesInString;
/**
* Check for variable references in an object
*/
private checkVariableReferencesInObject;
/**
* Generate a summary of what a script will do
*/
generateScriptSummary(script: string | DeclarativeScript): string;
/**
* Execute a script
*/
executeScript(script: string | DeclarativeScript, options?: ScriptExecutionOptions): Promise<ScriptExecutionResult>;
/**
* Execute a JavaScript script
*/
private executeJavaScriptScript;
/**
* Execute a declarative script
*/
private executeDeclarativeScript;
/**
* Execute a single action
*/
private executeAction;
/**
* Execute CUSTOM action
*/
private executeCustom;
/**
* Process variable references in parameters
*/
private processVariableReferences;
/**
* Execute CREATE_WALLET action
*/
private executeCreateWallet;
/**
* Execute MINE_BLOCKS action
*/
private executeMineBlocks;
/**
* Execute CREATE_TRANSACTION action
*/
private executeCreateTransaction;
/**
* Execute REPLACE_TRANSACTION action (RBF)
*/
private executeReplaceTransaction;
/**
* Execute SIGN_TRANSACTION action
*/
private executeSignTransaction;
/**
* Execute BROADCAST_TRANSACTION action
*/
private executeBroadcastTransaction;
/**
* Execute CREATE_MULTISIG action
*/
private executeCreateMultisig;
/**
* Execute WAIT action
*/
private executeWait;
/**
* Execute ASSERT action
*/
private executeAssert;
/**
* Get all available script templates
*/
getScriptTemplates(): Promise<{
name: string;
path: string;
description: string;
}[]>;
/**
* Create a new script template
*/
createScriptTemplate(name: string, content: string, type: ScriptType): Promise<string>;
/**
* Save a script to a file
*/
saveScript(name: string, content: string | DeclarativeScript, type: ScriptType): Promise<string>;
}