helper

package
v1.5.25 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLightHeader

func GetLightHeader(chain *collactor.Chain, opts ...string) (*tmclient.Header, error)

GetLightHeader returns header with chain and optional height as inputs

func InitLight

func InitLight(chain *collactor.Chain, force bool) (string, error)

InitLight is a helper function for init light

func SuccessJSONResponse

func SuccessJSONResponse(status int, v interface{}, w http.ResponseWriter)

SuccessJSONResponse prepares data and writes a HTTP success

func WriteErrorResponse

func WriteErrorResponse(statusCode int, err error, w http.ResponseWriter)

WriteErrorResponse writes a HTTP error given a status code and an error message

func WriteSuccessResponse

func WriteSuccessResponse(statusCode int, data interface{}, w http.ResponseWriter)

WriteSuccessResponse writes a HTTP success given a status code and data

Types

type KeyOutput

type KeyOutput struct {
	PrivateKey string `json:"privatekey" yaml:"privatekey"`
	Address    string `json:"address" yaml:"address"`
}

KeyOutput contains mnemonic and address of key

func KeyAddOrRestore

func KeyAddOrRestore(privatekeys ...string) (KeyOutput, error)

KeyAddOrRestore is a helper function for add key and restores key when mnemonic is passed

type RespStruct

type RespStruct struct {
	Ret  int         `json:"ret"`
	Data interface{} `json:"data, omitempty"`
	Err  string      `json:"err, omitempty"`
}

Jump to

Keyboard shortcuts

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