solana

package
v1.8.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 26 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 NewChain

func NewChain(db *sqlx.DB, ks keystore.Solana, logCfg pg.LogConfig, eb pg.EventBroadcaster, dbchain DBChain, orm ORM, lggr logger.Logger) (*chain, error)

NewChain returns a new chain backed by node.

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.

type ChainSetOpts

type ChainSetOpts struct {
	Config           coreconfig.GeneralConfig
	Logger           logger.Logger
	DB               *sqlx.DB
	KeyStore         keystore.Solana
	EventBroadcaster pg.EventBroadcaster
	ORM              ORM
}

ChainSetOpts holds options for configuring a ChainSet.

func (*ChainSetOpts) NewChain added in v1.5.0

func (o *ChainSetOpts) NewChain(dbchain DBChain) (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)
	Node(int32, ...pg.QOpt) (soldb.Node, 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

	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.LogConfig) ORM

NewORM returns an ORM backed by db.

type SetupConfig

type SetupConfig interface {
	SolanaNodes() string
	LogSQL() bool
}

Directories

Path Synopsis
TODO: Improve code reuse (mostly c/p of core/chains/terra/monitor/balance.go)
TODO: Improve code reuse (mostly c/p of core/chains/terra/monitor/balance.go)

Jump to

Keyboard shortcuts

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