-
Notifications
You must be signed in to change notification settings - Fork 300
feat(express): migrate getlightningstate to typed routes #6982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
danielzhao122
merged 9 commits into
master
from
WP-5447-express-migrate-api-v2-coin-wallet-id-state-to-typed-routes
Sep 26, 2025
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
916d430
feat(express): migrate getlightningstate to typed routes
danielzhao122 399ac1a
refactor: removed any type cast for something more explicit
danielzhao122 2940920
refactor: added response type and some jsdocs
danielzhao122 9f073c6
Merge branch 'master' into WP-5447-express-migrate-api-v2-coin-wallet…
danielzhao122 42f9eed
refactor: refactored jsdocs
danielzhao122 c678042
refactor: added decoding test to UT
danielzhao122 02537bd
refactor: removed inline import
danielzhao122 e74d662
Merge branch 'master' into WP-5447-express-migrate-api-v2-coin-wallet…
danielzhao122 6f89e61
Merge remote-tracking branch 'origin/master' into WP-5447-express-mig…
danielzhao122 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import * as t from 'io-ts'; | ||
| import { httpRoute, httpRequest } from '@api-ts/io-ts-http'; | ||
| import { BitgoExpressError } from '../../schemas/error'; | ||
| import { WalletState } from '../../../lightning/codecs'; | ||
|
|
||
| /** | ||
| * Path parameters for getting lightning node state | ||
| * @property {string} coin - A lightning coin name (e.g., lnbtc or tlnbtc) | ||
| * @property {string} walletId - The ID of the lightning self-custody wallet | ||
danielzhao122 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| */ | ||
| export const LightningStateParams = { | ||
| coin: t.string, | ||
| walletId: t.string, | ||
| }; | ||
danielzhao122 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Lightning - Get node state | ||
| * | ||
| * This is only used for self-custody lightning. Get the current state of the lightning node. | ||
| * | ||
| * @operationId express.lightning.getState | ||
| */ | ||
| export const GetLightningState = httpRoute({ | ||
| method: 'GET', | ||
| path: '/api/v2/{coin}/wallet/{walletId}/state', | ||
| request: httpRequest({ | ||
| params: LightningStateParams, | ||
| }), | ||
| response: { | ||
| 200: t.type({ | ||
| state: WalletState, | ||
| }), | ||
| 400: BitgoExpressError, | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.