Documentation ¶
Overview ¶
Package cmds provides command line tools.
Index ¶
- Constants
- Variables
- func AttachProposalProcessor(policy *isaac.LocalPolicy, nodepool *network.Nodepool, suffrage base.Suffrage, ...) (*blocksign.OperationProcessor, error)
- func GenesisOperationsHandlerGenesisCurrencies(ctx context.Context, m map[string]interface{}) (operation.Operation, error)
- func HookDigesterFollowUp(ctx context.Context) (context.Context, error)
- func HookInitializeProposalProcessor(ctx context.Context) (context.Context, error)
- func HookLoadCurrencies(ctx context.Context) (context.Context, error)
- func InitializeProposalProcessor(ctx context.Context, opr *blocksign.OperationProcessor) (context.Context, error)
- func LoadCurrencyPoolContextValue(ctx context.Context, l **currency.CurrencyPool) error
- func LoadDatabaseContextValue(ctx context.Context, l **mongodbstorage.Database) error
- func LoadDigestDatabaseContextValue(ctx context.Context, l **digest.Database) error
- func LoadDigestDesignContextValue(ctx context.Context, l *currencycmds.DigestDesign) error
- func LoadDigestNetworkContextValue(ctx context.Context, l **digest.HTTP2Server) error
- func LoadDigesterContextValue(ctx context.Context, l **digest.Digester) error
- func ProcessDigestAPI(ctx context.Context) (context.Context, error)
- func ProcessDigestDatabase(ctx context.Context) (context.Context, error)
- func ProcessDigester(ctx context.Context) (context.Context, error)
- func ProcessStartDigestAPI(ctx context.Context) (context.Context, error)
- func ProcessStartDigester(ctx context.Context) (context.Context, error)
- type BaseCommand
- type BaseNodeCommand
- type CreateDocumentCommand
- type FileHashFlag
- type InitCommand
- type NodeCommand
- type OperationFlags
- type RunCommand
- type SealCommand
- type SendCommand
- type SignDocumentCommand
- type TransferDocumentCommand
Constants ¶
View Source
const ( ProcessNameDigestAPI = "digest_api" ProcessNameStartDigestAPI = "start_digest_api" HookNameSetLocalChannel = "set_local_channel" )
View Source
const ( ProcessNameDigester = "digester" ProcessNameStartDigester = "start_digester" HookNameDigesterFollowUp = "followup_digester" )
View Source
const ProcessNameDigestDatabase = "digest_database"
Variables ¶
View Source
var ( ContextValueDigestDesign util.ContextKey = "digest_design" ContextValueDigestDatabase util.ContextKey = "digest_database" ContextValueDigestNetwork util.ContextKey = "digest_network" ContextValueDigester util.ContextKey = "digester" ContextValueCurrencyPool util.ContextKey = "currency_pool" )
View Source
var ( Hinters []hint.Hinter Types []hint.Type )
View Source
var ( GenesisAccountKey = "genesis_account" GenesisBalanceKey = "genesis_balance" )
View Source
var ( ProcessorDigestAPI pm.Process ProcessorStartDigestAPI pm.Process )
View Source
var ( ProcessorDigester pm.Process ProcessorStartDigester pm.Process )
View Source
var BaseNodeCommandHooks = func(cmd *BaseNodeCommand) []pm.Hook { return []pm.Hook{ pm.NewHook(pm.HookPrefixPost, process.ProcessNameEncoders, process.HookNameAddHinters, process.HookAddHinters(Types, Hinters)). SetOverride(true), pm.NewHook(pm.HookPrefixPost, process.ProcessNameConfig, "load_digest_config", cmd.hookLoadDigestConfig). SetOverride(true). SetDir(process.HookNameConfigGenesisOperations, pm.HookDirAfter), pm.NewHook(pm.HookPrefixPost, process.ProcessNameConfig, "validate_digest_config", cmd.hookValidateDigestConfig). SetOverride(true). SetDir(process.HookNameValidateConfig, pm.HookDirAfter), pm.NewHook(pm.HookPrefixPost, process.ProcessNameConfig, process.HookNameConfigVerbose, hookVerboseConfig). SetOverride(true), } }
View Source
var InitCommandHooks = func(cmd *InitCommand) []pm.Hook { genesisOperationHandlers := map[string]process.HookHandlerGenesisOperations{ "genesis-currencies": GenesisOperationsHandlerGenesisCurrencies, } for k, v := range process.DefaultHookHandlersGenesisOperations { genesisOperationHandlers[k] = v } return []pm.Hook{ pm.NewHook(pm.HookPrefixPre, process.ProcessNameProposalProcessor, "initialize_proposal_processor", cmd.hookInitializeProposalProcessor).SetOverride(true), pm.NewHook(pm.HookPrefixPost, process.ProcessNameConfig, process.HookNameConfigGenesisOperations, process.HookGenesisOperationFunc(genesisOperationHandlers)). SetOverride(true), } }
View Source
var ProcessorDigestDatabase pm.Process
View Source
var RunCommandHooks = func(cmd *RunCommand) []pm.Hook { return []pm.Hook{ pm.NewHook(pm.HookPrefixPost, process.ProcessNameDatabase, "set_database", HookLoadCurrencies).SetOverride(true), pm.NewHook(pm.HookPrefixPost, process.ProcessNameNetwork, "set_currency_network_handlers", cmd.hookSetNetworkHandlers).SetOverride(true), pm.NewHook(pm.HookPrefixPre, process.ProcessNameProposalProcessor, "initialize_proposal_processor", HookInitializeProposalProcessor).SetOverride(true), pm.NewHook(pm.HookPrefixPost, ProcessNameDigestAPI, "set_digest_api_handlers", cmd.hookDigestAPIHandlers).SetOverride(true), pm.NewHook(pm.HookPrefixPost, ProcessNameDigester, "set_state_handler", cmd.hookSetStateHandler).SetOverride(true), pm.NewHook(pm.HookPrefixPost, ProcessNameDigester, HookNameDigesterFollowUp, HookDigesterFollowUp).SetOverride(true), pm.NewHook(pm.HookPrefixPre, ProcessNameDigestAPI, HookNameSetLocalChannel, currencycmds.HookSetLocalChannel).SetOverride(true), } }
View Source
var RunCommandProcesses []pm.Process
View Source
var SendVars = kong.Vars{
"node_url": "quic://localhost:54321",
}
Functions ¶
func AttachProposalProcessor ¶
func AttachProposalProcessor( policy *isaac.LocalPolicy, nodepool *network.Nodepool, suffrage base.Suffrage, cp *currency.CurrencyPool, ) (*blocksign.OperationProcessor, error)
func LoadCurrencyPoolContextValue ¶
func LoadCurrencyPoolContextValue(ctx context.Context, l **currency.CurrencyPool) error
func LoadDatabaseContextValue ¶
func LoadDatabaseContextValue(ctx context.Context, l **mongodbstorage.Database) error
func LoadDigestDesignContextValue ¶
func LoadDigestDesignContextValue(ctx context.Context, l *currencycmds.DigestDesign) error
func LoadDigestNetworkContextValue ¶
func LoadDigestNetworkContextValue(ctx context.Context, l **digest.HTTP2Server) error
func ProcessDigestDatabase ¶
func ProcessStartDigestAPI ¶
Types ¶
type BaseCommand ¶
type BaseCommand struct { *mitumcmds.BaseCommand Out io.Writer `kong:"-"` }
func NewBaseCommand ¶
func NewBaseCommand(name string) *BaseCommand
type BaseNodeCommand ¶
func NewBaseNodeCommand ¶
func NewBaseNodeCommand(l *logging.Logging) *BaseNodeCommand
func (*BaseNodeCommand) BaseProcesses ¶
type CreateDocumentCommand ¶
type CreateDocumentCommand struct { *BaseCommand currencycmds.OperationFlags Sender currencycmds.AddressFlag `arg:"" name:"sender" help:"sender address" required:""` FileHash string `arg:"" name:"filehash" help:"filehash" required:""` Currency currencycmds.CurrencyIDFlag `arg:"" name:"currency" help:"currency id" required:""` Signers []currencycmds.AddressFlag `name:"signers" help:"signers for document"` // Keys []KeyFlag `name:"key" help:"key for new document account (ex: \"<public key>,<weight>\")" sep:"@"` Seal currencycmds.FileLoad `help:"seal" optional:""` // contains filtered or unexported fields }
func NewCreateDocumentCommand ¶
func NewCreateDocumentCommand() CreateDocumentCommand
type FileHashFlag ¶
func (*FileHashFlag) String ¶
func (v *FileHashFlag) String() string
func (*FileHashFlag) UnmarshalText ¶
func (v *FileHashFlag) UnmarshalText(b []byte) error
type InitCommand ¶
type InitCommand struct { *BaseNodeCommand *mitumcmds.InitCommand }
func NewInitCommand ¶
func NewInitCommand(dryrun bool) (InitCommand, error)
type NodeCommand ¶
type NodeCommand struct { Init InitCommand `cmd:"" help:"initialize node"` Run RunCommand `cmd:"" help:"run node"` Info currencycmds.NodeInfoCommand `cmd:"" help:"node information"` }
func NewNodeCommand ¶
func NewNodeCommand() (NodeCommand, error)
type OperationFlags ¶
type OperationFlags struct { Privatekey currencycmds.PrivatekeyFlag `arg:"" name:"privatekey" help:"privatekey to sign operation" required:"true"` Token string `help:"token for operation" optional:""` NetworkID mitumcmds.NetworkIDFlag `name:"network-id" help:"network-id" required:"true"` Memo string `name:"memo" help:"memo"` Pretty bool `name:"pretty" help:"pretty format"` }
func (*OperationFlags) IsValid ¶
func (op *OperationFlags) IsValid([]byte) error
type RunCommand ¶
type RunCommand struct { *mitumcmds.RunCommand *BaseNodeCommand }
func NewRunCommand ¶
func NewRunCommand(dryrun bool) (RunCommand, error)
type SealCommand ¶
type SealCommand struct { Send SendCommand `cmd:"" name:"send" help:"send seal to remote mitum node"` CreateAccount currencycmds.CreateAccountCommand `cmd:"" name:"create-account" help:"create new account"` CreateDocument CreateDocumentCommand `cmd:"" name:"create-document" help:"create new document"` SignDocument SignDocumentCommand `cmd:"" name:"sign-document" help:"sign document"` Transfer currencycmds.TransferCommand `cmd:"" name:"transfer" help:"transfer big"` TransferDocument TransferDocumentCommand `cmd:"" name:"transfer-document" help:"transfer document"` KeyUpdater currencycmds.KeyUpdaterCommand `cmd:"" name:"key-updater" help:"update keys"` CurrencyRegister currencycmds.CurrencyRegisterCommand `cmd:"" name:"currency-register" help:"register new currency"` CurrencyPolicyUpdater currencycmds.CurrencyPolicyUpdaterCommand `cmd:"" name:"currency-policy-updater" help:"update currency policy"` // revive:disable-line:line-length-limit Sign currencycmds.SignSealCommand `cmd:"" name:"sign" help:"sign seal"` SignFact currencycmds.SignFactCommand `cmd:"" name:"sign-fact" help:"sign facts of operation seal"` }
func NewSealCommand ¶
func NewSealCommand() SealCommand
type SendCommand ¶
type SendCommand struct { *BaseCommand URL []*url.URL `name:"node" help:"remote mitum url (default: ${node_url})" default:"${node_url}"` // nolint NetworkID mitumcmds.NetworkIDFlag `name:"network-id" help:"network-id" ` Seal currencycmds.FileLoad `help:"seal" optional:""` DryRun bool `help:"dry-run, print operation" optional:"" default:"false"` Pretty bool `name:"pretty" help:"pretty format"` Privatekey currencycmds.PrivatekeyFlag `arg:"" name:"privatekey" help:"privatekey for sign"` Timeout time.Duration `name:"timeout" help:"timeout; default: 5s"` TLSInscure bool `name:"tls-insecure" help:"allow inseucre TLS connection; default is false"` }
func NewSendCommand ¶
func NewSendCommand() SendCommand
type SignDocumentCommand ¶
type SignDocumentCommand struct { *BaseCommand currencycmds.OperationFlags Sender currencycmds.AddressFlag `arg:"" name:"sender" help:"sender address" required:""` DocId currencycmds.BigFlag `arg:"" name:"documentid" help:"document id" required:""` Owner currencycmds.AddressFlag `arg:"" name:"owner" help:"owner address" required:""` Currency currencycmds.CurrencyIDFlag `arg:"" name:"currency" help:"currency id" required:""` Seal currencycmds.FileLoad `help:"seal" optional:""` // contains filtered or unexported fields }
func NewSignDocumentCommand ¶
func NewSignDocumentCommand() SignDocumentCommand
type TransferDocumentCommand ¶
type TransferDocumentCommand struct { *BaseCommand currencycmds.OperationFlags Sender currencycmds.AddressFlag `arg:"" name:"sender" help:"sender address" required:""` Currency currencycmds.CurrencyIDFlag `arg:"" name:"currency" help:"currency id" required:""` DocId currencycmds.BigFlag `arg:"" name:"documentid" help:"document id" required:""` Receiver currencycmds.AddressFlag `arg:"" name:"reciever" help:"reciever address" required:""` Seal currencycmds.FileLoad `help:"seal" optional:""` // contains filtered or unexported fields }
func NewTransferDocumentCommand ¶
func NewTransferDocumentCommand() TransferDocumentCommand
Click to show internal directories.
Click to hide internal directories.