types

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBigInt

func ParseBigInt(i *big.Int, s string) error

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 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
	NSFilter               []byte
}

type BlockHeaderResult

type BlockHeaderResult struct {
	StateHash        []byte
	PatchReceiptHash []byte
	ReceiptHash      common.HexBytes
	ExtensionData    []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        *CallData `json:"data"`
	Height      HexInt    `json:"height,omitempty"`
}

func (*CallParam) MsgBytes

func (c *CallParam) MsgBytes() ([]byte, error)

func (*CallParam) Type

func (c *CallParam) Type() string

Added to implement RelayerMessage interface

type ClaimFee added in v1.1.0

type ClaimFee struct{}

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    Address
	Indexed [][]byte
	Data    [][]byte
}

type EventLogStr

type EventLogStr struct {
	Addr    Address  `json:"scoreAddress"`
	Indexed []string `json:"indexed"`
	Data    []string `json:"data"`
}

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 ExecuteCall added in v1.1.0

type ExecuteCall struct {
	ReqID HexInt   `json:"_reqId"`
	Data  HexBytes `json:"_data"`
}

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 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 RecvMessage

type RecvMessage struct {
	SrcNID string   `json:"srcNetwork"`
	ConnSn HexInt   `json:"_connSn"`
	Msg    HexBytes `json:"msg"`
}

type RevertMessage added in v1.1.0

type RevertMessage struct {
	Sn HexInt `json:"_sn"`
}

type SendMessage

type SendMessage struct {
	TargetNetwork string   `json:"to"`
	Svc           string   `json:"svc"`
	Sn            uint64   `json:"sn"`
	Msg           HexBytes `json:"msg"`
	Data          HexBytes `json:"data"`
}

type SetAdmin added in v1.1.0

type SetAdmin struct {
	Relayer string `json:"_relayer"`
}

type SetFee added in v1.1.0

type SetFee struct {
	NetworkID string `json:"networkId"`
	MsgFee    HexInt `json:"messageFee"`
	ResFee    HexInt `json:"responseFee"`
}

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,omitempty" validate:"optional,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,omitempty" validate:"optional,t_sig"`
	DataType    string   `json:"dataType,omitempty" validate:"optional,call|deploy|message"`
	Data        CallData `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          []EventLogStr `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 TxResult

type TxResult struct {
	Status             int64
	To                 []byte
	CumulativeStepUsed []byte
	StepUsed           []byte
	StepPrice          []byte
	LogsBloom          []byte
	EventLogs          []EventLog
	ScoreAddress       []byte
	EventLogsHash      common.HexBytes
	TxIndex            HexInt
	BlockHeight        HexInt
}

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