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 ParseCoinsNormalizedWithPercentageRequired(coins string) (sdk.Coins, error)
- func SetChainID(genesisPath, chainID string) error
- func SetGenesisTime(genesisPath string, genesisTime int64) error
- func VerifyPeerFormat(peer launchtypes.Peer) bool
- type ChainGenesis
- type Genesis
- type GentxInfo
- type StargateGentx
Constants ¶
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 ParseCoinsNormalizedWithPercentageRequired ¶ added in v0.21.0
ParseCoinsNormalizedWithPercentageRequired parses coins by requiring percentages. format: 20%foo,50%staking
func SetGenesisTime ¶
SetGenesisTime sets the genesis time inside a genesis file
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 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