types

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	JsonrpcApiVersion                                = 3
	JsonrpcErrorCodeSystem         jsonrpc.ErrorCode = -31000
	JsonrpcErrorCodeTxPoolOverflow jsonrpc.ErrorCode = -31001
	JsonrpcErrorCodePending        jsonrpc.ErrorCode = -31002
	JsonrpcErrorCodeExecuting      jsonrpc.ErrorCode = -31003
	JsonrpcErrorCodeNotFound       jsonrpc.ErrorCode = -31004
	JsonrpcErrorLackOfResource     jsonrpc.ErrorCode = -31005
	JsonrpcErrorCodeTimeout        jsonrpc.ErrorCode = -31006
	JsonrpcErrorCodeSystemTimeout  jsonrpc.ErrorCode = -31007
	JsonrpcErrorCodeScore          jsonrpc.ErrorCode = -30000
)
View Source
const (
	DuplicateTransactionError = iota + 2000
	TransactionPoolOverflowError
	ExpiredTransactionError
	FutureTransactionError
	TransitionInterruptedError
	InvalidTransactionError
	InvalidQueryError
	InvalidResultError
	NoActiveContractError
	NotContractAddressError
	InvalidPatchDataError
	CommittedTransactionError
)
View Source
const (
	ResultStatusSuccess           = "0x1"
	ResultStatusFailureCodeRevert = 32
	ResultStatusFailureCodeEnd    = 99
)
View Source
const (
	BMCRelayMethod     = "handleRelayMessage"
	BMCGetStatusMethod = "getStatus"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address string

T_ADDR_EOA, T_ADDR_SCORE

func NewAddress

func NewAddress(b []byte) Address

func (Address) Value

func (a Address) Value() ([]byte, error)

type AddressParam

type AddressParam struct {
	Address Address `json:"address" validate:"required,t_addr"`
	Height  HexInt  `json:"height,omitempty" validate:"optional,t_int"`
}

type BMCRelayMethodParams

type BMCRelayMethodParams struct {
	Prev     string `json:"_prev"`
	Messages string `json:"_msg"`
}

type BMCStatus

type BMCStatus struct {
	TxSeq            HexInt `json:"tx_seq"`
	RxSeq            HexInt `json:"rx_seq"`
	BMRIndex         HexInt `json:"relay_idx"`
	RotateHeight     HexInt `json:"rotate_height"`
	RotateTerm       HexInt `json:"rotate_term"`
	DelayLimit       HexInt `json:"delay_limit"`
	MaxAggregation   HexInt `json:"max_agg"`
	CurrentHeight    HexInt `json:"cur_height"`
	RxHeight         HexInt `json:"rx_height"`
	RxHeightSrc      HexInt `json:"rx_height_src"`
	BlockIntervalSrc HexInt `json:"block_interval_src"`
	BlockIntervalDst HexInt `json:"block_interval_dst"`
}

type BMCStatusParams

type BMCStatusParams struct {
	Target string `json:"_link"`
}

type Block

type Block struct {
	//BlockHash              HexBytes  `json:"block_hash" validate:"required,t_hash"`
	//Version                HexInt    `json:"version" validate:"required,t_int"`
	Height int64 `json:"height" validate:"required,t_int"`
	//Timestamp              int64             `json:"time_stamp" validate:"required,t_int"`
	//Proposer               HexBytes  `json:"peer_id" validate:"optional,t_addr_eoa"`
	//PrevID                 HexBytes  `json:"prev_block_hash" validate:"required,t_hash"`
	//NormalTransactionsHash HexBytes  `json:"merkle_tree_root_hash" validate:"required,t_hash"`
	NormalTransactions []struct {
		TxHash HexBytes `json:"txHash"`
		//Version   HexInt   `json:"version"`
		From Address `json:"from"`
		To   Address `json:"to"`
		//Value     HexInt   `json:"value,omitempty" `
		//StepLimit HexInt   `json:"stepLimit"`
		//TimeStamp HexInt   `json:"timestamp"`
		//NID       HexInt   `json:"nid,omitempty"`
		//Nonce     HexInt   `json:"nonce,omitempty"`
		//Signature HexBytes `json:"signature"`
		DataType string          `json:"dataType,omitempty"`
		Data     json.RawMessage `json:"data,omitempty"`
	} `json:"confirmed_transaction_list"`
}

type BlockHeader

type BlockHeader struct {
	Version                int
	Height                 int64
	Timestamp              int64
	Proposer               []byte
	PrevID                 []byte
	VotesHash              []byte
	NextValidatorsHash     []byte
	PatchTransactionsHash  []byte
	NormalTransactionsHash []byte
	LogsBloom              []byte
	Result                 []byte
}

type BlockHeightParam

type BlockHeightParam struct {
	Height HexInt `json:"height" validate:"required,t_int"`
}

type BlockNotification

type BlockNotification struct {
	Hash    HexBytes     `json:"hash"`
	Height  HexInt       `json:"height"`
	Indexes [][]HexInt   `json:"indexes,omitempty"`
	Events  [][][]HexInt `json:"events,omitempty"`
}

type BlockRequest

type BlockRequest struct {
	Height       HexInt         `json:"height"`
	EventFilters []*EventFilter `json:"eventFilters,omitempty"`
}

type CallData

type CallData struct {
	Method string      `json:"method"`
	Params interface{} `json:"params,omitempty"`
}

type CallParam

type CallParam struct {
	FromAddress Address     `json:"from" validate:"optional,t_addr_eoa"`
	ToAddress   Address     `json:"to" validate:"required,t_addr_score"`
	DataType    string      `json:"dataType" validate:"required,call"`
	Data        interface{} `json:"data"`
}

type CommitVoteItem

type CommitVoteItem struct {
	Timestamp int64
	Signature common.Signature
}

type CommitVoteList

type CommitVoteList struct {
	Round          int32
	BlockPartSetID *PartSetID
	Items          []CommitVoteItem
}

type DataHashParam

type DataHashParam struct {
	Hash HexBytes `json:"hash" validate:"required,t_hash"`
}

type EventFilter

type EventFilter struct {
	Addr      Address   `json:"addr,omitempty"`
	Signature string    `json:"event"`
	Indexed   []*string `json:"indexed,omitempty"`
	Data      []*string `json:"data,omitempty"`
}

type EventLog

type EventLog struct {
	Addr    []byte
	Indexed [][]byte
	Data    [][]byte
}

type EventNotification

type EventNotification struct {
	Hash   HexBytes `json:"hash"`
	Height HexInt   `json:"height"`
	Index  HexInt   `json:"index"`
	Events []HexInt `json:"events,omitempty"`
}

type EventRequest

type EventRequest struct {
	EventFilter
	Height HexInt `json:"height"`
}

type HR

type HR struct {
	Height int64
	Round  int32
}

type HexBytes

type HexBytes string

T_BIN_DATA, T_HASH

func NewHexBytes

func NewHexBytes(b []byte) HexBytes

func (HexBytes) Value

func (hs HexBytes) Value() ([]byte, error)

type HexInt

type HexInt string

T_INT

func NewHexInt

func NewHexInt(v int64) HexInt

func (HexInt) BigInt

func (i HexInt) BigInt() (*big.Int, error)

func (HexInt) Int

func (i HexInt) Int() (int, error)

func (HexInt) Value

func (i HexInt) Value() (int64, error)

type PartSetID

type PartSetID struct {
	Count uint16
	Hash  []byte
}

type ProofEventsParam

type ProofEventsParam struct {
	BlockHash HexBytes `json:"hash" validate:"required,t_hash"`
	Index     HexInt   `json:"index" validate:"required,t_int"`
	Events    []HexInt `json:"events"`
}

type ProofResultParam

type ProofResultParam struct {
	BlockHash HexBytes `json:"hash" validate:"required,t_hash"`
	Index     HexInt   `json:"index" validate:"required,t_int"`
}

type ReceiptProof

type ReceiptProof struct {
	Index  int
	Events []byte
	Height int64
}

type RelayMessage

type RelayMessage struct {
	ReceiptProofs [][]byte
	// contains filtered or unexported fields
}

type Signature

type Signature string

T_SIG

type TransactionHashParam

type TransactionHashParam struct {
	Hash HexBytes `json:"txHash" validate:"required,t_hash"`
}

type TransactionParam

type TransactionParam struct {
	Version     HexInt      `json:"version" validate:"required,t_int"`
	FromAddress Address     `json:"from" validate:"required,t_addr_eoa"`
	ToAddress   Address     `json:"to" validate:"required,t_addr"`
	Value       HexInt      `json:"value,omitempty" validate:"optional,t_int"`
	StepLimit   HexInt      `json:"stepLimit" validate:"required,t_int"`
	Timestamp   HexInt      `json:"timestamp" validate:"required,t_int"`
	NetworkID   HexInt      `json:"nid" validate:"required,t_int"`
	Nonce       HexInt      `json:"nonce,omitempty" validate:"optional,t_int"`
	Signature   string      `json:"signature" validate:"required,t_sig"`
	DataType    string      `json:"dataType,omitempty" validate:"optional,call|deploy|message"`
	Data        interface{} `json:"data,omitempty"`
	TxHash      HexBytes    `json:"-"`
}

type TransactionResult

type TransactionResult struct {
	To                 Address `json:"to"`
	CumulativeStepUsed HexInt  `json:"cumulativeStepUsed"`
	StepUsed           HexInt  `json:"stepUsed"`
	StepPrice          HexInt  `json:"stepPrice"`
	EventLogs          []struct {
		Addr    Address  `json:"scoreAddress"`
		Indexed []string `json:"indexed"`
		Data    []string `json:"data"`
	} `json:"eventLogs"`
	LogsBloom HexBytes `json:"logsBloom"`
	Status    HexInt   `json:"status"`
	Failure   *struct {
		CodeValue    HexInt `json:"code"`
		MessageValue string `json:"message"`
	} `json:"failure,omitempty"`
	SCOREAddress Address  `json:"scoreAddress,omitempty"`
	BlockHash    HexBytes `json:"blockHash" validate:"required,t_hash"`
	BlockHeight  HexInt   `json:"blockHeight" validate:"required,t_int"`
	TxIndex      HexInt   `json:"txIndex" validate:"required,t_int"`
	TxHash       HexBytes `json:"txHash" validate:"required,t_int"`
}

type VerifierOptions

type VerifierOptions struct {
	BlockHeight    uint64         `json:"blockHeight"`
	ValidatorsHash common.HexHash `json:"validatorsHash"`
}

type Vote

type Vote struct {
	VoteBase
	Timestamp int64
}

type VoteBase

type VoteBase struct {
	HR
	Type           VoteType
	BlockID        []byte
	BlockPartSetID PartSetID
}

type VoteType

type VoteType byte

type WSEvent

type WSEvent string
const (
	WSEventInit WSEvent = "WSEventInit"
)

type WSResponse

type WSResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message,omitempty"`
}

type WsReadCallback

type WsReadCallback func(*websocket.Conn, interface{}) error

Jump to

Keyboard shortcuts

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