-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfig.go
271 lines (249 loc) · 6.62 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
package minercraft
import "time"
const (
// version is the current package version
version = "v2.1.0"
// defaultUserAgent is the default user agent for all requests
defaultUserAgent string = "go-minercraft: " + version
// defaultFastQuoteTimeout is used for the FastestQuote timeout
defaultFastQuoteTimeout = 20 * time.Second
)
const (
// MAPI stands for Merchant API
MAPI APIType = "mAPI"
// Arc stands for Arc API
Arc APIType = "Arc"
)
const (
// PolicyQuote is the name of the PolicyQuote API action
PolicyQuote APIActionName = "PolicyQuote"
// FeeQuote is the name of the FeeQuote API action
FeeQuote APIActionName = "FeeQuote"
// QueryTx is the name of the Query Transaction API action
QueryTx APIActionName = "QueryTx"
// SubmitTx is the name of the Submit Transaction API action
SubmitTx APIActionName = "SubmitTx"
// SubmitTxs is the name of the Submit multiple Transactions API action
SubmitTxs APIActionName = "SubmitTxs"
)
// mAPI routes
const (
// mAPIRoutePolicyQuote is the route for getting a policy quote
mAPIRoutePolicyQuote = "/mapi/policyQuote"
// mAPIRouteFeeQuote is the route for getting a fee quote
mAPIRouteFeeQuote = "/mapi/feeQuote"
// mAPIRouteQueryTx is the route for querying a transaction
mAPIRouteQueryTx = "/mapi/tx/"
// mAPIRouteSubmitTx is the route for submit a transaction
mAPIRouteSubmitTx = "/mapi/tx"
// mAPIRouteSubmitTxs is the route for submit batched transactions
mAPIRouteSubmitTxs = "/mapi/txs"
)
// Arc routes
const (
// arcRoutePolicyQuote is the route for getting a policy quote
arcRoutePolicyQuote = "/v1/policy"
// arcRouteQueryTx is the route for querying a transaction
arcRouteQueryTx = "/v1/tx/"
// arcRouteSubmitTx is the route for submit a transaction
arcRouteSubmitTx = "/v1/tx"
// arcRouteSubmitTxs is the route for submit batched transactions
arcRouteSubmitTxs = "/v1/txs"
)
// Routes is a list of known actions with it's routes for the different APIs
var Routes = []APIRoute{
{
Name: PolicyQuote,
Routes: []APISpecificRoute{
{Route: mAPIRoutePolicyQuote, APIType: MAPI},
{Route: arcRoutePolicyQuote, APIType: Arc},
},
},
{
Name: FeeQuote,
Routes: []APISpecificRoute{
{Route: mAPIRouteFeeQuote, APIType: MAPI},
},
},
{
Name: QueryTx,
Routes: []APISpecificRoute{
{Route: mAPIRouteQueryTx, APIType: MAPI},
{Route: arcRouteQueryTx, APIType: Arc},
},
},
{
Name: SubmitTx,
Routes: []APISpecificRoute{
{Route: mAPIRouteSubmitTx, APIType: MAPI},
{Route: arcRouteSubmitTx, APIType: Arc},
},
},
{
Name: SubmitTxs,
Routes: []APISpecificRoute{
{Route: mAPIRouteSubmitTxs, APIType: MAPI},
{Route: arcRouteSubmitTxs, APIType: Arc},
},
},
}
const (
// MinerTaal is the name of the known miner for "Taal"
MinerTaal = "Taal"
// MinerGorillaPool is the name of the known miner for "GorillaPool"
MinerGorillaPool = "GorillaPool"
// MinerMempool is the name of the known miner for "Mempool"
MinerMempool = "Mempool"
// MinerMatterpool is the name of the known miner for "Matterpool"
MinerMatterpool = "Matterpool"
)
// KnownMiners is a pre-filled list of known miners
const KnownMiners = `
[
{
"name":"Taal",
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270"
},
{
"name":"GorillaPool",
"miner_id":"03ad780153c47df915b3d2e23af727c68facaca4facd5f155bf5018b979b9aeb83"
}
]
`
// KnownMinersAll is a pre-filled list of known miners
// deprecated: use KnownMiners instead
const KnownMinersAll = `
[
{
"name":"Taal",
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270"
},
{
"name":"Mempool",
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270"
},
{
"name":"Matterpool",
"miner_id":"0253a9b2d017254b91704ba52aad0df5ca32b4fb5cb6b267ada6aefa2bc5833a93"
},
{
"name":"GorillaPool",
"miner_id":"03ad780153c47df915b3d2e23af727c68facaca4facd5f155bf5018b979b9aeb83"
}
]
`
// KnownMinersAPIs is a pre-filled list of known miners with their APIs
// Any pre-filled tokens are for free use only
// update your custom token with client.MinerUpdateToken("name", "token")
const KnownMinersAPIs = `
[
{
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270",
"apis":[
{
"token":"",
"url":"https://merchantapi.taal.com",
"type":"mAPI"
},
{
"token":"",
"url":"https://tapi.taal.com/arc",
"type":"Arc"
}
]
},
{
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270",
"apis":[
{
"token":"561b756d12572020ea9a104c3441b71790acbbce95a6ddbf7e0630971af9424b",
"url":"https://www.ddpurse.com/openapi",
"type":"mAPI"
}
]
},
{
"miner_id":"0253a9b2d017254b91704ba52aad0df5ca32b4fb5cb6b267ada6aefa2bc5833a93",
"apis":[
{
"token":"",
"url":"https://merchantapi.matterpool.io",
"type":"mAPI"
}
]
},
{
"miner_id":"03ad780153c47df915b3d2e23af727c68facaca4facd5f155bf5018b979b9aeb83",
"apis":[
{
"token":"",
"url":"https://merchantapi.gorillapool.io",
"type":"mAPI"
},
{
"token":"",
"url":"https://arc.gorillapool.io",
"type":"Arc"
}
]
}
]
`
// KnownMinersAPIsAll is a pre-filled list of known miners with their APIs
// Any pre-filled tokens are for free use only
// update your custom token with client.MinerUpdateToken("name", "token")
// deprecated: use KnownMinersAPIsAll instead
const KnownMinersAPIsAll = `
[
{
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270",
"apis":[
{
"token":"",
"url":"https://merchantapi.taal.com",
"type":"mAPI"
},
{
"token":"",
"url":"https://tapi.taal.com/arc",
"type":"Arc"
}
]
},
{
"miner_id":"03e92d3e5c3f7bd945dfbf48e7a99393b1bfb3f11f380ae30d286e7ff2aec5a270",
"apis":[
{
"token":"561b756d12572020ea9a104c3441b71790acbbce95a6ddbf7e0630971af9424b",
"url":"https://www.ddpurse.com/openapi",
"type":"mAPI"
}
]
},
{
"miner_id":"0253a9b2d017254b91704ba52aad0df5ca32b4fb5cb6b267ada6aefa2bc5833a93",
"apis":[
{
"token":"",
"url":"https://merchantapi.matterpool.io",
"type":"mAPI"
}
]
},
{
"miner_id":"03ad780153c47df915b3d2e23af727c68facaca4facd5f155bf5018b979b9aeb83",
"apis":[
{
"token":"",
"url":"https://merchantapi.gorillapool.io",
"type":"mAPI"
},
{
"token":"",
"url":"https://arc.gorillapool.io",
"type":"Arc"
}
]
}
]
`