Documentation ¶
Index ¶
- Constants
- Variables
- func BatchExtractSigFromTx(txs []*solana.Transaction) []solana.Signature
- func CheckSignatureStatuses(statuses *rpc.GetSignatureStatusesResult) bool
- func ConvertBatchBytesToPublicKey(publicKeys [][]byte) []solana.PublicKey
- func ConvertBatchProtobufPacketToTransaction(packets []*packet.Packet) ([]*solana.Transaction, error)
- func ConvertBatchPublicKeyToString(publicKeys []solana.PublicKey) []string
- func ConvertBatchTransactionToProtobufPacket(transactions []*solana.Transaction) ([]*packet.Packet, error)
- func ConvertBytesToPublicKey(publicKey []byte) solana.PublicKey
- func ConvertProtobufPacketToTransaction(packet *packet.Packet) (*solana.Transaction, error)
- func ConvertPublicKeyToString(publicKey solana.PublicKey) string
- func ConvertTransactionToProtobufPacket(transaction *solana.Transaction) (packet.Packet, error)
- func CreateGRPCConnection(ctx context.Context, chErr chan error, grpcAddr string, ...) (*grpc.ClientConn, error)
- func ExtractSigFromTx(tx *solana.Transaction) solana.Signature
- func GetEndpoint(location string) string
- func LamportsToSol(lamports *big.Float) *big.Float
- func ValidateSignatureStatuses(statuses *rpc.GetSignatureStatusesResult) error
- func ValidateTransaction(tx *solana.Transaction) bool
- type AuthenticationService
Constants ¶
const ( AMS = "https://amsterdam.mainnet.block-engine.jito.wtf" // Amsterdam endpoint FRA = "https://frankfurt.mainnet.block-engine.jito.wtf" // Frankfurt endpoint NYC = "https://ny.mainnet.block-engine.jito.wtf" // New York City endpoint TKO = "https://tokyo.mainnet.block-engine.jito.wtf" // Tokyo endpoint )
Constants for block engine endpoints
Variables ¶
var (
MemoPublicKey = solana.MustPublicKeyFromBase58("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr")
)
Functions ¶
func BatchExtractSigFromTx ¶
func BatchExtractSigFromTx(txs []*solana.Transaction) []solana.Signature
BatchExtractSigFromTx extracts the first signature from each Solana transaction in a batch. It iterates over the provided transactions and accumulates the first signature of each transaction in a slice. It returns a slice of signatures.
func CheckSignatureStatuses ¶
func CheckSignatureStatuses(statuses *rpc.GetSignatureStatusesResult) bool
CheckSignatureStatuses verifies if all signatures in the given status result are non-nil. It returns true if all statuses are non-nil, otherwise returns false.
func ConvertBatchBytesToPublicKey ¶
func ConvertBatchBytesToPublicKey(publicKeys [][]byte) []solana.PublicKey
ConvertBatchBytesToPublicKey converts a batch of byte slices into a slice of Solana public keys.
Parameters: - publicKeys: A slice of byte slices, where each byte slice represents a Solana public key.
Returns: - A slice of Solana public keys.
func ConvertBatchProtobufPacketToTransaction ¶
func ConvertBatchProtobufPacketToTransaction(packets []*packet.Packet) ([]*solana.Transaction, error)
ConvertBatchProtobufPacketToTransaction converts a slice of protobuf packets to a slice of Solana transactions. It iterates over the provided packets, converts each one to a transaction, and accumulates the results in a slice.
func ConvertBatchPublicKeyToString ¶
func ConvertBatchPublicKeyToString(publicKeys []solana.PublicKey) []string
ConvertBatchPublicKeyToString converts a batch of Solana public keys into a slice of strings.
Parameters: - publicKeys: A slice of Solana public keys.
Returns: - A slice of strings where each string is the string representation of the corresponding Solana public key.
func ConvertBatchTransactionToProtobufPacket ¶
func ConvertBatchTransactionToProtobufPacket(transactions []*solana.Transaction) ([]*packet.Packet, error)
ConvertBatchTransactionToProtobufPacket converts a batch of Solana transactions to a slice of protobuf packets. It iterates over each transaction, converts it to a protobuf packet, and accumulates the results in a slice.
func ConvertBytesToPublicKey ¶
func ConvertBytesToPublicKey(publicKey []byte) solana.PublicKey
ConvertBytesToPublicKey converts a single byte slice into a Solana public key.
Parameters: - publicKey: A byte slice representing a Solana public key.
Returns: - The corresponding Solana public key.
func ConvertProtobufPacketToTransaction ¶
ConvertProtobufPacketToTransaction converts a protobuf packet to a Solana transaction. It unmarshals the binary data in the packet into a Solana transaction.
func ConvertPublicKeyToString ¶
func ConvertPublicKeyToString(publicKey solana.PublicKey) string
ConvertPublicKeyToString converts a single Solana public key into its string representation.
Parameters: - publicKey: A Solana public key.
Returns: - The string representation of the Solana public key.
func ConvertTransactionToProtobufPacket ¶
ConvertTransactionToProtobufPacket converts a Solana transaction to a protobuf packet. It marshals the transaction to binary data and creates a jito_pb.Packet with this data and associated metadata.
func CreateGRPCConnection ¶
func CreateGRPCConnection( ctx context.Context, chErr chan error, grpcAddr string, opts ...grpc.DialOption, ) (*grpc.ClientConn, error)
CreateGRPCConnection creates and manages a gRPC connection with specified options and error handling. It takes a context, an error channel, the gRPC address, and additional gRPC dial options. It returns a gRPC client connection or an error if the connection setup fails.
func ExtractSigFromTx ¶
func ExtractSigFromTx(tx *solana.Transaction) solana.Signature
ExtractSigFromTx extracts the first signature from a Solana transaction. It returns the first signature in the transaction's signature list.
func GetEndpoint ¶
GetEndpoint returns the endpoint URL for the given location code. It returns an empty string if the location code is not recognized.
func LamportsToSol ¶
LamportsToSol converts a given amount of lamports to SOL. It divides the lamports value by the constant LAMPORTS_PER_SOL and returns the result as a *big.Float.
func ValidateSignatureStatuses ¶
func ValidateSignatureStatuses(statuses *rpc.GetSignatureStatusesResult) error
ValidateSignatureStatuses checks the confirmation status of each signature in the given status result. It returns an error if any signature status is not "processed" or "confirmed".
func ValidateTransaction ¶
func ValidateTransaction(tx *solana.Transaction) bool
ValidateTransaction makes sure the bytes length of your transaction < 1232. If your transaction is bigger, Jito will return an error.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct { AuthService auth.AuthServiceClient // Client for authentication service GRPCCtx context.Context // Context for gRPC operations KeyPair *solana.PrivateKey // Private key for signing challenges BearerToken string // Bearer token for authorization ExpiresAt int64 // Expiration time for the token ErrChan chan error // Channel for error handling // contains filtered or unexported fields }
AuthenticationService handles the authentication logic for interacting with the gRPC services.
func NewAuthenticationService ¶
func NewAuthenticationService( ctx context.Context, grpcConn *grpc.ClientConn, keyPair *solana.PrivateKey, ) *AuthenticationService
NewAuthenticationService creates a new instance of AuthenticationService.
func (*AuthenticationService) AuthenticateAndRefresh ¶
func (as *AuthenticationService) AuthenticateAndRefresh(role auth.Role) error
AuthenticateAndRefresh handles the authentication and token refresh logic.