Skip to content

Commit

Permalink
fix: API v2 swap routes
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Jan 22, 2024
1 parent c47927e commit e9d1ee3
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 133 deletions.
122 changes: 61 additions & 61 deletions lib/api/v2/routers/SwapRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,67 +54,6 @@ class SwapRouter extends RouterBase {

const router = Router();

/**
* @openapi
* tags:
* name: Swap
* description: Generic Swap related endpoints
*/

/**
* @openapi
* components:
* schemas:
* SwapStatus:
* type: object
* properties:
* status:
* type: string
* description: Status of the Swap
* zeroConfRejected:
* type: boolean
* description: Whether 0-conf was accepted for the lockup transaction of the Submarine Swap
* transaction:
* type: object
* description: Details of the lockup transaction of a Reverse Swap
* properties:
* id:
* type: string
* description: ID of the transaction
* hex:
* type: string
* description: Raw hex of the transaction
*/

/**
* @openapi
* /swap/{id}:
* get:
* tags: [Swap]
* description: Get the status of a Swap
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* description: ID of the Swap
* responses:
* '200':
* description: The latest status of the Swap
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/SwapStatus'
* '404':
* description: When no Swap with the ID could be found
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
*/
router.get('/:id', this.handleError(this.getSwapStatus));

/**
* @openapi
* tags:
Expand Down Expand Up @@ -609,6 +548,67 @@ class SwapRouter extends RouterBase {
*/
router.post('/reverse/claim', this.handleError(this.claimReverse));

/**
* @openapi
* tags:
* name: Swap
* description: Generic Swap related endpoints
*/

/**
* @openapi
* components:
* schemas:
* SwapStatus:
* type: object
* properties:
* status:
* type: string
* description: Status of the Swap
* zeroConfRejected:
* type: boolean
* description: Whether 0-conf was accepted for the lockup transaction of the Submarine Swap
* transaction:
* type: object
* description: Details of the lockup transaction of a Reverse Swap
* properties:
* id:
* type: string
* description: ID of the transaction
* hex:
* type: string
* description: Raw hex of the transaction
*/

/**
* @openapi
* /swap/{id}:
* get:
* tags: [Swap]
* description: Get the status of a Swap
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* description: ID of the Swap
* responses:
* '200':
* description: The latest status of the Swap
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/SwapStatus'
* '404':
* description: When no Swap with the ID could be found
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
*/
router.get('/:id', this.handleError(this.getSwapStatus));

return router;
};

Expand Down
144 changes: 72 additions & 72 deletions swagger-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,47 +310,6 @@
}
}
},
"/swap/{id}": {
"get": {
"tags": [
"Swap"
],
"description": "Get the status of a Swap",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"description": "ID of the Swap"
}
],
"responses": {
"200": {
"description": "The latest status of the Swap",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SwapStatus"
}
}
}
},
"404": {
"description": "When no Swap with the ID could be found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/swap/submarine": {
"get": {
"description": "Possible pairs for Submarine Swaps",
Expand Down Expand Up @@ -599,6 +558,47 @@
}
}
}
},
"/swap/{id}": {
"get": {
"tags": [
"Swap"
],
"description": "Get the status of a Swap",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "string"
},
"description": "ID of the Swap"
}
],
"responses": {
"200": {
"description": "The latest status of the Swap",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SwapStatus"
}
}
}
},
"404": {
"description": "When no Swap with the ID could be found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -667,33 +667,6 @@
}
}
},
"SwapStatus": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Status of the Swap"
},
"zeroConfRejected": {
"type": "boolean",
"description": "Whether 0-conf was accepted for the lockup transaction of the Submarine Swap"
},
"transaction": {
"type": "object",
"description": "Details of the lockup transaction of a Reverse Swap",
"properties": {
"id": {
"type": "string",
"description": "ID of the transaction"
},
"hex": {
"type": "string",
"description": "Raw hex of the transaction"
}
}
}
}
},
"SubmarinePair": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1019,6 +992,33 @@
"description": "Index of the input of the transaction that should be signed"
}
}
},
"SwapStatus": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Status of the Swap"
},
"zeroConfRejected": {
"type": "boolean",
"description": "Whether 0-conf was accepted for the lockup transaction of the Submarine Swap"
},
"transaction": {
"type": "object",
"description": "Details of the lockup transaction of a Reverse Swap",
"properties": {
"id": {
"type": "string",
"description": "ID of the transaction"
},
"hex": {
"type": "string",
"description": "Raw hex of the transaction"
}
}
}
}
}
}
},
Expand All @@ -1035,17 +1035,17 @@
"name": "Nodes",
"description": "Lightning nodes"
},
{
"name": "Swap",
"description": "Generic Swap related endpoints"
},
{
"name": "Submarine",
"description": "Submarine Swap related endpoints"
},
{
"name": "Reverse",
"description": "Reverse Swap related endpoints"
},
{
"name": "Swap",
"description": "Generic Swap related endpoints"
}
],
"servers": [
Expand Down

0 comments on commit e9d1ee3

Please sign in to comment.