kin

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Mint         = "kinXdEcpDQeHPEuQnqmUgtYykqKGVFq6CeVX5iAHJq6"
	QuarksPerKin = 100000
	Decimals     = 5
)
View Source
const HighestVersion = 1

HighestVersion is the highest 'supported' memo version by the implementation.

View Source
const MaxTransactionType = TransactionTypeP2P

MaxTransactionType is the maximum transaction type 'supported' by the implementation.

Variables

View Source
var (
	TokenMint = ed25519.PublicKey{11, 51, 56, 160, 171, 44, 200, 65, 213, 176, 20, 188, 106, 60, 247, 86, 41, 24, 116, 179, 25, 201, 81, 125, 155, 191, 169, 228, 233, 102, 30, 249}
)

Functions

func FromQuarks

func FromQuarks(quarks uint64) uint64

func IsValidMemo

func IsValidMemo(m Memo) bool

IsValidMemo returns whether or not the memo is valid.

It should be noted that there are no guarantees if the memo is valid, only if the memo is invalid. That is, this function may return false positives.

Stricter validation can be done via the IsValidMemoStrict. However, IsValidMemoStrict is not as forward compatible as IsValidMemo.

func IsValidMemoStrict

func IsValidMemoStrict(m Memo) bool

IsValidMemoStrict returns whether or not the memo is valid checking against this SDKs supported version and transaction types.

It should be noted that there are no guarantees if the memo is valid, only if the memo is invalid. That is, this function may return false positives.

func MustStrToQuarks

func MustStrToQuarks(val string) int64

MustStrToQuarks calls StrToQuarks, panicking if there's an error.

This should only be used if you know for sure this will not panic.

func StrFromQuarks

func StrFromQuarks(amount int64) string

StrFromQuarks converts an int64 amount of quarks to the string representation of kin.

func StrToQuarks

func StrToQuarks(val string) (int64, error)

StrToQuarks converts a string representation of kin the quark value.

An error is returned if the value string is invalid, or it cannot be accurately represented as quarks. For example, a value smaller than quarks, or a value _far_ greater than the supply.

func ToQuarks

func ToQuarks(kin uint64) uint64

Types

type Memo

type Memo [32]byte

Memo is the 32 byte memo encoded into transactions, as defined in github.com/kinecosystem/agora-api.

func MemoFromBase64String

func MemoFromBase64String(b64 string, strict bool) (m Memo, err error)

func NewMemo

func NewMemo(v byte, t TransactionType, appIndex uint16, foreignKey []byte) (m Memo, err error)

NewMemo creates a new Memo with the specified parameters.

func (Memo) AppIndex

func (m Memo) AppIndex() uint16

AppIndex returns the app index of the memo.

func (Memo) ForeignKey

func (m Memo) ForeignKey() (fk []byte)

ForeignKey returns the foreign key of the memo.

func (Memo) TransactionType

func (m Memo) TransactionType() TransactionType

TransactionType returns the transaction type of the memo.

func (Memo) TransactionTypeRaw

func (m Memo) TransactionTypeRaw() TransactionType

TransactionTypeRaw returns the transaction type of the memo, even if it is unsupported by this SDK. It should only be used as a fall back if the raw value is needed when TransactionType() yields TransactionTypeUnknown.

func (Memo) Version

func (m Memo) Version() byte

Version returns the version of the memo.

type TransactionType

type TransactionType int16

TransactionType is the memo transaction type.

const (
	TransactionTypeUnknown TransactionType = iota - 1
	TransactionTypeNone
	TransactionTypeEarn
	TransactionTypeSpend
	TransactionTypeP2P
)

Jump to

Keyboard shortcuts

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