UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

65 lines (64 loc) 2.61 kB
import { BaseCommand } from './base.js'; import { type AccountManager } from '../core/account-manager.js'; import { type ArgvStruct } from '../types/aliases.js'; import { type CommandFlags } from '../types/flag-types.js'; export declare class FileCommand extends BaseCommand { private readonly accountManager; private static readonly MAX_CHUNK_SIZE; constructor(accountManager: AccountManager); static CREATE_FLAGS_LIST: CommandFlags; static UPDATE_FLAGS_LIST: CommandFlags; close(): Promise<void>; /** * Helper method to prepare initial content and determine if append is needed * @param fileContent - The complete file content * @param operation - The operation being performed ('create' or 'update') * @returns Object with initialContent and needsAppend flag */ private prepareInitialContent; /** * Helper method to initialize configuration and read file content * @param argv - Command arguments * @param requireFileId - Whether file ID is required (true for update, false for create) * @returns Configuration context with file content */ private initializeFileConfig; /** * Helper method to load node client and treasury keys * @param namespace - The namespace * @param deployment - The deployment name * @param useGenesisKeyForSystemFile - Whether to use genesis key for system file operations * @returns The private key to use for transactions */ private loadClientAndKeys; /** * Helper method to verify uploaded file content * @param client - The Hiero client * @param fileId - The file ID to verify * @param expectedContent - The expected file content */ private verifyFileUpload; /** * Helper method to append remaining file chunks after initial create/update * @param task - The Listr task wrapper for updating progress * @param client - The Hiero client * @param fileId - The file ID to append to * @param fileContent - The complete file content * @param treasuryPrivateKey - The private key to sign transactions */ private appendFileChunks; /** * Unified method to create or update a file on the Hiero network * @param argv - Command arguments * @param isCreate - True for create operation, false for update */ private executeFileOperation; /** * Create a new file on the Hiero network */ create(argv: ArgvStruct): Promise<boolean>; /** * Update an existing file on the Hiero network */ update(argv: ArgvStruct): Promise<boolean>; }