rpcwatcher

package
v0.0.0-...-a4031b1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

README

rpc-watcher

Receives block events from nodes to update the status of transaction tickets.

See also ticket-watcher.

Dependencies & Licenses

The list of non-{Cosmos, AiB, Tendermint} dependencies and their licenses are:

Module License
go.uber.org/zap MIT
go-playground/validator MIT
jackc/pgx MIT

Documentation

Index

Constants

View Source
const (
	EventsTx    = "tm.event='Tx'"
	EventsBlock = "tm.event='NewBlock'"
)

Variables

View Source
var (
	EventsToSubTo = []string{EventsTx, EventsBlock}

	StandardMappings = map[string][]DataHandler{
		EventsTx: {
			HandleMessage,
		},
		EventsBlock: {
			HandleNewBlock,
		},
	}
	CosmosHubMappings = map[string][]DataHandler{
		EventsTx: {
			HandleMessage,
		},
		EventsBlock: {
			HandleNewBlock,
			HandleCosmosHubBlock,
		},
	}
)

Functions

func HandleCosmosHubBlock

func HandleCosmosHubBlock(w *Watcher, data coretypes.ResultEvent)

func HandleCosmosHubLPCreated

func HandleCosmosHubLPCreated(w *Watcher, data coretypes.ResultEvent, chainName, key string, height int64)

func HandleIBCAckPacket

func HandleIBCAckPacket(w *Watcher, data coretypes.ResultEvent, chainName, txHash string, height int64)

func HandleIBCReceivePacket

func HandleIBCReceivePacket(w *Watcher, data coretypes.ResultEvent, chainName, txHash string, height int64)

func HandleIBCSenderEvent

func HandleIBCSenderEvent(w *Watcher, data coretypes.ResultEvent, chainName, txHash, key string, height int64)

func HandleIBCTimeoutPacket

func HandleIBCTimeoutPacket(w *Watcher, data coretypes.ResultEvent, chainName, txHash string, height int64)

func HandleMessage

func HandleMessage(w *Watcher, data coretypes.ResultEvent)

func HandleNewBlock

func HandleNewBlock(w *Watcher, data coretypes.ResultEvent)

func HandleSwapTransaction

func HandleSwapTransaction(w *Watcher, data coretypes.ResultEvent, chainName, key string, height int64)

func Start

func Start(watcher *Watcher, ctx context.Context)

Types

type Ack

type Ack struct {
	Result string `json:"result"`
}

type Config

type Config struct {
	DatabaseConnectionURL string `validate:"required"`
	RedisURL              string `validate:"required,hostname_port"`
	ApiURL                string `validate:"required,url"`
	ProfilingServerURL    string `validate:"hostname_port"`
	Debug                 bool
	JSONLogs              bool
}

func ReadConfig

func ReadConfig() (*Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type DataHandler

type DataHandler func(watcher *Watcher, event coretypes.ResultEvent)

type Events

type Events map[string][]string

type VerifyTraceResponse

type VerifyTraceResponse struct {
	VerifyTrace struct {
		IbcDenom  string `json:"ibc_denom"`
		BaseDenom string `json:"base_denom"`
		Verified  bool   `json:"verified"`
		Path      string `json:"path"`
		Trace     []struct {
			Channel          string `json:"channel"`
			Port             string `json:"port"`
			ChainName        string `json:"chain_name"`
			CounterpartyName string `json:"counterparty_name"`
		} `json:"trace"`
	} `json:"verify_trace"`
}

type Watcher

type Watcher struct {
	Name         string
	DataChannel  chan coretypes.ResultEvent
	ErrorChannel chan error
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(
	endpoint, chainName string,
	logger *zap.SugaredLogger,
	apiUrl, grpcEndpoint string,
	db *database.Instance,
	s *store.Store,
	subscriptions []string,
	eventTypeMappings map[string][]DataHandler,
) (*Watcher, error)

type WsResponse

type WsResponse struct {
	Event coretypes.ResultEvent `json:"result"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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