Documentation
¶
Overview ¶
Package currency implements conversion backends for different currencies used in a channel.
Use IsSupportedCurrency to check if the currency is supported and NewParser to obtain a parser for that currency.
Index ¶
Constants ¶
const ( // ETHSymbol is the symbol for ethereum's native currency ETHSymbol. ETHSymbol = "ETH" // ETHMaxDecimals is the maximum number of decimal places allowed in ETH representation. ETHMaxDecimals uint8 = 18 )
Define symbol and max decimals for ETH, because there is no token contract for ETH, from which these details can be fetched from.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶ added in v0.6.0
type Registry struct {
// contains filtered or unexported fields
}
Registry implements a currency registry with currency parsers indexed by symbols.
It uses a slice to keep track of registered symbols because iterating over map to retrieve the symbols each time will result in different ordering of symbols in the list.
func NewRegistry ¶ added in v0.6.0
func NewRegistry() *Registry
NewRegistry initializes a currency registry.
func (*Registry) Currency ¶ added in v0.6.0
Currency returns the currency parser registered for the given currency symbol. If no parser is registered, it returns nil.
So, caller should do a nil check before using the currency parser.
func (*Registry) IsRegistered ¶ added in v0.6.0
IsRegistered checks if there is parser registered for the currency represented by the given string.
Directories
¶
Path | Synopsis |
---|---|
Package currencytest implements test helpers for functionalities defined in currency.
|
Package currencytest implements test helpers for functionalities defined in currency. |