Documentation
¶
Index ¶
- Variables
- func GenerateTipInstruction(tipAmount uint64, from, tipAccount solana.PublicKey) solana.Instruction
- func NewDroppedBundle(message string) error
- func NewInternalError(message string) error
- func NewSimulationFailureError(tx string, message string) error
- func NewStateAuctionBidRejectedError(auction string, tip uint64) error
- func NewWinningBatchBidRejectedError(auction string, tip uint64) error
- type Account
- type BroadcastBundleResponse
- type BundleRejectionError
- type BundleStatusesResponse
- type Client
- func (c *Client) AssembleBundle(transactions []*solana.Transaction) (*jito_pb.Bundle, error)
- func (c *Client) BatchGetBundleStatuses(ctx context.Context, bundleIDs ...string) ([]*BundleStatusesResponse, error)
- func (c *Client) BroadcastBundle(transactions []*solana.Transaction, opts ...grpc.CallOption) (*jito_pb.SendBundleResponse, error)
- func (c *Client) BroadcastBundleWithConfirmation(ctx context.Context, transactions []*solana.Transaction, ...) (*jito_pb.SendBundleResponse, error)
- func (c *Client) Close() error
- func (c *Client) GenerateTipRandomAccountInstruction(tipAmount uint64, from solana.PublicKey) (solana.Instruction, error)
- func (c *Client) GetBundleStatuses(ctx context.Context, bundleIDs []string) (*BundleStatusesResponse, error)
- func (c *Client) GetConnectedLeaders(opts ...grpc.CallOption) (*jito_pb.ConnectedLeadersResponse, error)
- func (c *Client) GetConnectedLeadersRegioned(regions []string, opts ...grpc.CallOption) (*jito_pb.ConnectedLeadersRegionedResponse, error)
- func (c *Client) GetNextScheduledLeader(regions []string, opts ...grpc.CallOption) (*jito_pb.NextScheduledLeaderResponse, error)
- func (c *Client) GetRandomTipAccount(opts ...grpc.CallOption) (string, error)
- func (c *Client) GetRegions(opts ...grpc.CallOption) (*jito_pb.GetRegionsResponse, error)
- func (c *Client) GetTipAccounts(opts ...grpc.CallOption) (*jito_pb.GetTipAccountsResponse, error)
- func (c *Client) NewBundleSubscriptionResults(opts ...grpc.CallOption) (jito_pb.SearcherService_SubscribeBundleResultsClient, error)
- func (c *Client) SimulateBundle(ctx context.Context, bundleParams SimulateBundleParams, ...) (*SimulatedBundleResponse, error)
- func (c *Client) SpamBundle(transactions []*solana.Transaction, spam int, opts ...grpc.CallOption) ([]*jito_pb.SendBundleResponse, []error)
- type Encoding
- type ExecutionAccounts
- type GetInflightBundlesStatusesResponse
- type GetTipAccountsResponse
- type ReturnData
- type SimulateBundleConfig
- type SimulateBundleParams
- type SimulatedBundleResponse
- type SimulatedBundleResponseStruct
- type TransactionResponse
- type TransactionResult
Constants ¶
This section is empty.
Variables ¶
var DefaultHeader = http.Header{
"Content-Type": {"application/json"},
"User-Agent": {"jito-go :)"},
}
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 NewInternalError ¶
Types ¶
type BroadcastBundleResponse ¶
type BroadcastBundleResponse struct { Jsonrpc string `json:"jsonrpc"` Result string `json:"result"` Id int `json:"id"` }
func BroadcastBundle ¶
func BroadcastBundle(client *http.Client, encoding Encoding, transactions []*solana.Transaction) (*BroadcastBundleResponse, error)
BroadcastBundle sends a bundle through Jito API.
func BroadcastBundleWithConfirmation ¶
func BroadcastBundleWithConfirmation(ctx context.Context, client *http.Client, rpcConn *rpc.Client, encoding Encoding, transactions []*solana.Transaction) (*BroadcastBundleResponse, error)
BroadcastBundleWithConfirmation sends a bundle of transactions on chain through Jito BlockEngine and waits for its confirmation.
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)
BatchGetBundleStatuses returns the statuses of multiple submitted bundles by splitting the bundleIDs into groups of up to 5 and calling GetBundleStatuses on each group.
func GetBundleStatuses ¶
func GetBundleStatuses(client *http.Client, bundleIDs []string) (*BundleStatusesResponse, error)
GetBundleStatuses returns the status of submitted bundle(s). This function operates similarly to the Solana RPC method getSignatureStatuses.
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 jito_pb.SearcherServiceClient BundleStreamSubscription jito_pb.SearcherService_SubscribeBundleResultsClient // Used for receiving *jito_pb.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 NewNoAuth ¶
func NewNoAuth( ctx context.Context, grpcDialURL string, jitoRpcClient, rpcClient *rpc.Client, proxyURL string, tlsConfig *tls.Config, opts ...grpc.DialOption, ) ( *Client, error)
NewNoAuth initializes and returns a new instance of the Searcher Client which does not require private key signing.
func (*Client) AssembleBundle ¶
AssembleBundle converts an array of SOL transactions to a Jito bundle.
func (*Client) BatchGetBundleStatuses ¶
func (c *Client) BatchGetBundleStatuses(ctx context.Context, bundleIDs ...string) ([]*BundleStatusesResponse, error)
BatchGetBundleStatuses returns the statuses of multiple submitted bundles by splitting the bundleIDs into groups of up to 5 and calling GetBundleStatuses on each group.
func (*Client) BroadcastBundle ¶
func (c *Client) BroadcastBundle(transactions []*solana.Transaction, opts ...grpc.CallOption) (*jito_pb.SendBundleResponse, error)
BroadcastBundle sends a bundle of transaction(s) on chain through Jito.
func (*Client) BroadcastBundleWithConfirmation ¶
func (c *Client) BroadcastBundleWithConfirmation(ctx context.Context, transactions []*solana.Transaction, opts ...grpc.CallOption) (*jito_pb.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)
GetBundleStatuses returns the status of submitted bundle(s). This function operates similarly to the Solana RPC method getSignatureStatuses.
func (*Client) GetConnectedLeaders ¶
func (c *Client) GetConnectedLeaders(opts ...grpc.CallOption) (*jito_pb.ConnectedLeadersResponse, error)
func (*Client) GetConnectedLeadersRegioned ¶
func (c *Client) GetConnectedLeadersRegioned(regions []string, opts ...grpc.CallOption) (*jito_pb.ConnectedLeadersRegionedResponse, error)
func (*Client) GetNextScheduledLeader ¶
func (c *Client) GetNextScheduledLeader(regions []string, opts ...grpc.CallOption) (*jito_pb.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) (*jito_pb.GetRegionsResponse, error)
func (*Client) GetTipAccounts ¶
func (c *Client) GetTipAccounts(opts ...grpc.CallOption) (*jito_pb.GetTipAccountsResponse, error)
GetTipAccounts returns Jito Tip Accounts.
func (*Client) NewBundleSubscriptionResults ¶
func (c *Client) NewBundleSubscriptionResults(opts ...grpc.CallOption) (jito_pb.SearcherService_SubscribeBundleResultsClient, error)
NewBundleSubscriptionResults creates a new bundle subscription stream, allowing to receive information about broadcasted bundles.
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) SpamBundle ¶
func (c *Client) SpamBundle(transactions []*solana.Transaction, spam int, opts ...grpc.CallOption) ([]*jito_pb.SendBundleResponse, []error)
SpamBundle spams BroadcastBundle (spam being the amount of bundles sent). Beware, it uses goroutines 😉.
type ExecutionAccounts ¶
type GetInflightBundlesStatusesResponse ¶
type GetInflightBundlesStatusesResponse struct { Jsonrpc string `json:"jsonrpc"` Result struct { Context struct { Slot int `json:"slot"` } `json:"context"` Value []struct { BundleId string `json:"bundle_id"` Status string `json:"status"` LandedSlot interface{} `json:"landed_slot"` } `json:"value"` } `json:"result"` Id int `json:"id"` }
func GetInflightBundleStatuses ¶
func GetInflightBundleStatuses(client *http.Client, bundles []string) (*GetInflightBundlesStatusesResponse, error)
GetInflightBundleStatuses returns the status of submitted bundles within the last five minutes, allowing up to five bundle IDs per request.
type GetTipAccountsResponse ¶
type GetTipAccountsResponse struct { Jsonrpc string `json:"jsonrpc"` Result []string `json:"result"` Id int `json:"id"` }
func GetTipAccounts ¶
func GetTipAccounts(client *http.Client) (*GetTipAccountsResponse, error)
GetTipAccounts retrieves the tip accounts designated for tip payments for bundles.
type ReturnData ¶
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 TransactionResponse ¶
type TransactionResponse struct { Jsonrpc string `json:"jsonrpc"` Result string `json:"result"` ID int `json:"id"` BundleID string }
func SendTransaction ¶
func SendTransaction(client *http.Client, sig string, bundleOnly bool) (*TransactionResponse, error)
SendTransaction serves as a proxy to the Solana sendTransaction RPC method. It forwards the received transaction as a regular Solana transaction via the Solana RPC method and submits it as a bundle. Jito no longer provides a minimum tip for the bundle. Please note that this minimum tip might not be sufficient to get the bundle through the auction, especially during high-demand periods. Additionally, you need to set a priority fee and jito tip to ensure this transaction is setup correctly. Otherwise, if you set the query parameter bundleOnly=true, the transaction will only be sent out as a bundle and not as a regular transaction via RPC.
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"` }