server

package
v1.3.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultWSMaxSession = 10
View Source
const (
	UrlAdmin = "/admin"
)

Variables

This section is empty.

Functions

func ChainInjector

func ChainInjector(srv *Manager) echo.MiddlewareFunc

func Chunk

func Chunk() echo.MiddlewareFunc

Chunk()

func HTTPErrorHandler

func HTTPErrorHandler(err error, c echo.Context)

func JsonRpc

func JsonRpc() echo.MiddlewareFunc

JsonRpc()

func NoneMiddlewareFunc

func NoneMiddlewareFunc(next echo.HandlerFunc) echo.HandlerFunc

func Redoc

func Redoc(opts RedocOpts) echo.HandlerFunc

func Unauthorized

func Unauthorized(readOnly bool) echo.MiddlewareFunc

Types

type BTPNotification added in v1.3.0

type BTPNotification struct {
	Header common.HexBytes `json:"header"`
	Proof  string          `json:"proof,omitempty"`
}

type BTPRequest added in v1.3.0

type BTPRequest struct {
	Height    common.HexInt64 `json:"height"`
	NetworkId common.HexInt64 `json:"networkID"`
	ProofFlag bool            `json:"proofFlag"`
	// contains filtered or unexported fields
}

type BlockNotification

type BlockNotification struct {
	Hash    common.HexBytes       `json:"hash"`
	Height  common.HexInt64       `json:"height"`
	Indexes [][]common.HexInt32   `json:"indexes,omitempty"`
	Events  [][][]common.HexInt32 `json:"events,omitempty"`
	Logs    [][][]module.EventLog `json:"logs,omitempty"`
}

type BlockRequest

type BlockRequest struct {
	Height       common.HexInt64 `json:"height"`
	EventFilters []*EventFilter  `json:"eventFilters,omitempty"`
	Logs         common.HexInt32 `json:"logs,omitempty"`
	// contains filtered or unexported fields
}

func (*BlockRequest) Compile added in v1.3.0

func (r *BlockRequest) Compile() error

type Config added in v1.2.14

type Config struct {
	ServerAddress         string
	JSONRPCDump           bool
	JSONRPCIncludeDebug   bool
	JSONRPCRosetta        bool
	JSONRPCDefaultChannel string
	JSONRPCBatchLimit     int
	WSMaxSession          int
}

type EventFilter

type EventFilter struct {
	Addr      *common.Address `json:"addr,omitempty"`
	Signature string          `json:"event"`
	Indexed   []*string       `json:"indexed,omitempty"`
	Data      []*string       `json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*EventFilter) Compile added in v1.3.0

func (f *EventFilter) Compile() error

func (*EventFilter) MatchEvents added in v1.3.0

func (f *EventFilter) MatchEvents(r module.Receipt, includeLogs bool) ([]common.HexInt32, []module.EventLog, error)

func (*EventFilter) MatchLog added in v1.3.0

func (f *EventFilter) MatchLog(el module.EventLog) bool

type EventFilters added in v1.3.0

type EventFilters []*EventFilter

func (EventFilters) FilteredByLogBloom added in v1.3.0

func (fs EventFilters) FilteredByLogBloom(lb module.LogsBloom) (EventFilters, bool)

FilteredByLogBloom returns applicable event filters. If there is no event filters, then it returns false along with filters.

func (EventFilters) MatchEvents added in v1.3.0

func (fs EventFilters) MatchEvents(r module.Receipt, includeLogs bool) ([]common.HexInt32, []module.EventLog, error)

type EventNotification

type EventNotification struct {
	Hash   common.HexBytes   `json:"hash"`
	Height common.HexInt64   `json:"height"`
	Index  common.HexInt32   `json:"index"`
	Events []common.HexInt32 `json:"events"`
	Logs   []module.EventLog `json:"logs,omitempty"`
}

type EventRequest

type EventRequest struct {
	EventFilter
	Height common.HexInt64 `json:"height"`
	Logs   common.HexInt32 `json:"logs,omitempty""`

	Filters EventFilters `json:"eventFilters,omitempty"`
}

func (*EventRequest) Compile added in v1.3.0

func (f *EventRequest) Compile() (EventFilters, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(
	config *Config,
	wallet module.Wallet,
	l log.Logger) *Manager

func (*Manager) AdminEchoGroup

func (srv *Manager) AdminEchoGroup(m ...echo.MiddlewareFunc) *echo.Group

func (*Manager) BatchLimit added in v1.2.0

func (srv *Manager) BatchLimit() int

func (*Manager) Chain

func (srv *Manager) Chain(channel string) module.Chain

func (*Manager) CheckDebug

func (srv *Manager) CheckDebug() echo.MiddlewareFunc

func (*Manager) CheckRosetta added in v1.2.13

func (srv *Manager) CheckRosetta() echo.MiddlewareFunc

func (*Manager) IncludeDebug

func (srv *Manager) IncludeDebug() bool

func (*Manager) MessageDump

func (srv *Manager) MessageDump() bool

func (*Manager) RegisterAPIHandler added in v0.9.6

func (srv *Manager) RegisterAPIHandler(g *echo.Group)

func (*Manager) RegisterMetricsHandler added in v0.9.6

func (srv *Manager) RegisterMetricsHandler(g *echo.Group)

func (*Manager) RemoveChain

func (srv *Manager) RemoveChain(channel string)

func (*Manager) Rosetta added in v1.2.13

func (srv *Manager) Rosetta() bool

func (*Manager) SetBatchLimit added in v1.2.0

func (srv *Manager) SetBatchLimit(limitOfBatch int)

func (*Manager) SetChain

func (srv *Manager) SetChain(channel string, chain module.Chain)

func (*Manager) SetDefaultChannel

func (srv *Manager) SetDefaultChannel(jsonrpcDefaultChannel string)

func (*Manager) SetIncludeDebug

func (srv *Manager) SetIncludeDebug(enable bool)

func (*Manager) SetMessageDump

func (srv *Manager) SetMessageDump(enable bool)

func (*Manager) SetRosetta added in v1.2.13

func (srv *Manager) SetRosetta(enable bool)

func (*Manager) SetWSMaxSession added in v1.2.14

func (srv *Manager) SetWSMaxSession(limit int)

func (*Manager) Start

func (srv *Manager) Start() error

func (*Manager) Stop

func (srv *Manager) Stop() error

type RedocOpts

type RedocOpts struct {
	// BasePath for the UI path, defaults to: /
	BasePath string
	// Path combines with BasePath for the full UI path, defaults to: docs
	Path string
	// SpecURL the url to find the spec for
	SpecURL string
	// RedocURL for the js that generates the redoc site, defaults to: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js
	RedocURL string
	// Title for the documentation site, default to: API documentation
	Title string
}

func (*RedocOpts) EnsureDefaults

func (r *RedocOpts) EnsureDefaults()

type WSResponse

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

type WebSocketConn added in v1.3.0

type WebSocketConn interface {
	Close() error
	WriteJSON(v interface{}) error
	ReadMessage() (messageType int, p []byte, err error)
	NextReader() (messageType int, r io.Reader, err error)
}

type WebSocketUpgrader added in v1.3.0

type WebSocketUpgrader interface {
	Upgrade(ctx echo.Context) (WebSocketConn, error)
}

func NewWebSocketUpgrader added in v1.3.0

func NewWebSocketUpgrader() WebSocketUpgrader

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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