mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 20:54:20 +01:00
[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:
committed by
GitHub
parent
11b23e15c4
commit
cd502f3dac
@@ -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": {
|
"/v1/info": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "ArkService_GetInfo",
|
"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}": {
|
"/v1/round/id/{id}": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "ArkService_GetRoundById",
|
"operationId": "ArkService_GetRoundById",
|
||||||
@@ -732,24 +732,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"v1PingResponse": {
|
"v1PingResponse": {
|
||||||
"type": "object",
|
"type": "object"
|
||||||
"properties": {
|
|
||||||
"roundFinalization": {
|
|
||||||
"$ref": "#/definitions/v1RoundFinalizationEvent"
|
|
||||||
},
|
|
||||||
"roundFinalized": {
|
|
||||||
"$ref": "#/definitions/v1RoundFinalizedEvent"
|
|
||||||
},
|
|
||||||
"roundFailed": {
|
|
||||||
"$ref": "#/definitions/v1RoundFailed"
|
|
||||||
},
|
|
||||||
"roundSigning": {
|
|
||||||
"$ref": "#/definitions/v1RoundSigningEvent"
|
|
||||||
},
|
|
||||||
"roundSigningNoncesGenerated": {
|
|
||||||
"$ref": "#/definitions/v1RoundSigningNoncesGeneratedEvent"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"v1RedeemTransaction": {
|
"v1RedeemTransaction": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ service ArkService {
|
|||||||
};
|
};
|
||||||
rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) {
|
rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) {
|
||||||
option (google.api.http) = {
|
option (google.api.http) = {
|
||||||
get: "/v1/round/events"
|
get: "/v1/events"
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
rpc Ping(PingRequest) returns (PingResponse) {
|
rpc Ping(PingRequest) returns (PingResponse) {
|
||||||
@@ -175,15 +175,7 @@ message GetEventStreamResponse {
|
|||||||
message PingRequest {
|
message PingRequest {
|
||||||
string payment_id = 1;
|
string payment_id = 1;
|
||||||
}
|
}
|
||||||
message PingResponse {
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Async Payment API messages */
|
/* Async Payment API messages */
|
||||||
|
|
||||||
|
|||||||
@@ -1034,15 +1034,6 @@ type PingResponse struct {
|
|||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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() {
|
func (x *PingResponse) Reset() {
|
||||||
@@ -1077,82 +1068,6 @@ func (*PingResponse) Descriptor() ([]byte, []int) {
|
|||||||
return file_ark_v1_service_proto_rawDescGZIP(), []int{17}
|
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 {
|
type AsyncPaymentInput struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
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,
|
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,
|
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,
|
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,
|
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x0e, 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52,
|
||||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x12, 0x72, 0x6f, 0x75, 0x6e,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x64, 0x0a, 0x11, 0x41, 0x73, 0x79, 0x6e, 0x63,
|
||||||
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,
|
|
||||||
0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x05,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
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, 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,
|
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,
|
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,
|
0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4,
|
||||||
0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x65,
|
0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x30,
|
||||||
0x76, 0x65, 0x6e, 0x74, 0x73, 0x30, 0x01, 0x12, 0x56, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12,
|
0x01, 0x12, 0x56, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x13, 0x2e, 0x61, 0x72, 0x6b, 0x2e,
|
||||||
0x13, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
|
0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69,
|
0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70,
|
||||||
0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93,
|
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76,
|
||||||
0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x70, 0x69,
|
0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x70, 0x69, 0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61,
|
||||||
0x6e, 0x67, 0x2f, 0x7b, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12,
|
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x64, 0x0a, 0x0d, 0x43, 0x72, 0x65,
|
||||||
0x64, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74,
|
0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x2e, 0x61, 0x72, 0x6b,
|
||||||
0x12, 0x1c, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e,
|
||||||
0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d,
|
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
|
||||||
0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61,
|
0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52,
|
||||||
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a,
|
||||||
0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61,
|
0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12,
|
||||||
0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x73, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74,
|
0x73, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65,
|
||||||
0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
|
0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70,
|
||||||
0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e,
|
0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76,
|
0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70,
|
||||||
0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e,
|
0x6c, 0x65, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14,
|
||||||
0x19, 0x3a, 0x01, 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e,
|
0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70,
|
||||||
0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65,
|
0x6c, 0x65, 0x74, 0x65, 0x12, 0x57, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64,
|
||||||
0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x17, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
|
0x12, 0x17, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75,
|
||||||
0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e,
|
||||||
0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e,
|
0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31,
|
||||||
0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x7b, 0x74, 0x78,
|
0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x7b, 0x74, 0x78, 0x69, 0x64, 0x7d, 0x12, 0x64, 0x0a,
|
||||||
0x69, 0x64, 0x7d, 0x12, 0x64, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42,
|
0x0c, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x12, 0x1b, 0x2e,
|
||||||
0x79, 0x49, 0x64, 0x12, 0x1b, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74,
|
0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42,
|
||||||
0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x72, 0x6b,
|
||||||
0x1a, 0x1c, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75,
|
0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x79, 0x49, 0x64,
|
||||||
0x6e, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19,
|
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13,
|
||||||
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e,
|
0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x2f, 0x69, 0x64, 0x2f, 0x7b,
|
||||||
0x64, 0x2f, 0x69, 0x64, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x4c, 0x69, 0x73,
|
0x69, 0x64, 0x7d, 0x12, 0x5d, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73,
|
||||||
0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e,
|
0x12, 0x18, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74,
|
||||||
0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
0x78, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x72, 0x6b,
|
||||||
0x1a, 0x19, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74,
|
0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x74, 0x78, 0x6f, 0x73, 0x52, 0x65, 0x73,
|
||||||
0x78, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4,
|
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f,
|
||||||
0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x2f, 0x7b,
|
0x76, 0x31, 0x2f, 0x76, 0x74, 0x78, 0x6f, 0x73, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
|
||||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74,
|
0x73, 0x7d, 0x12, 0x80, 0x01, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61,
|
||||||
0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x74, 0x72, 0x65,
|
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x24, 0x2e, 0x61,
|
||||||
0x61, 0x6d, 0x12, 0x24, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54,
|
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,
|
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,
|
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02,
|
||||||
0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69,
|
||||||
0x73, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0x6f, 0x6e, 0x73, 0x30, 0x01, 0x42, 0x92, 0x01, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x72,
|
||||||
0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x72, 0x61,
|
0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f,
|
||||||
0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x30, 0x01, 0x42, 0x92, 0x01, 0x0a, 0x0a,
|
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||||
0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x72, 0x6b, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x53, 0x65, 0x72, 0x76,
|
0x2f, 0x61, 0x72, 0x6b, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x61, 0x72, 0x6b,
|
||||||
0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68,
|
0x2f, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x70, 0x65, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x6b, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f,
|
0x75, 0x66, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x72, 0x6b, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x72,
|
||||||
0x72, 0x6b, 0x2f, 0x61, 0x72, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2d, 0x73, 0x70, 0x65, 0x63, 0x2f,
|
0x6b, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x41, 0x72, 0x6b, 0x2e,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x72, 0x6b,
|
0x56, 0x31, 0xca, 0x02, 0x06, 0x41, 0x72, 0x6b, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x41, 0x72,
|
||||||
0x2f, 0x76, 0x31, 0x3b, 0x61, 0x72, 0x6b, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa,
|
0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||||
0x02, 0x06, 0x41, 0x72, 0x6b, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x41, 0x72, 0x6b, 0x5c, 0x56,
|
0xea, 0x02, 0x07, 0x41, 0x72, 0x6b, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x31, 0xe2, 0x02, 0x12, 0x41, 0x72, 0x6b, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
|
0x6f, 0x33,
|
||||||
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 (
|
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
|
32, // 4: ark.v1.GetEventStreamResponse.round_failed:type_name -> ark.v1.RoundFailed
|
||||||
33, // 5: ark.v1.GetEventStreamResponse.round_signing:type_name -> ark.v1.RoundSigningEvent
|
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
|
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
|
37, // 7: ark.v1.AsyncPaymentInput.input:type_name -> ark.v1.Input
|
||||||
31, // 8: ark.v1.PingResponse.round_finalized:type_name -> ark.v1.RoundFinalizedEvent
|
19, // 8: ark.v1.CreatePaymentRequest.inputs:type_name -> ark.v1.AsyncPaymentInput
|
||||||
32, // 9: ark.v1.PingResponse.round_failed:type_name -> ark.v1.RoundFailed
|
38, // 9: ark.v1.CreatePaymentRequest.outputs:type_name -> ark.v1.Output
|
||||||
33, // 10: ark.v1.PingResponse.round_signing:type_name -> ark.v1.RoundSigningEvent
|
35, // 10: ark.v1.GetRoundResponse.round:type_name -> ark.v1.Round
|
||||||
34, // 11: ark.v1.PingResponse.round_signing_nonces_generated:type_name -> ark.v1.RoundSigningNoncesGeneratedEvent
|
35, // 11: ark.v1.GetRoundByIdResponse.round:type_name -> ark.v1.Round
|
||||||
37, // 12: ark.v1.AsyncPaymentInput.input:type_name -> ark.v1.Input
|
42, // 12: ark.v1.ListVtxosResponse.spendable_vtxos:type_name -> ark.v1.Vtxo
|
||||||
19, // 13: ark.v1.CreatePaymentRequest.inputs:type_name -> ark.v1.AsyncPaymentInput
|
42, // 13: ark.v1.ListVtxosResponse.spent_vtxos:type_name -> ark.v1.Vtxo
|
||||||
38, // 14: ark.v1.CreatePaymentRequest.outputs:type_name -> ark.v1.Output
|
39, // 14: ark.v1.RoundFinalizationEvent.vtxo_tree:type_name -> ark.v1.Tree
|
||||||
35, // 15: ark.v1.GetRoundResponse.round:type_name -> ark.v1.Round
|
39, // 15: ark.v1.RoundSigningEvent.unsigned_vtxo_tree:type_name -> ark.v1.Tree
|
||||||
35, // 16: ark.v1.GetRoundByIdResponse.round:type_name -> ark.v1.Round
|
39, // 16: ark.v1.Round.vtxo_tree:type_name -> ark.v1.Tree
|
||||||
42, // 17: ark.v1.ListVtxosResponse.spendable_vtxos:type_name -> ark.v1.Vtxo
|
0, // 17: ark.v1.Round.stage:type_name -> ark.v1.RoundStage
|
||||||
42, // 18: ark.v1.ListVtxosResponse.spent_vtxos:type_name -> ark.v1.Vtxo
|
36, // 18: ark.v1.Input.outpoint:type_name -> ark.v1.Outpoint
|
||||||
39, // 19: ark.v1.RoundFinalizationEvent.vtxo_tree:type_name -> ark.v1.Tree
|
40, // 19: ark.v1.Tree.levels:type_name -> ark.v1.TreeLevel
|
||||||
39, // 20: ark.v1.RoundSigningEvent.unsigned_vtxo_tree:type_name -> ark.v1.Tree
|
41, // 20: ark.v1.TreeLevel.nodes:type_name -> ark.v1.Node
|
||||||
39, // 21: ark.v1.Round.vtxo_tree:type_name -> ark.v1.Tree
|
36, // 21: ark.v1.Vtxo.outpoint:type_name -> ark.v1.Outpoint
|
||||||
0, // 22: ark.v1.Round.stage:type_name -> ark.v1.RoundStage
|
45, // 22: ark.v1.GetTransactionsStreamResponse.round:type_name -> ark.v1.RoundTransaction
|
||||||
36, // 23: ark.v1.Input.outpoint:type_name -> ark.v1.Outpoint
|
46, // 23: ark.v1.GetTransactionsStreamResponse.redeem:type_name -> ark.v1.RedeemTransaction
|
||||||
40, // 24: ark.v1.Tree.levels:type_name -> ark.v1.TreeLevel
|
36, // 24: ark.v1.RoundTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
|
||||||
41, // 25: ark.v1.TreeLevel.nodes:type_name -> ark.v1.Node
|
42, // 25: ark.v1.RoundTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
|
||||||
36, // 26: ark.v1.Vtxo.outpoint:type_name -> ark.v1.Outpoint
|
36, // 26: ark.v1.RoundTransaction.claimed_boarding_utxos:type_name -> ark.v1.Outpoint
|
||||||
45, // 27: ark.v1.GetTransactionsStreamResponse.round:type_name -> ark.v1.RoundTransaction
|
36, // 27: ark.v1.RedeemTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
|
||||||
46, // 28: ark.v1.GetTransactionsStreamResponse.redeem:type_name -> ark.v1.RedeemTransaction
|
42, // 28: ark.v1.RedeemTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
|
||||||
36, // 29: ark.v1.RoundTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
|
1, // 29: ark.v1.ArkService.GetInfo:input_type -> ark.v1.GetInfoRequest
|
||||||
42, // 30: ark.v1.RoundTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
|
3, // 30: ark.v1.ArkService.GetBoardingAddress:input_type -> ark.v1.GetBoardingAddressRequest
|
||||||
36, // 31: ark.v1.RoundTransaction.claimed_boarding_utxos:type_name -> ark.v1.Outpoint
|
5, // 31: ark.v1.ArkService.RegisterInputsForNextRound:input_type -> ark.v1.RegisterInputsForNextRoundRequest
|
||||||
36, // 32: ark.v1.RedeemTransaction.spent_vtxos:type_name -> ark.v1.Outpoint
|
7, // 32: ark.v1.ArkService.RegisterOutputsForNextRound:input_type -> ark.v1.RegisterOutputsForNextRoundRequest
|
||||||
42, // 33: ark.v1.RedeemTransaction.spendable_vtxos:type_name -> ark.v1.Vtxo
|
9, // 33: ark.v1.ArkService.SubmitTreeNonces:input_type -> ark.v1.SubmitTreeNoncesRequest
|
||||||
1, // 34: ark.v1.ArkService.GetInfo:input_type -> ark.v1.GetInfoRequest
|
11, // 34: ark.v1.ArkService.SubmitTreeSignatures:input_type -> ark.v1.SubmitTreeSignaturesRequest
|
||||||
3, // 35: ark.v1.ArkService.GetBoardingAddress:input_type -> ark.v1.GetBoardingAddressRequest
|
13, // 35: ark.v1.ArkService.SubmitSignedForfeitTxs:input_type -> ark.v1.SubmitSignedForfeitTxsRequest
|
||||||
5, // 36: ark.v1.ArkService.RegisterInputsForNextRound:input_type -> ark.v1.RegisterInputsForNextRoundRequest
|
15, // 36: ark.v1.ArkService.GetEventStream:input_type -> ark.v1.GetEventStreamRequest
|
||||||
7, // 37: ark.v1.ArkService.RegisterOutputsForNextRound:input_type -> ark.v1.RegisterOutputsForNextRoundRequest
|
17, // 37: ark.v1.ArkService.Ping:input_type -> ark.v1.PingRequest
|
||||||
9, // 38: ark.v1.ArkService.SubmitTreeNonces:input_type -> ark.v1.SubmitTreeNoncesRequest
|
20, // 38: ark.v1.ArkService.CreatePayment:input_type -> ark.v1.CreatePaymentRequest
|
||||||
11, // 39: ark.v1.ArkService.SubmitTreeSignatures:input_type -> ark.v1.SubmitTreeSignaturesRequest
|
22, // 39: ark.v1.ArkService.CompletePayment:input_type -> ark.v1.CompletePaymentRequest
|
||||||
13, // 40: ark.v1.ArkService.SubmitSignedForfeitTxs:input_type -> ark.v1.SubmitSignedForfeitTxsRequest
|
24, // 40: ark.v1.ArkService.GetRound:input_type -> ark.v1.GetRoundRequest
|
||||||
15, // 41: ark.v1.ArkService.GetEventStream:input_type -> ark.v1.GetEventStreamRequest
|
26, // 41: ark.v1.ArkService.GetRoundById:input_type -> ark.v1.GetRoundByIdRequest
|
||||||
17, // 42: ark.v1.ArkService.Ping:input_type -> ark.v1.PingRequest
|
28, // 42: ark.v1.ArkService.ListVtxos:input_type -> ark.v1.ListVtxosRequest
|
||||||
20, // 43: ark.v1.ArkService.CreatePayment:input_type -> ark.v1.CreatePaymentRequest
|
43, // 43: ark.v1.ArkService.GetTransactionsStream:input_type -> ark.v1.GetTransactionsStreamRequest
|
||||||
22, // 44: ark.v1.ArkService.CompletePayment:input_type -> ark.v1.CompletePaymentRequest
|
2, // 44: ark.v1.ArkService.GetInfo:output_type -> ark.v1.GetInfoResponse
|
||||||
24, // 45: ark.v1.ArkService.GetRound:input_type -> ark.v1.GetRoundRequest
|
4, // 45: ark.v1.ArkService.GetBoardingAddress:output_type -> ark.v1.GetBoardingAddressResponse
|
||||||
26, // 46: ark.v1.ArkService.GetRoundById:input_type -> ark.v1.GetRoundByIdRequest
|
6, // 46: ark.v1.ArkService.RegisterInputsForNextRound:output_type -> ark.v1.RegisterInputsForNextRoundResponse
|
||||||
28, // 47: ark.v1.ArkService.ListVtxos:input_type -> ark.v1.ListVtxosRequest
|
8, // 47: ark.v1.ArkService.RegisterOutputsForNextRound:output_type -> ark.v1.RegisterOutputsForNextRoundResponse
|
||||||
43, // 48: ark.v1.ArkService.GetTransactionsStream:input_type -> ark.v1.GetTransactionsStreamRequest
|
10, // 48: ark.v1.ArkService.SubmitTreeNonces:output_type -> ark.v1.SubmitTreeNoncesResponse
|
||||||
2, // 49: ark.v1.ArkService.GetInfo:output_type -> ark.v1.GetInfoResponse
|
12, // 49: ark.v1.ArkService.SubmitTreeSignatures:output_type -> ark.v1.SubmitTreeSignaturesResponse
|
||||||
4, // 50: ark.v1.ArkService.GetBoardingAddress:output_type -> ark.v1.GetBoardingAddressResponse
|
14, // 50: ark.v1.ArkService.SubmitSignedForfeitTxs:output_type -> ark.v1.SubmitSignedForfeitTxsResponse
|
||||||
6, // 51: ark.v1.ArkService.RegisterInputsForNextRound:output_type -> ark.v1.RegisterInputsForNextRoundResponse
|
16, // 51: ark.v1.ArkService.GetEventStream:output_type -> ark.v1.GetEventStreamResponse
|
||||||
8, // 52: ark.v1.ArkService.RegisterOutputsForNextRound:output_type -> ark.v1.RegisterOutputsForNextRoundResponse
|
18, // 52: ark.v1.ArkService.Ping:output_type -> ark.v1.PingResponse
|
||||||
10, // 53: ark.v1.ArkService.SubmitTreeNonces:output_type -> ark.v1.SubmitTreeNoncesResponse
|
21, // 53: ark.v1.ArkService.CreatePayment:output_type -> ark.v1.CreatePaymentResponse
|
||||||
12, // 54: ark.v1.ArkService.SubmitTreeSignatures:output_type -> ark.v1.SubmitTreeSignaturesResponse
|
23, // 54: ark.v1.ArkService.CompletePayment:output_type -> ark.v1.CompletePaymentResponse
|
||||||
14, // 55: ark.v1.ArkService.SubmitSignedForfeitTxs:output_type -> ark.v1.SubmitSignedForfeitTxsResponse
|
25, // 55: ark.v1.ArkService.GetRound:output_type -> ark.v1.GetRoundResponse
|
||||||
16, // 56: ark.v1.ArkService.GetEventStream:output_type -> ark.v1.GetEventStreamResponse
|
27, // 56: ark.v1.ArkService.GetRoundById:output_type -> ark.v1.GetRoundByIdResponse
|
||||||
18, // 57: ark.v1.ArkService.Ping:output_type -> ark.v1.PingResponse
|
29, // 57: ark.v1.ArkService.ListVtxos:output_type -> ark.v1.ListVtxosResponse
|
||||||
21, // 58: ark.v1.ArkService.CreatePayment:output_type -> ark.v1.CreatePaymentResponse
|
44, // 58: ark.v1.ArkService.GetTransactionsStream:output_type -> ark.v1.GetTransactionsStreamResponse
|
||||||
23, // 59: ark.v1.ArkService.CompletePayment:output_type -> ark.v1.CompletePaymentResponse
|
44, // [44:59] is the sub-list for method output_type
|
||||||
25, // 60: ark.v1.ArkService.GetRound:output_type -> ark.v1.GetRoundResponse
|
29, // [29:44] is the sub-list for method input_type
|
||||||
27, // 61: ark.v1.ArkService.GetRoundById:output_type -> ark.v1.GetRoundByIdResponse
|
29, // [29:29] is the sub-list for extension type_name
|
||||||
29, // 62: ark.v1.ArkService.ListVtxos:output_type -> ark.v1.ListVtxosResponse
|
29, // [29:29] is the sub-list for extension extendee
|
||||||
44, // 63: ark.v1.ArkService.GetTransactionsStream:output_type -> ark.v1.GetTransactionsStreamResponse
|
0, // [0:29] is the sub-list for field type_name
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_ark_v1_service_proto_init() }
|
func init() { file_ark_v1_service_proto_init() }
|
||||||
@@ -3965,13 +3850,6 @@ func file_ark_v1_service_proto_init() {
|
|||||||
(*GetEventStreamResponse_RoundSigning)(nil),
|
(*GetEventStreamResponse_RoundSigning)(nil),
|
||||||
(*GetEventStreamResponse_RoundSigningNoncesGenerated)(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{}{
|
file_ark_v1_service_proto_msgTypes[43].OneofWrappers = []interface{}{
|
||||||
(*GetTransactionsStreamResponse_Round)(nil),
|
(*GetTransactionsStreamResponse_Round)(nil),
|
||||||
(*GetTransactionsStreamResponse_Redeem)(nil),
|
(*GetTransactionsStreamResponse_Redeem)(nil),
|
||||||
|
|||||||
@@ -1046,7 +1046,7 @@ func RegisterArkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux,
|
|||||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||||
var err error
|
var err error
|
||||||
var annotatedContext context.Context
|
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 {
|
if err != nil {
|
||||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||||
return
|
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_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"}, ""))
|
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"}, ""))
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ func (a *arkClient) initWithWallet(
|
|||||||
Dust: info.Dust,
|
Dust: info.Dust,
|
||||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||||
ForfeitAddress: info.ForfeitAddress,
|
ForfeitAddress: info.ForfeitAddress,
|
||||||
WithTransactionFeed: args.ListenTransactionStream,
|
WithTransactionFeed: args.WithTransactionFeed,
|
||||||
}
|
}
|
||||||
if err := a.store.ConfigStore().AddData(ctx, storeData); err != nil {
|
if err := a.store.ConfigStore().AddData(ctx, storeData); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -226,7 +226,7 @@ func (a *arkClient) init(
|
|||||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||||
ExplorerURL: args.ExplorerURL,
|
ExplorerURL: args.ExplorerURL,
|
||||||
ForfeitAddress: info.ForfeitAddress,
|
ForfeitAddress: info.ForfeitAddress,
|
||||||
WithTransactionFeed: args.ListenTransactionStream,
|
WithTransactionFeed: args.WithTransactionFeed,
|
||||||
}
|
}
|
||||||
walletSvc, err := getWallet(a.store.ConfigStore(), &cfgData, supportedWallets)
|
walletSvc, err := getWallet(a.store.ConfigStore(), &cfgData, supportedWallets)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -257,11 +257,11 @@ func (a *arkClient) ping(
|
|||||||
ticker := time.NewTicker(5 * time.Second)
|
ticker := time.NewTicker(5 * time.Second)
|
||||||
|
|
||||||
go func(t *time.Ticker) {
|
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)
|
logrus.Warnf("failed to ping asp: %s", err)
|
||||||
}
|
}
|
||||||
for range t.C {
|
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)
|
logrus.Warnf("failed to ping asp: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ type ASPClient interface {
|
|||||||
GetEventStream(
|
GetEventStream(
|
||||||
ctx context.Context, paymentID string,
|
ctx context.Context, paymentID string,
|
||||||
) (<-chan RoundEventChannel, func(), error)
|
) (<-chan RoundEventChannel, func(), error)
|
||||||
Ping(ctx context.Context, paymentID string) (RoundEvent, error)
|
Ping(ctx context.Context, paymentID string) error
|
||||||
CreatePayment(
|
CreatePayment(
|
||||||
ctx context.Context, inputs []AsyncPaymentInput, outputs []Output,
|
ctx context.Context, inputs []AsyncPaymentInput, outputs []Output,
|
||||||
) (string, error)
|
) (string, error)
|
||||||
|
|||||||
@@ -221,20 +221,12 @@ func (a *grpcClient) GetEventStream(
|
|||||||
|
|
||||||
func (a *grpcClient) Ping(
|
func (a *grpcClient) Ping(
|
||||||
ctx context.Context, paymentID string,
|
ctx context.Context, paymentID string,
|
||||||
) (client.RoundEvent, error) {
|
) error {
|
||||||
req := &arkv1.PingRequest{
|
req := &arkv1.PingRequest{
|
||||||
PaymentId: paymentID,
|
PaymentId: paymentID,
|
||||||
}
|
}
|
||||||
resp, err := a.svc.Ping(ctx, req)
|
_, err := a.svc.Ping(ctx, req)
|
||||||
if err != nil {
|
return err
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.GetEvent() == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return event{resp}.toRoundEvent()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *grpcClient) CreatePayment(
|
func (a *grpcClient) CreatePayment(
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package restclient
|
package restclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -22,19 +26,21 @@ import (
|
|||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type restClient struct {
|
type restClient struct {
|
||||||
|
serverURL string
|
||||||
svc ark_service.ClientService
|
svc ark_service.ClientService
|
||||||
requestTimeout time.Duration
|
requestTimeout time.Duration
|
||||||
treeCache *utils.Cache[tree.CongestionTree]
|
treeCache *utils.Cache[tree.CongestionTree]
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(aspUrl string) (client.ASPClient, error) {
|
func NewClient(serverURL string) (client.ASPClient, error) {
|
||||||
if len(aspUrl) <= 0 {
|
if len(serverURL) <= 0 {
|
||||||
return nil, fmt.Errorf("missing asp url")
|
return nil, fmt.Errorf("missing asp url")
|
||||||
}
|
}
|
||||||
svc, err := newRestClient(aspUrl)
|
svc, err := newRestClient(serverURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -42,7 +48,7 @@ func NewClient(aspUrl string) (client.ASPClient, error) {
|
|||||||
reqTimeout := 15 * time.Second
|
reqTimeout := 15 * time.Second
|
||||||
treeCache := utils.NewCache[tree.CongestionTree]()
|
treeCache := utils.NewCache[tree.CongestionTree]()
|
||||||
|
|
||||||
return &restClient{svc, reqTimeout, treeCache}, nil
|
return &restClient{serverURL, svc, reqTimeout, treeCache}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *restClient) GetInfo(
|
func (a *restClient) GetInfo(
|
||||||
@@ -220,119 +226,151 @@ func (a *restClient) SubmitSignedForfeitTxs(
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *restClient) GetEventStream(
|
func (c *restClient) GetEventStream(
|
||||||
ctx context.Context, paymentID string,
|
ctx context.Context, paymentID string,
|
||||||
) (<-chan client.RoundEventChannel, func(), error) {
|
) (<-chan client.RoundEventChannel, func(), error) {
|
||||||
ctx, cancel := context.WithTimeout(ctx, a.requestTimeout)
|
|
||||||
eventsCh := make(chan client.RoundEventChannel)
|
eventsCh := make(chan client.RoundEventChannel)
|
||||||
|
|
||||||
go func(payID string, eventsCh chan client.RoundEventChannel) {
|
go func(eventsCh chan client.RoundEventChannel) {
|
||||||
ticker := time.NewTicker(1 * time.Second)
|
httpClient := &http.Client{Timeout: time.Second * 0}
|
||||||
defer close(eventsCh)
|
|
||||||
defer ticker.Stop()
|
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 {
|
for {
|
||||||
select {
|
chunk, err := reader.ReadBytes('\n')
|
||||||
case <-ctx.Done():
|
if err != nil {
|
||||||
return
|
// Stream ended
|
||||||
case <-ticker.C:
|
if err == io.EOF {
|
||||||
event, err := a.Ping(ctx, payID)
|
|
||||||
if err != nil {
|
|
||||||
eventsCh <- client.RoundEventChannel{
|
|
||||||
Err: err,
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.WithError(err).Warn("failed to read from round event stream")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if event != nil {
|
chunk = bytes.Trim(chunk, "\n")
|
||||||
eventsCh <- client.RoundEventChannel{
|
resp := ark_service.ArkServiceGetEventStreamOKBody{}
|
||||||
Event: event,
|
if err := json.Unmarshal(chunk, &resp); err != nil {
|
||||||
|
eventsCh <- client.RoundEventChannel{
|
||||||
|
Err: fmt.Errorf("failed to parse message from round event stream: %s", err),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
emptyResp := ark_service.ArkServiceGetEventStreamOKBody{}
|
||||||
|
if resp == emptyResp {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if resp.Error != nil {
|
||||||
|
eventsCh <- client.RoundEventChannel{
|
||||||
|
Err: fmt.Errorf("received error %d: %s", resp.Error.Code, resp.Error.Message),
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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,
|
||||||
|
}
|
||||||
|
case resp.Result.RoundFinalization != nil:
|
||||||
|
e := resp.Result.RoundFinalization
|
||||||
|
tree := treeFromProto{e.VtxoTree}.parse()
|
||||||
|
|
||||||
|
minRelayFeeRate, err := strconv.Atoi(e.MinRelayFeeRate)
|
||||||
|
if err != nil {
|
||||||
|
_err = err
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
event = client.RoundFinalizationEvent{
|
||||||
|
ID: e.ID,
|
||||||
|
Tx: e.RoundTx,
|
||||||
|
Tree: tree,
|
||||||
|
Connectors: e.Connectors,
|
||||||
|
MinRelayFeeRate: chainfee.SatPerKVByte(minRelayFeeRate),
|
||||||
|
}
|
||||||
|
case resp.Result.RoundFinalized != nil:
|
||||||
|
e := resp.Result.RoundFinalized
|
||||||
|
event = client.RoundFinalizedEvent{
|
||||||
|
ID: e.ID,
|
||||||
|
Txid: e.RoundTxid,
|
||||||
|
}
|
||||||
|
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 {
|
||||||
|
_err = err
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
pk, err := secp256k1.ParsePubKey(p)
|
||||||
|
if err != nil {
|
||||||
|
_err = err
|
||||||
|
break
|
||||||
|
}
|
||||||
|
pubkeys = append(pubkeys, pk)
|
||||||
|
}
|
||||||
|
|
||||||
|
event = client.RoundSigningStartedEvent{
|
||||||
|
ID: e.ID,
|
||||||
|
UnsignedTree: treeFromProto{e.UnsignedVtxoTree}.parse(),
|
||||||
|
CosignersPublicKeys: pubkeys,
|
||||||
|
UnsignedRoundTx: e.UnsignedRoundTx,
|
||||||
|
}
|
||||||
|
case resp.Result.RoundSigningNoncesGenerated != nil:
|
||||||
|
e := resp.Result.RoundSigningNoncesGenerated
|
||||||
|
reader := hex.NewDecoder(strings.NewReader(e.TreeNonces))
|
||||||
|
nonces, err := bitcointree.DecodeNonces(reader)
|
||||||
|
if err != nil {
|
||||||
|
_err = err
|
||||||
|
break
|
||||||
|
}
|
||||||
|
event = client.RoundSigningNoncesGeneratedEvent{
|
||||||
|
ID: e.ID,
|
||||||
|
Nonces: nonces,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}(paymentID, eventsCh)
|
|
||||||
|
|
||||||
return eventsCh, cancel, nil
|
eventsCh <- client.RoundEventChannel{
|
||||||
|
Event: event,
|
||||||
|
Err: _err,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}(eventsCh)
|
||||||
|
|
||||||
|
return eventsCh, func() {}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *restClient) Ping(
|
func (a *restClient) Ping(
|
||||||
ctx context.Context, paymentID string,
|
ctx context.Context, paymentID string,
|
||||||
) (client.RoundEvent, error) {
|
) error {
|
||||||
r := ark_service.NewArkServicePingParams()
|
r := ark_service.NewArkServicePingParams()
|
||||||
r.SetPaymentID(paymentID)
|
r.SetPaymentID(paymentID)
|
||||||
resp, err := a.svc.ArkServicePing(r)
|
_, err := a.svc.ArkServicePing(r)
|
||||||
if err != nil {
|
return err
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
payload := resp.Payload
|
|
||||||
|
|
||||||
if e := payload.RoundFailed; e != nil {
|
|
||||||
return client.RoundFailedEvent{
|
|
||||||
ID: e.ID,
|
|
||||||
Reason: e.Reason,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
if e := payload.RoundFinalization; e != nil {
|
|
||||||
tree := treeFromProto{e.VtxoTree}.parse()
|
|
||||||
|
|
||||||
minRelayFeeRate, err := strconv.Atoi(e.MinRelayFeeRate)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return 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{
|
|
||||||
ID: e.ID,
|
|
||||||
Txid: e.RoundTxid,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if e := payload.RoundSigning; e != nil {
|
|
||||||
pubkeys := make([]*secp256k1.PublicKey, 0, len(e.CosignersPubkeys))
|
|
||||||
for _, pubkey := range e.CosignersPubkeys {
|
|
||||||
p, err := hex.DecodeString(pubkey)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
pk, err := secp256k1.ParsePubKey(p)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
pubkeys = append(pubkeys, pk)
|
|
||||||
}
|
|
||||||
|
|
||||||
return client.RoundSigningStartedEvent{
|
|
||||||
ID: e.ID,
|
|
||||||
UnsignedTree: treeFromProto{e.UnsignedVtxoTree}.parse(),
|
|
||||||
CosignersPublicKeys: pubkeys,
|
|
||||||
UnsignedRoundTx: e.UnsignedRoundTx,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if e := payload.RoundSigningNoncesGenerated; e != nil {
|
|
||||||
reader := hex.NewDecoder(strings.NewReader(e.TreeNonces))
|
|
||||||
nonces, err := bitcointree.DecodeNonces(reader)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return client.RoundSigningNoncesGeneratedEvent{
|
|
||||||
ID: e.ID,
|
|
||||||
Nonces: nonces,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *restClient) CreatePayment(
|
func (a *restClient) CreatePayment(
|
||||||
@@ -559,48 +597,84 @@ func (t treeFromProto) parse() tree.CongestionTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *restClient) GetTransactionsStream(ctx context.Context) (<-chan client.TransactionEvent, func(), error) {
|
func (c *restClient) GetTransactionsStream(ctx context.Context) (<-chan client.TransactionEvent, func(), error) {
|
||||||
ctx, cancel := context.WithTimeout(ctx, c.requestTimeout)
|
|
||||||
eventsCh := make(chan client.TransactionEvent)
|
eventsCh := make(chan client.TransactionEvent)
|
||||||
|
|
||||||
go func() {
|
go func(eventsCh chan client.TransactionEvent) {
|
||||||
ticker := time.NewTicker(1 * time.Second)
|
httpClient := &http.Client{Timeout: time.Second * 0}
|
||||||
defer close(eventsCh)
|
|
||||||
defer ticker.Stop()
|
|
||||||
|
|
||||||
|
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.StatusCode != http.StatusOK {
|
||||||
|
eventsCh <- client.TransactionEvent{
|
||||||
|
Err: fmt.Errorf("unexpected status code: %d", resp.StatusCode),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
reader := bufio.NewReader(resp.Body)
|
||||||
for {
|
for {
|
||||||
select {
|
chunk, err := reader.ReadBytes('\n')
|
||||||
case <-ctx.Done():
|
if err != nil {
|
||||||
return
|
// Stream ended
|
||||||
case <-ticker.C:
|
if err == io.EOF {
|
||||||
resp, err := c.svc.ArkServiceGetTransactionsStream(ark_service.NewArkServiceGetTransactionsStreamParams())
|
|
||||||
if err != nil {
|
|
||||||
eventsCh <- client.TransactionEvent{Err: err}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
eventsCh <- client.TransactionEvent{
|
||||||
|
Err: fmt.Errorf("failed to read from transaction stream: %s", err),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if resp.Payload.Result.Round != nil {
|
chunk = bytes.Trim(chunk, "\n")
|
||||||
eventsCh <- client.TransactionEvent{
|
resp := ark_service.ArkServiceGetTransactionsStreamOK{}
|
||||||
Round: &client.RoundTransaction{
|
if err := json.Unmarshal(chunk, &resp); err != nil {
|
||||||
Txid: resp.Payload.Result.Round.Txid,
|
eventsCh <- client.TransactionEvent{
|
||||||
SpentVtxos: outpointsFromRest(resp.Payload.Result.Round.SpentVtxos),
|
Err: fmt.Errorf("failed to parse message from transaction stream: %s", err),
|
||||||
SpendableVtxos: vtxosFromRest(resp.Payload.Result.Round.SpendableVtxos),
|
}
|
||||||
ClaimedBoardingUtxos: outpointsFromRest(resp.Payload.Result.Round.ClaimedBoardingUtxos),
|
return
|
||||||
},
|
}
|
||||||
}
|
|
||||||
} else if resp.Payload.Result.Redeem != nil {
|
if resp.Payload == nil {
|
||||||
eventsCh <- client.TransactionEvent{
|
continue
|
||||||
Redeem: &client.RedeemTransaction{
|
}
|
||||||
Txid: resp.Payload.Result.Redeem.Txid,
|
|
||||||
SpentVtxos: outpointsFromRest(resp.Payload.Result.Redeem.SpentVtxos),
|
if resp.Payload.Error != nil {
|
||||||
SpendableVtxos: vtxosFromRest(resp.Payload.Result.Redeem.SpendableVtxos),
|
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),
|
||||||
|
SpendableVtxos: vtxosFromRest(resp.Payload.Result.Round.SpendableVtxos),
|
||||||
|
ClaimedBoardingUtxos: outpointsFromRest(resp.Payload.Result.Round.ClaimedBoardingUtxos),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
} else if resp.Payload.Result.Redeem != nil {
|
||||||
|
event = client.TransactionEvent{
|
||||||
|
Redeem: &client.RedeemTransaction{
|
||||||
|
Txid: resp.Payload.Result.Redeem.Txid,
|
||||||
|
SpentVtxos: outpointsFromRest(resp.Payload.Result.Redeem.SpentVtxos),
|
||||||
|
SpendableVtxos: vtxosFromRest(resp.Payload.Result.Redeem.SpendableVtxos),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return eventsCh, cancel, nil
|
eventsCh <- event
|
||||||
|
}
|
||||||
|
}(eventsCh)
|
||||||
|
|
||||||
|
return eventsCh, func() {}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func outpointsFromRest(restOutpoints []*models.V1Outpoint) []client.Outpoint {
|
func outpointsFromRest(restOutpoints []*models.V1Outpoint) []client.Outpoint {
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ func (a *Client) ArkServiceGetEventStream(params *ArkServiceGetEventStreamParams
|
|||||||
op := &runtime.ClientOperation{
|
op := &runtime.ClientOperation{
|
||||||
ID: "ArkService_GetEventStream",
|
ID: "ArkService_GetEventStream",
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
PathPattern: "/v1/round/events",
|
PathPattern: "/v1/events",
|
||||||
ProducesMediaTypes: []string{"application/json"},
|
ProducesMediaTypes: []string{"application/json"},
|
||||||
ConsumesMediaTypes: []string{"application/json"},
|
ConsumesMediaTypes: []string{"application/json"},
|
||||||
Schemes: []string{"http"},
|
Schemes: []string{"http"},
|
||||||
|
|||||||
@@ -91,12 +91,12 @@ func (o *ArkServiceGetEventStreamOK) Code() int {
|
|||||||
|
|
||||||
func (o *ArkServiceGetEventStreamOK) Error() string {
|
func (o *ArkServiceGetEventStreamOK) Error() string {
|
||||||
payload, _ := json.Marshal(o.Payload)
|
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 {
|
func (o *ArkServiceGetEventStreamOK) String() string {
|
||||||
payload, _ := json.Marshal(o.Payload)
|
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 {
|
func (o *ArkServiceGetEventStreamOK) GetPayload() *ArkServiceGetEventStreamOKBody {
|
||||||
@@ -165,12 +165,12 @@ func (o *ArkServiceGetEventStreamDefault) Code() int {
|
|||||||
|
|
||||||
func (o *ArkServiceGetEventStreamDefault) Error() string {
|
func (o *ArkServiceGetEventStreamDefault) Error() string {
|
||||||
payload, _ := json.Marshal(o.Payload)
|
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 {
|
func (o *ArkServiceGetEventStreamDefault) String() string {
|
||||||
payload, _ := json.Marshal(o.Payload)
|
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 {
|
func (o *ArkServiceGetEventStreamDefault) GetPayload() *models.RPCStatus {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ ArkServicePingOK describes a response with status code 200, with default header
|
|||||||
A successful response.
|
A successful response.
|
||||||
*/
|
*/
|
||||||
type ArkServicePingOK struct {
|
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
|
// 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)
|
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
|
return o.Payload
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ArkServicePingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
func (o *ArkServicePingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||||
|
|
||||||
o.Payload = new(models.V1PingResponse)
|
|
||||||
|
|
||||||
// response payload
|
// 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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,309 +5,7 @@ package models
|
|||||||
// This file was generated by the swagger tool.
|
// This file was generated by the swagger tool.
|
||||||
// Editing this file might prove futile when you re-run the swagger generate command
|
// 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
|
// V1PingResponse v1 ping response
|
||||||
//
|
//
|
||||||
// swagger:model v1PingResponse
|
// swagger:model v1PingResponse
|
||||||
type V1PingResponse struct {
|
type V1PingResponse interface{}
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func TestVtxosToTxs(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range fixtures {
|
for _, tt := range fixtures {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
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.NoError(t, err)
|
||||||
require.Len(t, txHistory, len(tt.expectedTxHistory))
|
require.Len(t, txHistory, len(tt.expectedTxHistory))
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ func (a *covenantArkClient) Init(ctx context.Context, args InitArgs) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.ListenTransactionStream {
|
if args.WithTransactionFeed {
|
||||||
txStreamCtx, txStreamCtxCancel := context.WithCancel(context.Background())
|
txStreamCtx, txStreamCtxCancel := context.WithCancel(context.Background())
|
||||||
a.txStreamCtxCancel = txStreamCtxCancel
|
a.txStreamCtxCancel = txStreamCtxCancel
|
||||||
go a.listenForTxStream(txStreamCtx)
|
go a.listenForTxStream(txStreamCtx)
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ func (a *covenantlessArkClient) Init(ctx context.Context, args InitArgs) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.ListenTransactionStream {
|
if args.WithTransactionFeed {
|
||||||
txStreamCtx, txStreamCtxCancel := context.WithCancel(context.Background())
|
txStreamCtx, txStreamCtxCancel := context.WithCancel(context.Background())
|
||||||
a.txStreamCtxCancel = txStreamCtxCancel
|
a.txStreamCtxCancel = txStreamCtxCancel
|
||||||
go a.listenForTransactions(txStreamCtx)
|
go a.listenForTransactions(txStreamCtx)
|
||||||
@@ -1063,12 +1063,12 @@ func (a *covenantlessArkClient) GetTransactionHistory(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
boardingTxs, _, err := a.getBoardingTxs(ctx)
|
boardingTxs, roundsToIgnore, err := a.getBoardingTxs(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
offchainTxs, err := vtxosToTxsCovenantless(spendableVtxos, spentVtxos)
|
offchainTxs, err := vtxosToTxsCovenantless(spendableVtxos, spentVtxos, roundsToIgnore)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -1526,20 +1526,6 @@ func (a *covenantlessArkClient) handleRoundStream(
|
|||||||
if notify.Err != nil {
|
if notify.Err != nil {
|
||||||
return "", notify.Err
|
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) {
|
switch event := notify.Event; event.(type) {
|
||||||
case client.RoundFinalizedEvent:
|
case client.RoundFinalizedEvent:
|
||||||
if step != roundFinalization {
|
if step != roundFinalization {
|
||||||
@@ -2397,7 +2383,7 @@ func findVtxosBySpentBy(allVtxos []client.Vtxo, txid string) (vtxos []client.Vtx
|
|||||||
}
|
}
|
||||||
|
|
||||||
func vtxosToTxsCovenantless(
|
func vtxosToTxsCovenantless(
|
||||||
spendable, spent []client.Vtxo,
|
spendable, spent []client.Vtxo, ignoreVtxosByRound map[string]struct{},
|
||||||
) ([]types.Transaction, error) {
|
) ([]types.Transaction, error) {
|
||||||
txs := make([]types.Transaction, 0)
|
txs := make([]types.Transaction, 0)
|
||||||
vtxosByRound := make(map[string][]client.Vtxo)
|
vtxosByRound := make(map[string][]client.Vtxo)
|
||||||
@@ -2406,6 +2392,10 @@ func vtxosToTxsCovenantless(
|
|||||||
vtxosByRound[v.RoundTxid] = make([]client.Vtxo, 0)
|
vtxosByRound[v.RoundTxid] = make([]client.Vtxo, 0)
|
||||||
}
|
}
|
||||||
vtxosByRound[v.RoundTxid] = append(vtxosByRound[v.RoundTxid], v)
|
vtxosByRound[v.RoundTxid] = append(vtxosByRound[v.RoundTxid], v)
|
||||||
|
|
||||||
|
if len(v.SpentBy) > 0 {
|
||||||
|
ignoreVtxosByRound[v.SpentBy] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for round := range vtxosByRound {
|
for round := range vtxosByRound {
|
||||||
@@ -2425,6 +2415,15 @@ func vtxosToTxsCovenantless(
|
|||||||
Type: types.TxReceived,
|
Type: types.TxReceived,
|
||||||
CreatedAt: v.CreatedAt,
|
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 {
|
if len(vtxos) > 1 {
|
||||||
for _, v := range vtxos[1:] {
|
for _, v := range vtxos[1:] {
|
||||||
|
|||||||
@@ -186,11 +186,11 @@ func setupArkClient(wallet string) (arksdk.ArkClient, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := client.Init(context.Background(), arksdk.InitArgs{
|
if err := client.Init(context.Background(), arksdk.InitArgs{
|
||||||
WalletType: walletType,
|
WalletType: walletType,
|
||||||
ClientType: clientType,
|
ClientType: clientType,
|
||||||
AspUrl: aspUrl,
|
AspUrl: aspUrl,
|
||||||
Password: password,
|
Password: password,
|
||||||
ListenTransactionStream: true,
|
WithTransactionFeed: true,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, fmt.Errorf("failed to initialize wallet: %s", err)
|
return nil, fmt.Errorf("failed to initialize wallet: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type InitArgs struct {
|
type InitArgs struct {
|
||||||
ClientType string
|
ClientType string
|
||||||
WalletType string
|
WalletType string
|
||||||
AspUrl string
|
AspUrl string
|
||||||
Seed string
|
Seed string
|
||||||
Password string
|
Password string
|
||||||
ExplorerURL string
|
ExplorerURL string
|
||||||
ListenTransactionStream bool
|
WithTransactionFeed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a InitArgs) validate() error {
|
func (a InitArgs) validate() error {
|
||||||
@@ -61,13 +61,13 @@ func (a InitArgs) validate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type InitWithWalletArgs struct {
|
type InitWithWalletArgs struct {
|
||||||
ClientType string
|
ClientType string
|
||||||
Wallet wallet.WalletService
|
Wallet wallet.WalletService
|
||||||
AspUrl string
|
AspUrl string
|
||||||
Seed string
|
Seed string
|
||||||
Password string
|
Password string
|
||||||
ExplorerURL string
|
ExplorerURL string
|
||||||
ListenTransactionStream bool
|
WithTransactionFeed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a InitWithWalletArgs) validate() error {
|
func (a InitWithWalletArgs) validate() error {
|
||||||
|
|||||||
@@ -309,17 +309,8 @@ func (s *covenantService) ClaimVtxos(ctx context.Context, creds string, receiver
|
|||||||
return s.paymentRequests.update(*payment)
|
return s.paymentRequests.update(*payment)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *covenantService) UpdatePaymentStatus(_ context.Context, id string) (domain.RoundEvent, error) {
|
func (s *covenantService) UpdatePaymentStatus(_ context.Context, id string) error {
|
||||||
err := s.paymentRequests.updatePingTimestamp(id)
|
return 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) CompleteAsyncPayment(ctx context.Context, redeemTx string) error {
|
func (s *covenantService) CompleteAsyncPayment(ctx context.Context, redeemTx string) error {
|
||||||
|
|||||||
@@ -543,17 +543,8 @@ func (s *covenantlessService) ClaimVtxos(ctx context.Context, creds string, rece
|
|||||||
return s.paymentRequests.update(*payment)
|
return s.paymentRequests.update(*payment)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *covenantlessService) UpdatePaymentStatus(_ context.Context, id string) (domain.RoundEvent, error) {
|
func (s *covenantlessService) UpdatePaymentStatus(_ context.Context, id string) error {
|
||||||
err := s.paymentRequests.updatePingTimestamp(id)
|
return 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) SignVtxos(ctx context.Context, forfeitTxs []string) error {
|
func (s *covenantlessService) SignVtxos(ctx context.Context, forfeitTxs []string) error {
|
||||||
@@ -738,7 +729,7 @@ func (s *covenantlessService) startFinalization() {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
round := s.currentRound
|
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)
|
thirdOfRemainingDuration := time.Duration(roundRemainingDuration / 3)
|
||||||
|
|
||||||
var roundAborted bool
|
var roundAborted bool
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ type Service interface {
|
|||||||
GetRoundById(ctx context.Context, id string) (*domain.Round, error)
|
GetRoundById(ctx context.Context, id string) (*domain.Round, error)
|
||||||
GetCurrentRound(ctx context.Context) (*domain.Round, error)
|
GetCurrentRound(ctx context.Context) (*domain.Round, error)
|
||||||
GetEventsChannel(ctx context.Context) <-chan domain.RoundEvent
|
GetEventsChannel(ctx context.Context) <-chan domain.RoundEvent
|
||||||
UpdatePaymentStatus(
|
UpdatePaymentStatus(ctx context.Context, paymentId string) error
|
||||||
ctx context.Context, paymentId string,
|
|
||||||
) (lastEvent domain.RoundEvent, err error)
|
|
||||||
ListVtxos(
|
ListVtxos(
|
||||||
ctx context.Context, address string,
|
ctx context.Context, address string,
|
||||||
) (spendableVtxos, spentVtxos []domain.Vtxo, err error)
|
) (spendableVtxos, spentVtxos []domain.Vtxo, err error)
|
||||||
|
|||||||
@@ -227,25 +227,19 @@ func (h *handler) SubmitSignedForfeitTxs(
|
|||||||
func (h *handler) GetEventStream(
|
func (h *handler) GetEventStream(
|
||||||
_ *arkv1.GetEventStreamRequest, stream arkv1.ArkService_GetEventStreamServer,
|
_ *arkv1.GetEventStreamRequest, stream arkv1.ArkService_GetEventStreamServer,
|
||||||
) error {
|
) error {
|
||||||
doneCh := make(chan struct{})
|
|
||||||
|
|
||||||
listener := &listener[*arkv1.GetEventStreamResponse]{
|
listener := &listener[*arkv1.GetEventStreamResponse]{
|
||||||
id: uuid.NewString(),
|
id: uuid.NewString(),
|
||||||
done: doneCh,
|
ch: make(chan *arkv1.GetEventStreamResponse),
|
||||||
ch: make(chan *arkv1.GetEventStreamResponse),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h.eventsListenerHandler.pushListener(listener)
|
h.eventsListenerHandler.pushListener(listener)
|
||||||
defer h.eventsListenerHandler.removeListener(listener.id)
|
defer h.eventsListenerHandler.removeListener(listener.id)
|
||||||
defer close(listener.ch)
|
defer close(listener.ch)
|
||||||
defer close(doneCh)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stream.Context().Done():
|
case <-stream.Context().Done():
|
||||||
return nil
|
return nil
|
||||||
case <-doneCh:
|
|
||||||
return nil
|
|
||||||
case ev := <-listener.ch:
|
case ev := <-listener.ch:
|
||||||
if err := stream.Send(ev); err != nil {
|
if err := stream.Send(ev); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -261,78 +255,11 @@ func (h *handler) Ping(
|
|||||||
return nil, status.Error(codes.InvalidArgument, "missing payment id")
|
return nil, status.Error(codes.InvalidArgument, "missing payment id")
|
||||||
}
|
}
|
||||||
|
|
||||||
lastEvent, err := h.svc.UpdatePaymentStatus(ctx, req.GetPaymentId())
|
if err := h.svc.UpdatePaymentStatus(ctx, req.GetPaymentId()); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var resp *arkv1.PingResponse
|
return &arkv1.PingResponse{}, nil
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) CreatePayment(
|
func (h *handler) CreatePayment(
|
||||||
@@ -483,9 +410,8 @@ func (h *handler) GetTransactionsStream(
|
|||||||
stream arkv1.ArkService_GetTransactionsStreamServer,
|
stream arkv1.ArkService_GetTransactionsStreamServer,
|
||||||
) error {
|
) error {
|
||||||
listener := &listener[*arkv1.GetTransactionsStreamResponse]{
|
listener := &listener[*arkv1.GetTransactionsStreamResponse]{
|
||||||
id: uuid.NewString(),
|
id: uuid.NewString(),
|
||||||
done: make(chan struct{}),
|
ch: make(chan *arkv1.GetTransactionsStreamResponse),
|
||||||
ch: make(chan *arkv1.GetTransactionsStreamResponse),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h.transactionsListenerHandler.pushListener(listener)
|
h.transactionsListenerHandler.pushListener(listener)
|
||||||
@@ -512,7 +438,6 @@ func (h *handler) listenToEvents() {
|
|||||||
channel := h.svc.GetEventsChannel(context.Background())
|
channel := h.svc.GetEventsChannel(context.Background())
|
||||||
for event := range channel {
|
for event := range channel {
|
||||||
var ev *arkv1.GetEventStreamResponse
|
var ev *arkv1.GetEventStreamResponse
|
||||||
shouldClose := false
|
|
||||||
|
|
||||||
switch e := event.(type) {
|
switch e := event.(type) {
|
||||||
case domain.RoundFinalizationStarted:
|
case domain.RoundFinalizationStarted:
|
||||||
@@ -528,7 +453,6 @@ func (h *handler) listenToEvents() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
case domain.RoundFinalized:
|
case domain.RoundFinalized:
|
||||||
shouldClose = true
|
|
||||||
ev = &arkv1.GetEventStreamResponse{
|
ev = &arkv1.GetEventStreamResponse{
|
||||||
Event: &arkv1.GetEventStreamResponse_RoundFinalized{
|
Event: &arkv1.GetEventStreamResponse_RoundFinalized{
|
||||||
RoundFinalized: &arkv1.RoundFinalizedEvent{
|
RoundFinalized: &arkv1.RoundFinalizedEvent{
|
||||||
@@ -538,7 +462,6 @@ func (h *handler) listenToEvents() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
case domain.RoundFailed:
|
case domain.RoundFailed:
|
||||||
shouldClose = true
|
|
||||||
ev = &arkv1.GetEventStreamResponse{
|
ev = &arkv1.GetEventStreamResponse{
|
||||||
Event: &arkv1.GetEventStreamResponse_RoundFailed{
|
Event: &arkv1.GetEventStreamResponse_RoundFailed{
|
||||||
RoundFailed: &arkv1.RoundFailed{
|
RoundFailed: &arkv1.RoundFailed{
|
||||||
@@ -586,9 +509,6 @@ func (h *handler) listenToEvents() {
|
|||||||
for _, l := range h.eventsListenerHandler.listeners {
|
for _, l := range h.eventsListenerHandler.listeners {
|
||||||
go func(l *listener[*arkv1.GetEventStreamResponse]) {
|
go func(l *listener[*arkv1.GetEventStreamResponse]) {
|
||||||
l.ch <- ev
|
l.ch <- ev
|
||||||
if shouldClose {
|
|
||||||
l.done <- struct{}{}
|
|
||||||
}
|
|
||||||
}(l)
|
}(l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -644,9 +564,8 @@ func convertAsyncPaymentEvent(e application.RedeemTransactionEvent) *arkv1.Redee
|
|||||||
}
|
}
|
||||||
|
|
||||||
type listener[T any] struct {
|
type listener[T any] struct {
|
||||||
id string
|
id string
|
||||||
done chan struct{}
|
ch chan T
|
||||||
ch chan T
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type listenerHanlder[T any] struct {
|
type listenerHanlder[T any] struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user