-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.go
88 lines (72 loc) · 2.46 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package atomicasset
// Types
type AssetsConfig struct {
Contract string `json:"contract"`
CollectionFormat []SchemaFormat `json:"collection_format"`
SupportedTokens []PriceToken `json:"supported_tokens"`
Version string `json:"version"`
}
type MarketConfig struct {
AtomicassetsContract string `json:"atomicassets_contract"`
AtomicmarketContract string `json:"atomicmarket_contract"`
DelphioracleContract string `json:"delphioracle_contract"`
MakerMarketFee float64 `json:"maker_market_fee"`
TakerMarketFee float64 `json:"taker_market_fee"`
MinimumAuctionDuration int `json:"minimum_auction_duration"`
MaximumAuctionDuration int `json:"maximum_auction_duration"`
MinimumBidIncrease float64 `json:"minimum_bid_increase"`
AuctionResetDuration int `json:"auction_reset_duration"`
SupportedTokens []PriceToken `json:"supported_tokens"`
SupportedPairs []TokenPair `json:"supported_pairs"`
Version string `json:"version"`
}
type ToolsConfig struct {
AtomictoolsContract string `json:"atomictools_contract"`
AtomicassetsContract string `json:"atomicassets_contract"`
Version string `json:"version"`
}
// Request Parameters
// Responses
type AssetsConfigResponse struct {
APIResponse
Data AssetsConfig
}
type MarketConfigResponse struct {
APIResponse
Data MarketConfig
}
type ToolsConfigResponse struct {
APIResponse
Data ToolsConfig
}
// Client API Functions
// GetAssetsConfig fetches "/atomicassets/v1/config" from API
func (c *Client) GetAssetsConfig() (AssetsConfigResponse, error) {
var resp AssetsConfigResponse
r, err := c.fetch("GET", "/atomicassets/v1/config", nil, &resp.APIResponse)
if err == nil {
// Parse json
err = r.Unmarshal(&resp)
}
return resp, err
}
// GetMarketConfig fetches "/atomicmarket/v1/config" from API
func (c *Client) GetMarketConfig() (MarketConfigResponse, error) {
var resp MarketConfigResponse
r, err := c.fetch("GET", "/atomicmarket/v1/config", nil, &resp.APIResponse)
if err == nil {
// Parse json
err = r.Unmarshal(&resp)
}
return resp, err
}
// GetToolsConfig fetches "/atomictools/v1/config" from API
func (c *Client) GetToolsConfig() (ToolsConfigResponse, error) {
var resp ToolsConfigResponse
r, err := c.fetch("GET", "/atomictools/v1/config", nil, &resp.APIResponse)
if err == nil {
// Parse json
err = r.Unmarshal(&resp)
}
return resp, err
}