Skip to content

Commit cc17b83

Browse files
committed
feat: add includeBalance parameter to wallet query options
Allow users to specify whether balance information should be included in wallet query results by adding an optional boolean parameter 'includeBalance'. Validates the parameter type and includes it in the query if provided Ticket: BTC-1946 TICKET: BTC-1946
1 parent 3537128 commit cc17b83

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

modules/express/test/unit/clientRoutes/lightning/lightningSignerRoutes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ describe('Lightning signer routes', () => {
4343
includingOptionalFields ? 'with' : 'without'
4444
} optional fields`, async () => {
4545
const readFileStub = sinon.stub(fs.promises, 'readFile').resolves(JSON.stringify(lightningSignerConfigs));
46-
const wpWalletnock = nock(bgUrl).get(`/api/v2/tlnbtc/wallet/${apiData.wallet.id}`).reply(200, apiData.wallet);
46+
const wpWalletnock = nock(bgUrl)
47+
.get(`/api/v2/tlnbtc/wallet/${apiData.wallet.id}`)
48+
.query({ includeBalance: false })
49+
.reply(200, apiData.wallet);
4750

4851
const wpKeychainNocks = [
4952
nock(bgUrl).get(`/api/v2/tlnbtc/key/${apiData.userKey.id}`).reply(200, apiData.userKey),
@@ -92,6 +95,7 @@ describe('Lightning signer routes', () => {
9295
const readFileStub = sinon.stub(fs.promises, 'readFile').resolves(JSON.stringify(lightningSignerConfigs));
9396
const wpWalletnock = nock(bgUrl)
9497
.get(`/api/v2/tlnbtc/wallet/${apiData.wallet.id}`)
98+
.query({ includeBalance: false })
9599
.reply(200, {
96100
...apiData.wallet,
97101
...(includeWatchOnlyIp ? {} : { watchOnlyExternalIp: null }),

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,10 @@ export class Wallets implements IWallets {
926926
query.allTokens = params.allTokens;
927927
}
928928

929+
if (params.includeBalance !== undefined) {
930+
query.includeBalance = params.includeBalance;
931+
}
932+
929933
this.bitgo.setRequestTracer(params.reqId || new RequestTracer());
930934

931935
const wallet = await this.bitgo

0 commit comments

Comments
 (0)