mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 20:24:21 +01:00
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:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
.vscode/
|
||||
289
server/api-spec/openapi/swagger/ark/v1/admin.swagger.json
Normal file
289
server/api-spec/openapi/swagger/ark/v1/admin.swagger.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
84
server/api-spec/protobuf/ark/v1/admin.proto
Normal file
84
server/api-spec/protobuf/ark/v1/admin.proto
Normal file
@@ -0,0 +1,84 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ark.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service AdminService {
|
||||
rpc GetBalance(GetBalanceRequest) returns (GetBalanceResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/admin/balance"
|
||||
};
|
||||
}
|
||||
rpc GetScheduledSweep(GetScheduledSweepRequest) returns (GetScheduledSweepResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/admin/sweeps"
|
||||
};
|
||||
}
|
||||
rpc GetRoundDetails(GetRoundDetailsRequest) returns (GetRoundDetailsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/admin/round/{round_id}"
|
||||
};
|
||||
}
|
||||
rpc GetRounds(GetRoundsRequest) returns (GetRoundsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/admin/rounds"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetBalanceRequest {}
|
||||
|
||||
message Balance {
|
||||
string locked = 1;
|
||||
string available = 2;
|
||||
}
|
||||
|
||||
message GetBalanceResponse {
|
||||
Balance main_account = 1;
|
||||
Balance connectors_account = 2;
|
||||
}
|
||||
|
||||
message GetScheduledSweepRequest {}
|
||||
|
||||
message SweepableOutput {
|
||||
string txid = 1;
|
||||
uint32 vout = 2;
|
||||
string amount = 3;
|
||||
int64 scheduled_at = 4;
|
||||
}
|
||||
|
||||
message ScheduledSweep {
|
||||
string round_id = 1;
|
||||
repeated SweepableOutput outputs = 2;
|
||||
}
|
||||
|
||||
message GetScheduledSweepResponse {
|
||||
repeated ScheduledSweep sweeps = 1;
|
||||
}
|
||||
|
||||
message GetRoundDetailsRequest {
|
||||
string round_id = 1;
|
||||
}
|
||||
|
||||
message GetRoundDetailsResponse {
|
||||
string round_id = 1;
|
||||
string txid = 2;
|
||||
string forfeited_amount = 3;
|
||||
string total_vtxos_amount = 4;
|
||||
string total_exit_amount = 5;
|
||||
string fees_amount = 6;
|
||||
repeated string inputs_vtxos = 7;
|
||||
repeated string outputs_vtxos = 8;
|
||||
repeated string exit_addresses = 9;
|
||||
}
|
||||
|
||||
message GetRoundsRequest {
|
||||
int64 after = 1;
|
||||
int64 before = 2;
|
||||
}
|
||||
|
||||
message GetRoundsResponse {
|
||||
repeated string rounds = 1;
|
||||
}
|
||||
959
server/api-spec/protobuf/gen/ark/v1/admin.pb.go
Normal file
959
server/api-spec/protobuf/gen/ark/v1/admin.pb.go
Normal file
@@ -0,0 +1,959 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc (unknown)
|
||||
// source: ark/v1/admin.proto
|
||||
|
||||
package arkv1
|
||||
|
||||
import (
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type GetBalanceRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GetBalanceRequest) Reset() {
|
||||
*x = GetBalanceRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetBalanceRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetBalanceRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetBalanceRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetBalanceRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetBalanceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type Balance struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Locked string `protobuf:"bytes,1,opt,name=locked,proto3" json:"locked,omitempty"`
|
||||
Available string `protobuf:"bytes,2,opt,name=available,proto3" json:"available,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Balance) Reset() {
|
||||
*x = Balance{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Balance) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Balance) ProtoMessage() {}
|
||||
|
||||
func (x *Balance) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Balance.ProtoReflect.Descriptor instead.
|
||||
func (*Balance) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Balance) GetLocked() string {
|
||||
if x != nil {
|
||||
return x.Locked
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Balance) GetAvailable() string {
|
||||
if x != nil {
|
||||
return x.Available
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetBalanceResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
MainAccount *Balance `protobuf:"bytes,1,opt,name=main_account,json=mainAccount,proto3" json:"main_account,omitempty"`
|
||||
ConnectorsAccount *Balance `protobuf:"bytes,2,opt,name=connectors_account,json=connectorsAccount,proto3" json:"connectors_account,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetBalanceResponse) Reset() {
|
||||
*x = GetBalanceResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetBalanceResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetBalanceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetBalanceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetBalanceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetBalanceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetBalanceResponse) GetMainAccount() *Balance {
|
||||
if x != nil {
|
||||
return x.MainAccount
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetBalanceResponse) GetConnectorsAccount() *Balance {
|
||||
if x != nil {
|
||||
return x.ConnectorsAccount
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetScheduledSweepRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GetScheduledSweepRequest) Reset() {
|
||||
*x = GetScheduledSweepRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetScheduledSweepRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetScheduledSweepRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetScheduledSweepRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetScheduledSweepRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetScheduledSweepRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
type SweepableOutput struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Txid string `protobuf:"bytes,1,opt,name=txid,proto3" json:"txid,omitempty"`
|
||||
Vout uint32 `protobuf:"varint,2,opt,name=vout,proto3" json:"vout,omitempty"`
|
||||
Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"`
|
||||
ScheduledAt int64 `protobuf:"varint,4,opt,name=scheduled_at,json=scheduledAt,proto3" json:"scheduled_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SweepableOutput) Reset() {
|
||||
*x = SweepableOutput{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SweepableOutput) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SweepableOutput) ProtoMessage() {}
|
||||
|
||||
func (x *SweepableOutput) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SweepableOutput.ProtoReflect.Descriptor instead.
|
||||
func (*SweepableOutput) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *SweepableOutput) GetTxid() string {
|
||||
if x != nil {
|
||||
return x.Txid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SweepableOutput) GetVout() uint32 {
|
||||
if x != nil {
|
||||
return x.Vout
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SweepableOutput) GetAmount() string {
|
||||
if x != nil {
|
||||
return x.Amount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SweepableOutput) GetScheduledAt() int64 {
|
||||
if x != nil {
|
||||
return x.ScheduledAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ScheduledSweep struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RoundId string `protobuf:"bytes,1,opt,name=round_id,json=roundId,proto3" json:"round_id,omitempty"`
|
||||
Outputs []*SweepableOutput `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ScheduledSweep) Reset() {
|
||||
*x = ScheduledSweep{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ScheduledSweep) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ScheduledSweep) ProtoMessage() {}
|
||||
|
||||
func (x *ScheduledSweep) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ScheduledSweep.ProtoReflect.Descriptor instead.
|
||||
func (*ScheduledSweep) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *ScheduledSweep) GetRoundId() string {
|
||||
if x != nil {
|
||||
return x.RoundId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ScheduledSweep) GetOutputs() []*SweepableOutput {
|
||||
if x != nil {
|
||||
return x.Outputs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetScheduledSweepResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Sweeps []*ScheduledSweep `protobuf:"bytes,1,rep,name=sweeps,proto3" json:"sweeps,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetScheduledSweepResponse) Reset() {
|
||||
*x = GetScheduledSweepResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetScheduledSweepResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetScheduledSweepResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetScheduledSweepResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetScheduledSweepResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetScheduledSweepResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GetScheduledSweepResponse) GetSweeps() []*ScheduledSweep {
|
||||
if x != nil {
|
||||
return x.Sweeps
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetRoundDetailsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RoundId string `protobuf:"bytes,1,opt,name=round_id,json=roundId,proto3" json:"round_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsRequest) Reset() {
|
||||
*x = GetRoundDetailsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRoundDetailsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetRoundDetailsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetRoundDetailsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetRoundDetailsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsRequest) GetRoundId() string {
|
||||
if x != nil {
|
||||
return x.RoundId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetRoundDetailsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RoundId string `protobuf:"bytes,1,opt,name=round_id,json=roundId,proto3" json:"round_id,omitempty"`
|
||||
Txid string `protobuf:"bytes,2,opt,name=txid,proto3" json:"txid,omitempty"`
|
||||
ForfeitedAmount string `protobuf:"bytes,3,opt,name=forfeited_amount,json=forfeitedAmount,proto3" json:"forfeited_amount,omitempty"`
|
||||
TotalVtxosAmount string `protobuf:"bytes,4,opt,name=total_vtxos_amount,json=totalVtxosAmount,proto3" json:"total_vtxos_amount,omitempty"`
|
||||
TotalExitAmount string `protobuf:"bytes,5,opt,name=total_exit_amount,json=totalExitAmount,proto3" json:"total_exit_amount,omitempty"`
|
||||
FeesAmount string `protobuf:"bytes,6,opt,name=fees_amount,json=feesAmount,proto3" json:"fees_amount,omitempty"`
|
||||
InputsVtxos []string `protobuf:"bytes,7,rep,name=inputs_vtxos,json=inputsVtxos,proto3" json:"inputs_vtxos,omitempty"`
|
||||
OutputsVtxos []string `protobuf:"bytes,8,rep,name=outputs_vtxos,json=outputsVtxos,proto3" json:"outputs_vtxos,omitempty"`
|
||||
ExitAddresses []string `protobuf:"bytes,9,rep,name=exit_addresses,json=exitAddresses,proto3" json:"exit_addresses,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) Reset() {
|
||||
*x = GetRoundDetailsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRoundDetailsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetRoundDetailsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetRoundDetailsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetRoundDetailsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetRoundId() string {
|
||||
if x != nil {
|
||||
return x.RoundId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetTxid() string {
|
||||
if x != nil {
|
||||
return x.Txid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetForfeitedAmount() string {
|
||||
if x != nil {
|
||||
return x.ForfeitedAmount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetTotalVtxosAmount() string {
|
||||
if x != nil {
|
||||
return x.TotalVtxosAmount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetTotalExitAmount() string {
|
||||
if x != nil {
|
||||
return x.TotalExitAmount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetFeesAmount() string {
|
||||
if x != nil {
|
||||
return x.FeesAmount
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetInputsVtxos() []string {
|
||||
if x != nil {
|
||||
return x.InputsVtxos
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetOutputsVtxos() []string {
|
||||
if x != nil {
|
||||
return x.OutputsVtxos
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetRoundDetailsResponse) GetExitAddresses() []string {
|
||||
if x != nil {
|
||||
return x.ExitAddresses
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetRoundsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
After int64 `protobuf:"varint,1,opt,name=after,proto3" json:"after,omitempty"`
|
||||
Before int64 `protobuf:"varint,2,opt,name=before,proto3" json:"before,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRoundsRequest) Reset() {
|
||||
*x = GetRoundsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetRoundsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRoundsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetRoundsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetRoundsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetRoundsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *GetRoundsRequest) GetAfter() int64 {
|
||||
if x != nil {
|
||||
return x.After
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetRoundsRequest) GetBefore() int64 {
|
||||
if x != nil {
|
||||
return x.Before
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetRoundsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Rounds []string `protobuf:"bytes,1,rep,name=rounds,proto3" json:"rounds,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRoundsResponse) Reset() {
|
||||
*x = GetRoundsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetRoundsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRoundsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetRoundsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ark_v1_admin_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetRoundsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetRoundsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ark_v1_admin_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *GetRoundsResponse) GetRounds() []string {
|
||||
if x != nil {
|
||||
return x.Rounds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_ark_v1_admin_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ark_v1_admin_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x61, 0x72, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x47, 0x65,
|
||||
0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
|
||||
0x3f, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65,
|
||||
0x22, 0x88, 0x01, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x0c, 0x6d, 0x61, 0x69, 0x6e, 0x5f,
|
||||
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x0b,
|
||||
0x6d, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x12, 0x63,
|
||||
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e,
|
||||
0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x11, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
0x74, 0x6f, 0x72, 0x73, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x1a, 0x0a, 0x18, 0x47,
|
||||
0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53, 0x77, 0x65, 0x65, 0x70,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x74, 0x0a, 0x0f, 0x53, 0x77, 0x65, 0x65, 0x70,
|
||||
0x61, 0x62, 0x6c, 0x65, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x78,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x69, 0x64, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x76, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x76, 0x6f,
|
||||
0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x63,
|
||||
0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x0b, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x41, 0x74, 0x22, 0x5e, 0x0a,
|
||||
0x0e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53, 0x77, 0x65, 0x65, 0x70, 0x12,
|
||||
0x19, 0x0a, 0x08, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x07, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x07, 0x6f, 0x75,
|
||||
0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x72,
|
||||
0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x77, 0x65, 0x65, 0x70, 0x61, 0x62, 0x6c, 0x65, 0x4f, 0x75,
|
||||
0x74, 0x70, 0x75, 0x74, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x4b, 0x0a,
|
||||
0x19, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53, 0x77, 0x65,
|
||||
0x65, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x77,
|
||||
0x65, 0x65, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x72, 0x6b,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53, 0x77, 0x65,
|
||||
0x65, 0x70, 0x52, 0x06, 0x73, 0x77, 0x65, 0x65, 0x70, 0x73, 0x22, 0x33, 0x0a, 0x16, 0x47, 0x65,
|
||||
0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x22,
|
||||
0xdd, 0x02, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x65, 0x74, 0x61,
|
||||
0x69, 0x6c, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x72,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x78, 0x69, 0x64, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x69, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x66, 0x6f,
|
||||
0x72, 0x66, 0x65, 0x69, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x66, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x65, 0x64, 0x41,
|
||||
0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x76,
|
||||
0x74, 0x78, 0x6f, 0x73, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x10, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x41, 0x6d, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x69,
|
||||
0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f,
|
||||
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x45, 0x78, 0x69, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x66, 0x65, 0x65, 0x73, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x65, 0x65, 0x73, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74,
|
||||
0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x5f, 0x76, 0x74, 0x78, 0x6f, 0x73,
|
||||
0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x56, 0x74,
|
||||
0x78, 0x6f, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x5f, 0x76,
|
||||
0x74, 0x78, 0x6f, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x75, 0x74, 0x70,
|
||||
0x75, 0x74, 0x73, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x78, 0x69, 0x74,
|
||||
0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09,
|
||||
0x52, 0x0d, 0x65, 0x78, 0x69, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x22,
|
||||
0x40, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x65, 0x66,
|
||||
0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72,
|
||||
0x65, 0x22, 0x2b, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x73,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x32, 0xb9,
|
||||
0x03, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
|
||||
0x5e, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x19, 0x2e,
|
||||
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63,
|
||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12,
|
||||
0x72, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53,
|
||||
0x77, 0x65, 0x65, 0x70, 0x12, 0x20, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53, 0x77, 0x65, 0x65, 0x70, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x64, 0x53, 0x77, 0x65, 0x65,
|
||||
0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||
0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x73, 0x77, 0x65,
|
||||
0x65, 0x70, 0x73, 0x12, 0x76, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x44,
|
||||
0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12,
|
||||
0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64,
|
||||
0x2f, 0x7b, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x47,
|
||||
0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82,
|
||||
0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x64,
|
||||
0x6d, 0x69, 0x6e, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x42, 0x90, 0x01, 0x0a, 0x0a, 0x63,
|
||||
0x6f, 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x41, 0x64, 0x6d, 0x69, 0x6e,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x6b, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f,
|
||||
0x61, 0x72, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x70, 0x65, 0x63, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x72, 0x6b, 0x2f, 0x76, 0x31,
|
||||
0x3b, 0x61, 0x72, 0x6b, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x41,
|
||||
0x72, 0x6b, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x41, 0x72, 0x6b, 0x5c, 0x56, 0x31, 0xe2, 0x02,
|
||||
0x12, 0x41, 0x72, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
|
||||
0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x41, 0x72, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_ark_v1_admin_proto_rawDescOnce sync.Once
|
||||
file_ark_v1_admin_proto_rawDescData = file_ark_v1_admin_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_ark_v1_admin_proto_rawDescGZIP() []byte {
|
||||
file_ark_v1_admin_proto_rawDescOnce.Do(func() {
|
||||
file_ark_v1_admin_proto_rawDescData = protoimpl.X.CompressGZIP(file_ark_v1_admin_proto_rawDescData)
|
||||
})
|
||||
return file_ark_v1_admin_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_ark_v1_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_ark_v1_admin_proto_goTypes = []interface{}{
|
||||
(*GetBalanceRequest)(nil), // 0: ark.v1.GetBalanceRequest
|
||||
(*Balance)(nil), // 1: ark.v1.Balance
|
||||
(*GetBalanceResponse)(nil), // 2: ark.v1.GetBalanceResponse
|
||||
(*GetScheduledSweepRequest)(nil), // 3: ark.v1.GetScheduledSweepRequest
|
||||
(*SweepableOutput)(nil), // 4: ark.v1.SweepableOutput
|
||||
(*ScheduledSweep)(nil), // 5: ark.v1.ScheduledSweep
|
||||
(*GetScheduledSweepResponse)(nil), // 6: ark.v1.GetScheduledSweepResponse
|
||||
(*GetRoundDetailsRequest)(nil), // 7: ark.v1.GetRoundDetailsRequest
|
||||
(*GetRoundDetailsResponse)(nil), // 8: ark.v1.GetRoundDetailsResponse
|
||||
(*GetRoundsRequest)(nil), // 9: ark.v1.GetRoundsRequest
|
||||
(*GetRoundsResponse)(nil), // 10: ark.v1.GetRoundsResponse
|
||||
}
|
||||
var file_ark_v1_admin_proto_depIdxs = []int32{
|
||||
1, // 0: ark.v1.GetBalanceResponse.main_account:type_name -> ark.v1.Balance
|
||||
1, // 1: ark.v1.GetBalanceResponse.connectors_account:type_name -> ark.v1.Balance
|
||||
4, // 2: ark.v1.ScheduledSweep.outputs:type_name -> ark.v1.SweepableOutput
|
||||
5, // 3: ark.v1.GetScheduledSweepResponse.sweeps:type_name -> ark.v1.ScheduledSweep
|
||||
0, // 4: ark.v1.AdminService.GetBalance:input_type -> ark.v1.GetBalanceRequest
|
||||
3, // 5: ark.v1.AdminService.GetScheduledSweep:input_type -> ark.v1.GetScheduledSweepRequest
|
||||
7, // 6: ark.v1.AdminService.GetRoundDetails:input_type -> ark.v1.GetRoundDetailsRequest
|
||||
9, // 7: ark.v1.AdminService.GetRounds:input_type -> ark.v1.GetRoundsRequest
|
||||
2, // 8: ark.v1.AdminService.GetBalance:output_type -> ark.v1.GetBalanceResponse
|
||||
6, // 9: ark.v1.AdminService.GetScheduledSweep:output_type -> ark.v1.GetScheduledSweepResponse
|
||||
8, // 10: ark.v1.AdminService.GetRoundDetails:output_type -> ark.v1.GetRoundDetailsResponse
|
||||
10, // 11: ark.v1.AdminService.GetRounds:output_type -> ark.v1.GetRoundsResponse
|
||||
8, // [8:12] is the sub-list for method output_type
|
||||
4, // [4:8] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_ark_v1_admin_proto_init() }
|
||||
func file_ark_v1_admin_proto_init() {
|
||||
if File_ark_v1_admin_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_ark_v1_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetBalanceRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Balance); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetBalanceResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetScheduledSweepRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SweepableOutput); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ScheduledSweep); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetScheduledSweepResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetRoundDetailsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetRoundDetailsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetRoundsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ark_v1_admin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetRoundsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_ark_v1_admin_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_ark_v1_admin_proto_goTypes,
|
||||
DependencyIndexes: file_ark_v1_admin_proto_depIdxs,
|
||||
MessageInfos: file_ark_v1_admin_proto_msgTypes,
|
||||
}.Build()
|
||||
File_ark_v1_admin_proto = out.File
|
||||
file_ark_v1_admin_proto_rawDesc = nil
|
||||
file_ark_v1_admin_proto_goTypes = nil
|
||||
file_ark_v1_admin_proto_depIdxs = nil
|
||||
}
|
||||
404
server/api-spec/protobuf/gen/ark/v1/admin.pb.gw.go
Normal file
404
server/api-spec/protobuf/gen/ark/v1/admin.pb.gw.go
Normal file
@@ -0,0 +1,404 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: ark/v1/admin.proto
|
||||
|
||||
/*
|
||||
Package arkv1 is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package arkv1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var _ codes.Code
|
||||
var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_AdminService_GetBalance_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetBalanceRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.GetBalance(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_AdminService_GetBalance_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetBalanceRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := server.GetBalance(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_AdminService_GetScheduledSweep_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetScheduledSweepRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := client.GetScheduledSweep(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_AdminService_GetScheduledSweep_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetScheduledSweepRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
msg, err := server.GetScheduledSweep(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_AdminService_GetRoundDetails_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetRoundDetailsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["round_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "round_id")
|
||||
}
|
||||
|
||||
protoReq.RoundId, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "round_id", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetRoundDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_AdminService_GetRoundDetails_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetRoundDetailsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
var (
|
||||
val string
|
||||
ok bool
|
||||
err error
|
||||
_ = err
|
||||
)
|
||||
|
||||
val, ok = pathParams["round_id"]
|
||||
if !ok {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "round_id")
|
||||
}
|
||||
|
||||
protoReq.RoundId, err = runtime.String(val)
|
||||
if err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "round_id", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetRoundDetails(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_AdminService_GetRounds_0(ctx context.Context, marshaler runtime.Marshaler, client AdminServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetRoundsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetRounds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_AdminService_GetRounds_0(ctx context.Context, marshaler runtime.Marshaler, server AdminServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetRoundsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetRounds(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
// RegisterAdminServiceHandlerServer registers the http handlers for service AdminService to "mux".
|
||||
// UnaryRPC :call AdminServiceServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAdminServiceHandlerFromEndpoint instead.
|
||||
func RegisterAdminServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AdminServiceServer) error {
|
||||
|
||||
mux.Handle("GET", pattern_AdminService_GetBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ark.v1.AdminService/GetBalance", runtime.WithHTTPPathPattern("/v1/admin/balance"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_AdminService_GetBalance_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetBalance_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_AdminService_GetScheduledSweep_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ark.v1.AdminService/GetScheduledSweep", runtime.WithHTTPPathPattern("/v1/admin/sweeps"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_AdminService_GetScheduledSweep_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetScheduledSweep_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_AdminService_GetRoundDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ark.v1.AdminService/GetRoundDetails", runtime.WithHTTPPathPattern("/v1/admin/round/{round_id}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_AdminService_GetRoundDetails_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetRoundDetails_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_AdminService_GetRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ark.v1.AdminService/GetRounds", runtime.WithHTTPPathPattern("/v1/admin/rounds"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_AdminService_GetRounds_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetRounds_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterAdminServiceHandlerFromEndpoint is same as RegisterAdminServiceHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterAdminServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.NewClient(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
|
||||
return RegisterAdminServiceHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterAdminServiceHandler registers the http handlers for service AdminService to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterAdminServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterAdminServiceHandlerClient(ctx, mux, NewAdminServiceClient(conn))
|
||||
}
|
||||
|
||||
// RegisterAdminServiceHandlerClient registers the http handlers for service AdminService
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AdminServiceClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AdminServiceClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "AdminServiceClient" to call the correct interceptors.
|
||||
func RegisterAdminServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AdminServiceClient) error {
|
||||
|
||||
mux.Handle("GET", pattern_AdminService_GetBalance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ark.v1.AdminService/GetBalance", runtime.WithHTTPPathPattern("/v1/admin/balance"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_AdminService_GetBalance_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetBalance_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_AdminService_GetScheduledSweep_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ark.v1.AdminService/GetScheduledSweep", runtime.WithHTTPPathPattern("/v1/admin/sweeps"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_AdminService_GetScheduledSweep_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetScheduledSweep_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_AdminService_GetRoundDetails_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ark.v1.AdminService/GetRoundDetails", runtime.WithHTTPPathPattern("/v1/admin/round/{round_id}"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_AdminService_GetRoundDetails_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetRoundDetails_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_AdminService_GetRounds_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ark.v1.AdminService/GetRounds", runtime.WithHTTPPathPattern("/v1/admin/rounds"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_AdminService_GetRounds_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_AdminService_GetRounds_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_AdminService_GetBalance_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "admin", "balance"}, ""))
|
||||
|
||||
pattern_AdminService_GetScheduledSweep_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "admin", "sweeps"}, ""))
|
||||
|
||||
pattern_AdminService_GetRoundDetails_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "admin", "round", "round_id"}, ""))
|
||||
|
||||
pattern_AdminService_GetRounds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "admin", "rounds"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_AdminService_GetBalance_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_AdminService_GetScheduledSweep_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_AdminService_GetRoundDetails_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_AdminService_GetRounds_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
207
server/api-spec/protobuf/gen/ark/v1/admin_grpc.pb.go
Normal file
207
server/api-spec/protobuf/gen/ark/v1/admin_grpc.pb.go
Normal file
@@ -0,0 +1,207 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package arkv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// AdminServiceClient is the client API for AdminService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type AdminServiceClient interface {
|
||||
GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceResponse, error)
|
||||
GetScheduledSweep(ctx context.Context, in *GetScheduledSweepRequest, opts ...grpc.CallOption) (*GetScheduledSweepResponse, error)
|
||||
GetRoundDetails(ctx context.Context, in *GetRoundDetailsRequest, opts ...grpc.CallOption) (*GetRoundDetailsResponse, error)
|
||||
GetRounds(ctx context.Context, in *GetRoundsRequest, opts ...grpc.CallOption) (*GetRoundsResponse, error)
|
||||
}
|
||||
|
||||
type adminServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient {
|
||||
return &adminServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceResponse, error) {
|
||||
out := new(GetBalanceResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.AdminService/GetBalance", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) GetScheduledSweep(ctx context.Context, in *GetScheduledSweepRequest, opts ...grpc.CallOption) (*GetScheduledSweepResponse, error) {
|
||||
out := new(GetScheduledSweepResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.AdminService/GetScheduledSweep", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) GetRoundDetails(ctx context.Context, in *GetRoundDetailsRequest, opts ...grpc.CallOption) (*GetRoundDetailsResponse, error) {
|
||||
out := new(GetRoundDetailsResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.AdminService/GetRoundDetails", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) GetRounds(ctx context.Context, in *GetRoundsRequest, opts ...grpc.CallOption) (*GetRoundsResponse, error) {
|
||||
out := new(GetRoundsResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.AdminService/GetRounds", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AdminServiceServer is the server API for AdminService service.
|
||||
// All implementations should embed UnimplementedAdminServiceServer
|
||||
// for forward compatibility
|
||||
type AdminServiceServer interface {
|
||||
GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceResponse, error)
|
||||
GetScheduledSweep(context.Context, *GetScheduledSweepRequest) (*GetScheduledSweepResponse, error)
|
||||
GetRoundDetails(context.Context, *GetRoundDetailsRequest) (*GetRoundDetailsResponse, error)
|
||||
GetRounds(context.Context, *GetRoundsRequest) (*GetRoundsResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedAdminServiceServer should be embedded to have forward compatible implementations.
|
||||
type UnimplementedAdminServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedAdminServiceServer) GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBalance not implemented")
|
||||
}
|
||||
func (UnimplementedAdminServiceServer) GetScheduledSweep(context.Context, *GetScheduledSweepRequest) (*GetScheduledSweepResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetScheduledSweep not implemented")
|
||||
}
|
||||
func (UnimplementedAdminServiceServer) GetRoundDetails(context.Context, *GetRoundDetailsRequest) (*GetRoundDetailsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRoundDetails not implemented")
|
||||
}
|
||||
func (UnimplementedAdminServiceServer) GetRounds(context.Context, *GetRoundsRequest) (*GetRoundsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRounds not implemented")
|
||||
}
|
||||
|
||||
// UnsafeAdminServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to AdminServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeAdminServiceServer interface {
|
||||
mustEmbedUnimplementedAdminServiceServer()
|
||||
}
|
||||
|
||||
func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) {
|
||||
s.RegisterService(&AdminService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _AdminService_GetBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBalanceRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).GetBalance(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.AdminService/GetBalance",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).GetBalance(ctx, req.(*GetBalanceRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AdminService_GetScheduledSweep_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetScheduledSweepRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).GetScheduledSweep(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.AdminService/GetScheduledSweep",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).GetScheduledSweep(ctx, req.(*GetScheduledSweepRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AdminService_GetRoundDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRoundDetailsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).GetRoundDetails(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.AdminService/GetRoundDetails",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).GetRoundDetails(ctx, req.(*GetRoundDetailsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AdminService_GetRounds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRoundsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).GetRounds(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.AdminService/GetRounds",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AdminServiceServer).GetRounds(ctx, req.(*GetRoundsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var AdminService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "ark.v1.AdminService",
|
||||
HandlerType: (*AdminServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetBalance",
|
||||
Handler: _AdminService_GetBalance_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetScheduledSweep",
|
||||
Handler: _AdminService_GetScheduledSweep_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRoundDetails",
|
||||
Handler: _AdminService_GetRoundDetails_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRounds",
|
||||
Handler: _AdminService_GetRounds_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "ark/v1/admin.proto",
|
||||
}
|
||||
@@ -507,6 +507,7 @@ type isGetEventStreamResponse_Event interface {
|
||||
}
|
||||
|
||||
type GetEventStreamResponse_RoundFinalization struct {
|
||||
// TODO: BTC add "signTree" event
|
||||
RoundFinalization *RoundFinalizationEvent `protobuf:"bytes,1,opt,name=round_finalization,json=roundFinalization,proto3,oneof"`
|
||||
}
|
||||
|
||||
@@ -576,6 +577,7 @@ type PingResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// TODO: improve this response (returns oneof the round event)
|
||||
ForfeitTxs []string `protobuf:"bytes,1,rep,name=forfeit_txs,json=forfeitTxs,proto3" json:"forfeit_txs,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ type ArkServiceClient interface {
|
||||
RegisterPayment(ctx context.Context, in *RegisterPaymentRequest, opts ...grpc.CallOption) (*RegisterPaymentResponse, error)
|
||||
ClaimPayment(ctx context.Context, in *ClaimPaymentRequest, opts ...grpc.CallOption) (*ClaimPaymentResponse, error)
|
||||
FinalizePayment(ctx context.Context, in *FinalizePaymentRequest, opts ...grpc.CallOption) (*FinalizePaymentResponse, error)
|
||||
// TODO BTC: signTree rpc
|
||||
GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error)
|
||||
GetEventStream(ctx context.Context, in *GetEventStreamRequest, opts ...grpc.CallOption) (ArkService_GetEventStreamClient, error)
|
||||
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
|
||||
@@ -158,6 +159,7 @@ type ArkServiceServer interface {
|
||||
RegisterPayment(context.Context, *RegisterPaymentRequest) (*RegisterPaymentResponse, error)
|
||||
ClaimPayment(context.Context, *ClaimPaymentRequest) (*ClaimPaymentResponse, error)
|
||||
FinalizePayment(context.Context, *FinalizePaymentRequest) (*FinalizePaymentResponse, error)
|
||||
// TODO BTC: signTree rpc
|
||||
GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error)
|
||||
GetEventStream(*GetEventStreamRequest, ArkService_GetEventStreamServer) error
|
||||
Ping(context.Context, *PingRequest) (*PingResponse, error)
|
||||
|
||||
@@ -27,8 +27,10 @@ func main() {
|
||||
log.SetLevel(log.Level(cfg.LogLevel))
|
||||
|
||||
svcConfig := grpcservice.Config{
|
||||
Port: cfg.Port,
|
||||
NoTLS: cfg.NoTLS,
|
||||
Port: cfg.Port,
|
||||
NoTLS: cfg.NoTLS,
|
||||
AuthUser: cfg.AuthUser,
|
||||
AuthPass: cfg.AuthPass,
|
||||
}
|
||||
|
||||
appConfig := &appconfig.Config{
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y=
|
||||
cloud.google.com/go/compute v1.25.1 h1:ZRpHJedLtTpKgr3RV1Fx23NuaAEN1Zfx9hw1u4aJdjU=
|
||||
cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls=
|
||||
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
|
||||
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e h1:ahyvB3q25YnZWly5Gq1ekg6jcmWaGj/vG/MhF4aisoc=
|
||||
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:kGUqhHd//musdITWjFvNTHn90WG9bMLBEPQZ17Cmlpw=
|
||||
@@ -312,6 +317,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
|
||||
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
||||
@@ -47,6 +47,7 @@ type Config struct {
|
||||
|
||||
repo ports.RepoManager
|
||||
svc application.Service
|
||||
adminSvc application.AdminService
|
||||
wallet ports.WalletService
|
||||
txBuilder ports.TxBuilder
|
||||
scanner ports.BlockchainScanner
|
||||
@@ -125,6 +126,9 @@ func (c *Config) Validate() error {
|
||||
if err := c.appService(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := c.adminService(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -132,6 +136,10 @@ func (c *Config) AppService() application.Service {
|
||||
return c.svc
|
||||
}
|
||||
|
||||
func (c *Config) AdminService() application.AdminService {
|
||||
return c.adminSvc
|
||||
}
|
||||
|
||||
func (c *Config) repoManager() error {
|
||||
var svc ports.RepoManager
|
||||
var err error
|
||||
@@ -238,6 +246,11 @@ func (c *Config) appService() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) adminService() error {
|
||||
c.adminSvc = application.NewAdminService(c.wallet, c.repo, c.txBuilder)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Config) mainChain() network.Network {
|
||||
switch c.Network.Name {
|
||||
case "testnet":
|
||||
|
||||
@@ -25,6 +25,8 @@ type Config struct {
|
||||
MinRelayFee uint64
|
||||
RoundLifetime int64
|
||||
UnilateralExitDelay int64
|
||||
AuthUser string
|
||||
AuthPass string
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -42,6 +44,8 @@ var (
|
||||
MinRelayFee = "MIN_RELAY_FEE"
|
||||
RoundLifetime = "ROUND_LIFETIME"
|
||||
UnilateralExitDelay = "UNILATERAL_EXIT_DELAY"
|
||||
AuthUser = "AUTH_USER"
|
||||
AuthPass = "AUTH_PASS"
|
||||
|
||||
defaultDatadir = common.AppDataDir("arkd", false)
|
||||
defaultRoundInterval = 5
|
||||
@@ -57,6 +61,8 @@ var (
|
||||
defaultMinRelayFee = 30 // 0.1 sat/vbyte on Liquid
|
||||
defaultRoundLifetime = 604672
|
||||
defaultUnilateralExitDelay = 1024
|
||||
defaultAuthUser = "admin"
|
||||
defaultAuthPass = "admin"
|
||||
)
|
||||
|
||||
func LoadConfig() (*Config, error) {
|
||||
@@ -77,6 +83,8 @@ func LoadConfig() (*Config, error) {
|
||||
viper.SetDefault(TxBuilderType, defaultTxBuilderType)
|
||||
viper.SetDefault(UnilateralExitDelay, defaultUnilateralExitDelay)
|
||||
viper.SetDefault(BlockchainScannerType, defaultBlockchainScannerType)
|
||||
viper.SetDefault(AuthUser, defaultAuthUser)
|
||||
viper.SetDefault(AuthPass, defaultAuthPass)
|
||||
|
||||
net, err := getNetwork()
|
||||
if err != nil {
|
||||
@@ -102,6 +110,8 @@ func LoadConfig() (*Config, error) {
|
||||
MinRelayFee: viper.GetUint64(MinRelayFee),
|
||||
RoundLifetime: viper.GetInt64(RoundLifetime),
|
||||
UnilateralExitDelay: viper.GetInt64(UnilateralExitDelay),
|
||||
AuthUser: viper.GetString(AuthUser),
|
||||
AuthPass: viper.GetString(AuthPass),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
169
server/internal/core/application/admin.go
Normal file
169
server/internal/core/application/admin.go
Normal file
@@ -0,0 +1,169 @@
|
||||
package application
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ark-network/ark/internal/core/ports"
|
||||
)
|
||||
|
||||
type Balance struct {
|
||||
Locked uint64
|
||||
Available uint64
|
||||
}
|
||||
|
||||
type ArkProviderBalance struct {
|
||||
MainAccountBalance Balance
|
||||
ConnectorsAccountBalance Balance
|
||||
}
|
||||
|
||||
type SweepableOutput struct {
|
||||
TxId string
|
||||
Vout uint32
|
||||
Amount uint64
|
||||
ScheduledAt int64
|
||||
}
|
||||
|
||||
type ScheduledSweep struct {
|
||||
RoundId string
|
||||
SweepableOutputs []SweepableOutput
|
||||
}
|
||||
|
||||
type RoundDetails struct {
|
||||
RoundId string
|
||||
TxId string
|
||||
ForfeitedAmount uint64
|
||||
TotalVtxosAmount uint64
|
||||
TotalExitAmount uint64
|
||||
FeesAmount uint64
|
||||
InputsVtxos []string
|
||||
OutputsVtxos []string
|
||||
ExitAddresses []string
|
||||
}
|
||||
|
||||
type AdminService interface {
|
||||
GetBalance(ctx context.Context) (*ArkProviderBalance, error)
|
||||
GetScheduledSweeps(ctx context.Context) ([]ScheduledSweep, error)
|
||||
GetRoundDetails(ctx context.Context, roundId string) (*RoundDetails, error)
|
||||
GetRounds(ctx context.Context, after int64, before int64) ([]string, error)
|
||||
}
|
||||
|
||||
type adminService struct {
|
||||
walletSvc ports.WalletService
|
||||
repoManager ports.RepoManager
|
||||
txBuilder ports.TxBuilder
|
||||
}
|
||||
|
||||
func NewAdminService(walletSvc ports.WalletService, repoManager ports.RepoManager, txBuilder ports.TxBuilder) AdminService {
|
||||
return &adminService{
|
||||
walletSvc: walletSvc,
|
||||
repoManager: repoManager,
|
||||
txBuilder: txBuilder,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *adminService) GetBalance(ctx context.Context) (*ArkProviderBalance, error) {
|
||||
mainBalance, mainBalanceLocked, err := a.walletSvc.MainAccountBalance(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
connectorBalance, connectorBalanceLocked, err := a.walletSvc.ConnectorsAccountBalance(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &ArkProviderBalance{
|
||||
MainAccountBalance: Balance{Locked: mainBalanceLocked, Available: mainBalance},
|
||||
ConnectorsAccountBalance: Balance{Locked: connectorBalanceLocked, Available: connectorBalance},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *adminService) GetRoundDetails(ctx context.Context, roundId string) (*RoundDetails, error) {
|
||||
round, err := a.repoManager.Rounds().GetRoundWithId(ctx, roundId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roundDetails := &RoundDetails{
|
||||
RoundId: round.Id,
|
||||
TxId: round.Txid,
|
||||
ForfeitedAmount: 0,
|
||||
TotalVtxosAmount: 0,
|
||||
TotalExitAmount: 0,
|
||||
ExitAddresses: []string{},
|
||||
FeesAmount: 0,
|
||||
InputsVtxos: []string{},
|
||||
OutputsVtxos: []string{},
|
||||
}
|
||||
|
||||
for _, payment := range round.Payments {
|
||||
// TODO: Add fees amount
|
||||
roundDetails.ForfeitedAmount += payment.TotalInputAmount()
|
||||
|
||||
for _, receiver := range payment.Receivers {
|
||||
if receiver.IsOnchain() {
|
||||
roundDetails.TotalExitAmount += receiver.Amount
|
||||
roundDetails.ExitAddresses = append(roundDetails.ExitAddresses, receiver.OnchainAddress)
|
||||
continue
|
||||
}
|
||||
|
||||
roundDetails.TotalVtxosAmount += receiver.Amount
|
||||
}
|
||||
|
||||
for _, input := range payment.Inputs {
|
||||
roundDetails.InputsVtxos = append(roundDetails.InputsVtxos, input.Txid)
|
||||
}
|
||||
}
|
||||
|
||||
vtxos, err := a.repoManager.Vtxos().GetVtxosForRound(ctx, round.Txid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, vtxo := range vtxos {
|
||||
roundDetails.OutputsVtxos = append(roundDetails.OutputsVtxos, vtxo.Txid)
|
||||
}
|
||||
|
||||
return roundDetails, nil
|
||||
}
|
||||
|
||||
func (a *adminService) GetRounds(ctx context.Context, after int64, before int64) ([]string, error) {
|
||||
return a.repoManager.Rounds().GetRoundsIds(ctx, after, before)
|
||||
}
|
||||
|
||||
func (a *adminService) GetScheduledSweeps(ctx context.Context) ([]ScheduledSweep, error) {
|
||||
sweepableRounds, err := a.repoManager.Rounds().GetSweepableRounds(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
scheduledSweeps := make([]ScheduledSweep, 0, len(sweepableRounds))
|
||||
|
||||
for _, round := range sweepableRounds {
|
||||
sweepable, err := findSweepableOutputs(
|
||||
ctx, a.walletSvc, a.txBuilder, round.CongestionTree,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sweepableOutputs := make([]SweepableOutput, 0)
|
||||
for expirationTime, inputs := range sweepable {
|
||||
for _, input := range inputs {
|
||||
sweepableOutputs = append(sweepableOutputs, SweepableOutput{
|
||||
TxId: input.GetHash().String(),
|
||||
Vout: input.GetIndex(),
|
||||
Amount: input.GetAmount(),
|
||||
ScheduledAt: expirationTime,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
scheduledSweeps = append(scheduledSweeps, ScheduledSweep{
|
||||
RoundId: round.Id,
|
||||
SweepableOutputs: sweepableOutputs,
|
||||
})
|
||||
}
|
||||
|
||||
return scheduledSweeps, nil
|
||||
}
|
||||
@@ -121,7 +121,7 @@ func (s *sweeper) createTask(
|
||||
vtxoKeys := make([]domain.VtxoKey, 0) // vtxos associated to the sweep inputs
|
||||
|
||||
// inspect the congestion tree to find onchain shared outputs
|
||||
sharedOutputs, err := s.findSweepableOutputs(ctx, congestionTree)
|
||||
sharedOutputs, err := findSweepableOutputs(ctx, s.wallet, s.builder, congestionTree)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("error while inspecting congestion tree")
|
||||
return
|
||||
@@ -280,68 +280,6 @@ func (s *sweeper) createTask(
|
||||
}
|
||||
}
|
||||
|
||||
// onchainOutputs iterates over all the nodes' outputs in the congestion tree and checks their onchain state
|
||||
// returns the sweepable outputs as ports.SweepInput mapped by their expiration time
|
||||
func (s *sweeper) findSweepableOutputs(
|
||||
ctx context.Context,
|
||||
congestionTree tree.CongestionTree,
|
||||
) (map[int64][]ports.SweepInput, error) {
|
||||
sweepableOutputs := make(map[int64][]ports.SweepInput)
|
||||
blocktimeCache := make(map[string]int64) // txid -> blocktime
|
||||
nodesToCheck := congestionTree[0] // init with the root
|
||||
|
||||
for len(nodesToCheck) > 0 {
|
||||
newNodesToCheck := make([]tree.Node, 0)
|
||||
|
||||
for _, node := range nodesToCheck {
|
||||
isConfirmed, blocktime, err := s.wallet.IsTransactionConfirmed(ctx, node.Txid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var expirationTime int64
|
||||
var sweepInput ports.SweepInput
|
||||
|
||||
if !isConfirmed {
|
||||
if _, ok := blocktimeCache[node.ParentTxid]; !ok {
|
||||
isConfirmed, blocktime, err := s.wallet.IsTransactionConfirmed(ctx, node.ParentTxid)
|
||||
if !isConfirmed || err != nil {
|
||||
return nil, fmt.Errorf("tx %s not found", node.Txid)
|
||||
}
|
||||
|
||||
blocktimeCache[node.ParentTxid] = blocktime
|
||||
}
|
||||
|
||||
expirationTime, sweepInput, err = s.builder.GetSweepInput(blocktimeCache[node.ParentTxid], node)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
// cache the blocktime for future use
|
||||
blocktimeCache[node.Txid] = int64(blocktime)
|
||||
|
||||
// if the tx is onchain, it means that the input is spent
|
||||
// add the children to the nodes in order to check them during the next iteration
|
||||
// We will return the error below, but are we going to schedule the tasks for the "children roots"?
|
||||
if !node.Leaf {
|
||||
children := congestionTree.Children(node.Txid)
|
||||
newNodesToCheck = append(newNodesToCheck, children...)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if _, ok := sweepableOutputs[expirationTime]; !ok {
|
||||
sweepableOutputs[expirationTime] = make([]ports.SweepInput, 0)
|
||||
}
|
||||
sweepableOutputs[expirationTime] = append(sweepableOutputs[expirationTime], sweepInput)
|
||||
}
|
||||
|
||||
nodesToCheck = newNodesToCheck
|
||||
}
|
||||
|
||||
return sweepableOutputs, nil
|
||||
}
|
||||
|
||||
func (s *sweeper) updateVtxoExpirationTime(
|
||||
tree tree.CongestionTree,
|
||||
expirationTime int64,
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package application
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ark-network/ark/common"
|
||||
"github.com/ark-network/ark/common/tree"
|
||||
"github.com/ark-network/ark/internal/core/domain"
|
||||
"github.com/ark-network/ark/internal/core/ports"
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/vulpemventures/go-elements/psetv2"
|
||||
@@ -241,3 +244,67 @@ func (m *forfeitTxsMap) view() []string {
|
||||
}
|
||||
return txs
|
||||
}
|
||||
|
||||
// onchainOutputs iterates over all the nodes' outputs in the congestion tree and checks their onchain state
|
||||
// returns the sweepable outputs as ports.SweepInput mapped by their expiration time
|
||||
func findSweepableOutputs(
|
||||
ctx context.Context,
|
||||
walletSvc ports.WalletService,
|
||||
txbuilder ports.TxBuilder,
|
||||
congestionTree tree.CongestionTree,
|
||||
) (map[int64][]ports.SweepInput, error) {
|
||||
sweepableOutputs := make(map[int64][]ports.SweepInput)
|
||||
blocktimeCache := make(map[string]int64) // txid -> blocktime
|
||||
nodesToCheck := congestionTree[0] // init with the root
|
||||
|
||||
for len(nodesToCheck) > 0 {
|
||||
newNodesToCheck := make([]tree.Node, 0)
|
||||
|
||||
for _, node := range nodesToCheck {
|
||||
isConfirmed, blocktime, err := walletSvc.IsTransactionConfirmed(ctx, node.Txid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var expirationTime int64
|
||||
var sweepInput ports.SweepInput
|
||||
|
||||
if !isConfirmed {
|
||||
if _, ok := blocktimeCache[node.ParentTxid]; !ok {
|
||||
isConfirmed, blocktime, err := walletSvc.IsTransactionConfirmed(ctx, node.ParentTxid)
|
||||
if !isConfirmed || err != nil {
|
||||
return nil, fmt.Errorf("tx %s not found", node.Txid)
|
||||
}
|
||||
|
||||
blocktimeCache[node.ParentTxid] = blocktime
|
||||
}
|
||||
|
||||
expirationTime, sweepInput, err = txbuilder.GetSweepInput(blocktimeCache[node.ParentTxid], node)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
// cache the blocktime for future use
|
||||
blocktimeCache[node.Txid] = int64(blocktime)
|
||||
|
||||
// if the tx is onchain, it means that the input is spent
|
||||
// add the children to the nodes in order to check them during the next iteration
|
||||
// We will return the error below, but are we going to schedule the tasks for the "children roots"?
|
||||
if !node.Leaf {
|
||||
children := congestionTree.Children(node.Txid)
|
||||
newNodesToCheck = append(newNodesToCheck, children...)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if _, ok := sweepableOutputs[expirationTime]; !ok {
|
||||
sweepableOutputs[expirationTime] = make([]ports.SweepInput, 0)
|
||||
}
|
||||
sweepableOutputs[expirationTime] = append(sweepableOutputs[expirationTime], sweepInput)
|
||||
}
|
||||
|
||||
nodesToCheck = newNodesToCheck
|
||||
}
|
||||
|
||||
return sweepableOutputs, nil
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ type RoundRepository interface {
|
||||
GetRoundWithId(ctx context.Context, id string) (*Round, error)
|
||||
GetRoundWithTxid(ctx context.Context, txid string) (*Round, error)
|
||||
GetSweepableRounds(ctx context.Context) ([]Round, error)
|
||||
GetRoundsIds(ctx context.Context, startedAfter int64, startedBefore int64) ([]string, error)
|
||||
GetSweptRounds(ctx context.Context) ([]Round, error)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ type WalletService interface {
|
||||
WaitForSync(ctx context.Context, txid string) error
|
||||
EstimateFees(ctx context.Context, pset string) (uint64, error)
|
||||
ListConnectorUtxos(ctx context.Context, connectorAddress string) ([]TxInput, error)
|
||||
MainAccountBalance(ctx context.Context) (uint64, uint64, error)
|
||||
ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error)
|
||||
LockConnectorUtxos(ctx context.Context, utxos []TxOutpoint) error
|
||||
Close()
|
||||
}
|
||||
|
||||
@@ -109,6 +109,30 @@ func (r *roundRepository) GetSweptRounds(ctx context.Context) ([]domain.Round, e
|
||||
return r.findRound(ctx, query)
|
||||
}
|
||||
|
||||
func (r *roundRepository) GetRoundsIds(ctx context.Context, startedAfter int64, startedBefore int64) ([]string, error) {
|
||||
query := badgerhold.Where("Stage.Ended").Eq(true)
|
||||
|
||||
if startedAfter > 0 {
|
||||
query = query.And("StartingTimestamp").Gt(startedAfter)
|
||||
}
|
||||
|
||||
if startedBefore > 0 {
|
||||
query = query.And("StartingTimestamp").Lt(startedBefore)
|
||||
}
|
||||
|
||||
rounds, err := r.findRound(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ids := make([]string, 0, len(rounds))
|
||||
for _, round := range rounds {
|
||||
ids = append(ids, round.Id)
|
||||
}
|
||||
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
func (r *roundRepository) Close() {
|
||||
r.store.Close()
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
pb "github.com/ark-network/ark/api-spec/protobuf/gen/ocean/v1"
|
||||
"github.com/ark-network/ark/internal/core/ports"
|
||||
"github.com/vulpemventures/go-elements/address"
|
||||
"github.com/vulpemventures/go-elements/network"
|
||||
)
|
||||
|
||||
func (s *service) DeriveAddresses(
|
||||
@@ -45,6 +46,27 @@ func (s *service) ListConnectorUtxos(
|
||||
return utxos, nil
|
||||
}
|
||||
|
||||
func (s *service) ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
return s.getBalance(ctx, connectorAccount)
|
||||
}
|
||||
|
||||
func (s *service) MainAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
return s.getBalance(ctx, arkAccount)
|
||||
}
|
||||
|
||||
func (s *service) getBalance(ctx context.Context, accountName string) (uint64, uint64, error) {
|
||||
res, err := s.accountClient.Balance(ctx, &pb.BalanceRequest{
|
||||
AccountName: accountName,
|
||||
})
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
|
||||
balances := res.GetBalance()
|
||||
available, locked := getLBTCbalance(balances)
|
||||
return available, locked, nil
|
||||
}
|
||||
|
||||
func (s *service) deriveAddresses(
|
||||
ctx context.Context, numOfAddresses int, account string,
|
||||
) ([]string, error) {
|
||||
@@ -66,3 +88,31 @@ func (s *service) deriveAddresses(
|
||||
}
|
||||
return addresses, nil
|
||||
}
|
||||
|
||||
func getLBTCbalance(balances map[string]*pb.BalanceInfo) (uint64, uint64) {
|
||||
liquidBalance, liquidLockedBalance, found := getBalance(balances, network.Liquid.AssetID)
|
||||
if found {
|
||||
return liquidBalance, liquidLockedBalance
|
||||
}
|
||||
|
||||
testnetBalance, testnetLockedBalance, found := getBalance(balances, network.Testnet.AssetID)
|
||||
if found {
|
||||
return testnetBalance, testnetLockedBalance
|
||||
}
|
||||
|
||||
regtestBalance, regtestLockedBalance, found := getBalance(balances, network.Regtest.AssetID)
|
||||
if found {
|
||||
return regtestBalance, regtestLockedBalance
|
||||
}
|
||||
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
func getBalance(balances map[string]*pb.BalanceInfo, assetID string) (uint64, uint64, bool) {
|
||||
balance, ok := balances[assetID]
|
||||
if !ok {
|
||||
return 0, 0, false
|
||||
}
|
||||
|
||||
return balance.GetConfirmedBalance() + balance.GetUnconfirmedBalance(), balance.GetLockedBalance(), true
|
||||
}
|
||||
|
||||
@@ -178,6 +178,14 @@ func (m *mockedWallet) WaitForSync(ctx context.Context, txid string) error {
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (m *mockedWallet) MainAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
type mockedInput struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
@@ -178,6 +178,14 @@ func (m *mockedWallet) WaitForSync(ctx context.Context, txid string) error {
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
func (m *mockedWallet) ConnectorsAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
func (m *mockedWallet) MainAccountBalance(ctx context.Context) (uint64, uint64, error) {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
||||
type mockedInput struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
@@ -7,11 +7,21 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port uint32
|
||||
NoTLS bool
|
||||
Port uint32
|
||||
NoTLS bool
|
||||
AuthUser string
|
||||
AuthPass string
|
||||
}
|
||||
|
||||
func (c Config) Validate() error {
|
||||
if len(c.AuthUser) == 0 {
|
||||
return fmt.Errorf("missing auth user")
|
||||
}
|
||||
|
||||
if len(c.AuthPass) == 0 {
|
||||
return fmt.Errorf("missing auth password")
|
||||
}
|
||||
|
||||
lis, err := net.Listen("tcp", c.address())
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid port: %s", err)
|
||||
|
||||
121
server/internal/interface/grpc/handlers/adminservice.go
Normal file
121
server/internal/interface/grpc/handlers/adminservice.go
Normal file
@@ -0,0 +1,121 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
|
||||
"github.com/ark-network/ark/internal/core/application"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
type adminHandler struct {
|
||||
adminService application.AdminService
|
||||
}
|
||||
|
||||
func NewAdminHandler(adminService application.AdminService) arkv1.AdminServiceServer {
|
||||
return &adminHandler{adminService}
|
||||
}
|
||||
|
||||
func (a *adminHandler) GetBalance(ctx context.Context, _ *arkv1.GetBalanceRequest) (*arkv1.GetBalanceResponse, error) {
|
||||
balance, err := a.adminService.GetBalance(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetBalanceResponse{
|
||||
MainAccount: &arkv1.Balance{
|
||||
Locked: convertSatoshis(balance.MainAccountBalance.Locked),
|
||||
Available: convertSatoshis(balance.MainAccountBalance.Available),
|
||||
},
|
||||
ConnectorsAccount: &arkv1.Balance{
|
||||
Locked: convertSatoshis(balance.ConnectorsAccountBalance.Locked),
|
||||
Available: convertSatoshis(balance.ConnectorsAccountBalance.Available),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *adminHandler) GetRoundDetails(ctx context.Context, req *arkv1.GetRoundDetailsRequest) (*arkv1.GetRoundDetailsResponse, error) {
|
||||
id := req.GetRoundId()
|
||||
if len(id) == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing round id")
|
||||
}
|
||||
|
||||
details, err := a.adminService.GetRoundDetails(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetRoundDetailsResponse{
|
||||
RoundId: details.RoundId,
|
||||
Txid: details.TxId,
|
||||
ForfeitedAmount: convertSatoshis(details.ForfeitedAmount),
|
||||
TotalVtxosAmount: convertSatoshis(details.TotalVtxosAmount),
|
||||
TotalExitAmount: convertSatoshis(details.TotalExitAmount),
|
||||
FeesAmount: convertSatoshis(details.FeesAmount),
|
||||
InputsVtxos: details.InputsVtxos,
|
||||
OutputsVtxos: details.OutputsVtxos,
|
||||
ExitAddresses: details.ExitAddresses,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetRounds implements arkv1.AdminServiceServer.
|
||||
func (a *adminHandler) GetRounds(ctx context.Context, req *arkv1.GetRoundsRequest) (*arkv1.GetRoundsResponse, error) {
|
||||
startAfter := req.GetAfter()
|
||||
startBefore := req.GetBefore()
|
||||
|
||||
if startAfter < 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid after (must be >= 0)")
|
||||
}
|
||||
|
||||
if startBefore < 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid before (must be >= 0)")
|
||||
}
|
||||
|
||||
if startAfter >= startBefore {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid range")
|
||||
}
|
||||
|
||||
rounds, err := a.adminService.GetRounds(ctx, startAfter, startBefore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetRoundsResponse{Rounds: rounds}, nil
|
||||
}
|
||||
|
||||
func (a *adminHandler) GetScheduledSweep(ctx context.Context, _ *arkv1.GetScheduledSweepRequest) (*arkv1.GetScheduledSweepResponse, error) {
|
||||
scheduledSweeps, err := a.adminService.GetScheduledSweeps(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sweeps := make([]*arkv1.ScheduledSweep, 0)
|
||||
|
||||
for _, sweep := range scheduledSweeps {
|
||||
outputs := make([]*arkv1.SweepableOutput, 0)
|
||||
|
||||
for _, output := range sweep.SweepableOutputs {
|
||||
outputs = append(outputs, &arkv1.SweepableOutput{
|
||||
Txid: output.TxId,
|
||||
Vout: output.Vout,
|
||||
ScheduledAt: output.ScheduledAt,
|
||||
Amount: convertSatoshis(output.Amount),
|
||||
})
|
||||
}
|
||||
|
||||
sweeps = append(sweeps, &arkv1.ScheduledSweep{
|
||||
RoundId: sweep.RoundId,
|
||||
Outputs: outputs,
|
||||
})
|
||||
}
|
||||
|
||||
return &arkv1.GetScheduledSweepResponse{Sweeps: sweeps}, nil
|
||||
}
|
||||
|
||||
// convert sats to string BTC
|
||||
func convertSatoshis(sats uint64) string {
|
||||
btc := float64(sats) * 1e-8
|
||||
return fmt.Sprintf("%.8f", btc)
|
||||
}
|
||||
42
server/internal/interface/grpc/interceptors/auth.go
Normal file
42
server/internal/interface/grpc/interceptors/auth.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package interceptors
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
|
||||
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func unaryAuthenticator(user, pass string) grpc.UnaryServerInterceptor {
|
||||
adminToken := fmt.Sprintf("%s:%s", user, pass)
|
||||
adminTokenEncoded := base64.StdEncoding.EncodeToString([]byte(adminToken))
|
||||
|
||||
return func(
|
||||
ctx context.Context,
|
||||
req interface{},
|
||||
info *grpc.UnaryServerInfo,
|
||||
handler grpc.UnaryHandler,
|
||||
) (interface{}, error) {
|
||||
// whitelist the ArkService
|
||||
if strings.Contains(info.FullMethod, arkv1.ArkService_ServiceDesc.ServiceName) {
|
||||
return handler(ctx, req)
|
||||
}
|
||||
|
||||
token, err := grpc_auth.AuthFromMD(ctx, "basic")
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Unauthenticated, "no basic header found: %v", err)
|
||||
}
|
||||
|
||||
if token != adminTokenEncoded {
|
||||
return nil, status.Errorf(codes.Unauthenticated, "invalid auth credentials: %v", err)
|
||||
}
|
||||
|
||||
return handler(ctx, req)
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,11 @@ import (
|
||||
)
|
||||
|
||||
// UnaryInterceptor returns the unary interceptor
|
||||
func UnaryInterceptor() grpc.ServerOption {
|
||||
return grpc.UnaryInterceptor(middleware.ChainUnaryServer(unaryLogger))
|
||||
func UnaryInterceptor(user, pass string) grpc.ServerOption {
|
||||
return grpc.UnaryInterceptor(middleware.ChainUnaryServer(
|
||||
unaryAuthenticator(user, pass),
|
||||
unaryLogger,
|
||||
))
|
||||
}
|
||||
|
||||
// StreamInterceptor returns the stream interceptor with a logrus log
|
||||
|
||||
@@ -40,7 +40,8 @@ func NewService(
|
||||
}
|
||||
|
||||
grpcConfig := []grpc.ServerOption{
|
||||
interceptors.UnaryInterceptor(), interceptors.StreamInterceptor(),
|
||||
interceptors.UnaryInterceptor(svcConfig.AuthUser, svcConfig.AuthPass),
|
||||
interceptors.StreamInterceptor(),
|
||||
}
|
||||
if !svcConfig.NoTLS {
|
||||
return nil, fmt.Errorf("tls termination not supported yet")
|
||||
@@ -53,8 +54,13 @@ func NewService(
|
||||
|
||||
// Server grpc.
|
||||
grpcServer := grpc.NewServer(grpcConfig...)
|
||||
|
||||
appHandler := handlers.NewHandler(appConfig.AppService())
|
||||
arkv1.RegisterArkServiceServer(grpcServer, appHandler)
|
||||
|
||||
adminHandler := handlers.NewAdminHandler(appConfig.AdminService())
|
||||
arkv1.RegisterAdminServiceServer(grpcServer, adminHandler)
|
||||
|
||||
healthHandler := handlers.NewHealthHandler()
|
||||
grpchealth.RegisterHealthServer(grpcServer, healthHandler)
|
||||
|
||||
@@ -91,6 +97,11 @@ func NewService(
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := arkv1.RegisterAdminServiceHandler(
|
||||
ctx, gwmux, conn,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
grpcGateway := http.Handler(gwmux)
|
||||
|
||||
handler := router(grpcServer, grpcGateway)
|
||||
|
||||
Reference in New Issue
Block a user