Skip to content

Commit

Permalink
Add AdminService (#176)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
louisinger authored May 31, 2024
1 parent 329ba55 commit 9fc49d9
Show file tree
Hide file tree
Showing 27 changed files with 2,510 additions and 73 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
.vscode/
289 changes: 289 additions & 0 deletions server/api-spec/openapi/swagger/ark/v1/admin.swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
{
"swagger": "2.0",
"info": {
"title": "ark/v1/admin.proto",
"version": "version not set"
},
"tags": [
{
"name": "AdminService"
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1/admin/balance": {
"get": {
"operationId": "AdminService_GetBalance",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1GetBalanceResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"AdminService"
]
}
},
"/v1/admin/round/{roundId}": {
"get": {
"operationId": "AdminService_GetRoundDetails",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1GetRoundDetailsResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "roundId",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"AdminService"
]
}
},
"/v1/admin/rounds": {
"post": {
"operationId": "AdminService_GetRounds",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1GetRoundsResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/v1GetRoundsRequest"
}
}
],
"tags": [
"AdminService"
]
}
},
"/v1/admin/sweeps": {
"get": {
"operationId": "AdminService_GetScheduledSweep",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/v1GetScheduledSweepResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"AdminService"
]
}
}
},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/protobufAny"
}
}
}
},
"v1Balance": {
"type": "object",
"properties": {
"locked": {
"type": "string"
},
"available": {
"type": "string"
}
}
},
"v1GetBalanceResponse": {
"type": "object",
"properties": {
"mainAccount": {
"$ref": "#/definitions/v1Balance"
},
"connectorsAccount": {
"$ref": "#/definitions/v1Balance"
}
}
},
"v1GetRoundDetailsResponse": {
"type": "object",
"properties": {
"roundId": {
"type": "string"
},
"txid": {
"type": "string"
},
"forfeitedAmount": {
"type": "string"
},
"totalVtxosAmount": {
"type": "string"
},
"totalExitAmount": {
"type": "string"
},
"feesAmount": {
"type": "string"
},
"inputsVtxos": {
"type": "array",
"items": {
"type": "string"
}
},
"outputsVtxos": {
"type": "array",
"items": {
"type": "string"
}
},
"exitAddresses": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"v1GetRoundsRequest": {
"type": "object",
"properties": {
"after": {
"type": "string",
"format": "int64"
},
"before": {
"type": "string",
"format": "int64"
}
}
},
"v1GetRoundsResponse": {
"type": "object",
"properties": {
"rounds": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"v1GetScheduledSweepResponse": {
"type": "object",
"properties": {
"sweeps": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1ScheduledSweep"
}
}
}
},
"v1ScheduledSweep": {
"type": "object",
"properties": {
"roundId": {
"type": "string"
},
"outputs": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/v1SweepableOutput"
}
}
}
},
"v1SweepableOutput": {
"type": "object",
"properties": {
"txid": {
"type": "string"
},
"vout": {
"type": "integer",
"format": "int64"
},
"amount": {
"type": "string"
},
"scheduledAt": {
"type": "string",
"format": "int64"
}
}
}
}
}
7 changes: 5 additions & 2 deletions server/api-spec/openapi/swagger/ark/v1/service.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@
},
"/v1/round/{txid}": {
"get": {
"summary": "TODO BTC: signTree rpc",
"operationId": "ArkService_GetRound",
"responses": {
"200": {
Expand Down Expand Up @@ -388,7 +389,8 @@
"type": "object",
"properties": {
"roundFinalization": {
"$ref": "#/definitions/v1RoundFinalizationEvent"
"$ref": "#/definitions/v1RoundFinalizationEvent",
"title": "TODO: BTC add \"signTree\" event"
},
"roundFinalized": {
"$ref": "#/definitions/v1RoundFinalizedEvent"
Expand Down Expand Up @@ -516,7 +518,8 @@
"type": "array",
"items": {
"type": "string"
}
},
"title": "TODO: improve this response (returns oneof the round event)"
}
}
},
Expand Down
Loading

0 comments on commit 9fc49d9

Please sign in to comment.