pokt_v0

package
v0.0.0-...-5905db3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

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

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)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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