redstone_tx_sync

package
v0.2.159 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDownloader

type BlockDownloader struct {
	*task.Task

	Output chan *BlockInfoPayload
	// contains filtered or unexported fields
}

func NewBlockDownloader

func NewBlockDownloader(config *config.Config) (self *BlockDownloader)

When started, this task checks database for the latest block synced and store the result in lastSyncedBlockHeight field Then, compare lastSyncedBlockHeight to the current external network's block height and loads info for all of the missing blocks for the indicated range Lastly, it emits to the Output channel block's height, block's hash and all transactions that this block contains and update lastSyncedBlockHeight to the last processed block

func (*BlockDownloader) WithEthClient

func (self *BlockDownloader) WithEthClient(ethClient *ethclient.Client) *BlockDownloader

func (*BlockDownloader) WithInitStartBlockHeight

func (self *BlockDownloader) WithInitStartBlockHeight(db *gorm.DB) *BlockDownloader

func (*BlockDownloader) WithMonitor

func (self *BlockDownloader) WithMonitor(monitor monitoring.Monitor) *BlockDownloader

type BlockInfoPayload

type BlockInfoPayload struct {
	Transactions types.Transactions
	Height       int64
	Hash         string
}

type Controller

type Controller struct {
	*task.Task
}

func NewController

func NewController(config *config.Config) (self *Controller, err error)

type Input

type Input struct {
	Function string   `json:"function"`
	Points   int      `json:"points"`
	AdminId  string   `json:"adminId"`
	Members  []Member `json:"members"`
	NoBoost  bool     `json:"noBoost"`
}

func (Input) MarshalJSON

func (input Input) MarshalJSON() ([]byte, error)

type LastSyncedBlockPayload

type LastSyncedBlockPayload struct {
	Height int64
	Hash   string
}

type Member

type Member struct {
	Id    string   `json:"id"`
	Roles []string `json:"roles"`
	TxId  string   `json:"txId"`
}

type SenderDiscordIdPayload

type SenderDiscordIdPayload struct {
	Type   string `json:"type"`
	Result struct {
		UserId string `json:"userId"`
	} `json:"result"`
	ErrorMessage string `json:"errorMessage"`
}

type Store

type Store struct {
	*task.Processor[*LastSyncedBlockPayload, *LastSyncedBlockPayload]
	// contains filtered or unexported fields
}

Store is responsible for saving last synced block height in sync_state table It updates the table periodically to not overload database with updates done each time after new block has been processed

func NewStore

func NewStore(config *config.Config) (self *Store)

func (*Store) WithDb

func (self *Store) WithDb(v *gorm.DB) *Store

func (*Store) WithInputChannel

func (self *Store) WithInputChannel(v chan *LastSyncedBlockPayload) *Store

func (*Store) WithMonitor

func (self *Store) WithMonitor(v monitoring.Monitor) *Store

type Syncer

type Syncer struct {
	*task.Task

	Output chan *LastSyncedBlockPayload
	// contains filtered or unexported fields
}

func NewSyncer

func NewSyncer(config *config.Config) (self *Syncer)

This task receives block info in the input channel, iterate through all of the block's transactions in order to check if any of it contains Redstone data and if so - writes an interaction to Warpy. It emits block height and block hash in the Output channel

func (*Syncer) WithInputChannel

func (self *Syncer) WithInputChannel(v chan *BlockInfoPayload) *Syncer

func (*Syncer) WithMonitor

func (self *Syncer) WithMonitor(monitor monitoring.Monitor) *Syncer

func (*Syncer) WithSequencerClient

func (self *Syncer) WithSequencerClient(sequencerClient *sequencer.Client) *Syncer

Jump to

Keyboard shortcuts

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