mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 12:44:19 +01:00
API Renaming (#334)
* Update service.proto Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com> * Update buf.yaml * Fix API order and naming * Update server * Update sdk * Revert update to buf.yaml * Fix permissions --------- Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com> Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7676b3ddd2
commit
f36a747c59
@@ -48,37 +48,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/events": {
|
||||
"get": {
|
||||
"operationId": "ArkService_GetEventStream",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.(streaming responses)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/definitions/v1GetEventStreamResponse"
|
||||
},
|
||||
"error": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
},
|
||||
"title": "Stream result of v1GetEventStreamResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/info": {
|
||||
"get": {
|
||||
"operationId": "ArkService_GetInfo",
|
||||
@@ -133,38 +102,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment/claim": {
|
||||
"post": {
|
||||
"operationId": "ArkService_ClaimPayment",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1ClaimPaymentResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1ClaimPaymentRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment/complete": {
|
||||
"post": {
|
||||
"operationId": "ArkService_CompletePayment",
|
||||
@@ -197,14 +134,45 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment/finalize": {
|
||||
"post": {
|
||||
"operationId": "ArkService_FinalizePayment",
|
||||
"/v1/round/events": {
|
||||
"get": {
|
||||
"operationId": "ArkService_GetEventStream",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.(streaming responses)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"result": {
|
||||
"$ref": "#/definitions/v1GetEventStreamResponse"
|
||||
},
|
||||
"error": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
},
|
||||
"title": "Stream result of v1GetEventStreamResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/round/id/{id}": {
|
||||
"get": {
|
||||
"operationId": "ArkService_GetRoundById",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1FinalizePaymentResponse"
|
||||
"$ref": "#/definitions/v1GetRoundByIdResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
@@ -216,12 +184,10 @@
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1FinalizePaymentRequest"
|
||||
}
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
@@ -229,103 +195,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment/register": {
|
||||
"post": {
|
||||
"operationId": "ArkService_RegisterPayment",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1RegisterPaymentResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1RegisterPaymentRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment/tree/nonces": {
|
||||
"post": {
|
||||
"operationId": "ArkService_SendTreeNonces",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SendTreeNoncesResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SendTreeNoncesRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/payment/tree/signatures": {
|
||||
"post": {
|
||||
"operationId": "ArkService_SendTreeSignatures",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SendTreeSignaturesResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SendTreeSignaturesRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/ping/{paymentId}": {
|
||||
"/v1/round/ping/{paymentId}": {
|
||||
"get": {
|
||||
"operationId": "ArkService_Ping",
|
||||
"responses": {
|
||||
@@ -355,14 +225,14 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/round/id/{id}": {
|
||||
"get": {
|
||||
"operationId": "ArkService_GetRoundById",
|
||||
"/v1/round/registerInputs": {
|
||||
"post": {
|
||||
"operationId": "ArkService_RegisterInputsForNextRound",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1GetRoundByIdResponse"
|
||||
"$ref": "#/definitions/v1RegisterInputsForNextRoundResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
@@ -374,10 +244,140 @@
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1RegisterInputsForNextRoundRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/round/registerOutputs": {
|
||||
"post": {
|
||||
"operationId": "ArkService_RegisterOutputsForNextRound",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1RegisterOutputsForNextRoundResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1RegisterOutputsForNextRoundRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/round/submitForfeitTxs": {
|
||||
"post": {
|
||||
"operationId": "ArkService_SubmitSignedForfeitTxs",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SubmitSignedForfeitTxsResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SubmitSignedForfeitTxsRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/round/tree/submitNonces": {
|
||||
"post": {
|
||||
"operationId": "ArkService_SubmitTreeNonces",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SubmitTreeNoncesResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SubmitTreeNoncesRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"ArkService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/round/tree/submitSignatures": {
|
||||
"post": {
|
||||
"operationId": "ArkService_SubmitTreeSignatures",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SubmitTreeSignaturesResponse"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1SubmitTreeSignaturesRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
@@ -475,26 +475,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1ClaimPaymentRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Mocks wabisabi's credentials."
|
||||
},
|
||||
"outputs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/v1Output"
|
||||
},
|
||||
"description": "List of receivers for a registered payment."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1ClaimPaymentResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"v1CompletePaymentRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -546,25 +526,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1FinalizePaymentRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"signedForfeitTxs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Forfeit txs signed by the user."
|
||||
},
|
||||
"signedRoundTx": {
|
||||
"type": "string",
|
||||
"description": "If payment has boarding input, the user must sign the associated inputs."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1FinalizePaymentResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"v1GetBoardingAddressRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -632,6 +593,12 @@
|
||||
"boardingDescriptorTemplate": {
|
||||
"type": "string"
|
||||
},
|
||||
"vtxoDescriptorTemplates": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"forfeitAddress": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -714,16 +681,15 @@
|
||||
"properties": {
|
||||
"address": {
|
||||
"type": "string",
|
||||
"title": "onchain"
|
||||
},
|
||||
"descriptor": {
|
||||
"type": "string",
|
||||
"title": "offchain"
|
||||
"title": "onchain or off-chain"
|
||||
},
|
||||
"amount": {
|
||||
"type": "string",
|
||||
"format": "uint64",
|
||||
"description": "Amount to send in satoshis."
|
||||
},
|
||||
"descriptor": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -761,7 +727,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1RegisterPaymentRequest": {
|
||||
"v1RegisterInputsForNextRoundRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"inputs": {
|
||||
@@ -776,15 +742,35 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1RegisterPaymentResponse": {
|
||||
"v1RegisterInputsForNextRoundResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Mocks wabisabi's credentials."
|
||||
"description": "Mocks wabisabi's blinded credentials."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1RegisterOutputsForNextRoundRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Mocks wabisabi's blinded credentials."
|
||||
},
|
||||
"outputs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/v1Output"
|
||||
},
|
||||
"description": "List of receivers for a registered payment."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1RegisterOutputsForNextRoundResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"v1Round": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -910,7 +896,26 @@
|
||||
],
|
||||
"default": "ROUND_STAGE_UNSPECIFIED"
|
||||
},
|
||||
"v1SendTreeNoncesRequest": {
|
||||
"v1SubmitSignedForfeitTxsRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"signedForfeitTxs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Forfeit txs signed by the user."
|
||||
},
|
||||
"signedRoundTx": {
|
||||
"type": "string",
|
||||
"description": "If payment has boarding input, the user must sign the associated inputs."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1SubmitSignedForfeitTxsResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"v1SubmitTreeNoncesRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"roundId": {
|
||||
@@ -924,10 +929,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1SendTreeNoncesResponse": {
|
||||
"v1SubmitTreeNoncesResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"v1SendTreeSignaturesRequest": {
|
||||
"v1SubmitTreeSignaturesRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"roundId": {
|
||||
@@ -941,7 +946,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1SendTreeSignaturesResponse": {
|
||||
"v1SubmitTreeSignaturesResponse": {
|
||||
"type": "object"
|
||||
},
|
||||
"v1Tree": {
|
||||
|
||||
@@ -5,61 +5,6 @@ package ark.v1;
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service ArkService {
|
||||
rpc RegisterPayment(RegisterPaymentRequest) returns (RegisterPaymentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/payment/register"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc ClaimPayment(ClaimPaymentRequest) returns (ClaimPaymentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/payment/claim"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc SendTreeNonces(SendTreeNoncesRequest) returns (SendTreeNoncesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/payment/tree/nonces"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc SendTreeSignatures(SendTreeSignaturesRequest) returns (SendTreeSignaturesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/payment/tree/signatures"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc FinalizePayment(FinalizePaymentRequest) returns (FinalizePaymentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/payment/finalize"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetRound(GetRoundRequest) returns (GetRoundResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/round/{txid}"
|
||||
};
|
||||
};
|
||||
rpc GetRoundById(GetRoundByIdRequest) returns (GetRoundByIdResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/round/id/{id}"
|
||||
};
|
||||
};
|
||||
rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/events"
|
||||
};
|
||||
};
|
||||
rpc Ping(PingRequest) returns (PingResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/ping/{payment_id}"
|
||||
};
|
||||
};
|
||||
rpc ListVtxos(ListVtxosRequest) returns (ListVtxosResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/vtxos/{address}"
|
||||
};
|
||||
}
|
||||
rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/info"
|
||||
@@ -71,6 +16,52 @@ service ArkService {
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
|
||||
/* In-Round Payment APIs */
|
||||
|
||||
rpc RegisterInputsForNextRound(RegisterInputsForNextRoundRequest) returns (RegisterInputsForNextRoundResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/round/registerInputs"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc RegisterOutputsForNextRound(RegisterOutputsForNextRoundRequest) returns (RegisterOutputsForNextRoundResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/round/registerOutputs"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc SubmitTreeNonces(SubmitTreeNoncesRequest) returns (SubmitTreeNoncesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/round/tree/submitNonces"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc SubmitTreeSignatures(SubmitTreeSignaturesRequest) returns (SubmitTreeSignaturesResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/round/tree/submitSignatures"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
rpc SubmitSignedForfeitTxs(SubmitSignedForfeitTxsRequest) returns (SubmitSignedForfeitTxsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/round/submitForfeitTxs"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/round/events"
|
||||
};
|
||||
};
|
||||
rpc Ping(PingRequest) returns (PingResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/round/ping/{payment_id}"
|
||||
};
|
||||
};
|
||||
|
||||
/* Async Payment APIs */
|
||||
|
||||
rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/v1/payment"
|
||||
@@ -83,70 +74,87 @@ service ArkService {
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
/* Explorer-like APIs */
|
||||
|
||||
rpc GetRound(GetRoundRequest) returns (GetRoundResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/round/{txid}"
|
||||
};
|
||||
};
|
||||
rpc GetRoundById(GetRoundByIdRequest) returns (GetRoundByIdResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/round/id/{id}"
|
||||
};
|
||||
};
|
||||
rpc ListVtxos(ListVtxosRequest) returns (ListVtxosResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/vtxos/{address}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message CreatePaymentRequest {
|
||||
repeated Input inputs = 1;
|
||||
repeated Output outputs = 2;
|
||||
message GetInfoRequest {}
|
||||
message GetInfoResponse {
|
||||
string pubkey = 1;
|
||||
int64 round_lifetime = 2;
|
||||
int64 unilateral_exit_delay = 3;
|
||||
int64 round_interval = 4;
|
||||
string network = 5;
|
||||
int64 dust = 6;
|
||||
string boarding_descriptor_template = 7;
|
||||
repeated string vtxo_descriptor_templates = 8;
|
||||
string forfeit_address = 9;
|
||||
}
|
||||
message CreatePaymentResponse {
|
||||
string signed_redeem_tx = 1; // signed only by the ASP
|
||||
repeated string usigned_unconditional_forfeit_txs = 2;
|
||||
}
|
||||
|
||||
message CompletePaymentRequest {
|
||||
string signed_redeem_tx = 1;
|
||||
repeated string signed_unconditional_forfeit_txs = 2;
|
||||
}
|
||||
message CompletePaymentResponse {}
|
||||
|
||||
message GetBoardingAddressRequest {
|
||||
string pubkey = 1;
|
||||
}
|
||||
|
||||
message GetBoardingAddressResponse {
|
||||
string address = 1;
|
||||
string descriptor = 2;
|
||||
}
|
||||
|
||||
message RegisterPaymentRequest {
|
||||
/* In-Round Payment API messages */
|
||||
|
||||
message RegisterInputsForNextRoundRequest {
|
||||
repeated Input inputs = 1;
|
||||
optional string ephemeral_pubkey = 2;
|
||||
}
|
||||
message RegisterPaymentResponse {
|
||||
// Mocks wabisabi's credentials.
|
||||
message RegisterInputsForNextRoundResponse {
|
||||
// Mocks wabisabi's blinded credentials.
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message ClaimPaymentRequest {
|
||||
// Mocks wabisabi's credentials.
|
||||
message RegisterOutputsForNextRoundRequest {
|
||||
// Mocks wabisabi's blinded credentials.
|
||||
string id = 1;
|
||||
// List of receivers for a registered payment.
|
||||
repeated Output outputs = 2;
|
||||
}
|
||||
message ClaimPaymentResponse {}
|
||||
message RegisterOutputsForNextRoundResponse {}
|
||||
|
||||
message FinalizePaymentRequest {
|
||||
message SubmitTreeNoncesRequest {
|
||||
string round_id = 1;
|
||||
string public_key = 2;
|
||||
string tree_nonces = 3;
|
||||
}
|
||||
message SubmitTreeNoncesResponse {}
|
||||
|
||||
message SubmitTreeSignaturesRequest {
|
||||
string round_id = 1;
|
||||
string public_key = 2;
|
||||
string tree_signatures = 3;
|
||||
}
|
||||
message SubmitTreeSignaturesResponse {}
|
||||
|
||||
message SubmitSignedForfeitTxsRequest {
|
||||
// Forfeit txs signed by the user.
|
||||
repeated string signed_forfeit_txs = 1;
|
||||
// If payment has boarding input, the user must sign the associated inputs.
|
||||
optional string signed_round_tx = 2;
|
||||
}
|
||||
message FinalizePaymentResponse {}
|
||||
|
||||
message GetRoundRequest {
|
||||
string txid = 1;
|
||||
}
|
||||
message GetRoundResponse {
|
||||
Round round = 1;
|
||||
}
|
||||
|
||||
message GetRoundByIdRequest {
|
||||
string id = 1;
|
||||
}
|
||||
message GetRoundByIdResponse {
|
||||
Round round = 1;
|
||||
}
|
||||
message SubmitSignedForfeitTxsResponse {}
|
||||
|
||||
message GetEventStreamRequest {}
|
||||
message GetEventStreamResponse {
|
||||
@@ -172,6 +180,39 @@ message PingResponse {
|
||||
}
|
||||
}
|
||||
|
||||
/* Async Payment API messages */
|
||||
|
||||
message CreatePaymentRequest {
|
||||
repeated Input inputs = 1;
|
||||
repeated Output outputs = 2;
|
||||
}
|
||||
message CreatePaymentResponse {
|
||||
string signed_redeem_tx = 1; // signed only by the ASP
|
||||
repeated string usigned_unconditional_forfeit_txs = 2;
|
||||
}
|
||||
|
||||
message CompletePaymentRequest {
|
||||
string signed_redeem_tx = 1;
|
||||
repeated string signed_unconditional_forfeit_txs = 2;
|
||||
}
|
||||
message CompletePaymentResponse {}
|
||||
|
||||
/* Explorer-like API messages */
|
||||
|
||||
message GetRoundRequest {
|
||||
string txid = 1;
|
||||
}
|
||||
message GetRoundResponse {
|
||||
Round round = 1;
|
||||
}
|
||||
|
||||
message GetRoundByIdRequest {
|
||||
string id = 1;
|
||||
}
|
||||
message GetRoundByIdResponse {
|
||||
Round round = 1;
|
||||
}
|
||||
|
||||
message ListVtxosRequest {
|
||||
string address = 1;
|
||||
}
|
||||
@@ -180,19 +221,7 @@ message ListVtxosResponse {
|
||||
repeated Vtxo spent_vtxos = 2;
|
||||
}
|
||||
|
||||
message GetInfoRequest {}
|
||||
message GetInfoResponse {
|
||||
string pubkey = 1;
|
||||
int64 round_lifetime = 2;
|
||||
int64 unilateral_exit_delay = 3;
|
||||
int64 round_interval = 4;
|
||||
string network = 5;
|
||||
int64 dust = 6;
|
||||
string boarding_descriptor_template = 7;
|
||||
string forfeit_address = 8;
|
||||
}
|
||||
|
||||
// EVENT TYPES
|
||||
/* Events */
|
||||
|
||||
message RoundFinalizationEvent {
|
||||
string id = 1;
|
||||
@@ -224,7 +253,7 @@ message RoundSigningNoncesGeneratedEvent {
|
||||
string tree_nonces = 2;
|
||||
}
|
||||
|
||||
// TYPES
|
||||
/* Types */
|
||||
|
||||
enum RoundStage {
|
||||
ROUND_STAGE_UNSPECIFIED = 0;
|
||||
@@ -256,12 +285,9 @@ message Input {
|
||||
}
|
||||
|
||||
message Output {
|
||||
oneof destination {
|
||||
string address = 1; // onchain
|
||||
string descriptor = 2; // offchain
|
||||
}
|
||||
// Amount to send in satoshis.
|
||||
uint64 amount = 3;
|
||||
string address = 1; // onchain or off-chain
|
||||
uint64 amount = 2; // Amount to send in satoshis.
|
||||
string descriptor = 3;
|
||||
}
|
||||
|
||||
message Tree {
|
||||
@@ -295,19 +321,3 @@ message PendingPayment {
|
||||
string redeem_tx = 1;
|
||||
repeated string unconditional_forfeit_txs =2;
|
||||
}
|
||||
|
||||
message SendTreeNoncesRequest {
|
||||
string round_id = 1;
|
||||
string public_key = 2;
|
||||
string tree_nonces = 3;
|
||||
}
|
||||
|
||||
message SendTreeNoncesResponse {}
|
||||
|
||||
message SendTreeSignaturesRequest {
|
||||
string round_id = 1;
|
||||
string public_key = 2;
|
||||
string tree_signatures = 3;
|
||||
}
|
||||
|
||||
message SendTreeSignaturesResponse {}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -18,20 +18,20 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ArkServiceClient interface {
|
||||
RegisterPayment(ctx context.Context, in *RegisterPaymentRequest, opts ...grpc.CallOption) (*RegisterPaymentResponse, error)
|
||||
ClaimPayment(ctx context.Context, in *ClaimPaymentRequest, opts ...grpc.CallOption) (*ClaimPaymentResponse, error)
|
||||
SendTreeNonces(ctx context.Context, in *SendTreeNoncesRequest, opts ...grpc.CallOption) (*SendTreeNoncesResponse, error)
|
||||
SendTreeSignatures(ctx context.Context, in *SendTreeSignaturesRequest, opts ...grpc.CallOption) (*SendTreeSignaturesResponse, error)
|
||||
FinalizePayment(ctx context.Context, in *FinalizePaymentRequest, opts ...grpc.CallOption) (*FinalizePaymentResponse, error)
|
||||
GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error)
|
||||
GetRoundById(ctx context.Context, in *GetRoundByIdRequest, opts ...grpc.CallOption) (*GetRoundByIdResponse, error)
|
||||
GetEventStream(ctx context.Context, in *GetEventStreamRequest, opts ...grpc.CallOption) (ArkService_GetEventStreamClient, error)
|
||||
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
|
||||
ListVtxos(ctx context.Context, in *ListVtxosRequest, opts ...grpc.CallOption) (*ListVtxosResponse, error)
|
||||
GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error)
|
||||
GetBoardingAddress(ctx context.Context, in *GetBoardingAddressRequest, opts ...grpc.CallOption) (*GetBoardingAddressResponse, error)
|
||||
RegisterInputsForNextRound(ctx context.Context, in *RegisterInputsForNextRoundRequest, opts ...grpc.CallOption) (*RegisterInputsForNextRoundResponse, error)
|
||||
RegisterOutputsForNextRound(ctx context.Context, in *RegisterOutputsForNextRoundRequest, opts ...grpc.CallOption) (*RegisterOutputsForNextRoundResponse, error)
|
||||
SubmitTreeNonces(ctx context.Context, in *SubmitTreeNoncesRequest, opts ...grpc.CallOption) (*SubmitTreeNoncesResponse, error)
|
||||
SubmitTreeSignatures(ctx context.Context, in *SubmitTreeSignaturesRequest, opts ...grpc.CallOption) (*SubmitTreeSignaturesResponse, error)
|
||||
SubmitSignedForfeitTxs(ctx context.Context, in *SubmitSignedForfeitTxsRequest, opts ...grpc.CallOption) (*SubmitSignedForfeitTxsResponse, error)
|
||||
GetEventStream(ctx context.Context, in *GetEventStreamRequest, opts ...grpc.CallOption) (ArkService_GetEventStreamClient, error)
|
||||
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error)
|
||||
CreatePayment(ctx context.Context, in *CreatePaymentRequest, opts ...grpc.CallOption) (*CreatePaymentResponse, error)
|
||||
CompletePayment(ctx context.Context, in *CompletePaymentRequest, opts ...grpc.CallOption) (*CompletePaymentResponse, error)
|
||||
GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error)
|
||||
GetRoundById(ctx context.Context, in *GetRoundByIdRequest, opts ...grpc.CallOption) (*GetRoundByIdResponse, error)
|
||||
ListVtxos(ctx context.Context, in *ListVtxosRequest, opts ...grpc.CallOption) (*ListVtxosResponse, error)
|
||||
}
|
||||
|
||||
type arkServiceClient struct {
|
||||
@@ -42,63 +42,63 @@ func NewArkServiceClient(cc grpc.ClientConnInterface) ArkServiceClient {
|
||||
return &arkServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) RegisterPayment(ctx context.Context, in *RegisterPaymentRequest, opts ...grpc.CallOption) (*RegisterPaymentResponse, error) {
|
||||
out := new(RegisterPaymentResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/RegisterPayment", in, out, opts...)
|
||||
func (c *arkServiceClient) GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) {
|
||||
out := new(GetInfoResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) ClaimPayment(ctx context.Context, in *ClaimPaymentRequest, opts ...grpc.CallOption) (*ClaimPaymentResponse, error) {
|
||||
out := new(ClaimPaymentResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/ClaimPayment", in, out, opts...)
|
||||
func (c *arkServiceClient) GetBoardingAddress(ctx context.Context, in *GetBoardingAddressRequest, opts ...grpc.CallOption) (*GetBoardingAddressResponse, error) {
|
||||
out := new(GetBoardingAddressResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetBoardingAddress", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) SendTreeNonces(ctx context.Context, in *SendTreeNoncesRequest, opts ...grpc.CallOption) (*SendTreeNoncesResponse, error) {
|
||||
out := new(SendTreeNoncesResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/SendTreeNonces", in, out, opts...)
|
||||
func (c *arkServiceClient) RegisterInputsForNextRound(ctx context.Context, in *RegisterInputsForNextRoundRequest, opts ...grpc.CallOption) (*RegisterInputsForNextRoundResponse, error) {
|
||||
out := new(RegisterInputsForNextRoundResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/RegisterInputsForNextRound", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) SendTreeSignatures(ctx context.Context, in *SendTreeSignaturesRequest, opts ...grpc.CallOption) (*SendTreeSignaturesResponse, error) {
|
||||
out := new(SendTreeSignaturesResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/SendTreeSignatures", in, out, opts...)
|
||||
func (c *arkServiceClient) RegisterOutputsForNextRound(ctx context.Context, in *RegisterOutputsForNextRoundRequest, opts ...grpc.CallOption) (*RegisterOutputsForNextRoundResponse, error) {
|
||||
out := new(RegisterOutputsForNextRoundResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/RegisterOutputsForNextRound", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) FinalizePayment(ctx context.Context, in *FinalizePaymentRequest, opts ...grpc.CallOption) (*FinalizePaymentResponse, error) {
|
||||
out := new(FinalizePaymentResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/FinalizePayment", in, out, opts...)
|
||||
func (c *arkServiceClient) SubmitTreeNonces(ctx context.Context, in *SubmitTreeNoncesRequest, opts ...grpc.CallOption) (*SubmitTreeNoncesResponse, error) {
|
||||
out := new(SubmitTreeNoncesResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/SubmitTreeNonces", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error) {
|
||||
out := new(GetRoundResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetRound", in, out, opts...)
|
||||
func (c *arkServiceClient) SubmitTreeSignatures(ctx context.Context, in *SubmitTreeSignaturesRequest, opts ...grpc.CallOption) (*SubmitTreeSignaturesResponse, error) {
|
||||
out := new(SubmitTreeSignaturesResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/SubmitTreeSignatures", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) GetRoundById(ctx context.Context, in *GetRoundByIdRequest, opts ...grpc.CallOption) (*GetRoundByIdResponse, error) {
|
||||
out := new(GetRoundByIdResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetRoundById", in, out, opts...)
|
||||
func (c *arkServiceClient) SubmitSignedForfeitTxs(ctx context.Context, in *SubmitSignedForfeitTxsRequest, opts ...grpc.CallOption) (*SubmitSignedForfeitTxsResponse, error) {
|
||||
out := new(SubmitSignedForfeitTxsResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/SubmitSignedForfeitTxs", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -146,33 +146,6 @@ func (c *arkServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...gr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) ListVtxos(ctx context.Context, in *ListVtxosRequest, opts ...grpc.CallOption) (*ListVtxosResponse, error) {
|
||||
out := new(ListVtxosResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/ListVtxos", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) {
|
||||
out := new(GetInfoResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) GetBoardingAddress(ctx context.Context, in *GetBoardingAddressRequest, opts ...grpc.CallOption) (*GetBoardingAddressResponse, error) {
|
||||
out := new(GetBoardingAddressResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetBoardingAddress", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) CreatePayment(ctx context.Context, in *CreatePaymentRequest, opts ...grpc.CallOption) (*CreatePaymentResponse, error) {
|
||||
out := new(CreatePaymentResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/CreatePayment", in, out, opts...)
|
||||
@@ -191,50 +164,77 @@ func (c *arkServiceClient) CompletePayment(ctx context.Context, in *CompletePaym
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) GetRound(ctx context.Context, in *GetRoundRequest, opts ...grpc.CallOption) (*GetRoundResponse, error) {
|
||||
out := new(GetRoundResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetRound", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) GetRoundById(ctx context.Context, in *GetRoundByIdRequest, opts ...grpc.CallOption) (*GetRoundByIdResponse, error) {
|
||||
out := new(GetRoundByIdResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/GetRoundById", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *arkServiceClient) ListVtxos(ctx context.Context, in *ListVtxosRequest, opts ...grpc.CallOption) (*ListVtxosResponse, error) {
|
||||
out := new(ListVtxosResponse)
|
||||
err := c.cc.Invoke(ctx, "/ark.v1.ArkService/ListVtxos", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ArkServiceServer is the server API for ArkService service.
|
||||
// All implementations should embed UnimplementedArkServiceServer
|
||||
// for forward compatibility
|
||||
type ArkServiceServer interface {
|
||||
RegisterPayment(context.Context, *RegisterPaymentRequest) (*RegisterPaymentResponse, error)
|
||||
ClaimPayment(context.Context, *ClaimPaymentRequest) (*ClaimPaymentResponse, error)
|
||||
SendTreeNonces(context.Context, *SendTreeNoncesRequest) (*SendTreeNoncesResponse, error)
|
||||
SendTreeSignatures(context.Context, *SendTreeSignaturesRequest) (*SendTreeSignaturesResponse, error)
|
||||
FinalizePayment(context.Context, *FinalizePaymentRequest) (*FinalizePaymentResponse, error)
|
||||
GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error)
|
||||
GetRoundById(context.Context, *GetRoundByIdRequest) (*GetRoundByIdResponse, error)
|
||||
GetEventStream(*GetEventStreamRequest, ArkService_GetEventStreamServer) error
|
||||
Ping(context.Context, *PingRequest) (*PingResponse, error)
|
||||
ListVtxos(context.Context, *ListVtxosRequest) (*ListVtxosResponse, error)
|
||||
GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error)
|
||||
GetBoardingAddress(context.Context, *GetBoardingAddressRequest) (*GetBoardingAddressResponse, error)
|
||||
RegisterInputsForNextRound(context.Context, *RegisterInputsForNextRoundRequest) (*RegisterInputsForNextRoundResponse, error)
|
||||
RegisterOutputsForNextRound(context.Context, *RegisterOutputsForNextRoundRequest) (*RegisterOutputsForNextRoundResponse, error)
|
||||
SubmitTreeNonces(context.Context, *SubmitTreeNoncesRequest) (*SubmitTreeNoncesResponse, error)
|
||||
SubmitTreeSignatures(context.Context, *SubmitTreeSignaturesRequest) (*SubmitTreeSignaturesResponse, error)
|
||||
SubmitSignedForfeitTxs(context.Context, *SubmitSignedForfeitTxsRequest) (*SubmitSignedForfeitTxsResponse, error)
|
||||
GetEventStream(*GetEventStreamRequest, ArkService_GetEventStreamServer) error
|
||||
Ping(context.Context, *PingRequest) (*PingResponse, error)
|
||||
CreatePayment(context.Context, *CreatePaymentRequest) (*CreatePaymentResponse, error)
|
||||
CompletePayment(context.Context, *CompletePaymentRequest) (*CompletePaymentResponse, error)
|
||||
GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error)
|
||||
GetRoundById(context.Context, *GetRoundByIdRequest) (*GetRoundByIdResponse, error)
|
||||
ListVtxos(context.Context, *ListVtxosRequest) (*ListVtxosResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedArkServiceServer should be embedded to have forward compatible implementations.
|
||||
type UnimplementedArkServiceServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedArkServiceServer) RegisterPayment(context.Context, *RegisterPaymentRequest) (*RegisterPaymentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterPayment not implemented")
|
||||
func (UnimplementedArkServiceServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) ClaimPayment(context.Context, *ClaimPaymentRequest) (*ClaimPaymentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ClaimPayment not implemented")
|
||||
func (UnimplementedArkServiceServer) GetBoardingAddress(context.Context, *GetBoardingAddressRequest) (*GetBoardingAddressResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBoardingAddress not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) SendTreeNonces(context.Context, *SendTreeNoncesRequest) (*SendTreeNoncesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendTreeNonces not implemented")
|
||||
func (UnimplementedArkServiceServer) RegisterInputsForNextRound(context.Context, *RegisterInputsForNextRoundRequest) (*RegisterInputsForNextRoundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterInputsForNextRound not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) SendTreeSignatures(context.Context, *SendTreeSignaturesRequest) (*SendTreeSignaturesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendTreeSignatures not implemented")
|
||||
func (UnimplementedArkServiceServer) RegisterOutputsForNextRound(context.Context, *RegisterOutputsForNextRoundRequest) (*RegisterOutputsForNextRoundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterOutputsForNextRound not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) FinalizePayment(context.Context, *FinalizePaymentRequest) (*FinalizePaymentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method FinalizePayment not implemented")
|
||||
func (UnimplementedArkServiceServer) SubmitTreeNonces(context.Context, *SubmitTreeNoncesRequest) (*SubmitTreeNoncesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitTreeNonces not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRound not implemented")
|
||||
func (UnimplementedArkServiceServer) SubmitTreeSignatures(context.Context, *SubmitTreeSignaturesRequest) (*SubmitTreeSignaturesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitTreeSignatures not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetRoundById(context.Context, *GetRoundByIdRequest) (*GetRoundByIdResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRoundById not implemented")
|
||||
func (UnimplementedArkServiceServer) SubmitSignedForfeitTxs(context.Context, *SubmitSignedForfeitTxsRequest) (*SubmitSignedForfeitTxsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubmitSignedForfeitTxs not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetEventStream(*GetEventStreamRequest, ArkService_GetEventStreamServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method GetEventStream not implemented")
|
||||
@@ -242,21 +242,21 @@ func (UnimplementedArkServiceServer) GetEventStream(*GetEventStreamRequest, ArkS
|
||||
func (UnimplementedArkServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) ListVtxos(context.Context, *ListVtxosRequest) (*ListVtxosResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListVtxos not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetBoardingAddress(context.Context, *GetBoardingAddressRequest) (*GetBoardingAddressResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetBoardingAddress not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) CreatePayment(context.Context, *CreatePaymentRequest) (*CreatePaymentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreatePayment not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) CompletePayment(context.Context, *CompletePaymentRequest) (*CompletePaymentResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CompletePayment not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetRound(context.Context, *GetRoundRequest) (*GetRoundResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRound not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) GetRoundById(context.Context, *GetRoundByIdRequest) (*GetRoundByIdResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRoundById not implemented")
|
||||
}
|
||||
func (UnimplementedArkServiceServer) ListVtxos(context.Context, *ListVtxosRequest) (*ListVtxosResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListVtxos not implemented")
|
||||
}
|
||||
|
||||
// UnsafeArkServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ArkServiceServer will
|
||||
@@ -269,128 +269,128 @@ func RegisterArkServiceServer(s grpc.ServiceRegistrar, srv ArkServiceServer) {
|
||||
s.RegisterService(&ArkService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ArkService_RegisterPayment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterPaymentRequest)
|
||||
func _ArkService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).RegisterPayment(ctx, in)
|
||||
return srv.(ArkServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/RegisterPayment",
|
||||
FullMethod: "/ark.v1.ArkService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).RegisterPayment(ctx, req.(*RegisterPaymentRequest))
|
||||
return srv.(ArkServiceServer).GetInfo(ctx, req.(*GetInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_ClaimPayment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ClaimPaymentRequest)
|
||||
func _ArkService_GetBoardingAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBoardingAddressRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).ClaimPayment(ctx, in)
|
||||
return srv.(ArkServiceServer).GetBoardingAddress(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/ClaimPayment",
|
||||
FullMethod: "/ark.v1.ArkService/GetBoardingAddress",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).ClaimPayment(ctx, req.(*ClaimPaymentRequest))
|
||||
return srv.(ArkServiceServer).GetBoardingAddress(ctx, req.(*GetBoardingAddressRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_SendTreeNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SendTreeNoncesRequest)
|
||||
func _ArkService_RegisterInputsForNextRound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterInputsForNextRoundRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).SendTreeNonces(ctx, in)
|
||||
return srv.(ArkServiceServer).RegisterInputsForNextRound(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/SendTreeNonces",
|
||||
FullMethod: "/ark.v1.ArkService/RegisterInputsForNextRound",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).SendTreeNonces(ctx, req.(*SendTreeNoncesRequest))
|
||||
return srv.(ArkServiceServer).RegisterInputsForNextRound(ctx, req.(*RegisterInputsForNextRoundRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_SendTreeSignatures_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SendTreeSignaturesRequest)
|
||||
func _ArkService_RegisterOutputsForNextRound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RegisterOutputsForNextRoundRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).SendTreeSignatures(ctx, in)
|
||||
return srv.(ArkServiceServer).RegisterOutputsForNextRound(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/SendTreeSignatures",
|
||||
FullMethod: "/ark.v1.ArkService/RegisterOutputsForNextRound",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).SendTreeSignatures(ctx, req.(*SendTreeSignaturesRequest))
|
||||
return srv.(ArkServiceServer).RegisterOutputsForNextRound(ctx, req.(*RegisterOutputsForNextRoundRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_FinalizePayment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FinalizePaymentRequest)
|
||||
func _ArkService_SubmitTreeNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SubmitTreeNoncesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).FinalizePayment(ctx, in)
|
||||
return srv.(ArkServiceServer).SubmitTreeNonces(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/FinalizePayment",
|
||||
FullMethod: "/ark.v1.ArkService/SubmitTreeNonces",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).FinalizePayment(ctx, req.(*FinalizePaymentRequest))
|
||||
return srv.(ArkServiceServer).SubmitTreeNonces(ctx, req.(*SubmitTreeNoncesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_GetRound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRoundRequest)
|
||||
func _ArkService_SubmitTreeSignatures_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SubmitTreeSignaturesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).GetRound(ctx, in)
|
||||
return srv.(ArkServiceServer).SubmitTreeSignatures(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/GetRound",
|
||||
FullMethod: "/ark.v1.ArkService/SubmitTreeSignatures",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).GetRound(ctx, req.(*GetRoundRequest))
|
||||
return srv.(ArkServiceServer).SubmitTreeSignatures(ctx, req.(*SubmitTreeSignaturesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_GetRoundById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRoundByIdRequest)
|
||||
func _ArkService_SubmitSignedForfeitTxs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SubmitSignedForfeitTxsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).GetRoundById(ctx, in)
|
||||
return srv.(ArkServiceServer).SubmitSignedForfeitTxs(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/GetRoundById",
|
||||
FullMethod: "/ark.v1.ArkService/SubmitSignedForfeitTxs",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).GetRoundById(ctx, req.(*GetRoundByIdRequest))
|
||||
return srv.(ArkServiceServer).SubmitSignedForfeitTxs(ctx, req.(*SubmitSignedForfeitTxsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -434,60 +434,6 @@ func _ArkService_Ping_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_ListVtxos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListVtxosRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).ListVtxos(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/ListVtxos",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).ListVtxos(ctx, req.(*ListVtxosRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).GetInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/GetInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).GetInfo(ctx, req.(*GetInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_GetBoardingAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetBoardingAddressRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).GetBoardingAddress(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/GetBoardingAddress",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).GetBoardingAddress(ctx, req.(*GetBoardingAddressRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_CreatePayment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreatePaymentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -524,6 +470,60 @@ func _ArkService_CompletePayment_Handler(srv interface{}, ctx context.Context, d
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_GetRound_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRoundRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).GetRound(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/GetRound",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).GetRound(ctx, req.(*GetRoundRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_GetRoundById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRoundByIdRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).GetRoundById(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/GetRoundById",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).GetRoundById(ctx, req.(*GetRoundByIdRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ArkService_ListVtxos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListVtxosRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ArkServiceServer).ListVtxos(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/ark.v1.ArkService/ListVtxos",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ArkServiceServer).ListVtxos(ctx, req.(*ListVtxosRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ArkService_ServiceDesc is the grpc.ServiceDesc for ArkService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -532,24 +532,44 @@ var ArkService_ServiceDesc = grpc.ServiceDesc{
|
||||
HandlerType: (*ArkServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "RegisterPayment",
|
||||
Handler: _ArkService_RegisterPayment_Handler,
|
||||
MethodName: "GetInfo",
|
||||
Handler: _ArkService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ClaimPayment",
|
||||
Handler: _ArkService_ClaimPayment_Handler,
|
||||
MethodName: "GetBoardingAddress",
|
||||
Handler: _ArkService_GetBoardingAddress_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendTreeNonces",
|
||||
Handler: _ArkService_SendTreeNonces_Handler,
|
||||
MethodName: "RegisterInputsForNextRound",
|
||||
Handler: _ArkService_RegisterInputsForNextRound_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendTreeSignatures",
|
||||
Handler: _ArkService_SendTreeSignatures_Handler,
|
||||
MethodName: "RegisterOutputsForNextRound",
|
||||
Handler: _ArkService_RegisterOutputsForNextRound_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "FinalizePayment",
|
||||
Handler: _ArkService_FinalizePayment_Handler,
|
||||
MethodName: "SubmitTreeNonces",
|
||||
Handler: _ArkService_SubmitTreeNonces_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SubmitTreeSignatures",
|
||||
Handler: _ArkService_SubmitTreeSignatures_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SubmitSignedForfeitTxs",
|
||||
Handler: _ArkService_SubmitSignedForfeitTxs_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Ping",
|
||||
Handler: _ArkService_Ping_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreatePayment",
|
||||
Handler: _ArkService_CreatePayment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CompletePayment",
|
||||
Handler: _ArkService_CompletePayment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRound",
|
||||
@@ -559,30 +579,10 @@ var ArkService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "GetRoundById",
|
||||
Handler: _ArkService_GetRoundById_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Ping",
|
||||
Handler: _ArkService_Ping_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListVtxos",
|
||||
Handler: _ArkService_ListVtxos_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetInfo",
|
||||
Handler: _ArkService_GetInfo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetBoardingAddress",
|
||||
Handler: _ArkService_GetBoardingAddress_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreatePayment",
|
||||
Handler: _ArkService_CreatePayment_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CompletePayment",
|
||||
Handler: _ArkService_CompletePayment_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
||||
@@ -21,35 +21,34 @@ type RoundEvent interface {
|
||||
|
||||
type ASPClient interface {
|
||||
GetInfo(ctx context.Context) (*Info, error)
|
||||
ListVtxos(ctx context.Context, addr string) ([]Vtxo, []Vtxo, error)
|
||||
GetRound(ctx context.Context, txID string) (*Round, error)
|
||||
GetRoundByID(ctx context.Context, roundID string) (*Round, error)
|
||||
RegisterPayment(
|
||||
RegisterInputsForNextRound(
|
||||
ctx context.Context, inputs []Input, ephemeralKey string,
|
||||
) (string, error)
|
||||
ClaimPayment(
|
||||
RegisterOutputsForNextRound(
|
||||
ctx context.Context, paymentID string, outputs []Output,
|
||||
) error
|
||||
SubmitTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error
|
||||
SubmitTreeSignatures(
|
||||
ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.TreePartialSigs,
|
||||
) error
|
||||
SubmitSignedForfeitTxs(
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error
|
||||
GetEventStream(
|
||||
ctx context.Context, paymentID string,
|
||||
) (<-chan RoundEventChannel, func(), error)
|
||||
Ping(ctx context.Context, paymentID string) (RoundEvent, error)
|
||||
FinalizePayment(
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error
|
||||
CreatePayment(
|
||||
ctx context.Context, inputs []Input, outputs []Output,
|
||||
) (string, []string, error)
|
||||
CompletePayment(
|
||||
ctx context.Context, signedRedeemTx string, signedUnconditionalForfeitTxs []string,
|
||||
) error
|
||||
GetBoardingAddress(ctx context.Context, userPubkey string) (string, error)
|
||||
SendTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error
|
||||
SendTreeSignatures(
|
||||
ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.TreePartialSigs,
|
||||
) error
|
||||
ListVtxos(ctx context.Context, addr string) ([]Vtxo, []Vtxo, error)
|
||||
GetRound(ctx context.Context, txID string) (*Round, error)
|
||||
GetRoundByID(ctx context.Context, roundID string) (*Round, error)
|
||||
Close()
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ import (
|
||||
"github.com/ark-network/ark/common/tree"
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client"
|
||||
"github.com/ark-network/ark/pkg/client-sdk/internal/utils"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/sirupsen/logrus"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
@@ -53,9 +51,126 @@ func NewClient(aspUrl string) (client.ASPClient, error) {
|
||||
return &grpcClient{conn, svc, treeCache}, nil
|
||||
}
|
||||
|
||||
func (c *grpcClient) Close() {
|
||||
//nolint:all
|
||||
c.conn.Close()
|
||||
func (a *grpcClient) GetInfo(ctx context.Context) (*client.Info, error) {
|
||||
req := &arkv1.GetInfoRequest{}
|
||||
resp, err := a.svc.GetInfo(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &client.Info{
|
||||
Pubkey: resp.GetPubkey(),
|
||||
RoundLifetime: resp.GetRoundLifetime(),
|
||||
UnilateralExitDelay: resp.GetUnilateralExitDelay(),
|
||||
RoundInterval: resp.GetRoundInterval(),
|
||||
Network: resp.GetNetwork(),
|
||||
Dust: uint64(resp.GetDust()),
|
||||
BoardingDescriptorTemplate: resp.GetBoardingDescriptorTemplate(),
|
||||
ForfeitAddress: resp.GetForfeitAddress(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetBoardingAddress(
|
||||
ctx context.Context, userPubkey string,
|
||||
) (string, error) {
|
||||
req := &arkv1.GetBoardingAddressRequest{
|
||||
Pubkey: userPubkey,
|
||||
}
|
||||
resp, err := a.svc.GetBoardingAddress(ctx, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.GetAddress(), nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) RegisterInputsForNextRound(
|
||||
ctx context.Context, inputs []client.Input, ephemeralPublicKey string,
|
||||
) (string, error) {
|
||||
req := &arkv1.RegisterInputsForNextRoundRequest{
|
||||
Inputs: ins(inputs).toProto(),
|
||||
}
|
||||
if len(ephemeralPublicKey) > 0 {
|
||||
req.EphemeralPubkey = &ephemeralPublicKey
|
||||
}
|
||||
|
||||
resp, err := a.svc.RegisterInputsForNextRound(ctx, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.GetId(), nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) RegisterOutputsForNextRound(
|
||||
ctx context.Context, paymentID string, outputs []client.Output,
|
||||
) error {
|
||||
req := &arkv1.RegisterOutputsForNextRoundRequest{
|
||||
Id: paymentID,
|
||||
Outputs: outs(outputs).toProto(),
|
||||
}
|
||||
_, err := a.svc.RegisterOutputsForNextRound(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) SubmitTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error {
|
||||
var nonceBuffer bytes.Buffer
|
||||
|
||||
if err := nonces.Encode(&nonceBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedNonces := hex.EncodeToString(nonceBuffer.Bytes())
|
||||
|
||||
req := &arkv1.SubmitTreeNoncesRequest{
|
||||
RoundId: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeNonces: serializedNonces,
|
||||
}
|
||||
|
||||
if _, err := a.svc.SubmitTreeNonces(ctx, req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) SubmitTreeSignatures(
|
||||
ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.TreePartialSigs,
|
||||
) error {
|
||||
var sigsBuffer bytes.Buffer
|
||||
|
||||
if err := signatures.Encode(&sigsBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedSigs := hex.EncodeToString(sigsBuffer.Bytes())
|
||||
|
||||
req := &arkv1.SubmitTreeSignaturesRequest{
|
||||
RoundId: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeSignatures: serializedSigs,
|
||||
}
|
||||
|
||||
if _, err := a.svc.SubmitTreeSignatures(ctx, req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) SubmitSignedForfeitTxs(
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error {
|
||||
req := &arkv1.SubmitSignedForfeitTxsRequest{
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
}
|
||||
|
||||
if len(signedRoundTx) > 0 {
|
||||
req.SignedRoundTx = &signedRoundTx
|
||||
}
|
||||
|
||||
_, err := a.svc.SubmitSignedForfeitTxs(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetEventStream(
|
||||
@@ -103,32 +218,47 @@ func (a *grpcClient) GetEventStream(
|
||||
return eventsCh, closeFn, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetInfo(ctx context.Context) (*client.Info, error) {
|
||||
req := &arkv1.GetInfoRequest{}
|
||||
resp, err := a.svc.GetInfo(ctx, req)
|
||||
func (a *grpcClient) Ping(
|
||||
ctx context.Context, paymentID string,
|
||||
) (client.RoundEvent, error) {
|
||||
req := &arkv1.PingRequest{
|
||||
PaymentId: paymentID,
|
||||
}
|
||||
resp, err := a.svc.Ping(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &client.Info{
|
||||
Pubkey: resp.GetPubkey(),
|
||||
RoundLifetime: resp.GetRoundLifetime(),
|
||||
UnilateralExitDelay: resp.GetUnilateralExitDelay(),
|
||||
RoundInterval: resp.GetRoundInterval(),
|
||||
Network: resp.GetNetwork(),
|
||||
Dust: uint64(resp.GetDust()),
|
||||
BoardingDescriptorTemplate: resp.GetBoardingDescriptorTemplate(),
|
||||
ForfeitAddress: resp.GetForfeitAddress(),
|
||||
}, nil
|
||||
|
||||
if resp.GetEvent() == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return event{resp}.toRoundEvent()
|
||||
}
|
||||
|
||||
func (a *grpcClient) ListVtxos(
|
||||
ctx context.Context, addr string,
|
||||
) ([]client.Vtxo, []client.Vtxo, error) {
|
||||
resp, err := a.svc.ListVtxos(ctx, &arkv1.ListVtxosRequest{Address: addr})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
func (a *grpcClient) CreatePayment(
|
||||
ctx context.Context, inputs []client.Input, outputs []client.Output,
|
||||
) (string, []string, error) {
|
||||
req := &arkv1.CreatePaymentRequest{
|
||||
Inputs: ins(inputs).toProto(),
|
||||
Outputs: outs(outputs).toProto(),
|
||||
}
|
||||
return vtxos(resp.GetSpendableVtxos()).toVtxos(), vtxos(resp.GetSpentVtxos()).toVtxos(), nil
|
||||
resp, err := a.svc.CreatePayment(ctx, req)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return resp.SignedRedeemTx, resp.UsignedUnconditionalForfeitTxs, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) CompletePayment(
|
||||
ctx context.Context, redeemTx string, signedForfeitTxs []string,
|
||||
) error {
|
||||
req := &arkv1.CompletePaymentRequest{
|
||||
SignedRedeemTx: redeemTx,
|
||||
SignedUnconditionalForfeitTxs: signedForfeitTxs,
|
||||
}
|
||||
_, err := a.svc.CompletePayment(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetRound(
|
||||
@@ -158,92 +288,6 @@ func (a *grpcClient) GetRound(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) RegisterPayment(
|
||||
ctx context.Context, inputs []client.Input, ephemeralPublicKey string,
|
||||
) (string, error) {
|
||||
req := &arkv1.RegisterPaymentRequest{
|
||||
Inputs: ins(inputs).toProto(),
|
||||
}
|
||||
if len(ephemeralPublicKey) > 0 {
|
||||
req.EphemeralPubkey = &ephemeralPublicKey
|
||||
}
|
||||
|
||||
resp, err := a.svc.RegisterPayment(ctx, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.GetId(), nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) ClaimPayment(
|
||||
ctx context.Context, paymentID string, outputs []client.Output,
|
||||
) error {
|
||||
req := &arkv1.ClaimPaymentRequest{
|
||||
Id: paymentID,
|
||||
Outputs: outs(outputs).toProto(),
|
||||
}
|
||||
_, err := a.svc.ClaimPayment(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) Ping(
|
||||
ctx context.Context, paymentID string,
|
||||
) (client.RoundEvent, error) {
|
||||
req := &arkv1.PingRequest{
|
||||
PaymentId: paymentID,
|
||||
}
|
||||
resp, err := a.svc.Ping(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.GetEvent() == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return event{resp}.toRoundEvent()
|
||||
}
|
||||
|
||||
func (a *grpcClient) FinalizePayment(
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error {
|
||||
req := &arkv1.FinalizePaymentRequest{
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
}
|
||||
|
||||
if len(signedRoundTx) > 0 {
|
||||
req.SignedRoundTx = &signedRoundTx
|
||||
}
|
||||
|
||||
_, err := a.svc.FinalizePayment(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) CreatePayment(
|
||||
ctx context.Context, inputs []client.Input, outputs []client.Output,
|
||||
) (string, []string, error) {
|
||||
req := &arkv1.CreatePaymentRequest{
|
||||
Inputs: ins(inputs).toProto(),
|
||||
Outputs: outs(outputs).toProto(),
|
||||
}
|
||||
resp, err := a.svc.CreatePayment(ctx, req)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return resp.SignedRedeemTx, resp.UsignedUnconditionalForfeitTxs, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) CompletePayment(
|
||||
ctx context.Context, redeemTx string, signedForfeitTxs []string,
|
||||
) error {
|
||||
req := &arkv1.CompletePaymentRequest{
|
||||
SignedRedeemTx: redeemTx,
|
||||
SignedUnconditionalForfeitTxs: signedForfeitTxs,
|
||||
}
|
||||
_, err := a.svc.CompletePayment(ctx, req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetRoundByID(
|
||||
ctx context.Context, roundID string,
|
||||
) (*client.Round, error) {
|
||||
@@ -272,266 +316,17 @@ func (a *grpcClient) GetRoundByID(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) GetBoardingAddress(
|
||||
ctx context.Context, userPubkey string,
|
||||
) (string, error) {
|
||||
req := &arkv1.GetBoardingAddressRequest{
|
||||
Pubkey: userPubkey,
|
||||
}
|
||||
resp, err := a.svc.GetBoardingAddress(ctx, req)
|
||||
func (a *grpcClient) ListVtxos(
|
||||
ctx context.Context, addr string,
|
||||
) ([]client.Vtxo, []client.Vtxo, error) {
|
||||
resp, err := a.svc.ListVtxos(ctx, &arkv1.ListVtxosRequest{Address: addr})
|
||||
if err != nil {
|
||||
return "", err
|
||||
return nil, nil, err
|
||||
}
|
||||
return resp.GetAddress(), nil
|
||||
return vtxos(resp.GetSpendableVtxos()).toVtxos(), vtxos(resp.GetSpentVtxos()).toVtxos(), nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) SendTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error {
|
||||
var nonceBuffer bytes.Buffer
|
||||
|
||||
if err := nonces.Encode(&nonceBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedNonces := hex.EncodeToString(nonceBuffer.Bytes())
|
||||
|
||||
req := &arkv1.SendTreeNoncesRequest{
|
||||
RoundId: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeNonces: serializedNonces,
|
||||
}
|
||||
|
||||
if _, err := a.svc.SendTreeNonces(ctx, req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *grpcClient) SendTreeSignatures(
|
||||
ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.TreePartialSigs,
|
||||
) error {
|
||||
var sigsBuffer bytes.Buffer
|
||||
|
||||
if err := signatures.Encode(&sigsBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedSigs := hex.EncodeToString(sigsBuffer.Bytes())
|
||||
|
||||
req := &arkv1.SendTreeSignaturesRequest{
|
||||
RoundId: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeSignatures: serializedSigs,
|
||||
}
|
||||
|
||||
if _, err := a.svc.SendTreeSignatures(ctx, req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type out client.Output
|
||||
|
||||
func (o out) toProto() *arkv1.Output {
|
||||
if len(o.Address) > 0 {
|
||||
return &arkv1.Output{
|
||||
Destination: &arkv1.Output_Address{
|
||||
Address: o.Address,
|
||||
},
|
||||
Amount: o.Amount,
|
||||
}
|
||||
}
|
||||
|
||||
return &arkv1.Output{
|
||||
Destination: &arkv1.Output_Descriptor_{
|
||||
Descriptor_: o.Descriptor,
|
||||
},
|
||||
Amount: o.Amount,
|
||||
}
|
||||
}
|
||||
|
||||
type outs []client.Output
|
||||
|
||||
func (o outs) toProto() []*arkv1.Output {
|
||||
list := make([]*arkv1.Output, 0, len(o))
|
||||
for _, oo := range o {
|
||||
list = append(list, out(oo).toProto())
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
// wrapper for GetEventStreamResponse and PingResponse
|
||||
type eventResponse interface {
|
||||
GetRoundFailed() *arkv1.RoundFailed
|
||||
GetRoundFinalization() *arkv1.RoundFinalizationEvent
|
||||
GetRoundFinalized() *arkv1.RoundFinalizedEvent
|
||||
GetRoundSigning() *arkv1.RoundSigningEvent
|
||||
GetRoundSigningNoncesGenerated() *arkv1.RoundSigningNoncesGeneratedEvent
|
||||
}
|
||||
|
||||
type event struct {
|
||||
eventResponse
|
||||
}
|
||||
|
||||
func (e event) toRoundEvent() (client.RoundEvent, error) {
|
||||
if ee := e.GetRoundFailed(); ee != nil {
|
||||
return client.RoundFailedEvent{
|
||||
ID: ee.GetId(),
|
||||
Reason: ee.GetReason(),
|
||||
}, nil
|
||||
}
|
||||
if ee := e.GetRoundFinalization(); ee != nil {
|
||||
tree := treeFromProto{ee.GetCongestionTree()}.parse()
|
||||
return client.RoundFinalizationEvent{
|
||||
ID: ee.GetId(),
|
||||
Tx: ee.GetPoolTx(),
|
||||
Tree: tree,
|
||||
Connectors: ee.GetConnectors(),
|
||||
MinRelayFeeRate: chainfee.SatPerKVByte(ee.MinRelayFeeRate),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if ee := e.GetRoundFinalized(); ee != nil {
|
||||
return client.RoundFinalizedEvent{
|
||||
ID: ee.GetId(),
|
||||
Txid: ee.GetPoolTxid(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if ee := e.GetRoundSigning(); ee != nil {
|
||||
pubkeys := make([]*secp256k1.PublicKey, 0, len(ee.GetCosignersPubkeys()))
|
||||
for _, pubkey := range ee.GetCosignersPubkeys() {
|
||||
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: ee.GetId(),
|
||||
UnsignedTree: treeFromProto{ee.GetUnsignedTree()}.parse(),
|
||||
CosignersPublicKeys: pubkeys,
|
||||
UnsignedRoundTx: ee.GetUnsignedRoundTx(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if ee := e.GetRoundSigningNoncesGenerated(); ee != nil {
|
||||
nonces, err := bitcointree.DecodeNonces(hex.NewDecoder(strings.NewReader(ee.GetTreeNonces())))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.RoundSigningNoncesGeneratedEvent{
|
||||
ID: ee.GetId(),
|
||||
Nonces: nonces,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("unknown event")
|
||||
}
|
||||
|
||||
type vtxo struct {
|
||||
*arkv1.Vtxo
|
||||
}
|
||||
|
||||
func (v vtxo) toVtxo() client.Vtxo {
|
||||
var expiresAt *time.Time
|
||||
if v.GetExpireAt() > 0 {
|
||||
t := time.Unix(v.GetExpireAt(), 0)
|
||||
expiresAt = &t
|
||||
}
|
||||
var redeemTx string
|
||||
var uncondForfeitTxs []string
|
||||
if v.GetPendingData() != nil {
|
||||
redeemTx = v.GetPendingData().GetRedeemTx()
|
||||
uncondForfeitTxs = v.GetPendingData().GetUnconditionalForfeitTxs()
|
||||
}
|
||||
return client.Vtxo{
|
||||
Outpoint: client.Outpoint{
|
||||
Txid: v.GetOutpoint().GetTxid(),
|
||||
VOut: v.GetOutpoint().GetVout(),
|
||||
},
|
||||
Amount: v.GetAmount(),
|
||||
RoundTxid: v.GetPoolTxid(),
|
||||
ExpiresAt: expiresAt,
|
||||
Pending: v.GetPending(),
|
||||
RedeemTx: redeemTx,
|
||||
UnconditionalForfeitTxs: uncondForfeitTxs,
|
||||
SpentBy: v.GetSpentBy(),
|
||||
Descriptor: v.GetDescriptor_(),
|
||||
}
|
||||
}
|
||||
|
||||
type vtxos []*arkv1.Vtxo
|
||||
|
||||
func (v vtxos) toVtxos() []client.Vtxo {
|
||||
list := make([]client.Vtxo, 0, len(v))
|
||||
for _, vv := range v {
|
||||
list = append(list, vtxo{vv}.toVtxo())
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
func toProtoInput(i client.Input) *arkv1.Input {
|
||||
return &arkv1.Input{
|
||||
Outpoint: &arkv1.Outpoint{
|
||||
Txid: i.Txid,
|
||||
Vout: i.VOut,
|
||||
},
|
||||
Descriptor_: i.Descriptor,
|
||||
}
|
||||
}
|
||||
|
||||
type ins []client.Input
|
||||
|
||||
func (i ins) toProto() []*arkv1.Input {
|
||||
list := make([]*arkv1.Input, 0, len(i))
|
||||
for _, ii := range i {
|
||||
list = append(list, toProtoInput(ii))
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
type treeFromProto struct {
|
||||
*arkv1.Tree
|
||||
}
|
||||
|
||||
func (t treeFromProto) parse() tree.CongestionTree {
|
||||
levels := make(tree.CongestionTree, 0, len(t.GetLevels()))
|
||||
|
||||
for _, level := range t.GetLevels() {
|
||||
nodes := make([]tree.Node, 0, len(level.Nodes))
|
||||
|
||||
for _, node := range level.Nodes {
|
||||
nodes = append(nodes, tree.Node{
|
||||
Txid: node.Txid,
|
||||
Tx: node.Tx,
|
||||
ParentTxid: node.ParentTxid,
|
||||
})
|
||||
}
|
||||
|
||||
levels = append(levels, nodes)
|
||||
}
|
||||
|
||||
for j, treeLvl := range levels {
|
||||
for i, node := range treeLvl {
|
||||
if len(levels.Children(node.Txid)) == 0 {
|
||||
levels[j][i] = tree.Node{
|
||||
Txid: node.Txid,
|
||||
Tx: node.Tx,
|
||||
ParentTxid: node.ParentTxid,
|
||||
Leaf: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return levels
|
||||
func (c *grpcClient) Close() {
|
||||
//nolint:all
|
||||
c.conn.Close()
|
||||
}
|
||||
|
||||
208
pkg/client-sdk/client/grpc/types.go
Normal file
208
pkg/client-sdk/client/grpc/types.go
Normal file
@@ -0,0 +1,208 @@
|
||||
package grpcclient
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
arkv1 "github.com/ark-network/ark/api-spec/protobuf/gen/ark/v1"
|
||||
"github.com/ark-network/ark/common/bitcointree"
|
||||
"github.com/ark-network/ark/common/tree"
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
)
|
||||
|
||||
type out client.Output
|
||||
|
||||
func (o out) toProto() *arkv1.Output {
|
||||
return &arkv1.Output{
|
||||
Address: o.Address,
|
||||
Descriptor_: o.Descriptor,
|
||||
Amount: o.Amount,
|
||||
}
|
||||
}
|
||||
|
||||
type outs []client.Output
|
||||
|
||||
func (o outs) toProto() []*arkv1.Output {
|
||||
list := make([]*arkv1.Output, 0, len(o))
|
||||
for _, oo := range o {
|
||||
list = append(list, out(oo).toProto())
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
// wrapper for GetEventStreamResponse and PingResponse
|
||||
type eventResponse interface {
|
||||
GetRoundFailed() *arkv1.RoundFailed
|
||||
GetRoundFinalization() *arkv1.RoundFinalizationEvent
|
||||
GetRoundFinalized() *arkv1.RoundFinalizedEvent
|
||||
GetRoundSigning() *arkv1.RoundSigningEvent
|
||||
GetRoundSigningNoncesGenerated() *arkv1.RoundSigningNoncesGeneratedEvent
|
||||
}
|
||||
|
||||
type event struct {
|
||||
eventResponse
|
||||
}
|
||||
|
||||
func (e event) toRoundEvent() (client.RoundEvent, error) {
|
||||
if ee := e.GetRoundFailed(); ee != nil {
|
||||
return client.RoundFailedEvent{
|
||||
ID: ee.GetId(),
|
||||
Reason: ee.GetReason(),
|
||||
}, nil
|
||||
}
|
||||
if ee := e.GetRoundFinalization(); ee != nil {
|
||||
tree := treeFromProto{ee.GetCongestionTree()}.parse()
|
||||
return client.RoundFinalizationEvent{
|
||||
ID: ee.GetId(),
|
||||
Tx: ee.GetPoolTx(),
|
||||
Tree: tree,
|
||||
Connectors: ee.GetConnectors(),
|
||||
MinRelayFeeRate: chainfee.SatPerKVByte(ee.MinRelayFeeRate),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if ee := e.GetRoundFinalized(); ee != nil {
|
||||
return client.RoundFinalizedEvent{
|
||||
ID: ee.GetId(),
|
||||
Txid: ee.GetPoolTxid(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if ee := e.GetRoundSigning(); ee != nil {
|
||||
pubkeys := make([]*secp256k1.PublicKey, 0, len(ee.GetCosignersPubkeys()))
|
||||
for _, pubkey := range ee.GetCosignersPubkeys() {
|
||||
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: ee.GetId(),
|
||||
UnsignedTree: treeFromProto{ee.GetUnsignedTree()}.parse(),
|
||||
CosignersPublicKeys: pubkeys,
|
||||
UnsignedRoundTx: ee.GetUnsignedRoundTx(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if ee := e.GetRoundSigningNoncesGenerated(); ee != nil {
|
||||
nonces, err := bitcointree.DecodeNonces(hex.NewDecoder(strings.NewReader(ee.GetTreeNonces())))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.RoundSigningNoncesGeneratedEvent{
|
||||
ID: ee.GetId(),
|
||||
Nonces: nonces,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("unknown event")
|
||||
}
|
||||
|
||||
type vtxo struct {
|
||||
*arkv1.Vtxo
|
||||
}
|
||||
|
||||
func (v vtxo) toVtxo() client.Vtxo {
|
||||
var expiresAt *time.Time
|
||||
if v.GetExpireAt() > 0 {
|
||||
t := time.Unix(v.GetExpireAt(), 0)
|
||||
expiresAt = &t
|
||||
}
|
||||
var redeemTx string
|
||||
var uncondForfeitTxs []string
|
||||
if v.GetPendingData() != nil {
|
||||
redeemTx = v.GetPendingData().GetRedeemTx()
|
||||
uncondForfeitTxs = v.GetPendingData().GetUnconditionalForfeitTxs()
|
||||
}
|
||||
return client.Vtxo{
|
||||
Outpoint: client.Outpoint{
|
||||
Txid: v.GetOutpoint().GetTxid(),
|
||||
VOut: v.GetOutpoint().GetVout(),
|
||||
},
|
||||
Amount: v.GetAmount(),
|
||||
RoundTxid: v.GetPoolTxid(),
|
||||
ExpiresAt: expiresAt,
|
||||
Pending: v.GetPending(),
|
||||
RedeemTx: redeemTx,
|
||||
UnconditionalForfeitTxs: uncondForfeitTxs,
|
||||
SpentBy: v.GetSpentBy(),
|
||||
Descriptor: v.GetDescriptor_(),
|
||||
}
|
||||
}
|
||||
|
||||
type vtxos []*arkv1.Vtxo
|
||||
|
||||
func (v vtxos) toVtxos() []client.Vtxo {
|
||||
list := make([]client.Vtxo, 0, len(v))
|
||||
for _, vv := range v {
|
||||
list = append(list, vtxo{vv}.toVtxo())
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
func toProtoInput(i client.Input) *arkv1.Input {
|
||||
return &arkv1.Input{
|
||||
Outpoint: &arkv1.Outpoint{
|
||||
Txid: i.Txid,
|
||||
Vout: i.VOut,
|
||||
},
|
||||
Descriptor_: i.Descriptor,
|
||||
}
|
||||
}
|
||||
|
||||
type ins []client.Input
|
||||
|
||||
func (i ins) toProto() []*arkv1.Input {
|
||||
list := make([]*arkv1.Input, 0, len(i))
|
||||
for _, ii := range i {
|
||||
list = append(list, toProtoInput(ii))
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
type treeFromProto struct {
|
||||
*arkv1.Tree
|
||||
}
|
||||
|
||||
func (t treeFromProto) parse() tree.CongestionTree {
|
||||
levels := make(tree.CongestionTree, 0, len(t.GetLevels()))
|
||||
|
||||
for _, level := range t.GetLevels() {
|
||||
nodes := make([]tree.Node, 0, len(level.Nodes))
|
||||
|
||||
for _, node := range level.Nodes {
|
||||
nodes = append(nodes, tree.Node{
|
||||
Txid: node.Txid,
|
||||
Tx: node.Tx,
|
||||
ParentTxid: node.ParentTxid,
|
||||
})
|
||||
}
|
||||
|
||||
levels = append(levels, nodes)
|
||||
}
|
||||
|
||||
for j, treeLvl := range levels {
|
||||
for i, node := range treeLvl {
|
||||
if len(levels.Children(node.Txid)) == 0 {
|
||||
levels[j][i] = tree.Node{
|
||||
Txid: node.Txid,
|
||||
Tx: node.Tx,
|
||||
ParentTxid: node.ParentTxid,
|
||||
Leaf: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return levels
|
||||
}
|
||||
@@ -44,7 +44,181 @@ func NewClient(aspUrl string) (client.ASPClient, error) {
|
||||
return &restClient{svc, reqTimeout, treeCache}, nil
|
||||
}
|
||||
|
||||
func (c *restClient) Close() {}
|
||||
func (a *restClient) GetInfo(
|
||||
ctx context.Context,
|
||||
) (*client.Info, error) {
|
||||
resp, err := a.svc.ArkServiceGetInfo(ark_service.NewArkServiceGetInfoParams())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roundLifetime, err := strconv.Atoi(resp.Payload.RoundLifetime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
unilateralExitDelay, err := strconv.Atoi(resp.Payload.UnilateralExitDelay)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roundInterval, err := strconv.Atoi(resp.Payload.RoundInterval)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dust, err := strconv.Atoi(resp.Payload.Dust)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &client.Info{
|
||||
Pubkey: resp.Payload.Pubkey,
|
||||
RoundLifetime: int64(roundLifetime),
|
||||
UnilateralExitDelay: int64(unilateralExitDelay),
|
||||
RoundInterval: int64(roundInterval),
|
||||
Network: resp.Payload.Network,
|
||||
Dust: uint64(dust),
|
||||
BoardingDescriptorTemplate: resp.Payload.BoardingDescriptorTemplate,
|
||||
ForfeitAddress: resp.Payload.ForfeitAddress,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *restClient) GetBoardingAddress(
|
||||
ctx context.Context, pubkey string,
|
||||
) (string, error) {
|
||||
body := models.V1GetBoardingAddressRequest{
|
||||
Pubkey: pubkey,
|
||||
}
|
||||
|
||||
resp, err := a.svc.ArkServiceGetBoardingAddress(
|
||||
ark_service.NewArkServiceGetBoardingAddressParams().WithBody(&body),
|
||||
)
|
||||
if err != nil {
|
||||
return "",
|
||||
err
|
||||
}
|
||||
return resp.Payload.Address, nil
|
||||
}
|
||||
|
||||
func (a *restClient) RegisterInputsForNextRound(
|
||||
ctx context.Context, inputs []client.Input, ephemeralPublicKey string,
|
||||
) (string, error) {
|
||||
ins := make([]*models.V1Input, 0, len(inputs))
|
||||
for _, i := range inputs {
|
||||
ins = append(ins, &models.V1Input{
|
||||
Outpoint: &models.V1Outpoint{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
},
|
||||
Descriptor: i.Descriptor,
|
||||
})
|
||||
}
|
||||
body := &models.V1RegisterInputsForNextRoundRequest{
|
||||
Inputs: ins,
|
||||
}
|
||||
if len(ephemeralPublicKey) > 0 {
|
||||
body.EphemeralPubkey = ephemeralPublicKey
|
||||
}
|
||||
|
||||
resp, err := a.svc.ArkServiceRegisterInputsForNextRound(
|
||||
ark_service.NewArkServiceRegisterInputsForNextRoundParams().WithBody(body),
|
||||
)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp.Payload.ID, nil
|
||||
}
|
||||
|
||||
func (a *restClient) RegisterOutputsForNextRound(
|
||||
ctx context.Context, paymentID string, outputs []client.Output,
|
||||
) error {
|
||||
outs := make([]*models.V1Output, 0, len(outputs))
|
||||
for _, o := range outputs {
|
||||
outs = append(outs, &models.V1Output{
|
||||
Address: o.Address,
|
||||
Descriptor: o.Descriptor,
|
||||
Amount: strconv.Itoa(int(o.Amount)),
|
||||
})
|
||||
}
|
||||
body := models.V1RegisterOutputsForNextRoundRequest{
|
||||
ID: paymentID,
|
||||
Outputs: outs,
|
||||
}
|
||||
|
||||
_, err := a.svc.ArkServiceRegisterOutputsForNextRound(
|
||||
ark_service.NewArkServiceRegisterOutputsForNextRoundParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) SubmitTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string,
|
||||
nonces bitcointree.TreeNonces,
|
||||
) error {
|
||||
var nonceBuffer bytes.Buffer
|
||||
|
||||
if err := nonces.Encode(&nonceBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedNonces := hex.EncodeToString(nonceBuffer.Bytes())
|
||||
|
||||
body := &models.V1SubmitTreeNoncesRequest{
|
||||
RoundID: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeNonces: serializedNonces,
|
||||
}
|
||||
|
||||
if _, err := a.svc.ArkServiceSubmitTreeNonces(
|
||||
ark_service.NewArkServiceSubmitTreeNoncesParams().WithBody(body),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *restClient) SubmitTreeSignatures(
|
||||
ctx context.Context, roundID, cosignerPubkey string,
|
||||
signatures bitcointree.TreePartialSigs,
|
||||
) error {
|
||||
var sigsBuffer bytes.Buffer
|
||||
|
||||
if err := signatures.Encode(&sigsBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedSigs := hex.EncodeToString(sigsBuffer.Bytes())
|
||||
|
||||
body := &models.V1SubmitTreeSignaturesRequest{
|
||||
RoundID: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeSignatures: serializedSigs,
|
||||
}
|
||||
|
||||
if _, err := a.svc.ArkServiceSubmitTreeSignatures(
|
||||
ark_service.NewArkServiceSubmitTreeSignaturesParams().WithBody(body),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *restClient) SubmitSignedForfeitTxs(
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error {
|
||||
body := models.V1SubmitSignedForfeitTxsRequest{
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
SignedRoundTx: signedRoundTx,
|
||||
}
|
||||
_, err := a.svc.ArkServiceSubmitSignedForfeitTxs(
|
||||
ark_service.NewArkServiceSubmitSignedForfeitTxsParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) GetEventStream(
|
||||
ctx context.Context, paymentID string,
|
||||
@@ -94,43 +268,211 @@ func (a *restClient) GetEventStream(
|
||||
return eventsCh, close, nil
|
||||
}
|
||||
|
||||
func (a *restClient) GetInfo(
|
||||
ctx context.Context,
|
||||
) (*client.Info, error) {
|
||||
resp, err := a.svc.ArkServiceGetInfo(ark_service.NewArkServiceGetInfoParams())
|
||||
func (a *restClient) Ping(
|
||||
ctx context.Context, paymentID string,
|
||||
) (client.RoundEvent, error) {
|
||||
r := ark_service.NewArkServicePingParams()
|
||||
r.SetPaymentID(paymentID)
|
||||
resp, err := a.svc.ArkServicePing(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roundLifetime, err := strconv.Atoi(resp.Payload.RoundLifetime)
|
||||
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.CongestionTree}.parse()
|
||||
|
||||
minRelayFeeRate, err := strconv.Atoi(e.MinRelayFeeRate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return client.RoundFinalizationEvent{
|
||||
ID: e.ID,
|
||||
Tx: e.PoolTx,
|
||||
Tree: tree,
|
||||
Connectors: e.Connectors,
|
||||
MinRelayFeeRate: chainfee.SatPerKVByte(minRelayFeeRate),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if e := payload.RoundFinalized; e != nil {
|
||||
return client.RoundFinalizedEvent{
|
||||
ID: e.ID,
|
||||
Txid: e.PoolTxid,
|
||||
}, 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.UnsignedTree}.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(
|
||||
ctx context.Context, inputs []client.Input, outputs []client.Output,
|
||||
) (string, []string, error) {
|
||||
ins := make([]*models.V1Input, 0, len(inputs))
|
||||
for _, i := range inputs {
|
||||
ins = append(ins, &models.V1Input{
|
||||
Outpoint: &models.V1Outpoint{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
},
|
||||
Descriptor: i.Descriptor,
|
||||
})
|
||||
}
|
||||
outs := make([]*models.V1Output, 0, len(outputs))
|
||||
for _, o := range outputs {
|
||||
outs = append(outs, &models.V1Output{
|
||||
Address: o.Address,
|
||||
Amount: strconv.Itoa(int(o.Amount)),
|
||||
Descriptor: o.Descriptor,
|
||||
})
|
||||
}
|
||||
body := models.V1CreatePaymentRequest{
|
||||
Inputs: ins,
|
||||
Outputs: outs,
|
||||
}
|
||||
resp, err := a.svc.ArkServiceCreatePayment(
|
||||
ark_service.NewArkServiceCreatePaymentParams().WithBody(&body),
|
||||
)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return resp.GetPayload().SignedRedeemTx, resp.GetPayload().UsignedUnconditionalForfeitTxs, nil
|
||||
}
|
||||
|
||||
func (a *restClient) CompletePayment(
|
||||
ctx context.Context, signedRedeemTx string, signedUncondForfeitTxs []string,
|
||||
) error {
|
||||
req := &arkv1.CompletePaymentRequest{
|
||||
SignedRedeemTx: signedRedeemTx,
|
||||
SignedUnconditionalForfeitTxs: signedUncondForfeitTxs,
|
||||
}
|
||||
body := models.V1CompletePaymentRequest{
|
||||
SignedRedeemTx: req.GetSignedRedeemTx(),
|
||||
SignedUnconditionalForfeitTxs: req.GetSignedUnconditionalForfeitTxs(),
|
||||
}
|
||||
_, err := a.svc.ArkServiceCompletePayment(
|
||||
ark_service.NewArkServiceCompletePaymentParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) GetRound(
|
||||
ctx context.Context, txID string,
|
||||
) (*client.Round, error) {
|
||||
resp, err := a.svc.ArkServiceGetRound(
|
||||
ark_service.NewArkServiceGetRoundParams().WithTxid(txID),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
unilateralExitDelay, err := strconv.Atoi(resp.Payload.UnilateralExitDelay)
|
||||
start, err := strconv.Atoi(resp.Payload.Round.Start)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
roundInterval, err := strconv.Atoi(resp.Payload.RoundInterval)
|
||||
end, err := strconv.Atoi(resp.Payload.Round.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dust, err := strconv.Atoi(resp.Payload.Dust)
|
||||
startedAt := time.Unix(int64(start), 0)
|
||||
var endedAt *time.Time
|
||||
if end > 0 {
|
||||
t := time.Unix(int64(end), 0)
|
||||
endedAt = &t
|
||||
}
|
||||
|
||||
return &client.Round{
|
||||
ID: resp.Payload.Round.ID,
|
||||
StartedAt: &startedAt,
|
||||
EndedAt: endedAt,
|
||||
Tx: resp.Payload.Round.PoolTx,
|
||||
Tree: treeFromProto{resp.Payload.Round.CongestionTree}.parse(),
|
||||
ForfeitTxs: resp.Payload.Round.ForfeitTxs,
|
||||
Connectors: resp.Payload.Round.Connectors,
|
||||
Stage: toRoundStage(*resp.Payload.Round.Stage),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *restClient) GetRoundByID(
|
||||
ctx context.Context, roundID string,
|
||||
) (*client.Round, error) {
|
||||
resp, err := a.svc.ArkServiceGetRoundByID(
|
||||
ark_service.NewArkServiceGetRoundByIDParams().WithID(roundID),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &client.Info{
|
||||
Pubkey: resp.Payload.Pubkey,
|
||||
RoundLifetime: int64(roundLifetime),
|
||||
UnilateralExitDelay: int64(unilateralExitDelay),
|
||||
RoundInterval: int64(roundInterval),
|
||||
Network: resp.Payload.Network,
|
||||
Dust: uint64(dust),
|
||||
BoardingDescriptorTemplate: resp.Payload.BoardingDescriptorTemplate,
|
||||
ForfeitAddress: resp.Payload.ForfeitAddress,
|
||||
start, err := strconv.Atoi(resp.Payload.Round.Start)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
end, err := strconv.Atoi(resp.Payload.Round.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
startedAt := time.Unix(int64(start), 0)
|
||||
var endedAt *time.Time
|
||||
if end > 0 {
|
||||
t := time.Unix(int64(end), 0)
|
||||
endedAt = &t
|
||||
}
|
||||
|
||||
return &client.Round{
|
||||
ID: resp.Payload.Round.ID,
|
||||
StartedAt: &startedAt,
|
||||
EndedAt: endedAt,
|
||||
Tx: resp.Payload.Round.PoolTx,
|
||||
Tree: treeFromProto{resp.Payload.Round.CongestionTree}.parse(),
|
||||
ForfeitTxs: resp.Payload.Round.ForfeitTxs,
|
||||
Connectors: resp.Payload.Round.Connectors,
|
||||
Stage: toRoundStage(*resp.Payload.Round.Stage),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -217,345 +559,7 @@ func (a *restClient) ListVtxos(
|
||||
return spendableVtxos, spentVtxos, nil
|
||||
}
|
||||
|
||||
func (a *restClient) GetRound(
|
||||
ctx context.Context, txID string,
|
||||
) (*client.Round, error) {
|
||||
resp, err := a.svc.ArkServiceGetRound(
|
||||
ark_service.NewArkServiceGetRoundParams().WithTxid(txID),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
start, err := strconv.Atoi(resp.Payload.Round.Start)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
end, err := strconv.Atoi(resp.Payload.Round.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
startedAt := time.Unix(int64(start), 0)
|
||||
var endedAt *time.Time
|
||||
if end > 0 {
|
||||
t := time.Unix(int64(end), 0)
|
||||
endedAt = &t
|
||||
}
|
||||
|
||||
return &client.Round{
|
||||
ID: resp.Payload.Round.ID,
|
||||
StartedAt: &startedAt,
|
||||
EndedAt: endedAt,
|
||||
Tx: resp.Payload.Round.PoolTx,
|
||||
Tree: treeFromProto{resp.Payload.Round.CongestionTree}.parse(),
|
||||
ForfeitTxs: resp.Payload.Round.ForfeitTxs,
|
||||
Connectors: resp.Payload.Round.Connectors,
|
||||
Stage: toRoundStage(*resp.Payload.Round.Stage),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *restClient) RegisterPayment(
|
||||
ctx context.Context, inputs []client.Input, ephemeralPublicKey string,
|
||||
) (string, error) {
|
||||
ins := make([]*models.V1Input, 0, len(inputs))
|
||||
for _, i := range inputs {
|
||||
ins = append(ins, &models.V1Input{
|
||||
Outpoint: &models.V1Outpoint{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
},
|
||||
Descriptor: i.Descriptor,
|
||||
})
|
||||
}
|
||||
body := &models.V1RegisterPaymentRequest{
|
||||
Inputs: ins,
|
||||
}
|
||||
if len(ephemeralPublicKey) > 0 {
|
||||
body.EphemeralPubkey = ephemeralPublicKey
|
||||
}
|
||||
|
||||
resp, err := a.svc.ArkServiceRegisterPayment(
|
||||
ark_service.NewArkServiceRegisterPaymentParams().WithBody(body),
|
||||
)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp.Payload.ID, nil
|
||||
}
|
||||
|
||||
func (a *restClient) ClaimPayment(
|
||||
ctx context.Context, paymentID string, outputs []client.Output,
|
||||
) error {
|
||||
outs := make([]*models.V1Output, 0, len(outputs))
|
||||
for _, o := range outputs {
|
||||
outs = append(outs, &models.V1Output{
|
||||
Address: o.Address,
|
||||
Amount: strconv.Itoa(int(o.Amount)),
|
||||
})
|
||||
}
|
||||
body := models.V1ClaimPaymentRequest{
|
||||
ID: paymentID,
|
||||
Outputs: outs,
|
||||
}
|
||||
|
||||
_, err := a.svc.ArkServiceClaimPayment(
|
||||
ark_service.NewArkServiceClaimPaymentParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) Ping(
|
||||
ctx context.Context, paymentID string,
|
||||
) (client.RoundEvent, error) {
|
||||
r := ark_service.NewArkServicePingParams()
|
||||
r.SetPaymentID(paymentID)
|
||||
resp, err := a.svc.ArkServicePing(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
payload := resp.Payload
|
||||
|
||||
if e := payload.RoundFailed; e != nil {
|
||||
return client.RoundFailedEvent{
|
||||
ID: e.ID,
|
||||
Reason: e.Reason,
|
||||
}, nil
|
||||
}
|
||||
if e := payload.RoundFinalization; e != nil {
|
||||
tree := treeFromProto{e.CongestionTree}.parse()
|
||||
|
||||
minRelayFeeRate, err := strconv.Atoi(e.MinRelayFeeRate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return client.RoundFinalizationEvent{
|
||||
ID: e.ID,
|
||||
Tx: e.PoolTx,
|
||||
Tree: tree,
|
||||
Connectors: e.Connectors,
|
||||
MinRelayFeeRate: chainfee.SatPerKVByte(minRelayFeeRate),
|
||||
}, nil
|
||||
}
|
||||
|
||||
if e := payload.RoundFinalized; e != nil {
|
||||
return client.RoundFinalizedEvent{
|
||||
ID: e.ID,
|
||||
Txid: e.PoolTxid,
|
||||
}, 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.UnsignedTree}.parse(),
|
||||
CosignersPublicKeys: pubkeys,
|
||||
UnsignedRoundTx: e.UnsignedRoundTx,
|
||||
}, nil
|
||||
}
|
||||
|
||||
if e := payload.RoundSigningNoncesGenerated; e != nil {
|
||||
nonces, err := bitcointree.DecodeNonces(hex.NewDecoder(strings.NewReader(e.TreeNonces)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return client.RoundSigningNoncesGeneratedEvent{
|
||||
ID: e.ID,
|
||||
Nonces: nonces,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (a *restClient) FinalizePayment(
|
||||
ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
|
||||
) error {
|
||||
body := models.V1FinalizePaymentRequest{
|
||||
SignedForfeitTxs: signedForfeitTxs,
|
||||
SignedRoundTx: signedRoundTx,
|
||||
}
|
||||
_, err := a.svc.ArkServiceFinalizePayment(
|
||||
ark_service.NewArkServiceFinalizePaymentParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) CreatePayment(
|
||||
ctx context.Context, inputs []client.Input, outputs []client.Output,
|
||||
) (string, []string, error) {
|
||||
ins := make([]*models.V1Input, 0, len(inputs))
|
||||
for _, i := range inputs {
|
||||
ins = append(ins, &models.V1Input{
|
||||
Outpoint: &models.V1Outpoint{
|
||||
Txid: i.Txid,
|
||||
Vout: int64(i.VOut),
|
||||
},
|
||||
Descriptor: i.Descriptor,
|
||||
})
|
||||
}
|
||||
outs := make([]*models.V1Output, 0, len(outputs))
|
||||
for _, o := range outputs {
|
||||
outs = append(outs, &models.V1Output{
|
||||
Address: o.Address,
|
||||
Amount: strconv.Itoa(int(o.Amount)),
|
||||
Descriptor: o.Descriptor,
|
||||
})
|
||||
}
|
||||
body := models.V1CreatePaymentRequest{
|
||||
Inputs: ins,
|
||||
Outputs: outs,
|
||||
}
|
||||
resp, err := a.svc.ArkServiceCreatePayment(
|
||||
ark_service.NewArkServiceCreatePaymentParams().WithBody(&body),
|
||||
)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return resp.GetPayload().SignedRedeemTx, resp.GetPayload().UsignedUnconditionalForfeitTxs, nil
|
||||
}
|
||||
|
||||
func (a *restClient) CompletePayment(
|
||||
ctx context.Context, signedRedeemTx string, signedUnconditionalForfeitTxs []string,
|
||||
) error {
|
||||
req := &arkv1.CompletePaymentRequest{
|
||||
SignedRedeemTx: signedRedeemTx,
|
||||
SignedUnconditionalForfeitTxs: signedUnconditionalForfeitTxs,
|
||||
}
|
||||
body := models.V1CompletePaymentRequest{
|
||||
SignedRedeemTx: req.GetSignedRedeemTx(),
|
||||
SignedUnconditionalForfeitTxs: req.GetSignedUnconditionalForfeitTxs(),
|
||||
}
|
||||
_, err := a.svc.ArkServiceCompletePayment(
|
||||
ark_service.NewArkServiceCompletePaymentParams().WithBody(&body),
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *restClient) GetRoundByID(
|
||||
ctx context.Context, roundID string,
|
||||
) (*client.Round, error) {
|
||||
resp, err := a.svc.ArkServiceGetRoundByID(
|
||||
ark_service.NewArkServiceGetRoundByIDParams().WithID(roundID),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
start, err := strconv.Atoi(resp.Payload.Round.Start)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
end, err := strconv.Atoi(resp.Payload.Round.End)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
startedAt := time.Unix(int64(start), 0)
|
||||
var endedAt *time.Time
|
||||
if end > 0 {
|
||||
t := time.Unix(int64(end), 0)
|
||||
endedAt = &t
|
||||
}
|
||||
|
||||
return &client.Round{
|
||||
ID: resp.Payload.Round.ID,
|
||||
StartedAt: &startedAt,
|
||||
EndedAt: endedAt,
|
||||
Tx: resp.Payload.Round.PoolTx,
|
||||
Tree: treeFromProto{resp.Payload.Round.CongestionTree}.parse(),
|
||||
ForfeitTxs: resp.Payload.Round.ForfeitTxs,
|
||||
Connectors: resp.Payload.Round.Connectors,
|
||||
Stage: toRoundStage(*resp.Payload.Round.Stage),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *restClient) GetBoardingAddress(
|
||||
ctx context.Context, pubkey string,
|
||||
) (string, error) {
|
||||
body := models.V1GetBoardingAddressRequest{
|
||||
Pubkey: pubkey,
|
||||
}
|
||||
|
||||
resp, err := a.svc.ArkServiceGetBoardingAddress(
|
||||
ark_service.NewArkServiceGetBoardingAddressParams().WithBody(&body),
|
||||
)
|
||||
if err != nil {
|
||||
return "",
|
||||
err
|
||||
}
|
||||
return resp.Payload.Address, nil
|
||||
}
|
||||
|
||||
func (a *restClient) SendTreeNonces(
|
||||
ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
|
||||
) error {
|
||||
var nonceBuffer bytes.Buffer
|
||||
|
||||
if err := nonces.Encode(&nonceBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedNonces := hex.EncodeToString(nonceBuffer.Bytes())
|
||||
|
||||
body := &models.V1SendTreeNoncesRequest{
|
||||
RoundID: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeNonces: serializedNonces,
|
||||
}
|
||||
|
||||
if _, err := a.svc.ArkServiceSendTreeNonces(
|
||||
ark_service.NewArkServiceSendTreeNoncesParams().WithBody(body),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *restClient) SendTreeSignatures(
|
||||
ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.TreePartialSigs,
|
||||
) error {
|
||||
var sigsBuffer bytes.Buffer
|
||||
|
||||
if err := signatures.Encode(&sigsBuffer); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serializedSigs := hex.EncodeToString(sigsBuffer.Bytes())
|
||||
|
||||
body := &models.V1SendTreeSignaturesRequest{
|
||||
RoundID: roundID,
|
||||
PublicKey: cosignerPubkey,
|
||||
TreeSignatures: serializedSigs,
|
||||
}
|
||||
|
||||
if _, err := a.svc.ArkServiceSendTreeSignatures(
|
||||
ark_service.NewArkServiceSendTreeSignaturesParams().WithBody(body),
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
func (c *restClient) Close() {}
|
||||
|
||||
func newRestClient(
|
||||
serviceURL string,
|
||||
|
||||
@@ -54,14 +54,10 @@ type ClientOption func(*runtime.ClientOperation)
|
||||
|
||||
// ClientService is the interface for Client methods
|
||||
type ClientService interface {
|
||||
ArkServiceClaimPayment(params *ArkServiceClaimPaymentParams, opts ...ClientOption) (*ArkServiceClaimPaymentOK, error)
|
||||
|
||||
ArkServiceCompletePayment(params *ArkServiceCompletePaymentParams, opts ...ClientOption) (*ArkServiceCompletePaymentOK, error)
|
||||
|
||||
ArkServiceCreatePayment(params *ArkServiceCreatePaymentParams, opts ...ClientOption) (*ArkServiceCreatePaymentOK, error)
|
||||
|
||||
ArkServiceFinalizePayment(params *ArkServiceFinalizePaymentParams, opts ...ClientOption) (*ArkServiceFinalizePaymentOK, error)
|
||||
|
||||
ArkServiceGetBoardingAddress(params *ArkServiceGetBoardingAddressParams, opts ...ClientOption) (*ArkServiceGetBoardingAddressOK, error)
|
||||
|
||||
ArkServiceGetEventStream(params *ArkServiceGetEventStreamParams, opts ...ClientOption) (*ArkServiceGetEventStreamOK, error)
|
||||
@@ -76,52 +72,19 @@ type ClientService interface {
|
||||
|
||||
ArkServicePing(params *ArkServicePingParams, opts ...ClientOption) (*ArkServicePingOK, error)
|
||||
|
||||
ArkServiceRegisterPayment(params *ArkServiceRegisterPaymentParams, opts ...ClientOption) (*ArkServiceRegisterPaymentOK, error)
|
||||
ArkServiceRegisterInputsForNextRound(params *ArkServiceRegisterInputsForNextRoundParams, opts ...ClientOption) (*ArkServiceRegisterInputsForNextRoundOK, error)
|
||||
|
||||
ArkServiceSendTreeNonces(params *ArkServiceSendTreeNoncesParams, opts ...ClientOption) (*ArkServiceSendTreeNoncesOK, error)
|
||||
ArkServiceRegisterOutputsForNextRound(params *ArkServiceRegisterOutputsForNextRoundParams, opts ...ClientOption) (*ArkServiceRegisterOutputsForNextRoundOK, error)
|
||||
|
||||
ArkServiceSendTreeSignatures(params *ArkServiceSendTreeSignaturesParams, opts ...ClientOption) (*ArkServiceSendTreeSignaturesOK, error)
|
||||
ArkServiceSubmitSignedForfeitTxs(params *ArkServiceSubmitSignedForfeitTxsParams, opts ...ClientOption) (*ArkServiceSubmitSignedForfeitTxsOK, error)
|
||||
|
||||
ArkServiceSubmitTreeNonces(params *ArkServiceSubmitTreeNoncesParams, opts ...ClientOption) (*ArkServiceSubmitTreeNoncesOK, error)
|
||||
|
||||
ArkServiceSubmitTreeSignatures(params *ArkServiceSubmitTreeSignaturesParams, opts ...ClientOption) (*ArkServiceSubmitTreeSignaturesOK, error)
|
||||
|
||||
SetTransport(transport runtime.ClientTransport)
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceClaimPayment ark service claim payment API
|
||||
*/
|
||||
func (a *Client) ArkServiceClaimPayment(params *ArkServiceClaimPaymentParams, opts ...ClientOption) (*ArkServiceClaimPaymentOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceClaimPaymentParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_ClaimPayment",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/payment/claim",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceClaimPaymentReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceClaimPaymentOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceClaimPaymentDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceCompletePayment ark service complete payment API
|
||||
*/
|
||||
@@ -196,43 +159,6 @@ func (a *Client) ArkServiceCreatePayment(params *ArkServiceCreatePaymentParams,
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceFinalizePayment ark service finalize payment API
|
||||
*/
|
||||
func (a *Client) ArkServiceFinalizePayment(params *ArkServiceFinalizePaymentParams, opts ...ClientOption) (*ArkServiceFinalizePaymentOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceFinalizePaymentParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_FinalizePayment",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/payment/finalize",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceFinalizePaymentReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceFinalizePaymentOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceFinalizePaymentDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceGetBoardingAddress ark service get boarding address API
|
||||
*/
|
||||
@@ -281,7 +207,7 @@ func (a *Client) ArkServiceGetEventStream(params *ArkServiceGetEventStreamParams
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_GetEventStream",
|
||||
Method: "GET",
|
||||
PathPattern: "/v1/events",
|
||||
PathPattern: "/v1/round/events",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
@@ -466,7 +392,7 @@ func (a *Client) ArkServicePing(params *ArkServicePingParams, opts ...ClientOpti
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_Ping",
|
||||
Method: "GET",
|
||||
PathPattern: "/v1/ping/{paymentId}",
|
||||
PathPattern: "/v1/round/ping/{paymentId}",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
@@ -493,22 +419,22 @@ func (a *Client) ArkServicePing(params *ArkServicePingParams, opts ...ClientOpti
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterPayment ark service register payment API
|
||||
ArkServiceRegisterInputsForNextRound ark service register inputs for next round API
|
||||
*/
|
||||
func (a *Client) ArkServiceRegisterPayment(params *ArkServiceRegisterPaymentParams, opts ...ClientOption) (*ArkServiceRegisterPaymentOK, error) {
|
||||
func (a *Client) ArkServiceRegisterInputsForNextRound(params *ArkServiceRegisterInputsForNextRoundParams, opts ...ClientOption) (*ArkServiceRegisterInputsForNextRoundOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceRegisterPaymentParams()
|
||||
params = NewArkServiceRegisterInputsForNextRoundParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_RegisterPayment",
|
||||
ID: "ArkService_RegisterInputsForNextRound",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/payment/register",
|
||||
PathPattern: "/v1/round/registerInputs",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceRegisterPaymentReader{formats: a.formats},
|
||||
Reader: &ArkServiceRegisterInputsForNextRoundReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
@@ -520,32 +446,32 @@ func (a *Client) ArkServiceRegisterPayment(params *ArkServiceRegisterPaymentPara
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceRegisterPaymentOK)
|
||||
success, ok := result.(*ArkServiceRegisterInputsForNextRoundOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceRegisterPaymentDefault)
|
||||
unexpectedSuccess := result.(*ArkServiceRegisterInputsForNextRoundDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSendTreeNonces ark service send tree nonces API
|
||||
ArkServiceRegisterOutputsForNextRound ark service register outputs for next round API
|
||||
*/
|
||||
func (a *Client) ArkServiceSendTreeNonces(params *ArkServiceSendTreeNoncesParams, opts ...ClientOption) (*ArkServiceSendTreeNoncesOK, error) {
|
||||
func (a *Client) ArkServiceRegisterOutputsForNextRound(params *ArkServiceRegisterOutputsForNextRoundParams, opts ...ClientOption) (*ArkServiceRegisterOutputsForNextRoundOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceSendTreeNoncesParams()
|
||||
params = NewArkServiceRegisterOutputsForNextRoundParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_SendTreeNonces",
|
||||
ID: "ArkService_RegisterOutputsForNextRound",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/payment/tree/nonces",
|
||||
PathPattern: "/v1/round/registerOutputs",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceSendTreeNoncesReader{formats: a.formats},
|
||||
Reader: &ArkServiceRegisterOutputsForNextRoundReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
@@ -557,32 +483,32 @@ func (a *Client) ArkServiceSendTreeNonces(params *ArkServiceSendTreeNoncesParams
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceSendTreeNoncesOK)
|
||||
success, ok := result.(*ArkServiceRegisterOutputsForNextRoundOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceSendTreeNoncesDefault)
|
||||
unexpectedSuccess := result.(*ArkServiceRegisterOutputsForNextRoundDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSendTreeSignatures ark service send tree signatures API
|
||||
ArkServiceSubmitSignedForfeitTxs ark service submit signed forfeit txs API
|
||||
*/
|
||||
func (a *Client) ArkServiceSendTreeSignatures(params *ArkServiceSendTreeSignaturesParams, opts ...ClientOption) (*ArkServiceSendTreeSignaturesOK, error) {
|
||||
func (a *Client) ArkServiceSubmitSignedForfeitTxs(params *ArkServiceSubmitSignedForfeitTxsParams, opts ...ClientOption) (*ArkServiceSubmitSignedForfeitTxsOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceSendTreeSignaturesParams()
|
||||
params = NewArkServiceSubmitSignedForfeitTxsParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_SendTreeSignatures",
|
||||
ID: "ArkService_SubmitSignedForfeitTxs",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/payment/tree/signatures",
|
||||
PathPattern: "/v1/round/submitForfeitTxs",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceSendTreeSignaturesReader{formats: a.formats},
|
||||
Reader: &ArkServiceSubmitSignedForfeitTxsReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
@@ -594,12 +520,86 @@ func (a *Client) ArkServiceSendTreeSignatures(params *ArkServiceSendTreeSignatur
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceSendTreeSignaturesOK)
|
||||
success, ok := result.(*ArkServiceSubmitSignedForfeitTxsOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceSendTreeSignaturesDefault)
|
||||
unexpectedSuccess := result.(*ArkServiceSubmitSignedForfeitTxsDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeNonces ark service submit tree nonces API
|
||||
*/
|
||||
func (a *Client) ArkServiceSubmitTreeNonces(params *ArkServiceSubmitTreeNoncesParams, opts ...ClientOption) (*ArkServiceSubmitTreeNoncesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceSubmitTreeNoncesParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_SubmitTreeNonces",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/round/tree/submitNonces",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceSubmitTreeNoncesReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceSubmitTreeNoncesOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceSubmitTreeNoncesDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeSignatures ark service submit tree signatures API
|
||||
*/
|
||||
func (a *Client) ArkServiceSubmitTreeSignatures(params *ArkServiceSubmitTreeSignaturesParams, opts ...ClientOption) (*ArkServiceSubmitTreeSignaturesOK, error) {
|
||||
// TODO: Validate the params before sending
|
||||
if params == nil {
|
||||
params = NewArkServiceSubmitTreeSignaturesParams()
|
||||
}
|
||||
op := &runtime.ClientOperation{
|
||||
ID: "ArkService_SubmitTreeSignatures",
|
||||
Method: "POST",
|
||||
PathPattern: "/v1/round/tree/submitSignatures",
|
||||
ProducesMediaTypes: []string{"application/json"},
|
||||
ConsumesMediaTypes: []string{"application/json"},
|
||||
Schemes: []string{"http"},
|
||||
Params: params,
|
||||
Reader: &ArkServiceSubmitTreeSignaturesReader{formats: a.formats},
|
||||
Context: params.Context,
|
||||
Client: params.HTTPClient,
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(op)
|
||||
}
|
||||
|
||||
result, err := a.transport.Submit(op)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
success, ok := result.(*ArkServiceSubmitTreeSignaturesOK)
|
||||
if ok {
|
||||
return success, nil
|
||||
}
|
||||
// unexpected success response
|
||||
unexpectedSuccess := result.(*ArkServiceSubmitTreeSignaturesDefault)
|
||||
return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
|
||||
}
|
||||
|
||||
|
||||
@@ -91,12 +91,12 @@ func (o *ArkServiceGetEventStreamOK) Code() int {
|
||||
|
||||
func (o *ArkServiceGetEventStreamOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetEventStreamOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/events][%d] arkServiceGetEventStreamOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetEventStreamOK) GetPayload() *ArkServiceGetEventStreamOKBody {
|
||||
@@ -165,12 +165,12 @@ func (o *ArkServiceGetEventStreamDefault) Code() int {
|
||||
|
||||
func (o *ArkServiceGetEventStreamDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetEventStreamDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/events][%d] ArkService_GetEventStream default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceGetEventStreamDefault) GetPayload() *models.RPCStatus {
|
||||
|
||||
@@ -88,12 +88,12 @@ func (o *ArkServicePingOK) Code() int {
|
||||
|
||||
func (o *ArkServicePingOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/ping/{paymentId}][%d] arkServicePingOK %s", 200, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/ping/{paymentId}][%d] arkServicePingOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServicePingOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/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 {
|
||||
@@ -162,12 +162,12 @@ func (o *ArkServicePingDefault) Code() int {
|
||||
|
||||
func (o *ArkServicePingDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/ping/{paymentId}][%d] ArkService_Ping default %s", o._statusCode, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/ping/{paymentId}][%d] ArkService_Ping default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServicePingDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[GET /v1/ping/{paymentId}][%d] ArkService_Ping default %s", o._statusCode, payload)
|
||||
return fmt.Sprintf("[GET /v1/round/ping/{paymentId}][%d] ArkService_Ping default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServicePingDefault) GetPayload() *models.RPCStatus {
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceRegisterInputsForNextRoundParams creates a new ArkServiceRegisterInputsForNextRoundParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceRegisterInputsForNextRoundParams() *ArkServiceRegisterInputsForNextRoundParams {
|
||||
return &ArkServiceRegisterInputsForNextRoundParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterInputsForNextRoundParamsWithTimeout creates a new ArkServiceRegisterInputsForNextRoundParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceRegisterInputsForNextRoundParamsWithTimeout(timeout time.Duration) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
return &ArkServiceRegisterInputsForNextRoundParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterInputsForNextRoundParamsWithContext creates a new ArkServiceRegisterInputsForNextRoundParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceRegisterInputsForNextRoundParamsWithContext(ctx context.Context) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
return &ArkServiceRegisterInputsForNextRoundParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterInputsForNextRoundParamsWithHTTPClient creates a new ArkServiceRegisterInputsForNextRoundParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceRegisterInputsForNextRoundParamsWithHTTPClient(client *http.Client) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
return &ArkServiceRegisterInputsForNextRoundParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterInputsForNextRoundParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service register inputs for next round operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceRegisterInputsForNextRoundParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1RegisterInputsForNextRoundRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service register inputs for next round params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) WithDefaults() *ArkServiceRegisterInputsForNextRoundParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service register inputs for next round params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) WithTimeout(timeout time.Duration) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) WithContext(ctx context.Context) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) WithHTTPClient(client *http.Client) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) WithBody(body *models.V1RegisterInputsForNextRoundRequest) *ArkServiceRegisterInputsForNextRoundParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service register inputs for next round params
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) SetBody(body *models.V1RegisterInputsForNextRoundRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceRegisterInputsForNextRoundParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceRegisterInputsForNextRoundReader is a Reader for the ArkServiceRegisterInputsForNextRound structure.
|
||||
type ArkServiceRegisterInputsForNextRoundReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceRegisterInputsForNextRoundReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceRegisterInputsForNextRoundOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceRegisterInputsForNextRoundDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterInputsForNextRoundOK creates a ArkServiceRegisterInputsForNextRoundOK with default headers values
|
||||
func NewArkServiceRegisterInputsForNextRoundOK() *ArkServiceRegisterInputsForNextRoundOK {
|
||||
return &ArkServiceRegisterInputsForNextRoundOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterInputsForNextRoundOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceRegisterInputsForNextRoundOK struct {
|
||||
Payload *models.V1RegisterInputsForNextRoundResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service register inputs for next round o k response has a 2xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service register inputs for next round o k response has a 3xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service register inputs for next round o k response has a 4xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service register inputs for next round o k response has a 5xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service register inputs for next round o k response a status code equal to that given
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service register inputs for next round o k response
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerInputs][%d] arkServiceRegisterInputsForNextRoundOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerInputs][%d] arkServiceRegisterInputsForNextRoundOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) GetPayload() *models.V1RegisterInputsForNextRoundResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.V1RegisterInputsForNextRoundResponse)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterInputsForNextRoundDefault creates a ArkServiceRegisterInputsForNextRoundDefault with default headers values
|
||||
func NewArkServiceRegisterInputsForNextRoundDefault(code int) *ArkServiceRegisterInputsForNextRoundDefault {
|
||||
return &ArkServiceRegisterInputsForNextRoundDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterInputsForNextRoundDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceRegisterInputsForNextRoundDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service register inputs for next round default response has a 2xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service register inputs for next round default response has a 3xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service register inputs for next round default response has a 4xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service register inputs for next round default response has a 5xx status code
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service register inputs for next round default response a status code equal to that given
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service register inputs for next round default response
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerInputs][%d] ArkService_RegisterInputsForNextRound default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerInputs][%d] ArkService_RegisterInputsForNextRound default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterInputsForNextRoundDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceRegisterOutputsForNextRoundParams creates a new ArkServiceRegisterOutputsForNextRoundParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceRegisterOutputsForNextRoundParams() *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
return &ArkServiceRegisterOutputsForNextRoundParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterOutputsForNextRoundParamsWithTimeout creates a new ArkServiceRegisterOutputsForNextRoundParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceRegisterOutputsForNextRoundParamsWithTimeout(timeout time.Duration) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
return &ArkServiceRegisterOutputsForNextRoundParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterOutputsForNextRoundParamsWithContext creates a new ArkServiceRegisterOutputsForNextRoundParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceRegisterOutputsForNextRoundParamsWithContext(ctx context.Context) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
return &ArkServiceRegisterOutputsForNextRoundParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterOutputsForNextRoundParamsWithHTTPClient creates a new ArkServiceRegisterOutputsForNextRoundParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceRegisterOutputsForNextRoundParamsWithHTTPClient(client *http.Client) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
return &ArkServiceRegisterOutputsForNextRoundParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterOutputsForNextRoundParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service register outputs for next round operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceRegisterOutputsForNextRoundParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1RegisterOutputsForNextRoundRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service register outputs for next round params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) WithDefaults() *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service register outputs for next round params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) WithTimeout(timeout time.Duration) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) WithContext(ctx context.Context) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) WithHTTPClient(client *http.Client) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) WithBody(body *models.V1RegisterOutputsForNextRoundRequest) *ArkServiceRegisterOutputsForNextRoundParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service register outputs for next round params
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) SetBody(body *models.V1RegisterOutputsForNextRoundRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceRegisterOutputsForNextRoundReader is a Reader for the ArkServiceRegisterOutputsForNextRound structure.
|
||||
type ArkServiceRegisterOutputsForNextRoundReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceRegisterOutputsForNextRoundOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceRegisterOutputsForNextRoundDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterOutputsForNextRoundOK creates a ArkServiceRegisterOutputsForNextRoundOK with default headers values
|
||||
func NewArkServiceRegisterOutputsForNextRoundOK() *ArkServiceRegisterOutputsForNextRoundOK {
|
||||
return &ArkServiceRegisterOutputsForNextRoundOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterOutputsForNextRoundOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceRegisterOutputsForNextRoundOK struct {
|
||||
Payload models.V1RegisterOutputsForNextRoundResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service register outputs for next round o k response has a 2xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service register outputs for next round o k response has a 3xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service register outputs for next round o k response has a 4xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service register outputs for next round o k response has a 5xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service register outputs for next round o k response a status code equal to that given
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service register outputs for next round o k response
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerOutputs][%d] arkServiceRegisterOutputsForNextRoundOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerOutputs][%d] arkServiceRegisterOutputsForNextRoundOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) GetPayload() models.V1RegisterOutputsForNextRoundResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceRegisterOutputsForNextRoundDefault creates a ArkServiceRegisterOutputsForNextRoundDefault with default headers values
|
||||
func NewArkServiceRegisterOutputsForNextRoundDefault(code int) *ArkServiceRegisterOutputsForNextRoundDefault {
|
||||
return &ArkServiceRegisterOutputsForNextRoundDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceRegisterOutputsForNextRoundDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceRegisterOutputsForNextRoundDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service register outputs for next round default response has a 2xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service register outputs for next round default response has a 3xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service register outputs for next round default response has a 4xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service register outputs for next round default response has a 5xx status code
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service register outputs for next round default response a status code equal to that given
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service register outputs for next round default response
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerOutputs][%d] ArkService_RegisterOutputsForNextRound default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/registerOutputs][%d] ArkService_RegisterOutputsForNextRound default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceRegisterOutputsForNextRoundDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTransactionsParams creates a new ArkServiceSubmitSignedForfeitTransactionsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceSubmitSignedForfeitTransactionsParams() *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTransactionsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTransactionsParamsWithTimeout creates a new ArkServiceSubmitSignedForfeitTransactionsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceSubmitSignedForfeitTransactionsParamsWithTimeout(timeout time.Duration) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTransactionsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTransactionsParamsWithContext creates a new ArkServiceSubmitSignedForfeitTransactionsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceSubmitSignedForfeitTransactionsParamsWithContext(ctx context.Context) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTransactionsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTransactionsParamsWithHTTPClient creates a new ArkServiceSubmitSignedForfeitTransactionsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceSubmitSignedForfeitTransactionsParamsWithHTTPClient(client *http.Client) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTransactionsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitSignedForfeitTransactionsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service submit signed forfeit transactions operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceSubmitSignedForfeitTransactionsParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1SubmitSignedForfeitTransactionsRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service submit signed forfeit transactions params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) WithDefaults() *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service submit signed forfeit transactions params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) WithTimeout(timeout time.Duration) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) WithContext(ctx context.Context) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) WithHTTPClient(client *http.Client) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) WithBody(body *models.V1SubmitSignedForfeitTransactionsRequest) *ArkServiceSubmitSignedForfeitTransactionsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service submit signed forfeit transactions params
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) SetBody(body *models.V1SubmitSignedForfeitTransactionsRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceSubmitSignedForfeitTransactionsReader is a Reader for the ArkServiceSubmitSignedForfeitTransactions structure.
|
||||
type ArkServiceSubmitSignedForfeitTransactionsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceSubmitSignedForfeitTransactionsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceSubmitSignedForfeitTransactionsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTransactionsOK creates a ArkServiceSubmitSignedForfeitTransactionsOK with default headers values
|
||||
func NewArkServiceSubmitSignedForfeitTransactionsOK() *ArkServiceSubmitSignedForfeitTransactionsOK {
|
||||
return &ArkServiceSubmitSignedForfeitTransactionsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitSignedForfeitTransactionsOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceSubmitSignedForfeitTransactionsOK struct {
|
||||
Payload models.V1SubmitSignedForfeitTransactionsResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit signed forfeit transactions o k response has a 2xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit signed forfeit transactions o k response has a 3xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit signed forfeit transactions o k response has a 4xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit signed forfeit transactions o k response has a 5xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit signed forfeit transactions o k response a status code equal to that given
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit signed forfeit transactions o k response
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] arkServiceSubmitSignedForfeitTransactionsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] arkServiceSubmitSignedForfeitTransactionsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) GetPayload() models.V1SubmitSignedForfeitTransactionsResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTransactionsDefault creates a ArkServiceSubmitSignedForfeitTransactionsDefault with default headers values
|
||||
func NewArkServiceSubmitSignedForfeitTransactionsDefault(code int) *ArkServiceSubmitSignedForfeitTransactionsDefault {
|
||||
return &ArkServiceSubmitSignedForfeitTransactionsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitSignedForfeitTransactionsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceSubmitSignedForfeitTransactionsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit signed forfeit transactions default response has a 2xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit signed forfeit transactions default response has a 3xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit signed forfeit transactions default response has a 4xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit signed forfeit transactions default response has a 5xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit signed forfeit transactions default response a status code equal to that given
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit signed forfeit transactions default response
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] ArkService_SubmitSignedForfeitTransactions default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] ArkService_SubmitSignedForfeitTransactions default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTransactionsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTxsParams creates a new ArkServiceSubmitSignedForfeitTxsParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceSubmitSignedForfeitTxsParams() *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTxsParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTxsParamsWithTimeout creates a new ArkServiceSubmitSignedForfeitTxsParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceSubmitSignedForfeitTxsParamsWithTimeout(timeout time.Duration) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTxsParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTxsParamsWithContext creates a new ArkServiceSubmitSignedForfeitTxsParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceSubmitSignedForfeitTxsParamsWithContext(ctx context.Context) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTxsParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTxsParamsWithHTTPClient creates a new ArkServiceSubmitSignedForfeitTxsParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceSubmitSignedForfeitTxsParamsWithHTTPClient(client *http.Client) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
return &ArkServiceSubmitSignedForfeitTxsParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitSignedForfeitTxsParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service submit signed forfeit txs operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceSubmitSignedForfeitTxsParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1SubmitSignedForfeitTxsRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service submit signed forfeit txs params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) WithDefaults() *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service submit signed forfeit txs params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) WithTimeout(timeout time.Duration) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) WithContext(ctx context.Context) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) WithHTTPClient(client *http.Client) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) WithBody(body *models.V1SubmitSignedForfeitTxsRequest) *ArkServiceSubmitSignedForfeitTxsParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service submit signed forfeit txs params
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) SetBody(body *models.V1SubmitSignedForfeitTxsRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceSubmitSignedForfeitTxsReader is a Reader for the ArkServiceSubmitSignedForfeitTxs structure.
|
||||
type ArkServiceSubmitSignedForfeitTxsReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceSubmitSignedForfeitTxsOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceSubmitSignedForfeitTxsDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTxsOK creates a ArkServiceSubmitSignedForfeitTxsOK with default headers values
|
||||
func NewArkServiceSubmitSignedForfeitTxsOK() *ArkServiceSubmitSignedForfeitTxsOK {
|
||||
return &ArkServiceSubmitSignedForfeitTxsOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitSignedForfeitTxsOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceSubmitSignedForfeitTxsOK struct {
|
||||
Payload models.V1SubmitSignedForfeitTxsResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit signed forfeit txs o k response has a 2xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit signed forfeit txs o k response has a 3xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit signed forfeit txs o k response has a 4xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit signed forfeit txs o k response has a 5xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit signed forfeit txs o k response a status code equal to that given
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit signed forfeit txs o k response
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] arkServiceSubmitSignedForfeitTxsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] arkServiceSubmitSignedForfeitTxsOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) GetPayload() models.V1SubmitSignedForfeitTxsResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitSignedForfeitTxsDefault creates a ArkServiceSubmitSignedForfeitTxsDefault with default headers values
|
||||
func NewArkServiceSubmitSignedForfeitTxsDefault(code int) *ArkServiceSubmitSignedForfeitTxsDefault {
|
||||
return &ArkServiceSubmitSignedForfeitTxsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitSignedForfeitTxsDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceSubmitSignedForfeitTxsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit signed forfeit txs default response has a 2xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit signed forfeit txs default response has a 3xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit signed forfeit txs default response has a 4xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit signed forfeit txs default response has a 5xx status code
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit signed forfeit txs default response a status code equal to that given
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit signed forfeit txs default response
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] ArkService_SubmitSignedForfeitTxs default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/submitForfeitTxs][%d] ArkService_SubmitSignedForfeitTxs default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitSignedForfeitTxsDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceSubmitTreeNoncesParams creates a new ArkServiceSubmitTreeNoncesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceSubmitTreeNoncesParams() *ArkServiceSubmitTreeNoncesParams {
|
||||
return &ArkServiceSubmitTreeNoncesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeNoncesParamsWithTimeout creates a new ArkServiceSubmitTreeNoncesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceSubmitTreeNoncesParamsWithTimeout(timeout time.Duration) *ArkServiceSubmitTreeNoncesParams {
|
||||
return &ArkServiceSubmitTreeNoncesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeNoncesParamsWithContext creates a new ArkServiceSubmitTreeNoncesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceSubmitTreeNoncesParamsWithContext(ctx context.Context) *ArkServiceSubmitTreeNoncesParams {
|
||||
return &ArkServiceSubmitTreeNoncesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeNoncesParamsWithHTTPClient creates a new ArkServiceSubmitTreeNoncesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceSubmitTreeNoncesParamsWithHTTPClient(client *http.Client) *ArkServiceSubmitTreeNoncesParams {
|
||||
return &ArkServiceSubmitTreeNoncesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeNoncesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service submit tree nonces operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceSubmitTreeNoncesParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1SubmitTreeNoncesRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service submit tree nonces params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) WithDefaults() *ArkServiceSubmitTreeNoncesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service submit tree nonces params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) WithTimeout(timeout time.Duration) *ArkServiceSubmitTreeNoncesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) WithContext(ctx context.Context) *ArkServiceSubmitTreeNoncesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) WithHTTPClient(client *http.Client) *ArkServiceSubmitTreeNoncesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) WithBody(body *models.V1SubmitTreeNoncesRequest) *ArkServiceSubmitTreeNoncesParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service submit tree nonces params
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) SetBody(body *models.V1SubmitTreeNoncesRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceSubmitTreeNoncesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceSubmitTreeNoncesReader is a Reader for the ArkServiceSubmitTreeNonces structure.
|
||||
type ArkServiceSubmitTreeNoncesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceSubmitTreeNoncesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceSubmitTreeNoncesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceSubmitTreeNoncesDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeNoncesOK creates a ArkServiceSubmitTreeNoncesOK with default headers values
|
||||
func NewArkServiceSubmitTreeNoncesOK() *ArkServiceSubmitTreeNoncesOK {
|
||||
return &ArkServiceSubmitTreeNoncesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeNoncesOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceSubmitTreeNoncesOK struct {
|
||||
Payload models.V1SubmitTreeNoncesResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit tree nonces o k response has a 2xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit tree nonces o k response has a 3xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit tree nonces o k response has a 4xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit tree nonces o k response has a 5xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit tree nonces o k response a status code equal to that given
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit tree nonces o k response
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitNonces][%d] arkServiceSubmitTreeNoncesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitNonces][%d] arkServiceSubmitTreeNoncesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) GetPayload() models.V1SubmitTreeNoncesResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeNoncesDefault creates a ArkServiceSubmitTreeNoncesDefault with default headers values
|
||||
func NewArkServiceSubmitTreeNoncesDefault(code int) *ArkServiceSubmitTreeNoncesDefault {
|
||||
return &ArkServiceSubmitTreeNoncesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeNoncesDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceSubmitTreeNoncesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit tree nonces default response has a 2xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit tree nonces default response has a 3xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit tree nonces default response has a 4xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit tree nonces default response has a 5xx status code
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit tree nonces default response a status code equal to that given
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit tree nonces default response
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitNonces][%d] ArkService_SubmitTreeNonces default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitNonces][%d] ArkService_SubmitTreeNonces default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeNoncesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
cr "github.com/go-openapi/runtime/client"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// NewArkServiceSubmitTreeSignaturesParams creates a new ArkServiceSubmitTreeSignaturesParams object,
|
||||
// with the default timeout for this client.
|
||||
//
|
||||
// Default values are not hydrated, since defaults are normally applied by the API server side.
|
||||
//
|
||||
// To enforce default values in parameter, use SetDefaults or WithDefaults.
|
||||
func NewArkServiceSubmitTreeSignaturesParams() *ArkServiceSubmitTreeSignaturesParams {
|
||||
return &ArkServiceSubmitTreeSignaturesParams{
|
||||
timeout: cr.DefaultTimeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeSignaturesParamsWithTimeout creates a new ArkServiceSubmitTreeSignaturesParams object
|
||||
// with the ability to set a timeout on a request.
|
||||
func NewArkServiceSubmitTreeSignaturesParamsWithTimeout(timeout time.Duration) *ArkServiceSubmitTreeSignaturesParams {
|
||||
return &ArkServiceSubmitTreeSignaturesParams{
|
||||
timeout: timeout,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeSignaturesParamsWithContext creates a new ArkServiceSubmitTreeSignaturesParams object
|
||||
// with the ability to set a context for a request.
|
||||
func NewArkServiceSubmitTreeSignaturesParamsWithContext(ctx context.Context) *ArkServiceSubmitTreeSignaturesParams {
|
||||
return &ArkServiceSubmitTreeSignaturesParams{
|
||||
Context: ctx,
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeSignaturesParamsWithHTTPClient creates a new ArkServiceSubmitTreeSignaturesParams object
|
||||
// with the ability to set a custom HTTPClient for a request.
|
||||
func NewArkServiceSubmitTreeSignaturesParamsWithHTTPClient(client *http.Client) *ArkServiceSubmitTreeSignaturesParams {
|
||||
return &ArkServiceSubmitTreeSignaturesParams{
|
||||
HTTPClient: client,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeSignaturesParams contains all the parameters to send to the API endpoint
|
||||
|
||||
for the ark service submit tree signatures operation.
|
||||
|
||||
Typically these are written to a http.Request.
|
||||
*/
|
||||
type ArkServiceSubmitTreeSignaturesParams struct {
|
||||
|
||||
// Body.
|
||||
Body *models.V1SubmitTreeSignaturesRequest
|
||||
|
||||
timeout time.Duration
|
||||
Context context.Context
|
||||
HTTPClient *http.Client
|
||||
}
|
||||
|
||||
// WithDefaults hydrates default values in the ark service submit tree signatures params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) WithDefaults() *ArkServiceSubmitTreeSignaturesParams {
|
||||
o.SetDefaults()
|
||||
return o
|
||||
}
|
||||
|
||||
// SetDefaults hydrates default values in the ark service submit tree signatures params (not the query body).
|
||||
//
|
||||
// All values with no default are reset to their zero value.
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) SetDefaults() {
|
||||
// no default values defined for this parameter
|
||||
}
|
||||
|
||||
// WithTimeout adds the timeout to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) WithTimeout(timeout time.Duration) *ArkServiceSubmitTreeSignaturesParams {
|
||||
o.SetTimeout(timeout)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetTimeout adds the timeout to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) SetTimeout(timeout time.Duration) {
|
||||
o.timeout = timeout
|
||||
}
|
||||
|
||||
// WithContext adds the context to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) WithContext(ctx context.Context) *ArkServiceSubmitTreeSignaturesParams {
|
||||
o.SetContext(ctx)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetContext adds the context to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) SetContext(ctx context.Context) {
|
||||
o.Context = ctx
|
||||
}
|
||||
|
||||
// WithHTTPClient adds the HTTPClient to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) WithHTTPClient(client *http.Client) *ArkServiceSubmitTreeSignaturesParams {
|
||||
o.SetHTTPClient(client)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetHTTPClient adds the HTTPClient to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) SetHTTPClient(client *http.Client) {
|
||||
o.HTTPClient = client
|
||||
}
|
||||
|
||||
// WithBody adds the body to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) WithBody(body *models.V1SubmitTreeSignaturesRequest) *ArkServiceSubmitTreeSignaturesParams {
|
||||
o.SetBody(body)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBody adds the body to the ark service submit tree signatures params
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) SetBody(body *models.V1SubmitTreeSignaturesRequest) {
|
||||
o.Body = body
|
||||
}
|
||||
|
||||
// WriteToRequest writes these params to a swagger request
|
||||
func (o *ArkServiceSubmitTreeSignaturesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
||||
|
||||
if err := r.SetTimeout(o.timeout); err != nil {
|
||||
return err
|
||||
}
|
||||
var res []error
|
||||
if o.Body != nil {
|
||||
if err := r.SetBodyParam(o.Body); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package ark_service
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/ark-network/ark/pkg/client-sdk/client/rest/service/models"
|
||||
)
|
||||
|
||||
// ArkServiceSubmitTreeSignaturesReader is a Reader for the ArkServiceSubmitTreeSignatures structure.
|
||||
type ArkServiceSubmitTreeSignaturesReader struct {
|
||||
formats strfmt.Registry
|
||||
}
|
||||
|
||||
// ReadResponse reads a server response into the received o.
|
||||
func (o *ArkServiceSubmitTreeSignaturesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
|
||||
switch response.Code() {
|
||||
case 200:
|
||||
result := NewArkServiceSubmitTreeSignaturesOK()
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
default:
|
||||
result := NewArkServiceSubmitTreeSignaturesDefault(response.Code())
|
||||
if err := result.readResponse(response, consumer, o.formats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code()/100 == 2 {
|
||||
return result, nil
|
||||
}
|
||||
return nil, result
|
||||
}
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeSignaturesOK creates a ArkServiceSubmitTreeSignaturesOK with default headers values
|
||||
func NewArkServiceSubmitTreeSignaturesOK() *ArkServiceSubmitTreeSignaturesOK {
|
||||
return &ArkServiceSubmitTreeSignaturesOK{}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeSignaturesOK describes a response with status code 200, with default header values.
|
||||
|
||||
A successful response.
|
||||
*/
|
||||
type ArkServiceSubmitTreeSignaturesOK struct {
|
||||
Payload models.V1SubmitTreeSignaturesResponse
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit tree signatures o k response has a 2xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) IsSuccess() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit tree signatures o k response has a 3xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) IsRedirect() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit tree signatures o k response has a 4xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) IsClientError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit tree signatures o k response has a 5xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) IsServerError() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit tree signatures o k response a status code equal to that given
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) IsCode(code int) bool {
|
||||
return code == 200
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit tree signatures o k response
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) Code() int {
|
||||
return 200
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitSignatures][%d] arkServiceSubmitTreeSignaturesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitSignatures][%d] arkServiceSubmitTreeSignaturesOK %s", 200, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) GetPayload() models.V1SubmitTreeSignaturesResponse {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewArkServiceSubmitTreeSignaturesDefault creates a ArkServiceSubmitTreeSignaturesDefault with default headers values
|
||||
func NewArkServiceSubmitTreeSignaturesDefault(code int) *ArkServiceSubmitTreeSignaturesDefault {
|
||||
return &ArkServiceSubmitTreeSignaturesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ArkServiceSubmitTreeSignaturesDefault describes a response with status code -1, with default header values.
|
||||
|
||||
An unexpected error response.
|
||||
*/
|
||||
type ArkServiceSubmitTreeSignaturesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
Payload *models.RPCStatus
|
||||
}
|
||||
|
||||
// IsSuccess returns true when this ark service submit tree signatures default response has a 2xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) IsSuccess() bool {
|
||||
return o._statusCode/100 == 2
|
||||
}
|
||||
|
||||
// IsRedirect returns true when this ark service submit tree signatures default response has a 3xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) IsRedirect() bool {
|
||||
return o._statusCode/100 == 3
|
||||
}
|
||||
|
||||
// IsClientError returns true when this ark service submit tree signatures default response has a 4xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) IsClientError() bool {
|
||||
return o._statusCode/100 == 4
|
||||
}
|
||||
|
||||
// IsServerError returns true when this ark service submit tree signatures default response has a 5xx status code
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) IsServerError() bool {
|
||||
return o._statusCode/100 == 5
|
||||
}
|
||||
|
||||
// IsCode returns true when this ark service submit tree signatures default response a status code equal to that given
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) IsCode(code int) bool {
|
||||
return o._statusCode == code
|
||||
}
|
||||
|
||||
// Code gets the status code for the ark service submit tree signatures default response
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) Code() int {
|
||||
return o._statusCode
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) Error() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitSignatures][%d] ArkService_SubmitTreeSignatures default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) String() string {
|
||||
payload, _ := json.Marshal(o.Payload)
|
||||
return fmt.Sprintf("[POST /v1/round/tree/submitSignatures][%d] ArkService_SubmitTreeSignatures default %s", o._statusCode, payload)
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) GetPayload() *models.RPCStatus {
|
||||
return o.Payload
|
||||
}
|
||||
|
||||
func (o *ArkServiceSubmitTreeSignaturesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
|
||||
|
||||
o.Payload = new(models.RPCStatus)
|
||||
|
||||
// response payload
|
||||
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -40,6 +40,9 @@ type V1GetInfoResponse struct {
|
||||
|
||||
// unilateral exit delay
|
||||
UnilateralExitDelay string `json:"unilateralExitDelay,omitempty"`
|
||||
|
||||
// vtxo descriptor templates
|
||||
VtxoDescriptorTemplates []string `json:"vtxoDescriptorTemplates"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 get info response
|
||||
|
||||
@@ -17,13 +17,13 @@ import (
|
||||
// swagger:model v1Output
|
||||
type V1Output struct {
|
||||
|
||||
// onchain
|
||||
// onchain or off-chain
|
||||
Address string `json:"address,omitempty"`
|
||||
|
||||
// Amount to send in satoshis.
|
||||
Amount string `json:"amount,omitempty"`
|
||||
|
||||
// offchain
|
||||
// descriptor
|
||||
Descriptor string `json:"descriptor,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1RegisterInputsForNextRoundRequest v1 register inputs for next round request
|
||||
//
|
||||
// swagger:model v1RegisterInputsForNextRoundRequest
|
||||
type V1RegisterInputsForNextRoundRequest struct {
|
||||
|
||||
// ephemeral pubkey
|
||||
EphemeralPubkey string `json:"ephemeralPubkey,omitempty"`
|
||||
|
||||
// inputs
|
||||
Inputs []*V1Input `json:"inputs"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 register inputs for next round request
|
||||
func (m *V1RegisterInputsForNextRoundRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateInputs(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1RegisterInputsForNextRoundRequest) validateInputs(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Inputs) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Inputs); i++ {
|
||||
if swag.IsZero(m.Inputs[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Inputs[i] != nil {
|
||||
if err := m.Inputs[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("inputs" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("inputs" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this v1 register inputs for next round request based on the context it is used
|
||||
func (m *V1RegisterInputsForNextRoundRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateInputs(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1RegisterInputsForNextRoundRequest) contextValidateInputs(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Inputs); i++ {
|
||||
|
||||
if m.Inputs[i] != nil {
|
||||
|
||||
if swag.IsZero(m.Inputs[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Inputs[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("inputs" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("inputs" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1RegisterInputsForNextRoundRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1RegisterInputsForNextRoundRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1RegisterInputsForNextRoundRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1RegisterInputsForNextRoundResponse v1 register inputs for next round response
|
||||
//
|
||||
// swagger:model v1RegisterInputsForNextRoundResponse
|
||||
type V1RegisterInputsForNextRoundResponse struct {
|
||||
|
||||
// Mocks wabisabi's blinded credentials.
|
||||
ID string `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 register inputs for next round response
|
||||
func (m *V1RegisterInputsForNextRoundResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 register inputs for next round response based on context it is used
|
||||
func (m *V1RegisterInputsForNextRoundResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1RegisterInputsForNextRoundResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1RegisterInputsForNextRoundResponse) UnmarshalBinary(b []byte) error {
|
||||
var res V1RegisterInputsForNextRoundResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1RegisterOutputsForNextRoundRequest v1 register outputs for next round request
|
||||
//
|
||||
// swagger:model v1RegisterOutputsForNextRoundRequest
|
||||
type V1RegisterOutputsForNextRoundRequest struct {
|
||||
|
||||
// Mocks wabisabi's blinded credentials.
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
// List of receivers for a registered payment.
|
||||
Outputs []*V1Output `json:"outputs"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 register outputs for next round request
|
||||
func (m *V1RegisterOutputsForNextRoundRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateOutputs(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1RegisterOutputsForNextRoundRequest) validateOutputs(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Outputs) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Outputs); i++ {
|
||||
if swag.IsZero(m.Outputs[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Outputs[i] != nil {
|
||||
if err := m.Outputs[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("outputs" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("outputs" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this v1 register outputs for next round request based on the context it is used
|
||||
func (m *V1RegisterOutputsForNextRoundRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateOutputs(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *V1RegisterOutputsForNextRoundRequest) contextValidateOutputs(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Outputs); i++ {
|
||||
|
||||
if m.Outputs[i] != nil {
|
||||
|
||||
if swag.IsZero(m.Outputs[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Outputs[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("outputs" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("outputs" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1RegisterOutputsForNextRoundRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1RegisterOutputsForNextRoundRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1RegisterOutputsForNextRoundRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// V1RegisterOutputsForNextRoundResponse v1 register outputs for next round response
|
||||
//
|
||||
// swagger:model v1RegisterOutputsForNextRoundResponse
|
||||
type V1RegisterOutputsForNextRoundResponse interface{}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1SubmitSignedForfeitTransactionsRequest v1 submit signed forfeit transactions request
|
||||
//
|
||||
// swagger:model v1SubmitSignedForfeitTransactionsRequest
|
||||
type V1SubmitSignedForfeitTransactionsRequest struct {
|
||||
|
||||
// Forfeit txs signed by the user.
|
||||
SignedForfeitTxs []string `json:"signedForfeitTxs"`
|
||||
|
||||
// If payment has boarding input, the user must sign the associated inputs.
|
||||
SignedRoundTx string `json:"signedRoundTx,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 submit signed forfeit transactions request
|
||||
func (m *V1SubmitSignedForfeitTransactionsRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 submit signed forfeit transactions request based on context it is used
|
||||
func (m *V1SubmitSignedForfeitTransactionsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1SubmitSignedForfeitTransactionsRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1SubmitSignedForfeitTransactionsRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1SubmitSignedForfeitTransactionsRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// V1SubmitSignedForfeitTransactionsResponse v1 submit signed forfeit transactions response
|
||||
//
|
||||
// swagger:model v1SubmitSignedForfeitTransactionsResponse
|
||||
type V1SubmitSignedForfeitTransactionsResponse interface{}
|
||||
@@ -0,0 +1,53 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1SubmitSignedForfeitTxsRequest v1 submit signed forfeit txs request
|
||||
//
|
||||
// swagger:model v1SubmitSignedForfeitTxsRequest
|
||||
type V1SubmitSignedForfeitTxsRequest struct {
|
||||
|
||||
// Forfeit txs signed by the user.
|
||||
SignedForfeitTxs []string `json:"signedForfeitTxs"`
|
||||
|
||||
// If payment has boarding input, the user must sign the associated inputs.
|
||||
SignedRoundTx string `json:"signedRoundTx,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 submit signed forfeit txs request
|
||||
func (m *V1SubmitSignedForfeitTxsRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 submit signed forfeit txs request based on context it is used
|
||||
func (m *V1SubmitSignedForfeitTxsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1SubmitSignedForfeitTxsRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1SubmitSignedForfeitTxsRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1SubmitSignedForfeitTxsRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// V1SubmitSignedForfeitTxsResponse v1 submit signed forfeit txs response
|
||||
//
|
||||
// swagger:model v1SubmitSignedForfeitTxsResponse
|
||||
type V1SubmitSignedForfeitTxsResponse interface{}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1SubmitTreeNoncesRequest v1 submit tree nonces request
|
||||
//
|
||||
// swagger:model v1SubmitTreeNoncesRequest
|
||||
type V1SubmitTreeNoncesRequest struct {
|
||||
|
||||
// public key
|
||||
PublicKey string `json:"publicKey,omitempty"`
|
||||
|
||||
// round Id
|
||||
RoundID string `json:"roundId,omitempty"`
|
||||
|
||||
// tree nonces
|
||||
TreeNonces string `json:"treeNonces,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 submit tree nonces request
|
||||
func (m *V1SubmitTreeNoncesRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 submit tree nonces request based on context it is used
|
||||
func (m *V1SubmitTreeNoncesRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1SubmitTreeNoncesRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1SubmitTreeNoncesRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1SubmitTreeNoncesRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// V1SubmitTreeNoncesResponse v1 submit tree nonces response
|
||||
//
|
||||
// swagger:model v1SubmitTreeNoncesResponse
|
||||
type V1SubmitTreeNoncesResponse interface{}
|
||||
@@ -0,0 +1,56 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// V1SubmitTreeSignaturesRequest v1 submit tree signatures request
|
||||
//
|
||||
// swagger:model v1SubmitTreeSignaturesRequest
|
||||
type V1SubmitTreeSignaturesRequest struct {
|
||||
|
||||
// public key
|
||||
PublicKey string `json:"publicKey,omitempty"`
|
||||
|
||||
// round Id
|
||||
RoundID string `json:"roundId,omitempty"`
|
||||
|
||||
// tree signatures
|
||||
TreeSignatures string `json:"treeSignatures,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this v1 submit tree signatures request
|
||||
func (m *V1SubmitTreeSignaturesRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this v1 submit tree signatures request based on context it is used
|
||||
func (m *V1SubmitTreeSignaturesRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *V1SubmitTreeSignaturesRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *V1SubmitTreeSignaturesRequest) UnmarshalBinary(b []byte) error {
|
||||
var res V1SubmitTreeSignaturesRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// V1SubmitTreeSignaturesResponse v1 submit tree signatures response
|
||||
//
|
||||
// swagger:model v1SubmitTreeSignaturesResponse
|
||||
type V1SubmitTreeSignaturesResponse interface{}
|
||||
@@ -481,12 +481,12 @@ func (a *covenantArkClient) CollaborativeRedeem(
|
||||
})
|
||||
}
|
||||
|
||||
paymentID, err := a.client.RegisterPayment(ctx, inputs, "") // ephemeralPublicKey is not required for covenant
|
||||
paymentID, err := a.client.RegisterInputsForNextRound(ctx, inputs, "") // ephemeralPublicKey is not required for covenant
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := a.client.ClaimPayment(ctx, paymentID, receivers); err != nil {
|
||||
if err := a.client.RegisterOutputsForNextRound(ctx, paymentID, receivers); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -900,14 +900,14 @@ func (a *covenantArkClient) sendOffchain(
|
||||
})
|
||||
}
|
||||
|
||||
paymentID, err := a.client.RegisterPayment(
|
||||
paymentID, err := a.client.RegisterInputsForNextRound(
|
||||
ctx, inputs, "", // ephemeralPublicKey is not required for covenant
|
||||
)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := a.client.ClaimPayment(
|
||||
if err := a.client.RegisterOutputsForNextRound(
|
||||
ctx, paymentID, receiversOutput,
|
||||
); err != nil {
|
||||
return "", err
|
||||
@@ -1058,7 +1058,7 @@ func (a *covenantArkClient) handleRoundStream(
|
||||
}
|
||||
|
||||
log.Info("finalizing payment... ")
|
||||
if err := a.client.FinalizePayment(ctx, signedForfeitTxs, signedRoundTx); err != nil {
|
||||
if err := a.client.SubmitSignedForfeitTxs(ctx, signedForfeitTxs, signedRoundTx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -1632,12 +1632,12 @@ func (a *covenantArkClient) selfTransferAllPendingPayments(
|
||||
|
||||
outputs := []client.Output{myself}
|
||||
|
||||
paymentID, err := a.client.RegisterPayment(ctx, inputs, "") // ephemeralPublicKey is not required for covenant
|
||||
paymentID, err := a.client.RegisterInputsForNextRound(ctx, inputs, "") // ephemeralPublicKey is not required for covenant
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := a.client.ClaimPayment(ctx, paymentID, outputs); err != nil {
|
||||
if err := a.client.RegisterOutputsForNextRound(ctx, paymentID, outputs); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
||||
@@ -521,7 +521,7 @@ func (a *covenantlessArkClient) CollaborativeRedeem(
|
||||
return "", err
|
||||
}
|
||||
|
||||
paymentID, err := a.client.RegisterPayment(
|
||||
paymentID, err := a.client.RegisterInputsForNextRound(
|
||||
ctx,
|
||||
inputs,
|
||||
hex.EncodeToString(roundEphemeralKey.PubKey().SerializeCompressed()),
|
||||
@@ -530,7 +530,7 @@ func (a *covenantlessArkClient) CollaborativeRedeem(
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := a.client.ClaimPayment(ctx, paymentID, receivers); err != nil {
|
||||
if err := a.client.RegisterOutputsForNextRound(ctx, paymentID, receivers); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -1005,14 +1005,14 @@ func (a *covenantlessArkClient) sendOffchain(
|
||||
return "", err
|
||||
}
|
||||
|
||||
paymentID, err := a.client.RegisterPayment(
|
||||
paymentID, err := a.client.RegisterInputsForNextRound(
|
||||
ctx, inputs, hex.EncodeToString(roundEphemeralKey.PubKey().SerializeCompressed()),
|
||||
)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := a.client.ClaimPayment(
|
||||
if err := a.client.RegisterOutputsForNextRound(
|
||||
ctx, paymentID, receiversOutput,
|
||||
); err != nil {
|
||||
return "", err
|
||||
@@ -1203,7 +1203,7 @@ func (a *covenantlessArkClient) handleRoundStream(
|
||||
}
|
||||
|
||||
log.Info("finalizing payment... ")
|
||||
if err := a.client.FinalizePayment(ctx, signedForfeitTxs, signedRoundTx); err != nil {
|
||||
if err := a.client.SubmitSignedForfeitTxs(ctx, signedForfeitTxs, signedRoundTx); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -1255,7 +1255,7 @@ func (a *covenantlessArkClient) handleRoundSigningStarted(
|
||||
|
||||
myPubKey := hex.EncodeToString(ephemeralKey.PubKey().SerializeCompressed())
|
||||
|
||||
err = a.arkClient.client.SendTreeNonces(ctx, event.ID, myPubKey, nonces)
|
||||
err = a.arkClient.client.SubmitTreeNonces(ctx, event.ID, myPubKey, nonces)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -1279,7 +1279,7 @@ func (a *covenantlessArkClient) handleRoundSigningNoncesGenerated(
|
||||
return err
|
||||
}
|
||||
|
||||
if err := a.arkClient.client.SendTreeSignatures(
|
||||
if err := a.arkClient.client.SubmitTreeSignatures(
|
||||
ctx,
|
||||
event.ID,
|
||||
hex.EncodeToString(ephemeralKey.PubKey().SerializeCompressed()),
|
||||
@@ -1994,7 +1994,7 @@ func (a *covenantlessArkClient) selfTransferAllPendingPayments(
|
||||
return "", err
|
||||
}
|
||||
|
||||
paymentID, err := a.client.RegisterPayment(
|
||||
paymentID, err := a.client.RegisterInputsForNextRound(
|
||||
ctx,
|
||||
inputs,
|
||||
hex.EncodeToString(roundEphemeralKey.PubKey().SerializeCompressed()),
|
||||
@@ -2003,7 +2003,7 @@ func (a *covenantlessArkClient) selfTransferAllPendingPayments(
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := a.client.ClaimPayment(ctx, paymentID, outputs); err != nil {
|
||||
if err := a.client.RegisterOutputsForNextRound(ctx, paymentID, outputs); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
||||
@@ -40,63 +40,228 @@ func NewHandler(service application.Service) arkv1.ArkServiceServer {
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *handler) CompletePayment(ctx context.Context, req *arkv1.CompletePaymentRequest) (*arkv1.CompletePaymentResponse, error) {
|
||||
if req.GetSignedRedeemTx() == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing signed redeem tx")
|
||||
}
|
||||
|
||||
if len(req.GetSignedUnconditionalForfeitTxs()) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing signed unconditional forfeit txs")
|
||||
}
|
||||
|
||||
if err := h.svc.CompleteAsyncPayment(
|
||||
ctx, req.GetSignedRedeemTx(), req.GetSignedUnconditionalForfeitTxs(),
|
||||
); err != nil {
|
||||
func (h *handler) GetInfo(
|
||||
ctx context.Context, req *arkv1.GetInfoRequest,
|
||||
) (*arkv1.GetInfoResponse, error) {
|
||||
info, err := h.svc.GetInfo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.CompletePaymentResponse{}, nil
|
||||
return &arkv1.GetInfoResponse{
|
||||
Pubkey: info.PubKey,
|
||||
RoundLifetime: info.RoundLifetime,
|
||||
UnilateralExitDelay: info.UnilateralExitDelay,
|
||||
RoundInterval: info.RoundInterval,
|
||||
Network: info.Network,
|
||||
Dust: int64(info.Dust),
|
||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||
ForfeitAddress: info.ForfeitAddress,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) CreatePayment(ctx context.Context, req *arkv1.CreatePaymentRequest) (*arkv1.CreatePaymentResponse, error) {
|
||||
func (h *handler) GetBoardingAddress(
|
||||
ctx context.Context, req *arkv1.GetBoardingAddressRequest,
|
||||
) (*arkv1.GetBoardingAddressResponse, error) {
|
||||
pubkey := req.GetPubkey()
|
||||
if pubkey == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing pubkey")
|
||||
}
|
||||
|
||||
pubkeyBytes, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid pubkey (invalid hex)")
|
||||
}
|
||||
|
||||
userPubkey, err := secp256k1.ParsePubKey(pubkeyBytes)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid pubkey (parse error)")
|
||||
}
|
||||
|
||||
addr, descriptor, err := h.svc.GetBoardingAddress(ctx, userPubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetBoardingAddressResponse{
|
||||
Address: addr,
|
||||
Descriptor_: descriptor,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) RegisterInputsForNextRound(
|
||||
ctx context.Context, req *arkv1.RegisterInputsForNextRoundRequest,
|
||||
) (*arkv1.RegisterInputsForNextRoundResponse, error) {
|
||||
inputs, err := parseInputs(req.GetInputs())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
id, err := h.svc.SpendVtxos(ctx, inputs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pubkey := req.GetEphemeralPubkey()
|
||||
if len(pubkey) > 0 {
|
||||
if err := h.svc.RegisterCosignerPubkey(ctx, id, pubkey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &arkv1.RegisterInputsForNextRoundResponse{
|
||||
Id: id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) RegisterOutputsForNextRound(
|
||||
ctx context.Context, req *arkv1.RegisterOutputsForNextRoundRequest,
|
||||
) (*arkv1.RegisterOutputsForNextRoundResponse, error) {
|
||||
receivers, err := parseReceivers(req.GetOutputs())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
for _, receiver := range receivers {
|
||||
if receiver.Amount <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "output amount must be greater than 0")
|
||||
}
|
||||
|
||||
if len(receiver.OnchainAddress) > 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "onchain address is not supported as async payment destination")
|
||||
}
|
||||
|
||||
if len(receiver.Descriptor) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing output descriptor")
|
||||
}
|
||||
}
|
||||
|
||||
redeemTx, unconditionalForfeitTxs, err := h.svc.CreateAsyncPayment(
|
||||
ctx, inputs, receivers,
|
||||
)
|
||||
if err != nil {
|
||||
if err := h.svc.ClaimVtxos(ctx, req.GetId(), receivers); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.CreatePaymentResponse{
|
||||
SignedRedeemTx: redeemTx,
|
||||
UsignedUnconditionalForfeitTxs: unconditionalForfeitTxs,
|
||||
}, nil
|
||||
return &arkv1.RegisterOutputsForNextRoundResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) Ping(ctx context.Context, req *arkv1.PingRequest) (*arkv1.PingResponse, error) {
|
||||
func (h *handler) SubmitTreeNonces(
|
||||
ctx context.Context, req *arkv1.SubmitTreeNoncesRequest,
|
||||
) (*arkv1.SubmitTreeNoncesResponse, error) {
|
||||
pubkey := req.GetPublicKey()
|
||||
encodedNonces := req.GetTreeNonces()
|
||||
roundID := req.GetRoundId()
|
||||
|
||||
if len(pubkey) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing cosigner public key")
|
||||
}
|
||||
|
||||
if len(encodedNonces) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing tree nonces")
|
||||
}
|
||||
|
||||
if len(roundID) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing round id")
|
||||
}
|
||||
|
||||
pubkeyBytes, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
cosignerPublicKey, err := secp256k1.ParsePubKey(pubkeyBytes)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
if err := h.svc.RegisterCosignerNonces(
|
||||
ctx, roundID, cosignerPublicKey, encodedNonces,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.SubmitTreeNoncesResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) SubmitTreeSignatures(
|
||||
ctx context.Context, req *arkv1.SubmitTreeSignaturesRequest,
|
||||
) (*arkv1.SubmitTreeSignaturesResponse, error) {
|
||||
roundID := req.GetRoundId()
|
||||
pubkey := req.GetPublicKey()
|
||||
encodedSignatures := req.GetTreeSignatures()
|
||||
|
||||
if len(pubkey) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing cosigner public key")
|
||||
}
|
||||
|
||||
if len(encodedSignatures) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing tree signatures")
|
||||
}
|
||||
|
||||
if len(roundID) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing round id")
|
||||
}
|
||||
|
||||
pubkeyBytes, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
cosignerPublicKey, err := secp256k1.ParsePubKey(pubkeyBytes)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
if err := h.svc.RegisterCosignerSignatures(
|
||||
ctx, roundID, cosignerPublicKey, encodedSignatures,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.SubmitTreeSignaturesResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) SubmitSignedForfeitTxs(
|
||||
ctx context.Context, req *arkv1.SubmitSignedForfeitTxsRequest,
|
||||
) (*arkv1.SubmitSignedForfeitTxsResponse, error) {
|
||||
forfeitTxs := req.GetSignedForfeitTxs()
|
||||
roundTx := req.GetSignedRoundTx()
|
||||
|
||||
if len(forfeitTxs) <= 0 && roundTx == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing forfeit txs or round tx")
|
||||
}
|
||||
|
||||
if len(forfeitTxs) > 0 {
|
||||
if err := h.svc.SignVtxos(ctx, forfeitTxs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if roundTx != "" {
|
||||
if err := h.svc.SignRoundTx(ctx, roundTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &arkv1.SubmitSignedForfeitTxsResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) GetEventStream(
|
||||
_ *arkv1.GetEventStreamRequest, stream arkv1.ArkService_GetEventStreamServer,
|
||||
) error {
|
||||
doneCh := make(chan struct{})
|
||||
|
||||
listener := &listener{
|
||||
id: uuid.NewString(),
|
||||
done: doneCh,
|
||||
ch: make(chan *arkv1.GetEventStreamResponse),
|
||||
}
|
||||
|
||||
h.pushListener(listener)
|
||||
defer h.removeListener(listener.id)
|
||||
defer close(listener.ch)
|
||||
defer close(doneCh)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-stream.Context().Done():
|
||||
return nil
|
||||
case <-doneCh:
|
||||
return nil
|
||||
case ev := <-listener.ch:
|
||||
if err := stream.Send(ev); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (h *handler) Ping(
|
||||
ctx context.Context, req *arkv1.PingRequest,
|
||||
) (*arkv1.PingResponse, error) {
|
||||
if req.GetPaymentId() == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing payment id")
|
||||
}
|
||||
@@ -175,65 +340,69 @@ func (h *handler) Ping(ctx context.Context, req *arkv1.PingRequest) (*arkv1.Ping
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (h *handler) RegisterPayment(ctx context.Context, req *arkv1.RegisterPaymentRequest) (*arkv1.RegisterPaymentResponse, error) {
|
||||
func (h *handler) CreatePayment(
|
||||
ctx context.Context, req *arkv1.CreatePaymentRequest,
|
||||
) (*arkv1.CreatePaymentResponse, error) {
|
||||
inputs, err := parseInputs(req.GetInputs())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
id, err := h.svc.SpendVtxos(ctx, inputs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pubkey := req.GetEphemeralPubkey()
|
||||
if len(pubkey) > 0 {
|
||||
if err := h.svc.RegisterCosignerPubkey(ctx, id, pubkey); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &arkv1.RegisterPaymentResponse{
|
||||
Id: id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) ClaimPayment(ctx context.Context, req *arkv1.ClaimPaymentRequest) (*arkv1.ClaimPaymentResponse, error) {
|
||||
receivers, err := parseReceivers(req.GetOutputs())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
if err := h.svc.ClaimVtxos(ctx, req.GetId(), receivers); err != nil {
|
||||
for _, receiver := range receivers {
|
||||
if receiver.Amount <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "output amount must be greater than 0")
|
||||
}
|
||||
|
||||
if len(receiver.OnchainAddress) > 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "onchain address is not supported as async payment destination")
|
||||
}
|
||||
|
||||
if len(receiver.Descriptor) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing output descriptor")
|
||||
}
|
||||
}
|
||||
|
||||
redeemTx, unconditionalForfeitTxs, err := h.svc.CreateAsyncPayment(
|
||||
ctx, inputs, receivers,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.ClaimPaymentResponse{}, nil
|
||||
return &arkv1.CreatePaymentResponse{
|
||||
SignedRedeemTx: redeemTx,
|
||||
UsignedUnconditionalForfeitTxs: unconditionalForfeitTxs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) FinalizePayment(ctx context.Context, req *arkv1.FinalizePaymentRequest) (*arkv1.FinalizePaymentResponse, error) {
|
||||
forfeitTxs := req.GetSignedForfeitTxs()
|
||||
roundTx := req.GetSignedRoundTx()
|
||||
|
||||
if len(forfeitTxs) <= 0 && roundTx == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing forfeit txs or round tx")
|
||||
func (h *handler) CompletePayment(
|
||||
ctx context.Context, req *arkv1.CompletePaymentRequest,
|
||||
) (*arkv1.CompletePaymentResponse, error) {
|
||||
if req.GetSignedRedeemTx() == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing signed redeem tx")
|
||||
}
|
||||
|
||||
if len(forfeitTxs) > 0 {
|
||||
if err := h.svc.SignVtxos(ctx, forfeitTxs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(req.GetSignedUnconditionalForfeitTxs()) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing signed unconditional forfeit txs")
|
||||
}
|
||||
|
||||
if roundTx != "" {
|
||||
if err := h.svc.SignRoundTx(ctx, roundTx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := h.svc.CompleteAsyncPayment(
|
||||
ctx, req.GetSignedRedeemTx(), req.GetSignedUnconditionalForfeitTxs(),
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.FinalizePaymentResponse{}, nil
|
||||
return &arkv1.CompletePaymentResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) GetRound(ctx context.Context, req *arkv1.GetRoundRequest) (*arkv1.GetRoundResponse, error) {
|
||||
func (h *handler) GetRound(
|
||||
ctx context.Context, req *arkv1.GetRoundRequest,
|
||||
) (*arkv1.GetRoundResponse, error) {
|
||||
if len(req.GetTxid()) <= 0 {
|
||||
round, err := h.svc.GetCurrentRound(ctx)
|
||||
if err != nil {
|
||||
@@ -300,35 +469,9 @@ func (h *handler) GetRoundById(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) GetEventStream(_ *arkv1.GetEventStreamRequest, stream arkv1.ArkService_GetEventStreamServer) error {
|
||||
doneCh := make(chan struct{})
|
||||
|
||||
listener := &listener{
|
||||
id: uuid.NewString(),
|
||||
done: doneCh,
|
||||
ch: make(chan *arkv1.GetEventStreamResponse),
|
||||
}
|
||||
|
||||
h.pushListener(listener)
|
||||
defer h.removeListener(listener.id)
|
||||
defer close(listener.ch)
|
||||
defer close(doneCh)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-stream.Context().Done():
|
||||
return nil
|
||||
case <-doneCh:
|
||||
return nil
|
||||
case ev := <-listener.ch:
|
||||
if err := stream.Send(ev); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (h *handler) ListVtxos(ctx context.Context, req *arkv1.ListVtxosRequest) (*arkv1.ListVtxosResponse, error) {
|
||||
func (h *handler) ListVtxos(
|
||||
ctx context.Context, req *arkv1.ListVtxosRequest,
|
||||
) (*arkv1.ListVtxosResponse, error) {
|
||||
_, userPubkey, _, err := parseAddress(req.GetAddress())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
@@ -345,119 +488,6 @@ func (h *handler) ListVtxos(ctx context.Context, req *arkv1.ListVtxosRequest) (*
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) GetInfo(ctx context.Context, req *arkv1.GetInfoRequest) (*arkv1.GetInfoResponse, error) {
|
||||
info, err := h.svc.GetInfo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetInfoResponse{
|
||||
Pubkey: info.PubKey,
|
||||
RoundLifetime: info.RoundLifetime,
|
||||
UnilateralExitDelay: info.UnilateralExitDelay,
|
||||
RoundInterval: info.RoundInterval,
|
||||
Network: info.Network,
|
||||
Dust: int64(info.Dust),
|
||||
BoardingDescriptorTemplate: info.BoardingDescriptorTemplate,
|
||||
ForfeitAddress: info.ForfeitAddress,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) GetBoardingAddress(ctx context.Context, req *arkv1.GetBoardingAddressRequest) (*arkv1.GetBoardingAddressResponse, error) {
|
||||
pubkey := req.GetPubkey()
|
||||
if pubkey == "" {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing pubkey")
|
||||
}
|
||||
|
||||
pubkeyBytes, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid pubkey (invalid hex)")
|
||||
}
|
||||
|
||||
userPubkey, err := secp256k1.ParsePubKey(pubkeyBytes)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid pubkey (parse error)")
|
||||
}
|
||||
|
||||
addr, descriptor, err := h.svc.GetBoardingAddress(ctx, userPubkey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.GetBoardingAddressResponse{
|
||||
Address: addr,
|
||||
Descriptor_: descriptor,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (h *handler) SendTreeNonces(ctx context.Context, req *arkv1.SendTreeNoncesRequest) (*arkv1.SendTreeNoncesResponse, error) {
|
||||
pubkey := req.GetPublicKey()
|
||||
encodedNonces := req.GetTreeNonces()
|
||||
roundID := req.GetRoundId()
|
||||
|
||||
if len(pubkey) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing cosigner public key")
|
||||
}
|
||||
|
||||
if len(encodedNonces) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing tree nonces")
|
||||
}
|
||||
|
||||
if len(roundID) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing round id")
|
||||
}
|
||||
|
||||
pubkeyBytes, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
cosignerPublicKey, err := secp256k1.ParsePubKey(pubkeyBytes)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
if err := h.svc.RegisterCosignerNonces(ctx, roundID, cosignerPublicKey, encodedNonces); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.SendTreeNoncesResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) SendTreeSignatures(ctx context.Context, req *arkv1.SendTreeSignaturesRequest) (*arkv1.SendTreeSignaturesResponse, error) {
|
||||
roundID := req.GetRoundId()
|
||||
pubkey := req.GetPublicKey()
|
||||
encodedSignatures := req.GetTreeSignatures()
|
||||
|
||||
if len(pubkey) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing cosigner public key")
|
||||
}
|
||||
|
||||
if len(encodedSignatures) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing tree signatures")
|
||||
}
|
||||
|
||||
if len(roundID) <= 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "missing round id")
|
||||
}
|
||||
|
||||
pubkeyBytes, err := hex.DecodeString(pubkey)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
cosignerPublicKey, err := secp256k1.ParsePubKey(pubkeyBytes)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, "invalid cosigner public key")
|
||||
}
|
||||
|
||||
if err := h.svc.RegisterCosignerSignatures(ctx, roundID, cosignerPublicKey, encodedSignatures); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &arkv1.SendTreeSignaturesResponse{}, nil
|
||||
}
|
||||
|
||||
func (h *handler) pushListener(l *listener) {
|
||||
h.listenersLock.Lock()
|
||||
defer h.listenersLock.Unlock()
|
||||
@@ -520,7 +550,8 @@ func (h *handler) listenToEvents() {
|
||||
case application.RoundSigningStarted:
|
||||
cosignersKeys := make([]string, 0, len(e.Cosigners))
|
||||
for _, key := range e.Cosigners {
|
||||
cosignersKeys = append(cosignersKeys, hex.EncodeToString(key.SerializeCompressed()))
|
||||
keyStr := hex.EncodeToString(key.SerializeCompressed())
|
||||
cosignersKeys = append(cosignersKeys, keyStr)
|
||||
}
|
||||
|
||||
ev = &arkv1.GetEventStreamResponse{
|
||||
|
||||
@@ -109,15 +109,15 @@ func Whitelist() map[string][]bakery.Op {
|
||||
Entity: EntityWallet,
|
||||
Action: "read",
|
||||
}},
|
||||
fmt.Sprintf("/%s/RegisterPayment", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
fmt.Sprintf("/%s/RegisterInputsForNextRound", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
Entity: EntityArk,
|
||||
Action: "write",
|
||||
}},
|
||||
fmt.Sprintf("/%s/ClaimPayment", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
fmt.Sprintf("/%s/RegisterOutputsForNextRound", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
Entity: EntityArk,
|
||||
Action: "write",
|
||||
}},
|
||||
fmt.Sprintf("/%s/FinalizePayment", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
fmt.Sprintf("/%s/SubmitSignedForfeitTxs", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
Entity: EntityArk,
|
||||
Action: "write",
|
||||
}},
|
||||
@@ -161,11 +161,11 @@ func Whitelist() map[string][]bakery.Op {
|
||||
Entity: EntityArk,
|
||||
Action: "read",
|
||||
}},
|
||||
fmt.Sprintf("/%s/SendTreeNonces", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
fmt.Sprintf("/%s/SubmitTreeNonces", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
Entity: EntityArk,
|
||||
Action: "write",
|
||||
}},
|
||||
fmt.Sprintf("/%s/SendTreeSignatures", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
fmt.Sprintf("/%s/SubmitTreeSignatures", arkv1.ArkService_ServiceDesc.ServiceName): {{
|
||||
Entity: EntityArk,
|
||||
Action: "write",
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user