solvm

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataDirectory           string = ".solvm"
	DataDirectoryContextKey string = "DataDirectory"
)
View Source
const (
	BinDirectory   string = "bin"
	ConfigFilename string = "config"
	AliasedSolc    string = "solvm_solc"
)
View Source
const (
	DataDirectoryEnvKey string = "SOLVM_DATA_DIRECTORY"
)

Variables

This section is empty.

Functions

func AddVToSemver

func AddVToSemver(semverStr string) string

AddVToSemver literally just adds the "v" prefix to an otherwise "valid" semver string if it doesn't already have it.

func DefaultDataDirectory

func DefaultDataDirectory() string

DefaultDataDirectory returns the full path to the default directory solvm uses to store configuration and data, which is $HOME/.solvm.

func DownloadBinary

func DownloadBinary(downloadPath string, version string) (string, error)

DownloadBinary downloads the solc binary with the specified version from the ethereum/solidity repo's releases. This function calls DownloadBinaryForOS using the output of runtime.GOOS.

func DownloadBinaryForOS

func DownloadBinaryForOS(downloadPath string, version string, desiredOS string) (string, error)

DownloadBinaryForOS downloads the solc binary with the specified version and OS from the ethereum/solidity repo's releases. Valid values for desiredOS: "linux", "darwin", "macos", "windows". If successful, returns the path where the binary was downloaded.

func InitializeConfig

func InitializeConfig(dataDirectory, version string) error

func ResetConfig

func ResetConfig(dataDirectory string, keepBinaries bool, config *Config) error

Types

type Config

type Config struct {
	VersionUsing      string            `yaml:"version_using"`
	InstalledVersions map[string]string `yaml:"installed_versions,flow"` // version => binary filename
	Aliases           map[string]string `yaml:"aliases,flow"`            // alias => version
	// contains filtered or unexported fields
}

Config contains solvm configuration data. By default, it's located at $HOME/.solvm/config

func LoadConfig

func LoadConfig(dataDirectory string) (*Config, error)

func (*Config) AddAlias

func (c *Config) AddAlias(alias, version string) error

func (*Config) AddInstalledVersion

func (c *Config) AddInstalledVersion(version, binPath string) error

func (Config) BinDirectory

func (c Config) BinDirectory() string

func (Config) FindAlias

func (c Config) FindAlias(version string) string

func (*Config) NukeVersion

func (c *Config) NukeVersion(version string) error

func (*Config) RemoveAlias

func (c *Config) RemoveAlias(alias string) error

func (*Config) RemoveInstalledVersion

func (c *Config) RemoveInstalledVersion(version string) error

func (*Config) SetVersionUsing

func (c *Config) SetVersionUsing(version string) error

func (Config) SolvmAliasPath

func (c Config) SolvmAliasPath() string

type SolcBinListResponse

type SolcBinListResponse struct {
	Builds        []SolcBuildEntry  `json:"builds"`
	Releases      map[string]string `json:"releases"` // map in the format of version => path
	LatestRelease string            `json:"latestRelease"`
}

SolcBinListResponse is based on the response data from https://binaries.soliditylang.org/bin/list.json

func ListRemote

func ListRemote() (*SolcBinListResponse, error)

ListRemote returns the response from https://binaries.soliditylang.org/bin/list.json, which contains all known/released versions of solc.

type SolcBuildEntry

type SolcBuildEntry struct {
	Path        string   `json:"path"`
	Version     string   `json:"version"`     // the "short" version identifier, ex. 0.7.6
	Build       string   `json:"build"`       // the git commit of this release
	LongVersion string   `json:"longVersion"` // Version + Build
	Prerelease  string   `json:"prerelease"`
	Keccak256   string   `json:"keccak256"` // Not sure if I'll end up using this...
	Sha256      string   `json:"sha256"`
	Urls        []string `json:"urls"`
}

SolcBuildEntry is based on the "builds" field found in the response data from https://binaries.soliditylang.org/bin/list.json

func GetVersionFromUserInput

func GetVersionFromUserInput(versionInput string, listResponse *SolcBinListResponse) *SolcBuildEntry

GetVersionFromUserInput basically takes anything a user could put in as a solc "version identifier", such as the release's commit number, short version, or the always-fun combo of both, and returns the relevant data from the /list.json api response. Or nil. nil works too.

Jump to

Keyboard shortcuts

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