[SDK] Improve REST JSON streaming (#374)

* Fixes

* GetEventStream REST rework

* fix round phases time intervals

* [SDK] Use server-side streams in rest client

* Fix history

* Fix

* Drop data in ping response

* Polish

---------

Co-authored-by: louisinger <louis@vulpem.com>
This commit is contained in:
Pietralberto Mazza
2024-11-11 15:43:57 +01:00
committed by GitHub
parent 11b23e15c4
commit cd502f3dac
21 changed files with 427 additions and 914 deletions

View File

@@ -48,6 +48,37 @@
]
}
},
"/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/info": {
"get": {
"operationId": "ArkService_GetInfo",
@@ -134,37 +165,6 @@
]
}
},
"/v1/round/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/round/id/{id}": {
"get": {
"operationId": "ArkService_GetRoundById",
@@ -732,24 +732,7 @@
}
},
"v1PingResponse": {
"type": "object",
"properties": {
"roundFinalization": {
"$ref": "#/definitions/v1RoundFinalizationEvent"
},
"roundFinalized": {
"$ref": "#/definitions/v1RoundFinalizedEvent"
},
"roundFailed": {
"$ref": "#/definitions/v1RoundFailed"
},
"roundSigning": {
"$ref": "#/definitions/v1RoundSigningEvent"
},
"roundSigningNoncesGenerated": {
"$ref": "#/definitions/v1RoundSigningNoncesGeneratedEvent"
}
}
"type": "object"
},
"v1RedeemTransaction": {
"type": "object",

View File

@@ -51,7 +51,7 @@ service ArkService {
};
rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) {
option (google.api.http) = {
get: "/v1/round/events"
get: "/v1/events"
};
};
rpc Ping(PingRequest) returns (PingResponse) {
@@ -175,15 +175,7 @@ message GetEventStreamResponse {
message PingRequest {
string payment_id = 1;
}
message PingResponse {
oneof event {
RoundFinalizationEvent round_finalization = 1;
RoundFinalizedEvent round_finalized = 2;
RoundFailed round_failed = 3;
RoundSigningEvent round_signing = 4;
RoundSigningNoncesGeneratedEvent round_signing_nonces_generated = 5;
}
}
message PingResponse {}
/* Async Payment API messages */

View File

@@ -1034,15 +1034,6 @@ type PingResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Types that are assignable to Event:
//
// *PingResponse_RoundFinalization
// *PingResponse_RoundFinalized
// *PingResponse_RoundFailed
// *PingResponse_RoundSigning
// *PingResponse_RoundSigningNoncesGenerated
Event isPingResponse_Event `protobuf_oneof:"event"`
}
func (x *PingResponse) Reset() {
@@ -1077,82 +1068,6 @@ func (*PingResponse) Descriptor() ([]byte, []int) {
return file_ark_v1_service_proto_rawDescGZIP(), []int{17}
}
func (m *PingResponse) GetEvent() isPingResponse_Event {
if m != nil {
return m.Event
}
return nil
}
func (x *PingResponse) GetRoundFinalization() *RoundFinalizationEvent {
if x, ok := x.GetEvent().(*PingResponse_RoundFinalization); ok {
return x.RoundFinalization
}
return nil
}
func (x *PingResponse) GetRoundFinalized() *RoundFinalizedEvent {
if x, ok := x.GetEvent().(*PingResponse_RoundFinalized); ok {
return x.RoundFinalized
}
return nil
}
func (x *PingResponse) GetRoundFailed() *RoundFailed {
if x, ok := x.GetEvent().(*PingResponse_RoundFailed); ok {
return x.RoundFailed
}
return nil
}
func (x *PingResponse) GetRoundSigning() *RoundSigningEvent {
if x, ok := x.GetEvent().(*PingResponse_RoundSigning); ok {
return x.RoundSigning
}
return nil
}
func (x *PingResponse) GetRoundSigningNoncesGenerated() *RoundSigningNoncesGeneratedEvent {
if x, ok := x.GetEvent().(*PingResponse_RoundSigningNoncesGenerated); ok {
return x.RoundSigningNoncesGenerated
}
return nil
}
type isPingResponse_Event interface {
isPingResponse_Event()
}
type PingResponse_RoundFinalization struct {
RoundFinalization *RoundFinalizationEvent `protobuf:"bytes,1,opt,name=round_finalization,json=roundFinalization,proto3,oneof"`
}
type PingResponse_RoundFinalized struct {
RoundFinalized *RoundFinalizedEvent `protobuf:"bytes,2,opt,name=round_finalized,json=roundFinalized,proto3,oneof"`
}
type PingResponse_RoundFailed struct {
RoundFailed *RoundFailed `protobuf:"bytes,3,opt,name=round_failed,json=roundFailed,proto3,oneof"`
}
type PingResponse_RoundSigning struct {
RoundSigning *RoundSigningEvent `protobuf:"bytes,4,opt,name=round_signing,json=roundSigning,proto3,oneof"`
}
type PingResponse_RoundSigningNoncesGenerated struct {
RoundSigningNoncesGenerated *RoundSigningNoncesGeneratedEvent `protobuf:"bytes,5,opt,name=round_signing_nonces_generated,json=roundSigningNoncesGenerated,proto3,oneof"`
}
func (*PingResponse_RoundFinalization) isPingResponse_Event() {}
func (*PingResponse_RoundFinalized) isPingResponse_Event() {}
func (*PingResponse_RoundFailed) isPingResponse_Event() {}
func (*PingResponse_RoundSigning) isPingResponse_Event() {}
func (*PingResponse_RoundSigningNoncesGenerated) isPingResponse_Event() {}
type AsyncPaymentInput struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -2927,33 +2842,8 @@ var file_ark_v1_service_proto_rawDesc = []byte{
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, 0x9d, 0x03, 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67,
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, 0x12, 0x40, 0x0a, 0x0d, 0x72,
0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x6f, 0x75, 0x6e,
0x64, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52,
0x0c, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x6f, 0x0a,
0x1e, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x6e,
0x6f, 0x6e, 0x63, 0x65, 0x73, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18,
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x52,
0x6f, 0x75, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x6e, 0x63, 0x65,
0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48,
0x00, 0x52, 0x1b, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4e,
0x6f, 0x6e, 0x63, 0x65, 0x73, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x07,
0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x64, 0x0a, 0x11, 0x41, 0x73, 0x79, 0x6e, 0x63,
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x64, 0x0a, 0x11, 0x41, 0x73, 0x79, 0x6e, 0x63,
0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x05,
0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x61, 0x72,
0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75,
@@ -3138,7 +3028,7 @@ var file_ark_v1_service_proto_rawDesc = []byte{
0x4c, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x4f,
0x55, 0x4e, 0x44, 0x5f, 0x53, 0x54, 0x41, 0x47, 0x45, 0x5f, 0x46, 0x49, 0x4e, 0x41, 0x4c, 0x49,
0x5a, 0x45, 0x44, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x4f, 0x55, 0x4e, 0x44, 0x5f, 0x53,
0x54, 0x41, 0x47, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x32, 0xeb, 0x0d,
0x54, 0x41, 0x47, 0x45, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x32, 0xe5, 0x0d,
0x0a, 0x0a, 0x41, 0x72, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x07,
0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31,
0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
@@ -3197,69 +3087,69 @@ var file_ark_v1_service_proto_rawDesc = []byte{
0x64, 0x46, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x54, 0x78, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, 0x01, 0x2a, 0x22, 0x1a,
0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74,
0x46, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x54, 0x78, 0x73, 0x12, 0x6b, 0x0a, 0x0e, 0x47, 0x65,
0x46, 0x6f, 0x72, 0x66, 0x65, 0x69, 0x74, 0x54, 0x78, 0x73, 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, 0x18, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x73, 0x30, 0x01, 0x12, 0x56, 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, 0x23, 0x82, 0xd3, 0xe4, 0x93,
0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x70, 0x69,
0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12,
0x64, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x12, 0x1c, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61,
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61,
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x73, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74,
0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 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, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 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, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 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, 0x64, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42,
0x79, 0x49, 0x64, 0x12, 0x1b, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74,
0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1c, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75,
0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e,
0x64, 0x2f, 0x69, 0x64, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x4c, 0x69, 0x73,
0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x19, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74,
0x78, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x2f, 0x7b,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74,
0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x12, 0x24, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54,
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, 0x56, 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, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76,
0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61,
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x64, 0x0a, 0x0d, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x72, 0x6b,
0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e,
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a,
0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x73, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65,
0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 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, 0x43, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 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, 0x63, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 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, 0x64, 0x0a,
0x0c, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x2e,
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42,
0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x72, 0x6b,
0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13,
0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x69, 0x64, 0x2f, 0x7b,
0x69, 0x64, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73,
0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74,
0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x72, 0x6b,
0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f,
0x76, 0x31, 0x2f, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x24, 0x2e, 0x61,
0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x25, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54,
0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61,
0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x72, 0x61,
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x30, 0x01, 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,
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x30, 0x01, 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 (
@@ -3333,68 +3223,63 @@ var file_ark_v1_service_proto_depIdxs = []int32{
32, // 4: ark.v1.GetEventStreamResponse.round_failed:type_name -> ark.v1.RoundFailed
33, // 5: ark.v1.GetEventStreamResponse.round_signing:type_name -> ark.v1.RoundSigningEvent
34, // 6: ark.v1.GetEventStreamResponse.round_signing_nonces_generated:type_name -> ark.v1.RoundSigningNoncesGeneratedEvent
30, // 7: ark.v1.PingResponse.round_finalization:type_name -> ark.v1.RoundFinalizationEvent
31, // 8: ark.v1.PingResponse.round_finalized:type_name -> ark.v1.RoundFinalizedEvent
32, // 9: ark.v1.PingResponse.round_failed:type_name -> ark.v1.RoundFailed
33, // 10: ark.v1.PingResponse.round_signing:type_name -> ark.v1.RoundSigningEvent
34, // 11: ark.v1.PingResponse.round_signing_nonces_generated:type_name -> ark.v1.RoundSigningNoncesGeneratedEvent
37, // 12: ark.v1.AsyncPaymentInput.input:type_name -> ark.v1.Input
19, // 13: ark.v1.CreatePaymentRequest.inputs:type_name -> ark.v1.AsyncPaymentInput
38, // 14: ark.v1.CreatePaymentRequest.outputs:type_name -> ark.v1.Output
35, // 15: ark.v1.GetRoundResponse.round:type_name -> ark.v1.Round
35, // 16: ark.v1.GetRoundByIdResponse.round:type_name -> ark.v1.Round
42, // 17: ark.v1.ListVtxosResponse.spendable_vtxos:type_name -> ark.v1.Vtxo
42, // 18: ark.v1.ListVtxosResponse.spent_vtxos:type_name -> ark.v1.Vtxo
39, // 19: ark.v1.RoundFinalizationEvent.vtxo_tree:type_name -> ark.v1.Tree
39, // 20: ark.v1.RoundSigningEvent.unsigned_vtxo_tree:type_name -> ark.v1.Tree
39, // 21: ark.v1.Round.vtxo_tree:type_name -> ark.v1.Tree
0, // 22: ark.v1.Round.stage:type_name -> ark.v1.RoundStage
36, // 23: ark.v1.Input.outpoint:type_name -> ark.v1.Outpoint
40, // 24: ark.v1.Tree.levels:type_name -> ark.v1.TreeLevel
41, // 25: ark.v1.TreeLevel.nodes:type_name -> ark.v1.Node
36, // 26: ark.v1.Vtxo.outpoint:type_name -> ark.v1.Outpoint
45, // 27: ark.v1.GetTransactionsStreamResponse.round:type_name -> ark.v1.RoundTransaction
46, // 28: ark.v1.GetTransactionsStreamResponse.redeem:type_name -> ark.v1.RedeemTransaction
36, // 29: ark.v1.RoundTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
42, // 30: ark.v1.RoundTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
36, // 31: ark.v1.RoundTransaction.claimed_boarding_utxos:type_name -> ark.v1.Outpoint
36, // 32: ark.v1.RedeemTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
42, // 33: ark.v1.RedeemTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
1, // 34: ark.v1.ArkService.GetInfo:input_type -> ark.v1.GetInfoRequest
3, // 35: ark.v1.ArkService.GetBoardingAddress:input_type -> ark.v1.GetBoardingAddressRequest
5, // 36: ark.v1.ArkService.RegisterInputsForNextRound:input_type -> ark.v1.RegisterInputsForNextRoundRequest
7, // 37: ark.v1.ArkService.RegisterOutputsForNextRound:input_type -> ark.v1.RegisterOutputsForNextRoundRequest
9, // 38: ark.v1.ArkService.SubmitTreeNonces:input_type -> ark.v1.SubmitTreeNoncesRequest
11, // 39: ark.v1.ArkService.SubmitTreeSignatures:input_type -> ark.v1.SubmitTreeSignaturesRequest
13, // 40: ark.v1.ArkService.SubmitSignedForfeitTxs:input_type -> ark.v1.SubmitSignedForfeitTxsRequest
15, // 41: ark.v1.ArkService.GetEventStream:input_type -> ark.v1.GetEventStreamRequest
17, // 42: ark.v1.ArkService.Ping:input_type -> ark.v1.PingRequest
20, // 43: ark.v1.ArkService.CreatePayment:input_type -> ark.v1.CreatePaymentRequest
22, // 44: ark.v1.ArkService.CompletePayment:input_type -> ark.v1.CompletePaymentRequest
24, // 45: ark.v1.ArkService.GetRound:input_type -> ark.v1.GetRoundRequest
26, // 46: ark.v1.ArkService.GetRoundById:input_type -> ark.v1.GetRoundByIdRequest
28, // 47: ark.v1.ArkService.ListVtxos:input_type -> ark.v1.ListVtxosRequest
43, // 48: ark.v1.ArkService.GetTransactionsStream:input_type -> ark.v1.GetTransactionsStreamRequest
2, // 49: ark.v1.ArkService.GetInfo:output_type -> ark.v1.GetInfoResponse
4, // 50: ark.v1.ArkService.GetBoardingAddress:output_type -> ark.v1.GetBoardingAddressResponse
6, // 51: ark.v1.ArkService.RegisterInputsForNextRound:output_type -> ark.v1.RegisterInputsForNextRoundResponse
8, // 52: ark.v1.ArkService.RegisterOutputsForNextRound:output_type -> ark.v1.RegisterOutputsForNextRoundResponse
10, // 53: ark.v1.ArkService.SubmitTreeNonces:output_type -> ark.v1.SubmitTreeNoncesResponse
12, // 54: ark.v1.ArkService.SubmitTreeSignatures:output_type -> ark.v1.SubmitTreeSignaturesResponse
14, // 55: ark.v1.ArkService.SubmitSignedForfeitTxs:output_type -> ark.v1.SubmitSignedForfeitTxsResponse
16, // 56: ark.v1.ArkService.GetEventStream:output_type -> ark.v1.GetEventStreamResponse
18, // 57: ark.v1.ArkService.Ping:output_type -> ark.v1.PingResponse
21, // 58: ark.v1.ArkService.CreatePayment:output_type -> ark.v1.CreatePaymentResponse
23, // 59: ark.v1.ArkService.CompletePayment:output_type -> ark.v1.CompletePaymentResponse
25, // 60: ark.v1.ArkService.GetRound:output_type -> ark.v1.GetRoundResponse
27, // 61: ark.v1.ArkService.GetRoundById:output_type -> ark.v1.GetRoundByIdResponse
29, // 62: ark.v1.ArkService.ListVtxos:output_type -> ark.v1.ListVtxosResponse
44, // 63: ark.v1.ArkService.GetTransactionsStream:output_type -> ark.v1.GetTransactionsStreamResponse
49, // [49:64] is the sub-list for method output_type
34, // [34:49] is the sub-list for method input_type
34, // [34:34] is the sub-list for extension type_name
34, // [34:34] is the sub-list for extension extendee
0, // [0:34] is the sub-list for field type_name
37, // 7: ark.v1.AsyncPaymentInput.input:type_name -> ark.v1.Input
19, // 8: ark.v1.CreatePaymentRequest.inputs:type_name -> ark.v1.AsyncPaymentInput
38, // 9: ark.v1.CreatePaymentRequest.outputs:type_name -> ark.v1.Output
35, // 10: ark.v1.GetRoundResponse.round:type_name -> ark.v1.Round
35, // 11: ark.v1.GetRoundByIdResponse.round:type_name -> ark.v1.Round
42, // 12: ark.v1.ListVtxosResponse.spendable_vtxos:type_name -> ark.v1.Vtxo
42, // 13: ark.v1.ListVtxosResponse.spent_vtxos:type_name -> ark.v1.Vtxo
39, // 14: ark.v1.RoundFinalizationEvent.vtxo_tree:type_name -> ark.v1.Tree
39, // 15: ark.v1.RoundSigningEvent.unsigned_vtxo_tree:type_name -> ark.v1.Tree
39, // 16: ark.v1.Round.vtxo_tree:type_name -> ark.v1.Tree
0, // 17: ark.v1.Round.stage:type_name -> ark.v1.RoundStage
36, // 18: ark.v1.Input.outpoint:type_name -> ark.v1.Outpoint
40, // 19: ark.v1.Tree.levels:type_name -> ark.v1.TreeLevel
41, // 20: ark.v1.TreeLevel.nodes:type_name -> ark.v1.Node
36, // 21: ark.v1.Vtxo.outpoint:type_name -> ark.v1.Outpoint
45, // 22: ark.v1.GetTransactionsStreamResponse.round:type_name -> ark.v1.RoundTransaction
46, // 23: ark.v1.GetTransactionsStreamResponse.redeem:type_name -> ark.v1.RedeemTransaction
36, // 24: ark.v1.RoundTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
42, // 25: ark.v1.RoundTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
36, // 26: ark.v1.RoundTransaction.claimed_boarding_utxos:type_name -> ark.v1.Outpoint
36, // 27: ark.v1.RedeemTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
42, // 28: ark.v1.RedeemTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
1, // 29: ark.v1.ArkService.GetInfo:input_type -> ark.v1.GetInfoRequest
3, // 30: ark.v1.ArkService.GetBoardingAddress:input_type -> ark.v1.GetBoardingAddressRequest
5, // 31: ark.v1.ArkService.RegisterInputsForNextRound:input_type -> ark.v1.RegisterInputsForNextRoundRequest
7, // 32: ark.v1.ArkService.RegisterOutputsForNextRound:input_type -> ark.v1.RegisterOutputsForNextRoundRequest
9, // 33: ark.v1.ArkService.SubmitTreeNonces:input_type -> ark.v1.SubmitTreeNoncesRequest
11, // 34: ark.v1.ArkService.SubmitTreeSignatures:input_type -> ark.v1.SubmitTreeSignaturesRequest
13, // 35: ark.v1.ArkService.SubmitSignedForfeitTxs:input_type -> ark.v1.SubmitSignedForfeitTxsRequest
15, // 36: ark.v1.ArkService.GetEventStream:input_type -> ark.v1.GetEventStreamRequest
17, // 37: ark.v1.ArkService.Ping:input_type -> ark.v1.PingRequest
20, // 38: ark.v1.ArkService.CreatePayment:input_type -> ark.v1.CreatePaymentRequest
22, // 39: ark.v1.ArkService.CompletePayment:input_type -> ark.v1.CompletePaymentRequest
24, // 40: ark.v1.ArkService.GetRound:input_type -> ark.v1.GetRoundRequest
26, // 41: ark.v1.ArkService.GetRoundById:input_type -> ark.v1.GetRoundByIdRequest
28, // 42: ark.v1.ArkService.ListVtxos:input_type -> ark.v1.ListVtxosRequest
43, // 43: ark.v1.ArkService.GetTransactionsStream:input_type -> ark.v1.GetTransactionsStreamRequest
2, // 44: ark.v1.ArkService.GetInfo:output_type -> ark.v1.GetInfoResponse
4, // 45: ark.v1.ArkService.GetBoardingAddress:output_type -> ark.v1.GetBoardingAddressResponse
6, // 46: ark.v1.ArkService.RegisterInputsForNextRound:output_type -> ark.v1.RegisterInputsForNextRoundResponse
8, // 47: ark.v1.ArkService.RegisterOutputsForNextRound:output_type -> ark.v1.RegisterOutputsForNextRoundResponse
10, // 48: ark.v1.ArkService.SubmitTreeNonces:output_type -> ark.v1.SubmitTreeNoncesResponse
12, // 49: ark.v1.ArkService.SubmitTreeSignatures:output_type -> ark.v1.SubmitTreeSignaturesResponse
14, // 50: ark.v1.ArkService.SubmitSignedForfeitTxs:output_type -> ark.v1.SubmitSignedForfeitTxsResponse
16, // 51: ark.v1.ArkService.GetEventStream:output_type -> ark.v1.GetEventStreamResponse
18, // 52: ark.v1.ArkService.Ping:output_type -> ark.v1.PingResponse
21, // 53: ark.v1.ArkService.CreatePayment:output_type -> ark.v1.CreatePaymentResponse
23, // 54: ark.v1.ArkService.CompletePayment:output_type -> ark.v1.CompletePaymentResponse
25, // 55: ark.v1.ArkService.GetRound:output_type -> ark.v1.GetRoundResponse
27, // 56: ark.v1.ArkService.GetRoundById:output_type -> ark.v1.GetRoundByIdResponse
29, // 57: ark.v1.ArkService.ListVtxos:output_type -> ark.v1.ListVtxosResponse
44, // 58: ark.v1.ArkService.GetTransactionsStream:output_type -> ark.v1.GetTransactionsStreamResponse
44, // [44:59] is the sub-list for method output_type
29, // [29:44] is the sub-list for method input_type
29, // [29:29] is the sub-list for extension type_name
29, // [29:29] is the sub-list for extension extendee
0, // [0:29] is the sub-list for field type_name
}
func init() { file_ark_v1_service_proto_init() }
@@ -3965,13 +3850,6 @@ func file_ark_v1_service_proto_init() {
(*GetEventStreamResponse_RoundSigning)(nil),
(*GetEventStreamResponse_RoundSigningNoncesGenerated)(nil),
}
file_ark_v1_service_proto_msgTypes[17].OneofWrappers = []interface{}{
(*PingResponse_RoundFinalization)(nil),
(*PingResponse_RoundFinalized)(nil),
(*PingResponse_RoundFailed)(nil),
(*PingResponse_RoundSigning)(nil),
(*PingResponse_RoundSigningNoncesGenerated)(nil),
}
file_ark_v1_service_proto_msgTypes[43].OneofWrappers = []interface{}{
(*GetTransactionsStreamResponse_Round)(nil),
(*GetTransactionsStreamResponse_Redeem)(nil),

View File

@@ -1046,7 +1046,7 @@ func RegisterArkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ark.v1.ArkService/GetEventStream", runtime.WithHTTPPathPattern("/v1/round/events"))
annotatedContext, 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
@@ -1234,7 +1234,7 @@ var (
pattern_ArkService_SubmitSignedForfeitTxs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "round", "submitForfeitTxs"}, ""))
pattern_ArkService_GetEventStream_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "round", "events"}, ""))
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, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"v1", "round", "ping", "payment_id"}, ""))

View File

@@ -158,7 +158,7 @@ func (a *arkClient) initWithWallet(
Dust: info.Dust,
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
ForfeitAddress: info.ForfeitAddress,
WithTransactionFeed: args.ListenTransactionStream,
WithTransactionFeed: args.WithTransactionFeed,
}
if err := a.store.ConfigStore().AddData(ctx, storeData); err != nil {
return err
@@ -226,7 +226,7 @@ func (a *arkClient) init(
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
ExplorerURL: args.ExplorerURL,
ForfeitAddress: info.ForfeitAddress,
WithTransactionFeed: args.ListenTransactionStream,
WithTransactionFeed: args.WithTransactionFeed,
}
walletSvc, err := getWallet(a.store.ConfigStore(), &cfgData, supportedWallets)
if err != nil {
@@ -257,11 +257,11 @@ func (a *arkClient) ping(
ticker := time.NewTicker(5 * time.Second)
go func(t *time.Ticker) {
if _, err := a.client.Ping(ctx, paymentID); err != nil {
if err := a.client.Ping(ctx, paymentID); err != nil {
logrus.Warnf("failed to ping asp: %s", err)
}
for range t.C {
if _, err := a.client.Ping(ctx, paymentID); err != nil {
if err := a.client.Ping(ctx, paymentID); err != nil {
logrus.Warnf("failed to ping asp: %s", err)
}
}

View File

@@ -43,7 +43,7 @@ type ASPClient interface {
GetEventStream(
ctx context.Context, paymentID string,
) (<-chan RoundEventChannel, func(), error)
Ping(ctx context.Context, paymentID string) (RoundEvent, error)
Ping(ctx context.Context, paymentID string) error
CreatePayment(
ctx context.Context, inputs []AsyncPaymentInput, outputs []Output,
) (string, error)

View File

@@ -221,20 +221,12 @@ func (a *grpcClient) GetEventStream(
func (a *grpcClient) Ping(
ctx context.Context, paymentID string,
) (client.RoundEvent, error) {
) error {
req := &arkv1.PingRequest{
PaymentId: paymentID,
}
resp, err := a.svc.Ping(ctx, req)
if err != nil {
return nil, err
}
if resp.GetEvent() == nil {
return nil, nil
}
return event{resp}.toRoundEvent()
_, err := a.svc.Ping(ctx, req)
return err
}
func (a *grpcClient) CreatePayment(

View File

@@ -1,10 +1,14 @@
package restclient
import (
"bufio"
"bytes"
"context"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
@@ -22,19 +26,21 @@ import (
httptransport "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
log "github.com/sirupsen/logrus"
)
type restClient struct {
serverURL string
svc ark_service.ClientService
requestTimeout time.Duration
treeCache *utils.Cache[tree.CongestionTree]
}
func NewClient(aspUrl string) (client.ASPClient, error) {
if len(aspUrl) <= 0 {
func NewClient(serverURL string) (client.ASPClient, error) {
if len(serverURL) <= 0 {
return nil, fmt.Errorf("missing asp url")
}
svc, err := newRestClient(aspUrl)
svc, err := newRestClient(serverURL)
if err != nil {
return nil, err
}
@@ -42,7 +48,7 @@ func NewClient(aspUrl string) (client.ASPClient, error) {
reqTimeout := 15 * time.Second
treeCache := utils.NewCache[tree.CongestionTree]()
return &restClient{svc, reqTimeout, treeCache}, nil
return &restClient{serverURL, svc, reqTimeout, treeCache}, nil
}
func (a *restClient) GetInfo(
@@ -220,119 +226,151 @@ func (a *restClient) SubmitSignedForfeitTxs(
return err
}
func (a *restClient) GetEventStream(
func (c *restClient) GetEventStream(
ctx context.Context, paymentID string,
) (<-chan client.RoundEventChannel, func(), error) {
ctx, cancel := context.WithTimeout(ctx, a.requestTimeout)
eventsCh := make(chan client.RoundEventChannel)
go func(payID string, eventsCh chan client.RoundEventChannel) {
ticker := time.NewTicker(1 * time.Second)
defer close(eventsCh)
defer ticker.Stop()
go func(eventsCh chan client.RoundEventChannel) {
httpClient := &http.Client{Timeout: time.Second * 0}
resp, err := httpClient.Get(fmt.Sprintf("%s/v1/events", c.serverURL))
if err != nil {
eventsCh <- client.RoundEventChannel{
Err: fmt.Errorf("failed to fetch round event stream: %s", err),
}
return
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
eventsCh <- client.RoundEventChannel{
Err: fmt.Errorf("received unexpected status %d code when fetching round event stream", resp.StatusCode),
}
return
}
reader := bufio.NewReader(resp.Body)
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
event, err := a.Ping(ctx, payID)
chunk, err := reader.ReadBytes('\n')
if err != nil {
// Stream ended
if err == io.EOF {
return
}
log.WithError(err).Warn("failed to read from round event stream")
return
}
chunk = bytes.Trim(chunk, "\n")
resp := ark_service.ArkServiceGetEventStreamOKBody{}
if err := json.Unmarshal(chunk, &resp); err != nil {
eventsCh <- client.RoundEventChannel{
Err: err,
Err: fmt.Errorf("failed to parse message from round event stream: %s", err),
}
return
}
if event != nil {
emptyResp := ark_service.ArkServiceGetEventStreamOKBody{}
if resp == emptyResp {
continue
}
if resp.Error != nil {
eventsCh <- client.RoundEventChannel{
Event: event,
Err: fmt.Errorf("received error %d: %s", resp.Error.Code, resp.Error.Message),
}
}
}
}
}(paymentID, eventsCh)
return eventsCh, cancel, nil
continue
}
func (a *restClient) Ping(
ctx context.Context, paymentID string,
) (client.RoundEvent, error) {
r := ark_service.NewArkServicePingParams()
r.SetPaymentID(paymentID)
resp, err := a.svc.ArkServicePing(r)
if err != nil {
return nil, err
}
payload := resp.Payload
if e := payload.RoundFailed; e != nil {
return client.RoundFailedEvent{
// Handle different event types
var event client.RoundEvent
var _err error
switch {
case resp.Result.RoundFailed != nil:
e := resp.Result.RoundFailed
event = client.RoundFailedEvent{
ID: e.ID,
Reason: e.Reason,
}, nil
}
if e := payload.RoundFinalization; e != nil {
case resp.Result.RoundFinalization != nil:
e := resp.Result.RoundFinalization
tree := treeFromProto{e.VtxoTree}.parse()
minRelayFeeRate, err := strconv.Atoi(e.MinRelayFeeRate)
if err != nil {
return nil, err
_err = err
break
}
return client.RoundFinalizationEvent{
event = client.RoundFinalizationEvent{
ID: e.ID,
Tx: e.RoundTx,
Tree: tree,
Connectors: e.Connectors,
MinRelayFeeRate: chainfee.SatPerKVByte(minRelayFeeRate),
}, nil
}
if e := payload.RoundFinalized; e != nil {
return client.RoundFinalizedEvent{
case resp.Result.RoundFinalized != nil:
e := resp.Result.RoundFinalized
event = client.RoundFinalizedEvent{
ID: e.ID,
Txid: e.RoundTxid,
}, nil
}
if e := payload.RoundSigning; e != nil {
case resp.Result.RoundSigning != nil:
e := resp.Result.RoundSigning
pubkeys := make([]*secp256k1.PublicKey, 0, len(e.CosignersPubkeys))
for _, pubkey := range e.CosignersPubkeys {
p, err := hex.DecodeString(pubkey)
if err != nil {
return nil, err
_err = err
break
}
pk, err := secp256k1.ParsePubKey(p)
if err != nil {
return nil, err
_err = err
break
}
pubkeys = append(pubkeys, pk)
}
return client.RoundSigningStartedEvent{
event = client.RoundSigningStartedEvent{
ID: e.ID,
UnsignedTree: treeFromProto{e.UnsignedVtxoTree}.parse(),
CosignersPublicKeys: pubkeys,
UnsignedRoundTx: e.UnsignedRoundTx,
}, nil
}
if e := payload.RoundSigningNoncesGenerated; e != nil {
case resp.Result.RoundSigningNoncesGenerated != nil:
e := resp.Result.RoundSigningNoncesGenerated
reader := hex.NewDecoder(strings.NewReader(e.TreeNonces))
nonces, err := bitcointree.DecodeNonces(reader)
if err != nil {
return nil, err
_err = err
break
}
return client.RoundSigningNoncesGeneratedEvent{
event = client.RoundSigningNoncesGeneratedEvent{
ID: e.ID,
Nonces: nonces,
}, nil
}
}
return nil, nil
eventsCh <- client.RoundEventChannel{
Event: event,
Err: _err,
}
}
}(eventsCh)
return eventsCh, func() {}, nil
}
func (a *restClient) Ping(
ctx context.Context, paymentID string,
) error {
r := ark_service.NewArkServicePingParams()
r.SetPaymentID(paymentID)
_, err := a.svc.ArkServicePing(r)
return err
}
func (a *restClient) CreatePayment(
@@ -559,27 +597,62 @@ func (t treeFromProto) parse() tree.CongestionTree {
}
func (c *restClient) GetTransactionsStream(ctx context.Context) (<-chan client.TransactionEvent, func(), error) {
ctx, cancel := context.WithTimeout(ctx, c.requestTimeout)
eventsCh := make(chan client.TransactionEvent)
go func() {
ticker := time.NewTicker(1 * time.Second)
defer close(eventsCh)
defer ticker.Stop()
go func(eventsCh chan client.TransactionEvent) {
httpClient := &http.Client{Timeout: time.Second * 0}
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
resp, err := c.svc.ArkServiceGetTransactionsStream(ark_service.NewArkServiceGetTransactionsStreamParams())
resp, err := httpClient.Get(fmt.Sprintf("%s/v1/transactions", c.serverURL))
if err != nil {
eventsCh <- client.TransactionEvent{Err: err}
return
}
defer resp.Body.Close()
if resp.Payload.Result.Round != nil {
if resp.StatusCode != http.StatusOK {
eventsCh <- client.TransactionEvent{
Err: fmt.Errorf("unexpected status code: %d", resp.StatusCode),
}
return
}
reader := bufio.NewReader(resp.Body)
for {
chunk, err := reader.ReadBytes('\n')
if err != nil {
// Stream ended
if err == io.EOF {
return
}
eventsCh <- client.TransactionEvent{
Err: fmt.Errorf("failed to read from transaction stream: %s", err),
}
return
}
chunk = bytes.Trim(chunk, "\n")
resp := ark_service.ArkServiceGetTransactionsStreamOK{}
if err := json.Unmarshal(chunk, &resp); err != nil {
eventsCh <- client.TransactionEvent{
Err: fmt.Errorf("failed to parse message from transaction stream: %s", err),
}
return
}
if resp.Payload == nil {
continue
}
if resp.Payload.Error != nil {
eventsCh <- client.TransactionEvent{
Err: fmt.Errorf("received error from transaction stream: %s", resp.Payload.Error.Message),
}
continue
}
var event client.TransactionEvent
if resp.Payload.Result.Round != nil {
event = client.TransactionEvent{
Round: &client.RoundTransaction{
Txid: resp.Payload.Result.Round.Txid,
SpentVtxos: outpointsFromRest(resp.Payload.Result.Round.SpentVtxos),
@@ -588,7 +661,7 @@ func (c *restClient) GetTransactionsStream(ctx context.Context) (<-chan client.T
},
}
} else if resp.Payload.Result.Redeem != nil {
eventsCh <- client.TransactionEvent{
event = client.TransactionEvent{
Redeem: &client.RedeemTransaction{
Txid: resp.Payload.Result.Redeem.Txid,
SpentVtxos: outpointsFromRest(resp.Payload.Result.Redeem.SpentVtxos),
@@ -596,11 +669,12 @@ func (c *restClient) GetTransactionsStream(ctx context.Context) (<-chan client.T
},
}
}
}
}
}()
return eventsCh, cancel, nil
eventsCh <- event
}
}(eventsCh)
return eventsCh, func() {}, nil
}
func outpointsFromRest(restOutpoints []*models.V1Outpoint) []client.Outpoint {

View File

@@ -209,7 +209,7 @@ func (a *Client) ArkServiceGetEventStream(params *ArkServiceGetEventStreamParams
op := &runtime.ClientOperation{
ID: "ArkService_GetEventStream",
Method: "GET",
PathPattern: "/v1/round/events",
PathPattern: "/v1/events",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},

View File

@@ -91,12 +91,12 @@ func (o *ArkServiceGetEventStreamOK) Code() int {
func (o *ArkServiceGetEventStreamOK) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /v1/round/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
return fmt.Sprintf("[GET /v1/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
}
func (o *ArkServiceGetEventStreamOK) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /v1/round/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
return fmt.Sprintf("[GET /v1/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
}
func (o *ArkServiceGetEventStreamOK) GetPayload() *ArkServiceGetEventStreamOKBody {
@@ -165,12 +165,12 @@ func (o *ArkServiceGetEventStreamDefault) Code() int {
func (o *ArkServiceGetEventStreamDefault) Error() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /v1/round/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
return fmt.Sprintf("[GET /v1/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
}
func (o *ArkServiceGetEventStreamDefault) String() string {
payload, _ := json.Marshal(o.Payload)
return fmt.Sprintf("[GET /v1/round/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
return fmt.Sprintf("[GET /v1/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
}
func (o *ArkServiceGetEventStreamDefault) GetPayload() *models.RPCStatus {

View File

@@ -53,7 +53,7 @@ ArkServicePingOK describes a response with status code 200, with default header
A successful response.
*/
type ArkServicePingOK struct {
Payload *models.V1PingResponse
Payload models.V1PingResponse
}
// IsSuccess returns true when this ark service ping o k response has a 2xx status code
@@ -96,16 +96,14 @@ func (o *ArkServicePingOK) String() string {
return fmt.Sprintf("[GET /v1/round/ping/{paymentId}][%d] arkServicePingOK %s", 200, payload)
}
func (o *ArkServicePingOK) GetPayload() *models.V1PingResponse {
func (o *ArkServicePingOK) GetPayload() models.V1PingResponse {
return o.Payload
}
func (o *ArkServicePingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
o.Payload = new(models.V1PingResponse)
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
return err
}

View File

@@ -5,309 +5,7 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// V1PingResponse v1 ping response
//
// swagger:model v1PingResponse
type V1PingResponse struct {
// round failed
RoundFailed *V1RoundFailed `json:"roundFailed,omitempty"`
// round finalization
RoundFinalization *V1RoundFinalizationEvent `json:"roundFinalization,omitempty"`
// round finalized
RoundFinalized *V1RoundFinalizedEvent `json:"roundFinalized,omitempty"`
// round signing
RoundSigning *V1RoundSigningEvent `json:"roundSigning,omitempty"`
// round signing nonces generated
RoundSigningNoncesGenerated *V1RoundSigningNoncesGeneratedEvent `json:"roundSigningNoncesGenerated,omitempty"`
}
// Validate validates this v1 ping response
func (m *V1PingResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateRoundFailed(formats); err != nil {
res = append(res, err)
}
if err := m.validateRoundFinalization(formats); err != nil {
res = append(res, err)
}
if err := m.validateRoundFinalized(formats); err != nil {
res = append(res, err)
}
if err := m.validateRoundSigning(formats); err != nil {
res = append(res, err)
}
if err := m.validateRoundSigningNoncesGenerated(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V1PingResponse) validateRoundFailed(formats strfmt.Registry) error {
if swag.IsZero(m.RoundFailed) { // not required
return nil
}
if m.RoundFailed != nil {
if err := m.RoundFailed.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundFailed")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundFailed")
}
return err
}
}
return nil
}
func (m *V1PingResponse) validateRoundFinalization(formats strfmt.Registry) error {
if swag.IsZero(m.RoundFinalization) { // not required
return nil
}
if m.RoundFinalization != nil {
if err := m.RoundFinalization.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundFinalization")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundFinalization")
}
return err
}
}
return nil
}
func (m *V1PingResponse) validateRoundFinalized(formats strfmt.Registry) error {
if swag.IsZero(m.RoundFinalized) { // not required
return nil
}
if m.RoundFinalized != nil {
if err := m.RoundFinalized.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundFinalized")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundFinalized")
}
return err
}
}
return nil
}
func (m *V1PingResponse) validateRoundSigning(formats strfmt.Registry) error {
if swag.IsZero(m.RoundSigning) { // not required
return nil
}
if m.RoundSigning != nil {
if err := m.RoundSigning.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundSigning")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundSigning")
}
return err
}
}
return nil
}
func (m *V1PingResponse) validateRoundSigningNoncesGenerated(formats strfmt.Registry) error {
if swag.IsZero(m.RoundSigningNoncesGenerated) { // not required
return nil
}
if m.RoundSigningNoncesGenerated != nil {
if err := m.RoundSigningNoncesGenerated.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundSigningNoncesGenerated")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundSigningNoncesGenerated")
}
return err
}
}
return nil
}
// ContextValidate validate this v1 ping response based on the context it is used
func (m *V1PingResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateRoundFailed(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRoundFinalization(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRoundFinalized(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRoundSigning(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateRoundSigningNoncesGenerated(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *V1PingResponse) contextValidateRoundFailed(ctx context.Context, formats strfmt.Registry) error {
if m.RoundFailed != nil {
if swag.IsZero(m.RoundFailed) { // not required
return nil
}
if err := m.RoundFailed.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundFailed")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundFailed")
}
return err
}
}
return nil
}
func (m *V1PingResponse) contextValidateRoundFinalization(ctx context.Context, formats strfmt.Registry) error {
if m.RoundFinalization != nil {
if swag.IsZero(m.RoundFinalization) { // not required
return nil
}
if err := m.RoundFinalization.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundFinalization")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundFinalization")
}
return err
}
}
return nil
}
func (m *V1PingResponse) contextValidateRoundFinalized(ctx context.Context, formats strfmt.Registry) error {
if m.RoundFinalized != nil {
if swag.IsZero(m.RoundFinalized) { // not required
return nil
}
if err := m.RoundFinalized.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundFinalized")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundFinalized")
}
return err
}
}
return nil
}
func (m *V1PingResponse) contextValidateRoundSigning(ctx context.Context, formats strfmt.Registry) error {
if m.RoundSigning != nil {
if swag.IsZero(m.RoundSigning) { // not required
return nil
}
if err := m.RoundSigning.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundSigning")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundSigning")
}
return err
}
}
return nil
}
func (m *V1PingResponse) contextValidateRoundSigningNoncesGenerated(ctx context.Context, formats strfmt.Registry) error {
if m.RoundSigningNoncesGenerated != nil {
if swag.IsZero(m.RoundSigningNoncesGenerated) { // not required
return nil
}
if err := m.RoundSigningNoncesGenerated.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("roundSigningNoncesGenerated")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("roundSigningNoncesGenerated")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *V1PingResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *V1PingResponse) UnmarshalBinary(b []byte) error {
var res V1PingResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}
type V1PingResponse interface{}

View File

@@ -27,7 +27,7 @@ func TestVtxosToTxs(t *testing.T) {
for _, tt := range fixtures {
t.Run(tt.name, func(t *testing.T) {
txHistory, err := vtxosToTxsCovenantless(tt.spendableVtxos, tt.spentVtxos)
txHistory, err := vtxosToTxsCovenantless(tt.spendableVtxos, tt.spentVtxos, tt.ignoreTxs)
require.NoError(t, err)
require.Len(t, txHistory, len(tt.expectedTxHistory))

View File

@@ -184,7 +184,7 @@ func (a *covenantArkClient) Init(ctx context.Context, args InitArgs) error {
return err
}
if args.ListenTransactionStream {
if args.WithTransactionFeed {
txStreamCtx, txStreamCtxCancel := context.WithCancel(context.Background())
a.txStreamCtxCancel = txStreamCtxCancel
go a.listenForTxStream(txStreamCtx)

View File

@@ -183,7 +183,7 @@ func (a *covenantlessArkClient) Init(ctx context.Context, args InitArgs) error {
return err
}
if args.ListenTransactionStream {
if args.WithTransactionFeed {
txStreamCtx, txStreamCtxCancel := context.WithCancel(context.Background())
a.txStreamCtxCancel = txStreamCtxCancel
go a.listenForTransactions(txStreamCtx)
@@ -1063,12 +1063,12 @@ func (a *covenantlessArkClient) GetTransactionHistory(
return nil, err
}
boardingTxs, _, err := a.getBoardingTxs(ctx)
boardingTxs, roundsToIgnore, err := a.getBoardingTxs(ctx)
if err != nil {
return nil, err
}
offchainTxs, err := vtxosToTxsCovenantless(spendableVtxos, spentVtxos)
offchainTxs, err := vtxosToTxsCovenantless(spendableVtxos, spentVtxos, roundsToIgnore)
if err != nil {
return nil, err
}
@@ -1526,20 +1526,6 @@ func (a *covenantlessArkClient) handleRoundStream(
if notify.Err != nil {
return "", notify.Err
}
if notify.Event == nil {
if step != roundFinalization {
continue
}
res, err := a.client.Ping(ctx, paymentID)
if err != nil {
return "", err
}
if e, ok := res.(client.RoundFinalizedEvent); ok {
log.Infof("round completed %s", e.Txid)
return e.Txid, nil
}
time.Sleep(time.Second)
}
switch event := notify.Event; event.(type) {
case client.RoundFinalizedEvent:
if step != roundFinalization {
@@ -2397,7 +2383,7 @@ func findVtxosBySpentBy(allVtxos []client.Vtxo, txid string) (vtxos []client.Vtx
}
func vtxosToTxsCovenantless(
spendable, spent []client.Vtxo,
spendable, spent []client.Vtxo, ignoreVtxosByRound map[string]struct{},
) ([]types.Transaction, error) {
txs := make([]types.Transaction, 0)
vtxosByRound := make(map[string][]client.Vtxo)
@@ -2406,6 +2392,10 @@ func vtxosToTxsCovenantless(
vtxosByRound[v.RoundTxid] = make([]client.Vtxo, 0)
}
vtxosByRound[v.RoundTxid] = append(vtxosByRound[v.RoundTxid], v)
if len(v.SpentBy) > 0 {
ignoreVtxosByRound[v.SpentBy] = struct{}{}
}
}
for round := range vtxosByRound {
@@ -2425,6 +2415,15 @@ func vtxosToTxsCovenantless(
Type: types.TxReceived,
CreatedAt: v.CreatedAt,
})
} else if _, ok := ignoreVtxosByRound[v.RoundTxid]; !ok {
txs = append(txs, types.Transaction{
TransactionKey: types.TransactionKey{
RoundTxid: v.RoundTxid,
},
Amount: v.Amount,
Type: types.TxReceived,
CreatedAt: v.CreatedAt,
})
}
if len(vtxos) > 1 {
for _, v := range vtxos[1:] {

View File

@@ -190,7 +190,7 @@ func setupArkClient(wallet string) (arksdk.ArkClient, error) {
ClientType: clientType,
AspUrl: aspUrl,
Password: password,
ListenTransactionStream: true,
WithTransactionFeed: true,
}); err != nil {
return nil, fmt.Errorf("failed to initialize wallet: %s", err)
}

View File

@@ -27,7 +27,7 @@ type InitArgs struct {
Seed string
Password string
ExplorerURL string
ListenTransactionStream bool
WithTransactionFeed bool
}
func (a InitArgs) validate() error {
@@ -67,7 +67,7 @@ type InitWithWalletArgs struct {
Seed string
Password string
ExplorerURL string
ListenTransactionStream bool
WithTransactionFeed bool
}
func (a InitWithWalletArgs) validate() error {

View File

@@ -309,17 +309,8 @@ func (s *covenantService) ClaimVtxos(ctx context.Context, creds string, receiver
return s.paymentRequests.update(*payment)
}
func (s *covenantService) UpdatePaymentStatus(_ context.Context, id string) (domain.RoundEvent, error) {
err := s.paymentRequests.updatePingTimestamp(id)
if err != nil {
if _, ok := err.(errPaymentNotFound); ok {
return s.lastEvent, nil
}
return nil, err
}
return s.lastEvent, nil
func (s *covenantService) UpdatePaymentStatus(_ context.Context, id string) error {
return s.paymentRequests.updatePingTimestamp(id)
}
func (s *covenantService) CompleteAsyncPayment(ctx context.Context, redeemTx string) error {

View File

@@ -543,17 +543,8 @@ func (s *covenantlessService) ClaimVtxos(ctx context.Context, creds string, rece
return s.paymentRequests.update(*payment)
}
func (s *covenantlessService) UpdatePaymentStatus(_ context.Context, id string) (domain.RoundEvent, error) {
err := s.paymentRequests.updatePingTimestamp(id)
if err != nil {
if _, ok := err.(errPaymentNotFound); ok {
return s.lastEvent, nil
}
return nil, err
}
return s.lastEvent, nil
func (s *covenantlessService) UpdatePaymentStatus(_ context.Context, id string) error {
return s.paymentRequests.updatePingTimestamp(id)
}
func (s *covenantlessService) SignVtxos(ctx context.Context, forfeitTxs []string) error {
@@ -738,7 +729,7 @@ func (s *covenantlessService) startFinalization() {
ctx := context.Background()
round := s.currentRound
roundRemainingDuration := time.Duration(s.roundInterval/3-1) * time.Second
roundRemainingDuration := time.Duration((s.roundInterval/3)*2-1) * time.Second
thirdOfRemainingDuration := time.Duration(roundRemainingDuration / 3)
var roundAborted bool

View File

@@ -29,9 +29,7 @@ type Service interface {
GetRoundById(ctx context.Context, id string) (*domain.Round, error)
GetCurrentRound(ctx context.Context) (*domain.Round, error)
GetEventsChannel(ctx context.Context) <-chan domain.RoundEvent
UpdatePaymentStatus(
ctx context.Context, paymentId string,
) (lastEvent domain.RoundEvent, err error)
UpdatePaymentStatus(ctx context.Context, paymentId string) error
ListVtxos(
ctx context.Context, address string,
) (spendableVtxos, spentVtxos []domain.Vtxo, err error)

View File

@@ -227,25 +227,19 @@ func (h *handler) SubmitSignedForfeitTxs(
func (h *handler) GetEventStream(
_ *arkv1.GetEventStreamRequest, stream arkv1.ArkService_GetEventStreamServer,
) error {
doneCh := make(chan struct{})
listener := &listener[*arkv1.GetEventStreamResponse]{
id: uuid.NewString(),
done: doneCh,
ch: make(chan *arkv1.GetEventStreamResponse),
}
h.eventsListenerHandler.pushListener(listener)
defer h.eventsListenerHandler.removeListener(listener.id)
defer close(listener.ch)
defer close(doneCh)
for {
select {
case <-stream.Context().Done():
return nil
case <-doneCh:
return nil
case ev := <-listener.ch:
if err := stream.Send(ev); err != nil {
return err
@@ -261,78 +255,11 @@ func (h *handler) Ping(
return nil, status.Error(codes.InvalidArgument, "missing payment id")
}
lastEvent, err := h.svc.UpdatePaymentStatus(ctx, req.GetPaymentId())
if err != nil {
if err := h.svc.UpdatePaymentStatus(ctx, req.GetPaymentId()); err != nil {
return nil, err
}
var resp *arkv1.PingResponse
switch e := lastEvent.(type) {
case domain.RoundFinalizationStarted:
resp = &arkv1.PingResponse{
Event: &arkv1.PingResponse_RoundFinalization{
RoundFinalization: &arkv1.RoundFinalizationEvent{
Id: e.Id,
RoundTx: e.RoundTx,
VtxoTree: congestionTree(e.CongestionTree).toProto(),
Connectors: e.Connectors,
MinRelayFeeRate: e.MinRelayFeeRate,
},
},
}
case domain.RoundFinalized:
resp = &arkv1.PingResponse{
Event: &arkv1.PingResponse_RoundFinalized{
RoundFinalized: &arkv1.RoundFinalizedEvent{
Id: e.Id,
RoundTxid: e.Txid,
},
},
}
case domain.RoundFailed:
resp = &arkv1.PingResponse{
Event: &arkv1.PingResponse_RoundFailed{
RoundFailed: &arkv1.RoundFailed{
Id: e.Id,
Reason: e.Err,
},
},
}
case application.RoundSigningStarted:
cosignersKeys := make([]string, 0, len(e.Cosigners))
for _, key := range e.Cosigners {
cosignersKeys = append(cosignersKeys, hex.EncodeToString(key.SerializeCompressed()))
}
resp = &arkv1.PingResponse{
Event: &arkv1.PingResponse_RoundSigning{
RoundSigning: &arkv1.RoundSigningEvent{
Id: e.Id,
CosignersPubkeys: cosignersKeys,
UnsignedVtxoTree: congestionTree(e.UnsignedVtxoTree).toProto(),
UnsignedRoundTx: e.UnsignedRoundTx,
},
},
}
case application.RoundSigningNoncesGenerated:
serialized, err := e.SerializeNonces()
if err != nil {
logrus.WithError(err).Error("failed to serialize nonces")
return nil, status.Error(codes.Internal, "failed to serialize nonces")
}
resp = &arkv1.PingResponse{
Event: &arkv1.PingResponse_RoundSigningNoncesGenerated{
RoundSigningNoncesGenerated: &arkv1.RoundSigningNoncesGeneratedEvent{
Id: e.Id,
TreeNonces: serialized,
},
},
}
}
return resp, nil
return &arkv1.PingResponse{}, nil
}
func (h *handler) CreatePayment(
@@ -484,7 +411,6 @@ func (h *handler) GetTransactionsStream(
) error {
listener := &listener[*arkv1.GetTransactionsStreamResponse]{
id: uuid.NewString(),
done: make(chan struct{}),
ch: make(chan *arkv1.GetTransactionsStreamResponse),
}
@@ -512,7 +438,6 @@ func (h *handler) listenToEvents() {
channel := h.svc.GetEventsChannel(context.Background())
for event := range channel {
var ev *arkv1.GetEventStreamResponse
shouldClose := false
switch e := event.(type) {
case domain.RoundFinalizationStarted:
@@ -528,7 +453,6 @@ func (h *handler) listenToEvents() {
},
}
case domain.RoundFinalized:
shouldClose = true
ev = &arkv1.GetEventStreamResponse{
Event: &arkv1.GetEventStreamResponse_RoundFinalized{
RoundFinalized: &arkv1.RoundFinalizedEvent{
@@ -538,7 +462,6 @@ func (h *handler) listenToEvents() {
},
}
case domain.RoundFailed:
shouldClose = true
ev = &arkv1.GetEventStreamResponse{
Event: &arkv1.GetEventStreamResponse_RoundFailed{
RoundFailed: &arkv1.RoundFailed{
@@ -586,9 +509,6 @@ func (h *handler) listenToEvents() {
for _, l := range h.eventsListenerHandler.listeners {
go func(l *listener[*arkv1.GetEventStreamResponse]) {
l.ch <- ev
if shouldClose {
l.done <- struct{}{}
}
}(l)
}
}
@@ -645,7 +565,6 @@ func convertAsyncPaymentEvent(e application.RedeemTransactionEvent) *arkv1.Redee
type listener[T any] struct {
id string
done chan struct{}
ch chan T
}