cmd

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package cmd is all the available commands for the bux-cli application

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedToLoadBux = errors.New("failed to load bux")

ErrFailedToLoadBux is returned when bux fails to load

View Source
var ErrModeIsRequired = errors.New("mode is required")

ErrModeIsRequired is returned when a mode is required

View Source
var ErrModelIsNil = errors.New("model is nil")

ErrModelIsNil is returned when a model is nil

View Source
var ErrNoXpubsFound = errors.New("no xpubs found")

ErrNoXpubsFound is returned when no xpubs are found

View Source
var ErrServerModeIsNotImplemented = errors.New("server mode is not implemented")

ErrServerModeIsNotImplemented is returned when a server mode is not implemented

View Source
var ErrUnknownMode = errors.New("unknown mode")

ErrUnknownMode is returned when a mode is unknown

View Source
var ErrUnknownSubcommand = errors.New("unknown subcommand")

ErrUnknownSubcommand is returned when a subcommand is unknown

View Source
var ErrXprivIsRequired = errors.New("xpriv is required")

ErrXprivIsRequired is returned when a xpriv is required

View Source
var ErrXpubIDIsRequired = errors.New("xpub id is required")

ErrXpubIDIsRequired is returned when a xpub id is required

View Source
var ErrXpubIsRequired = errors.New("xpub is required")

ErrXpubIsRequired is returned when a xpub is required

View Source
var ErrXpubOrXpubIDIsRequired = errors.New("xpub or xpub id is required")

ErrXpubOrXpubIDIsRequired is returned when a xpub or xpub id is required

View Source
var Version = "v0.2.4"

Version of the application

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type App

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

App is the main application struct This is used to pass around the application configuration and services

func (*App) GetUserAgent

func (a *App) GetUserAgent() string

GetUserAgent will return the outgoing user agent

func (*App) InitializeBUX

func (a *App) InitializeBUX() (deferFunc func())

InitializeBUX will initialize BUX if it is not already initialized

type CachestoreConfig

type CachestoreConfig struct {
	Engine cachestore.Engine `json:"engine" mapstructure:"engine"` // Cache engine to use (redis, freecache)
}

CachestoreConfig is the configuration for the cachestore

type ChainstateConfig

type ChainstateConfig struct {
	BroadcastInstantly bool     `json:"broadcast_instantly" mapstructure:"broadcast_instantly"` // true for broadcasting instantly
	Broadcasting       bool     `json:"broadcast" mapstructure:"broadcast"`                     // true for broadcasting
	MinersBroadcast    []string `json:"miners_broadcast" mapstructure:"miners_broadcast"`       // Miners for broadcasting
	MinersQuery        []string `json:"miners_query" mapstructure:"miners_query"`               // Miners for querying
	P2P                bool     `json:"p2p" mapstructure:"p2p"`                                 // true for p2p
	SyncOnChain        bool     `json:"sync_on_chain" mapstructure:"sync_on_chain"`             // true for syncing on chain
	TaalAPIKey         string   `json:"taal_api_key" mapstructure:"taal_api_key"`               // Taal API key
}

ChainstateConfig is a configuration for the chainstate

type Config

type Config struct {
	Cachestore  CachestoreConfig        `json:"cachestore" mapstructure:"cachestore"`     // Cachestore config
	Chainstate  ChainstateConfig        `json:"chainstate" mapstructure:"chainstate"`     // Chainstate config
	Datastore   DatastoreConfig         `json:"datastore" mapstructure:"datastore"`       // Datastore config
	Debug       bool                    `json:"debug" mapstructure:"debug"`               // Debug mode
	Mode        string                  `json:"mode" mapstructure:"mode"`                 // Mode is either database or server
	Mongo       datastore.MongoDBConfig `json:"mongodb" mapstructure:"mongodb"`           // MongoDB config
	Redis       RedisConfig             `json:"redis" mapstructure:"redis"`               // Redis config
	SQL         datastore.SQLConfig     `json:"sql" mapstructure:"sql"`                   // SQL config (MySQL, Postgres, etc)
	SQLite      datastore.SQLiteConfig  `json:"sqlite" mapstructure:"sqlite"`             // SQLite config
	TaskManager TaskManagerConfig       `json:"task_manager" mapstructure:"task_manager"` // TaskManager config
	Verbose     bool                    `json:"verbose" mapstructure:"verbose"`           // Verbose mode (also enables debug)
}

Config is the configuration for the application and BUX

type DatastoreConfig

type DatastoreConfig struct {
	AutoMigrate bool             `json:"auto_migrate" mapstructure:"auto_migrate"` // loads a blank database
	Debug       bool             `json:"debug" mapstructure:"debug"`               // true for sql statements
	Engine      datastore.Engine `json:"engine" mapstructure:"engine"`             // mysql, sqlite
	TablePrefix string           `json:"table_prefix" mapstructure:"table_prefix"` // pre_users (pre)
}

DatastoreConfig is a configuration for the datastore

type Destination added in v0.1.1

type Destination struct {
	Bux        *bux.Destination             `json:"bux" mapstructure:"bux"`
	WOCBalance *whatsonchain.AddressBalance `json:"woc_balance,omitempty" mapstructure:"woc_balance"`
	WOCInfo    *whatsonchain.AddressInfo    `json:"woc_info,omitempty" mapstructure:"woc_info"`
}

Destination is a struct for the bux model and whatsonchain destination

type Keys

type Keys struct {
	PrivateKey string `json:"private_key" mapstructure:"private_key"`
	WIF        string `json:"wif" mapstructure:"wif"`
	Xpriv      string `json:"xpriv" mapstructure:"xpriv"`
	Xpub       string `json:"xpub" mapstructure:"xpub"`
}

Keys is a struct for the private keys, wif, xpriv and xpub

type RedisConfig

type RedisConfig struct {
	DependencyMode        bool          `json:"dependency_mode" mapstructure:"dependency_mode"`                 // Only in Redis with script enabled
	MaxActiveConnections  int           `json:"max_active_connections" mapstructure:"max_active_connections"`   // Max active connections
	MaxConnectionLifetime time.Duration `json:"max_connection_lifetime" mapstructure:"max_connection_lifetime"` // Max connection lifetime
	MaxIdleConnections    int           `json:"max_idle_connections" mapstructure:"max_idle_connections"`       // Max idle connections
	MaxIdleTimeout        time.Duration `json:"max_idle_timeout" mapstructure:"max_idle_timeout"`               // Max idle timeout
	URL                   string        `json:"url" mapstructure:"url"`                                         // Redis URL connection string
	UseTLS                bool          `json:"use_tls" mapstructure:"use_tls"`                                 // Flag for using TLS
}

RedisConfig is a configuration for Redis cachestore or taskmanager

type TaskManagerConfig

type TaskManagerConfig struct {
	Engine    taskmanager.Engine  `json:"engine" mapstructure:"engine"`         // taskq, machinery
	Factory   taskmanager.Factory `json:"factory" mapstructure:"factory"`       // Factory (memory, redis)
	QueueName string              `json:"queue_name" mapstructure:"queue_name"` // test_queue
}

TaskManagerConfig is a configuration for the taskmanager

type Transaction

type Transaction struct {
	Bux *bux.Transaction     `json:"bux" mapstructure:"bux"`
	WOC *whatsonchain.TxInfo `json:"woc,omitempty" mapstructure:"woc"`
}

Transaction is a struct for the bux model and whatsonchain transaction

type XpubExtended

type XpubExtended struct {
	*bux.Xpub
	FullKey string `json:"full_key" mapstructure:"full_key"`
}

XpubExtended is an extended xpub struct with the full key

Jump to

Keyboard shortcuts

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