Skip to content

Commit c987311

Browse files
authored
Merge pull request #6202 from BitGo/coin-3872-consolidate-nfts-without-address
chore: assert both nftCollectionId and nftId
2 parents fa8c2df + 6a43121 commit c987311

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

examples/ts/nft/list-wallet-addresses-by-balance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright 2025, BitGo, Inc. All Rights Reserved.
55
*/
66
import { BitGoAPI } from '@bitgo/sdk-api';
7-
import { Tapt } from "@bitgo/sdk-coin-apt";
7+
import { Tapt } from '@bitgo/sdk-coin-apt';
88
require('dotenv').config({ path: '../../../.env' });
99

1010
const bitgo = new BitGoAPI({

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,13 @@ export class Wallet implements IWallet {
11751175
throw new Error('limit argument must be between 1 and 500');
11761176
}
11771177

1178+
// Assert that either both nftCollectionId and nftId are provided or neither are provided
1179+
const hasNftCollectionId = !_.isUndefined(query.nftCollectionId);
1180+
const hasNftId = !_.isUndefined(query.nftId);
1181+
if (hasNftCollectionId !== hasNftId) {
1182+
throw new Error('nftCollectionId and nftId must both be provided or both be omitted');
1183+
}
1184+
11781185
return this.bitgo
11791186
.get(this.baseCoin.url('/wallet/' + this._wallet.id + '/addresses/balances'))
11801187
.query(query)

0 commit comments

Comments
 (0)