tpu

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_FANOUT_SLOTS uint64 = 12
View Source
var MAX_FANOUT_SLOTS uint64 = 100
View Source
var MAX_SLOT_SKIP_DISTANCE uint64 = 48

Functions

func CheckIfDuplicate

func CheckIfDuplicate(array []string, item string) bool

func ConvertURLToWS

func ConvertURLToWS(url string) string

Types

type LeaderTPUCache

type LeaderTPUCache struct {
	LeaderTPUMap      map[string]string
	Connection        *rpc.Client
	FirstSlot         uint64
	SlotsInEpoch      uint64
	LastEpochInfoSlot uint64
	Leaders           []solana.PublicKey
}

func (*LeaderTPUCache) FetchClusterTPUSockets

func (leaderTPUCache *LeaderTPUCache) FetchClusterTPUSockets() (map[string]string, error)

func (*LeaderTPUCache) FetchSlotLeaders

func (leaderTPUCache *LeaderTPUCache) FetchSlotLeaders(startSlot uint64, slotsInEpoch uint64) ([]solana.PublicKey, error)

func (*LeaderTPUCache) GetLeaderSockets

func (leaderTPUCache *LeaderTPUCache) GetLeaderSockets(fanoutSlots uint64) []string

func (*LeaderTPUCache) GetLeaderSocketsConverted

func (leaderTPUCache *LeaderTPUCache) GetLeaderSocketsConverted(fanoutSlots uint64) []*net.UDPAddr

func (*LeaderTPUCache) GetSlotLeader

func (leaderTPUCache *LeaderTPUCache) GetSlotLeader(slot uint64) solana.PublicKey

func (*LeaderTPUCache) LastSlot

func (leaderTPUCache *LeaderTPUCache) LastSlot() uint64

func (*LeaderTPUCache) Load

func (leaderTPUCache *LeaderTPUCache) Load(connection *rpc.Client, startSlot uint64) error

type LeaderTPUService

type LeaderTPUService struct {
	RecentSlots       *RecentLeaderSlots
	LTPUCache         *LeaderTPUCache
	Subscription      *ws.SlotsUpdatesSubscription
	Connection        *rpc.Client
	WSConnection      *ws.Client
	LeaderConnections []net.Conn
}

func (*LeaderTPUService) LeaderTPUSockets

func (leaderTPUService *LeaderTPUService) LeaderTPUSockets(fanoutSlots uint64) []string

func (*LeaderTPUService) Load

func (leaderTPUService *LeaderTPUService) Load(connection *rpc.Client, websocketURL string, fanout uint64) error

func (*LeaderTPUService) Run

func (leaderTPUService *LeaderTPUService) Run(fanout uint64)

type RecentLeaderSlots

type RecentLeaderSlots struct {
	RecentSlots []float64
}

func (*RecentLeaderSlots) EstimatedCurrentSlot

func (recentLeaderSlots *RecentLeaderSlots) EstimatedCurrentSlot() uint64

func (*RecentLeaderSlots) Load

func (recentLeaderSlots *RecentLeaderSlots) Load(currentSlot uint64)

func (*RecentLeaderSlots) RecordSlot

func (recentLeaderSlots *RecentLeaderSlots) RecordSlot(currentSlot uint64)

type TPUClient

type TPUClient struct {
	FanoutSlots uint64
	LTPUService *LeaderTPUService
	Exit        bool
	Connection  *rpc.Client
}

func New

func New(connection *rpc.Client, websocketURL string, config TPUClientConfig) (*TPUClient, error)

func (*TPUClient) Load

func (tpuClient *TPUClient) Load(connection *rpc.Client, websocketURL string, config TPUClientConfig) error

func (*TPUClient) SendRawTransaction

func (tpuClient *TPUClient) SendRawTransaction(transaction []byte, amount int) error

func (*TPUClient) SendRawTransactionThroughSocket

func (tpuClient *TPUClient) SendRawTransactionThroughSocket(transaction []byte, amount int, socket *net.UDPConn) error

func (*TPUClient) SendTransaction

func (tpuClient *TPUClient) SendTransaction(transaction *solana.Transaction, amount int) (solana.Signature, error)

func (*TPUClient) SendTransactionThroughSocket

func (tpuClient *TPUClient) SendTransactionThroughSocket(transaction *solana.Transaction, amount int, socket *net.UDPConn) (solana.Signature, error)

type TPUClientConfig

type TPUClientConfig struct {
	FanoutSlots uint64
}

Jump to

Keyboard shortcuts

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