Documentation
¶
Index ¶
- Variables
- func CreateSVMClientFactory() rpcpool.ClientFactory
- func CreateSVMHealthChecker(expectedGenesisHash string) rpcpool.HealthChecker
- func GetSolanaClientFromPool(endpoint *rpcpool.Endpoint) (*rpc.Client, error)
- type Client
- func (c *Client) GetGasPrice(ctx context.Context) (*big.Int, error)
- func (c *Client) GetGenesisHash() string
- func (c *Client) GetLatestBlock(ctx context.Context) (uint64, error)
- func (c *Client) GetRPCURL() string
- func (c *Client) GetSlot(ctx context.Context) (uint64, error)
- func (c *Client) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
- func (c *Client) IsConfirmed(ctx context.Context, txHash string) (bool, error)
- func (c *Client) IsHealthy() bool
- func (c *Client) SetVoteHandler(handler common.VoteHandler)
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Stop() error
- func (c *Client) WatchGatewayEvents(ctx context.Context, fromBlock uint64) (<-chan *common.GatewayEvent, error)
- type EventParser
- type EventWatcher
- type GatewayHandler
- func (h *GatewayHandler) GetConfirmationTracker() *common.ConfirmationTracker
- func (h *GatewayHandler) GetLatestBlock(ctx context.Context) (uint64, error)
- func (h *GatewayHandler) GetStartSlot(ctx context.Context) (uint64, error)
- func (h *GatewayHandler) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
- func (h *GatewayHandler) IsConfirmed(ctx context.Context, txHash string) (bool, error)
- func (h *GatewayHandler) SetVoteHandler(handler common.VoteHandler)
- func (h *GatewayHandler) UpdateLastProcessedSlot(slotNumber uint64) error
- func (h *GatewayHandler) WatchGatewayEvents(ctx context.Context, fromSlot uint64) (<-chan *common.GatewayEvent, error)
- type MethodExtractionInfo
- type TransactionStatus
- type TransactionVerifier
- func (tv *TransactionVerifier) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
- func (tv *TransactionVerifier) GetTransactionStatus(ctx context.Context, txHash string) (*TransactionStatus, error)
- func (tv *TransactionVerifier) IsConfirmed(ctx context.Context, txHash string) (bool, error)
- func (tv *TransactionVerifier) VerifyPendingTransactions(ctx context.Context) error
- func (tv *TransactionVerifier) VerifyTransactionExistence(ctx context.Context, tx *store.ChainTransaction) (bool, error)
- func (tv *TransactionVerifier) WaitForTransaction(ctx context.Context, txHash string, confirmationLevel string) error
Constants ¶
This section is empty.
Variables ¶
var (
UniversalTxDiscriminator = strings.ToLower("6C9AD829B5EA1D7C")
)
Constants for event parsing
Functions ¶
func CreateSVMClientFactory ¶
func CreateSVMClientFactory() rpcpool.ClientFactory
CreateSVMClientFactory returns a ClientFactory for SVM endpoints
func CreateSVMHealthChecker ¶
func CreateSVMHealthChecker(expectedGenesisHash string) rpcpool.HealthChecker
CreateSVMHealthChecker creates a health checker for SVM endpoints
Types ¶
type Client ¶
type Client struct {
*common.BaseChainClient
// contains filtered or unexported fields
}
Client implements the ChainClient interface for Solana chains
func NewClient ¶
func NewClient(config *uregistrytypes.ChainConfig, database *db.DB, appConfig *config.Config, logger zerolog.Logger) (*Client, error)
NewClient creates a new Solana chain client
func (*Client) GetGasPrice ¶
GetGasPrice fetches the current gas price from the Solana chain Returns the median priority fee in lamports per compute unit
func (*Client) GetGenesisHash ¶
GetGenesisHash returns the genesis hash
func (*Client) GetLatestBlock ¶
GetLatestBlock returns the latest slot number
func (*Client) GetTransactionConfirmations ¶
GetTransactionConfirmations returns the number of confirmations for a transaction
func (*Client) IsConfirmed ¶
IsConfirmed checks if a transaction has enough confirmations
func (*Client) SetVoteHandler ¶
func (c *Client) SetVoteHandler(handler common.VoteHandler)
SetVoteHandler sets the vote handler for confirmed transactions
func (*Client) WatchGatewayEvents ¶
func (c *Client) WatchGatewayEvents(ctx context.Context, fromBlock uint64) (<-chan *common.GatewayEvent, error)
WatchGatewayEvents starts watching for gateway events
type EventParser ¶
type EventParser struct {
// contains filtered or unexported fields
}
EventParser handles parsing of SVM gateway events
func NewEventParser ¶
func NewEventParser( gatewayAddr solana.PublicKey, config *uregistrytypes.ChainConfig, logger zerolog.Logger, ) *EventParser
NewEventParser creates a new event parser
func (*EventParser) ParseGatewayEvent ¶
func (ep *EventParser) ParseGatewayEvent(log string, signature string, slot uint64, logIndex uint) *common.GatewayEvent
ParseGatewayEvent parses a single log into a GatewayEvent Only processes UniversalTxDiscriminator events
type EventWatcher ¶
type EventWatcher struct {
// contains filtered or unexported fields
}
EventWatcher handles watching for events on Solana chains
func NewEventWatcher ¶
func NewEventWatcher( parentClient *Client, gatewayAddr solana.PublicKey, eventParser *EventParser, tracker *common.ConfirmationTracker, txVerifier *TransactionVerifier, appConfig *config.Config, chainID string, logger zerolog.Logger, ) *EventWatcher
NewEventWatcher creates a new event watcher
func (*EventWatcher) WatchEvents ¶
func (ew *EventWatcher) WatchEvents( ctx context.Context, fromSlot uint64, updateLastSlot func(uint64) error, verifyTransactions func(context.Context) error, ) (<-chan *common.GatewayEvent, error)
WatchEvents starts watching for events from a specific slot
type GatewayHandler ¶
type GatewayHandler struct {
// contains filtered or unexported fields
}
GatewayHandler handles gateway operations for Solana chains
func NewGatewayHandler ¶
func NewGatewayHandler( parentClient *Client, config *uregistrytypes.ChainConfig, database *db.DB, appConfig *config.Config, logger zerolog.Logger, ) (*GatewayHandler, error)
NewGatewayHandler creates a new Solana gateway handler
func (*GatewayHandler) GetConfirmationTracker ¶
func (h *GatewayHandler) GetConfirmationTracker() *common.ConfirmationTracker
GetConfirmationTracker returns the confirmation tracker
func (*GatewayHandler) GetLatestBlock ¶
func (h *GatewayHandler) GetLatestBlock(ctx context.Context) (uint64, error)
GetLatestBlock returns the latest slot number
func (*GatewayHandler) GetStartSlot ¶
func (h *GatewayHandler) GetStartSlot(ctx context.Context) (uint64, error)
GetStartSlot returns the slot to start watching from
func (*GatewayHandler) GetTransactionConfirmations ¶
func (*GatewayHandler) IsConfirmed ¶
IsConfirmed delegates to transaction verifier
func (*GatewayHandler) SetVoteHandler ¶
func (h *GatewayHandler) SetVoteHandler(handler common.VoteHandler)
SetVoteHandler sets the vote handler on the confirmation tracker
func (*GatewayHandler) UpdateLastProcessedSlot ¶
func (h *GatewayHandler) UpdateLastProcessedSlot(slotNumber uint64) error
UpdateLastProcessedSlot updates the last processed slot in the database
func (*GatewayHandler) WatchGatewayEvents ¶
func (h *GatewayHandler) WatchGatewayEvents(ctx context.Context, fromSlot uint64) (<-chan *common.GatewayEvent, error)
WatchGatewayEvents starts watching for gateway events from a specific slot
type MethodExtractionInfo ¶
type MethodExtractionInfo struct {
ReceiverInstructionIndex int
AmountEventPosition int
LastVerified time.Time
}
MethodExtractionInfo caches discovered positions for each method
type TransactionStatus ¶
type TransactionStatus struct {
Exists bool `json:"exists"`
Status string `json:"status"`
Slot uint64 `json:"slot"`
Confirmations uint64 `json:"confirmations"`
ConfirmationStatus string `json:"confirmation_status"`
Error string `json:"error,omitempty"`
}
TransactionStatus holds detailed transaction status information
type TransactionVerifier ¶
type TransactionVerifier struct {
// contains filtered or unexported fields
}
TransactionVerifier handles transaction verification for Solana
func NewTransactionVerifier ¶
func NewTransactionVerifier( parentClient *Client, config *uregistrytypes.ChainConfig, database *db.DB, tracker *common.ConfirmationTracker, logger zerolog.Logger, ) *TransactionVerifier
NewTransactionVerifier creates a new transaction verifier
func (*TransactionVerifier) GetTransactionConfirmations ¶
func (tv *TransactionVerifier) GetTransactionConfirmations(ctx context.Context, txHash string) (uint64, error)
GetTransactionConfirmations returns the number of confirmations for a transaction
func (*TransactionVerifier) GetTransactionStatus ¶
func (tv *TransactionVerifier) GetTransactionStatus(ctx context.Context, txHash string) (*TransactionStatus, error)
GetTransactionStatus returns detailed status of a transaction
func (*TransactionVerifier) IsConfirmed ¶
IsConfirmed checks if a transaction has enough confirmations
func (*TransactionVerifier) VerifyPendingTransactions ¶
func (tv *TransactionVerifier) VerifyPendingTransactions(ctx context.Context) error
VerifyPendingTransactions checks all pending transactions for reorgs
func (*TransactionVerifier) VerifyTransactionExistence ¶
func (tv *TransactionVerifier) VerifyTransactionExistence( ctx context.Context, tx *store.ChainTransaction, ) (bool, error)
VerifyTransactionExistence checks if a Solana transaction still exists on chain
func (*TransactionVerifier) WaitForTransaction ¶
func (tv *TransactionVerifier) WaitForTransaction( ctx context.Context, txHash string, confirmationLevel string, ) error
WaitForTransaction waits for a transaction to reach a specific confirmation level