provider

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrivateKeyFromRaw

func PrivateKeyFromRaw(privateKey string) *privateKeyFromRaw

PrivateKeyFromRaw creates a new instance of the privateKeyFromRaw generator with the raw private key.

func PrivateKeyRandom

func PrivateKeyRandom() *privateKeyRandom

PrivateKeyRandom creates a new instance of the privateKeyRandom generator.

func WritePrivateKeyToPath added in v0.17.2

func WritePrivateKeyToPath(keyPath string, privKey solana.PrivateKey) error

WritePrivateKeyToPath writes the provided Solana private key to the specified file path in JSON format. The private key is stored as an array of integers, where each integer represents a byte of the private key.

Types

type CTFChainProvider added in v0.12.0

type CTFChainProvider struct {
	// contains filtered or unexported fields
}

CTFChainProvider manages an Solana chain instance running inside a Chainlink Testing Framework (CTF) Docker container.

This provider requires Docker to be installed and operational. Spinning up a new container can be slow, so it is recommended to initialize the provider only once per test suite or parent test to optimize performance.

func NewCTFChainProvider added in v0.12.0

func NewCTFChainProvider(
	t *testing.T, selector uint64, config CTFChainProviderConfig,
) *CTFChainProvider

NewCTFChainProvider creates a new CTFChainProvider with the given selector and configuration.

func (*CTFChainProvider) BlockChain added in v0.12.0

func (p *CTFChainProvider) BlockChain() chain.BlockChain

BlockChain returns the Solana chain instance managed by this provider. You must call Initialize before using this method to ensure the chain is properly set up.

func (*CTFChainProvider) ChainSelector added in v0.12.0

func (p *CTFChainProvider) ChainSelector() uint64

ChainSelector returns the chain selector of the Solana chain managed by this provider.

func (*CTFChainProvider) Initialize added in v0.12.0

func (p *CTFChainProvider) Initialize(_ context.Context) (chain.BlockChain, error)

Initialize sets up the Solana chain by validating the configuration, starting a CTF container, generating a deployer key, and constructing the chain instance.

func (*CTFChainProvider) Name added in v0.12.0

func (*CTFChainProvider) Name() string

Name returns the name of the CTFChainProvider.

type CTFChainProviderConfig added in v0.12.0

type CTFChainProviderConfig struct {
	// Required: A generator for the deployer key. Use PrivateKeyFromRaw to create a deployer
	// key from a private key.
	DeployerKeyGen PrivateKeyGenerator
	// Required: The absolute path to the directory containing the Solana CLI binaries.
	ProgramsPath string
	// Required: A map of program names to their program IDs. You may set this as an empty map if
	// you do not have any programs to deploy.
	ProgramIDs map[string]string
	// Required: A sync.Once instance to ensure that the CTF framework only sets up the new
	// DefaultNetwork once
	Once *sync.Once
	// Optional: WaitDelayAfterContainerStart is the duration to wait after starting the CTF
	// container. This is useful to ensure the container is fully initialized before attempting to
	// interact with it.
	//
	// Default: 0s (no delay)
	WaitDelayAfterContainerStart time.Duration
}

CTFChainProviderConfig holds the configuration to initialize the CTFChainProvider.

type PrivateKeyGenerator

type PrivateKeyGenerator interface {
	// Generate creates a new Solana keypair and returns the private key
	Generate() (sollib.PrivateKey, error)
}

PrivateKeyGenerator is an interface for generating Solana Keypairs.

type RPCChainProvider

type RPCChainProvider struct {
	// contains filtered or unexported fields
}

RPCChainProvider is a chain provider that provides a chain that connects to an Solana node via RPC.

func NewRPCChainProvider

func NewRPCChainProvider(selector uint64, config RPCChainProviderConfig) *RPCChainProvider

func (*RPCChainProvider) BlockChain

func (p *RPCChainProvider) BlockChain() chain.BlockChain

BlockChain returns the Solana chain instance managed by this provider. You must call Initialize before using this method to ensure the chain is properly set up.

func (*RPCChainProvider) ChainSelector

func (p *RPCChainProvider) ChainSelector() uint64

ChainSelector returns the chain selector of the Solana chain managed by this provider.

func (*RPCChainProvider) Initialize

func (p *RPCChainProvider) Initialize(_ context.Context) (chain.BlockChain, error)

Initialize initializes the RPCChainProvider. It generates the deployer keypair from the provided configuration, writes it to the specified KeypairPath directory, and sets up the Solana client with the provided HTTP RPC URL. It returns the initialized Solana chain instance.

func (*RPCChainProvider) Name

func (*RPCChainProvider) Name() string

Name returns the name of the RPCChainProvider.

type RPCChainProviderConfig

type RPCChainProviderConfig struct {
	// Required: The HTTP RPC URL to connect to the Solana node.
	HTTPURL string
	// Optional: The WebSocket URL to connect to the Solana node.
	WSURL string
	// Required: A generator for the deployer key. Use PrivateKeyFromRaw to create a deployer
	// key from a private key.
	DeployerKeyGen PrivateKeyGenerator
	// Required: The absolute path to the directory containing the Solana CLI binaries.
	ProgramsPath string
	// Required: The absolute path to the directory that will contain the keypair file used for
	// deploying programs for the Solana CLI.
	KeypairDirPath string
}

RPCChainProviderConfig holds the configuration to initialize the RPCChainProvider.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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