transaction

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 13 Imported by: 6

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
)

Transaction code

View Source
const (
	ContractInitFunc = "init"
)

Variables

This section is empty.

Functions

func DecodeTx added in v0.3.0

func DecodeTx(bs []byte) (types.Tx, types.Error)

DecodeTx function is called by tendermint when node receives tx

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 FetchCodeValue added in v0.3.0

func FetchCodeValue(bs []byte) (byte, error)

FetchCodeValue returns code from rlp bytes

func GetNonceByAddress

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

Types

type CommonTx

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

func (*CommonTx) DecodeRLP added in v0.3.0

func (tx *CommonTx) DecodeRLP(s *rlp.Stream) error

func (CommonTx) EncodeNoSig added in v0.3.0

func (tx CommonTx) EncodeNoSig(w io.Writer) error

func (CommonTx) EncodeRLP added in v0.3.0

func (tx CommonTx) EncodeRLP(w io.Writer) error

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 {
	Common     CommonTx
	Address    common.Address
	Func       string // function name
	Args       [][]byte
	RWSetsHash []byte
}

func DecodeContractCallTx added in v0.3.0

func DecodeContractCallTx(b []byte) (*ContractCallTx, error)

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) SetSignature added in v0.3.0

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

func (*ContractCallTx) ValidateBasic

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

type ContractDeployTx

type ContractDeployTx struct {
	Common CommonTx
	Code   []byte
}

func DecodeContractDeployTx added in v0.3.0

func DecodeContractDeployTx(b []byte) (*ContractDeployTx, error)

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) SetSignature added in v0.3.0

func (tx *ContractDeployTx) SetSignature(sig []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 {
	Common CommonTx
	To     common.Address
	Amount uint64
}

func DecodeTransferTx added in v0.3.0

func DecodeTransferTx(b []byte) (*TransferTx, error)

func (*TransferTx) Bytes

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

func (*TransferTx) GetSignBytes

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

func (*TransferTx) SetSignature added in v0.3.0

func (tx *TransferTx) SetSignature(sig []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