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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullGasBankService

type NullGasBankService struct{}

NullGasBankService is a minimal implementation of the GasBank service interface that can be used when a real implementation is not needed

type Service

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

Service provides Oracle functionality

func NewService

func NewService(
	config *config.Config,
	repository models.OracleRepository,
	blockchainClient blockchain.Client,
	teeManager *tee.Manager,
) (*Service, error)

NewService creates a new Oracle service

func (*Service) CancelRequest

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

CancelRequest cancels an oracle request

func (*Service) CreateDataSource

func (s *Service) CreateDataSource(ctx context.Context, dataSource *models.OracleDataSource) (*models.OracleDataSource, error)

CreateDataSource creates a new Oracle data source

func (*Service) CreateOracle

func (s *Service) CreateOracle(ctx context.Context, name string, description string, oracleType models.OracleDataSourceType,
	url string, method string, headers models.JsonMap, body string, authType models.OracleAuthType,
	authParams models.JsonMap, path string, transform string, schedule string, userID int) (*models.Oracle, error)

CreateOracle creates a new oracle

func (*Service) CreateRequest

func (s *Service) CreateRequest(ctx context.Context, userID int, oracleID int, callbackAddress string, callbackMethod string) (*models.OracleRequest, error)

CreateRequest creates a new oracle request

func (*Service) DeleteDataSource

func (s *Service) DeleteDataSource(ctx context.Context, id string) error

DeleteDataSource deletes an Oracle data source

func (*Service) DeleteOracle

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

DeleteOracle deletes an oracle

func (*Service) ExecuteUpdate

func (s *Service) ExecuteUpdate(ctx context.Context, id string) error

ExecuteUpdate executes a complete update cycle for a data source

func (*Service) FetchAndTransformData

func (s *Service) FetchAndTransformData(ctx context.Context, id string) (string, error)

FetchAndTransformData fetches and transforms data for a data source

func (*Service) GetDataHistory

func (s *Service) GetDataHistory(ctx context.Context, dataSourceID string, limit int) ([]*models.OracleUpdate, error)

GetDataHistory gets the data history for a data source

func (*Service) GetDataSource

func (s *Service) GetDataSource(ctx context.Context, id string) (*models.OracleDataSource, error)

GetDataSource retrieves an Oracle data source by ID

func (*Service) GetLatestData

func (s *Service) GetLatestData(ctx context.Context, dataSourceID string) (string, error)

GetLatestData gets the latest data for a data source

func (*Service) GetOracle

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

GetOracle gets an oracle by ID

func (*Service) GetRequest

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

GetRequest gets an oracle request by ID

func (*Service) ListDataSources

func (s *Service) ListDataSources(ctx context.Context) ([]*models.OracleDataSource, error)

ListDataSources retrieves all Oracle data sources

func (*Service) ListOracles

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

ListOracles lists all oracles

func (*Service) ListRequests

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

ListRequests lists oracle requests

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start starts the oracle service

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop stops the oracle service

func (*Service) TriggerUpdate

func (s *Service) TriggerUpdate(ctx context.Context, dataSourceID string) error

TriggerUpdate triggers an update for a data source

func (*Service) UpdateBlockchainContract

func (s *Service) UpdateBlockchainContract(ctx context.Context, id string, data string) (string, error)

UpdateBlockchainContract updates the blockchain contract with data

func (*Service) UpdateDataSource

func (s *Service) UpdateDataSource(ctx context.Context, dataSource *models.OracleDataSource) (*models.OracleDataSource, error)

UpdateDataSource updates an Oracle data source

func (*Service) UpdateOracle

func (s *Service) UpdateOracle(ctx context.Context, id int, name string, description string, active bool) (*models.Oracle, error)

UpdateOracle updates an oracle

type Wrapper

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

Wrapper implements the models.OracleService interface by delegating to the core implementation

func NewWrapper

func NewWrapper(coreService *oracle.Service) *Wrapper

NewWrapper creates a new wrapper around the core oracle service

func (*Wrapper) CancelRequest

func (w *Wrapper) CancelRequest(ctx context.Context, id int) error

CancelRequest cancels an oracle request

func (*Wrapper) CreateDataSource

func (w *Wrapper) CreateDataSource(ctx context.Context, name string, url string, method string, headers string,
	contractScript string, dataPath string, transformScript string, updateInterval int) (*models.OracleDataSource, error)

CreateDataSource creates a new oracle data source

func (*Wrapper) CreateOracle

func (w *Wrapper) CreateOracle(ctx context.Context, name string, description string, oracleType models.OracleDataSourceType,
	url string, method string, headers models.JsonMap, body string, authType models.OracleAuthType,
	authParams models.JsonMap, path string, transform string, schedule string, userID int) (*models.Oracle, error)

CreateOracle creates a new oracle

func (*Wrapper) CreateRequest

func (w *Wrapper) CreateRequest(ctx context.Context, userID int, oracleID int, callbackAddress string, callbackMethod string) (*models.OracleRequest, error)

CreateRequest creates a new oracle request

func (*Wrapper) DeleteDataSource

func (w *Wrapper) DeleteDataSource(ctx context.Context, id string) error

DeleteDataSource deletes an oracle data source

func (*Wrapper) DeleteOracle

func (w *Wrapper) DeleteOracle(ctx context.Context, id int) error

DeleteOracle deletes an oracle

func (*Wrapper) GetDataHistory

func (w *Wrapper) GetDataHistory(ctx context.Context, dataSourceID string, limit int) ([]*models.OracleUpdate, error)

GetDataHistory gets the data history for an oracle data source

func (*Wrapper) GetDataSource

func (w *Wrapper) GetDataSource(ctx context.Context, id string) (*models.OracleDataSource, error)

GetDataSource gets an oracle data source by ID

func (*Wrapper) GetLatestData

func (w *Wrapper) GetLatestData(ctx context.Context, dataSourceID string) (string, error)

GetLatestData gets the latest data for an oracle data source

func (*Wrapper) GetOracle

func (w *Wrapper) GetOracle(ctx context.Context, id int) (*models.Oracle, error)

GetOracle gets an oracle by ID

func (*Wrapper) GetRequest

func (w *Wrapper) GetRequest(ctx context.Context, id int) (*models.OracleRequest, error)

GetRequest gets an oracle request by ID

func (*Wrapper) ListDataSources

func (w *Wrapper) ListDataSources(ctx context.Context) ([]*models.OracleDataSource, error)

ListDataSources lists all oracle data sources

func (*Wrapper) ListOracles

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

ListOracles lists all oracles

func (*Wrapper) ListRequests

func (w *Wrapper) ListRequests(ctx context.Context, userID int, offset int, limit int) ([]*models.OracleRequest, error)

ListRequests lists oracle requests

func (*Wrapper) Start

func (w *Wrapper) Start(ctx context.Context) error

Start starts the oracle service

func (*Wrapper) Stop

func (w *Wrapper) Stop(ctx context.Context) error

Stop stops the oracle service

func (*Wrapper) TriggerUpdate

func (w *Wrapper) TriggerUpdate(ctx context.Context, dataSourceID string) error

TriggerUpdate triggers an update for an oracle data source

func (*Wrapper) UpdateDataSource

func (w *Wrapper) UpdateDataSource(ctx context.Context, id string, url string, method string, headers string,
	contractScript string, dataPath string, transformScript string, updateInterval int, active bool) (*models.OracleDataSource, error)

UpdateDataSource updates an oracle data source

func (*Wrapper) UpdateOracle

func (w *Wrapper) UpdateOracle(ctx context.Context, id int, name string, description string, active bool) (*models.Oracle, error)

UpdateOracle updates an oracle

Jump to

Keyboard shortcuts

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