solana

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 30 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultRequestTimeout = 30 * time.Second

DefaultRequestTimeout is the default Solana client timeout.

Variables

This section is empty.

Functions

func SetupNodes

func SetupNodes(db *sqlx.DB, cfg SetupConfig, lggr logger.Logger) (err error)

SetupNodes is a hack/shim method to allow node operators to specify multiple nodes via ENV. See: https://app.shortcut.com/chainlinklabs/epic/33587/overhaul-config?cf_workflow=500000005&ct_workflow=all

Types

type ChainSet

type ChainSet interface {
	solana.ChainSet

	Add(context.Context, string, *db.ChainCfg) (DBChain, error)
	Remove(string) error
	Configure(ctx context.Context, id string, enabled bool, config *db.ChainCfg) (DBChain, error)
	Show(id string) (DBChain, error)
	Index(offset, limit int) ([]DBChain, int, error)
	GetNodes(ctx context.Context, offset, limit int) (nodes []db.Node, count int, err error)
	GetNodesForChain(ctx context.Context, chainID string, offset, limit int) (nodes []db.Node, count int, err error)
	CreateNode(ctx context.Context, data db.Node) (db.Node, error)
	DeleteNode(ctx context.Context, id int32) error
}

ChainSet extends solana.ChainSet with mutability.

func NewChainSet

func NewChainSet(opts ChainSetOpts) (ChainSet, error)

NewChainSet returns a new chain set for opts. https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config

func NewChainSetImmut

func NewChainSetImmut(opts ChainSetOpts, cfgs SolanaConfigs) (ChainSet, error)

type ChainSetOpts

type ChainSetOpts struct {
	Logger   logger.Logger
	DB       *sqlx.DB
	KeyStore keystore.Solana
	ORM      ORM
}

ChainSetOpts holds options for configuring a ChainSet.

func (*ChainSetOpts) NewTOMLChain

func (o *ChainSetOpts) NewTOMLChain(cfg *SolanaConfig) (solana.Chain, error)

func (*ChainSetOpts) ORMAndLogger

func (o *ChainSetOpts) ORMAndLogger() (chains.ORM[string, *db.ChainCfg, db.Node], logger.Logger)

func (*ChainSetOpts) Validate

func (o *ChainSetOpts) Validate() (err error)

type DBChain

type DBChain = chains.DBChain[string, *soldb.ChainCfg]

type ORM

type ORM interface {
	Chain(string, ...pg.QOpt) (DBChain, error)
	Chains(offset, limit int, qopts ...pg.QOpt) ([]DBChain, int, error)
	CreateChain(id string, config *soldb.ChainCfg, qopts ...pg.QOpt) (DBChain, error)
	UpdateChain(id string, enabled bool, config *soldb.ChainCfg, qopts ...pg.QOpt) (DBChain, error)
	DeleteChain(id string, qopts ...pg.QOpt) error
	GetChainsByIDs(ids []string) (chains []DBChain, err error)
	EnabledChains(...pg.QOpt) ([]DBChain, error)

	CreateNode(soldb.Node, ...pg.QOpt) (soldb.Node, error)
	DeleteNode(int32, ...pg.QOpt) error
	GetNodesByChainIDs(chainIDs []string, qopts ...pg.QOpt) (nodes []soldb.Node, err error)
	NodeNamed(string, ...pg.QOpt) (soldb.Node, error)
	Nodes(offset, limit int, qopts ...pg.QOpt) (nodes []soldb.Node, count int, err error)
	NodesForChain(chainID string, offset, limit int, qopts ...pg.QOpt) (nodes []soldb.Node, count int, err error)

	SetupNodes([]soldb.Node, []string) error
	EnsureChains([]string, ...pg.QOpt) error

	StoreString(chainID string, key, val string) error
	Clear(chainID string, key string) error
}

ORM manages solana chains and nodes.

func NewORM

func NewORM(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig) ORM

NewORM returns an ORM backed by db. https://app.shortcut.com/chainlinklabs/story/33622/remove-legacy-config

func NewORMImmut

func NewORMImmut(cfgs chains.ChainConfig[string, *soldb.ChainCfg, soldb.Node]) ORM

type SetupConfig

type SetupConfig interface {
	SolanaNodes() string
	pg.QConfig
}

type SolanaConfig

type SolanaConfig struct {
	ChainID *string
	Enabled *bool
	solcfg.Chain
	Nodes SolanaNodes
}

func (*SolanaConfig) AsV1

func (c *SolanaConfig) AsV1() DBChain

func (*SolanaConfig) BalancePollPeriod

func (c *SolanaConfig) BalancePollPeriod() time.Duration

func (*SolanaConfig) Commitment

func (c *SolanaConfig) Commitment() rpc.CommitmentType

func (*SolanaConfig) ComputeUnitPriceDefault

func (c *SolanaConfig) ComputeUnitPriceDefault() uint64

func (*SolanaConfig) ComputeUnitPriceMax

func (c *SolanaConfig) ComputeUnitPriceMax() uint64

func (*SolanaConfig) ComputeUnitPriceMin

func (c *SolanaConfig) ComputeUnitPriceMin() uint64

func (*SolanaConfig) ConfirmPollPeriod

func (c *SolanaConfig) ConfirmPollPeriod() time.Duration

func (*SolanaConfig) FeeBumpPeriod

func (c *SolanaConfig) FeeBumpPeriod() time.Duration

func (*SolanaConfig) FeeEstimatorMode

func (c *SolanaConfig) FeeEstimatorMode() string

func (*SolanaConfig) IsEnabled

func (c *SolanaConfig) IsEnabled() bool

func (*SolanaConfig) MaxRetries

func (c *SolanaConfig) MaxRetries() *uint

func (*SolanaConfig) OCR2CachePollPeriod

func (c *SolanaConfig) OCR2CachePollPeriod() time.Duration

func (*SolanaConfig) OCR2CacheTTL

func (c *SolanaConfig) OCR2CacheTTL() time.Duration

func (*SolanaConfig) SetFrom

func (c *SolanaConfig) SetFrom(f *SolanaConfig)

func (*SolanaConfig) SetFromDB

func (c *SolanaConfig) SetFromDB(ch DBChain, nodes []soldb.Node) error

func (*SolanaConfig) SkipPreflight

func (c *SolanaConfig) SkipPreflight() bool

func (*SolanaConfig) TxConfirmTimeout

func (c *SolanaConfig) TxConfirmTimeout() time.Duration

func (*SolanaConfig) TxRetryTimeout

func (c *SolanaConfig) TxRetryTimeout() time.Duration

func (*SolanaConfig) TxTimeout

func (c *SolanaConfig) TxTimeout() time.Duration

func (*SolanaConfig) Update

func (c *SolanaConfig) Update(cfg soldb.ChainCfg)

func (*SolanaConfig) ValidateConfig

func (c *SolanaConfig) ValidateConfig() (err error)

type SolanaConfigs

type SolanaConfigs []*SolanaConfig

func (SolanaConfigs) Chains

func (cs SolanaConfigs) Chains(ids ...string) (chains []DBChain)

func (SolanaConfigs) Node

func (cs SolanaConfigs) Node(name string) (soldb.Node, error)

func (SolanaConfigs) Nodes

func (cs SolanaConfigs) Nodes() (ns []soldb.Node)

func (SolanaConfigs) NodesByID

func (cs SolanaConfigs) NodesByID(chainIDs ...string) (ns []soldb.Node)

func (*SolanaConfigs) SetFrom

func (cs *SolanaConfigs) SetFrom(fs *SolanaConfigs)

func (SolanaConfigs) ValidateConfig

func (cs SolanaConfigs) ValidateConfig() (err error)

type SolanaNodes

type SolanaNodes []*solcfg.Node

func (*SolanaNodes) SetFrom

func (ns *SolanaNodes) SetFrom(fs *SolanaNodes)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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