account

package
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPrivateKey = fmt.Errorf("invalid private key")

	ErrInvalidCosmosAddress = fmt.Errorf("invalid cosmos address")
)

Functions

func CosmosAddressToHexAddress

func CosmosAddressToHexAddress(cosmosAddr string) (string, error)

CosmosAddressToHexAddress converts an address in the cosmos version to the hex version.

func CosmosAddressToValAddress added in v0.0.5

func CosmosAddressToValAddress(cosmosAddr string) (string, error)

CosmosAddressToValAddress converts an address in the cosmos version to the corresponding validator address.

func HexToCosmosAddress

func HexToCosmosAddress(hexAddr string) (string, error)

HexToCosmosAddress creates a new Cosmos version address from the given hex address.

func MustCosmosAddressToHexAddress

func MustCosmosAddressToHexAddress(cosmosAddr string) string

MustCosmosAddressToHexAddress is the same as CosmosAddressToHexAddress except that it will panic upon encountering errors.

func MustCosmosAddressToValAddress added in v0.0.5

func MustCosmosAddressToValAddress(cosmosAddr string) string

MustCosmosAddressToValAddress is the same as CosmosAddressToValAddress except that it will panic upon encountering errors.

func MustHexToCosmosAddress

func MustHexToCosmosAddress(hexAddr string) string

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

func MustValAddressToCosmosAddress(cosmosAddr string) string

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

func ValAddressToCosmosAddress(cosmosAddr string) (string, error)

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

func NewKeyInfoFromPrivateKey(privateKeyStr string) (*KeyInfo, error)

NewKeyInfoFromPrivateKey recovers the KeyInfo from the given private key.

type PrivateKey

type PrivateKey struct {
	types.PrivKey
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL