oracle

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: 21 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 oracle operations

func NewService

func NewService(
	cfg *config.Config,
	log *logger.Logger,
	oracleRepository models.OracleRepository,
	blockchainClient *blockchain.Client,
	gasBankService *gasbank.Service,
	teeManager *tee.Manager,
) *Service

NewService creates a new oracle service

func (*Service) CreateOracle

func (s *Service) CreateOracle(
	ctx context.Context,
	name, description string,
	sourceType models.OracleDataSourceType,
	url, method string,
	headers map[string]interface{},
	body string,
	authType models.OracleAuthType,
	authParams map[string]interface{},
	path string,
	transform string,
	schedule string,
	userID int,
) (*models.Oracle, error)

CreateOracle creates a new oracle data source configuration

func (*Service) CreateOracleRequest

func (s *Service) CreateOracleRequest(
	ctx context.Context,
	oracleID int,
	userID int,
	params map[string]interface{},
	callbackAddress string,
	callbackMethod string,
	gasFee float64,
) (*models.OracleRequest, error)

CreateOracleRequest creates a new oracle data request

func (*Service) DeleteOracle

func (s *Service) DeleteOracle(ctx context.Context, id, userID int) error

DeleteOracle deletes an oracle data source configuration

func (*Service) GetOracle

func (s *Service) GetOracle(ctx context.Context, id int) (*models.Oracle, error)

GetOracle gets an oracle data source configuration by ID

func (*Service) GetOracleByName

func (s *Service) GetOracleByName(ctx context.Context, name string) (*models.Oracle, error)

GetOracleByName gets an oracle data source configuration by name

func (*Service) GetOracleRequest

func (s *Service) GetOracleRequest(ctx context.Context, id int) (*models.OracleRequest, error)

GetOracleRequest gets an oracle data request by ID

func (*Service) GetOracleStatistics

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

GetOracleStatistics gets statistics for oracle data

func (*Service) ListOracleRequests

func (s *Service) ListOracleRequests(ctx context.Context, oracleID int, offset, limit int) ([]*models.OracleRequest, error)

ListOracleRequests lists oracle data requests for an oracle

func (*Service) ListOracles

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

ListOracles lists oracle data source configurations

func (*Service) Start

func (s *Service) Start() error

Start starts the oracle service

func (*Service) Stop

func (s *Service) Stop()

Stop stops the oracle service

func (*Service) UpdateOracle

func (s *Service) UpdateOracle(
	ctx context.Context,
	id int,
	name, description string,
	sourceType models.OracleDataSourceType,
	url, method string,
	headers map[string]interface{},
	body string,
	authType models.OracleAuthType,
	authParams map[string]interface{},
	path string,
	transform string,
	schedule string,
	active bool,
	userID int,
) (*models.Oracle, error)

UpdateOracle updates an oracle data source configuration

Jump to

Keyboard shortcuts

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