commands

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2017 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	FlagTo       = "to"
	FlagAmount   = "amount"
	FlagFee      = "fee"
	FlagGas      = "gas"
	FlagSequence = "sequence"
)

nolint

View Source
const (
	FlagOutput = "file"
)

Variables

View Source
var AccountQueryCmd = &cobra.Command{
	Use:   "account [address]",
	Short: "Get details of an account, with proof",
	RunE:  lcmd.RequireInit(doAccountQuery),
}
View Source
var AutoCompleteCmd = &cobra.Command{
	Use:   "complete",
	Short: "generate bash autocompletions",
	RunE:  doAutoComplete,
}
View Source
var SendTxCmd = &cobra.Command{
	Use:   "send",
	Short: "send tokens from one account to another",
	RunE:  commands.RequireInit(doSendTx),
}

SendTxCmd is CLI command to send tokens between basecoin accounts

Functions

func AddAppTxFlags added in v0.6.0

func AddAppTxFlags(fs *flag.FlagSet)

AddAppTxFlags adds flags required by apptx

func BroadcastAppTx added in v0.6.0

func BroadcastAppTx(tx *btypes.AppTx) (*ctypes.ResultBroadcastTxCommit, error)

BroadcastAppTx wraps, signs, and executes an app tx basecoin transaction

func ParseHexFlag added in v0.6.0

func ParseHexFlag(flag string) ([]byte, error)

ParseHexFlag parses a flag string to byte array

func ReadAppTxFlags added in v0.6.0

func ReadAppTxFlags() (gas int64, fee btypes.Coin, txInput btypes.TxInput, err error)

ReadAppTxFlags reads in the standard flags your command should parse info to set tx.Name and tx.Data

Types

type AppTx

type AppTx struct {
	Tx *bc.AppTx
	// contains filtered or unexported fields
}

AppTx Application transaction structure for client

func WrapAppTx added in v0.6.0

func WrapAppTx(tx *btypes.AppTx) *AppTx

WrapAppTx wraps the transaction with chain id

func (*AppTx) Sign

func (s *AppTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error

Sign will add a signature and pubkey.

Depending on the Signable, one may be able to call this multiple times for multisig Returns error if called with invalid data or too many times

func (*AppTx) SignBytes

func (s *AppTx) SignBytes() []byte

SignBytes returned the unsigned bytes, needing a signature

func (*AppTx) Signers

func (s *AppTx) Signers() ([]crypto.PubKey, error)

Signers will return the public key(s) that signed if the signature is valid, or an error if there is any issue with the signature, including if there are no signatures

func (*AppTx) TxBytes

func (s *AppTx) TxBytes() ([]byte, error)

TxBytes returns the transaction data as well as all signatures It should return an error if Sign was never called

func (*AppTx) ValidateBasic added in v0.6.0

func (a *AppTx) ValidateBasic() error

TODO: this should really be in the basecoin.types SendTx, but that code is too ugly now, needs refactor..

type BaseTxPresenter

type BaseTxPresenter struct {
	proofs.RawPresenter // this handles MakeKey as hex bytes
}

BaseTxPresenter this decodes all basecoin tx

func (BaseTxPresenter) ParseData

func (_ BaseTxPresenter) ParseData(raw []byte) (interface{}, error)

type SendTx

type SendTx struct {
	Tx *bc.SendTx
	// contains filtered or unexported fields
}

func (*SendTx) AddSigner added in v0.6.0

func (s *SendTx) AddSigner(pk crypto.PubKey)

AddSigner sets address and pubkey info on the tx based on the key that will be used for signing

func (*SendTx) Sign

func (s *SendTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error

Sign will add a signature and pubkey.

Depending on the Signable, one may be able to call this multiple times for multisig Returns error if called with invalid data or too many times

func (*SendTx) SignBytes

func (s *SendTx) SignBytes() []byte

SignBytes returned the unsigned bytes, needing a signature

func (*SendTx) Signers

func (s *SendTx) Signers() ([]crypto.PubKey, error)

Signers will return the public key(s) that signed if the signature is valid, or an error if there is any issue with the signature, including if there are no signatures

func (*SendTx) TxBytes

func (s *SendTx) TxBytes() ([]byte, error)

TxBytes returns the transaction data as well as all signatures It should return an error if Sign was never called

func (*SendTx) ValidateBasic added in v0.6.0

func (s *SendTx) ValidateBasic() error

TODO: this should really be in the basecoin.types SendTx, but that code is too ugly now, needs refactor..

Jump to

Keyboard shortcuts

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