svm

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeSendFunds           = "send_funds"
	EventTypeOutboundObservation = "outboundObservation"
)

Event type constants

Variables

This section is empty.

Functions

func ParseEvent added in v0.0.13

func ParseEvent(log string, signature string, slot uint64, logIndex uint, eventType string, chainID string, logger zerolog.Logger) *store.Event

ParseEvent parses a log into a store.Event based on the event type eventType should be "sendFunds" or "outboundObservation"

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements the ChainClient interface for Solana chains

func NewClient

func NewClient(
	config *uregistrytypes.ChainConfig,
	database *db.DB,
	chainConfig *config.ChainSpecificConfig,
	pushSigner *pushsigner.Signer,
	nodeHome string,
	logger zerolog.Logger,
) (*Client, error)

NewClient creates a new Solana chain client

func (*Client) ChainID added in v0.0.13

func (c *Client) ChainID() string

ChainID returns the chain ID string

func (*Client) GetConfig added in v0.0.13

func (c *Client) GetConfig() *uregistrytypes.ChainConfig

GetConfig returns the registry chain config

func (*Client) GetTxBuilder added in v0.0.13

func (c *Client) GetTxBuilder() (common.OutboundTxBuilder, error)

GetTxBuilder returns the OutboundTxBuilder for this chain

func (*Client) IsHealthy

func (c *Client) IsHealthy() bool

IsHealthy checks if the Solana chain RPC client is healthy

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

Start initializes and starts the Solana chain client

func (*Client) Stop

func (c *Client) Stop() error

Stop gracefully shuts down the Solana chain client

type EventConfirmer added in v0.0.13

type EventConfirmer struct {
	// contains filtered or unexported fields
}

EventConfirmer periodically checks pending events and marks them as CONFIRMED once their transactions are confirmed on-chain.

func NewEventConfirmer added in v0.0.13

func NewEventConfirmer(
	rpcClient *RPCClient,
	database *db.DB,
	chainID string,
	pollIntervalSeconds int,
	fastConfirmations uint64,
	standardConfirmations uint64,
	logger zerolog.Logger,
) *EventConfirmer

NewEventConfirmer creates a new event confirmer

func (*EventConfirmer) Start added in v0.0.13

func (ec *EventConfirmer) Start(ctx context.Context) error

Start begins checking and confirming events

func (*EventConfirmer) Stop added in v0.0.13

func (ec *EventConfirmer) Stop()

Stop stops the event confirmer

type EventListener added in v0.0.13

type EventListener struct {
	// contains filtered or unexported fields
}

EventListener listens for gateway events on SVM chains and stores them in the database

func NewEventListener added in v0.0.13

func NewEventListener(
	rpcClient *RPCClient,
	gatewayAddress string,
	chainID string,
	gatewayMethods []*uregistrytypes.GatewayMethods,
	database *db.DB,
	eventPollingSeconds int,
	eventStartFrom *int64,
	logger zerolog.Logger,
) (*EventListener, error)

NewEventListener creates a new SVM event listener

func (*EventListener) IsRunning added in v0.0.13

func (el *EventListener) IsRunning() bool

IsRunning returns whether the listener is currently running

func (*EventListener) Start added in v0.0.13

func (el *EventListener) Start(ctx context.Context) error

Start begins listening for gateway events

func (*EventListener) Stop added in v0.0.13

func (el *EventListener) Stop() error

Stop gracefully stops the event listener

type GasOracle added in v0.0.13

type GasOracle struct {
	// contains filtered or unexported fields
}

GasOracle handles fetching and reporting gas prices (prioritization fees)

func NewGasOracle added in v0.0.13

func NewGasOracle(
	rpcClient *RPCClient,
	pushSigner *pushsigner.Signer,
	chainID string,
	gasPriceIntervalSeconds int,
	logger zerolog.Logger,
) *GasOracle

NewGasOracle creates a new gas oracle

func (*GasOracle) Start added in v0.0.13

func (g *GasOracle) Start(ctx context.Context) error

Start begins fetching and voting on gas prices

func (*GasOracle) Stop added in v0.0.13

func (g *GasOracle) Stop()

Stop stops the gas oracle

type RPCClient added in v0.0.13

type RPCClient struct {
	// contains filtered or unexported fields
}

RPCClient provides SVM-specific RPC operations

func NewRPCClient added in v0.0.13

func NewRPCClient(rpcURLs []string, expectedGenesisHash string, logger zerolog.Logger) (*RPCClient, error)

NewRPCClient creates a new SVM RPC client from RPC URLs and validates genesis hash

func (*RPCClient) BroadcastTransaction added in v0.0.13

func (rc *RPCClient) BroadcastTransaction(ctx context.Context, tx *solana.Transaction) (string, error)

BroadcastTransaction broadcasts a signed transaction and returns the transaction signature (hash)

func (*RPCClient) Close added in v0.0.13

func (rc *RPCClient) Close()

Close closes all RPC connections

func (*RPCClient) GetAccountData added in v0.0.13

func (rc *RPCClient) GetAccountData(ctx context.Context, pubkey solana.PublicKey) ([]byte, error)

GetAccountData fetches account data for a given public key

func (*RPCClient) GetGasPrice added in v0.0.13

func (rc *RPCClient) GetGasPrice(ctx context.Context) (*big.Int, error)

GetGasPrice fetches the current gas price (prioritization fee) from Solana

func (*RPCClient) GetLatestSlot added in v0.0.13

func (rc *RPCClient) GetLatestSlot(ctx context.Context) (uint64, error)

GetLatestSlot returns the latest slot number

func (*RPCClient) GetRecentBlockhash added in v0.0.13

func (rc *RPCClient) GetRecentBlockhash(ctx context.Context) (solana.Hash, error)

GetRecentBlockhash gets a recent blockhash for transaction building

func (*RPCClient) GetSignaturesForAddress added in v0.0.13

func (rc *RPCClient) GetSignaturesForAddress(ctx context.Context, address solana.PublicKey) ([]*rpc.TransactionSignature, error)

GetSignaturesForAddress gets transaction signatures for an address

func (*RPCClient) GetTransaction added in v0.0.13

func (rc *RPCClient) GetTransaction(ctx context.Context, signature solana.Signature) (*rpc.GetTransactionResult, error)

GetTransaction gets a transaction by signature

func (*RPCClient) IsHealthy added in v0.0.13

func (rc *RPCClient) IsHealthy(ctx context.Context) bool

IsHealthy checks if any RPC in the pool is healthy by pinging it

type TxBuilder added in v0.0.13

type TxBuilder struct {
	// contains filtered or unexported fields
}

TxBuilder implements OutboundTxBuilder for Solana chains

func NewTxBuilder added in v0.0.13

func NewTxBuilder(
	rpcClient *RPCClient,
	chainID string,
	gatewayAddress string,
	nodeHome string,
	logger zerolog.Logger,
) (*TxBuilder, error)

NewTxBuilder creates a new Solana transaction builder

func (*TxBuilder) BroadcastOutboundSigningRequest added in v0.0.13

func (tb *TxBuilder) BroadcastOutboundSigningRequest(
	ctx context.Context,
	req *common.UnSignedOutboundTxReq,
	data *uetypes.OutboundCreatedEvent,
	signature []byte,
) (string, error)

BroadcastOutboundSigningRequest assembles and broadcasts a signed transaction from the signing request, event data, and signature NOTE: This method will internally use a relayer key to create and send the Solana transaction The signature provided is the TSS signature for the message hash, which will be included in the instruction data

func (*TxBuilder) GetOutboundSigningRequest added in v0.0.13

func (tb *TxBuilder) GetOutboundSigningRequest(
	ctx context.Context,
	data *uetypes.OutboundCreatedEvent,
	gasPrice *big.Int,
	signerAddress string,
) (*common.UnSignedOutboundTxReq, error)

GetOutboundSigningRequest creates a signing request from outbound event data The signing hash is the keccak256 hash of the TSS message constructed according to the gateway contract

Jump to

Keyboard shortcuts

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