cryptos

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BitcoinCash = &Crypto{
		Name:     "bitcoin-cash",
		Short:    "BCH",
		Decimals: 8,
		Type:     UTXO,
	}
	Bitcoin = &Crypto{
		Name:     "bitcoin",
		Short:    "BTC",
		Decimals: 8,
		Type:     UTXO,
	}
	Decred = &Crypto{
		Name:     "decred",
		Short:    "DCR",
		Decimals: 8,
		Type:     UTXO,
	}
	Dogecoin = &Crypto{
		Name:     "dogecoin",
		Short:    "DOGE",
		Decimals: 8,
		Type:     UTXO,
	}
	Litecoin = &Crypto{
		Name:     "litecoin",
		Short:    "LTC",
		Decimals: 8,
		Type:     UTXO,
	}

	Cryptos = map[string]*Crypto{
		"bitcoin-cash": BitcoinCash,
		"bitcoin":      Bitcoin,
		"decred":       Decred,
		"dogecoin":     Dogecoin,
		"litecoin":     Litecoin,
	}
)
View Source
var CryptosShort map[string]*Crypto

CryptosShort contains all available cryptocurrencies

Functions

This section is empty.

Types

type Crypto

type Crypto struct {
	// Name of the crypto
	Name string
	// Short is the ticker
	Short string
	// Decimals used
	Decimals int
	// Type of crypto
	Type Type
}

Crypto represents a cryptocurrency

func Parse

func Parse(s string) (*Crypto, error)

Parse parses a cryptocurrency name

func ParseShort

func ParseShort(s string) (*Crypto, error)

ParseShort parses a cryptocurrency ticker

func (Crypto) MarshalYAML

func (c Crypto) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler

func (Crypto) String

func (c Crypto) String() string

String implement fmt.Stringer

func (*Crypto) UnmarshalYAML

func (c *Crypto) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implement yaml.Unmarshaler

type InvalidCryptoError

type InvalidCryptoError string

InvalidCryptoError represents an error parsing a crypto name

func (InvalidCryptoError) Error

func (e InvalidCryptoError) Error() string

Error implement error

type InvalidTypeError

type InvalidTypeError string

func (InvalidTypeError) Error

func (e InvalidTypeError) Error() string

type Type

type Type int
const (
	UTXO Type = iota
	StateBased
	ERC20Token
)

func ParseType

func ParseType(s string) (Type, error)

func (Type) MarshalYAML

func (v Type) MarshalYAML() (interface{}, error)

func (*Type) Set

func (v *Type) Set(sv string) error

func (Type) String

func (v Type) String() string

func (*Type) UnmarshalYAML

func (v *Type) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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