Documentation ¶
Index ¶
Constants ¶
const APIBaseAddress = "https://xmr.to/api"
APIBaseAddress is the base URL of the xmr.to API
const APIConversionDirection = "xmr2btc"
APIConversionDirection is the API conversion direction (currently only xmr2btc)
const APITestnetBaseAddress = "https://test.xmr.to/api/"
APITestnetBaseAddress is the base URL of the xmr.to TESTNET API
const APIVersion = "v3"
APIVersion is the API version identifier (currently v3)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // The order parameter endpoint supplies information about whether new orders can be created. // In this case, this endpoint provides the current price, order limits, etc. for newly created orders. GetOrderParameters() (*ResponseGetOrderParameters, error) // The order creation endpoint allows to create a new order at the current price. // The user has to supply a bitcoin destination address and amount to create the order. CreateOrder(*RequestCreateOrder) (*ResponseCreateOrder, error) // The order status endpoint allows users to query the status of an order, thereby obtaining payment details and order processing progress. GetOrderStatus(*RequestGetOrderStatus) (*ResponseGetOrderStatus, error) // The order status endpoint allows users to query the recent price of an order by displaying the convertion price of XMR to BTC GetOrderPrice(*RequestGetOrderPrice) (*ResponseGetOrderPrice, error) }
Client is a xmr.to API client
type Config ¶
type Config struct { APIBaseAddress string APIVersion string APIConversionDirection string Testnet bool }
Config holds the configuration of a xmr.to API client.
type RequestCreateOrder ¶
type RequestCreateOrder struct { Amount float64 `json:"amount"` AmountCurrency string `json:"amount_currency"` BTCDestAddress string `json:"btc_dest_address"` }
RequestCreateOrder is for CreateOrder()
type RequestGetOrderPrice ¶
type RequestGetOrderPrice struct { Amount float64 `json:"amount"` AmountCurrency string `json:"amount_currency"` }
RequestGetOrderPrice is for GetOrderPrice()
type RequestGetOrderStatus ¶
type RequestGetOrderStatus struct {
UUID string `json:"uuid"`
}
RequestGetOrderStatus is for GetOrderStatus()
type ResponseCreateOrder ¶
type ResponseCreateOrder struct { State string `json:"state"` BTCAmount string `json:"btc_amount"` BTCDestAddress string `json:"btc_dest_address"` UUID string `json:"uuid"` }
ResponseCreateOrder is for CreateOrder()
type ResponseGetOrderParameters ¶
type ResponseGetOrderParameters struct { LowerLimit string `json:"lower_limit"` Price string `json:"price"` UpperLimit string `json:"upper_limit"` ZeroConfEnabled bool `json:"zero_conf_enabled"` ZeroConfMaxAmount string `json:"zero_conf_max_amount"` }
ResponseGetOrderParameters is for GetOrderParameters()
type ResponseGetOrderPrice ¶
type ResponseGetOrderPrice struct { BTCAmount string `json:"btc_amount"` XMRAmountTotal string `json:"incoming_amount_total"` XMRNumConfirmationsRemaining int64 `json:"incoming_num_confirmations_remaining"` XMRPriceBTC string `json:"incoming_price_btc"` }
ResponseGetOrderPrice is for GetOrderPrice()
type ResponseGetOrderStatus ¶
type ResponseGetOrderStatus struct { State string `json:"state"` BTCAmount string `json:"btc_amount"` BTCAmountPartial string `json:"btc_amount_partial"` BTCDestAddress string `json:"btc_dest_address"` UUID string `json:"uuid"` BTCNumConfirmationsThreshold int64 `json:"btc_num_confirmations_threshold"` CreatedAT string `json:"created_at"` ExpiresAT string `json:"expires_at"` SecondsTillTimeout int64 `json:"seconds_till_timeout"` BTCTransactionID string `json:"btc_transaction_id"` XMRAmountTotal string `json:"incoming_amount_total"` XMRAmountRemaining string `json:"remaining_amount_incoming"` XMRNumConfirmationsRemaining int64 `json:"incoming_num_confirmations_remaining"` XMRPriceBTC string `json:"incoming_price_btc"` XMRReceivingSubAddress string `json:"receiving_subaddress"` XMRRecommendedMixin int64 `json:"recommended_mixin"` }
ResponseGetOrderStatus is for GetOrderStatus()