solana

package
v0.0.0-...-43fc98a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CCQ_RETRY_SLOP gets subtracted from the query retry interval to determine how long we can continue fast retries.
	// We don't want the fast retry time to be too close to the query retry interval.
	CCQ_RETRY_SLOP = 250 * time.Millisecond

	// CCQ_ESTIMATED_SLOT_TIME is the estimated Solana slot time used for estimating how long until the MinContextSlot will be reached.
	CCQ_ESTIMATED_SLOT_TIME = 400 * time.Millisecond

	// CCQ_FAST_RETRY_INTERVAL is how long we sleep between fast retry attempts.
	CCQ_FAST_RETRY_INTERVAL = 200 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistencyLevel

type ConsistencyLevel uint8

func (ConsistencyLevel) Commitment

func (c ConsistencyLevel) Commitment() (rpc.CommitmentType, error)

type EventSubscriptionData

type EventSubscriptionData struct {
	Jsonrpc string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  *struct {
		Result struct {
			Context struct {
				Slot int64 `json:"slot"`
			} `json:"context"`
			Value struct {
				Pubkey  string `json:"pubkey"`
				Account struct {
					Lamports   int64    `json:"lamports"`
					Data       []string `json:"data"`
					Owner      string   `json:"owner"`
					Executable bool     `json:"executable"`
					RentEpoch  int64    `json:"rentEpoch"`
				} `json:"account"`
			} `json:"value"`
		} `json:"result"`
		Subscription int `json:"subscription"`
	} `json:"params"`
}

type EventSubscriptionError

type EventSubscriptionError struct {
	Jsonrpc string `json:"jsonrpc"`
	Error   struct {
		Code    int     `json:"code"`
		Message *string `json:"message"`
	} `json:"error"`
	ID string `json:"id"`
}

type M

type M map[string]interface{}

type MessagePublicationAccount

type MessagePublicationAccount struct {
	VaaVersion       uint8
	ConsistencyLevel uint8
	EmitterAuthority vaa.Address
	MessageStatus    uint8
	Gap              [3]byte
	SubmissionTime   uint32
	Nonce            uint32
	Sequence         uint64
	EmitterChain     uint16
	EmitterAddress   vaa.Address
	Payload          []byte
}

func ParseMessagePublicationAccount

func ParseMessagePublicationAccount(data []byte) (*MessagePublicationAccount, error)

type PostMessageData

type PostMessageData struct {
	Nonce            uint32
	Payload          []byte
	ConsistencyLevel ConsistencyLevel
}

PostMessageData represents the user-supplied, untrusted instruction data for message publications. We use this to determine consistency level before fetching accounts.

type SolanaWatcher

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

func NewSolanaWatcher

func NewSolanaWatcher(
	rpcUrl string,
	wsUrl *string,
	contractAddress solana.PublicKey,
	rawContract string,
	msgC chan<- *common.MessagePublication,
	obsvReqC <-chan *gossipv1.ObservationRequest,
	commitment rpc.CommitmentType,
	chainID vaa.ChainID,
	queryReqC <-chan *query.PerChainQueryInternal,
	queryResponseC chan<- *query.PerChainQueryResponseInternal,
) *SolanaWatcher

func (*SolanaWatcher) GetLatestFinalizedBlockNumber

func (s *SolanaWatcher) GetLatestFinalizedBlockNumber() uint64

GetLatestFinalizedBlockNumber() returns the latest published block.

func (*SolanaWatcher) Run

func (s *SolanaWatcher) Run(ctx context.Context) error

func (*SolanaWatcher) SetupSubscription

func (s *SolanaWatcher) SetupSubscription(ctx context.Context) (error, *websocket.Conn)

func (*SolanaWatcher) SetupWebSocket

func (s *SolanaWatcher) SetupWebSocket(ctx context.Context) error

type WatcherConfig

type WatcherConfig struct {
	NetworkID     watchers.NetworkID // unique identifier of the network
	ChainID       vaa.ChainID        // ChainID
	ReceiveObsReq bool               // if false, this watcher will not get access to the observation request channel
	Rpc           string             // RPC URL
	Websocket     string             // Websocket URL
	Contract      string             // hex representation of the contract address
	Commitment    solana_rpc.CommitmentType
}

func (*WatcherConfig) Create

func (wc *WatcherConfig) Create(
	msgC chan<- *common.MessagePublication,
	obsvReqC <-chan *gossipv1.ObservationRequest,
	queryReqC <-chan *query.PerChainQueryInternal,
	queryResponseC chan<- *query.PerChainQueryResponseInternal,
	_ chan<- *common.GuardianSet,
	env common.Environment,
) (interfaces.L1Finalizer, supervisor.Runnable, error)

func (*WatcherConfig) GetChainID

func (wc *WatcherConfig) GetChainID() vaa.ChainID

func (*WatcherConfig) GetNetworkID

func (wc *WatcherConfig) GetNetworkID() watchers.NetworkID

func (*WatcherConfig) RequiredL1Finalizer

func (wc *WatcherConfig) RequiredL1Finalizer() watchers.NetworkID

func (*WatcherConfig) SetL1Finalizer

func (wc *WatcherConfig) SetL1Finalizer(l1finalizer interfaces.L1Finalizer)

Jump to

Keyboard shortcuts

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