Documentation ¶
Index ¶
- Variables
- func CosmosAddressToHexAddress(cosmosAddr string) (string, error)
- func CosmosAddressToValAddress(cosmosAddr string) (string, error)
- func HexToCosmosAddress(hexAddr string) (string, error)
- func MustCosmosAddressToHexAddress(cosmosAddr string) string
- func MustCosmosAddressToValAddress(cosmosAddr string) string
- func MustHexToCosmosAddress(hexAddr string) string
- func MustNewCosmosAddressFromStr(strAddr string) sdk.AccAddress
- func MustParseCosmosAddress(strAddr string) sdk.AccAddress
- func MustParseCosmosValidatorAddress(strAddr string) sdk.ValAddress
- func MustValAddressToCosmosAddress(cosmosAddr string) string
- func NewCosmosAddressFromStr(strAddr string) (sdk.AccAddress, error)
- func ParseCosmosAddress(strAddr string) (sdk.AccAddress, error)
- func ParseCosmosValidatorAddress(strAddr string) (sdk.ValAddress, error)
- func ValAddressToCosmosAddress(cosmosAddr string) (string, error)
- type KeyInfo
- type PrivateKey
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidPrivateKey = fmt.Errorf("invalid private key") ErrInvalidCosmosAddress = fmt.Errorf("invalid cosmos address") )
Functions ¶
func CosmosAddressToHexAddress ¶
CosmosAddressToHexAddress converts an address in the cosmos version to the hex version.
func CosmosAddressToValAddress ¶ added in v0.0.5
CosmosAddressToValAddress converts an address in the cosmos version to the corresponding validator address.
func HexToCosmosAddress ¶
HexToCosmosAddress creates a new Cosmos version address from the given hex address.
func MustCosmosAddressToHexAddress ¶
MustCosmosAddressToHexAddress is the same as CosmosAddressToHexAddress except that it will panic upon encountering errors.
func MustCosmosAddressToValAddress ¶ added in v0.0.5
MustCosmosAddressToValAddress is the same as CosmosAddressToValAddress except that it will panic upon encountering errors.
func MustHexToCosmosAddress ¶
MustHexToCosmosAddress is the same as HexToCosmosAddress except that it will panic upon encountering errors.
func MustNewCosmosAddressFromStr ¶
func MustNewCosmosAddressFromStr(strAddr string) sdk.AccAddress
MustNewCosmosAddressFromStr is the same as NewCosmosAddressFromStr except that it will panic upon encountering errors.
func MustParseCosmosAddress ¶
func MustParseCosmosAddress(strAddr string) sdk.AccAddress
MustParseCosmosAddress converts the given address (either in hex format or bech32 format) to a valid sdk.AccAddress. It will panic if any error occurs.
func MustParseCosmosValidatorAddress ¶
func MustParseCosmosValidatorAddress(strAddr string) sdk.ValAddress
MustParseCosmosValidatorAddress converts the given address to a valid sdk.ValAddress. It will panic if any error occurs.
func MustValAddressToCosmosAddress ¶ added in v0.0.5
MustValAddressToCosmosAddress is the same as ValAddressToCosmosAddress except that it will panic upon encountering errors.
func NewCosmosAddressFromStr ¶
func NewCosmosAddressFromStr(strAddr string) (sdk.AccAddress, error)
NewCosmosAddressFromStr creates a new sdk.AccAddress from the given bech32-encoded string.
func ParseCosmosAddress ¶
func ParseCosmosAddress(strAddr string) (sdk.AccAddress, error)
ParseCosmosAddress converts the given address (either in hex format or bech32 format) to a valid sdk.AccAddress.
func ParseCosmosValidatorAddress ¶
func ParseCosmosValidatorAddress(strAddr string) (sdk.ValAddress, error)
ParseCosmosValidatorAddress converts the given address to a valid sdk.ValAddress.
func ValAddressToCosmosAddress ¶ added in v0.0.5
ValAddressToCosmosAddress converts a validator address to the corresponding cosmos address.
Types ¶
type KeyInfo ¶
type KeyInfo struct { // PrivateKey is the secret key of the account. PrivateKey string `json:"PrivateKey"` // CosmosAddress is the cosmos version of the address. CosmosAddress string `json:"CosmosAddress"` // EthAddress is the Eth version of the address. EthAddress string `json:"EthAddress"` // ValAddress is the validator version of the address. ValAddress string `json:"ValAddress"` }
KeyInfo holds necessary information of an account on the Astra blockchain.
func NewKeyInfoFromPrivateKey ¶
NewKeyInfoFromPrivateKey recovers the KeyInfo from the given private key.
type PrivateKey ¶
func MustNewPrivateKeyFromString ¶ added in v0.0.4
func MustNewPrivateKeyFromString(privateKeyStr string) *PrivateKey
func NewPrivateKeyFromString ¶
func NewPrivateKeyFromString(privateKeyStr string) (*PrivateKey, error)
func (PrivateKey) AccAddress ¶
func (k PrivateKey) AccAddress() sdk.AccAddress
func (PrivateKey) HexAddress ¶
func (k PrivateKey) HexAddress() common.Address
func (PrivateKey) PubKey ¶
func (k PrivateKey) PubKey() types.PubKey
func (PrivateKey) String ¶
func (k PrivateKey) String() string
func (PrivateKey) ValAddress ¶ added in v0.0.5
func (k PrivateKey) ValAddress() sdk.ValAddress