transaction

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TypeSend                byte = 0x01
	TypeConvert             byte = 0x02
	TypeCreateCoin          byte = 0x03
	TypeDeclareCandidacy    byte = 0x04
	TypeDelegate            byte = 0x05
	TypeUnbond              byte = 0x06
	TypeRedeemCheck         byte = 0x07
	TypeSetCandidateOnline  byte = 0x08
	TypeSetCandidateOffline byte = 0x09
)

Variables

View Source
var (
	CommissionMultiplier = big.NewInt(10e8)
)
View Source
var (
	ErrInvalidSig = errors.New("invalid transaction v, r, s values")
)

Functions

This section is empty.

Types

type ConvertData

type ConvertData struct {
	FromCoinSymbol types.CoinSymbol
	ToCoinSymbol   types.CoinSymbol
	Value          *big.Int
}

func (ConvertData) MarshalJSON

func (s ConvertData) MarshalJSON() ([]byte, error)

type CreateCoinData

type CreateCoinData struct {
	Name                 string
	Symbol               types.CoinSymbol
	InitialAmount        *big.Int
	InitialReserve       *big.Int
	ConstantReserveRatio uint
}

func (CreateCoinData) MarshalJSON

func (s CreateCoinData) MarshalJSON() ([]byte, error)

type Data

type Data interface {
	MarshalJSON() ([]byte, error)
}

type DeclareCandidacyData

type DeclareCandidacyData struct {
	Address    types.Address
	PubKey     []byte
	Commission uint
	Stake      *big.Int
}

func (DeclareCandidacyData) MarshalJSON

func (s DeclareCandidacyData) MarshalJSON() ([]byte, error)

type DelegateData

type DelegateData struct {
	PubKey []byte
	Stake  *big.Int
}

func (DelegateData) MarshalJSON

func (s DelegateData) MarshalJSON() ([]byte, error)

type RawData

type RawData []byte

type RedeemCheckData

type RedeemCheckData struct {
	RawCheck []byte
	Proof    [65]byte
}

func (RedeemCheckData) MarshalJSON

func (s RedeemCheckData) MarshalJSON() ([]byte, error)

type Response

type Response struct {
	Code      uint32          `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Data      []byte          `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	Log       string          `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
	Info      string          `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
	GasWanted int64           `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"`
	GasUsed   int64           `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
	Tags      []common.KVPair `protobuf:"bytes,7,rep,name=tags" json:"tags,omitempty"`
	Fee       common.KI64Pair `protobuf:"bytes,8,opt,name=fee" json:"fee"`
}

func RunTx

func RunTx(context *state.StateDB, isCheck bool, tx *Transaction, rewardPull *big.Int, currentBlock uint64) Response

type SendData

type SendData struct {
	Coin  types.CoinSymbol
	To    types.Address
	Value *big.Int
}

func (SendData) MarshalJSON

func (s SendData) MarshalJSON() ([]byte, error)

type SetCandidateOffData

type SetCandidateOffData struct {
	PubKey []byte
}

func (SetCandidateOffData) MarshalJSON

func (s SetCandidateOffData) MarshalJSON() ([]byte, error)

type SetCandidateOnData

type SetCandidateOnData struct {
	PubKey []byte
}

func (SetCandidateOnData) MarshalJSON

func (s SetCandidateOnData) MarshalJSON() ([]byte, error)

type Transaction

type Transaction struct {
	Nonce       uint64
	GasPrice    *big.Int
	Type        byte
	Data        RawData
	Payload     []byte
	ServiceData []byte
	V           *big.Int
	R           *big.Int
	S           *big.Int
	// contains filtered or unexported fields
}

TODO: refactor, get rid of switch cases

func DecodeFromBytes

func DecodeFromBytes(buf []byte) (*Transaction, error)

func (*Transaction) Gas

func (tx *Transaction) Gas() int64

func (*Transaction) GetDecodedData

func (tx *Transaction) GetDecodedData() Data

func (*Transaction) Hash

func (tx *Transaction) Hash() types.Hash

func (*Transaction) Sender

func (tx *Transaction) Sender() (types.Address, error)

func (*Transaction) Serialize

func (tx *Transaction) Serialize() ([]byte, error)

func (*Transaction) SetDecodedData

func (tx *Transaction) SetDecodedData(data Data)

func (*Transaction) SetSignature

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

func (*Transaction) Sign

func (tx *Transaction) Sign(prv *ecdsa.PrivateKey) error

func (*Transaction) String

func (tx *Transaction) String() string

type UnbondData

type UnbondData struct {
	PubKey []byte
	Value  *big.Int
}

func (UnbondData) MarshalJSON

func (s UnbondData) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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