Documentation ¶
Index ¶
- Constants
- Variables
- func AmountStringAsFloat(amount string) float64
- func Asset2Asset(Asset horizon.Asset) build.Asset
- func Asset2Asset2(Asset build.Asset) horizon.Asset
- func Asset2CodeString(asset horizon.Asset) string
- func Asset2String(asset horizon.Asset) string
- func AssetsEqual(baseAsset base.Asset, horizonAsset horizon.Asset) bool
- func CheckConfigError(cfg fmt.Stringer, e error, filename string)
- func CheckFetchFloat(m map[string]interface{}, key string) (float64, error)
- func CheckedString(v interface{}) string
- func FilterOffers(offers []horizon.Offer, sellAsset horizon.Asset, buyAsset horizon.Asset) (sellOffers []horizon.Offer, buyOffers []horizon.Offer)
- func GetCreditBalance(a horizon.Account, code string, issuer string) *string
- func GetInvertedPrice(offer horizon.Offer) float64
- func GetJSON(client http.Client, url string, target interface{}) error
- func GetPrice(offer horizon.Offer) float64
- func Hide(i interface{}) interface{}
- func IsSelling(sdexBase horizon.Asset, sdexQuote horizon.Asset, selling xdr.Asset, ...) (bool, error)
- func LoadAllOffers(account string, api *horizon.Client) (offersRet []horizon.Offer, err error)
- func LogConfig(cfg fmt.Stringer)
- func ParseAsset(code string, issuer string) (*horizon.Asset, error)
- func ParseNetwork(horizonURL string) build.Network
- func ParseOfferAmount(amt string) (float64, error)
- func ParseSecret(secret string) (*string, error)
- func PriceAsFloat(price string) float64
- func SecretKey2PublicKey(i interface{}) interface{}
- func String2Asset(code string, issuer string) horizon.Asset
- func StructString(s interface{}, transforms map[string]func(interface{}) interface{}) string
- type ByPrice
Constants ¶
const Native = "native"
Native is the string representing the type for the native lumen asset
const SdexPrecision int8 = 7
SdexPrecision defines the number of decimals used in SDEX
Variables ¶
var NativeAsset = horizon.Asset{Type: Native}
NativeAsset represents the native asset
Functions ¶
func AmountStringAsFloat ¶
AmountStringAsFloat converts a string amount to a float amount
func Asset2Asset ¶
Asset2Asset is a Boyz2Men cover band on the blockchain
func Asset2Asset2 ¶
Asset2Asset2 converts a build.Asset to a horizon.Asset
func Asset2CodeString ¶ added in v1.3.0
Asset2CodeString extracts the code out of a horizon.Asset
func Asset2String ¶
Asset2String converts a horizon.Asset to a string representation, using "native" for the native XLM
func AssetsEqual ¶
AssetsEqual is a convenience method to compare horizon.Asset and base.Asset because they are not type aliased
func CheckConfigError ¶
CheckConfigError checks configs for errors, crashes app if there's an error
func CheckFetchFloat ¶ added in v1.1.1
CheckFetchFloat tries to fetch and then cast the value for the provided key
func CheckedString ¶ added in v1.2.0
func CheckedString(v interface{}) string
CheckedString returns "<nil>" if the object is nil, otherwise calls the String() function on the object
func FilterOffers ¶
func FilterOffers(offers []horizon.Offer, sellAsset horizon.Asset, buyAsset horizon.Asset) (sellOffers []horizon.Offer, buyOffers []horizon.Offer)
FilterOffers filters out the offers into selling and buying, where sellOffers sells the sellAsset and buyOffers buys the sellAsset
func GetCreditBalance ¶
GetCreditBalance is a drop-in for the function in the GoSDK, we want it to return nil if there's no balance (as opposed to "0")
func GetInvertedPrice ¶
GetInvertedPrice gets the inverted price from an offer
func IsSelling ¶ added in v1.6.0
func IsSelling(sdexBase horizon.Asset, sdexQuote horizon.Asset, selling xdr.Asset, buying xdr.Asset) (bool, error)
IsSelling helper method
func LoadAllOffers ¶
LoadAllOffers loads all the offers for a given account
func ParseAsset ¶ added in v1.4.0
ParseAsset returns a horizon asset a string
func ParseNetwork ¶
ParseNetwork checks the horizon url and returns the test network if it contains "test"
func ParseOfferAmount ¶ added in v1.6.0
ParseOfferAmount is a convenience method to parse an offer amount
func ParseSecret ¶
ParseSecret returns the address from the secret
func PriceAsFloat ¶
PriceAsFloat converts a string price to a float price
func SecretKey2PublicKey ¶
func SecretKey2PublicKey(i interface{}) interface{}
SecretKey2PublicKey converts a secret key to a public key
func String2Asset ¶
String2Asset converts a code:issuer to a horizon.Asset
func StructString ¶
StructString is a helper method that