Skip to content

Commit 2940920

Browse files
committed
refactor: added response type and some jsdocs
TICKET: WP-5447
1 parent 399ac1a commit 2940920

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

modules/express/src/typedRoutes/api/v2/lightningState.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ export const LightningStateParams = {
1313
walletId: t.string,
1414
};
1515

16+
/**
17+
* Response
18+
* - 200: Returns the current Lightning wallet/node state('NON_EXISTING' | 'LOCKED' | 'UNLOCKED' | 'RPC_ACTIVE' | 'SERVER_ACTIVE' | 'WAITING_TO_START'.
19+
* - 400: BitGo Express error payload when the request is invalid (e.g., invalid coin or wallet not a self-custody lightning wallet).
20+
*
21+
* See platform spec: GET /api/v2/{coin}/wallet/{walletId}/state
22+
*/
23+
export const LightningStateResponse = {
24+
200: t.type({
25+
state: WalletState,
26+
}),
27+
400: BitgoExpressError,
28+
} as const;
29+
1630
/**
1731
* Lightning - Get node state
1832
*
@@ -26,10 +40,5 @@ export const GetLightningState = httpRoute({
2640
request: httpRequest({
2741
params: LightningStateParams,
2842
}),
29-
response: {
30-
200: t.type({
31-
state: WalletState,
32-
}),
33-
400: BitgoExpressError,
34-
},
43+
response: LightningStateResponse,
3544
});

0 commit comments

Comments
 (0)