config

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingKey indicates that a key was expected in the config,
	// but was not found.
	ErrMissingKey = errors.New("missing key")

	// ErrConfigFileNotFound indicates that no config file was found in any of
	// the standard paths.
	ErrConfigFileNotFound = errors.New("config file not found")

	// ErrMalformed indicates that a config file was found, but the
	// JSON contents could not be decoded. This does not indicate a validation
	// error.
	ErrMalformed = errors.New("malformed JSON")

	// ErrValidation indicates a validation error in the config.
	ErrValidation = errors.New("validation error")

	// ErrHomeNotFound indicates that an error was encountered while obtaining
	// the user's home directory.
	ErrHomeNotFound = errors.New("home directory not found")
)
View Source
var BIP0039Genesis, _ = time.Parse("2006/01/02", "2013/09/10")

BIP0039Genesis indicates the earliest date of a BIP39 seed that a Ledger device could possibly have.

Functions

func WriteRescanConf added in v0.18.0

func WriteRescanConf(data *ConfigurationRescan) error

WriteRescanConf writes the rescan information into a file when it does not exist it saves it to the same location where the lss.json is stored

Types

type Account

type Account struct {
	External *string `json:"external"` // output descriptor at external path
	Internal *string `json:"internal"` // output descriptor at internal path
	Depth    *int    `json:"depth"`    // (?) Number of addresses to import
	Birthday *date   `json:"birthday"` // (?) Earliest known creation date (YYYY/MM/DD)
}

Account struct models the configuration of an account on Ledger Live.

Fields marked as (?) are optional.

type Configuration

type Configuration struct {
	RPCURL      *string   `json:"rpcurl"`
	RPCUser     *string   `json:"rpcuser"`
	RPCPassword *string   `json:"rpcpass"`
	TorProxy    string    `json:"torproxy"`
	NoTLS       bool      `json:"notls"`
	Accounts    []Account `json:"accounts"`
}

Configuration is a struct to model the JSON configuration of the project, stored in ~/.lss.json file.

Fields marked as (?) are optional.

func Load

func Load() (*Configuration, error)

Load reads the config file from disk and returns a Configuration.

It searches for the config file in a standard set of directories, in the following order:

  1. Ledger Live user data folder.
  2. Current directory.
  3. User's home directory.

The filename is always expected to be lss.json.

type ConfigurationRescan added in v0.18.0

type ConfigurationRescan struct {
	LastSyncTime    string `json:"last_synctime"`
	TimeStamp       string `json:"timestamp"`
	LastBlock       int64  `json:"last_block"`
	SatstackVersion string `json:"satstack_version"`
}

Type for saving the Rescan time to avoid scanning the wallet always from the beginning

func LoadRescanConf added in v0.18.0

func LoadRescanConf() (*ConfigurationRescan, error)

Jump to

Keyboard shortcuts

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