logic

package
v0.0.0-...-ae3d888 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockProposedCallback

func BlockProposedCallback(rpcURL, beaconURL, networkName string, log types.Log)

BlockProposedCallback is a callback for the "BlockProposed" event.

func GetBlobData

func GetBlobData(cfg *Config, blobHashes []string) ([]struct {
	Blob          string `bson:"blob_data"`
	KzgCommitment string `bson:"kzg_commitment"`
}, error)

GetBlobData retrieves blob data from MongoDB based on blobHashes.

Types

type CallbackFunc

type CallbackFunc func(string, string, string, types.Log)

CallbackFunc represents the type of the callback function for handling events.

type Config

type Config struct {
	Networks []NetworkConfig
	MongoDB  MongoDBConfig
	Server   ServerConfig
}

Config struct holds the overall configuration for the application.

func GetConfig

func GetConfig() (*Config, error)

GetConfig loads the configuration from environment variables or a config file.

type IndexedEvent

type IndexedEvent struct {
	Contract  string
	EventName string
	EventHash string
	Callback  CallbackFunc
}

IndexedEvent struct represents the configuration for an indexed event.

type MongoDBClient

type MongoDBClient struct {
	Client *mongo.Client
}

MongoDBClient holds the MongoDB client instance.

func NewMongoDBClient

func NewMongoDBClient(cfg MongoDBConfig) (*MongoDBClient, error)

NewMongoDBClient creates a new MongoDB client.

func (*MongoDBClient) Close

func (mc *MongoDBClient) Close()

Close closes the MongoDB client connection.

type MongoDBConfig

type MongoDBConfig struct {
	Host     string
	Port     int
	Username string
	Password string
	Database string
}

MongoDBConfig holds the configuration for MongoDB.

type NetworkConfig

type NetworkConfig struct {
	RPCURL        string
	BeaconURL     string // Add this field
	NetworkName   string
	IndexedEvents []IndexedEvent
}

NetworkConfig struct represents the configuration for a network.

type Response

type Response struct {
	Data []struct {
		Index            string `json:"index"`
		Blob             string `json:"blob"`
		KzgCommitment    string `json:"kzg_commitment"`
		KzgCommitmentHex []byte `json:"-"`
	} `json:"data"`
}

type Server

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

func NewServer

func NewServer(cfg *Config) *Server

func (*Server) Start

func (s *Server) Start() error

type ServerConfig

type ServerConfig struct {
	Port string
}

ServerConfig struct represents the configuration for the api server.

Jump to

Keyboard shortcuts

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