commands

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: 50 Imported by: 0

Documentation

Overview

Package commands contains common commands that can be injected into each domain's CLI application.

Index

Constants

View Source
const (
	// BytecodeOffset takes a length-128 hex string sample at the end of the contract bytecode to compare in transaction data.
	// 128 hex (64 bytes) provides both minimum collision risk with encoded constructor args, and minimum mismatch risk with transaction init data.
	BytecodeOffset = 128
)

Variables

This section is empty.

Functions

func GetContractCreationTx added in v0.42.0

func GetContractCreationTx(ctx context.Context, endpoint string, addressStr string, apiKey string) (string, error)

GetContractCreationTx finds contract creation tx by querying getcontractcreation action. It is a short-cut provided by most Etherscan instances.

func GetContractCreationTxFallback added in v0.42.0

func GetContractCreationTxFallback(ctx context.Context, endpoint string, addressStr string, apiKey string) (string, error)

GetContractCreationTxFallback finds contract creation tx by searching tx history. Some Etherscan instances may not support getcontractcreation action, we can fall back to parsing transaction history. Example offenders are Avax Fuji Etherscan and BSC Testnet Etherscan

func IsContractVerified added in v0.42.0

func IsContractVerified(ctx context.Context, endpoint string, addressStr string, apiKey string) (bool, error)

Types

type APIResponse added in v0.42.0

type APIResponse struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type AddressTxListResponse added in v0.42.0

type AddressTxListResponse struct {
	APIResponse
	Result []struct {
		BlockNumber string `json:"blockNumber"`
		TimeStamp   string `json:"timeStamp"`
		Hash        string `json:"hash"`
	} `json:"result"`
}

type Commands

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

Commands provides a set of common commands that can be integrated into Domain-specific CLIs.

func NewCommands

func NewCommands(lggr logger.Logger) *Commands

NewCommands creates a new instance of Commands.

func (Commands) NewDurablePipelineCmds added in v0.44.0

func (c Commands) NewDurablePipelineCmds(
	domain dom.Domain,
	loadMigration func(envName string) (*cs.ChangesetsRegistry, error),
	decodeProposalCtxProvider func(env fdeployment.Environment) (analyzer.ProposalContext, error),
	loadConfigResolvers *fresolvers.ConfigResolverManager) *cobra.Command

TODO: envLoader needs to be refactored to an interface so we can mock it for testing to avoid using real backends

func (Commands) NewEnvCmds

func (c Commands) NewEnvCmds(
	domain domain.Domain,
) *cobra.Command

NewEnvCmds creates a new set of commands for managing environment.

func (Commands) NewEvmCmds added in v0.42.0

func (c Commands) NewEvmCmds(domain domain.Domain) *cobra.Command

NewEvmCmds creates EVM-related commands for managing gas, nonces, and node funding.

func (Commands) NewJDCmds added in v0.42.0

func (c Commands) NewJDCmds(domain domain.Domain) *cobra.Command

NewJDCmds holds the commands related to job distributor.

func (Commands) NewMigrationCmds added in v0.44.0

func (c Commands) NewMigrationCmds(
	domain domain.Domain,
	loadFunc LoadRegistryFunc,
	decodeProposalContext DecodeProposalCtxProvider,
) *cobra.Command

NewMigrationCmds creates a new set of commands for managing migrations.

func (Commands) NewStateCmds

func (c Commands) NewStateCmds(dom domain.Domain, config StateConfig) *cobra.Command

NewStateCmds creates a new set of commands for state environment.

type ContractABIResponse added in v0.42.0

type ContractABIResponse struct {
	APIResponse
	Result string `json:"result"`
}

type ContractCreationResult added in v0.42.0

type ContractCreationResult struct {
	ContractAddress string `json:"contractAddress"`
	ContractCreator string `json:"contractCreator"`
	TxHash          string `json:"txHash"`
}

type ContractCreationTxResponse added in v0.42.0

type ContractCreationTxResponse struct {
	APIResponse
	Result json.RawMessage `json:"result"`
}

type ContractToVerify added in v0.42.0

type ContractToVerify struct {
	Selector        uint64 `toml:"selector"`
	Environment     string `toml:"environment"`
	ContractAddress string `toml:"contract_address"`
	ContractName    string `toml:"contract_name"`
	OptimizerRuns   uint64 `toml:"optimizer_runs"`
	CompilerVersion string `toml:"compiler_version"`
}

type ContractsToVerify added in v0.42.0

type ContractsToVerify struct {
	Contracts []ContractToVerify `toml:"contracts"`
}

type DecodeProposalCtxProvider added in v0.44.0

type DecodeProposalCtxProvider func(env deployment.Environment) (analyzer.ProposalContext, error)

DecodeProposalCtxProvider is a function type that adds decoding context based on the environment.

type LoadRegistryFunc added in v0.44.0

type LoadRegistryFunc func(envKey string) (*changeset.ChangesetsRegistry, error)

LoadRegistryFunc is a function type that loads the migrations registry for a given environment key.

type NodeSet added in v0.42.0

type NodeSet struct {
	Nodes []fnode.NodeCfg `json:"nodes" toml:"nodes"`
}

type NodeView added in v0.42.0

type NodeView struct {
	*nodev1.Node
	// CreatedAt is the creation timestamp of the node
	CreatedAt string `json:"created_at"`
	// UpdatedAt is the last updated timestamp of the node
	UpdatedAt string `json:"updated_at"`

	// Jobs maps a job UUID to a list of proposal views
	Jobs map[string][]ProposalView `json:"jobs,omitempty"`
}

NodeView is a view of a node that optionally includes a map of jobs.

type ProposalView added in v0.42.0

type ProposalView struct {
	ID                 string `json:"id"`
	JobID              string `json:"job_id"`
	Status             string `json:"status"`
	Revision           int64  `json:"revision"`
	DeliveryStatus     string `json:"delivery_status"`
	CreatedAt          string `json:"created_at"`
	UpdatedAt          string `json:"updated_at"`
	AckedAt            string `json:"acked_at"`
	ResponseReceivedAt string `json:"response_received_at"`
}

ProposalView is the viewable version of a proposal.

type StateConfig

type StateConfig struct {
	ViewState deployment.ViewStateV2
}

Jump to

Keyboard shortcuts

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