diff --git a/asp/internal/interface/grpc/handlers/.gitkeep b/.gitignore old mode 100755 new mode 100644 similarity index 100% rename from asp/internal/interface/grpc/handlers/.gitkeep rename to .gitignore diff --git a/asp/api-spec/openapi/swagger/ark/v1/service.swagger.json b/asp/api-spec/openapi/swagger/ark/v1/service.swagger.json index 4d2851e..d7ec85e 100644 --- a/asp/api-spec/openapi/swagger/ark/v1/service.swagger.json +++ b/asp/api-spec/openapi/swagger/ark/v1/service.swagger.json @@ -16,6 +16,37 @@ "application/json" ], "paths": { + "/v1/events": { + "get": { + "operationId": "ArkService_GetEventStream", + "responses": { + "200": { + "description": "A successful response.(streaming responses)", + "schema": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/v1GetEventStreamResponse" + }, + "error": { + "$ref": "#/definitions/rpcStatus" + } + }, + "title": "Stream result of v1GetEventStreamResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "ArkService" + ] + } + }, "/v1/payment/claim": { "post": { "operationId": "ArkService_ClaimPayment", @@ -112,6 +143,36 @@ ] } }, + "/v1/ping/{paymentId}": { + "get": { + "operationId": "ArkService_Ping", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1PingResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "paymentId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ArkService" + ] + } + }, "/v1/round/{txid}": { "get": { "operationId": "ArkService_GetRound", @@ -141,38 +202,6 @@ "ArkService" ] } - }, - "/v1/rounds": { - "post": { - "operationId": "ArkService_ListRounds", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1ListRoundsResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/v1ListRoundsRequest" - } - } - ], - "tags": [ - "ArkService" - ] - } } }, "definitions": { @@ -225,15 +254,32 @@ "v1FinalizePaymentRequest": { "type": "object", "properties": { - "signedVtx": { - "type": "string", - "description": "Forfeit tx signed also by the user." + "signedForfeits": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Forfeit txs signed by the user." } } }, "v1FinalizePaymentResponse": { "type": "object" }, + "v1GetEventStreamResponse": { + "type": "object", + "properties": { + "roundFinalization": { + "$ref": "#/definitions/v1RoundFinalizationEvent" + }, + "roundFinalized": { + "$ref": "#/definitions/v1RoundFinalizedEvent" + }, + "roundFailed": { + "$ref": "#/definitions/v1RoundFailed" + } + } + }, "v1GetRoundResponse": { "type": "object", "properties": { @@ -242,30 +288,18 @@ } } }, - "v1ListRoundsRequest": { + "v1Input": { "type": "object", "properties": { - "start": { - "type": "string", - "format": "int64" + "txid": { + "type": "string" }, - "end": { - "type": "string", + "vout": { + "type": "integer", "format": "int64" } } }, - "v1ListRoundsResponse": { - "type": "object", - "properties": { - "rounds": { - "type": "array", - "items": { - "$ref": "#/definitions/v1Round" - } - } - } - }, "v1Output": { "type": "object", "properties": { @@ -278,12 +312,17 @@ } } }, + "v1PingResponse": { + "type": "object" + }, "v1RegisterPaymentRequest": { "type": "object", "properties": { - "vtx": { - "type": "string", - "description": "Unsigned forfeit tx sending all funds back to the ASP." + "inputs": { + "type": "array", + "items": { + "$ref": "#/definitions/v1Input" + } } } }, @@ -293,16 +332,15 @@ "id": { "type": "string", "description": "Mocks wabisabi's credentials." - }, - "signedVtx": { - "type": "string", - "description": "Forfeit tx signed by the ASP." } } }, "v1Round": { "type": "object", "properties": { + "id": { + "type": "string" + }, "start": { "type": "string", "format": "int64" @@ -314,13 +352,58 @@ "txid": { "type": "string" }, - "outputs": { + "congestionTree": { "type": "array", "items": { - "$ref": "#/definitions/v1Output" + "type": "string" } } } + }, + "v1RoundFailed": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "reason": { + "type": "string" + } + } + }, + "v1RoundFinalizationEvent": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "poolPartialTx": { + "type": "string" + }, + "forfeitTxs": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "congestionTree": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "v1RoundFinalizedEvent": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "poolTxid": { + "type": "string" + } + } } } } diff --git a/asp/api-spec/protobuf/ark/v1/service.proto b/asp/api-spec/protobuf/ark/v1/service.proto index ccb4c53..e3b6ac5 100755 --- a/asp/api-spec/protobuf/ark/v1/service.proto +++ b/asp/api-spec/protobuf/ark/v1/service.proto @@ -23,28 +23,29 @@ service ArkService { body: "*" }; }; - rpc ListRounds(ListRoundsRequest) returns (ListRoundsResponse) { - option (google.api.http) = { - post: "/v1/rounds" - body: "*" - }; - }; rpc GetRound(GetRoundRequest) returns (GetRoundResponse) { option (google.api.http) = { get: "/v1/round/{txid}" }; }; + rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) { + option (google.api.http) = { + get: "/v1/events" + }; + }; + rpc Ping(PingRequest) returns (PingResponse) { + option (google.api.http) = { + get: "/v1/ping/{payment_id}" + }; + }; } message RegisterPaymentRequest { - // Unsigned forfeit tx sending all funds back to the ASP. - string vtx = 1; + repeated Input inputs = 1; } message RegisterPaymentResponse { // Mocks wabisabi's credentials. string id = 1; - // Forfeit tx signed by the ASP. - string signed_vtx = 2; } message ClaimPaymentRequest { @@ -56,19 +57,11 @@ message ClaimPaymentRequest { message ClaimPaymentResponse {} message FinalizePaymentRequest { - // Forfeit tx signed also by the user. - string signed_vtx = 1; + // Forfeit txs signed by the user. + repeated string signed_forfeits = 1; } message FinalizePaymentResponse {} -message ListRoundsRequest { - int64 start = 1; - int64 end = 2; -} -message ListRoundsResponse { - repeated Round rounds = 1; -} - message GetRoundRequest { string txid = 1; } @@ -77,13 +70,53 @@ message GetRoundResponse { } message Round { - int64 start = 1; - int64 end = 2; - string txid = 3; - repeated Output outputs = 4; + string id = 1; + int64 start = 2; + int64 end = 3; + string txid = 4; + repeated string congestion_tree = 5; +} + +message Input { + string txid = 1; + uint32 vout = 2; } message Output { string pubkey = 1; uint64 amount = 2; -} \ No newline at end of file +} + +message RoundFinalizationEvent { + string id = 1; + string pool_partial_tx = 2; + map forfeit_txs = 3; + repeated string congestion_tree = 4; +} + +message RoundFinalizedEvent { + string id = 1; + string pool_txid = 2; +} + +message RoundFailed { + string id = 1; + string reason = 2; +} + +message GetEventStreamRequest {} + +message GetEventStreamResponse { + oneof event { + RoundFinalizationEvent round_finalization = 1; + RoundFinalizedEvent round_finalized = 2; + RoundFailed round_failed = 3; + } +} + +message PingRequest { + string payment_id = 1; +} + +message PingResponse {} + diff --git a/asp/api-spec/protobuf/gen/ark/v1/service.pb.go b/asp/api-spec/protobuf/gen/ark/v1/service.pb.go index 1e18d65..9176f37 100644 --- a/asp/api-spec/protobuf/gen/ark/v1/service.pb.go +++ b/asp/api-spec/protobuf/gen/ark/v1/service.pb.go @@ -26,8 +26,7 @@ type RegisterPaymentRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Unsigned forfeit tx sending all funds back to the ASP. - Vtx string `protobuf:"bytes,1,opt,name=vtx,proto3" json:"vtx,omitempty"` + Inputs []*Input `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs,omitempty"` } func (x *RegisterPaymentRequest) Reset() { @@ -62,11 +61,11 @@ func (*RegisterPaymentRequest) Descriptor() ([]byte, []int) { return file_ark_v1_service_proto_rawDescGZIP(), []int{0} } -func (x *RegisterPaymentRequest) GetVtx() string { +func (x *RegisterPaymentRequest) GetInputs() []*Input { if x != nil { - return x.Vtx + return x.Inputs } - return "" + return nil } type RegisterPaymentResponse struct { @@ -76,8 +75,6 @@ type RegisterPaymentResponse struct { // Mocks wabisabi's credentials. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // Forfeit tx signed by the ASP. - SignedVtx string `protobuf:"bytes,2,opt,name=signed_vtx,json=signedVtx,proto3" json:"signed_vtx,omitempty"` } func (x *RegisterPaymentResponse) Reset() { @@ -119,13 +116,6 @@ func (x *RegisterPaymentResponse) GetId() string { return "" } -func (x *RegisterPaymentResponse) GetSignedVtx() string { - if x != nil { - return x.SignedVtx - } - return "" -} - type ClaimPaymentRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -226,8 +216,8 @@ type FinalizePaymentRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Forfeit tx signed also by the user. - SignedVtx string `protobuf:"bytes,1,opt,name=signed_vtx,json=signedVtx,proto3" json:"signed_vtx,omitempty"` + // Forfeit txs signed by the user. + SignedForfeits []string `protobuf:"bytes,1,rep,name=signed_forfeits,json=signedForfeits,proto3" json:"signed_forfeits,omitempty"` } func (x *FinalizePaymentRequest) Reset() { @@ -262,11 +252,11 @@ func (*FinalizePaymentRequest) Descriptor() ([]byte, []int) { return file_ark_v1_service_proto_rawDescGZIP(), []int{4} } -func (x *FinalizePaymentRequest) GetSignedVtx() string { +func (x *FinalizePaymentRequest) GetSignedForfeits() []string { if x != nil { - return x.SignedVtx + return x.SignedForfeits } - return "" + return nil } type FinalizePaymentResponse struct { @@ -307,108 +297,6 @@ func (*FinalizePaymentResponse) Descriptor() ([]byte, []int) { return file_ark_v1_service_proto_rawDescGZIP(), []int{5} } -type ListRoundsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` -} - -func (x *ListRoundsRequest) Reset() { - *x = ListRoundsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_ark_v1_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListRoundsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListRoundsRequest) ProtoMessage() {} - -func (x *ListRoundsRequest) ProtoReflect() protoreflect.Message { - mi := &file_ark_v1_service_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 ListRoundsRequest.ProtoReflect.Descriptor instead. -func (*ListRoundsRequest) Descriptor() ([]byte, []int) { - return file_ark_v1_service_proto_rawDescGZIP(), []int{6} -} - -func (x *ListRoundsRequest) GetStart() int64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *ListRoundsRequest) GetEnd() int64 { - if x != nil { - return x.End - } - return 0 -} - -type ListRoundsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rounds []*Round `protobuf:"bytes,1,rep,name=rounds,proto3" json:"rounds,omitempty"` -} - -func (x *ListRoundsResponse) Reset() { - *x = ListRoundsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_ark_v1_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListRoundsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListRoundsResponse) ProtoMessage() {} - -func (x *ListRoundsResponse) ProtoReflect() protoreflect.Message { - mi := &file_ark_v1_service_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 ListRoundsResponse.ProtoReflect.Descriptor instead. -func (*ListRoundsResponse) Descriptor() ([]byte, []int) { - return file_ark_v1_service_proto_rawDescGZIP(), []int{7} -} - -func (x *ListRoundsResponse) GetRounds() []*Round { - if x != nil { - return x.Rounds - } - return nil -} - type GetRoundRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -420,7 +308,7 @@ type GetRoundRequest struct { func (x *GetRoundRequest) Reset() { *x = GetRoundRequest{} if protoimpl.UnsafeEnabled { - mi := &file_ark_v1_service_proto_msgTypes[8] + mi := &file_ark_v1_service_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -433,7 +321,7 @@ func (x *GetRoundRequest) String() string { func (*GetRoundRequest) ProtoMessage() {} func (x *GetRoundRequest) ProtoReflect() protoreflect.Message { - mi := &file_ark_v1_service_proto_msgTypes[8] + mi := &file_ark_v1_service_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -446,7 +334,7 @@ func (x *GetRoundRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRoundRequest.ProtoReflect.Descriptor instead. func (*GetRoundRequest) Descriptor() ([]byte, []int) { - return file_ark_v1_service_proto_rawDescGZIP(), []int{8} + return file_ark_v1_service_proto_rawDescGZIP(), []int{6} } func (x *GetRoundRequest) GetTxid() string { @@ -467,7 +355,7 @@ type GetRoundResponse struct { func (x *GetRoundResponse) Reset() { *x = GetRoundResponse{} if protoimpl.UnsafeEnabled { - mi := &file_ark_v1_service_proto_msgTypes[9] + mi := &file_ark_v1_service_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -480,7 +368,7 @@ func (x *GetRoundResponse) String() string { func (*GetRoundResponse) ProtoMessage() {} func (x *GetRoundResponse) ProtoReflect() protoreflect.Message { - mi := &file_ark_v1_service_proto_msgTypes[9] + mi := &file_ark_v1_service_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -493,7 +381,7 @@ func (x *GetRoundResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetRoundResponse.ProtoReflect.Descriptor instead. func (*GetRoundResponse) Descriptor() ([]byte, []int) { - return file_ark_v1_service_proto_rawDescGZIP(), []int{9} + return file_ark_v1_service_proto_rawDescGZIP(), []int{7} } func (x *GetRoundResponse) GetRound() *Round { @@ -508,16 +396,17 @@ type Round struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` - Txid string `protobuf:"bytes,3,opt,name=txid,proto3" json:"txid,omitempty"` - Outputs []*Output `protobuf:"bytes,4,rep,name=outputs,proto3" json:"outputs,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Start int64 `protobuf:"varint,2,opt,name=start,proto3" json:"start,omitempty"` + End int64 `protobuf:"varint,3,opt,name=end,proto3" json:"end,omitempty"` + Txid string `protobuf:"bytes,4,opt,name=txid,proto3" json:"txid,omitempty"` + CongestionTree []string `protobuf:"bytes,5,rep,name=congestion_tree,json=congestionTree,proto3" json:"congestion_tree,omitempty"` } func (x *Round) Reset() { *x = Round{} if protoimpl.UnsafeEnabled { - mi := &file_ark_v1_service_proto_msgTypes[10] + mi := &file_ark_v1_service_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -530,7 +419,7 @@ func (x *Round) String() string { func (*Round) ProtoMessage() {} func (x *Round) ProtoReflect() protoreflect.Message { - mi := &file_ark_v1_service_proto_msgTypes[10] + mi := &file_ark_v1_service_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -543,7 +432,14 @@ func (x *Round) ProtoReflect() protoreflect.Message { // Deprecated: Use Round.ProtoReflect.Descriptor instead. func (*Round) Descriptor() ([]byte, []int) { - return file_ark_v1_service_proto_rawDescGZIP(), []int{10} + return file_ark_v1_service_proto_rawDescGZIP(), []int{8} +} + +func (x *Round) GetId() string { + if x != nil { + return x.Id + } + return "" } func (x *Round) GetStart() int64 { @@ -567,13 +463,68 @@ func (x *Round) GetTxid() string { return "" } -func (x *Round) GetOutputs() []*Output { +func (x *Round) GetCongestionTree() []string { if x != nil { - return x.Outputs + return x.CongestionTree } return nil } +type Input 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"` +} + +func (x *Input) Reset() { + *x = Input{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Input) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Input) ProtoMessage() {} + +func (x *Input) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_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 Input.ProtoReflect.Descriptor instead. +func (*Input) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{9} +} + +func (x *Input) GetTxid() string { + if x != nil { + return x.Txid + } + return "" +} + +func (x *Input) GetVout() uint32 { + if x != nil { + return x.Vout + } + return 0 +} + type Output struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -586,7 +537,7 @@ type Output struct { func (x *Output) Reset() { *x = Output{} if protoimpl.UnsafeEnabled { - mi := &file_ark_v1_service_proto_msgTypes[11] + mi := &file_ark_v1_service_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -599,7 +550,7 @@ func (x *Output) String() string { func (*Output) ProtoMessage() {} func (x *Output) ProtoReflect() protoreflect.Message { - mi := &file_ark_v1_service_proto_msgTypes[11] + mi := &file_ark_v1_service_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -612,7 +563,7 @@ func (x *Output) ProtoReflect() protoreflect.Message { // Deprecated: Use Output.ProtoReflect.Descriptor instead. func (*Output) Descriptor() ([]byte, []int) { - return file_ark_v1_service_proto_rawDescGZIP(), []int{11} + return file_ark_v1_service_proto_rawDescGZIP(), []int{10} } func (x *Output) GetPubkey() string { @@ -629,100 +580,545 @@ func (x *Output) GetAmount() uint64 { return 0 } +type RoundFinalizationEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + PoolPartialTx string `protobuf:"bytes,2,opt,name=pool_partial_tx,json=poolPartialTx,proto3" json:"pool_partial_tx,omitempty"` + ForfeitTxs map[string]string `protobuf:"bytes,3,rep,name=forfeit_txs,json=forfeitTxs,proto3" json:"forfeit_txs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CongestionTree []string `protobuf:"bytes,4,rep,name=congestion_tree,json=congestionTree,proto3" json:"congestion_tree,omitempty"` +} + +func (x *RoundFinalizationEvent) Reset() { + *x = RoundFinalizationEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoundFinalizationEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoundFinalizationEvent) ProtoMessage() {} + +func (x *RoundFinalizationEvent) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[11] + 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 RoundFinalizationEvent.ProtoReflect.Descriptor instead. +func (*RoundFinalizationEvent) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{11} +} + +func (x *RoundFinalizationEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RoundFinalizationEvent) GetPoolPartialTx() string { + if x != nil { + return x.PoolPartialTx + } + return "" +} + +func (x *RoundFinalizationEvent) GetForfeitTxs() map[string]string { + if x != nil { + return x.ForfeitTxs + } + return nil +} + +func (x *RoundFinalizationEvent) GetCongestionTree() []string { + if x != nil { + return x.CongestionTree + } + return nil +} + +type RoundFinalizedEvent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + PoolTxid string `protobuf:"bytes,2,opt,name=pool_txid,json=poolTxid,proto3" json:"pool_txid,omitempty"` +} + +func (x *RoundFinalizedEvent) Reset() { + *x = RoundFinalizedEvent{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoundFinalizedEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoundFinalizedEvent) ProtoMessage() {} + +func (x *RoundFinalizedEvent) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[12] + 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 RoundFinalizedEvent.ProtoReflect.Descriptor instead. +func (*RoundFinalizedEvent) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{12} +} + +func (x *RoundFinalizedEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RoundFinalizedEvent) GetPoolTxid() string { + if x != nil { + return x.PoolTxid + } + return "" +} + +type RoundFailed struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"` +} + +func (x *RoundFailed) Reset() { + *x = RoundFailed{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RoundFailed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RoundFailed) ProtoMessage() {} + +func (x *RoundFailed) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[13] + 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 RoundFailed.ProtoReflect.Descriptor instead. +func (*RoundFailed) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{13} +} + +func (x *RoundFailed) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *RoundFailed) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type GetEventStreamRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetEventStreamRequest) Reset() { + *x = GetEventStreamRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetEventStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetEventStreamRequest) ProtoMessage() {} + +func (x *GetEventStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[14] + 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 GetEventStreamRequest.ProtoReflect.Descriptor instead. +func (*GetEventStreamRequest) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{14} +} + +type GetEventStreamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Event: + // *GetEventStreamResponse_RoundFinalization + // *GetEventStreamResponse_RoundFinalized + // *GetEventStreamResponse_RoundFailed + Event isGetEventStreamResponse_Event `protobuf_oneof:"event"` +} + +func (x *GetEventStreamResponse) Reset() { + *x = GetEventStreamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetEventStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetEventStreamResponse) ProtoMessage() {} + +func (x *GetEventStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[15] + 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 GetEventStreamResponse.ProtoReflect.Descriptor instead. +func (*GetEventStreamResponse) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{15} +} + +func (m *GetEventStreamResponse) GetEvent() isGetEventStreamResponse_Event { + if m != nil { + return m.Event + } + return nil +} + +func (x *GetEventStreamResponse) GetRoundFinalization() *RoundFinalizationEvent { + if x, ok := x.GetEvent().(*GetEventStreamResponse_RoundFinalization); ok { + return x.RoundFinalization + } + return nil +} + +func (x *GetEventStreamResponse) GetRoundFinalized() *RoundFinalizedEvent { + if x, ok := x.GetEvent().(*GetEventStreamResponse_RoundFinalized); ok { + return x.RoundFinalized + } + return nil +} + +func (x *GetEventStreamResponse) GetRoundFailed() *RoundFailed { + if x, ok := x.GetEvent().(*GetEventStreamResponse_RoundFailed); ok { + return x.RoundFailed + } + return nil +} + +type isGetEventStreamResponse_Event interface { + isGetEventStreamResponse_Event() +} + +type GetEventStreamResponse_RoundFinalization struct { + RoundFinalization *RoundFinalizationEvent `protobuf:"bytes,1,opt,name=round_finalization,json=roundFinalization,proto3,oneof"` +} + +type GetEventStreamResponse_RoundFinalized struct { + RoundFinalized *RoundFinalizedEvent `protobuf:"bytes,2,opt,name=round_finalized,json=roundFinalized,proto3,oneof"` +} + +type GetEventStreamResponse_RoundFailed struct { + RoundFailed *RoundFailed `protobuf:"bytes,3,opt,name=round_failed,json=roundFailed,proto3,oneof"` +} + +func (*GetEventStreamResponse_RoundFinalization) isGetEventStreamResponse_Event() {} + +func (*GetEventStreamResponse_RoundFinalized) isGetEventStreamResponse_Event() {} + +func (*GetEventStreamResponse_RoundFailed) isGetEventStreamResponse_Event() {} + +type PingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PaymentId string `protobuf:"bytes,1,opt,name=payment_id,json=paymentId,proto3" json:"payment_id,omitempty"` +} + +func (x *PingRequest) Reset() { + *x = PingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PingRequest) ProtoMessage() {} + +func (x *PingRequest) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[16] + 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 PingRequest.ProtoReflect.Descriptor instead. +func (*PingRequest) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{16} +} + +func (x *PingRequest) GetPaymentId() string { + if x != nil { + return x.PaymentId + } + return "" +} + +type PingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PingResponse) Reset() { + *x = PingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_ark_v1_service_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PingResponse) ProtoMessage() {} + +func (x *PingResponse) ProtoReflect() protoreflect.Message { + mi := &file_ark_v1_service_proto_msgTypes[17] + 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 PingResponse.ProtoReflect.Descriptor instead. +func (*PingResponse) Descriptor() ([]byte, []int) { + return file_ark_v1_service_proto_rawDescGZIP(), []int{17} +} + var File_ark_v1_service_proto protoreflect.FileDescriptor var file_ark_v1_service_proto_rawDesc = []byte{ 0x0a, 0x14, 0x61, 0x72, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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, 0x2a, 0x0a, 0x16, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x16, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x74, 0x78, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x76, 0x74, 0x78, 0x22, 0x48, 0x0a, 0x17, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x76, 0x74, - 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x56, - 0x74, 0x78, 0x22, 0x4f, 0x0a, 0x13, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x61, 0x72, 0x6b, - 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x16, 0x46, - 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, - 0x76, 0x74, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x65, - 0x64, 0x56, 0x74, 0x78, 0x22, 0x19, 0x0a, 0x17, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, - 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x3b, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x22, 0x3b, 0x0a, 0x12, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e, - 0x64, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22, 0x25, 0x0a, 0x0f, 0x47, 0x65, 0x74, - 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x74, 0x78, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x69, 0x64, - 0x22, 0x37, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, - 0x6e, 0x64, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x6d, 0x0a, 0x05, 0x52, 0x6f, 0x75, - 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x78, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x78, 0x69, 0x64, 0x12, 0x28, - 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, - 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x38, 0x0a, 0x06, 0x4f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x32, 0x94, 0x04, 0x0a, 0x0a, 0x41, 0x72, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x73, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, - 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x67, 0x0a, 0x0c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, - 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, + 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x22, 0x29, 0x0a, + 0x17, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4f, 0x0a, 0x13, 0x43, 0x6c, 0x61, 0x69, + 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x28, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, + 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, - 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, - 0x73, 0x0a, 0x0f, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, - 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, - 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, - 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x66, 0x69, 0x6e, 0x61, - 0x6c, 0x69, 0x7a, 0x65, 0x12, 0x5a, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x6e, - 0x64, 0x73, 0x12, 0x19, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, - 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x0f, 0x3a, 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x73, - 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x61, - 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, - 0x6e, 0x64, 0x2f, 0x7b, 0x74, 0x78, 0x69, 0x64, 0x7d, 0x42, 0x92, 0x01, 0x0a, 0x0a, 0x63, 0x6f, - 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 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, + 0x65, 0x22, 0x41, 0x0a, 0x16, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x66, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x46, 0x6f, 0x72, 0x66, + 0x65, 0x69, 0x74, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, + 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x25, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x78, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x78, 0x69, 0x64, 0x22, 0x37, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, + 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x72, 0x6f, + 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, + 0x7c, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, + 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x65, 0x6e, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x74, 0x78, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x74, 0x78, 0x69, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x74, 0x72, 0x65, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x63, + 0x6f, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x65, 0x65, 0x22, 0x2f, 0x0a, + 0x05, 0x49, 0x6e, 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, 0x22, 0x38, + 0x0a, 0x06, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x89, 0x02, 0x0a, 0x16, 0x52, 0x6f, 0x75, + 0x6e, 0x64, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x74, + 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x6f, + 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x54, 0x78, 0x12, 0x4f, 0x0a, 0x0b, 0x66, + 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x5f, 0x74, 0x78, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x46, + 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x2e, 0x46, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x54, 0x78, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0a, 0x66, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x54, 0x78, 0x73, 0x12, 0x27, 0x0a, 0x0f, + 0x63, 0x6f, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x72, 0x65, 0x65, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x67, 0x65, 0x73, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x65, 0x65, 0x1a, 0x3d, 0x0a, 0x0f, 0x46, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, + 0x54, 0x78, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0x42, 0x0a, 0x13, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x46, 0x69, 0x6e, + 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x70, + 0x6f, 0x6f, 0x6c, 0x5f, 0x74, 0x78, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x70, 0x6f, 0x6f, 0x6c, 0x54, 0x78, 0x69, 0x64, 0x22, 0x35, 0x0a, 0x0b, 0x52, 0x6f, 0x75, 0x6e, + 0x64, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, + 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xf4, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x12, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x66, 0x69, 0x6e, + 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x46, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, + 0x00, 0x52, 0x11, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x0f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x66, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x46, 0x69, 0x6e, 0x61, + 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0e, 0x72, 0x6f, + 0x75, 0x6e, 0x64, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x0c, + 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e, + 0x64, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x6f, 0x75, 0x6e, 0x64, + 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, + 0x2c, 0x0a, 0x0b, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x0e, 0x0a, + 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf1, 0x04, + 0x0a, 0x0a, 0x41, 0x72, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x0f, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, + 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 0x12, 0x67, 0x0a, 0x0c, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x1b, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, + 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, + 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x50, 0x61, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x16, 0x3a, 0x01, 0x2a, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x61, 0x69, 0x6d, 0x12, 0x73, 0x0a, 0x0f, 0x46, 0x69, + 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e, + 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, + 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, + 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x50, + 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x70, + 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x12, + 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x61, 0x72, + 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, + 0x64, 0x2f, 0x7b, 0x74, 0x78, 0x69, 0x64, 0x7d, 0x12, 0x65, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1d, 0x2e, 0x61, 0x72, 0x6b, + 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x30, 0x01, 0x12, + 0x50, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x13, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, + 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, + 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, + 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x7d, 0x42, 0x92, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, + 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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 ( @@ -737,7 +1133,7 @@ func file_ark_v1_service_proto_rawDescGZIP() []byte { return file_ark_v1_service_proto_rawDescData } -var file_ark_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_ark_v1_service_proto_msgTypes = make([]protoimpl.MessageInfo, 19) var file_ark_v1_service_proto_goTypes = []interface{}{ (*RegisterPaymentRequest)(nil), // 0: ark.v1.RegisterPaymentRequest (*RegisterPaymentResponse)(nil), // 1: ark.v1.RegisterPaymentResponse @@ -745,33 +1141,45 @@ var file_ark_v1_service_proto_goTypes = []interface{}{ (*ClaimPaymentResponse)(nil), // 3: ark.v1.ClaimPaymentResponse (*FinalizePaymentRequest)(nil), // 4: ark.v1.FinalizePaymentRequest (*FinalizePaymentResponse)(nil), // 5: ark.v1.FinalizePaymentResponse - (*ListRoundsRequest)(nil), // 6: ark.v1.ListRoundsRequest - (*ListRoundsResponse)(nil), // 7: ark.v1.ListRoundsResponse - (*GetRoundRequest)(nil), // 8: ark.v1.GetRoundRequest - (*GetRoundResponse)(nil), // 9: ark.v1.GetRoundResponse - (*Round)(nil), // 10: ark.v1.Round - (*Output)(nil), // 11: ark.v1.Output + (*GetRoundRequest)(nil), // 6: ark.v1.GetRoundRequest + (*GetRoundResponse)(nil), // 7: ark.v1.GetRoundResponse + (*Round)(nil), // 8: ark.v1.Round + (*Input)(nil), // 9: ark.v1.Input + (*Output)(nil), // 10: ark.v1.Output + (*RoundFinalizationEvent)(nil), // 11: ark.v1.RoundFinalizationEvent + (*RoundFinalizedEvent)(nil), // 12: ark.v1.RoundFinalizedEvent + (*RoundFailed)(nil), // 13: ark.v1.RoundFailed + (*GetEventStreamRequest)(nil), // 14: ark.v1.GetEventStreamRequest + (*GetEventStreamResponse)(nil), // 15: ark.v1.GetEventStreamResponse + (*PingRequest)(nil), // 16: ark.v1.PingRequest + (*PingResponse)(nil), // 17: ark.v1.PingResponse + nil, // 18: ark.v1.RoundFinalizationEvent.ForfeitTxsEntry } var file_ark_v1_service_proto_depIdxs = []int32{ - 11, // 0: ark.v1.ClaimPaymentRequest.outputs:type_name -> ark.v1.Output - 10, // 1: ark.v1.ListRoundsResponse.rounds:type_name -> ark.v1.Round - 10, // 2: ark.v1.GetRoundResponse.round:type_name -> ark.v1.Round - 11, // 3: ark.v1.Round.outputs:type_name -> ark.v1.Output - 0, // 4: ark.v1.ArkService.RegisterPayment:input_type -> ark.v1.RegisterPaymentRequest - 2, // 5: ark.v1.ArkService.ClaimPayment:input_type -> ark.v1.ClaimPaymentRequest - 4, // 6: ark.v1.ArkService.FinalizePayment:input_type -> ark.v1.FinalizePaymentRequest - 6, // 7: ark.v1.ArkService.ListRounds:input_type -> ark.v1.ListRoundsRequest - 8, // 8: ark.v1.ArkService.GetRound:input_type -> ark.v1.GetRoundRequest - 1, // 9: ark.v1.ArkService.RegisterPayment:output_type -> ark.v1.RegisterPaymentResponse - 3, // 10: ark.v1.ArkService.ClaimPayment:output_type -> ark.v1.ClaimPaymentResponse - 5, // 11: ark.v1.ArkService.FinalizePayment:output_type -> ark.v1.FinalizePaymentResponse - 7, // 12: ark.v1.ArkService.ListRounds:output_type -> ark.v1.ListRoundsResponse - 9, // 13: ark.v1.ArkService.GetRound:output_type -> ark.v1.GetRoundResponse - 9, // [9:14] is the sub-list for method output_type - 4, // [4:9] 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 + 9, // 0: ark.v1.RegisterPaymentRequest.inputs:type_name -> ark.v1.Input + 10, // 1: ark.v1.ClaimPaymentRequest.outputs:type_name -> ark.v1.Output + 8, // 2: ark.v1.GetRoundResponse.round:type_name -> ark.v1.Round + 18, // 3: ark.v1.RoundFinalizationEvent.forfeit_txs:type_name -> ark.v1.RoundFinalizationEvent.ForfeitTxsEntry + 11, // 4: ark.v1.GetEventStreamResponse.round_finalization:type_name -> ark.v1.RoundFinalizationEvent + 12, // 5: ark.v1.GetEventStreamResponse.round_finalized:type_name -> ark.v1.RoundFinalizedEvent + 13, // 6: ark.v1.GetEventStreamResponse.round_failed:type_name -> ark.v1.RoundFailed + 0, // 7: ark.v1.ArkService.RegisterPayment:input_type -> ark.v1.RegisterPaymentRequest + 2, // 8: ark.v1.ArkService.ClaimPayment:input_type -> ark.v1.ClaimPaymentRequest + 4, // 9: ark.v1.ArkService.FinalizePayment:input_type -> ark.v1.FinalizePaymentRequest + 6, // 10: ark.v1.ArkService.GetRound:input_type -> ark.v1.GetRoundRequest + 14, // 11: ark.v1.ArkService.GetEventStream:input_type -> ark.v1.GetEventStreamRequest + 16, // 12: ark.v1.ArkService.Ping:input_type -> ark.v1.PingRequest + 1, // 13: ark.v1.ArkService.RegisterPayment:output_type -> ark.v1.RegisterPaymentResponse + 3, // 14: ark.v1.ArkService.ClaimPayment:output_type -> ark.v1.ClaimPaymentResponse + 5, // 15: ark.v1.ArkService.FinalizePayment:output_type -> ark.v1.FinalizePaymentResponse + 7, // 16: ark.v1.ArkService.GetRound:output_type -> ark.v1.GetRoundResponse + 15, // 17: ark.v1.ArkService.GetEventStream:output_type -> ark.v1.GetEventStreamResponse + 17, // 18: ark.v1.ArkService.Ping:output_type -> ark.v1.PingResponse + 13, // [13:19] is the sub-list for method output_type + 7, // [7:13] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_ark_v1_service_proto_init() } @@ -853,30 +1261,6 @@ func file_ark_v1_service_proto_init() { } } file_ark_v1_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRoundsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ark_v1_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListRoundsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_ark_v1_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRoundRequest); i { case 0: return &v.state @@ -888,7 +1272,7 @@ func file_ark_v1_service_proto_init() { return nil } } - file_ark_v1_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_ark_v1_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetRoundResponse); i { case 0: return &v.state @@ -900,7 +1284,7 @@ func file_ark_v1_service_proto_init() { return nil } } - file_ark_v1_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + file_ark_v1_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Round); i { case 0: return &v.state @@ -912,7 +1296,19 @@ func file_ark_v1_service_proto_init() { return nil } } - file_ark_v1_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + file_ark_v1_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Input); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Output); i { case 0: return &v.state @@ -924,6 +1320,95 @@ func file_ark_v1_service_proto_init() { return nil } } + file_ark_v1_service_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoundFinalizationEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoundFinalizedEvent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RoundFailed); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEventStreamRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEventStreamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PingRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_ark_v1_service_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PingResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_ark_v1_service_proto_msgTypes[15].OneofWrappers = []interface{}{ + (*GetEventStreamResponse_RoundFinalization)(nil), + (*GetEventStreamResponse_RoundFinalized)(nil), + (*GetEventStreamResponse_RoundFailed)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -931,7 +1416,7 @@ func file_ark_v1_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_ark_v1_service_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 19, NumExtensions: 0, NumServices: 1, }, diff --git a/asp/api-spec/protobuf/gen/ark/v1/service.pb.gw.go b/asp/api-spec/protobuf/gen/ark/v1/service.pb.gw.go index c97216a..04a96e4 100644 --- a/asp/api-spec/protobuf/gen/ark/v1/service.pb.gw.go +++ b/asp/api-spec/protobuf/gen/ark/v1/service.pb.gw.go @@ -133,40 +133,6 @@ func local_request_ArkService_FinalizePayment_0(ctx context.Context, marshaler r } -func request_ArkService_ListRounds_0(ctx context.Context, marshaler runtime.Marshaler, client ArkServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListRoundsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListRounds(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_ArkService_ListRounds_0(ctx context.Context, marshaler runtime.Marshaler, server ArkServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListRoundsRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListRounds(ctx, &protoReq) - return msg, metadata, err - -} - func request_ArkService_GetRound_0(ctx context.Context, marshaler runtime.Marshaler, client ArkServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetRoundRequest var metadata runtime.ServerMetadata @@ -219,6 +185,75 @@ func local_request_ArkService_GetRound_0(ctx context.Context, marshaler runtime. } +func request_ArkService_GetEventStream_0(ctx context.Context, marshaler runtime.Marshaler, client ArkServiceClient, req *http.Request, pathParams map[string]string) (ArkService_GetEventStreamClient, runtime.ServerMetadata, error) { + var protoReq GetEventStreamRequest + var metadata runtime.ServerMetadata + + stream, err := client.GetEventStream(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +func request_ArkService_Ping_0(ctx context.Context, marshaler runtime.Marshaler, client ArkServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PingRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["payment_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "payment_id") + } + + protoReq.PaymentId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "payment_id", err) + } + + msg, err := client.Ping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_ArkService_Ping_0(ctx context.Context, marshaler runtime.Marshaler, server ArkServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PingRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["payment_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "payment_id") + } + + protoReq.PaymentId, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "payment_id", err) + } + + msg, err := server.Ping(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterArkServiceHandlerServer registers the http handlers for service ArkService to "mux". // UnaryRPC :call ArkServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -294,29 +329,6 @@ func RegisterArkServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) - mux.Handle("POST", pattern_ArkService_ListRounds_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) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ark.v1.ArkService/ListRounds", runtime.WithHTTPPathPattern("/v1/rounds")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_ArkService_ListRounds_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_ArkService_ListRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_ArkService_GetRound_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -340,6 +352,36 @@ func RegisterArkServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_ArkService_GetEventStream_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + + mux.Handle("GET", pattern_ArkService_Ping_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) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/ark.v1.ArkService/Ping", runtime.WithHTTPPathPattern("/v1/ping/{payment_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_ArkService_Ping_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ArkService_Ping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -441,26 +483,6 @@ func RegisterArkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) - mux.Handle("POST", pattern_ArkService_ListRounds_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) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ark.v1.ArkService/ListRounds", runtime.WithHTTPPathPattern("/v1/rounds")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_ArkService_ListRounds_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_ArkService_ListRounds_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_ArkService_GetRound_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -481,6 +503,46 @@ func RegisterArkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_ArkService_GetEventStream_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ark.v1.ArkService/GetEventStream", runtime.WithHTTPPathPattern("/v1/events")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ArkService_GetEventStream_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ArkService_GetEventStream_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_ArkService_Ping_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) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/ark.v1.ArkService/Ping", runtime.WithHTTPPathPattern("/v1/ping/{payment_id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_ArkService_Ping_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_ArkService_Ping_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -491,9 +553,11 @@ var ( pattern_ArkService_FinalizePayment_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "payment", "finalize"}, "")) - pattern_ArkService_ListRounds_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "rounds"}, "")) - pattern_ArkService_GetRound_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "round", "txid"}, "")) + + pattern_ArkService_GetEventStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "events"}, "")) + + pattern_ArkService_Ping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "ping", "payment_id"}, "")) ) var ( @@ -503,7 +567,9 @@ var ( forward_ArkService_FinalizePayment_0 = runtime.ForwardResponseMessage - forward_ArkService_ListRounds_0 = runtime.ForwardResponseMessage - forward_ArkService_GetRound_0 = runtime.ForwardResponseMessage + + forward_ArkService_GetEventStream_0 = runtime.ForwardResponseStream + + forward_ArkService_Ping_0 = runtime.ForwardResponseMessage ) diff --git a/asp/api-spec/protobuf/gen/ark/v1/service_grpc.pb.go b/asp/api-spec/protobuf/gen/ark/v1/service_grpc.pb.go index e894819..69d2359 100644 --- a/asp/api-spec/protobuf/gen/ark/v1/service_grpc.pb.go +++ b/asp/api-spec/protobuf/gen/ark/v1/service_grpc.pb.go @@ -21,8 +21,9 @@ 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) - ListRounds(ctx context.Context, in *ListRoundsRequest, opts ...grpc.CallOption) (*ListRoundsResponse, error) 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) } type arkServiceClient struct { @@ -60,18 +61,50 @@ func (c *arkServiceClient) FinalizePayment(ctx context.Context, in *FinalizePaym return out, nil } -func (c *arkServiceClient) ListRounds(ctx context.Context, in *ListRoundsRequest, opts ...grpc.CallOption) (*ListRoundsResponse, error) { - out := new(ListRoundsResponse) - err := c.cc.Invoke(ctx, "/ark.v1.ArkService/ListRounds", in, out, opts...) +func (c *arkServiceClient) GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error) { + out := new(GetRoundResponse) + err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetRound", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *arkServiceClient) GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error) { - out := new(GetRoundResponse) - err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetRound", in, out, opts...) +func (c *arkServiceClient) GetEventStream(ctx context.Context, in *GetEventStreamRequest, opts ...grpc.CallOption) (ArkService_GetEventStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &ArkService_ServiceDesc.Streams[0], "/ark.v1.ArkService/GetEventStream", opts...) + if err != nil { + return nil, err + } + x := &arkServiceGetEventStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ArkService_GetEventStreamClient interface { + Recv() (*GetEventStreamResponse, error) + grpc.ClientStream +} + +type arkServiceGetEventStreamClient struct { + grpc.ClientStream +} + +func (x *arkServiceGetEventStreamClient) Recv() (*GetEventStreamResponse, error) { + m := new(GetEventStreamResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *arkServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { + out := new(PingResponse) + err := c.cc.Invoke(ctx, "/ark.v1.ArkService/Ping", in, out, opts...) if err != nil { return nil, err } @@ -85,8 +118,9 @@ type ArkServiceServer interface { RegisterPayment(context.Context, *RegisterPaymentRequest) (*RegisterPaymentResponse, error) ClaimPayment(context.Context, *ClaimPaymentRequest) (*ClaimPaymentResponse, error) FinalizePayment(context.Context, *FinalizePaymentRequest) (*FinalizePaymentResponse, error) - ListRounds(context.Context, *ListRoundsRequest) (*ListRoundsResponse, error) GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error) + GetEventStream(*GetEventStreamRequest, ArkService_GetEventStreamServer) error + Ping(context.Context, *PingRequest) (*PingResponse, error) } // UnimplementedArkServiceServer should be embedded to have forward compatible implementations. @@ -102,12 +136,15 @@ func (UnimplementedArkServiceServer) ClaimPayment(context.Context, *ClaimPayment func (UnimplementedArkServiceServer) FinalizePayment(context.Context, *FinalizePaymentRequest) (*FinalizePaymentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalizePayment not implemented") } -func (UnimplementedArkServiceServer) ListRounds(context.Context, *ListRoundsRequest) (*ListRoundsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListRounds not implemented") -} func (UnimplementedArkServiceServer) GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRound not implemented") } +func (UnimplementedArkServiceServer) GetEventStream(*GetEventStreamRequest, ArkService_GetEventStreamServer) error { + return status.Errorf(codes.Unimplemented, "method GetEventStream not implemented") +} +func (UnimplementedArkServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} // UnsafeArkServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ArkServiceServer will @@ -174,24 +211,6 @@ func _ArkService_FinalizePayment_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } -func _ArkService_ListRounds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListRoundsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ArkServiceServer).ListRounds(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/ark.v1.ArkService/ListRounds", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArkServiceServer).ListRounds(ctx, req.(*ListRoundsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _ArkService_GetRound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetRoundRequest) if err := dec(in); err != nil { @@ -210,6 +229,45 @@ func _ArkService_GetRound_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _ArkService_GetEventStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetEventStreamRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ArkServiceServer).GetEventStream(m, &arkServiceGetEventStreamServer{stream}) +} + +type ArkService_GetEventStreamServer interface { + Send(*GetEventStreamResponse) error + grpc.ServerStream +} + +type arkServiceGetEventStreamServer struct { + grpc.ServerStream +} + +func (x *arkServiceGetEventStreamServer) Send(m *GetEventStreamResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _ArkService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ArkServiceServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ark.v1.ArkService/Ping", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ArkServiceServer).Ping(ctx, req.(*PingRequest)) + } + return interceptor(ctx, in, info, handler) +} + // ArkService_ServiceDesc is the grpc.ServiceDesc for ArkService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -229,15 +287,21 @@ var ArkService_ServiceDesc = grpc.ServiceDesc{ MethodName: "FinalizePayment", Handler: _ArkService_FinalizePayment_Handler, }, - { - MethodName: "ListRounds", - Handler: _ArkService_ListRounds_Handler, - }, { MethodName: "GetRound", Handler: _ArkService_GetRound_Handler, }, + { + MethodName: "Ping", + Handler: _ArkService_Ping_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "GetEventStream", + Handler: _ArkService_GetEventStream_Handler, + ServerStreams: true, + }, }, - Streams: []grpc.StreamDesc{}, Metadata: "ark/v1/service.proto", } diff --git a/asp/cmd/arkd/main.go b/asp/cmd/arkd/main.go index 904f120..cd0f5f7 100755 --- a/asp/cmd/arkd/main.go +++ b/asp/cmd/arkd/main.go @@ -4,9 +4,9 @@ import ( "os" "os/signal" "syscall" - - log "github.com/sirupsen/logrus" + service_interface "github.com/ark-network/ark/internal/interface" + log "github.com/sirupsen/logrus" ) //nolint:all @@ -16,15 +16,14 @@ var ( date = "unknown" ) -// TODO: Edit this file to something more meaningful for your application. func main() { - svc, err := service_interface.NewService() + svc, err := service_interface.NewService(service_interface.Options{}) // TODO populate options if err != nil { log.Fatal(err) } log.RegisterExitHandler(svc.Stop) - + log.Info("starting service...") if err := svc.Start(); err != nil { log.Fatal(err) @@ -37,4 +36,3 @@ func main() { log.Info("shutting down service...") log.Exit(0) } - \ No newline at end of file diff --git a/asp/go.mod b/asp/go.mod index b49052f..6c83b6f 100644 --- a/asp/go.mod +++ b/asp/go.mod @@ -17,7 +17,6 @@ require ( github.com/stretchr/testify v1.8.4 github.com/timshannon/badgerhold/v4 v4.0.3 github.com/vulpemventures/go-elements v0.4.7 - golang.org/x/crypto v0.14.0 google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 @@ -36,7 +35,9 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect go.opencensus.io v0.24.0 // indirect + golang.org/x/crypto v0.14.0 // indirect google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect ) require ( diff --git a/asp/go.sum b/asp/go.sum index bc4e464..02af465 100644 --- a/asp/go.sum +++ b/asp/go.sum @@ -656,6 +656,8 @@ google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA5 google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/asp/internal/core/application/service.go b/asp/internal/core/application/service.go index eb5ee6d..e5c3628 100644 --- a/asp/internal/core/application/service.go +++ b/asp/internal/core/application/service.go @@ -21,6 +21,15 @@ import ( const paymentsThreshold = 128 +type Service interface { + SpendVtxos(ctx context.Context, inputs []domain.VtxoKey) (string, error) + ClaimVtxos(ctx context.Context, creds string, receivers []domain.Receiver) error + SignVtxos(ctx context.Context, forfeitTxs map[string]string) error + GetRoundByTxid(ctx context.Context, poolTxid string) (*domain.Round, error) + GetEventsChannel(ctx context.Context) <-chan domain.RoundEvent + UpdatePaymenStatus(ctx context.Context, id string) error +} + type service struct { roundInterval int64 network common.Network @@ -32,20 +41,28 @@ type service struct { builder ports.TxBuilder paymentRequests *paymentsMap forfeitTxs *forfeitTxsMap + + eventsCh chan domain.RoundEvent } func NewService( interval int64, network common.Network, onchainNetwork network.Network, walletSvc ports.WalletService, schedulerSvc ports.SchedulerService, repoManager ports.RepoManager, builder ports.TxBuilder, -) *service { +) Service { paymentRequests := newPaymentsMap(nil) forfeitTxs := newForfeitTxsMap() svc := &service{ interval, network, onchainNetwork, walletSvc, schedulerSvc, repoManager, builder, paymentRequests, forfeitTxs, + make(chan domain.RoundEvent), } - repoManager.RegisterEventsHandler(svc.updateProjectionStore) + repoManager.RegisterEventsHandler( + func(round *domain.Round) { + svc.updateProjectionStore(round) + svc.propagateEvents(round) + }, + ) return svc } @@ -100,6 +117,14 @@ func (s *service) SignVtxos(ctx context.Context, forfeitTxs map[string]string) e return nil } +func (s *service) GetEventsChannel(ctx context.Context) <-chan domain.RoundEvent { + return s.eventsCh +} + +func (s *service) GetRoundByTxid(ctx context.Context, poolTxid string) (*domain.Round, error) { + return s.repoManager.Rounds().GetRoundWithTxid(ctx, poolTxid) +} + func (s *service) start() error { startImmediately := true finalizationInterval := int64(s.roundInterval / 2) @@ -264,6 +289,14 @@ func (s *service) updateProjectionStore(round *domain.Round) { } } +func (s *service) propagateEvents(round *domain.Round) { + lastEvent := round.Events()[len(round.Events())-1] + switch e := lastEvent.(type) { + case domain.RoundFinalizationStarted, domain.RoundFinalized: + s.eventsCh <- e + } +} + func getNewVtxos(net network.Network, round *domain.Round) []domain.Vtxo { treeDepth := math.Log2(float64(len(round.CongestionTree) + 1)) leaves := round.CongestionTree[int(math.Pow(2, treeDepth)-1):] diff --git a/asp/internal/interface/grpc/handlers/arkservice.go b/asp/internal/interface/grpc/handlers/arkservice.go new file mode 100644 index 0000000..e84b58a --- /dev/null +++ b/asp/internal/interface/grpc/handlers/arkservice.go @@ -0,0 +1,227 @@ +package handlers + +import ( + "context" + "sync" + + arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1" + "github.com/ark-network/ark/internal/core/application" + "github.com/ark-network/ark/internal/core/domain" + "github.com/ark-network/ark/internal/core/ports" + "github.com/google/uuid" + "github.com/vulpemventures/go-elements/psetv2" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type listener struct { + id string + ch chan *arkv1.GetEventStreamResponse +} + +type handler struct { + svc application.Service + + listenersLock *sync.Mutex + listeners []*listener +} + +func NewHandler(service application.Service, repoManager ports.RepoManager) arkv1.ArkServiceServer { + h := &handler{ + svc: service, + listenersLock: &sync.Mutex{}, + listeners: make([]*listener, 0), + } + + go h.listenToEvents() + + return h +} + +func (h *handler) Ping(ctx context.Context, req *arkv1.PingRequest) (*arkv1.PingResponse, error) { + if req.GetPaymentId() == "" { + return nil, status.Error(codes.InvalidArgument, "missing payment id") + } + + if err := h.svc.UpdatePaymenStatus(ctx, req.GetPaymentId()); err != nil { + return nil, err + } + + return &arkv1.PingResponse{}, nil +} + +func (h *handler) RegisterPayment(ctx context.Context, req *arkv1.RegisterPaymentRequest) (*arkv1.RegisterPaymentResponse, error) { + vtxosKeys := make([]domain.VtxoKey, 0, len(req.GetInputs())) + for _, input := range req.GetInputs() { + vtxosKeys = append(vtxosKeys, domain.VtxoKey{ + Txid: input.GetTxid(), + VOut: input.GetVout(), + }) + } + + id, err := h.svc.SpendVtxos(ctx, vtxosKeys) + if err != nil { + return nil, err + } + + return &arkv1.RegisterPaymentResponse{ + Id: id, + }, nil +} + +func (h *handler) ClaimPayment(ctx context.Context, req *arkv1.ClaimPaymentRequest) (*arkv1.ClaimPaymentResponse, error) { + receivers := make([]domain.Receiver, 0, len(req.GetOutputs())) + for _, output := range req.GetOutputs() { + receivers = append(receivers, domain.Receiver{ + Pubkey: output.GetPubkey(), + Amount: output.GetAmount(), + }) + } + + err := h.svc.ClaimVtxos(ctx, req.GetId(), receivers) + if err != nil { + return nil, err + } + + return &arkv1.ClaimPaymentResponse{}, nil +} + +func (h *handler) FinalizePayment(ctx context.Context, req *arkv1.FinalizePaymentRequest) (*arkv1.FinalizePaymentResponse, error) { + forfeits := make(map[string]string) + + for _, b64 := range req.GetSignedForfeits() { + pset, err := psetv2.NewPsetFromBase64(b64) + if err != nil { + return nil, err + } + + unsignedTx, err := pset.UnsignedTx() + if err != nil { + return nil, err + } + + forfeits[unsignedTx.TxHash().String()] = b64 + } + + err := h.svc.SignVtxos(ctx, forfeits) + if err != nil { + return nil, err + } + + return &arkv1.FinalizePaymentResponse{}, nil +} + +func (h *handler) GetRound(ctx context.Context, req *arkv1.GetRoundRequest) (*arkv1.GetRoundResponse, error) { + if req.GetTxid() != "" { + return nil, status.Error(codes.InvalidArgument, "missing pool txid") + } + + round, err := h.svc.GetRoundByTxid(ctx, req.GetTxid()) + if err != nil { + return nil, err + } + + return &arkv1.GetRoundResponse{ + Round: &arkv1.Round{ + Id: round.Id, + Start: round.StartingTimestamp, + End: round.EndingTimestamp, + Txid: round.Txid, + CongestionTree: round.CongestionTree, + }, + }, nil +} + +func (h *handler) GetEventStream(_ *arkv1.GetEventStreamRequest, stream arkv1.ArkService_GetEventStreamServer) error { + listener := &listener{ + id: uuid.NewString(), + ch: make(chan *arkv1.GetEventStreamResponse), + } + + defer h.removeListener(listener.id) + defer close(listener.ch) + + h.pushListener(listener) + + for { + select { + case <-stream.Context().Done(): + return nil + + case ev := <-listener.ch: + if err := stream.Send(ev); err != nil { + return err + } + + switch ev.Event.(type) { + case *arkv1.GetEventStreamResponse_RoundFinalized, *arkv1.GetEventStreamResponse_RoundFailed: + return nil + } + } + } +} + +func (h *handler) pushListener(l *listener) { + h.listenersLock.Lock() + defer h.listenersLock.Unlock() + + h.listeners = append(h.listeners, l) +} + +func (h *handler) removeListener(id string) { + h.listenersLock.Lock() + defer h.listenersLock.Unlock() + + for i, listener := range h.listeners { + if listener.id == id { + h.listeners = append(h.listeners[:i], h.listeners[i+1:]...) + return + } + } +} + +// listenToEvents forwards events from the application layer to the set of listeners +func (h *handler) listenToEvents() { + channel := h.svc.GetEventsChannel(context.Background()) + for event := range channel { + var ev *arkv1.GetEventStreamResponse + + switch e := event.(type) { + case domain.RoundFinalizationStarted: + ev = &arkv1.GetEventStreamResponse{ + Event: &arkv1.GetEventStreamResponse_RoundFinalization{ + RoundFinalization: &arkv1.RoundFinalizationEvent{ + Id: e.Id, + PoolPartialTx: e.PoolTx, + CongestionTree: e.CongestionTree, + ForfeitTxs: nil, // TODO: add forfeit txs + }, + }, + } + case domain.RoundFinalized: + ev = &arkv1.GetEventStreamResponse{ + Event: &arkv1.GetEventStreamResponse_RoundFinalized{ + RoundFinalized: &arkv1.RoundFinalizedEvent{ + Id: e.Id, + PoolTxid: e.Txid, + }, + }, + } + case domain.RoundFailed: + ev = &arkv1.GetEventStreamResponse{ + Event: &arkv1.GetEventStreamResponse_RoundFailed{ + RoundFailed: &arkv1.RoundFailed{ + Id: e.Id, + Reason: e.Err.Error(), + }, + }, + } + } + + if ev != nil { + for _, listener := range h.listeners { + listener.ch <- ev + } + } + } +} diff --git a/asp/internal/interface/grpc/service.go b/asp/internal/interface/grpc/service.go deleted file mode 100755 index 01c2293..0000000 --- a/asp/internal/interface/grpc/service.go +++ /dev/null @@ -1,22 +0,0 @@ -package grpc_interface - -import ( - log "github.com/sirupsen/logrus" -) - -// TODO: Edit this file to something more meaningful for your application. -type service struct {} - -func NewService() (*service, error) { - return &service{}, nil -} - -func (s *service) Start() error { - log.Debug("service is listening") - return nil -} - -func (s *service) Stop() { - log.Debug("service stopped") -} - \ No newline at end of file diff --git a/asp/internal/interface/service.go b/asp/internal/interface/service.go index b14123c..a2fe8ad 100755 --- a/asp/internal/interface/service.go +++ b/asp/internal/interface/service.go @@ -1,7 +1,12 @@ -package service_interface +package interfaces import ( - grpc_interface "github.com/ark-network/ark/internal/interface/grpc" + arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1" + "github.com/ark-network/ark/internal/core/application" + "github.com/ark-network/ark/internal/core/ports" + "github.com/ark-network/ark/internal/interface/grpc/handlers" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) // TODO: Edit this file to something more meaningful for your application. @@ -10,7 +15,35 @@ type Service interface { Stop() } -func NewService() (Service, error) { - return grpc_interface.NewService() +type service struct { + grpcService arkv1.ArkServiceServer + grpcServer *grpc.Server +} + +type Options struct { + applicationService application.Service + repositoryManager ports.RepoManager +} + +func NewService(opts Options) (Service, error) { + return &service{ + grpcService: handlers.NewHandler(opts.applicationService, opts.repositoryManager), + }, nil +} + +// Start implements Service. +func (s *service) Start() error { + creds := insecure.NewCredentials() + serverOpts := grpc.Creds(creds) + server := grpc.NewServer(serverOpts) + + arkv1.RegisterArkServiceServer(server, s.grpcService) + + s.grpcServer = server + return nil +} + +// Stop implements Service. +func (s *service) Stop() { + s.grpcServer.Stop() } - \ No newline at end of file