cmd

package
v0.54.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultForwarderRetryCount = 5
	ForwarderRequestTimeout    = 5 * time.Second
)
View Source
const MaxConsentRequests = 100

Variables

View Source
var (
	ErrEnableAutomaticConsentFlagIsRequiredWithoutTTY = errors.New("--automatic-consent flag is required without TTY")
	ErrMsysUnsupported                                = errors.New("this command is not supported on msys, please use a standard windows terminal")
	ErrNoHostSpecified                                = errors.New("no host specified in the configuration")
)
View Source
var (
	ErrDoNotSetPubKeyInCommand = errors.New("do not set the public key through the command, use --pubkey flag instead")
)
View Source
var (
	ErrForceFlagIsRequiredWithoutTTY = errors.New("--force is required without TTY")
)
View Source
var (
	ErrProgramIsNotInitialised = errors.New("first, you need initialise the program, using the `init` command")
)
View Source
var SupportedLogLevels = []string{
	zapcore.DebugLevel.String(),
	zapcore.InfoLevel.String(),
	zapcore.WarnLevel.String(),
	zapcore.ErrorLevel.String(),
}

Functions

func BuildCmdAnnotateKey

func BuildCmdAnnotateKey(w io.Writer, handler AnnotateKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdCommandSend

func BuildCmdCommandSend(w io.Writer, handler SendCommandHandler, rf *RootFlags) *cobra.Command

func BuildCmdCommandSign

func BuildCmdCommandSign(w io.Writer, handler SignCommandHandler, rf *RootFlags) *cobra.Command

func BuildCmdCreateWallet

func BuildCmdCreateWallet(w io.Writer, handler CreateWalletHandler, rf *RootFlags) *cobra.Command

func BuildCmdDeleteNetwork

func BuildCmdDeleteNetwork(w io.Writer, handler DeleteNetworkHandler, rf *RootFlags) *cobra.Command

func BuildCmdDeleteWallet

func BuildCmdDeleteWallet(w io.Writer, handler DeleteWalletHandler, rf *RootFlags) *cobra.Command

func BuildCmdDescribeKey

func BuildCmdDescribeKey(w io.Writer, handler DescribeKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdDescribeNetwork

func BuildCmdDescribeNetwork(w io.Writer, handler DescribeNetworkHandler, rf *RootFlags) *cobra.Command

func BuildCmdDescribePermissions

func BuildCmdDescribePermissions(w io.Writer, handler DescribePermissionsHandler, rf *RootFlags) *cobra.Command

func BuildCmdGenerateKey

func BuildCmdGenerateKey(w io.Writer, handler GenerateKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdGetInfoWallet

func BuildCmdGetInfoWallet(w io.Writer, handler GetInfoWalletHandler, rf *RootFlags) *cobra.Command

func BuildCmdGetVersion

func BuildCmdGetVersion(w io.Writer, handler GetVersionHandler, rf *RootFlags) *cobra.Command

func BuildCmdImportNetwork

func BuildCmdImportNetwork(w io.Writer, handler ImportNetworkFromSourceHandler, rf *RootFlags) *cobra.Command

func BuildCmdImportWallet

func BuildCmdImportWallet(w io.Writer, handler ImportWalletHandler, rf *RootFlags) *cobra.Command

func BuildCmdInit

func BuildCmdInit(w io.Writer, handler InitHandler, rf *RootFlags) *cobra.Command

func BuildCmdIsolateKey

func BuildCmdIsolateKey(w io.Writer, handler IsolateKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdListEndpoints

func BuildCmdListEndpoints(w io.Writer, handler ListEndpointsHandler, rf *RootFlags) *cobra.Command

func BuildCmdListKeys

func BuildCmdListKeys(w io.Writer, handler ListKeysHandler, rf *RootFlags) *cobra.Command

func BuildCmdListNetworks

func BuildCmdListNetworks(w io.Writer, handler ListNetworksHandler, rf *RootFlags) *cobra.Command

func BuildCmdListPermissions

func BuildCmdListPermissions(w io.Writer, handler ListPermissionsHandler, rf *RootFlags) *cobra.Command

func BuildCmdListWallets

func BuildCmdListWallets(w io.Writer, handler ListWalletsHandler, rf *RootFlags) *cobra.Command

func BuildCmdLocateNetworks

func BuildCmdLocateNetworks(w io.Writer, handler LocateNetworksHandler, rf *RootFlags) *cobra.Command

func BuildCmdPurgePermissions

func BuildCmdPurgePermissions(w io.Writer, handler PurgePermissionsHandler, rf *RootFlags) *cobra.Command

func BuildCmdRevokePermissions

func BuildCmdRevokePermissions(w io.Writer, handler RevokePermissionsHandler, rf *RootFlags) *cobra.Command

func BuildCmdRoot

func BuildCmdRoot(w io.Writer, vh CheckVersionHandler) *cobra.Command

func BuildCmdRotateKey

func BuildCmdRotateKey(w io.Writer, handler RotateKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdRunService

func BuildCmdRunService(w io.Writer, handler RunServiceHandler, rf *RootFlags) *cobra.Command

func BuildCmdSignMessage

func BuildCmdSignMessage(w io.Writer, handler SignMessageHandler, rf *RootFlags) *cobra.Command

func BuildCmdTaintKey

func BuildCmdTaintKey(w io.Writer, handler TaintKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdTxSend

func BuildCmdTxSend(w io.Writer, handler SendTxHandler, rf *RootFlags) *cobra.Command

func BuildCmdUntaintKey

func BuildCmdUntaintKey(w io.Writer, handler UntaintKeyHandler, rf *RootFlags) *cobra.Command

func BuildCmdVerifyMessage

func BuildCmdVerifyMessage(w io.Writer, handler VerifyMessageHandler, rf *RootFlags) *cobra.Command

func BuildJSONLogger

func BuildJSONLogger(level string, vegaPaths paths.Paths, logsDir paths.StatePath) (*zap.Logger, string, error)

func BuildLogger

func BuildLogger(output, level string) (*zap.Logger, error)

func DefaultConfig

func DefaultConfig() zap.Config

func Execute

func Execute(w *Writer)

func ListEndpoints

func ListEndpoints(w io.Writer, rf *RootFlags, f *ListEndpointsFlags) error

func NewCmdAnnotateKey

func NewCmdAnnotateKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdCommand

func NewCmdCommand(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdCommandSend

func NewCmdCommandSend(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdCommandSign

func NewCmdCommandSign(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdCompletion

func NewCmdCompletion(w io.Writer) *cobra.Command

func NewCmdCreateWallet

func NewCmdCreateWallet(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdDeleteNetwork

func NewCmdDeleteNetwork(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdDeleteWallet

func NewCmdDeleteWallet(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdDescribeKey

func NewCmdDescribeKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdDescribeNetwork

func NewCmdDescribeNetwork(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdDescribePermissions

func NewCmdDescribePermissions(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdGenerateKey

func NewCmdGenerateKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdGetInfoWallet

func NewCmdGetInfoWallet(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdImportNetwork

func NewCmdImportNetwork(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdImportWallet

func NewCmdImportWallet(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdInit

func NewCmdInit(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdIsolateKey

func NewCmdIsolateKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdKey

func NewCmdKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdListEndpoints

func NewCmdListEndpoints(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdListKeys

func NewCmdListKeys(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdListNetworks

func NewCmdListNetworks(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdListPermissions

func NewCmdListPermissions(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdListWallets

func NewCmdListWallets(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdLocateNetworks

func NewCmdLocateNetworks(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdMessage

func NewCmdMessage(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdNetwork

func NewCmdNetwork(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdPermissions

func NewCmdPermissions(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdPurgePermissions

func NewCmdPurgePermissions(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdRevokePermissions

func NewCmdRevokePermissions(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdRoot

func NewCmdRoot(w io.Writer) *cobra.Command

func NewCmdRotateKey

func NewCmdRotateKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdRunService

func NewCmdRunService(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdService

func NewCmdService(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdSignMessage

func NewCmdSignMessage(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdTaintKey

func NewCmdTaintKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdTx

func NewCmdTx(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdTxSend

func NewCmdTxSend(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdUntaintKey

func NewCmdUntaintKey(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdVerifyMessage

func NewCmdVerifyMessage(w io.Writer, rf *RootFlags) *cobra.Command

func NewCmdVersion

func NewCmdVersion(w io.Writer, rf *RootFlags) *cobra.Command

func NewUnsupportedFlagValueError

func NewUnsupportedFlagValueError(level string) error

func PrintAnnotateKeyResponse

func PrintAnnotateKeyResponse(w io.Writer, req *wallet.AnnotateKeyRequest)

func PrintCreateWalletResponse

func PrintCreateWalletResponse(w io.Writer, resp *wallet.CreateWalletResponse)

func PrintDeleteNetworkResponse

func PrintDeleteNetworkResponse(w io.Writer, networkName string)

func PrintDeleteWalletResponse

func PrintDeleteWalletResponse(w io.Writer, walletName string)

func PrintDescribeKeyResponse

func PrintDescribeKeyResponse(w io.Writer, resp *wallet.DescribeKeyResponse)

func PrintDescribeNetworkResponse

func PrintDescribeNetworkResponse(w io.Writer, resp *network.DescribeNetworkResponse)

func PrintDescribePermissionsResponse

func PrintDescribePermissionsResponse(w io.Writer, resp *wallet.DescribePermissionsResponse)

func PrintGenerateKeyResponse

func PrintGenerateKeyResponse(w io.Writer, req *wallet.GenerateKeyRequest, resp *wallet.GenerateKeyResponse)

func PrintGetVersionResponse

func PrintGetVersionResponse(w io.Writer, resp *version.GetVersionResponse)

func PrintGetWalletInfoResponse

func PrintGetWalletInfoResponse(w io.Writer, resp *wallet.GetWalletInfoResponse)

func PrintImportNetworkResponse

func PrintImportNetworkResponse(w io.Writer, resp *network.ImportNetworkFromSourceResponse)

func PrintImportWalletResponse

func PrintImportWalletResponse(w io.Writer, resp *wallet.ImportWalletResponse)

func PrintInitResponse

func PrintInitResponse(w io.Writer, resp *InitResponse)

func PrintIsolateKeyResponse

func PrintIsolateKeyResponse(w io.Writer, resp *wallet.IsolateKeyResponse)

func PrintListKeysResponse

func PrintListKeysResponse(w io.Writer, resp *wallet.ListKeysResponse)

func PrintListNetworksResponse

func PrintListNetworksResponse(w io.Writer, resp *network.ListNetworksResponse)

func PrintListPermissionsResponse

func PrintListPermissionsResponse(w io.Writer, resp *wallet.ListPermissionsResponse)

func PrintListWalletsResponse

func PrintListWalletsResponse(w io.Writer, resp *wallet.ListWalletsResponse)

func PrintLocateNetworksResponse

func PrintLocateNetworksResponse(w io.Writer, resp *LocateNetworksResponse)

func PrintPurgePermissionsResponse

func PrintPurgePermissionsResponse(w io.Writer, wallet string)

func PrintRevokePermissionsResponse

func PrintRevokePermissionsResponse(w io.Writer, req *wallet.RevokePermissionsRequest)

func PrintRotateKeyResponse

func PrintRotateKeyResponse(w io.Writer, req *wallet.RotateKeyResponse)

func PrintSignCommandResponse

func PrintSignCommandResponse(w io.Writer, req *wallet.SignCommandResponse)

func PrintSignMessageResponse

func PrintSignMessageResponse(w io.Writer, req *wallet.SignMessageResponse)

func PrintTaintKeyResponse

func PrintTaintKeyResponse(w io.Writer)

func PrintUntaintKeyResponse

func PrintUntaintKeyResponse(w io.Writer)

func PrintVerifyMessageResponse

func PrintVerifyMessageResponse(w io.Writer, isValid bool)

func RunService

func RunService(w io.Writer, rf *RootFlags, f *RunServiceFlags) error

func SendCommand

func SendCommand(w io.Writer, rf *RootFlags, req *SendCommandRequest) error

func SendTx

func SendTx(w io.Writer, rf *RootFlags, req *SendTxRequest) error

func ValidateLogLevel

func ValidateLogLevel(level string) error

Types

type AnnotateKeyFlags

type AnnotateKeyFlags struct {
	Wallet         string
	PubKey         string
	PassphraseFile string
	Clear          bool
	RawMetadata    []string
}

func (*AnnotateKeyFlags) Validate

func (f *AnnotateKeyFlags) Validate() (*wallet.AnnotateKeyRequest, error)

type AnnotateKeyHandler

type AnnotateKeyHandler func(*wallet.AnnotateKeyRequest) error

type CheckVersionHandler

type CheckVersionHandler func() (*semver.Version, error)

type CreateWalletFlags

type CreateWalletFlags struct {
	Wallet         string
	PassphraseFile string
}

func (*CreateWalletFlags) Validate

type DeleteNetworkFlags

type DeleteNetworkFlags struct {
	Network string
	Force   bool
}

func (*DeleteNetworkFlags) Validate

type DeleteNetworkHandler

type DeleteNetworkHandler func(*network.DeleteNetworkRequest) error

type DeleteWalletFlags

type DeleteWalletFlags struct {
	Wallet string
	Force  bool
}

func (*DeleteWalletFlags) Validate

func (f *DeleteWalletFlags) Validate() error

type DeleteWalletHandler

type DeleteWalletHandler func(wallet string) error

type DescribeKeyFlags

type DescribeKeyFlags struct {
	Wallet         string
	PassphraseFile string
	PubKey         string
}

func (*DescribeKeyFlags) Validate

func (f *DescribeKeyFlags) Validate() (*wallet.DescribeKeyRequest, error)

type DescribeNetworkFlags

type DescribeNetworkFlags struct {
	Network string
}

func (*DescribeNetworkFlags) Validate

type DescribePermissionsFlags

type DescribePermissionsFlags struct {
	Wallet         string
	Hostname       string
	PassphraseFile string
}

func (*DescribePermissionsFlags) Validate

type Error

type Error struct {
	Err string `json:"error"`
}

type GenerateKeyFlags

type GenerateKeyFlags struct {
	Wallet         string
	PassphraseFile string
	RawMetadata    []string
}

func (*GenerateKeyFlags) Validate

func (f *GenerateKeyFlags) Validate() (*wallet.GenerateKeyRequest, error)

type GetVersionHandler

type GetVersionHandler func() *version.GetVersionResponse

type GetWalletInfoFlags

type GetWalletInfoFlags struct {
	Wallet         string
	PassphraseFile string
}

func (*GetWalletInfoFlags) Validate

type ImportNetworkFlags

type ImportNetworkFlags struct {
	FilePath string
	URL      string
	Name     string
	Force    bool
}

func (*ImportNetworkFlags) Validate

type ImportWalletFlags

type ImportWalletFlags struct {
	Wallet             string
	PassphraseFile     string
	RecoveryPhraseFile string
	Version            uint32
}

func (*ImportWalletFlags) Validate

type InitFlags

type InitFlags struct {
	Force bool
}

type InitHandler

type InitHandler func(home string, f *InitFlags) (*InitResponse, error)

type InitResponse

type InitResponse struct {
	RSAKeys struct {
		PublicKeyFilePath  string `json:"publicKeyFilePath"`
		PrivateKeyFilePath string `json:"privateKeyFilePath"`
	} `json:"rsaKeys"`
}

func Init

func Init(home string, f *InitFlags) (*InitResponse, error)

type IsolateKeyFlags

type IsolateKeyFlags struct {
	Wallet         string
	PubKey         string
	PassphraseFile string
}

func (*IsolateKeyFlags) Validate

func (f *IsolateKeyFlags) Validate() (*wallet.IsolateKeyRequest, error)

type ListEndpointsFlags

type ListEndpointsFlags struct {
	Network string
}

func (*ListEndpointsFlags) Validate

func (f *ListEndpointsFlags) Validate() error

type ListEndpointsHandler

type ListEndpointsHandler func(io.Writer, *RootFlags, *ListEndpointsFlags) error

type ListKeysFlags

type ListKeysFlags struct {
	Wallet         string
	PassphraseFile string
}

func (*ListKeysFlags) Validate

func (f *ListKeysFlags) Validate() (*wallet.ListKeysRequest, error)

type ListKeysHandler

type ListKeysHandler func(*wallet.ListKeysRequest) (*wallet.ListKeysResponse, error)

type ListNetworksHandler

type ListNetworksHandler func() (*network.ListNetworksResponse, error)

type ListPermissionsFlags

type ListPermissionsFlags struct {
	Wallet         string
	PassphraseFile string
}

func (*ListPermissionsFlags) Validate

type ListWalletsHandler

type ListWalletsHandler func() (*wallet.ListWalletsResponse, error)

type LocateNetworksHandler

type LocateNetworksHandler func() (*LocateNetworksResponse, error)

type LocateNetworksResponse

type LocateNetworksResponse struct {
	Path string `json:"path"`
}

type LoggerError

type LoggerError struct {
	// contains filtered or unexported fields
}

func UnsupportedLoggerLevelError

func UnsupportedLoggerLevelError(l string) LoggerError

func (LoggerError) Error

func (e LoggerError) Error() string

type PurgePermissionsFlags

type PurgePermissionsFlags struct {
	Wallet         string
	PassphraseFile string
	Force          bool
}

func (*PurgePermissionsFlags) Validate

type PurgePermissionsHandler

type PurgePermissionsHandler func(*wallet.PurgePermissionsRequest) error

type RevokePermissionsFlags

type RevokePermissionsFlags struct {
	Wallet         string
	Hostname       string
	Force          bool
	PassphraseFile string
}

func (*RevokePermissionsFlags) Validate

type RevokePermissionsHandler

type RevokePermissionsHandler func(*wallet.RevokePermissionsRequest) error

type RootFlags

type RootFlags struct {
	Output         string
	Home           string
	NoVersionCheck bool
}

func (*RootFlags) Validate

func (f *RootFlags) Validate() error

type RotateKeyFlags

type RotateKeyFlags struct {
	Wallet            string
	PassphraseFile    string
	NewPublicKey      string
	ChainID           string
	CurrentPubKey     string
	TxBlockHeight     uint64
	TargetBlockHeight uint64
}

func (*RotateKeyFlags) Validate

func (f *RotateKeyFlags) Validate() (*wallet.RotateKeyRequest, error)

type RotateKeyHandler

type RotateKeyHandler func(*wallet.RotateKeyRequest) (*wallet.RotateKeyResponse, error)

type RunServiceFlags

type RunServiceFlags struct {
	Network                string
	EnableAutomaticConsent bool
}

func (*RunServiceFlags) Validate

func (f *RunServiceFlags) Validate() error

type RunServiceHandler

type RunServiceHandler func(io.Writer, *RootFlags, *RunServiceFlags) error

type SendCommandFlags

type SendCommandFlags struct {
	Network        string
	NodeAddress    string
	Wallet         string
	PubKey         string
	PassphraseFile string
	Retries        uint64
	LogLevel       string
	RawCommand     string
}

func (*SendCommandFlags) Validate

func (f *SendCommandFlags) Validate() (*SendCommandRequest, error)

type SendCommandHandler

type SendCommandHandler func(io.Writer, *RootFlags, *SendCommandRequest) error

type SendCommandRequest

type SendCommandRequest struct {
	Network     string
	NodeAddress string
	Wallet      string
	Passphrase  string
	Retries     uint64
	LogLevel    string
	Request     *walletpb.SubmitTransactionRequest
}

type SendTxFlags

type SendTxFlags struct {
	Network     string
	NodeAddress string
	Retries     uint64
	LogLevel    string
	RawTx       string
}

func (*SendTxFlags) Validate

func (f *SendTxFlags) Validate() (*SendTxRequest, error)

type SendTxHandler

type SendTxHandler func(io.Writer, *RootFlags, *SendTxRequest) error

type SendTxRequest

type SendTxRequest struct {
	Network     string
	NodeAddress string
	Retries     uint64
	LogLevel    string
	Tx          *commandspb.Transaction
}

type SignCommandFlags

type SignCommandFlags struct {
	Wallet         string
	PubKey         string
	PassphraseFile string
	RawCommand     string
	TxBlockHeight  uint64
	ChainID        string
}

func (*SignCommandFlags) Validate

func (f *SignCommandFlags) Validate() (*wallet.SignCommandRequest, error)

type SignMessageFlags

type SignMessageFlags struct {
	Wallet         string
	PubKey         string
	Message        string
	PassphraseFile string
}

func (*SignMessageFlags) Validate

func (f *SignMessageFlags) Validate() (*wallet.SignMessageRequest, error)

type TaintKeyFlags

type TaintKeyFlags struct {
	Wallet         string
	PubKey         string
	PassphraseFile string
}

func (*TaintKeyFlags) Validate

func (f *TaintKeyFlags) Validate() (*wallet.TaintKeyRequest, error)

type TaintKeyHandler

type TaintKeyHandler func(*wallet.TaintKeyRequest) error

type UntaintKeyFlags

type UntaintKeyFlags struct {
	Wallet         string
	PubKey         string
	PassphraseFile string
}

func (*UntaintKeyFlags) Validate

func (f *UntaintKeyFlags) Validate() (*wallet.UntaintKeyRequest, error)

type UntaintKeyHandler

type UntaintKeyHandler func(*wallet.UntaintKeyRequest) error

type VerifyMessageFlags

type VerifyMessageFlags struct {
	Signature string
	Message   string
	PubKey    string
}

func (*VerifyMessageFlags) Validate

type VerifyMessageHandler

type VerifyMessageHandler func(*crypto.VerifyMessageRequest) (bool, error)

type Writer

type Writer struct {
	Out io.Writer
	Err io.Writer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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