@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
81 lines • 6.33 kB
JavaScript
// SPDX-License-Identifier: Apache-2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var LedgerCommandDefinition_1;
import { inject, injectable } from 'tsyringe-neo';
import { InjectTokens } from '../../core/dependency-injection/inject-tokens.js';
import { patchInject } from '../../core/dependency-injection/container-helper.js';
import { BaseCommandDefinition } from './base-command-definition.js';
import { CommandBuilder, CommandGroup, Subcommand } from '../../core/command-path-builders/command-builder.js';
import { AccountCommand } from '../account.js';
import { FileCommand } from '../file.js';
let LedgerCommandDefinition = class LedgerCommandDefinition extends BaseCommandDefinition {
static { LedgerCommandDefinition_1 = this; }
logger;
accountCommand;
fileCommand;
constructor(logger, accountCommand, fileCommand) {
super();
this.logger = logger;
this.accountCommand = accountCommand;
this.fileCommand = fileCommand;
this.accountCommand = patchInject(accountCommand, InjectTokens.AccountCommand, this.constructor.name);
this.fileCommand = patchInject(fileCommand, InjectTokens.FileCommand, this.constructor.name);
this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name);
}
static COMMAND_NAME = 'ledger';
static DESCRIPTION = 'System, Account, and Crypto ledger-based management operations. ' +
'These commands require an operational set of consensus nodes and may require an operational mirror node.';
static SYSTEM_SUBCOMMAND_NAME = 'system';
static SYSTEM_SUBCOMMAND_DESCRIPTION = 'Perform a full ledger initialization on a new deployment, ' +
'rekey privileged/system accounts, or setup network staking parameters.';
static ACCOUNT_SUBCOMMAND_NAME = 'account';
static ACCOUNT_SUBCOMMAND_DESCRIPTION = 'View, list, create, update, delete, and import ledger accounts.';
static CRYPTO_SUBCOMMAND_NAME = 'crypto';
static CRYPTO_SUBCOMMAND_DESCRIPTION = 'Transfer native crypto tokens or query native token account balances.';
static FILE_SUBCOMMAND_NAME = 'file';
static FILE_SUBCOMMAND_DESCRIPTION = 'Upload or update files on the Hiero network.';
static SYSTEM_INIT = 'init';
static SYSTEM_RESET = 'reset';
static ACCOUNT_UPDATE = 'update';
static ACCOUNT_CREATE = 'create';
static ACCOUNT_INFO = 'info';
static ACCOUNT_PREDEFINED = 'predefined';
static FILE_CREATE = 'create';
static FILE_UPDATE = 'update';
getCommandDefinition() {
return new CommandBuilder(LedgerCommandDefinition_1.COMMAND_NAME, LedgerCommandDefinition_1.DESCRIPTION, this.logger)
.addCommandGroup(new CommandGroup(LedgerCommandDefinition_1.SYSTEM_SUBCOMMAND_NAME, LedgerCommandDefinition_1.SYSTEM_SUBCOMMAND_DESCRIPTION)
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.SYSTEM_INIT, 'Re-keys ledger system accounts and consensus node admin keys with uniquely generated ED25519 private keys and will stake consensus nodes.', this.accountCommand, this.accountCommand.init, AccountCommand.INIT_FLAGS_LIST, []))
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.SYSTEM_RESET, 'Resets the ledger system to genesis by clearing saved states and ledger-related secrets.', this.accountCommand, this.accountCommand.resetSystem, AccountCommand.RESET_FLAGS_LIST, [])))
.addCommandGroup(new CommandGroup(LedgerCommandDefinition_1.ACCOUNT_SUBCOMMAND_NAME, LedgerCommandDefinition_1.ACCOUNT_SUBCOMMAND_DESCRIPTION)
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.ACCOUNT_UPDATE, 'Updates an existing ledger account.', this.accountCommand, this.accountCommand.update, AccountCommand.UPDATE_FLAGS_LIST, []))
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.ACCOUNT_CREATE, 'Creates a new ledger account.', this.accountCommand, this.accountCommand.create, AccountCommand.CREATE_FLAGS_LIST, []))
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.ACCOUNT_INFO, 'Gets the account info including the current amount of HBAR', this.accountCommand, this.accountCommand.get, AccountCommand.GET_FLAGS_LIST, []))
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.ACCOUNT_PREDEFINED, 'Creates predefined accounts used by one-shot deployments.', this.accountCommand, this.accountCommand.createPredefined, AccountCommand.PREDEFINED_FLAGS_LIST, [])))
.addCommandGroup(new CommandGroup(LedgerCommandDefinition_1.FILE_SUBCOMMAND_NAME, LedgerCommandDefinition_1.FILE_SUBCOMMAND_DESCRIPTION)
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.FILE_CREATE, 'Create a new file on the Hiero network', this.fileCommand, this.fileCommand.create, FileCommand.CREATE_FLAGS_LIST, []))
.addSubcommand(new Subcommand(LedgerCommandDefinition_1.FILE_UPDATE, 'Update an existing file on the Hiero network', this.fileCommand, this.fileCommand.update, FileCommand.UPDATE_FLAGS_LIST, [])))
.build();
}
};
LedgerCommandDefinition = LedgerCommandDefinition_1 = __decorate([
injectable(),
__param(0, inject(InjectTokens.SoloLogger)),
__param(1, inject(InjectTokens.AccountCommand)),
__param(2, inject(InjectTokens.FileCommand)),
__metadata("design:paramtypes", [Object, AccountCommand,
FileCommand])
], LedgerCommandDefinition);
export { LedgerCommandDefinition };
//# sourceMappingURL=ledger-command-definition.js.map