random

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service handles random number generation operations

func NewService

func NewService(
	cfg *config.Config,
	log *logger.Logger,
	randomRepository models.RandomRepository,
	blockchainClient *blockchain.Client,
	teeManager *tee.Manager,
) *Service

NewService creates a new random service

func (*Service) CreateRequest

func (s *Service) CreateRequest(
	ctx context.Context,
	userID int,
	callbackAddress string,
	callbackMethod string,
	seed []byte,
	numBytes int,
	delayBlocks int,
	gasFee float64,
) (*models.RandomRequest, error)

CreateRequest creates a new random number request

func (*Service) GetRandomStatistics

func (s *Service) GetRandomStatistics(ctx context.Context) (map[string]interface{}, error)

GetRandomStatistics gets statistics for random number generation

func (*Service) GetRequest

func (s *Service) GetRequest(ctx context.Context, id int) (*models.RandomRequest, error)

GetRequest gets a random number request by ID

func (*Service) ListRequests

func (s *Service) ListRequests(ctx context.Context, userID int, offset, limit int) ([]*models.RandomRequest, error)

ListRequests lists random number requests for a user

func (*Service) Start

func (s *Service) Start() error

Start starts the random service

func (*Service) Stop

func (s *Service) Stop()

Stop stops the random service

func (*Service) VerifyRandomNumber

func (s *Service) VerifyRandomNumber(ctx context.Context, requestID int, randomNumber, proof []byte) (bool, error)

VerifyRandomNumber verifies a random number

Jump to

Keyboard shortcuts

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