-
Notifications
You must be signed in to change notification settings - Fork 300
feat(express): migrate initwallet to typed routes #6959
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
davidkaplanbitgo
merged 9 commits into
master
from
WP-5444-express-migrate-api-v2-coin-wallet-id-initwallet-to-typed-routes
Sep 22, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
685ae3c
feat(express): migrate init wallet to typed routes
danielzhao122 9352c72
refactor: adding missed changes
danielzhao122 1b717f3
docs: updated documentation
danielzhao122 f14ae3f
refactor: updated jsdocs and removed unnecessary casting
danielzhao122 8d928e9
refactor: added unit tests that test encoding and decoding from end t…
danielzhao122 e3c160f
Merge branch 'master' into WP-5444-express-migrate-api-v2-coin-wallet…
danielzhao122 86d385f
refactor: fixed import
danielzhao122 dd93ddf
refactor: fixed code
danielzhao122 c0b322c
refactor: removed unneccessary UTs and modified existing ones
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
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
48 changes: 48 additions & 0 deletions
48
modules/express/src/typedRoutes/api/v2/lightningInitWallet.ts
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,48 @@ | ||
| import * as t from 'io-ts'; | ||
| import { httpRoute, httpRequest, optional } from '@api-ts/io-ts-http'; | ||
| import { BitgoExpressError } from '../../schemas/error'; | ||
|
|
||
| /** | ||
| * Path parameters for initializing a Lightning wallet | ||
| * @property {string} coin - A lightning coin name (e.g, lnbtc, tlnbtc). | ||
| * @property {string} walletId - The ID of the wallet. | ||
| */ | ||
| export const LightningInitWalletParams = { | ||
| coin: t.string, | ||
| walletId: t.string, | ||
| } as const; | ||
|
|
||
| /** | ||
| * Request body for initializing a Lightning wallet | ||
| */ | ||
| export const LightningInitWalletBody = { | ||
| /** Passphrase to encrypt the admin macaroon of the signer node. */ | ||
| passphrase: t.string, | ||
| /** Optional hostname or IP address to set the `expressHost` field of the wallet. */ | ||
| expressHost: optional(t.string), | ||
| } as const; | ||
|
|
||
| /** | ||
| * Response for initializing a Lightning wallet | ||
| */ | ||
| export const LightningInitWalletResponse = { | ||
| /** Returns the updated wallet. On success, the wallet's `coinSpecific` will include the encrypted admin macaroon for the Lightning signer node. */ | ||
| 200: t.unknown, | ||
| /** BitGo Express error payload when initialization cannot proceed (for example: invalid coin, unsupported environment, wallet not in an initializable state). */ | ||
| 400: BitgoExpressError, | ||
| } as const; | ||
|
|
||
| /** | ||
| * Lightning - This is only used for self-custody lightning. Initialize a newly created Lightning Network Daemon (LND) for the first time. | ||
| * Returns the updated wallet with the encrypted admin macaroon in the `coinSpecific` response field. | ||
| * | ||
| * @operationId express.lightning.initWallet | ||
| */ | ||
| export const PostLightningInitWallet = httpRoute({ | ||
| path: '/api/v2/:coin/wallet/:walletId/initwallet', | ||
| method: 'POST', | ||
| request: httpRequest({ params: LightningInitWalletParams, body: LightningInitWalletBody }), | ||
| response: LightningInitWalletResponse, | ||
| }); | ||
|
|
||
| export type PostLightningInitWallet = typeof PostLightningInitWallet; | ||
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.