UNPKG

beeline-cli

Version:

A terminal wallet for the Hive blockchain - type, sign, rule the chain

90 lines 2.89 kB
export interface SimplePlugin { name: string; description: string; version: string; activate(context: PluginContext): void | Promise<void>; deactivate?(): void | Promise<void>; } export interface PluginContext { addCommand(name: string, description: string, handler: CommandHandler): void; addUICommand(name: string, description: string, handler: UICommandHandler): void; log(message: string): void; success(message: string): void; error(message: string): void; wallet: { getCurrentAccount(): Promise<string | null>; getAccountList(): Promise<string[]>; getBalance(account?: string): Promise<any>; broadcastCustomJson(account: string, id: string, json: any, requiredAuths?: string[], requiredPostingAuths?: string[]): Promise<any>; }; ui?: { createForm(options: UIFormOptions): Promise<any>; showDialog(options: UIDialogOptions): Promise<string | boolean>; showMenu(options: UIMenuOptions): Promise<string>; blessed: any; }; } export type CommandHandler = (args: string[], flags: any) => Promise<void> | void; export type UICommandHandler = (args: string[], flags: any, uiContext: any) => Promise<void> | void; export interface UIFormField { name: string; label: string; type: 'text' | 'number' | 'password' | 'select'; required?: boolean; default?: string; options?: string[]; validation?: (value: string) => string | null; } export interface UIFormOptions { title: string; fields: UIFormField[]; submitText?: string; cancelText?: string; } export interface UIDialogOptions { title: string; message: string; type: 'info' | 'warning' | 'error' | 'confirm'; buttons?: string[]; } export interface UIMenuOptions { title: string; items: { key: string; label: string; description?: string; }[]; allowBack?: boolean; } export declare class SimplePluginManager { private plugins; private pluginDir; private registeredCommands; constructor(); initialize(): Promise<void>; installPlugin(sourcePath: string): Promise<void>; private loadAllPlugins; private loadPlugin; private createPluginContext; getPlugins(): LoadedPlugin[]; getCommands(): Map<string, PluginCommand>; executeCommand(commandName: string, args: string[], flags: any): Promise<void>; uninstallPlugin(pluginName: string): Promise<void>; } interface LoadedPlugin { plugin: SimplePlugin; context: PluginContext; path: string; packageJson: any; } interface PluginCommand { name: string; description: string; handler: CommandHandler; pluginName: string; isUI?: boolean; uiHandler?: UICommandHandler; } export declare function getPluginManager(): SimplePluginManager; export {}; //# sourceMappingURL=simple-plugins.d.ts.map