Skip to content

Commit a9b2b18

Browse files
louisingeraltafan
andauthored
[Server] Add admin RPCs to manage queue of tx requests (#442)
* add admin RPCs: GetTxRequestQueue & DeleteTxRequests * update permissions * add arkd commands * Move types to types.proto & add request ids filter for getter * Add filter to get tx requests by id --------- Co-authored-by: altafan <[email protected]>
1 parent 5fab508 commit a9b2b18

File tree

17 files changed

+1819
-481
lines changed

17 files changed

+1819
-481
lines changed

api-spec/openapi/swagger/ark/v1/admin.swagger.json

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,72 @@
100100
]
101101
}
102102
},
103+
"/v1/admin/queue": {
104+
"get": {
105+
"operationId": "AdminService_GetTxRequestQueue",
106+
"responses": {
107+
"200": {
108+
"description": "A successful response.",
109+
"schema": {
110+
"$ref": "#/definitions/v1GetTxRequestQueueResponse"
111+
}
112+
},
113+
"default": {
114+
"description": "An unexpected error response.",
115+
"schema": {
116+
"$ref": "#/definitions/rpcStatus"
117+
}
118+
}
119+
},
120+
"parameters": [
121+
{
122+
"name": "requestIds",
123+
"in": "query",
124+
"required": false,
125+
"type": "array",
126+
"items": {
127+
"type": "string"
128+
},
129+
"collectionFormat": "multi"
130+
}
131+
],
132+
"tags": [
133+
"AdminService"
134+
]
135+
}
136+
},
137+
"/v1/admin/queue/delete": {
138+
"post": {
139+
"operationId": "AdminService_DeleteTxRequests",
140+
"responses": {
141+
"200": {
142+
"description": "A successful response.",
143+
"schema": {
144+
"$ref": "#/definitions/v1DeleteTxRequestsResponse"
145+
}
146+
},
147+
"default": {
148+
"description": "An unexpected error response.",
149+
"schema": {
150+
"$ref": "#/definitions/rpcStatus"
151+
}
152+
}
153+
},
154+
"parameters": [
155+
{
156+
"name": "body",
157+
"in": "body",
158+
"required": true,
159+
"schema": {
160+
"$ref": "#/definitions/v1DeleteTxRequestsRequest"
161+
}
162+
}
163+
],
164+
"tags": [
165+
"AdminService"
166+
]
167+
}
168+
},
103169
"/v1/admin/round/{roundId}": {
104170
"get": {
105171
"operationId": "AdminService_GetRoundDetails",
@@ -270,6 +336,20 @@
270336
}
271337
}
272338
},
339+
"v1DeleteTxRequestsRequest": {
340+
"type": "object",
341+
"properties": {
342+
"requestIds": {
343+
"type": "array",
344+
"items": {
345+
"type": "string"
346+
}
347+
}
348+
}
349+
},
350+
"v1DeleteTxRequestsResponse": {
351+
"type": "object"
352+
},
273353
"v1GetMarketHourConfigResponse": {
274354
"type": "object",
275355
"properties": {
@@ -355,6 +435,18 @@
355435
}
356436
}
357437
},
438+
"v1GetTxRequestQueueResponse": {
439+
"type": "object",
440+
"properties": {
441+
"requests": {
442+
"type": "array",
443+
"items": {
444+
"type": "object",
445+
"$ref": "#/definitions/v1TxRequestInfo"
446+
}
447+
}
448+
}
449+
},
358450
"v1MarketHourConfig": {
359451
"type": "object",
360452
"properties": {
@@ -374,6 +466,36 @@
374466
}
375467
}
376468
},
469+
"v1Output": {
470+
"type": "object",
471+
"properties": {
472+
"address": {
473+
"type": "string",
474+
"title": "onchain or off-chain"
475+
},
476+
"amount": {
477+
"type": "string",
478+
"format": "uint64",
479+
"description": "Amount to send in satoshis."
480+
}
481+
}
482+
},
483+
"v1RequestInput": {
484+
"type": "object",
485+
"properties": {
486+
"txid": {
487+
"type": "string"
488+
},
489+
"vout": {
490+
"type": "integer",
491+
"format": "int64"
492+
},
493+
"amount": {
494+
"type": "string",
495+
"format": "uint64"
496+
}
497+
}
498+
},
377499
"v1ScheduledSweep": {
378500
"type": "object",
379501
"properties": {
@@ -408,6 +530,58 @@
408530
}
409531
}
410532
},
533+
"v1TxRequestInfo": {
534+
"type": "object",
535+
"properties": {
536+
"id": {
537+
"type": "string"
538+
},
539+
"createdAt": {
540+
"type": "string",
541+
"format": "int64"
542+
},
543+
"receivers": {
544+
"type": "array",
545+
"items": {
546+
"type": "object",
547+
"$ref": "#/definitions/v1Output"
548+
}
549+
},
550+
"inputs": {
551+
"type": "array",
552+
"items": {
553+
"type": "object",
554+
"$ref": "#/definitions/v1RequestInput"
555+
}
556+
},
557+
"boardingInputs": {
558+
"type": "array",
559+
"items": {
560+
"type": "object",
561+
"$ref": "#/definitions/v1RequestInput"
562+
}
563+
},
564+
"notes": {
565+
"type": "array",
566+
"items": {
567+
"type": "string"
568+
}
569+
},
570+
"signingType": {
571+
"type": "string"
572+
},
573+
"cosignersPublicKeys": {
574+
"type": "array",
575+
"items": {
576+
"type": "string"
577+
}
578+
},
579+
"lastPing": {
580+
"type": "string",
581+
"format": "int64"
582+
}
583+
}
584+
},
411585
"v1UpdateMarketHourConfigRequest": {
412586
"type": "object",
413587
"properties": {

api-spec/protobuf/ark/v1/admin.proto

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package ark.v1;
55
import "google/api/annotations.proto";
66
import "google/protobuf/timestamp.proto";
77
import "google/protobuf/duration.proto";
8+
import "ark/v1/types.proto";
89

910
service AdminService {
1011
rpc GetScheduledSweep(GetScheduledSweepRequest) returns (GetScheduledSweepResponse) {
@@ -40,6 +41,17 @@ service AdminService {
4041
body: "*"
4142
};
4243
}
44+
rpc GetTxRequestQueue(GetTxRequestQueueRequest) returns (GetTxRequestQueueResponse) {
45+
option (google.api.http) = {
46+
get: "/v1/admin/queue"
47+
};
48+
}
49+
rpc DeleteTxRequests(DeleteTxRequestsRequest) returns (DeleteTxRequestsResponse) {
50+
option (google.api.http) = {
51+
post: "/v1/admin/queue/delete"
52+
body: "*"
53+
};
54+
}
4355
rpc Withdraw(WithdrawRequest) returns (WithdrawResponse) {
4456
option (google.api.http) = {
4557
post: "/v1/admin/withdraw"
@@ -53,22 +65,9 @@ message GetScheduledSweepResponse {
5365
repeated ScheduledSweep sweeps = 1;
5466
}
5567

56-
message SweepableOutput {
57-
string txid = 1;
58-
uint32 vout = 2;
59-
string amount = 3;
60-
int64 scheduled_at = 4;
61-
}
62-
63-
message ScheduledSweep {
64-
string round_id = 1;
65-
repeated SweepableOutput outputs = 2;
66-
}
67-
6868
message GetRoundDetailsRequest {
6969
string round_id = 1;
7070
}
71-
7271
message GetRoundDetailsResponse {
7372
string round_id = 1;
7473
string txid = 2;
@@ -85,7 +84,6 @@ message GetRoundsRequest {
8584
int64 after = 1;
8685
int64 before = 2;
8786
}
88-
8987
message GetRoundsResponse {
9088
repeated string rounds = 1;
9189
}
@@ -94,21 +92,18 @@ message CreateNoteRequest {
9492
uint32 amount = 1;
9593
uint32 quantity = 2;
9694
}
97-
9895
message CreateNoteResponse {
9996
repeated string notes = 1;
10097
}
10198

10299
message GetMarketHourConfigRequest {}
103-
104100
message GetMarketHourConfigResponse {
105101
MarketHourConfig config = 1;
106102
}
107103

108104
message UpdateMarketHourConfigRequest {
109105
MarketHourConfig config = 1;
110106
}
111-
112107
message UpdateMarketHourConfigResponse {}
113108

114109
message MarketHourConfig {
@@ -118,11 +113,22 @@ message MarketHourConfig {
118113
google.protobuf.Duration round_interval = 4;
119114
}
120115

116+
message GetTxRequestQueueRequest {
117+
repeated string request_ids = 1;
118+
}
119+
message GetTxRequestQueueResponse {
120+
repeated TxRequestInfo requests = 1;
121+
}
122+
123+
message DeleteTxRequestsRequest {
124+
repeated string request_ids = 1;
125+
}
126+
message DeleteTxRequestsResponse {}
121127
message WithdrawRequest {
122128
string address = 1;
123129
uint64 amount = 2;
124130
}
125131

126132
message WithdrawResponse {
127133
string txid = 1;
128-
}
134+
}

api-spec/protobuf/ark/v1/types.proto

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,36 @@ message MarketHour {
105105
int64 round_interval = 4;
106106
}
107107

108+
message SweepableOutput {
109+
string txid = 1;
110+
uint32 vout = 2;
111+
string amount = 3;
112+
int64 scheduled_at = 4;
113+
}
114+
115+
message ScheduledSweep {
116+
string round_id = 1;
117+
repeated SweepableOutput outputs = 2;
118+
}
119+
120+
message TxRequestInfo {
121+
string id = 1;
122+
int64 created_at = 2;
123+
repeated Output receivers = 3;
124+
repeated RequestInput inputs = 4;
125+
repeated RequestInput boarding_inputs = 5;
126+
repeated string notes = 6;
127+
string signing_type = 7;
128+
repeated string cosigners_public_keys = 8;
129+
int64 last_ping = 9;
130+
}
131+
132+
message RequestInput {
133+
string txid = 1;
134+
uint32 vout = 2;
135+
uint64 amount = 3;
136+
}
137+
108138
/* Events */
109139

110140
message RoundFinalizationEvent {

0 commit comments

Comments
 (0)