ioctl

package
v2.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidEndpointOrInsecure represents that endpoint or insecure is invalid
	ErrInvalidEndpointOrInsecure = errors.New("check endpoint or secureConnect in ~/.config/ioctl/default/config.default or cmd flag value if has")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	// Start starts the client
	Start(context.Context) error
	// Stop stops the client
	Stop(context.Context) error
	// Config returns the config of the client
	Config() config.Config
	// ConfigFilePath returns the file path of the config
	ConfigFilePath() string
	// SetEndpointWithFlag receives input flag value
	SetEndpointWithFlag(func(*string, string, string, string))
	// SetInsecureWithFlag receives input flag value
	SetInsecureWithFlag(func(*bool, string, bool, string))
	// APIServiceClient returns an API service client
	APIServiceClient() (iotexapi.APIServiceClient, error)
	// SelectTranslation select a translation based on UILanguage
	SelectTranslation(map[config.Language]string) (string, config.Language)
	// ReadCustomLink scans a custom link from terminal and validates it.
	ReadCustomLink() (string, error)
	// AskToConfirm asks user to confirm from terminal, true to continue
	AskToConfirm(string) (bool, error)
	// ReadSecret reads password from terminal
	ReadSecret() (string, error)
	// Execute a bash command
	Execute(string) error
	// AddressWithDefaultIfNotExist returns default address if input empty
	AddressWithDefaultIfNotExist(in string) (string, error)
	// Address returns address if input address|alias
	Address(in string) (string, error)
	// NewKeyStore creates a keystore by default walletdir
	NewKeyStore() *keystore.KeyStore
	// DecryptPrivateKey returns privateKey from a json blob
	DecryptPrivateKey(string, string) (*ecdsa.PrivateKey, error)
	// AliasMap returns the alias map: accountAddr-aliasName
	AliasMap() map[string]string
	// Alias returns the alias corresponding to address
	Alias(string) (string, error)
	// SetAlias updates aliasname and account address and not write them into the default config file
	SetAlias(string, string)
	// SetAliasAndSave updates aliasname and account address and write them into the default config file
	SetAliasAndSave(string, string) error
	// DeleteAlias delete alias from the default config file
	DeleteAlias(string) error
	// WriteConfig write config datas to the default config file
	WriteConfig() error
	// IsCryptoSm2 return true if use sm2 cryptographic algorithm, false if not use
	IsCryptoSm2() bool
	// QueryAnalyser sends request to Analyser endpoint
	QueryAnalyser(interface{}) (*http.Response, error)
	// ReadInput reads the input from stdin
	ReadInput() (string, error)
	// HdwalletMnemonic returns the mnemonic of hdwallet
	HdwalletMnemonic(string) (string, error)
	// WriteHdWalletConfigFile writes encrypting mnemonic into config file
	WriteHdWalletConfigFile(string, string) error
	// RemoveHdWalletConfigFile removes hdwalletConfigFile
	RemoveHdWalletConfigFile() error
	// IsHdWalletConfigFileExist return true if config file is existed, false if not existed
	IsHdWalletConfigFileExist() bool
	// Insecure returns the insecure connect option of grpc dial, default is false
	Insecure() bool
}

Client defines the interface of an ioctl client

func NewClient

func NewClient(cfg config.Config, configFilePath string, opts ...Option) Client

NewClient creates a new ioctl client

type ConfirmationMessage

type ConfirmationMessage struct {
	Info    string   `json:"info"`
	Options []string `json:"options"`
}

ConfirmationMessage is the struct of an Confirmation output

func (*ConfirmationMessage) String

func (m *ConfirmationMessage) String() string

type Option

type Option func(*client)

Option sets client construction parameter

func EnableCryptoSm2

func EnableCryptoSm2() Option

EnableCryptoSm2 enables to use sm2 cryptographic algorithm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL