From 91cdb9be4cd1f225d5cd5a922568196b73731f07 Mon Sep 17 00:00:00 2001 From: oXtxNt9U <120286271+oXtxNt9U@users.noreply.github.com> Date: Wed, 29 Apr 2026 08:34:55 +0900 Subject: [PATCH 1/2] add ?tokenAddress filter --- packages/api-http/source/controllers/wallets.ts | 11 +++++++++-- packages/api-http/source/routes/wallets.ts | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/api-http/source/controllers/wallets.ts b/packages/api-http/source/controllers/wallets.ts index 2b3d534f0..74f29cc62 100644 --- a/packages/api-http/source/controllers/wallets.ts +++ b/packages/api-http/source/controllers/wallets.ts @@ -463,8 +463,15 @@ export class WalletsController extends Controller { const tokenHoldersQuery = this.tokenHolderRepositoryFactory() .createQueryBuilder("th") .innerJoin(Models.Token, "tok", "tok.address = th.token_address") - .where("th.address = :address", { address: walletAddress }) - .andWhere("th.balance / POW(10, tok.decimals) >= :minBalance", { minBalance }); + .where("th.address = :address", { address: walletAddress }); + + if (request.query.tokenAddress) { + tokenHoldersQuery.andWhere("th.token_address = :tokenAddress", { + tokenAddress: request.query.tokenAddress, + }); + } + + tokenHoldersQuery.andWhere("th.balance / POW(10, tok.decimals) >= :minBalance", { minBalance }); TokensController.andWhereWhitelisted(tokenHoldersQuery, request); TokensController.andWhereNameSearch(tokenHoldersQuery, request.query.name); diff --git a/packages/api-http/source/routes/wallets.ts b/packages/api-http/source/routes/wallets.ts index 7909e0733..8386c515e 100644 --- a/packages/api-http/source/routes/wallets.ts +++ b/packages/api-http/source/routes/wallets.ts @@ -6,6 +6,7 @@ import Joi from "joi"; import { WalletsController } from "../controllers/wallets.js"; import { + address, tokenBalanceSchema, tokenNameSchema, transactionCriteriaSchemas, @@ -234,6 +235,7 @@ export const register = (server: Contracts.Api.ApiServer): void => { ignoreWhitelist: Joi.bool().default(false), minBalance: Schemas.orNumericCriteria(tokenBalanceSchema), name: Schemas.orEqualCriteria(tokenNameSchema), + tokenAddress: Schemas.orEqualCriteria(address), whitelist: Schemas.orEqualCriteria(walletAddressSchema), }).concat(Schemas.pagination), }, From c8c2be1e98cb592ab9a54df7ca3be6c3c2da1f73 Mon Sep 17 00:00:00 2001 From: oXtxNt9U <120286271+oXtxNt9U@users.noreply.github.com> Date: Wed, 29 Apr 2026 08:35:00 +0900 Subject: [PATCH 2/2] add test --- packages/api-http/integration/routes/wallets.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/api-http/integration/routes/wallets.test.ts b/packages/api-http/integration/routes/wallets.test.ts index 739d0ceb7..f76adb644 100644 --- a/packages/api-http/integration/routes/wallets.test.ts +++ b/packages/api-http/integration/routes/wallets.test.ts @@ -294,6 +294,14 @@ describe<{ path: `/wallets/${walletsTokens[0].address}/tokens?minBalance=2`, result: walletTokensResponse, }, + { + path: `/wallets/${walletsTokens[0].address}/tokens?tokenAddress=0x0ba3d7cba9701f76f6285733a5a877a557c86034`, + result: [walletTokensResponse[0]], + }, + { + path: `/wallets/${walletsTokens[0].address}/tokens?tokenAddress=0x1ba3d7cba9701f76f6285733a5a877a557c86034`, + result: [], + }, ]; for (const { path, result } of testCases) {