solana

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 30 Imported by: 0

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 added in v1.10.0

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 added in v1.10.0

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

func (*ChainSetOpts) ORMAndLogger added in v1.5.0

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

func (*ChainSetOpts) Validate added in v1.5.0

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

type DBChain added in v1.5.0

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 added in v1.10.0

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

type SetupConfig

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

type SolanaConfig added in v1.10.0

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

func (*SolanaConfig) AsV1 added in v1.10.0

func (c *SolanaConfig) AsV1() DBChain

func (*SolanaConfig) BalancePollPeriod added in v1.10.0

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

func (*SolanaConfig) Commitment added in v1.10.0

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

func (*SolanaConfig) ComputeUnitPriceDefault added in v1.13.0

func (c *SolanaConfig) ComputeUnitPriceDefault() uint64

func (*SolanaConfig) ComputeUnitPriceMax added in v1.13.0

func (c *SolanaConfig) ComputeUnitPriceMax() uint64

func (*SolanaConfig) ComputeUnitPriceMin added in v1.13.0

func (c *SolanaConfig) ComputeUnitPriceMin() uint64

func (*SolanaConfig) ConfirmPollPeriod added in v1.10.0

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

func (*SolanaConfig) FeeBumpPeriod added in v1.13.0

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

func (*SolanaConfig) FeeEstimatorMode added in v1.13.0

func (c *SolanaConfig) FeeEstimatorMode() string

func (*SolanaConfig) IsEnabled added in v1.10.0

func (c *SolanaConfig) IsEnabled() bool

func (*SolanaConfig) MaxRetries added in v1.10.0

func (c *SolanaConfig) MaxRetries() *uint

func (*SolanaConfig) OCR2CachePollPeriod added in v1.10.0

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

func (*SolanaConfig) OCR2CacheTTL added in v1.10.0

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

func (*SolanaConfig) SetFrom added in v1.11.0

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

func (*SolanaConfig) SetFromDB added in v1.10.0

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

func (*SolanaConfig) SkipPreflight added in v1.10.0

func (c *SolanaConfig) SkipPreflight() bool

func (*SolanaConfig) TxConfirmTimeout added in v1.10.0

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

func (*SolanaConfig) TxRetryTimeout added in v1.10.0

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

func (*SolanaConfig) TxTimeout added in v1.10.0

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

func (*SolanaConfig) Update added in v1.10.0

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

func (*SolanaConfig) ValidateConfig added in v1.10.0

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

type SolanaConfigs added in v1.10.0

type SolanaConfigs []*SolanaConfig

func (SolanaConfigs) Chains added in v1.10.0

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

func (SolanaConfigs) Node added in v1.10.0

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

func (SolanaConfigs) Nodes added in v1.10.0

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

func (SolanaConfigs) NodesByID added in v1.10.0

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

func (*SolanaConfigs) SetFrom added in v1.11.0

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

func (SolanaConfigs) ValidateConfig added in v1.10.0

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

type SolanaNodes added in v1.10.0

type SolanaNodes []*solcfg.Node

func (*SolanaNodes) SetFrom added in v1.11.0

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