Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CTFChainProvider ¶
type CTFChainProvider struct {
// contains filtered or unexported fields
}
CTFChainProvider manages a Stellar 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 ¶
func NewCTFChainProvider( t *testing.T, selector uint64, config CTFChainProviderConfig, ) *CTFChainProvider
NewCTFChainProvider creates a new CTFChainProvider with the given selector and configuration.
func (*CTFChainProvider) BlockChain ¶
func (p *CTFChainProvider) BlockChain() chain.BlockChain
BlockChain returns the Stellar 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 ¶
func (p *CTFChainProvider) ChainSelector() uint64
ChainSelector returns the chain selector of the Stellar chain managed by this provider.
func (*CTFChainProvider) Initialize ¶
func (p *CTFChainProvider) Initialize(ctx context.Context) (chain.BlockChain, error)
Initialize sets up the Stellar chain by validating the configuration, starting a CTF container, generating a deployer keypair, and constructing the chain instance.
func (*CTFChainProvider) Name ¶
func (*CTFChainProvider) Name() string
Name returns the name of the CTFChainProvider.
type CTFChainProviderConfig ¶
type CTFChainProviderConfig struct {
// Required: A generator for the deployer keypair. Use KeypairFromHex to create a deployer
// keypair from a hex-encoded private key, or KeypairRandom to generate a random keypair.
DeployerKeypairGen KeypairGenerator
// Required: A sync.Once instance to ensure that the CTF framework only sets up the new
// DefaultNetwork once
Once *sync.Once
// Optional: Docker image to use for the Stellar localnet. If empty, defaults to defaultStellarImage.
Image string
// Optional: Network passphrase for the Stellar network. If empty, defaults to defaultNetworkPassphrase.
NetworkPassphrase string
// Optional: Custom environment variables to pass to the Stellar container.
CustomEnv map[string]string
// Optional: Port to expose the Stellar container on. If 0 or not specified, a free port will be
// automatically selected using freeport.
Port int
}
CTFChainProviderConfig holds the configuration to initialize the CTFChainProvider.
type KeypairGenerator ¶
type KeypairGenerator interface {
Generate() (stellar.StellarSigner, error)
}
KeypairGenerator is an interface for generating Stellar keypairs.
func KeypairFromHex ¶
func KeypairFromHex(hexKey string) KeypairGenerator
KeypairFromHex creates a KeypairGenerator that generates a keypair from a hex-encoded private key. The hex string can be with or without the "0x" prefix.
func KeypairRandom ¶
func KeypairRandom() KeypairGenerator
KeypairRandom creates a KeypairGenerator that generates a random keypair.
type RPCChainProvider ¶
type RPCChainProvider struct {
// contains filtered or unexported fields
}
func NewRPCChainProvider ¶
func NewRPCChainProvider(selector uint64, config RPCChainProviderConfig) *RPCChainProvider
func (*RPCChainProvider) BlockChain ¶
func (p *RPCChainProvider) BlockChain() chain.BlockChain
func (*RPCChainProvider) ChainSelector ¶
func (p *RPCChainProvider) ChainSelector() uint64
func (*RPCChainProvider) Initialize ¶
func (p *RPCChainProvider) Initialize(_ context.Context) (chain.BlockChain, error)
func (*RPCChainProvider) Name ¶
func (p *RPCChainProvider) Name() string
type RPCChainProviderConfig ¶
type RPCChainProviderConfig struct {
// Required: The Soroban RPC URL to connect to the Stellar network
SorobanRPCURL string
// Required: The network passphrase identifying the Stellar network
NetworkPassphrase string
// Optional: The Friendbot URL for funding test accounts (only required for testing environments)
FriendbotURL string
// Required: A generator for the deployer keypair. Use KeypairFromHex to create a deployer
// keypair from a hex-encoded private key.
DeployerKeypairGen KeypairGenerator
}