environment

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Local          = "local"
	StagingTestnet = "staging_testnet"
	StagingMainnet = "staging_mainnet"
	Staging        = "staging" // Note this is currently the equivalent of staging_testnet.
	ProdMainnet    = "prod_mainnet"
	ProdTestnet    = "prod_testnet"
	Prod           = "prod"

	// Legacy environments to be cleaned up once the migration to the above environments is completed.
	Testnet    = "testnet"
	Mainnet    = "mainnet"
	SolStaging = "solana-staging" // Note this is testnet staging for Solana.
)

Variables

This section is empty.

Functions

func Load added in v0.40.0

func Load(
	getCtx func() context.Context,
	lggr logger.Logger,
	env string,
	domain cldf_domain.Domain,
	useRealBackends bool,
	opts ...LoadEnvironmentOption,
) (cldf.Environment, error)

Types

type AnvilChainsOutput added in v0.41.0

type AnvilChainsOutput struct {
	Chains       map[uint64]cldfevm.Chain
	ForkClients  map[uint64]ForkedOnchainClient
	ChainConfigs map[uint64]ChainConfig
}

AnvilChainsOutput represents the output of the newAnvilChains function.

type ChainConfig added in v0.41.0

type ChainConfig struct {
	ChainID  string // chain id as per EIP-155
	HTTPRPCs []RPCs // http rpcs to connect to the chain
}

ChainConfig represents the configuration for a chain.

type ForkedEnvironment added in v0.41.0

type ForkedEnvironment struct {
	cldf.Environment
	ChainConfigs map[uint64]ChainConfig
	ForkClients  map[uint64]ForkedOnchainClient
}

ForkedEnvironment represents a forked deployment environment. It embeds a standard environment with the addition of a client for forking per chain.

func LoadForkedEnvironment added in v0.41.0

func LoadForkedEnvironment(ctx context.Context, lggr logger.Logger, env string, domain domain.Domain, blockNumbers map[uint64]*big.Int, opts ...LoadEnvironmentOption) (ForkedEnvironment, error)

LoadForkedEnvironment loads a deployment environment in which the chains are forks of real networks. Provides access to a forking client per chain that allows users to send transactions without signatures.

Limitations: - EVM only

func (ForkedEnvironment) ApplyChangesetOutput added in v0.41.0

func (e ForkedEnvironment) ApplyChangesetOutput(ctx context.Context, output cldf.ChangesetOutput) (ForkedEnvironment, error)

ApplyChangesetOutput executes MCMS proposals and merges addresses into the address book.

type ForkedOnchainClient added in v0.41.0

type ForkedOnchainClient interface {
	// SendTransaction sends transaction data from one address to another.
	// Implementations should ensure that the transaction doesn't need a valid signature to be accepted.
	SendTransaction(ctx context.Context, from string, to string, data []byte) error
}

ForkedOnchainClient is a client for a fork of a blockchain node. It should be able to send transactions from any address without the need for a private key.

type LoadEnvironmentOption added in v0.40.0

type LoadEnvironmentOption func(*LoadEnvironmentOptions)

LoadEnvironmentOption is a function that modifies LoadEnvironmentOptions.

func OnlyLoadChainsFor added in v0.40.0

func OnlyLoadChainsFor(migrationKey string, chainsSelectors []uint64) LoadEnvironmentOption

OnlyLoadChainsFor will configure the environment to load only the specified chains for the given migration key. By default, if option is not specified, all chains are loaded. This is useful for migrations that are only applicable to a subset of chains.

func WithAnvilKeyAsDeployer added in v0.40.0

func WithAnvilKeyAsDeployer() LoadEnvironmentOption

WithAnvilKeyAsDeployer sets the private key of the forked environment to use the Anvil key as the deployer key.

func WithOperationRegistry added in v0.40.0

func WithOperationRegistry(registry *operations.OperationRegistry) LoadEnvironmentOption

WithOperationRegistry will configure the bundle in environment to use the specified operation registry.

func WithReporter added in v0.40.0

func WithReporter(reporter operations.Reporter) LoadEnvironmentOption

WithReporter sets the reporter for LoadEnvironment.

func WithoutJD added in v0.40.0

func WithoutJD() LoadEnvironmentOption

WithoutJD will configure the environment to not load Job Distributor. By default, if option is not specified, Job Distributor is loaded. This is useful for migrations that do not require Job Distributor to be loaded. WARNING: This will set env.Offchain to nil. Ensure that you do not use env.Offchain.

type LoadEnvironmentOptions added in v0.40.0

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

LoadEnvironmentOptions contains configuration options for LoadEnvironment.

type RPCs added in v0.41.0

type RPCs struct {
	External string
}

RPCs represents the internal and external RPCs for a chain.

Jump to

Keyboard shortcuts

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