solana

package
v0.0.0-...-7be3494 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 MessagePublicationAccount

type MessagePublicationAccount struct {
	VaaVersion uint8
	// Borsh does not seem to support booleans, so 0=false / 1=true
	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) *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 (*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