pkg

package
v0.0.0-...-fad8960 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchExtractSigFromTx

func BatchExtractSigFromTx(txns []*solana.Transaction) []solana.Signature
func BuildTransactionLinks(txns []solana.Signature, platform Platform) []string

BuildTransactionLinks generates a list of URLs for the provided transactions, linking each transaction signature to the appropriate blockchain explorer based on the platform.

func ConvertBachTransactionsToBase58

func ConvertBachTransactionsToBase58(transactions []*solana.Transaction) ([]string, error)

ConvertBachTransactionsToBase58 converts a slice of solana.Transaction to a base58 string encoded transaction.

func ConvertBachTransactionsToString

func ConvertBachTransactionsToString(transactions []*solana.Transaction) []string

func ConvertBatchProtobufPacketToTransaction

func ConvertBatchProtobufPacketToTransaction(packets []*jito_pb.Packet) ([]*solana.Transaction, error)

ConvertBatchProtobufPacketToTransaction converts a slice of pb.Packet to a slice of solana-go Transaction.

func ConvertBatchTransactionToProtobufPacket

func ConvertBatchTransactionToProtobufPacket(transactions []*solana.Transaction) ([]*jito_pb.Packet, error)

ConvertBatchTransactionToProtobufPacket converts a slice of solana-go Transaction to a slice of pb.Packet.

func ConvertProtobufPacketToTransaction

func ConvertProtobufPacketToTransaction(packet *jito_pb.Packet) (*solana.Transaction, error)

ConvertProtobufPacketToTransaction converts a pb.Packet to a solana-go Transaction.

func ConvertTransactionToProtobufPacket

func ConvertTransactionToProtobufPacket(transaction *solana.Transaction) (jito_pb.Packet, error)

ConvertTransactionToProtobufPacket converts a solana-go Transaction to a pb.Packet.

func CreateAndObserveGRPCConn

func CreateAndObserveGRPCConn(ctx context.Context, chErr chan error, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

CreateAndObserveGRPCConn creates a new gRPC connection and observes its conn status.

func ExtractSigFromTx

func ExtractSigFromTx(tx *solana.Transaction) solana.Signature

ExtractSigFromTx extracts the transaction's signature.

func LamportsToSol

func LamportsToSol(lamports *big.Float) *big.Float

LamportsToSol converts the given amount of lamports to SOL by dividing by the number of lamports per SOL.

func StrSliceToByteSlice

func StrSliceToByteSlice(s []string) [][]byte

StrSliceToByteSlice converts a string array to a byte array.

func SubscribeTipStream

func SubscribeTipStream(ctx context.Context) (<-chan []*TipStreamInfo, <-chan error, error)

SubscribeTipStream establishes a connection to the Jito websocket and receives TipStreamInfo.

func TxToStr

func TxToStr(txns []*solana.Transaction) []string

TxToStr converts type solana.Transaction to string.

Types

type AuthenticationService

type AuthenticationService struct {
	AuthService jito_pb.AuthServiceClient
	GrpcCtx     context.Context
	KeyPair     *Keypair
	BearerToken string
	ExpiresAt   int64 // seconds
	ErrChan     chan error
	// contains filtered or unexported fields
}

func NewAuthenticationService

func NewAuthenticationService(grpcConn *grpc.ClientConn, privateKey solana.PrivateKey) *AuthenticationService

func (*AuthenticationService) AuthenticateAndRefresh

func (as *AuthenticationService) AuthenticateAndRefresh(role jito_pb.Role) error

AuthenticateAndRefresh is a function that authenticates the client and refreshes the access token.

type Keypair

type Keypair struct {
	PublicKey  solana.PublicKey
	PrivateKey solana.PrivateKey
}

func GenerateKeypair

func GenerateKeypair() *Keypair

GenerateKeypair creates a new Solana Keypair.

func NewKeyPair

func NewKeyPair(privateKey solana.PrivateKey) *Keypair

NewKeyPair creates a Keypair from a private key.

type Platform

type Platform string
var (
	SolanaFM       Platform = "https://solana.fm/tx/"
	Solscan        Platform = "https://solscan.io/tx/"
	SolanaExplorer Platform = "https://explorer.solana.com/tx/"
	SolanaBeach    Platform = "https://solanabeach.io/transaction/"
	XRAY           Platform = "https://xray.helius.xyz/tx/"
)

type TipStreamInfo

type TipStreamInfo struct {
	Time                        time.Time `json:"time"`
	LandedTips25ThPercentile    float64   `json:"landed_tips_25th_percentile"`
	LandedTips50ThPercentile    float64   `json:"landed_tips_50th_percentile"`
	LandedTips75ThPercentile    float64   `json:"landed_tips_75th_percentile"`
	LandedTips95ThPercentile    float64   `json:"landed_tips_95th_percentile"`
	LandedTips99ThPercentile    float64   `json:"landed_tips_99th_percentile"`
	EmaLandedTips50ThPercentile float64   `json:"ema_landed_tips_50th_percentile"`
}

Jump to

Keyboard shortcuts

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