shared

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: Apache-2.0 Imports: 13 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 CreateBalanceRequest

func CreateBalanceRequest(args *BalanceArguments) []byte

func CreateMintRequest

func CreateMintRequest(args *SendArguments) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateRegisterRequest

func CreateRegisterRequest(args *RegisterArguments) []byte

Create a request to register a new identity with the chain

func CreateSendRequest

func CreateSendRequest(args *SendArguments) []byte

CreateRequest builds and signs the transaction based on the arguments

func CreateSwapRequest

func CreateSwapRequest(args *SwapArguments) []byte

Create a swap request

func GetAccountKey

func GetAccountKey(identity string) []byte

func GetBalance

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

func GetPublicKey

func GetPublicKey() id.PublicKey

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

func GetSigners

func GetSigners() []id.PublicKey

GetSigners will return the public keys of the signers

func GetSwapAddress added in v0.5.0

func GetSwapAddress(currencyName string) []byte

func SignAndPack

func SignAndPack(ttype action.Type, transaction action.Transaction) []byte

Prepare a transaction to be issued.

Types

type BalanceArguments

type BalanceArguments struct {
}

type RegisterArguments

type RegisterArguments struct {
	Identity string
}

Registration

type SendArguments

type SendArguments struct {
	Party        string
	CounterParty string
	Currency     string
	Amount       string
	Gas          string
	Fee          string
}

type SwapArguments

type SwapArguments struct {
	Party        string
	CounterParty string
	Amount       string
	Currency     string
	Fee          string
	Gas          string // TODO: Not sure this is necessary, unless the chain is like Ethereum
	Exchange     string
	Excurrency   string
	Nonce        int64
}

Arguments to the command

type Terminal

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

	// Input
	Read(string) string
	Password() 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) Info

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

func (*Tty) Password

func (tty *Tty) Password() 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