shared

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright 2017-2018 OneLedger

Encapsulate any reads/writes to a terminal, to allow scripting later.

Should be separate from logging...

Query the chain for answers

Structures and functions for getting command line arguments, and functions to convert these into specific requests.

Common Transaction utilities, helps to create them consistently

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatchSigterm added in v0.7.1

func CatchSigterm(StopProcess func())

A polite way of bring down the service on a SIGTERM

func CreateApplyValidatorRequest added in v0.7.1

func CreateApplyValidatorRequest(args *comm.ApplyValidatorArguments) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateBalanceRequest

func CreateBalanceRequest(args *BalanceArguments) []byte

func CreateExSendRequest added in v0.7.1

func CreateExSendRequest(args *comm.ExSendArguments) []byte

func CreateExecuteRequest added in v0.8.0

func CreateExecuteRequest(args *ExecuteArguments) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateInstallRequest added in v0.8.0

func CreateInstallRequest(args *InstallArguments, script []byte) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateMintRequest

func CreateMintRequest(args *comm.SendArguments) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateSendRequest

func CreateSendRequest(args *comm.SendArguments) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateSwapRequest

func CreateSwapRequest(args *comm.SwapArguments) []byte

Create a swap request

func GetAccountKey

func GetAccountKey(identity string) []byte

func GetBalance

func GetBalance(accountKey id.AccountKey) *data.Balance

TODO: Return a balance, not a coin

func GetCurrencyAddress added in v0.7.1

func GetCurrencyAddress(currencyName string, id string) []byte

func GetNodeName added in v0.6.2

func GetNodeName() string

func GetPublicKey

func GetPublicKey() id.PublicKey

Given an Identity or Account, get the correct associated public key

func GetSequenceNumber added in v0.7.1

func GetSequenceNumber(accountKey id.AccountKey) int64

func GetTxByHash added in v0.7.0

func GetTxByHash(hash []byte) *ctypes.ResultTx

func GetTxByHeight added in v0.7.0

func GetTxByHeight(height int) *ctypes.ResultTxSearch

func GetTxByType added in v0.7.0

func GetTxByType(t string) *ctypes.ResultTxSearch

func ParseVersion added in v0.8.0

func ParseVersion(argsVersion string) *version.Version

func ReadFile added in v0.8.0

func ReadFile(filePath string) []byte

func RegisterIdentityRequest added in v0.7.1

func RegisterIdentityRequest(args *RegisterArguments) interface{}

Create a request to register a new identity with the chain

func SignAndPack

func SignAndPack(transaction action.Transaction) []byte

Prepare a transaction to be issued.

func UpdateAccountRequest added in v0.7.1

func UpdateAccountRequest(args *AccountArguments) interface{}

Types

type AccountArguments added in v0.7.1

type AccountArguments struct {
	Account     string
	Chain       string
	PublicKey   string
	PrivateKey  string
	NodeAccount bool
}

Registration

type BalanceArguments

type BalanceArguments struct {
}

type ContractArguments added in v0.8.2

type ContractArguments struct {
	Address    string
	CallString string
	CallFrom   string
	SourceCode string
	Value      int
}

type ExecuteArguments added in v0.8.0

type ExecuteArguments struct {
	Owner    string
	Name     string
	Version  string
	Currency string
	Fee      float64
	Gas      int64
}

type InstallArguments added in v0.8.0

type InstallArguments struct {
	Owner    string
	Name     string
	Version  string
	File     string
	Currency string
	Fee      float64
	Gas      int64
}

type RegisterArguments

type RegisterArguments struct {
	Identity string
	Account  string
	NodeName string
	Fee      float64
}

Registration

type Terminal

type Terminal interface {
	// Output
	//Print(text ...interface{})
	Question(text ...interface{})
	Info(text ...interface{})
	Warning(text ...interface{})
	Error(text ...interface{})
	Fatal(text ...interface{})

	// Input
	Read(string) string
	Password(string) string
}
var Console Terminal

A globally accessable terminal called Console

type Tty

type Tty struct {
}

func NewTty

func NewTty() *Tty

func (*Tty) Error

func (tty *Tty) Error(text ...interface{})

func (*Tty) Fatal added in v0.8.1

func (tty *Tty) Fatal(text ...interface{})

func (*Tty) Info

func (tty *Tty) Info(text ...interface{})

func (*Tty) Password

func (tty *Tty) Password(prompt string) string

Get a password from the console, needs to be attached to work correctly

func (*Tty) Print

func (tty *Tty) Print(text ...interface{})

TODO: Depreciate

func (*Tty) Question

func (tty *Tty) Question(text ...interface{})

func (*Tty) Read

func (tty *Tty) Read(prompt string) string

TODO: Catch a disconnected terminal, maybe read input from files? TODO: Will need this to handled getting secure passwords at the client...

func (*Tty) Warning

func (tty *Tty) Warning(text ...interface{})

Jump to

Keyboard shortcuts

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