Skip to content

Commit fa8c2df

Browse files
authored
Merge pull request #6200 from BitGo/coin-3872-consolidate-nfts-without-address
feat: consolidate NFTs without address input
2 parents a80f608 + 015bd4f commit fa8c2df

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* List address of an NFT on a wallet.
3+
*
4+
* Copyright 2025, BitGo, Inc. All Rights Reserved.
5+
*/
6+
import { BitGoAPI } from '@bitgo/sdk-api';
7+
import { Tapt } from "@bitgo/sdk-coin-apt";
8+
require('dotenv').config({ path: '../../../.env' });
9+
10+
const bitgo = new BitGoAPI({
11+
accessToken: process.env.TESTNET_ACCESS_TOKEN,
12+
env: 'test',
13+
});
14+
15+
const coin = 'tapt';
16+
bitgo.register(coin, Tapt.createInstance);
17+
18+
const walletId = '';
19+
20+
async function main() {
21+
const wallet = await bitgo.coin(coin).wallets().get({ id: walletId });
22+
const addresses = await wallet.addressesByBalance({
23+
nftCollectionId: '',
24+
nftId: '',
25+
});
26+
console.log(JSON.stringify(addresses.addresses));
27+
}
28+
29+
main().catch((e) => console.error(e));

examples/ts/nft/nft-consolidation-send.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ async function main() {
3232

3333
const sendConsolidations = await wallet.sendAccountConsolidations({
3434
walletPassphrase,
35-
consolidateAddresses: [''],
3635
nftCollectionId: '',
3736
nftId: '',
3837
});

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ export interface AddressesOptions extends PaginationOptions {
423423
}
424424

425425
export interface AddressesByBalanceOptions extends PaginationOptions {
426-
token: string;
426+
token?: string;
427+
nftCollectionId?: string;
428+
nftId?: string;
427429
sort?: number;
428430
}
429431

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,8 @@ export class Wallet implements IWallet {
11551155
async addressesByBalance(params: AddressesByBalanceOptions): Promise<any> {
11561156
const query: AddressesByBalanceOptions = {
11571157
token: params.token,
1158+
nftCollectionId: params.nftCollectionId,
1159+
nftId: params.nftId,
11581160
};
11591161
query.sort = params.sort ?? -1;
11601162
query.page = params.page ?? 1;
@@ -1166,10 +1168,10 @@ export class Wallet implements IWallet {
11661168
if (!_.isNumber(query.page)) {
11671169
throw new Error('invalid page argument, expecting number');
11681170
}
1169-
if (!_.isNumber(params.limit)) {
1171+
if (!_.isNumber(query.limit)) {
11701172
throw new Error('invalid limit argument, expecting number');
11711173
}
1172-
if (params.limit < 1 || params.limit > 500) {
1174+
if (query.limit < 1 || query.limit > 500) {
11731175
throw new Error('limit argument must be between 1 and 500');
11741176
}
11751177

0 commit comments

Comments
 (0)