bank

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = 2

	CodeInvalidInput  sdk.CodeType = 101
	CodeInvalidOutput sdk.CodeType = 102
)

Bank errors reserve 100 ~ 199.

Variables

This section is empty.

Functions

func ApproveCmd

func ApproveCmd(cdc *wire.Codec) *cobra.Command

ApproveCmd will create a approve tx and sign it with the given key.

func ErrInvalidInput

func ErrInvalidInput(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidOutput

func ErrInvalidOutput(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrNoInputs

func ErrNoInputs(codespace sdk.CodespaceType) sdk.Error

func ErrNoOutputs

func ErrNoOutputs(codespace sdk.CodespaceType) sdk.Error

func GetResultKey

func GetResultKey(heigth1 string, tx1 string) string

func MustSortJSON

func MustSortJSON(toSortJSON []byte) []byte

MustSortJSON is like SortJSON but panic if an error occurs, e.g., if the passed JSON isn't valid.

func NewSendBody

func NewSendBody(r *http.Request) (*sendBody, error)

func RegisterRoutes

func RegisterRoutes(cdc *wire.Codec, r *mux.Router)

RegisterRoutes - Central function to define routes that get registered by the main application

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

func SendTxCmd

func SendTxCmd(cdc *wire.Codec) *cobra.Command

SendTxCmd will create a send tx and sign it with the given key.

func SortJSON

func SortJSON(toSortJSON []byte) ([]byte, error)

Types

type BankStub

type BankStub struct{}

func NewBankStub

func NewBankStub() BankStub

func (BankStub) CustomerQuery

func (kv BankStub) CustomerQuery(ctx ctx.Context, route []string, req abci.RequestQuery) (res []byte, err types.Error)

func (BankStub) EndBlockNotify

func (kv BankStub) EndBlockNotify(ctx context.Context)

func (BankStub) Name

func (kv BankStub) Name() string

func (BankStub) RegisterCdc

func (kv BankStub) RegisterCdc(cdc *go_amino.Codec)

func (BankStub) ResultNotify

func (kv BankStub) ResultNotify(ctx context.Context, txQcpResult interface{}) *types.Result

func (BankStub) StartX

func (kv BankStub) StartX(base *baseapp.QstarsBaseApp) error

type Input

type Input struct {
	Address qbtype.Address `json:"address"`
	Coins   sdk.Coins      `json:"coins"`
}

Transaction Input

func NewInput

func NewInput(addr qbtype.Address, coins sdk.Coins) Input

NewInput - create a transaction input, used with MsgSend

func (Input) GetSignBytes

func (in Input) GetSignBytes() []byte

Return bytes to sign for Input

func (Input) ValidateBasic

func (in Input) ValidateBasic() sdk.Error

ValidateBasic - validate transaction input

type MsgSend

type MsgSend struct {
	Inputs  []Input  `json:"inputs"`
	Outputs []Output `json:"outputs"`
}

MsgSend - high level transaction of the coin module

func NewMsgSend

func NewMsgSend(in []Input, out []Output) MsgSend

NewMsgSend - construct arbitrary multi-in, multi-out send msg.

type Output

type Output struct {
	Address qbtype.Address `json:"address"`
	Coins   sdk.Coins      `json:"coins"`
}

Transaction Output

func NewOutput

func NewOutput(addr qbtype.Address, coins sdk.Coins) Output

NewOutput - create a transaction output, used with MsgSend

func (Output) GetSignBytes

func (out Output) GetSignBytes() []byte

Return bytes to sign for Output

func (Output) ValidateBasic

func (out Output) ValidateBasic() sdk.Error

ValidateBasic - validate transaction output

type SendOptions

type SendOptions struct {
	// contains filtered or unexported fields
}

func NewSendOptions

func NewSendOptions(opts ...func(*SendOptions)) *SendOptions

type SendResult

type SendResult struct {
	Hash   string `json:"hash"`
	Error  string `json:"error"`
	Code   string `json:"code"`
	Result string `json:"result"`
	Heigth string `json:"heigth"`
}

func Approve

func Approve(cdc *wire.Codec, command string, fromstr string, tostr string, coins types.Coins, chainid string,
	sopt *SendOptions) (*SendResult, error)

Send 暂时只支持一次只转一种币 coins.Len() == 1; add chainid string input

func Send

func Send(cdc *wire.Codec, fromstr string, to qbasetypes.Address, coins types.Coins, sopt *SendOptions) (*SendResult, error)

Send 支持一次多种币 coins.Len() == 1;

func TxSend

func TxSend(cdc *wire.Codec, txb []byte) (*SendResult, error)

type WrapperSendTx

type WrapperSendTx struct {
	Wrapper *txs.TxStd
}

func NewWrapperSendTx

func NewWrapperSendTx(wrapper *txs.TxStd) WrapperSendTx

func (WrapperSendTx) CalcGas

func (tx WrapperSendTx) CalcGas() btypes.BigInt

func (WrapperSendTx) Exec

func (tx WrapperSendTx) Exec(ctx context.Context) (result btypes.Result, crossTxQcps *txs.TxQcp)

func (WrapperSendTx) GetGasPayer

func (tx WrapperSendTx) GetGasPayer() btypes.Address

func (WrapperSendTx) GetSignData

func (tx WrapperSendTx) GetSignData() []byte

func (WrapperSendTx) GetSigner

func (tx WrapperSendTx) GetSigner() []btypes.Address

func (WrapperSendTx) Name

func (tx WrapperSendTx) Name() string

func (WrapperSendTx) ValidateData

func (tx WrapperSendTx) ValidateData(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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