transaction

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCodespace types.CodespaceType = "2"

	CodeInvalidTx       types.CodeType = 101
	CodeInvalidTransfer types.CodeType = 102
	CodeFailTransfer    types.CodeType = 103
	CodeInvalidDeploy   types.CodeType = 104
	CodeInvalidCall     types.CodeType = 105
)

Bank errors reserve 100 ~ 199.

View Source
const (
	TRANSFER uint8 = 1 + iota
	CONTRACT_DEPLOY
	CONTRACT_CALL
)
View Source
const (
	ContractInitFunc = "init"
)

Variables

This section is empty.

Functions

func Decode

func Decode(b []byte) (types.Tx, types.Error)

func ErrFailTransfer

func ErrFailTransfer(codespace types.CodespaceType, msg string) types.Error

func ErrInvalidCall

func ErrInvalidCall(codespace types.CodespaceType, msg string) types.Error

func ErrInvalidDeploy

func ErrInvalidDeploy(codespace types.CodespaceType, msg string) types.Error

func ErrInvalidTransfer

func ErrInvalidTransfer(codespace types.CodespaceType, msg string) types.Error

func ErrInvalidTx

func ErrInvalidTx(codespace types.CodespaceType, msg string) types.Error

func GetNonceByAddress

func GetNonceByAddress(addr common.Address) (uint64, error)

Types

type CommonTx

type CommonTx struct {
	From      common.Address
	Nonce     uint64
	Gas       uint64
	Signature []byte
}

func (*CommonTx) SetSignature

func (tx *CommonTx) SetSignature(sig []byte)

func (*CommonTx) ValidateBasic

func (tx *CommonTx) ValidateBasic() types.Error

func (*CommonTx) VerifySignature

func (tx *CommonTx) VerifySignature(hash []byte) types.Error

type ContractCallTx

type ContractCallTx struct {
	Address    common.Address
	Func       string // function name
	Args       [][]byte
	RWSetsHash []byte
	CommonTx
}

func (*ContractCallTx) Bytes

func (tx *ContractCallTx) Bytes() []byte

func (*ContractCallTx) Decode

func (tx *ContractCallTx) Decode(b []byte) error

func (*ContractCallTx) GetSignBytes

func (tx *ContractCallTx) GetSignBytes() []byte

func (*ContractCallTx) ValidateBasic

func (tx *ContractCallTx) ValidateBasic() types.Error

type ContractDeployTx

type ContractDeployTx struct {
	Code []byte
	CommonTx
}

func (*ContractDeployTx) Bytes

func (tx *ContractDeployTx) Bytes() []byte

func (*ContractDeployTx) Decode

func (tx *ContractDeployTx) Decode(b []byte) error

func (*ContractDeployTx) GetSignBytes

func (tx *ContractDeployTx) GetSignBytes() []byte

func (*ContractDeployTx) ValidateBasic

func (tx *ContractDeployTx) ValidateBasic() types.Error

type Transaction

type Transaction interface {
	types.Tx
	GetSignBytes() []byte
	SetSignature([]byte)
	Bytes() []byte
}

type TransferTx

type TransferTx struct {
	To     common.Address
	Amount uint64
	CommonTx
}

func (*TransferTx) Bytes

func (tx *TransferTx) Bytes() []byte

func (*TransferTx) Decode

func (tx *TransferTx) Decode(b []byte) error

func (*TransferTx) GetSignBytes

func (tx *TransferTx) GetSignBytes() []byte

func (*TransferTx) ValidateBasic

func (tx *TransferTx) ValidateBasic() types.Error

type TxIndexMapper

type TxIndexMapper interface {
	Get(types.Context) uint32
	Incr(types.Context) uint32
}

func NewTxIndexMapper

func NewTxIndexMapper(k types.StoreKey) TxIndexMapper

Jump to

Keyboard shortcuts

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