irys-complete-toolkit
Version:
Complete Irys SDK toolkit supporting all chains, tokens, and features
110 lines (109 loc) • 2.59 kB
TypeScript
/**
* Irys CLI Wrapper
* Programmatic interface for Irys CLI operations
*/
import { SpawnOptions } from 'child_process';
import { CLIUploadOptions, CLIBalanceOptions } from '../types';
export interface CLIResult {
success: boolean;
stdout: string;
stderr: string;
exitCode: number | null;
}
export declare class IrysCLI {
private cliPath;
private defaultOptions;
constructor(cliPath?: string, options?: SpawnOptions);
/**
* Execute CLI command
*/
private executeCommand;
/**
* Check if CLI is available
*/
isAvailable(): Promise<boolean>;
/**
* Get CLI version
*/
getVersion(): Promise<string>;
/**
* Upload a file using CLI
*/
uploadFile(filePath: string, options: CLIUploadOptions): Promise<{
transactionId: string;
url: string;
receipt: any;
}>;
/**
* Upload a directory using CLI
*/
uploadDirectory(directoryPath: string, options: CLIUploadOptions): Promise<{
manifestId: string;
url: string;
receipt: any;
}>;
/**
* Get account balance using CLI
*/
getBalance(options: CLIBalanceOptions): Promise<string>;
/**
* Fund account using CLI
*/
fund(amount: string, options: CLIUploadOptions): Promise<{
transactionId: string;
amount: string;
token: string;
}>;
/**
* Get upload price using CLI
*/
getPrice(bytes: number, options: Pick<CLIBalanceOptions, 'network' | 'token' | 'providerUrl'>): Promise<string>;
/**
* Withdraw funds using CLI
*/
withdraw(amount: string, options: CLIUploadOptions): Promise<{
transactionId: string;
amount: string;
token: string;
}>;
/**
* Get CLI status/info
*/
getStatus(): Promise<any>;
/**
* Validate token support
*/
private validateToken;
/**
* Extract transaction ID from CLI output
*/
private extractTransactionId;
/**
* Extract balance from CLI output
*/
private extractBalance;
/**
* Extract price from CLI output
*/
private extractPrice;
/**
* Parse receipt from CLI output
*/
private parseReceipt;
/**
* Set CLI path
*/
setCLIPath(path: string): void;
/**
* Get current CLI path
*/
getCLIPath(): string;
/**
* Set default spawn options
*/
setDefaultOptions(options: SpawnOptions): void;
/**
* Get supported tokens for CLI
*/
static getSupportedTokens(): string[];
}