Skip to content

Commit 9fc49d9

Browse files
authored
Add AdminService (#176)
* add admin service * go mod tidy * fix linter: grpc.Dial * fix ocean get balance * fix linter * add .vscode to gitignore * rework admin balance API * fix mockedwallet in covenantless pkg * make proto
1 parent 329ba55 commit 9fc49d9

File tree

27 files changed

+2510
-73
lines changed

27 files changed

+2510
-73
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.DS_Store
1+
.DS_Store
2+
.vscode/
Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "ark/v1/admin.proto",
5+
"version": "version not set"
6+
},
7+
"tags": [
8+
{
9+
"name": "AdminService"
10+
}
11+
],
12+
"consumes": [
13+
"application/json"
14+
],
15+
"produces": [
16+
"application/json"
17+
],
18+
"paths": {
19+
"/v1/admin/balance": {
20+
"get": {
21+
"operationId": "AdminService_GetBalance",
22+
"responses": {
23+
"200": {
24+
"description": "A successful response.",
25+
"schema": {
26+
"$ref": "#/definitions/v1GetBalanceResponse"
27+
}
28+
},
29+
"default": {
30+
"description": "An unexpected error response.",
31+
"schema": {
32+
"$ref": "#/definitions/rpcStatus"
33+
}
34+
}
35+
},
36+
"tags": [
37+
"AdminService"
38+
]
39+
}
40+
},
41+
"/v1/admin/round/{roundId}": {
42+
"get": {
43+
"operationId": "AdminService_GetRoundDetails",
44+
"responses": {
45+
"200": {
46+
"description": "A successful response.",
47+
"schema": {
48+
"$ref": "#/definitions/v1GetRoundDetailsResponse"
49+
}
50+
},
51+
"default": {
52+
"description": "An unexpected error response.",
53+
"schema": {
54+
"$ref": "#/definitions/rpcStatus"
55+
}
56+
}
57+
},
58+
"parameters": [
59+
{
60+
"name": "roundId",
61+
"in": "path",
62+
"required": true,
63+
"type": "string"
64+
}
65+
],
66+
"tags": [
67+
"AdminService"
68+
]
69+
}
70+
},
71+
"/v1/admin/rounds": {
72+
"post": {
73+
"operationId": "AdminService_GetRounds",
74+
"responses": {
75+
"200": {
76+
"description": "A successful response.",
77+
"schema": {
78+
"$ref": "#/definitions/v1GetRoundsResponse"
79+
}
80+
},
81+
"default": {
82+
"description": "An unexpected error response.",
83+
"schema": {
84+
"$ref": "#/definitions/rpcStatus"
85+
}
86+
}
87+
},
88+
"parameters": [
89+
{
90+
"name": "body",
91+
"in": "body",
92+
"required": true,
93+
"schema": {
94+
"$ref": "#/definitions/v1GetRoundsRequest"
95+
}
96+
}
97+
],
98+
"tags": [
99+
"AdminService"
100+
]
101+
}
102+
},
103+
"/v1/admin/sweeps": {
104+
"get": {
105+
"operationId": "AdminService_GetScheduledSweep",
106+
"responses": {
107+
"200": {
108+
"description": "A successful response.",
109+
"schema": {
110+
"$ref": "#/definitions/v1GetScheduledSweepResponse"
111+
}
112+
},
113+
"default": {
114+
"description": "An unexpected error response.",
115+
"schema": {
116+
"$ref": "#/definitions/rpcStatus"
117+
}
118+
}
119+
},
120+
"tags": [
121+
"AdminService"
122+
]
123+
}
124+
}
125+
},
126+
"definitions": {
127+
"protobufAny": {
128+
"type": "object",
129+
"properties": {
130+
"@type": {
131+
"type": "string"
132+
}
133+
},
134+
"additionalProperties": {}
135+
},
136+
"rpcStatus": {
137+
"type": "object",
138+
"properties": {
139+
"code": {
140+
"type": "integer",
141+
"format": "int32"
142+
},
143+
"message": {
144+
"type": "string"
145+
},
146+
"details": {
147+
"type": "array",
148+
"items": {
149+
"type": "object",
150+
"$ref": "#/definitions/protobufAny"
151+
}
152+
}
153+
}
154+
},
155+
"v1Balance": {
156+
"type": "object",
157+
"properties": {
158+
"locked": {
159+
"type": "string"
160+
},
161+
"available": {
162+
"type": "string"
163+
}
164+
}
165+
},
166+
"v1GetBalanceResponse": {
167+
"type": "object",
168+
"properties": {
169+
"mainAccount": {
170+
"$ref": "#/definitions/v1Balance"
171+
},
172+
"connectorsAccount": {
173+
"$ref": "#/definitions/v1Balance"
174+
}
175+
}
176+
},
177+
"v1GetRoundDetailsResponse": {
178+
"type": "object",
179+
"properties": {
180+
"roundId": {
181+
"type": "string"
182+
},
183+
"txid": {
184+
"type": "string"
185+
},
186+
"forfeitedAmount": {
187+
"type": "string"
188+
},
189+
"totalVtxosAmount": {
190+
"type": "string"
191+
},
192+
"totalExitAmount": {
193+
"type": "string"
194+
},
195+
"feesAmount": {
196+
"type": "string"
197+
},
198+
"inputsVtxos": {
199+
"type": "array",
200+
"items": {
201+
"type": "string"
202+
}
203+
},
204+
"outputsVtxos": {
205+
"type": "array",
206+
"items": {
207+
"type": "string"
208+
}
209+
},
210+
"exitAddresses": {
211+
"type": "array",
212+
"items": {
213+
"type": "string"
214+
}
215+
}
216+
}
217+
},
218+
"v1GetRoundsRequest": {
219+
"type": "object",
220+
"properties": {
221+
"after": {
222+
"type": "string",
223+
"format": "int64"
224+
},
225+
"before": {
226+
"type": "string",
227+
"format": "int64"
228+
}
229+
}
230+
},
231+
"v1GetRoundsResponse": {
232+
"type": "object",
233+
"properties": {
234+
"rounds": {
235+
"type": "array",
236+
"items": {
237+
"type": "string"
238+
}
239+
}
240+
}
241+
},
242+
"v1GetScheduledSweepResponse": {
243+
"type": "object",
244+
"properties": {
245+
"sweeps": {
246+
"type": "array",
247+
"items": {
248+
"type": "object",
249+
"$ref": "#/definitions/v1ScheduledSweep"
250+
}
251+
}
252+
}
253+
},
254+
"v1ScheduledSweep": {
255+
"type": "object",
256+
"properties": {
257+
"roundId": {
258+
"type": "string"
259+
},
260+
"outputs": {
261+
"type": "array",
262+
"items": {
263+
"type": "object",
264+
"$ref": "#/definitions/v1SweepableOutput"
265+
}
266+
}
267+
}
268+
},
269+
"v1SweepableOutput": {
270+
"type": "object",
271+
"properties": {
272+
"txid": {
273+
"type": "string"
274+
},
275+
"vout": {
276+
"type": "integer",
277+
"format": "int64"
278+
},
279+
"amount": {
280+
"type": "string"
281+
},
282+
"scheduledAt": {
283+
"type": "string",
284+
"format": "int64"
285+
}
286+
}
287+
}
288+
}
289+
}

server/api-spec/openapi/swagger/ark/v1/service.swagger.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
},
262262
"/v1/round/{txid}": {
263263
"get": {
264+
"summary": "TODO BTC: signTree rpc",
264265
"operationId": "ArkService_GetRound",
265266
"responses": {
266267
"200": {
@@ -388,7 +389,8 @@
388389
"type": "object",
389390
"properties": {
390391
"roundFinalization": {
391-
"$ref": "#/definitions/v1RoundFinalizationEvent"
392+
"$ref": "#/definitions/v1RoundFinalizationEvent",
393+
"title": "TODO: BTC add \"signTree\" event"
392394
},
393395
"roundFinalized": {
394396
"$ref": "#/definitions/v1RoundFinalizedEvent"
@@ -516,7 +518,8 @@
516518
"type": "array",
517519
"items": {
518520
"type": "string"
519-
}
521+
},
522+
"title": "TODO: improve this response (returns oneof the round event)"
520523
}
521524
}
522525
},

0 commit comments

Comments
 (0)