Documentation ¶
Index ¶
Constants ¶
const ( // NativeDenominationKey is the key used to signify the native denomination. NativeDenominationKey = "_" // ContextKeyParaTimeCfg is the key to retrieve the current ParaTime config from a context. ContextKeyParaTimeCfg = contextKey("runtime/paratime-cfg") )
Variables ¶
var DefaultNetworks = Networks{ Default: "mainnet", All: map[string]*Network{ "mainnet": { ChainContext: "bb3d748def55bdfb797a2ac53ee6ee141e54cd2ab2dc2375f4a0703a178e6e55", RPC: "grpc.oasis.io:443", Denomination: DenominationInfo{ Symbol: "ROSE", Decimals: 9, }, ParaTimes: ParaTimes{ Default: "sapphire", All: map[string]*ParaTime{ "cipher": { ID: "000000000000000000000000000000000000000000000000e199119c992377cb", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "ROSE", Decimals: 9, }, }, ConsensusDenomination: NativeDenominationKey, }, "emerald": { ID: "000000000000000000000000000000000000000000000000e2eaa99fc008f87f", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "ROSE", Decimals: 18, }, }, ConsensusDenomination: NativeDenominationKey, }, "sapphire": { ID: "000000000000000000000000000000000000000000000000f80306c9858e7279", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "ROSE", Decimals: 18, }, }, ConsensusDenomination: NativeDenominationKey, }, }, }, }, "testnet": { ChainContext: "0b91b8e4e44b2003a7c5e23ddadb5e14ef5345c0ebcb3ddcae07fa2f244cab76", RPC: "testnet.grpc.oasis.io:443", Denomination: DenominationInfo{ Symbol: "TEST", Decimals: 9, }, ParaTimes: ParaTimes{ Default: "sapphire", All: map[string]*ParaTime{ "cipher": { ID: "0000000000000000000000000000000000000000000000000000000000000000", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "TEST", Decimals: 9, }, }, ConsensusDenomination: NativeDenominationKey, }, "emerald": { ID: "00000000000000000000000000000000000000000000000072c8215e60d5bca7", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "TEST", Decimals: 18, }, }, ConsensusDenomination: NativeDenominationKey, }, "sapphire": { ID: "000000000000000000000000000000000000000000000000a6d1e3ebf60dff6c", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "TEST", Decimals: 18, }, }, ConsensusDenomination: NativeDenominationKey, }, "pontusx_dev": { Description: "Pontus-X Devnet", ID: "0000000000000000000000000000000000000000000000004febe52eb412b421", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "EUROe", Decimals: 18, }, "TEST": { Symbol: "TEST", Decimals: 18, }, }, ConsensusDenomination: "TEST", }, "pontusx_test": { Description: "Pontus-X Testnet", ID: "00000000000000000000000000000000000000000000000004a6f9071c007069", Denominations: map[string]*DenominationInfo{ NativeDenominationKey: { Symbol: "EUROe", Decimals: 18, }, "TEST": { Symbol: "TEST", Decimals: 18, }, }, ConsensusDenomination: "TEST", }, }, }, }, }, }
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.
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 is a map of denominations supported by the ParaTime. Denominations map[string]*DenominationInfo `mapstructure:"denominations,omitempty"` // ConsensusDenomination is the denomination that represents the consensus layer denomination. // If empty, it means that the ParaTime does not support consensus layer transfers. ConsensusDenomination string `mapstructure:"consensus_denomination,omitempty"` }
ParaTime contains the configuration parameters of a ParaTime.
func (*ParaTime) GetDenominationInfo ¶
func (p *ParaTime) GetDenominationInfo(d string) *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.