Documentation ΒΆ
Index ΒΆ
- Constants
- type ChangeNow
- func (c *ChangeNow) AvailablePairs() (map[string]*Pair, error)
- func (c *ChangeNow) CreateTransaction(request *TransactionRequest) (*Transaction, error)
- func (c *ChangeNow) Currencies() ([]*Currency, error)
- func (c *ChangeNow) CurrenciesTo(ticker string) ([]*Currency, error)
- func (c *ChangeNow) CurrencyInfo(ticker string) (*CurrencyInfo, error)
- func (c *ChangeNow) EstimatedExchangeAmount(amount float64, source, target string) (*EstimatedExchangeAmount, error)
- func (c *ChangeNow) GetPair(from, to string) (*Pair, error)
- func (c *ChangeNow) ListTransactions() ([]*TransactionDetails, error)
- func (c *ChangeNow) MinAmount(source, target string) (float64, error)
- func (c *ChangeNow) TransactionStatus(id string) (*TransactionDetails, error)
- type Currency
- type CurrencyInfo
- type EstimatedExchangeAmount
- type MinAmount
- type Pair
- type RequestError
- type Transaction
- type TransactionDetails
- type TransactionRequest
Constants ΒΆ
const ( Waiting string = "waiting" Confirming = "confirming" Sending = "sending" Finished = "finished" Expired = "expired" )
Statuses
Variables ΒΆ
This section is empty.
Functions ΒΆ
This section is empty.
Types ΒΆ
type ChangeNow ΒΆ
type ChangeNow struct {
// contains filtered or unexported fields
}
ChangeNow is the root client object
func (*ChangeNow) AvailablePairs ΒΆ
AvailablePairs ... GET /api/v1/market-info/available-pairs/ This function caches all the pairs, subsequent calls will not refresh. Use GetPair to get a single pair after you've called this. WARNING: NOT THREAD SAFE!
func (*ChangeNow) CreateTransaction ΒΆ
func (c *ChangeNow) CreateTransaction(request *TransactionRequest) (*Transaction, error)
CreateTransaction ... POST /api/v1/transactions/:api_key Errors encountered: - not_valid_params - cannot_create_transaction (when pair is not available?) - not_valid_address - out_of_range
func (*ChangeNow) Currencies ΒΆ
Currencies ... GET /currencies
func (*ChangeNow) CurrenciesTo ΒΆ
CurrenciesTo ... /currencies-to/:ticker List of available currencies for specific currency This API endpoint returns the list of available currencies. Some currencies get enabled or disabled from time to time, so make sure to refresh the list occasionally.
func (*ChangeNow) CurrencyInfo ΒΆ
func (c *ChangeNow) CurrencyInfo(ticker string) (*CurrencyInfo, error)
CurrencyInfo ... GET /currencies/:ticker
func (*ChangeNow) EstimatedExchangeAmount ΒΆ
func (c *ChangeNow) EstimatedExchangeAmount(amount float64, source, target string) (*EstimatedExchangeAmount, error)
EstimatedExchangeAmount ... GET /exchange-amount/:send_amount/:from_to
func (*ChangeNow) GetPair ΒΆ added in v0.0.3
GetPair returns a matching pair or error if an invalid pair
func (*ChangeNow) ListTransactions ΒΆ
func (c *ChangeNow) ListTransactions() ([]*TransactionDetails, error)
ListTransactions ... GET /api/v1/transactions/:api_key
func (*ChangeNow) MinAmount ΒΆ
MinAmount ... GET /min-amount/:from_to This func is the one that mentions if the pair is inactive
func (*ChangeNow) TransactionStatus ΒΆ
func (c *ChangeNow) TransactionStatus(id string) (*TransactionDetails, error)
TransactionStatus ... GET /api/v1/transactions/:id/:api_key
type Currency ΒΆ
type Currency struct { Ticker string `json:"ticker"` Image string `json:"image"` HasExternalID bool `json:"hasExternalId"` IsFiat bool `json:"isFiat"` SupportsFixedRate bool `json:"supportsFixedRate"` Featured bool `json:"featured"` }
Currency response
type CurrencyInfo ΒΆ
type CurrencyInfo struct { Name string `json:"name"` Image string `json:"image"` WarningMessage string `json:"warningMessage"` HasExternalID bool `json:"hasExternalId"` IsFiat bool `json:"isFiat"` IsAnonymous bool `json:"isAnonymous"` Wallets struct { Primary []struct { Name string `json:"name"` URL string `json:"url"` ImageURL string `json:"imageUrl"` } `json:"primary"` } `json:"wallets"` }
CurrencyInfo response
type EstimatedExchangeAmount ΒΆ
type EstimatedExchangeAmount struct { EstimatedAmount float64 `json:"estimatedAmount"` TransactionSpeedForecast string `json:"transactionSpeedForecast"` WarningMessage string `json:"warningMessage"` }
EstimatedExchangeAmount response
type RequestError ΒΆ
type RequestError struct {
Message string `json:"error"`
}
RequestError embeds in all responses Some responses from ChangeNow have an "error" instead.
func (*RequestError) Error ΒΆ
func (e *RequestError) Error() string
func (*RequestError) IsError ΒΆ
func (e *RequestError) IsError() bool
type Transaction ΒΆ
type Transaction struct { // Base fields (create transaction) ID string `json:"id"` PayinAddress string `json:"payinAddress"` PayoutAddress string `json:"payoutAddress"` PayinExtraID string `json:"payinExtraId"` FromCurrency string `json:"fromCurrency"` ToCurrency string `json:"toCurrency"` RefundAddress string `json:"refundAddress"` }
Transaction ...
type TransactionDetails ΒΆ
type TransactionDetails struct { ID string `json:"id"` PayinAddress string `json:"payinAddress"` PayoutAddress string `json:"payoutAddress"` PayinExtraID string `json:"payinExtraId"` FromCurrency string `json:"fromCurrency"` ToCurrency string `json:"toCurrency"` Status string `json:"status"` Hash string `json:"hash"` PayinHash string `json:"payinHash"` PayoutHash string `json:"payoutHash"` AmountSend float64 `json:"amountSend"` AmountReceive float64 `json:"amountReceive"` NetworkFee float64 `json:"networkFee"` UpdatedAt string `json:"updatedAt"` }
TransactionDetails ...
type TransactionRequest ΒΆ
type TransactionRequest struct { From string `json:"from"` // from (Required): Ticker of a currency you want to send To string `json:"to"` // to (Required): Ticker of a currency you want to receive Address string `json:"address"` // address (Required): Address to receive a currency Amount float64 `json:"amount"` // amount (Required): Amount you want to exchange ExtraID string `json:"extraId,omitempty"` // extraId (Optional): Extra Id for currencies that require it RefundAddress string `json:"refundAddress,omitempty"` // refundAddress (Optional): Refund address }
TransactionRequest request