api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiServer

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

func NewApiServer

func NewApiServer(opts ...Option) (*ApiServer, error)

func (*ApiServer) GetCirculatingSupply

func (s *ApiServer) GetCirculatingSupply() (float64, error)

GetCirculatingSupply calculates and returns the current circulating supply.

func (*ApiServer) Run

func (s *ApiServer) Run() error

func (*ApiServer) Shutdown

func (s *ApiServer) Shutdown() error

type Option

type Option func(*ApiServer)

func WithEstimatedSupply

func WithEstimatedSupply(supplyMap map[string]float64) Option

WithEstimatedSupply sets the estimated supply by day. The map keys are dates in "YYYY-MM-DD" format.

func WithListenAddr

func WithListenAddr(addr string) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithRpcClient

func WithRpcClient(client RpcClient) Option

WithRpcClient sets the solana RPC client for the ApiServer.

type RpcClient

type RpcClient interface {
	GetTotalSupply(ctx context.Context) (float64, error)
}

type SolanaClient

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

SolanaClient is an HTTP client for the Solana JSON-RPC API.

func NewSolanaClient

func NewSolanaClient() *SolanaClient

NewSolanaClient creates a new client for the Solana JSON-RPC API.

func (*SolanaClient) GetTotalSupply

func (c *SolanaClient) GetTotalSupply(ctx context.Context) (float64, error)

GetTotalSupply fetches the total supply of a token from the Solana RPC.

Jump to

Keyboard shortcuts

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