kin

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MIT Imports: 10 Imported by: 16

Documentation

Index

Constants

View Source
const (
	// KinAssetCode is the asset code for Kin 2
	KinAssetCode = "KIN"

	// kin2ProdIssuer is the Kin 2 issuer address on the production Kin 2 network
	Kin2ProdIssuer = "GDF42M3IPERQCBLWFEZKQRK77JQ65SCKTU3CW36HZVCX7XX5A5QXZIVK"
	// kin2TestIssuer is the Kin 2 issuer address on the test Kin 2 network
	Kin2TestIssuer = "GBC3SG6NGTSZ2OMH3FFGB7UVRQWILW367U4GSOOF4TFSZONV42UJXUH7"
)
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 (
	// ErrInvalidKinNetwork occurs when an invalid KinNetwork is provided
	ErrInvalidKinNetwork = errors.New("KinNetwork was not 'mainnet' or 'testnet'")
)

Functions

func GetClient

func GetClient() (client *horizon.Client, err error)

GetClient returns the default Horizon client based on which environment the application is running in.

func GetClientByKinNetwork

func GetClientByKinNetwork(net network.KinNetwork) (client *horizon.Client, err error)

GetClientByKinNetwork returns a Horizon client for the provided Kin network

func GetClientV2

func GetClientV2() (client *horizonclient.Client, err error)

GetClientV2 returns the default stellar based Horizon client based on which environment the application is running in.

The stellar based client offers some additional niceties, notably around retrieving transaction history. It's generally considered to be a better client, however, the functionality _may_ have some divergent behaviour from the kin fork. Therefore, any use of this client should be tested thoroughly.

func GetKin2Client added in v0.40.0

func GetKin2Client() (client *horizon.Client, err error)

GetKin2Client returns the default Kin 2 Horizon client based on which environment the environment is running in

func GetKin2ClientV2 added in v0.40.0

func GetKin2ClientV2() (client *horizonclient.Client, err error)

GetKin2ClientV2 returns the default stellar-based Kin 2 Horizon client based on which environment the application is running in.

The stellar based client offers some additional niceties, notably around retrieving transaction history. It's generally considered to be a better client, however, the functionality _may_ have some divergent behaviour from the kin fork. Therefore, any use of this client should be tested thoroughly.

func GetKin2Issuer added in v0.40.0

func GetKin2Issuer() (issuer string, err error)

GetKin2Issuer returns the Kin issuer address based on which environment the application is running in.

func GetKin2Network added in v0.40.0

func GetKin2Network() (network build.Network, err error)

GetKin2Network returns the default Kin 2 Network modifier based on which environment the application is running in.

func GetNetwork

func GetNetwork() (network build.Network, err error)

GetNetwork returns the default Network modifier based on which environment the application is running in.

func GetNetworkByKinNetwork

func GetNetworkByKinNetwork(net network.KinNetwork) (buildNetwork build.Network, err error)

GetNetworkByKinNetwork returns a Network modifier for the provided Kin network

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.

Types

type Memo

type Memo [32]byte

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

func MemoFromBase64String added in v0.45.0

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

func MemoFromXDR

func MemoFromXDR(xm xdr.Memo, strict bool) (m Memo, ok bool)

MemoFromXDR returns a Memo from an xdr.Memo, provided it is a valid (or strictly valid) memo.

func MemoFromXDRString

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

MemoFromXDRString returns a Memo from a standard base64 encoded xdr.Memo, provided it is valid (or strictly) valid memo.

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
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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