types

package
v0.0.0-...-29d6195 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bech32PubKeyTypeAccPub    Bech32PubKeyType = "accpub"
	Bech32PubKeyTypeValPub    Bech32PubKeyType = "valpub"
	Bech32PubKeyTypeConsPub   Bech32PubKeyType = "conspub"
	Bech32PubKeyTypeSdsP2PPub Bech32PubKeyType = "sdsp2p"

	AccountPubKeyPrefix     = nexusBech32Prefix + "pub"
	ValidatorAddressPrefix  = nexusBech32Prefix + "valoper"
	ValidatorPubKeyPrefix   = nexusBech32Prefix + "valoperpub"
	ConsNodeAddressPrefix   = nexusBech32Prefix + "valcons"
	ConsNodePubKeyPrefix    = nexusBech32Prefix + "valconspub"
	SdsNodeP2PPubkeyPrefix  = nexusBech32Prefix + "sdspub"
	SdsNodeP2PAddressPrefix = nexusBech32Prefix + "sds"

	CoinType = 606

	HDPath = "m/44'/606'/0'/0/0"
)

Bech32 conversion constants

View Source
const DefaultKeyringServiceName = "nexus"

DefaultKeyringServiceName defines a default service name for the keyring.

Variables

This section is empty.

Functions

func Bech32ifyPubKey

func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey crypto.PubKey) (string, error)

Bech32ifyPubKey returns a Bech32 encoded string containing the appropriate prefix based on the key type provided for a given PublicKey.

func GetPubKeyFromBech32

func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (crypto.PubKey, error)

GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with a given key type.

func KeyringServiceName

func KeyringServiceName() string

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type Bech32PubKeyType

type Bech32PubKeyType string

Bech32PubKeyType defines a string type alias for a Bech32 public key type.

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is the structure that holds the SDK configuration parameters. This could be used to initialize certain configuration parameters for the SDK.

func GetConfig

func GetConfig() *Config

GetConfig returns the config instance for the SDK.

func GetSealedConfig

func GetSealedConfig(ctx context.Context) (*Config, error)

GetSealedConfig returns the config instance for the SDK if/once it is sealed.

func NewConfig

func NewConfig() *Config

New returns a new Config with default values.

func (*Config) GetAddressVerifier

func (config *Config) GetAddressVerifier() func([]byte) error

GetAddressVerifier returns the function to verify that addresses have the correct format

func (*Config) GetBech32AccountAddrPrefix

func (config *Config) GetBech32AccountAddrPrefix() string

GetBech32AccountAddrPrefix returns the Bech32 prefix for account address

func (*Config) GetBech32AccountPubPrefix

func (config *Config) GetBech32AccountPubPrefix() string

GetBech32AccountPubPrefix returns the Bech32 prefix for account public key

func (*Config) GetBech32ConsensusAddrPrefix

func (config *Config) GetBech32ConsensusAddrPrefix() string

GetBech32ConsensusAddrPrefix returns the Bech32 prefix for consensus node address

func (*Config) GetBech32ConsensusPubPrefix

func (config *Config) GetBech32ConsensusPubPrefix() string

GetBech32ConsensusPubPrefix returns the Bech32 prefix for consensus node public key

func (*Config) GetBech32SdsNodeP2PAddrPrefix

func (config *Config) GetBech32SdsNodeP2PAddrPrefix() string

func (*Config) GetBech32SdsNodeP2PPubPrefix

func (config *Config) GetBech32SdsNodeP2PPubPrefix() string

func (*Config) GetBech32ValidatorAddrPrefix

func (config *Config) GetBech32ValidatorAddrPrefix() string

GetBech32ValidatorAddrPrefix returns the Bech32 prefix for validator address

func (*Config) GetBech32ValidatorPubPrefix

func (config *Config) GetBech32ValidatorPubPrefix() string

GetBech32ValidatorPubPrefix returns the Bech32 prefix for validator public key

func (*Config) GetCoinType

func (config *Config) GetCoinType() uint32

GetCoinType returns the BIP-0044 CoinType code on the config.

func (*Config) GetFullFundraiserPath

func (config *Config) GetFullFundraiserPath() string

GetFullFundraiserPath returns the BIP44Prefix.

func (*Config) GetTxEncoder

func (config *Config) GetTxEncoder() sdk.TxEncoder

GetTxEncoder return function to encode transactions

func (*Config) Seal

func (config *Config) Seal() *Config

Seal seals the config such that the config state could not be modified further

func (*Config) SetAddressVerifier

func (config *Config) SetAddressVerifier(addressVerifier func([]byte) error)

SetAddressVerifier builds the Config with the provided function for verifying that addresses have the correct format

func (*Config) SetBech32PrefixForAccount

func (config *Config) SetBech32PrefixForAccount(addressPrefix, pubKeyPrefix string)

SetBech32PrefixForAccount builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts and returns the config instance

func (*Config) SetBech32PrefixForConsensusNode

func (config *Config) SetBech32PrefixForConsensusNode(addressPrefix, pubKeyPrefix string)

SetBech32PrefixForConsensusNode builds the Config with Bech32 addressPrefix and publKeyPrefix for consensus nodes and returns the config instance

func (*Config) SetBech32PrefixForSdsNodeP2P

func (config *Config) SetBech32PrefixForSdsNodeP2P(pubKeyPrefix, p2pAddrPrifx string)

func (*Config) SetBech32PrefixForValidator

func (config *Config) SetBech32PrefixForValidator(addressPrefix, pubKeyPrefix string)

SetBech32PrefixForValidator builds the Config with Bech32 addressPrefix and publKeyPrefix for validators

and returns the config instance

func (*Config) SetCoinType

func (config *Config) SetCoinType(coinType uint32)

Set the BIP-0044 CoinType code on the config

func (*Config) SetFullFundraiserPath

func (config *Config) SetFullFundraiserPath(fullFundraiserPath string)

Set the FullFundraiserPath (BIP44Prefix) on the config

func (*Config) SetTxEncoder

func (config *Config) SetTxEncoder(encoder sdk.TxEncoder)

SetTxEncoder builds the Config with TxEncoder used to marshal StdTx to bytes

type SdsAddress

type SdsAddress []byte

func SdsAddressFromBech32

func SdsAddressFromBech32(address string) (addr SdsAddress, err error)

AccAddressFromBech32 creates an AccAddress from a Bech32 string.

func (SdsAddress) Bytes

func (a SdsAddress) Bytes() []byte

func (SdsAddress) Empty

func (a SdsAddress) Empty() bool

func (SdsAddress) Equals

func (a SdsAddress) Equals(addr sdk.Address) bool

func (SdsAddress) Format

func (a SdsAddress) Format(s fmt.State, verb rune)

func (SdsAddress) Marshal

func (a SdsAddress) Marshal() ([]byte, error)

func (SdsAddress) MarshalJSON

func (a SdsAddress) MarshalJSON() ([]byte, error)

func (SdsAddress) MarshalYAML

func (a SdsAddress) MarshalYAML() (interface{}, error)

MarshalYAML marshals to YAML using Bech32.

func (SdsAddress) String

func (a SdsAddress) String() string

func (*SdsAddress) Unmarshal

func (a *SdsAddress) Unmarshal(data []byte) error

Unmarshal sets the address to the given data. It is needed for protobuf compatibility.

func (*SdsAddress) UnmarshalJSON

func (a *SdsAddress) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON assuming Bech32 encoding.

func (*SdsAddress) UnmarshalYAML

func (a *SdsAddress) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals from JSON assuming Bech32 encoding.

Jump to

Keyboard shortcuts

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