wsmsg

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IncomingMessageMap = map[string]reflect.Type{}

Message registration

View Source
var IncomingStructMap = map[reflect.Type]string{}
View Source
var OutgoingMessageMap = map[string]reflect.Type{}
View Source
var OutgoingStructMap = map[reflect.Type]string{}

Functions

func GetType

func GetType(msg OutgoingMessager) (string, error)

GetType retrieves the message `type` on a Common outgoing structure.

func RegisterIncomingMessage

func RegisterIncomingMessage(typeName string, obj interface{})

func RegisterOutgoingMessage

func RegisterOutgoingMessage(typeName string, obj interface{})

func SetType

func SetType(msg OutgoingMessager) error

SetType sets the `type` on a Common outgoing structure.

Types

type Account

type Account struct {
	CommonOut
	Data struct {
		Account *mdl.Account `json:"account"`
	} `json:"data"`
}

func NewAccount

func NewAccount(account *mdl.Account) *Account

OUTGOING

type ActionTrace

type ActionTrace struct {
	CommonOut
	Data struct {
		BlockNum      uint32    `json:"block_num"`
		BlockID       string    `json:"block_id"`
		BlockTime     time.Time `json:"block_time"`
		TransactionID string    `json:"trx_id"`
		ActionIndex   int       `json:"idx"`
		//ActionDepth   int             `json:"depth"`
		Trace json.RawMessage `json:"trace"`

		DBOps    []*v0.DBOp    `json:"dbops,omitempty"`
		RAMOps   []*v0.RAMOp   `json:"ramops,omitempty"`
		DTrxOps  []*v0.DTrxOp  `json:"dtrxops,omitempty"`
		TableOps []*v0.TableOp `json:"tableops,omitempty"`
	} `json:"data"`
}

func NewActionTrace

func NewActionTrace(trxid string, actionIndex int, trace json.RawMessage) *ActionTrace

type CommonIn

type CommonIn struct {
	Type             string `json:"type"`
	ReqID            string `json:"req_id,omitempty"`
	Fetch            bool   `json:"fetch,omitempty"`
	Listen           bool   `json:"listen,omitempty"`
	StartBlock       int64  `json:"start_block,omitempty"`
	IrreversibleOnly bool   `json:"irreversible_only,omitempty"`
	WithProgress     int64  `json:"with_progress,omitempty"` // send progress each X blocks
}

func (CommonIn) GetCommon

func (c CommonIn) GetCommon() *CommonIn

func (CommonIn) GetID

func (c CommonIn) GetID() string

func (CommonIn) GetReqID

func (c CommonIn) GetReqID() string

func (CommonIn) GetType

func (c CommonIn) GetType() string

func (CommonIn) GetWithProgress

func (c CommonIn) GetWithProgress() int64

type CommonOut

type CommonOut struct {
	Type  string `json:"type"`
	ReqID string `json:"req_id,omitempty"`
}

func (*CommonOut) SetReqID

func (c *CommonOut) SetReqID(v string)

func (*CommonOut) SetType

func (c *CommonOut) SetType(v string)

type Error

type Error struct {
	CommonOut
	Data *derr.ErrorResponse `json:"data"`
}

func NewError

func NewError(reqID string, err *derr.ErrorResponse) *Error

type FormattedTransaction

type FormattedTransaction struct {
	CommonOut
	Data json.RawMessage `json:"data"`
}

type ForumPost

type ForumPost struct {
	CommonOut
	Data *forum.Post `json:"data"`
}

func NewForumPost

func NewForumPost(post *forum.Post) *ForumPost

type ForumProposition

type ForumProposition struct {
	CommonOut
	Data *mdl.Proposition `json:"data"`
}

func NewProposition

func NewProposition(proposition *mdl.Proposition) *ForumProposition

type ForumVote

type ForumVote struct {
	CommonOut
	Data *forum.Vote `json:"data"`
}

func NewForumVote

func NewForumVote(vote *forum.Vote) *ForumVote

type GetAccount

type GetAccount struct {
	CommonIn
	Data *GetAccountData `json:"data"`
}

func (*GetAccount) Validate

func (m *GetAccount) Validate(ctx context.Context) error

type GetAccountData

type GetAccountData struct {
	Name string `json:"name"`
}

INCOMING

type GetActionTraces

type GetActionTraces struct {
	CommonIn

	// TODO: Allow filtering by authorization accounts on DB ops
	Data struct {
		Receiver   zsw.AccountName `json:"receiver"`    // deprecated (keep plural form)
		Account    zsw.AccountName `json:"account"`     // deprecated (keep plural form)
		ActionName zsw.ActionName  `json:"action_name"` // deprecated (keep plural form)

		Receivers   string `json:"receivers"`
		Accounts    string `json:"accounts"`
		ActionNames string `json:"action_names"`

		WithInlineTraces bool `json:"with_inline_traces"`
		WithDBOps        bool `json:"with_dbops"`
		WithRAMOps       bool `json:"with_ramops"`
		WithDTrxOps      bool `json:"with_dtrxops"`
		WithTableOps     bool `json:"with_tableops"`
	} `json:"data"`
}

func (*GetActionTraces) Validate

func (m *GetActionTraces) Validate(ctx context.Context) error

type GetForumProposition

type GetForumProposition struct {
	CommonIn

	Data struct {
		Title string `json:"title"`
	} `json:"data"`
}

type GetHeadInfo

type GetHeadInfo struct {
	CommonIn
}

func (*GetHeadInfo) Validate

func (m *GetHeadInfo) Validate() error

type GetPrice

type GetPrice struct {
	CommonIn
}

type GetTableRows

type GetTableRows struct {
	CommonIn
	Data GetTableRowsData `json:"data"`
}

func (*GetTableRows) Validate

func (m *GetTableRows) Validate(ctx context.Context) error

type GetTableRowsData

type GetTableRowsData struct {
	JSON bool `json:"json,omitempty"`

	Code      zsw.AccountName `json:"code"`
	Scope     *zsw.Name       `json:"scope"`
	TableName zsw.TableName   `json:"table"`
}

INCOMING

type GetTransaction

type GetTransaction struct {
	CommonIn

	Data struct {
		ID string `json:"id"`
	} `json:"data"`
}

func (*GetTransaction) Validate

func (m *GetTransaction) Validate(ctx context.Context) error

type GetVoteTally

type GetVoteTally struct {
	CommonIn
}

func (*GetVoteTally) Validate

func (t *GetVoteTally) Validate(ctx context.Context) error

type HeadInfo

type HeadInfo struct {
	CommonOut
	Data *HeadInfoData `json:"data"`
}

type HeadInfoData

type HeadInfoData struct {
	LastIrreversibleBlockNum uint32    `json:"last_irreversible_block_num"`
	LastIrreversibleBlockId  string    `json:"last_irreversible_block_id"`
	HeadBlockNum             uint32    `json:"head_block_num"`
	HeadBlockId              string    `json:"head_block_id"`
	HeadBlockTime            time.Time `json:"head_block_time"`
	HeadBlockProducer        string    `json:"head_block_producer"`
}

type IncomingMessage

type IncomingMessage interface {
	// GetID returns a composite of `GetType` @ `GetReqID`
	GetID() string
	GetType() string
	GetReqID() string
	GetCommon() *CommonIn
	GetWithProgress() int64
}

type IncomingMessager

type IncomingMessager interface {
	GetType() string
	GetReqID() string
	GetCommon() *CommonIn
	GetWithProgress() int64
}

type Listening

type Listening struct {
	CommonOut
	Data struct {
		NextBlock uint32 `json:"next_block"`
	} `json:"data"`
}

func NewListening

func NewListening(nextBlock uint32) *Listening

type M

type M map[string]interface{}

Obj

type OutgoingMessager

type OutgoingMessager interface {
	SetType(v string)
	SetReqID(v string)
}

type Ping

type Ping struct {
	CommonOut
	Data time.Time `json:"data"`
}

func NewPing

func NewPing(now time.Time) *Ping

type PriceResp

type PriceResp struct {
	CommonOut
	Data struct {
		//Title string `json:"title"`
		Symbol      string    `json:"symbol"`
		Price       float64   `json:"price"`
		Variation   float64   `json:"variation"`
		LastUpdated time.Time `json:"last_updated"`
	} `json:"data"`
	Metadata struct {
		Timestamp int   `json:"timestamp"`
		Error     error `json:"error"`
	} `json:"metadata"`
}

type Progress

type Progress struct {
	CommonOut
	Data struct {
		BlockNum uint32 `json:"block_num"`
		BlockID  string `json:"block_id"`
	} `json:"data"`
}

type RAMOut

type RAMOut struct {
	CommonOut
	Data struct {
		Delta    int64  `json:"delta"`
		Account  string `json:"account"`
		BlockNum uint32 `json:"block_num"`
		Action   string `json:"action"`
	} `json:"data"`
}

func NewRAMOut

func NewRAMOut(blockNum uint32, action string, delta int64, account string) *RAMOut

type TableDelta

type TableDelta struct {
	CommonOut
	Data struct {
		BlockNum uint32   `json:"block_num"`
		DBOp     *v1.DBOp `json:"dbop"`
		Step     string   `json:"step"`
	} `json:"data"`
}

func NewTableDelta

func NewTableDelta(blockNum uint32, dbop *v1.DBOp, stepType forkable.StepType) *TableDelta

type TableSnapshot

type TableSnapshot struct {
	CommonOut
	Data struct {
		Rows []json.RawMessage `json:"rows"`
	} `json:"data"`
}

type TicketDataQuote

type TicketDataQuote struct {
	Price            float64 `json:"price"`
	Volume24h        float64 `json:"volume_24h"`
	MarketCap        float64 `json:"market_cap"`
	PercentChange1h  float64 `json:"percent_change_1h"`
	PercentChange24h float64 `json:"percent_change_24h"`
	PercentChange7d  float64 `json:"percent_change_7d"`
}

type TransactionLifecycle

type TransactionLifecycle struct {
	CommonOut
	Data struct {
		Lifecycle *v1.TransactionLifecycle `json:"lifecycle"`
	} `json:"data"`
}

func NewTransactionLifecycle

func NewTransactionLifecycle(transaction *v1.TransactionLifecycle) *TransactionLifecycle

type Unlisten

type Unlisten struct {
	CommonIn
	Data struct {
		ReqID string `json:"req_id"`
	} `json:"data"`
}

func (*Unlisten) Validate

func (m *Unlisten) Validate(ctx context.Context) error

type Unlistened

type Unlistened struct {
	CommonOut
	Data struct {
		Success bool `json:"success"`
	} `json:"data"`
}

func NewUnlistened

func NewUnlistened() *Unlistened

type Validator

type Validator interface {
	Validate(ctx context.Context) error
}

type VoteTally

type VoteTally struct {
	CommonOut
	Data struct {
		VoteTally *VoteTallyData `json:"vote_tally"`
	} `json:"data"`
}

func NewVoteTally

func NewVoteTally(data *VoteTallyData) *VoteTally

type VoteTallyData

type VoteTallyData struct {
	TotalActivatedStake float64            `json:"total_activated_stake"`
	TotalVotes          float64            `json:"total_votes"`
	DecayWeight         float64            `json:"decay_weight"`
	Producers           []statedb.Producer `json:"producers"`
}

Jump to

Keyboard shortcuts

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