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
This commit is contained in:
Louis Singer
2024-05-31 15:46:46 +02:00
committed by GitHub
parent 329ba555db
commit 9fc49d9f08
27 changed files with 2510 additions and 73 deletions

View File

@@ -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"
}
}
}
}
}

View File

@@ -261,6 +261,7 @@
},
"/v1/round/{txid}": {
"get": {
"summary": "TODO BTC: signTree rpc",
"operationId": "ArkService_GetRound",
"responses": {
"200": {
@@ -388,7 +389,8 @@
"type": "object",
"properties": {
"roundFinalization": {
"$ref": "#/definitions/v1RoundFinalizationEvent"
"$ref": "#/definitions/v1RoundFinalizationEvent",
"title": "TODO: BTC add \"signTree\" event"
},
"roundFinalized": {
"$ref": "#/definitions/v1RoundFinalizedEvent"
@@ -516,7 +518,8 @@
"type": "array",
"items": {
"type": "string"
}
},
"title": "TODO: improve this response (returns oneof the round event)"
}
}
},