Documentation
¶
Index ¶
- Constants
- Variables
- func ChangeAddressPrefix(address, newPrefix string) (string, error)
- func CheckGenesisContainsAddress(genesisPath, addr string) (bool, error)
- func GenesisAndHashFromURL(ctx context.Context, url string) (genesis []byte, hash string, err error)
- func GetAddressPrefix(address string) (string, error)
- func UpdateGenesis(genesisPath string, options ...GenesisField) error
- func VerifyPeerFormat(peer launchtypes.Peer) bool
- type ChainGenesis
- type Genesis
- type GenesisField
- type GentxInfo
- type StargateGentx
Constants ¶
const ( FieldGenesisTime = "genesis_time" FieldChainID = "chain_id" FieldConsumerChainID = "app_state.monitoringp.params.consumerChainID" FieldLastBlockHeight = "app_state.monitoringp.params.lastBlockHeight" FieldConsensusTimestamp = "app_state.monitoringp.params.consumerConsensusState.timestamp" FieldConsensusNextValidatorsHash = "app_state.monitoringp.params.consumerConsensusState.nextValidatorsHash" FieldConsensusRootHash = "app_state.monitoringp.params.consumerConsensusState.root.hash" FieldConsumerUnbondingPeriod = "app_state.monitoringp.params.consumerUnbondingPeriod" FieldConsumerRevisionHeight = "app_state.monitoringp.params.consumerRevisionHeight" )
const (
ChainConfigDir = "config"
)
Variables ¶
var GentxFilename = "gentx.json"
Functions ¶
func ChangeAddressPrefix ¶
ChangeAddressPrefix returns the address with another prefix
func CheckGenesisContainsAddress ¶
CheckGenesisContainsAddress returns true if the address exist into the genesis file
func GenesisAndHashFromURL ¶
func GenesisAndHashFromURL(ctx context.Context, url string) (genesis []byte, hash string, err error)
GenesisAndHashFromURL fetches the genesis from the given url and returns its content along with the sha256 hash.
func GetAddressPrefix ¶
GetAddressPrefix returns the bech 32 prefix used by the address
func UpdateGenesis ¶ added in v0.22.0
func UpdateGenesis(genesisPath string, options ...GenesisField) error
func VerifyPeerFormat ¶
func VerifyPeerFormat(peer launchtypes.Peer) bool
VerifyPeerFormat checks if the peer address format is valid
Types ¶
type ChainGenesis ¶
type ChainGenesis struct {
ChainID string `json:"chain_id"`
AppState struct {
Auth struct {
Accounts []struct {
Address string `json:"address"`
} `json:"accounts"`
} `json:"auth"`
Staking struct {
Params struct {
BondDenom string `json:"bond_denom"`
} `json:"params"`
} `json:"staking"`
} `json:"app_state"`
}
ChainGenesis represents the stargate genesis file
func ParseChainGenesis ¶
func ParseChainGenesis(genesisFile []byte) (chainGenesis ChainGenesis, err error)
ParseChainGenesis parse ChainGenesis object from a byte slice
type Genesis ¶
Genesis represents a more readable version of the stargate genesis file
func ParseGenesis ¶
ParseGenesis parse ChainGenesis object from a byte slice into a Genesis object
func ParseGenesisFromPath ¶
ParseGenesisFromPath parse ChainGenesis object from a genesis file
func (Genesis) HasAccount ¶
HasAccount check if account exist into the genesis account
type GenesisField ¶ added in v0.22.0
type GenesisField func(fields)
GenesisField configures the genesis key value fields.
func WithKeyValue ¶ added in v0.22.0
func WithKeyValue(key, value string) GenesisField
WithKeyValue sets key and value field to genesis file
func WithKeyValueBoolean ¶ added in v0.22.0
func WithKeyValueBoolean(key string, value bool) GenesisField
WithKeyValueBoolean sets key and boolean value field to genesis file
func WithKeyValueInt ¶ added in v0.22.0
func WithKeyValueInt(key string, value int64) GenesisField
WithKeyValueInt sets key and int64 value field to genesis file
func WithKeyValueTimestamp ¶ added in v0.22.0
func WithKeyValueTimestamp(key string, value int64) GenesisField
WithKeyValueTimestamp sets key and timestamp value field to genesis file
func WithKeyValueUint ¶ added in v0.22.0
func WithKeyValueUint(key string, value uint64) GenesisField
WithKeyValueUint sets key and uint64 value field to genesis file
type GentxInfo ¶
type GentxInfo struct {
DelegatorAddress string
PubKey ed25519.PubKey
SelfDelegation sdk.Coin
Memo string
}
GentxInfo represents the basic info about gentx file
func GentxFromPath ¶
GentxFromPath returns GentxInfo from the json file
type StargateGentx ¶
type StargateGentx struct {
Body struct {
Messages []struct {
DelegatorAddress string `json:"delegator_address"`
ValidatorAddress string `json:"validator_address"`
PubKey struct {
Type string `json:"@type"`
Key string `json:"key"`
} `json:"pubkey"`
Value struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"value"`
} `json:"messages"`
Memo string `json:"memo"`
} `json:"body"`
}
StargateGentx represents the stargate gentx file