Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultPaths() []string
- func Exists(path string) bool
- func GlobalPath() string
- func IsDefaultPath(paths []string) bool
- func ParseSourceString(s string) (network, address, contractName string, err error)
- type Account
- type AccountKey
- type Accounts
- type Alias
- type Aliases
- type Config
- type Contract
- type ContractDeployment
- type Contracts
- func (c *Contracts) AddDependencyAsContract(dependency Dependency, networkName string)
- func (c *Contracts) AddOrUpdate(contract Contract)
- func (c *Contracts) ByName(name string) (*Contract, error)
- func (c *Contracts) DependencyContractByName(name string) *Contract
- func (c *Contracts) GetAliases(canonicalName string) []*Contract
- func (c *Contracts) Remove(name string) error
- func (c *Contracts) ValidateCanonical() error
- type Dependencies
- type Dependency
- type Deployment
- type Deployments
- func (d *Deployments) AddOrUpdate(deployment Deployment)
- func (d *Deployments) All() Deployments
- func (d *Deployments) ByAccountAndNetwork(account string, network string) *Deployment
- func (d *Deployments) ByNetwork(network string) Deployments
- func (d *Deployments) Remove(account string, network string) error
- type Emulator
- type Emulators
- type KeyType
- type Loader
- type Network
- type Networks
- type Parser
- type Parsers
- type ReaderWriter
- type Source
Constants ¶
const ( DefaultHashAlgo = crypto.SHA3_256 DefaultSigAlgo = crypto.ECDSA_P256 )
const DefaultPath = "flow.json"
Variables ¶
var ( DefaultEmulator = Emulator{ Name: "default", ServiceAccount: "emulator-account", Port: 3569, } DefaultEmulators = Emulators{DefaultEmulator} )
var ( EmptyNetwork = Network{} EmulatorNetwork = Network{ Name: "emulator", Host: "127.0.0.1:3569", } TestingNetwork = Network{ Name: "testing", Host: "127.0.0.1:3569", } TestnetNetwork = Network{ Name: "testnet", Host: "access.devnet.nodes.onflow.org:9000", } MainnetNetwork = Network{ Name: "mainnet", Host: "access.mainnet.nodes.onflow.org:9000", } DefaultNetworks = Networks{ EmulatorNetwork, TestingNetwork, TestnetNetwork, MainnetNetwork, } )
var ErrDoesNotExist = errors.New("missing configuration")
ErrDoesNotExist is error to be returned when config file does not exists.
var ErrOutdatedFormat = errors.New("you are using old configuration format")
Functions ¶
func DefaultPaths ¶
func DefaultPaths() []string
DefaultPaths determines default paths for configuration.
func IsDefaultPath ¶
func ParseSourceString ¶
Types ¶
type Account ¶
type Account struct {
Name string
Address flow.Address
Key AccountKey
}
Account defines the configuration for a Flow account.
type AccountKey ¶
type AccountKey struct {
Type KeyType
Index uint32
SigAlgo crypto.SignatureAlgorithm
HashAlgo crypto.HashAlgorithm
ResourceID string
Mnemonic string
DerivationPath string
PrivateKey crypto.PrivateKey
Location string
Env string
}
AccountKey represents account key and all their possible configuration formats.
func NewDefaultAccountKey ¶
func NewDefaultAccountKey(pkey crypto.PrivateKey) AccountKey
func (*AccountKey) IsDefault ¶
func (a *AccountKey) IsDefault() bool
type Accounts ¶
type Accounts []Account
func (*Accounts) AddOrUpdate ¶
AddOrUpdate add new or update if already present.
type Config ¶
type Config struct {
Emulators Emulators
Contracts Contracts
Dependencies Dependencies
Networks Networks
Accounts Accounts
Deployments Deployments
}
Config contains all the configuration for CLI and implements getters and setters for properties. Config is agnostic to format from which it is built and it doesn't provide persistence functionality.
Emulators contains all the emulator config Contracts contains all contracts definitions and their sources Networks defines all the Flow networks addresses Accounts defines Flow accounts and their addresses, private key and more properties Deployments describes which contracts should be deployed to which accounts
type Contract ¶
type Contract struct {
Name string
Location string
Aliases Aliases
IsDependency bool
Canonical string // Reference to canonical contract name if this is an alias
}
Contract defines the configuration for a Cadence contract.
func (*Contract) CanonicalName ¶ added in v2.8.0
CanonicalName returns the canonical contract name if this is an alias, otherwise returns the contract's own name.
type ContractDeployment ¶
ContractDeployment defines the deployment of the contract with possible args.
type Contracts ¶
type Contracts []Contract
func (*Contracts) AddDependencyAsContract ¶
func (c *Contracts) AddDependencyAsContract(dependency Dependency, networkName string)
AddDependencyAsContract adds a dependency as a contract if it doesn't already exist.
func (*Contracts) AddOrUpdate ¶
AddOrUpdate add new or update if already present.
func (*Contracts) DependencyContractByName ¶
func (*Contracts) GetAliases ¶ added in v2.8.0
GetAliases returns all contracts that have the given contract as their canonical.
func (*Contracts) ValidateCanonical ¶ added in v2.8.0
ValidateCanonical validates that all canonical references are valid.
type Dependencies ¶
type Dependencies []Dependency
func (*Dependencies) AddOrUpdate ¶
func (d *Dependencies) AddOrUpdate(dep Dependency)
func (*Dependencies) ByName ¶
func (d *Dependencies) ByName(name string) *Dependency
func (*Dependencies) ValidateCanonical ¶ added in v2.9.0
func (d *Dependencies) ValidateCanonical() error
ValidateCanonical validates that all canonical references are valid for dependencies.
type Dependency ¶
type Deployment ¶
type Deployment struct {
Network string // network name to deploy to
Account string // account name to which to deploy to
Contracts []ContractDeployment // contracts to deploy
}
Deployment defines the configuration for a contract deployment.
func (*Deployment) AddContract ¶
func (d *Deployment) AddContract(contract ContractDeployment)
AddContract to deployment list on the account name and network name.
func (*Deployment) RemoveContract ¶
func (d *Deployment) RemoveContract(contractName string)
RemoveContract removes a specific contract by name from an existing deployment identified by account name and network name.
type Deployments ¶
type Deployments []Deployment
func (*Deployments) AddOrUpdate ¶
func (d *Deployments) AddOrUpdate(deployment Deployment)
AddOrUpdate add new or update if already present.
func (*Deployments) All ¶
func (d *Deployments) All() Deployments
All returns a list of all deployments
func (*Deployments) ByAccountAndNetwork ¶
func (d *Deployments) ByAccountAndNetwork(account string, network string) *Deployment
ByAccountAndNetwork get deploy by account and network.
func (*Deployments) ByNetwork ¶
func (d *Deployments) ByNetwork(network string) Deployments
ByNetwork get all deployments by network.
type Emulators ¶
type Emulators []Emulator
func (*Emulators) AddOrUpdate ¶
AddOrUpdate add new or update if already present.
type Loader ¶
type Loader struct {
LoadedLocations []string
// contains filtered or unexported fields
}
Loader contains actions for composing and modifying configuration.
func (*Loader) AddConfigParser ¶
AddConfigParser adds a new configuration parser.
type Network ¶
type Network struct {
Name string
Host string
Key string
Fork string // Source network for alias resolution (e.g., "mainnet" for forked networks)
}
Network defines the configuration for a Flow network.
type Networks ¶
type Networks []Network
func (*Networks) AddOrUpdate ¶
AddOrUpdate add new network or update if already present.
type Parser ¶
type Parser interface {
Serialize(*Config) ([]byte, error)
Deserialize([]byte) (*Config, error)
SupportsFormat(string) bool
}
Parser is interface for any configuration format parser to implement.
type Parsers ¶
type Parsers []Parser
Parsers is a list of all configuration parsers.
func (*Parsers) FindForFormat ¶
FindForFormat finds a parser that can parse a specific format based on extension.