Documentation ¶
Index ¶
- Variables
- func DefaultDirectory() string
- func Load(v *viper.Viper) error
- func ResetDefaults()
- func Save(v *viper.Viper) error
- type Account
- type AddressBook
- type AddressBookEntry
- type Config
- type Wallet
- func (w *Wallet) Create(name string, passphrase string, nw *Account) error
- func (w *Wallet) Import(name string, passphrase string, nw *Account, src *wallet.ImportSource) error
- func (w *Wallet) Load(name string, passphrase string) (wallet.Account, error)
- func (w *Wallet) Migrate() (bool, error)
- func (w *Wallet) Remove(name string) error
- func (w *Wallet) Rename(old, new string) error
- func (w *Wallet) SetDefault(name string) error
- func (w *Wallet) Validate() error
Constants ¶
This section is empty.
Variables ¶
var Default = Config{ Networks: config.DefaultNetworks, }
Default is the default config that should be used in case no configuration file exists.
var OldNetworks = map[string][]string{
"testnet": {
"50304f98ddb656620ea817cc1446c401752a05a249b36c9b90dba4616829977a",
},
}
OldNetworks contains information about old versions (e.g. chain contexts) of known networks so they can be automatically migrated.
Functions ¶
func DefaultDirectory ¶ added in v0.3.0
func DefaultDirectory() string
DefaultDirectory returns the path to the default configuration directory.
func ResetDefaults ¶
func ResetDefaults()
ResetDefaults resets the global configuration to defaults.
Types ¶
type Account ¶
type Account struct { Description string `mapstructure:"description"` Kind string `mapstructure:"kind"` Address string `mapstructure:"address"` // Config contains kind-specific configuration for this wallet. Config map[string]interface{} `mapstructure:",remain"` }
Account is an account configuration object.
func (*Account) GetAddress ¶
GetAddress returns the parsed account address.
func (*Account) HasConsensusSigner ¶
HasConsensusSigner returns true, iff there is a consensus layer signer associated with this account.
func (*Account) LoadFactory ¶
LoadFactory loads the account factory corresponding to this account's kind.
func (*Account) PrettyKind ¶
PrettyKind returns a human-friendly account kind.
func (*Account) SetConfigFromFlags ¶
SetConfigFromFlags populates the kind-specific configuration from CLI flags.
type AddressBook ¶
type AddressBook struct { // All is a map of all configured address entries in the address book. All map[string]*AddressBookEntry `mapstructure:",remain"` }
AddressBook contains the configuration of the address book.
func (*AddressBook) Add ¶
func (ab *AddressBook) Add(name string, address string) error
Add adds new address book entry.
func (*AddressBook) Remove ¶
func (ab *AddressBook) Remove(name string) error
Remove removes the given address book entry.
func (*AddressBook) Rename ¶
func (ab *AddressBook) Rename(old, new string) error
Rename renames an existing address book entry.
func (*AddressBook) Validate ¶
func (ab *AddressBook) Validate() error
Validate performs config validation.
type AddressBookEntry ¶
type AddressBookEntry struct { Description string `mapstructure:"description"` Address string `mapstructure:"address"` EthAddress string `mapstructure:"eth_address,omitempty"` }
AddressBookEntry is a configuration object for a single entry in the address book.
func (*AddressBookEntry) GetAddress ¶
func (a *AddressBookEntry) GetAddress() types.Address
GetAddress returns the native address object.
func (*AddressBookEntry) GetEthAddress ¶
func (a *AddressBookEntry) GetEthAddress() *ethCommon.Address
GetEthAddress returns the Ethereum address object, if set.
func (*AddressBookEntry) Validate ¶
func (a *AddressBookEntry) Validate() error
Validate performs config validation.
type Config ¶
type Config struct { Networks config.Networks `mapstructure:"networks"` Wallet Wallet `mapstructure:"wallets"` AddressBook AddressBook `mapstructure:"address_book"` // contains filtered or unexported fields }
Config contains the CLI configuration.
func (*Config) Directory ¶ added in v0.3.0
Directory returns the path to the used configuration directory.
func (*Config) Migrate ¶ added in v0.2.0
Migrate migrates the given wallet config entry to the latest version and returns true, if any changes were needed.
type Wallet ¶
type Wallet struct { // Default is the name of the default account. Default string `mapstructure:"default"` // All is a map of all configured accounts in the wallet. All map[string]*Account `mapstructure:",remain"` }
Wallet contains the configuration of the wallet.
func (*Wallet) Import ¶
func (w *Wallet) Import(name string, passphrase string, nw *Account, src *wallet.ImportSource) error
Import imports an existing account.
func (*Wallet) Migrate ¶ added in v0.2.0
Migrate migrates configs of all accounts to the latest version and returns true, if any changes were needed.
func (*Wallet) SetDefault ¶
SetDefault marks the given account as default.