block_engine

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CheckBundleRetries               = 5                // Number of times to retry checking bundle status
	CheckBundleRetryDelay            = 5 * time.Second  // Delay between retries for checking bundle status
	SignaturesConfirmationTimeout    = 15 * time.Second // Timeout for confirming signatures
	SignaturesConfirmationRetryDelay = 1 * time.Second  // Delay between retries for confirming signatures
)

Constants for retry and timeout configurations

Variables

This section is empty.

Functions

func NewDroppedBundle

func NewDroppedBundle(message string) error

NewDroppedBundle creates a new error indicating that a bundle was dropped.

func NewInternalError

func NewInternalError(message string) error

NewInternalError creates a new internal error.

func NewSimulationFailureError

func NewSimulationFailureError(tx string, message string) error

NewSimulationFailureError creates a new error indicating that a bundle failed simulation.

func NewStateAuctionBidRejectedError

func NewStateAuctionBidRejectedError(auction string, tip uint64) error

NewStateAuctionBidRejectedError creates a new error indicating that a bundle lost the state auction.

func NewWinningBatchBidRejectedError

func NewWinningBatchBidRejectedError(auction string, tip uint64) error

NewWinningBatchBidRejectedError creates a new error indicating that a bundle won the state auction but failed the global auction.

Types

type BundleRejectionError

type BundleRejectionError struct {
	Message string // Error message
}

BundleRejectionError represents an error when a bundle is rejected.

func (BundleRejectionError) Error

func (e BundleRejectionError) Error() string

Error implements the error interface for BundleRejectionError.

type BundleResponse

type BundleResponse struct {
	BundleResponse *searcher_pb.SendBundleResponse // Response from sending bundle
	Signatures     []solana.Signature              // Signatures of transactions in the bundle
}

BundleResponse represents a response from sending a bundle.

type Relayer

type Relayer struct {
	GRPCConn              *grpc.ClientConn                         // gRPC connection
	Client                block_engine_pb.BlockEngineRelayerClient // Relayer client
	AuthenticationService *pkg.AuthenticationService               // Authentication service
	ErrChan               <-chan error                             // Error channel
}

Relayer is a client for interacting with the Block Engine Relayer service.

func NewRelayer

func NewRelayer(
	ctx context.Context,
	grpcAddr string,
	keyPair *solana.PrivateKey,
	opts ...grpc.DialOption,
) (*Relayer, error)

NewRelayer initializes a new Relayer with the given context, gRPC address, and Solana private key. It establishes a gRPC connection, sets up authentication if a keyPair is provided, and returns the Relayer.

func (*Relayer) OnStartExpiringPacketStream

func (r *Relayer) OnStartExpiringPacketStream(ctx context.Context) (
	<-chan *block_engine_pb.StartExpiringPacketStreamResponse, <-chan error, error)

OnStartExpiringPacketStream starts a stream for receiving expiring packet updates and handles the incoming updates and errors. It returns channels for the updates and errors.

func (*Relayer) OnSubscribeAccountsOfInterest

func (r *Relayer) OnSubscribeAccountsOfInterest(ctx context.Context) (
	<-chan *block_engine_pb.AccountsOfInterestUpdate, <-chan error, error)

OnSubscribeAccountsOfInterest subscribes to accounts of interest updates and handles the incoming updates and errors. It returns channels for the updates and errors.

func (*Relayer) OnSubscribeProgramsOfInterest

func (r *Relayer) OnSubscribeProgramsOfInterest(ctx context.Context) (
	<-chan *block_engine_pb.ProgramsOfInterestUpdate, <-chan error, error)

OnSubscribeProgramsOfInterest subscribes to programs of interest updates and handles the incoming updates and errors. It returns channels for the updates and errors.

func (*Relayer) StartExpiringPacketStream

StartExpiringPacketStream starts a stream for receiving expiring packet updates from the BlockEngineRelayer service. It returns a client for receiving these updates.

func (*Relayer) SubscribeAccountsOfInterest

SubscribeAccountsOfInterest subscribes to accounts of interest updates from the BlockEngineRelayer service. It returns a client for receiving these updates.

func (*Relayer) SubscribeProgramsOfInterest

SubscribeProgramsOfInterest subscribes to programs of interest updates from the BlockEngineRelayer service. It returns a client for receiving these updates.

type SearcherClient

type SearcherClient struct {
	GRPCConn                 *grpc.ClientConn                                         // gRPC connection
	RPCConn                  *rpc.Client                                              // Standard RPC connection
	JitoRPCConn              *rpc.Client                                              // Jito RPC connection
	SearcherService          searcher_pb.SearcherServiceClient                        // Searcher service client
	BundleStreamSubscription searcher_pb.SearcherService_SubscribeBundleResultsClient // Bundle stream subscription
	AuthenticationService    *pkg.AuthenticationService                               // Authentication service
	ErrChan                  <-chan error                                             // Error channel
}

SearcherClient is a client for interacting with the Searcher service.

func NewSearcherClient

func NewSearcherClient(
	ctx context.Context,
	grpcAddr string,
	jitoRPCClient, rpcClient *rpc.Client,
	keyPair *solana.PrivateKey,
	opts ...grpc.DialOption,
) (*SearcherClient, error)

NewSearcherClient initializes a new SearcherClient with the provided context, gRPC address, Jito and standard RPC clients, Solana private key, and additional gRPC dial options. It establishes a gRPC connection, sets up authentication if a keyPair is provided, and returns the SearcherClient.

func (*SearcherClient) GetConnectedLeaders

func (c *SearcherClient) GetConnectedLeaders(opts ...grpc.CallOption) (*searcher_pb.ConnectedLeadersResponse, error)

GetConnectedLeaders retrieves the connected leaders from the Searcher service. It returns a ConnectedLeadersResponse or an error.

func (*SearcherClient) GetConnectedLeadersRegioned

func (c *SearcherClient) GetConnectedLeadersRegioned(regions []string, opts ...grpc.CallOption) (*searcher_pb.ConnectedLeadersRegionedResponse, error)

GetConnectedLeadersRegioned retrieves the connected leaders for specified regions from the Searcher service. It returns a ConnectedLeadersRegionedResponse or an error.

func (*SearcherClient) GetNextScheduledLeader

func (c *SearcherClient) GetNextScheduledLeader(regions []string, opts ...grpc.CallOption) (*searcher_pb.NextScheduledLeaderResponse, error)

GetNextScheduledLeader retrieves the next scheduled leader for the specified regions from the Searcher service. It returns a NextScheduledLeaderResponse or an error.

func (*SearcherClient) GetRandomTipAccount

func (c *SearcherClient) GetRandomTipAccount(opts ...grpc.CallOption) (string, error)

GetRandomTipAccount retrieves a random tip account from the list of tip accounts. It returns the selected account or an error.

func (*SearcherClient) GetRegions

GetRegions retrieves the regions from the Searcher service. It returns a GetRegionsResponse or an error.

func (*SearcherClient) GetTipAccounts

func (c *SearcherClient) GetTipAccounts(opts ...grpc.CallOption) (*searcher_pb.GetTipAccountsResponse, error)

GetTipAccounts retrieves the tip accounts from the Searcher service. It returns a GetTipAccountsResponse or an error.

func (*SearcherClient) NewBundle

func (c *SearcherClient) NewBundle(transactions []*solana.Transaction) (*bundle_pb.Bundle, error)

NewBundle creates a new bundle protobuf object from a slice of transactions. It converts the transactions into protobuf packets and includes them in the bundle.

func (*SearcherClient) NewBundleSubscriptionResults

NewBundleSubscriptionResults subscribes to bundle result updates from the Searcher service. It uses the provided gRPC call options to set up the subscription.

func (*SearcherClient) SendBundle

func (c *SearcherClient) SendBundle(
	transactions []*solana.Transaction,
	opts ...grpc.CallOption,
) (*searcher_pb.SendBundleResponse, error)

SendBundle creates and sends a bundle of transactions to the Searcher service. It converts transactions to a protobuf packet and sends it using the SearcherService.

func (*SearcherClient) SendBundleWithConfirmation

func (c *SearcherClient) SendBundleWithConfirmation(
	ctx context.Context,
	transactions []*solana.Transaction,
	opts ...grpc.CallOption,
) (*BundleResponse, error)

SendBundleWithConfirmation sends a bundle of transactions and waits for confirmation of signatures. It attempts to send the bundle, then continuously checks for the result of the bundle and validates the signatures of the transactions.

type Validator

type Validator struct {
	GRPCConn              *grpc.ClientConn                           // gRPC connection
	Client                block_engine_pb.BlockEngineValidatorClient // Validator client
	AuthenticationService *pkg.AuthenticationService                 // Authentication service
	ErrChan               <-chan error                               // Error channel
}

Validator is a client for interacting with the Block Engine Validator service.

func NewValidator

func NewValidator(
	ctx context.Context,
	grpcAddr string,
	keyPair *solana.PrivateKey,
	opts ...grpc.DialOption,
) (*Validator, error)

NewValidator initializes a new Validator with the provided context, gRPC address, and Solana private key. It establishes a gRPC connection, sets up authentication if a keyPair is provided, and returns the Validator.

func (*Validator) GetBlockBuilderFeeInfo

func (v *Validator) GetBlockBuilderFeeInfo(
	opts ...grpc.CallOption,
) (*block_engine_pb.BlockBuilderFeeInfoResponse, error)

GetBlockBuilderFeeInfo retrieves the block builder fee information from the BlockEngineValidator service. It returns a BlockBuilderFeeInfoResponse or an error.

func (*Validator) OnBundleSubscription

func (v *Validator) OnBundleSubscription(ctx context.Context) (
	<-chan []*bundle_pb.BundleUuid, <-chan error, error)

OnBundleSubscription subscribes to bundle updates and handles the incoming updates and errors. It returns channels for the updates and errors.

func (*Validator) OnPacketSubscription

func (v *Validator) OnPacketSubscription(
	ctx context.Context,
) (<-chan *block_engine_pb.SubscribePacketsResponse, <-chan error, error)

OnPacketSubscription subscribes to packet updates and handles the incoming updates and errors. It returns channels for the updates and errors.

func (*Validator) SubscribeBundles

SubscribeBundles subscribes to bundle updates from the BlockEngineValidator service. It returns a client for receiving these updates.

func (*Validator) SubscribePackets

SubscribePackets subscribes to packet updates from the BlockEngineValidator service. It returns a client for receiving these updates.

Jump to

Keyboard shortcuts

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