Documentation ¶
Index ¶
- func GetSessionFromRequest(pocketService PocketDispatcher, req *models.SendRelayRequest) (*models.Session, error)
- type BasicClient
- func (r BasicClient) GetLatestBlockHeight() (*models.GetLatestBlockHeightResponse, error)
- func (r BasicClient) GetLatestStakedApplications() ([]*models.PoktApplication, error)
- func (r BasicClient) GetSession(req *models.GetSessionRequest) (*models.GetSessionResponse, error)
- func (r BasicClient) SendRelay(req *models.SendRelayRequest) (*models.SendRelayResponse, error)
- type PocketDispatcher
- type PocketRelayer
- type PocketService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSessionFromRequest ¶
func GetSessionFromRequest(pocketService PocketDispatcher, req *models.SendRelayRequest) (*models.Session, error)
GetSessionFromRequest obtains a session from a relay request. Parameters:
- req: SendRelayRequest instance containing the relay request parameters.
Returns:
- (*GetSessionResponse): Session response.
- (error): Error, if any.
Types ¶
type BasicClient ¶
type BasicClient struct {
// contains filtered or unexported fields
}
BasicClient represents a basic client with a logging, full node host, and a global request timeout.
func NewBasicClient ¶
func NewBasicClient(fullNodeHost string, userAgent string, timeout time.Duration) (*BasicClient, error)
NewBasicClient creates a new BasicClient instance. Parameters:
- fullNodeHost: Full node host address.
- logging: Logger instance.
- timeout: Global request timeout duration.
Returns:
- (*BasicClient): New BasicClient instance.
- (error): Error, if any.
func (BasicClient) GetLatestBlockHeight ¶
func (r BasicClient) GetLatestBlockHeight() (*models.GetLatestBlockHeightResponse, error)
GetLatestBlockHeight gets the latest block height from the full node. Returns:
- (*GetLatestBlockHeightResponse): Latest block height response.
- (error): Error, if any.
func (BasicClient) GetLatestStakedApplications ¶
func (r BasicClient) GetLatestStakedApplications() ([]*models.PoktApplication, error)
GetLatestStakedApplications obtains all the applications from the latest block then filters for staked. Returns:
- ([]*models.PoktApplication): list of staked applications
- (error): Error, if any.
func (BasicClient) GetSession ¶
func (r BasicClient) GetSession(req *models.GetSessionRequest) (*models.GetSessionResponse, error)
GetSession obtains a session from the full node. Parameters:
- req: GetSessionRequest instance containing the request parameters.
Returns:
- (*GetSessionResponse): Session response.
- (error): Error, if any.
func (BasicClient) SendRelay ¶
func (r BasicClient) SendRelay(req *models.SendRelayRequest) (*models.SendRelayResponse, error)
SendRelay sends a relay request to the full node. Parameters:
- req: SendRelayRequest instance containing the relay request parameters.
Returns:
- (*SendRelayResponse): Relay response.
- (error): Error, if any.
type PocketDispatcher ¶
type PocketDispatcher interface {
GetSession(req *models.GetSessionRequest) (*models.GetSessionResponse, error)
}
type PocketRelayer ¶
type PocketRelayer interface {
SendRelay(req *models.SendRelayRequest) (*models.SendRelayResponse, error)
}
type PocketService ¶
type PocketService interface { PocketRelayer PocketDispatcher GetLatestBlockHeight() (*models.GetLatestBlockHeightResponse, error) GetLatestStakedApplications() ([]*models.PoktApplication, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.