Documentation
¶
Index ¶
- type NullGasBankService
- type Service
- func (s *Service) CancelRequest(ctx context.Context, id int) error
- func (s *Service) CreateDataSource(ctx context.Context, dataSource *models.OracleDataSource) (*models.OracleDataSource, error)
- func (s *Service) CreateOracle(ctx context.Context, name string, description string, ...) (*models.Oracle, error)
- func (s *Service) CreateRequest(ctx context.Context, userID int, oracleID int, callbackAddress string, ...) (*models.OracleRequest, error)
- func (s *Service) DeleteDataSource(ctx context.Context, id string) error
- func (s *Service) DeleteOracle(ctx context.Context, id int) error
- func (s *Service) ExecuteUpdate(ctx context.Context, id string) error
- func (s *Service) FetchAndTransformData(ctx context.Context, id string) (string, error)
- func (s *Service) GetDataHistory(ctx context.Context, dataSourceID string, limit int) ([]*models.OracleUpdate, error)
- func (s *Service) GetDataSource(ctx context.Context, id string) (*models.OracleDataSource, error)
- func (s *Service) GetLatestData(ctx context.Context, dataSourceID string) (string, error)
- func (s *Service) GetOracle(ctx context.Context, id int) (*models.Oracle, error)
- func (s *Service) GetRequest(ctx context.Context, id int) (*models.OracleRequest, error)
- func (s *Service) ListDataSources(ctx context.Context) ([]*models.OracleDataSource, error)
- func (s *Service) ListOracles(ctx context.Context, userID int, offset int, limit int) ([]*models.Oracle, error)
- func (s *Service) ListRequests(ctx context.Context, userID int, offset int, limit int) ([]*models.OracleRequest, error)
- func (s *Service) Start(ctx context.Context) error
- func (s *Service) Stop(ctx context.Context) error
- func (s *Service) TriggerUpdate(ctx context.Context, dataSourceID string) error
- func (s *Service) UpdateBlockchainContract(ctx context.Context, id string, data string) (string, error)
- func (s *Service) UpdateDataSource(ctx context.Context, dataSource *models.OracleDataSource) (*models.OracleDataSource, error)
- func (s *Service) UpdateOracle(ctx context.Context, id int, name string, description string, active bool) (*models.Oracle, error)
- type Wrapper
- func (w *Wrapper) CancelRequest(ctx context.Context, id int) error
- func (w *Wrapper) CreateDataSource(ctx context.Context, name string, url string, method string, headers string, ...) (*models.OracleDataSource, error)
- func (w *Wrapper) CreateOracle(ctx context.Context, name string, description string, ...) (*models.Oracle, error)
- func (w *Wrapper) CreateRequest(ctx context.Context, userID int, oracleID int, callbackAddress string, ...) (*models.OracleRequest, error)
- func (w *Wrapper) DeleteDataSource(ctx context.Context, id string) error
- func (w *Wrapper) DeleteOracle(ctx context.Context, id int) error
- func (w *Wrapper) GetDataHistory(ctx context.Context, dataSourceID string, limit int) ([]*models.OracleUpdate, error)
- func (w *Wrapper) GetDataSource(ctx context.Context, id string) (*models.OracleDataSource, error)
- func (w *Wrapper) GetLatestData(ctx context.Context, dataSourceID string) (string, error)
- func (w *Wrapper) GetOracle(ctx context.Context, id int) (*models.Oracle, error)
- func (w *Wrapper) GetRequest(ctx context.Context, id int) (*models.OracleRequest, error)
- func (w *Wrapper) ListDataSources(ctx context.Context) ([]*models.OracleDataSource, error)
- func (w *Wrapper) ListOracles(ctx context.Context, userID int, offset int, limit int) ([]*models.Oracle, error)
- func (w *Wrapper) ListRequests(ctx context.Context, userID int, offset int, limit int) ([]*models.OracleRequest, error)
- func (w *Wrapper) Start(ctx context.Context) error
- func (w *Wrapper) Stop(ctx context.Context) error
- func (w *Wrapper) TriggerUpdate(ctx context.Context, dataSourceID string) error
- func (w *Wrapper) UpdateDataSource(ctx context.Context, id string, url string, method string, headers string, ...) (*models.OracleDataSource, error)
- func (w *Wrapper) UpdateOracle(ctx context.Context, id int, name string, description string, active bool) (*models.Oracle, error)
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 ¶
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 ¶
DeleteDataSource deletes an Oracle data source
func (*Service) DeleteOracle ¶
DeleteOracle deletes an oracle
func (*Service) ExecuteUpdate ¶
ExecuteUpdate executes a complete update cycle for a data source
func (*Service) FetchAndTransformData ¶
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 ¶
GetDataSource retrieves an Oracle data source by ID
func (*Service) GetLatestData ¶
GetLatestData gets the latest data for a data source
func (*Service) GetRequest ¶
GetRequest gets an oracle request by ID
func (*Service) ListDataSources ¶
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) TriggerUpdate ¶
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
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper implements the models.OracleService interface by delegating to the core implementation
func NewWrapper ¶
NewWrapper creates a new wrapper around the core oracle service
func (*Wrapper) CancelRequest ¶
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 ¶
DeleteDataSource deletes an oracle data source
func (*Wrapper) DeleteOracle ¶
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 ¶
GetDataSource gets an oracle data source by ID
func (*Wrapper) GetLatestData ¶
GetLatestData gets the latest data for an oracle data source
func (*Wrapper) GetRequest ¶
GetRequest gets an oracle request by ID
func (*Wrapper) ListDataSources ¶
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) TriggerUpdate ¶
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