types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EthTxType      = "et"
	ContractTxType = "ct"
	SuicideTxType  = "st"
)
View Source
const (
	LKTxType        = "lk"
	LKRawTxType     = "tx"
	LKValidatorType = "val" // del
)
View Source
const (
	ServiceName = "lk"
)

Variables

View Source
var (
	ErrNotExist           = errors.New("Not Exist")
	ErrInvalidSignature   = errors.New("Invalid Signature")
	ErrInvalidTx          = errors.New("Invalid Tx")
	ErrUnknownEtherTxType = errors.New("Unknown Ether Tx Type")
)

Functions

func CheckTxSign

func CheckTxSign(tx *LKTransaction, pub string) error

Types

type ContractTransaction

type ContractTransaction struct {
	TxHash   common.Hash    `json:"tx_hash"`
	From     common.Address `json:"from"`
	To       common.Address `json:"address"`
	Value    *big.Int       `json:"value"`
	Index    int            `json:"index"`
	BlockNum *big.Int       `json:"block_num"`
	// contains filtered or unexported fields
}

func (*ContractTransaction) Hash

func (tx *ContractTransaction) Hash() common.Hash

func (*ContractTransaction) String

func (tx *ContractTransaction) String() string

type EthTransaction

type EthTransaction struct {
	Tx      *types.Transaction `json:"tx"`
	GasUsed *big.Int           `json:"gas_used"`
	// Result: 0(success), others(fail, details come with Errmsg field)
	Ret    int    `json:"ret"`
	Errmsg string `json:"errmsg"`
}

func (*EthTransaction) Hash

func (tx *EthTransaction) Hash() common.Hash

func (*EthTransaction) String

func (tx *EthTransaction) String() string

func (*EthTransaction) TxHash

func (tx *EthTransaction) TxHash() common.Hash

type EtherTx

type EtherTx struct {
	Type string `json:"type"`
	Tx   string `json:"tx"`
}

type LKBlock

type LKBlock struct {
	Number       *big.Int         `json:"num"`
	Hash         common.Hash      `json:"hash"`
	Time         *big.Int         `json:"time"`
	Transactions []*LKTransaction `json:"txs"`
}

func (*LKBlock) String

func (d *LKBlock) String() string

type LKTransaction

type LKTransaction struct {
	Type string               `json:"type"`
	ETx  *EthTransaction      `json:"etx"`
	CTx  *ContractTransaction `json:"ctx"`
	STx  *SuicideTransaction  `json:"stx"`
	Sign string               `json:"sign"`
}

func FromEtherTx

func FromEtherTx(txHexBytes string) (*LKTransaction, error)

func SignTx

func SignTx(tx *LKTransaction, prv string) (*LKTransaction, error)

SignTx signs the transaction using the given private key

func (*LKTransaction) BlockNum

func (d *LKTransaction) BlockNum() *big.Int

func (*LKTransaction) Decode

func (tx *LKTransaction) Decode(s string) error

func (*LKTransaction) Encode

func (tx *LKTransaction) Encode() string

func (*LKTransaction) Hash

func (tx *LKTransaction) Hash() common.Hash

func (*LKTransaction) String

func (d *LKTransaction) String() string

func (*LKTransaction) TxHash

func (tx *LKTransaction) TxHash() common.Hash

type SuicideTransaction

type SuicideTransaction struct {
	TxHash   common.Hash    `json:"tx_hash"`
	From     common.Address `json:"from"`
	To       common.Address `json:"to"`
	Target   common.Address `json:"target"`
	Index    int            `json:"index"`
	Value    *big.Int       `json:"value"`
	BlockNum *big.Int       `json:"block_num"`
	// contains filtered or unexported fields
}

func (*SuicideTransaction) Hash

func (tx *SuicideTransaction) Hash() common.Hash

func (*SuicideTransaction) String

func (tx *SuicideTransaction) String() string

type TxRecordReq

type TxRecordReq struct {
	TxHash string `json:"tx_hash"`
	Type   string `json:"type"`
}

type WrappedLKTransaction

type WrappedLKTransaction struct {
	LKx      *LKTransaction `json:"lkx"`
	BlockNum *big.Int       `json:"block_num"`
}

func (*WrappedLKTransaction) String

func (w *WrappedLKTransaction) String() string

Jump to

Keyboard shortcuts

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