searcher_client

package
v0.0.0-...-9f54599 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTipInstruction

func GenerateTipInstruction(tipAmount uint64, from, tipAccount solana.PublicKey) solana.Instruction

GenerateTipInstruction is a function that generates a Solana tip instruction mandatory to broadcast a bundle to Jito.

func NewDroppedBundle

func NewDroppedBundle(message string) error

func NewInternalError

func NewInternalError(message string) error

func NewSimulationFailureError

func NewSimulationFailureError(tx string, message string) error

func NewStateAuctionBidRejectedError

func NewStateAuctionBidRejectedError(auction string, tip uint64) error

func NewWinningBatchBidRejectedError

func NewWinningBatchBidRejectedError(auction string, tip uint64) error

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 Account

type Account struct {
	Executable bool     `json:"executable"`
	Owner      string   `json:"owner"`
	Lamports   int      `json:"lamports"`
	Data       []string `json:"data"`
	RentEpoch  *big.Int `json:"rentEpoch,omitempty"`
}

type BundleRejectionError

type BundleRejectionError struct {
	Message string
}

func (BundleRejectionError) Error

func (e BundleRejectionError) Error() string

type BundleStatusesResponse

type BundleStatusesResponse struct {
	Jsonrpc string `json:"jsonrpc"`
	Result  struct {
		Context struct {
			Slot int `json:"slot"`
		} `json:"context"`
		Value []struct {
			BundleId           string   `json:"bundle_id"`
			Transactions       []string `json:"transactions"`
			Slot               int      `json:"slot"`
			ConfirmationStatus string   `json:"confirmation_status"`
			Err                struct {
				Ok interface{} `json:"Ok"`
			} `json:"err"`
		} `json:"value"`
	} `json:"result"`
	Id int `json:"id"`
}

func BatchGetBundleStatuses

func BatchGetBundleStatuses(client *http.Client, bundleIDs ...string) ([]*BundleStatusesResponse, error)

func GetBundleStatuses

func GetBundleStatuses(client *http.Client, bundleIDs []string) (*BundleStatusesResponse, error)

type Client

type Client struct {
	GrpcConn    *grpc.ClientConn
	RpcConn     *rpc.Client // Utilized for executing standard Solana RPC requests.
	JitoRpcConn *rpc.Client // Utilized for executing specific Jito RPC requests (Jito node required).

	SearcherService          proto.SearcherServiceClient
	BundleStreamSubscription proto.SearcherService_SubscribeBundleResultsClient // Used for receiving *proto.BundleResult (bundle broadcast status info).

	Auth *pkg.AuthenticationService

	ErrChan <-chan error // ErrChan is used for dispatching errors from functions executed within goroutines.
}

func New

func New(ctx context.Context, grpcDialURL string, jitoRpcClient, rpcClient *rpc.Client, privateKey solana.PrivateKey, tlsConfig *tls.Config, opts ...grpc.DialOption) (*Client, error)

New creates a new Searcher Client instance.

func (*Client) AssembleBundle

func (c *Client) AssembleBundle(transactions []*solana.Transaction) (*proto.Bundle, error)

func (*Client) BatchGetBundleStatuses

func (c *Client) BatchGetBundleStatuses(ctx context.Context, bundleIDs ...string) ([]*BundleStatusesResponse, error)

func (*Client) BroadcastBundle

func (c *Client) BroadcastBundle(transactions []*solana.Transaction, opts ...grpc.CallOption) (*proto.SendBundleResponse, error)

BroadcastBundle sends a bundle of transactions on chain thru Jito.

func (*Client) BroadcastBundleWithConfirmation

func (c *Client) BroadcastBundleWithConfirmation(ctx context.Context, transactions []*solana.Transaction, opts ...grpc.CallOption) (*proto.SendBundleResponse, error)

BroadcastBundleWithConfirmation sends a bundle of transactions on chain thru Jito BlockEngine and waits for its confirmation.

func (*Client) GenerateTipRandomAccountInstruction

func (c *Client) GenerateTipRandomAccountInstruction(tipAmount uint64, from solana.PublicKey) (solana.Instruction, error)

GenerateTipRandomAccountInstruction functions similarly to GenerateTipInstruction, but it selects a random tip account.

func (*Client) GetBundleStatuses

func (c *Client) GetBundleStatuses(ctx context.Context, bundleIDs []string) (*BundleStatusesResponse, error)

func (*Client) GetConnectedLeaders

func (c *Client) GetConnectedLeaders(opts ...grpc.CallOption) (*proto.ConnectedLeadersResponse, error)

func (*Client) GetConnectedLeadersRegioned

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

func (*Client) GetNextScheduledLeader

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

func (*Client) GetRandomTipAccount

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

GetRandomTipAccount returns a random Jito TipAccount.

func (*Client) GetRegions

func (c *Client) GetRegions(opts ...grpc.CallOption) (*proto.GetRegionsResponse, error)

func (*Client) GetTipAccounts

func (c *Client) GetTipAccounts(opts ...grpc.CallOption) (*proto.GetTipAccountsResponse, error)

func (*Client) HandleBundleResult

func (c *Client) HandleBundleResult(bundleResult *proto.BundleResult) error

func (*Client) NewBundleSubscriptionResults

func (c *Client) NewBundleSubscriptionResults(opts ...grpc.CallOption) (proto.SearcherService_SubscribeBundleResultsClient, error)

NewBundleSubscriptionResults creates a new bundle subscription, allowing to receive information about broadcasted bundles.

func (*Client) NewMempoolStreamAccount

func (c *Client) NewMempoolStreamAccount(accounts, regions []string) (proto.SearcherService_SubscribeMempoolClient, error)

NewMempoolStreamAccount creates a new mempool subscription on specific Solana accounts.

func (*Client) NewMempoolStreamProgram

func (c *Client) NewMempoolStreamProgram(programs, regions []string) (proto.SearcherService_SubscribeMempoolClient, error)

NewMempoolStreamProgram creates a new mempool subscription on specific Solana programs.

func (*Client) SimulateBundle

func (c *Client) SimulateBundle(ctx context.Context, bundleParams SimulateBundleParams, simulationConfigs SimulateBundleConfig) (*SimulatedBundleResponse, error)

SimulateBundle is an RPC method that simulates a Jito bundle – exclusively available to Jito-Solana validator.

func (*Client) SubscribeAccountsMempoolTransactions

func (c *Client) SubscribeAccountsMempoolTransactions(ctx context.Context, accounts, regions []string) (<-chan *solana.Transaction, <-chan error, error)

SubscribeAccountsMempoolTransactions subscribes to the mempool transactions of the provided accounts.

func (*Client) SubscribeProgramsMempoolTransactions

func (c *Client) SubscribeProgramsMempoolTransactions(ctx context.Context, programs, regions []string) (<-chan *solana.Transaction, <-chan error, error)

SubscribeProgramsMempoolTransactions subscribes to the mempool transactions of the provided programs.

type ExecutionAccounts

type ExecutionAccounts struct {
	Encoding  string   `json:"encoding"`
	Addresses []string `json:"addresses"`
}

type ReturnData

type ReturnData struct {
	ProgramId string    `json:"programId"`
	Data      [2]string `json:"data"`
}

type SimulateBundleConfig

type SimulateBundleConfig struct {
	PreExecutionAccountsConfigs  []ExecutionAccounts `json:"preExecutionAccountsConfigs"`
	PostExecutionAccountsConfigs []ExecutionAccounts `json:"postExecutionAccountsConfigs"`
}

type SimulateBundleParams

type SimulateBundleParams struct {
	EncodedTransactions []string `json:"encodedTransactions"`
}

type SimulatedBundleResponse

type SimulatedBundleResponse struct {
	Context interface{}                   `json:"context"`
	Value   SimulatedBundleResponseStruct `json:"value"`
}

type SimulatedBundleResponseStruct

type SimulatedBundleResponseStruct struct {
	Summary           interface{}         `json:"summary"`
	TransactionResult []TransactionResult `json:"transactionResults"`
}

type TransactionResult

type TransactionResult struct {
	Err                   interface{} `json:"err,omitempty"`
	Logs                  []string    `json:"logs,omitempty"`
	PreExecutionAccounts  []Account   `json:"preExecutionAccounts,omitempty"`
	PostExecutionAccounts []Account   `json:"postExecutionAccounts,omitempty"`
	UnitsConsumed         *int        `json:"unitsConsumed,omitempty"`
	ReturnData            *ReturnData `json:"returnData,omitempty"`
}

Jump to

Keyboard shortcuts

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