Skip to content

Commit 832aa59

Browse files
committed
feat(express): add includeBalance option when fetching lightning wallets
Add includeBalance=false flag when fetching lightning wallets in express routes to optimize performance by skipping balance calculation when it's not needed. This improves response times for lightning wallet operations that don't require balance information. Ticket: BTC-1946 TICKET: BTC-1946
1 parent 4f46881 commit 832aa59

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

modules/express/src/lightning/lightningSignerRoutes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function handleInitLightningWallet(req: express.Request): Promise<u
8484
}
8585
);
8686

87-
const wallet = await coin.wallets().get({ id: walletId });
87+
const wallet = await coin.wallets().get({ id: walletId, includeBalance: false });
8888
if (wallet.subType() !== 'lightningSelfCustody') {
8989
throw new ApiResponseError(`not a self custodial lighting wallet ${walletId}`, 400);
9090
}
@@ -145,7 +145,7 @@ export async function handleCreateSignerMacaroon(req: express.Request): Promise<
145145
}
146146
);
147147

148-
const wallet = await coin.wallets().get({ id: walletId });
148+
const wallet = await coin.wallets().get({ id: walletId, includeBalance: false });
149149
if (wallet.subType() !== 'lightningSelfCustody') {
150150
throw new ApiResponseError(`not a self custodial lighting wallet ${walletId}`, 400);
151151
}

modules/express/src/lightning/lightningWalletRoutes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export async function handleUpdateLightningWalletCoinSpecific(req: express.Reque
1717
);
1818

1919
const coin = bitgo.coin(req.params.coin);
20-
const wallet = await coin.wallets().get({ id: req.params.id });
20+
const wallet = await coin.wallets().get({ id: req.params.id, includeBalance: false });
2121

2222
return await updateWalletCoinSpecific(wallet, params);
2323
}

modules/sdk-core/src/bitgo/wallet/iWallets.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface GetWalletOptions {
2323
allTokens?: boolean;
2424
reqId?: IRequestTracer;
2525
id?: string;
26+
includeBalance?: boolean;
2627
}
2728

2829
export interface GenerateBaseMpcWalletOptions {

0 commit comments

Comments
 (0)