Documentation ¶
Index ¶
- Constants
- Variables
- func MaskString6P4(s string) string
- func MustUnpack58(data string) []byte
- func Pack58(data []byte) string
- func StampToTime(timestamp uint64) time.Time
- func Unpack58(data string) ([]byte, error)
- func ValidToken(u uint16) bool
- func ValidWalletTag(u uint8) bool
- type Digest
- type PrivateKey
- type PublicKey
- type Signature
- type Token
- type WalletTag
Constants ¶
const DigestSize = 32
DigestSize is digest length in bytes
const PrivateKeySize = 64
PrivateKeySize is private key length in bytes
const PublicKeySize = 32
PublicKeySize is public key length in bytes
const SignatureSize = 64
SignatureSize is signature length in bytes
Variables ¶
var TokenToString = map[Token]string{ TokenMNT: "MNT", TokenGOLD: "GOLD", }
TokenToString definition
var WalletTagToString = map[WalletTag]string{ WalletTagNode: "node", WalletTagGenesisNode: "gnode", WalletTagSupervisor: "supervisor", WalletTagOwner: "owner", WalletTagEmission: "emission", WalletTagNoFee: "nofee", WalletTagApproved: "approved", WalletTagAuthority: "authority", WalletTagDeposital: "deposital", WalletTagExchange: "exchange", }
WalletTagToString definition
Functions ¶
func MaskString6P4 ¶
MaskString6P4 masks a string exposing first 6 and 4 last symbols, like: YeAHCqTJk4aFnHXGV4zaaf3dTqJkdjQzg8TJENmP3zxDMpa97 => YeAHCq***pa97
func MustUnpack58 ¶
MustUnpack58 does the same as Unpack58, but panics on failure
func StampToTime ¶
StampToTime converts mint timestamp to time.Time
Types ¶
type Digest ¶
type Digest [DigestSize]byte
Digest bytes
func BytesToDigest ¶
BytesToDigest creates an instance from a bytes slice
func MustBytesToDigest ¶ added in v1.2.5
MustBytesToDigest creates an instance from bytes slice or panics
func MustParseDigest ¶ added in v1.2.5
MustParseDigest parses an instance from Base58 string or panics
func ParseDigest ¶
ParseDigest parses an instance from Base58 string
func (Digest) StringMask ¶
StringMask packs the instance into 6+4 a masked Base58 string
func (*Digest) UnmarshalJSON ¶ added in v1.2.1
UnmarshalJSON impl
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
PrivateKey bytes
func BytesToPrivateKey ¶
func BytesToPrivateKey(b []byte) (PrivateKey, error)
BytesToPrivateKey creates an instance from a bytes slice
func MustBytesToPrivateKey ¶ added in v1.2.5
func MustBytesToPrivateKey(b []byte) PrivateKey
MustBytesToPrivateKey creates an instance from bytes slice or panics
func MustNewPrivateKey ¶ added in v1.2.3
func MustNewPrivateKey() PrivateKey
MustNewPrivateKey generates a new random private key or panics on error
func MustParsePrivateKey ¶ added in v1.2.5
func MustParsePrivateKey(s string) PrivateKey
MustParsePrivateKey parses an instance from Base58 string or panics
func NewPrivateKey ¶ added in v1.2.3
func NewPrivateKey() (p PrivateKey, err error)
NewPrivateKey generates a new random private key
func ParsePrivateKey ¶
func ParsePrivateKey(s string) (PrivateKey, error)
ParsePrivateKey parses an instance from Base58 string
func (PrivateKey) PublicKey ¶ added in v1.2.3
func (p PrivateKey) PublicKey() PublicKey
PublicKey of the private key
func (PrivateKey) String ¶
func (p PrivateKey) String() string
String packs the instance into a Base58 string
func (PrivateKey) StringMask ¶
func (p PrivateKey) StringMask() string
StringMask packs the instance into 6+4 a masked Base58 string
func (*PrivateKey) UnmarshalJSON ¶ added in v1.2.1
func (p *PrivateKey) UnmarshalJSON(b []byte) error
UnmarshalJSON impl
type PublicKey ¶
type PublicKey [PublicKeySize]byte
PublicKey bytes
func BytesToPublicKey ¶
BytesToPublicKey creates an instance from a bytes slice
func MustBytesToPublicKey ¶ added in v1.2.5
MustBytesToPublicKey creates an instance from bytes slice or panics
func MustParsePublicKey ¶ added in v1.2.5
MustParsePublicKey parses an instance from Base58 string or panics
func ParsePublicKey ¶
ParsePublicKey parses an instance from Base58 string
func (PublicKey) StringMask ¶
StringMask packs the instance into 6+4 a masked Base58 string
func (*PublicKey) UnmarshalJSON ¶ added in v1.2.1
UnmarshalJSON impl
type Signature ¶
type Signature [SignatureSize]byte
Signature bytes
func BytesToSignature ¶
BytesToSignature creates an instance from a bytes slice
func MustBytesToSignature ¶ added in v1.2.5
MustBytesToSignature creates an instance from bytes slice or panics
func MustParseSignature ¶ added in v1.2.5
MustParseSignature parses an instance from Base58 string or panics
func ParseSignature ¶
ParseSignature parses an instance from Base58 string
func (Signature) StringMask ¶
StringMask packs the instance into 6+4 a masked Base58 string
func (*Signature) UnmarshalJSON ¶ added in v1.2.1
UnmarshalJSON impl
type WalletTag ¶
type WalletTag uint8
WalletTag in Sumus blockchain
const ( // WalletTagNode is a registered node (by "supervisor") WalletTagNode WalletTag = 1 // WalletTagGenesisNode is registered node (in genesis block) WalletTagGenesisNode WalletTag = 2 // WalletTagSupervisor can set/unset tags, fee-free (system, singleton) WalletTagSupervisor WalletTag = 3 // WalletTagOwner is a fee collector, fee-free (system, singleton) WalletTagOwner WalletTag = 4 // WalletTagEmission can emit/burn tokens, fee-free (system) WalletTagEmission WalletTag = 5 // WalletTagNoFee sends transactions without a fee (system) WalletTagNoFee WalletTag = 6 // WalletTagApproved grants ability to a KYC-proved user to send/receive GOLD WalletTagApproved WalletTag = 7 // WalletTagAuthority can set/unset "approved" tag WalletTagAuthority WalletTag = 8 // WalletTagDeposital grants ability to an exchange to send/received GOLD WalletTagDeposital WalletTag = 9 // WalletTagExchange can set/unset "deposital" tag WalletTagExchange WalletTag = 10 )