Documentation ¶
Overview ¶
TODO: Improve code reuse (mostly c/p of core/chains/terra/chain_set.go)
Index ¶
- Constants
- Variables
- func NewChain(db *sqlx.DB, ks keystore.Solana, logCfg pg.LogConfig, eb pg.EventBroadcaster, ...) (*chain, error)
- func NewChainSet(opts ChainSetOpts) (*chainSet, error)
- func SetupNodes(db *sqlx.DB, cfg SetupConfig, lggr logger.Logger) (err error)
- type Chain
- type ChainSet
- type ChainSetOpts
- type ORM
- type SetupConfig
Constants ¶
View Source
const DefaultRequestTimeout = 30 * time.Second
DefaultRequestTimeout is the default Solana client timeout.
Variables ¶
View Source
var ( // ErrChainIDEmpty is returned when chain is required but was empty. ErrChainIDEmpty = errors.New("chain id empty") // ErrChainIDInvalid is returned when a chain id does not match any configured chains. ErrChainIDInvalid = errors.New("chain id does not match any local chains") )
Functions ¶
func NewChain ¶
func NewChain(db *sqlx.DB, ks keystore.Solana, logCfg pg.LogConfig, eb pg.EventBroadcaster, dbchain Chain, orm ORM, lggr logger.Logger) (*chain, error)
NewChain returns a new chain backed by node.
func NewChainSet ¶
func NewChainSet(opts ChainSetOpts) (*chainSet, error)
NewChainSet returns a new chain set for opts.
func SetupNodes ¶
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) (Chain, error) Remove(string) error Configure(ctx context.Context, id string, enabled bool, config db.ChainCfg) (Chain, error) ORM() ORM }
ChainSet extends solana.ChainSet with mutability and exposes the underlying ORM.
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.
type ORM ¶
type ORM interface { Chain(string, ...pg.QOpt) (Chain, error) Chains(offset, limit int, qopts ...pg.QOpt) ([]Chain, int, error) CreateChain(id string, config soldb.ChainCfg, qopts ...pg.QOpt) (Chain, error) UpdateChain(id string, enabled bool, config soldb.ChainCfg, qopts ...pg.QOpt) (Chain, error) DeleteChain(id string, qopts ...pg.QOpt) error EnabledChains(...pg.QOpt) ([]Chain, error) CreateNode(soldb.Node, ...pg.QOpt) (soldb.Node, error) DeleteNode(int32, ...pg.QOpt) 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 }
ORM manages solana chains and nodes.
type SetupConfig ¶
Click to show internal directories.
Click to hide internal directories.