Documentation ¶
Index ¶
- Variables
- func AskPassphrase() string
- func CachePassphrase(passphrase string)
- func CheckBalance(address, symbol string) (float64, error)
- func CheckTx(tx string) (bool, error)
- func GetIP() (string, error)
- func HandleError(err error, msg, path string) error
- func NewPassphrase() string
- func OpenAccount() (bool, error)
- func PrintError(err error)
- func SendRequest(requestType, url string, data interface{}) (string, error)
- func SetLogLevel(level int)
- func SetupLogger() error
- func Version()
- func WaitForTx(tx string) (bool, error)
- type APIResponse
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
var LogFile *os.File
LogFile - Where the logs are stored
var LogLevel int
LogLevel - What kind of logs to show (1 = Debug and above, 2 = Info and above, 3 = Warnings and above, 4 = Fatal)
var RequestTimeout int
RequestTimeout - Request timeout in seconds
Functions ¶
func CachePassphrase ¶
func CachePassphrase(passphrase string)
CachePassphrase - cache passphrase so user's don't have to retype it every time in the same command.
func CheckBalance ¶
CheckBalance - check SYMBOL balance of account DEPRECATED
func GetIP ¶
GetIP - Retrieve the current machine's external IPv4 address using multiple ip API's. DEPRECATED
func HandleError ¶
HandleError - custom error handler for the CLI. Uses ResponseError as a means of keeping 2 seperate error messages. UserMessage is a message to display to a user when an error occurs. LogError is a message to log or display to a developer. Path is the error path which is up to the developer to include.
func NewPassphrase ¶
func NewPassphrase() string
NewPassphrase - prompts user for new passphrase and confirms it.
func PrintError ¶
func PrintError(err error)
PrintError - print and logs ReponseError's. Use this to println the UserMessage and log the LogError with correct path.
func SendRequest ¶
SendRequest - custom function to make sending api requests less of a pain in the arse.
func SetLogLevel ¶
func SetLogLevel(level int)
SetLogLevel - Sets the appropriate logging level. 1 = Debug < , 2 = Info <, 3 = Warning <, 4 = Fatal.
func SetupLogger ¶
func SetupLogger() error
SetupLogger - Clears the previous file, and creates log file ready for writing
Types ¶
type APIResponse ¶
type APIResponse struct { Message string `json:"message"` Success bool `json:"success"` Error string `json:"error"` Response interface{} `json:"response"` TxHash interface{} `json:"txHash"` Endpoint string `json:"endpoint"` }
APIResponse - standard response from the control daemon api
func ControlDaemonHandler ¶
func ControlDaemonHandler(_res []byte) (APIResponse, error)
ControlDaemonHandler - handler for the API responses
type ErrorResponse ¶
ErrorResponse - custom error struct