Documentation ¶
Index ¶
- type Client
- func (c *Client) CreateOrder(ctx context.Context, from, to Ticker, amount decimal.Decimal, toAddress string, ...) (CreateOrderResponse, error)
- func (c *Client) GetEstimate(ctx context.Context, from, to Ticker, fromAmount decimal.Decimal) (GetEstimateResponse, error)
- func (c *Client) GetEstimateReverse(ctx context.Context, from, to Ticker, toAmount decimal.Decimal) (GetEstimateResponse, error)
- func (c *Client) GetLimits(ctx context.Context, from, to Ticker) (GetLimitsResponse, error)
- func (c *Client) GetOrder(ctx context.Context, id string) (GetOrderResponse, error)
- type CreateOrderResponse
- type GetEstimateResponse
- type GetLimitsResponse
- type GetOrderResponse
- type OrderStatus
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for the Nanswap API
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(ctx context.Context, from, to Ticker, amount decimal.Decimal, toAddress string, maxDuration time.Duration) (CreateOrderResponse, error)
CreateOrder creates a new order and returns order data
func (*Client) GetEstimate ¶
func (c *Client) GetEstimate(ctx context.Context, from, to Ticker, fromAmount decimal.Decimal) (GetEstimateResponse, error)
GetEstimate gets estimated exchange amount
func (*Client) GetEstimateReverse ¶
func (c *Client) GetEstimateReverse(ctx context.Context, from, to Ticker, toAmount decimal.Decimal) (GetEstimateResponse, error)
GetEstimateReverse takes toAmount and returns the fromAmount estimation
type CreateOrderResponse ¶
type CreateOrderResponse struct { ID string `json:"id"` From Ticker `json:"from"` To Ticker `json:"to"` ExpectedAmountFrom decimal.Decimal `json:"expectedAmountFrom"` ExpectedAmountTo decimal.Decimal `json:"expectedAmountTo"` PayinAddress string `json:"payinAddress"` PayoutAddress string `json:"payoutAddress"` }
CreateOrderResponse represents the response to a CreateOrder request
type GetEstimateResponse ¶
type GetEstimateResponse struct { From Ticker `json:"from"` To Ticker `json:"to"` AmountFrom decimal.Decimal `json:"amountFrom"` AmountTo decimal.Decimal `json:"amountTo"` }
GetEstimateResponse represents the response to a GetEstimate or GetEstimateReverse request
type GetLimitsResponse ¶
type GetLimitsResponse struct { From Ticker `json:"from"` To Ticker `json:"to"` Min decimal.Decimal `json:"min"` Max decimal.Decimal `json:"max"` }
GetLimitsResponse represents the response to a GetLimits request
type GetOrderResponse ¶
type GetOrderResponse struct { ID string `json:"id"` Status OrderStatus `json:"status"` From Ticker `json:"from"` To Ticker `json:"to"` ExpectedAmountFrom decimal.Decimal `json:"expectedAmountFrom"` ExpectedAmountTo decimal.Decimal `json:"expectedAmountTo"` AmountFrom decimal.Decimal `json:"amountFrom"` AmountTo decimal.Decimal `json:"amountTo"` PayinAddress string `json:"payinAddress"` PayoutAddress string `json:"payoutAddress"` SenderAddress string `json:"senderAddress"` PayinHash string `json:"payinHash"` PayoutHash string `json:"payoutHash"` }
GetOrderResponse represents the response to a GetOrder request
type OrderStatus ¶
type OrderStatus string
OrderStatus represents the status of an order
var ( OrderStatusWaiting OrderStatus = "waiting" OrderStatusExchanging OrderStatus = "exchanging" OrderStatusSending OrderStatus = "sending" OrderStatusCompleted OrderStatus = "completed" OrderStatusError OrderStatus = "error" )
Click to show internal directories.
Click to hide internal directories.