Documentation ¶
Index ¶
Constants ¶
const NativeDenominationKey = "_"
NativeDenominationKey is the key used to signify the native denomination.
Variables ¶
var DefaultNetworks = Networks{ Default: "mainnet", All: map[string]*Network{ "mainnet": { ChainContext: "b11b369e0da5bb230b220127f5e7b242d385ef8c6f54906243f30af63c815535", RPC: "grpc.oasis.dev:443", Denomination: DenominationInfo{ Symbol: "ROSE", Decimals: 9, }, ParaTimes: ParaTimes{ Default: "emerald", All: map[string]*ParaTime{ "cipher": { ID: "000000000000000000000000000000000000000000000000e199119c992377cb", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "ROSE", Decimals: 9, }, }, }, "emerald": { ID: "000000000000000000000000000000000000000000000000e2eaa99fc008f87f", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "ROSE", Decimals: 18, }, }, }, "sapphire": { ID: "000000000000000000000000000000000000000000000000f80306c9858e7279", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "ROSE", Decimals: 18, }, }, }, }, }, }, "testnet": { ChainContext: "50304f98ddb656620ea817cc1446c401752a05a249b36c9b90dba4616829977a", RPC: "testnet.grpc.oasis.dev:443", Denomination: DenominationInfo{ Symbol: "TEST", Decimals: 9, }, ParaTimes: ParaTimes{ Default: "emerald", All: map[string]*ParaTime{ "cipher": { ID: "0000000000000000000000000000000000000000000000000000000000000000", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "TEST", Decimals: 9, }, }, }, "emerald": { ID: "00000000000000000000000000000000000000000000000072c8215e60d5bca7", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "TEST", Decimals: 18, }, }, }, "sapphire": { ID: "000000000000000000000000000000000000000000000000a6d1e3ebf60dff6c", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "TEST", Decimals: 18, }, }, }, }, }, }, }, }
DefaultNetworks is the default config containing known networks.
Functions ¶
func ValidateIdentifier ¶
ValidateIdentifier makes sure the given string is a valid identifier.
Types ¶
type DenominationInfo ¶
type DenominationInfo struct { Symbol string `mapstructure:"symbol"` Decimals uint8 `mapstructure:"decimals"` }
DenominationInfo is the denomination information for the given denomination.
func (*DenominationInfo) Validate ¶
func (di *DenominationInfo) Validate() error
Validate performs config validation.
type Network ¶
type Network struct { Description string `mapstructure:"description"` ChainContext string `mapstructure:"chain_context"` RPC string `mapstructure:"rpc"` Denomination DenominationInfo `mapstructure:"denomination"` ParaTimes ParaTimes `mapstructure:"paratimes"` }
Network contains the configuration parameters of a network.
func (*Network) IsLocalRPC ¶
IsLocalRPC checks whether the RPC endpoint points to a local UNIX socket.
type Networks ¶
type Networks struct { // Default is the name of the default network. Default string `mapstructure:"default"` // All is a map of all configured networks. All map[string]*Network `mapstructure:",remain"` }
Networks contains the configuration of supported networks.
func (*Networks) SetDefault ¶
SetDefault sets the given network as the default one.
type ParaTime ¶
type ParaTime struct { Description string `mapstructure:"description"` ID string `mapstructure:"id"` Denominations map[string]*DenominationInfo `mapstructure:"denominations,omitempty"` }
ParaTime contains the configuration parameters of a network.
func (*ParaTime) GetDenominationInfo ¶
func (p *ParaTime) GetDenominationInfo(d types.Denomination) *DenominationInfo
GetDenominationInfo returns the denomination information for the given denomination.
In case the given denomination does not exist, it provides sane defaults.
type ParaTimes ¶
type ParaTimes struct { // Default is the name of the default paratime. Default string `mapstructure:"default"` // All is a map of all configured paratimes. All map[string]*ParaTime `mapstructure:",remain"` }
ParaTimes contains the configuration of supported paratimes.
func (*ParaTimes) SetDefault ¶
SetDefault sets the given paratime as the default one.