Documentation ¶
Index ¶
- Constants
- Variables
- func AmountStringAsFloat(amount string) float64
- func Asset2Asset(Asset horizon.Asset) build.Asset
- func Asset2Asset2(Asset build.Asset) horizon.Asset
- 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 FilterOffers(offers []horizon.Offer, sellAsset horizon.Asset, buyAsset horizon.Asset) (sellOffers []horizon.Offer, buyOffers []horizon.Offer)
- func FloatEquals(f1 float64, f2 float64, epsilon float64) bool
- 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 JSONRequest(httpClient *http.Client, method string, reqURL string, data string, ...) error
- func LoadAllOffers(account string, api *horizon.Client) (offersRet []horizon.Offer, err error)
- func ParseBool(m map[string]interface{}, key string, methodAPI string) (bool, error)
- func ParseNetwork(horizonURL string) build.Network
- func ParseNumber(m map[string]interface{}, key string, methodAPI string) (*model.Number, error)
- func ParseSecret(secret string) (*string, error)
- func ParseString(m map[string]interface{}, key string, methodAPI 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 PrefixFieldNotFound = "could not find field in map of PrepareDeposit"
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 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
func CheckFetchFloat ¶ added in v1.1.1
CheckFetchFloat tries to fetch and then cast the value for the provided key
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 FloatEquals ¶
FloatEquals returns true if the two floats are equal within the epsilon of error (avoids mismatched equality because of floating point noise)
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 JSONRequest ¶ added in v1.1.0
func JSONRequest( httpClient *http.Client, method string, reqURL string, data string, headers map[string]string, responseData interface{}, ) error
JSONRequest submits an HTTP web request and parses the response into the responseData object as JSON
func LoadAllOffers ¶
LoadAllOffers loads all the offers for a given account
func ParseNetwork ¶
ParseNetwork checks the horizon url and returns the test network if it contains "test"
func ParseNumber ¶
ParseNumber helps to parse a model.Number value out of the map
func ParseSecret ¶
ParseSecret returns the address from the secret
func ParseString ¶
ParseString helps to parse a string value out of the map
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