From 701dad49f54323cf2b455376b1af3b012e2e0b71 Mon Sep 17 00:00:00 2001 From: "Ko Miyatake (Openclaw Bot)" Date: Mon, 18 May 2026 05:38:25 +0000 Subject: [PATCH 1/3] fix(research): make --to-date optional on historical-token-screener `requireOptions` incorrectly listed `to-date` as required, causing the command to reject valid calls that omit the optional `--to-date` flag. Co-Authored-By: Claude Sonnet 4.6 --- .../fix-historical-token-screener-to-date-optional.md | 5 +++++ src/__tests__/research.test.js | 11 +++++++++++ src/commands/research.js | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-historical-token-screener-to-date-optional.md diff --git a/.changeset/fix-historical-token-screener-to-date-optional.md b/.changeset/fix-historical-token-screener-to-date-optional.md new file mode 100644 index 00000000..05fe801c --- /dev/null +++ b/.changeset/fix-historical-token-screener-to-date-optional.md @@ -0,0 +1,5 @@ +--- +"nansen-cli": patch +--- + +Fix `research historical-token-screener` incorrectly requiring `--to-date` when it is optional diff --git a/src/__tests__/research.test.js b/src/__tests__/research.test.js index b844e203..fbd6743a 100644 --- a/src/__tests__/research.test.js +++ b/src/__tests__/research.test.js @@ -368,6 +368,17 @@ describe('buildResearchCommands handler', () => { })); }); + it('dispatches historical-token-screener without --to-date', async () => { + mockApi = makeMockApi(); + await cmds.research(['historical-token-screener'], mockApi, {}, { + 'timeframe-days': '30', chains: 'solana', + }); + expect(mockApi.researchTokenScreener).toHaveBeenCalledWith(expect.objectContaining({ + timeframeDays: 30, + toDate: undefined, + })); + }); + it('dispatches historical-wallet-balances with --as-of-date', async () => { mockApi = makeMockApi(); await cmds.research(['historical-wallet-balances'], mockApi, {}, { diff --git a/src/commands/research.js b/src/commands/research.js index f6f76af0..bbcdc0f9 100644 --- a/src/commands/research.js +++ b/src/commands/research.js @@ -249,7 +249,7 @@ export function buildResearchCommands(deps = {}) { if (sub === 'historical-token-screener') { const timeframeDays = parseTimeframeDays(options['timeframe-days']); - requireOptions({ 'timeframe-days': timeframeDays, 'to-date': options['to-date'] }, ['timeframe-days', 'to-date']); + requireOptions({ 'timeframe-days': timeframeDays }, ['timeframe-days']); return apiInstance.researchTokenScreener({ chains: parseChains(options), timeframeDays, From bb3ce8f631d0483dd39a753d72485fede944463c Mon Sep 17 00:00:00 2001 From: "Ko Miyatake (Openclaw Bot)" Date: Mon, 18 May 2026 05:43:12 +0000 Subject: [PATCH 2/3] fix(research): update help text to show --to-date as optional Co-Authored-By: Claude Sonnet 4.6 --- src/commands/research.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/research.js b/src/commands/research.js index bbcdc0f9..2866098f 100644 --- a/src/commands/research.js +++ b/src/commands/research.js @@ -137,7 +137,7 @@ NOTE: This endpoint does not support order_by.`, 'historical-token-screener': `nansen research historical-token-screener — Historical token screener USAGE: - nansen research historical-token-screener --timeframe-days --to-date [--chains c1,c2]`, + nansen research historical-token-screener --timeframe-days [--to-date ] [--chains c1,c2]`, 'historical-wallet-balances': `nansen research historical-wallet-balances — Historical token balances for a wallet USAGE: From cd799fbbb71676200a61b642a1cc8d4a1cbd2de1 Mon Sep 17 00:00:00 2001 From: Ko Date: Mon, 18 May 2026 15:04:59 +0900 Subject: [PATCH 3/3] fix(schema): mark --to-date as required on historical-token-screener MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API requires `to_date` — the schema incorrectly marked it optional. Reverts the code/test changes from the prior commits and fixes the schema to match CLI and API behavior. Co-Authored-By: Claude Opus 4.6 --- .../fix-historical-token-screener-to-date-optional.md | 2 +- src/__tests__/research.test.js | 11 ----------- src/commands/research.js | 4 ++-- src/schema.json | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.changeset/fix-historical-token-screener-to-date-optional.md b/.changeset/fix-historical-token-screener-to-date-optional.md index 05fe801c..92bf4c9e 100644 --- a/.changeset/fix-historical-token-screener-to-date-optional.md +++ b/.changeset/fix-historical-token-screener-to-date-optional.md @@ -2,4 +2,4 @@ "nansen-cli": patch --- -Fix `research historical-token-screener` incorrectly requiring `--to-date` when it is optional +Fix `research historical-token-screener` schema to mark `--to-date` as required (matching CLI and API behavior) diff --git a/src/__tests__/research.test.js b/src/__tests__/research.test.js index fbd6743a..b844e203 100644 --- a/src/__tests__/research.test.js +++ b/src/__tests__/research.test.js @@ -368,17 +368,6 @@ describe('buildResearchCommands handler', () => { })); }); - it('dispatches historical-token-screener without --to-date', async () => { - mockApi = makeMockApi(); - await cmds.research(['historical-token-screener'], mockApi, {}, { - 'timeframe-days': '30', chains: 'solana', - }); - expect(mockApi.researchTokenScreener).toHaveBeenCalledWith(expect.objectContaining({ - timeframeDays: 30, - toDate: undefined, - })); - }); - it('dispatches historical-wallet-balances with --as-of-date', async () => { mockApi = makeMockApi(); await cmds.research(['historical-wallet-balances'], mockApi, {}, { diff --git a/src/commands/research.js b/src/commands/research.js index 2866098f..f6f76af0 100644 --- a/src/commands/research.js +++ b/src/commands/research.js @@ -137,7 +137,7 @@ NOTE: This endpoint does not support order_by.`, 'historical-token-screener': `nansen research historical-token-screener — Historical token screener USAGE: - nansen research historical-token-screener --timeframe-days [--to-date ] [--chains c1,c2]`, + nansen research historical-token-screener --timeframe-days --to-date [--chains c1,c2]`, 'historical-wallet-balances': `nansen research historical-wallet-balances — Historical token balances for a wallet USAGE: @@ -249,7 +249,7 @@ export function buildResearchCommands(deps = {}) { if (sub === 'historical-token-screener') { const timeframeDays = parseTimeframeDays(options['timeframe-days']); - requireOptions({ 'timeframe-days': timeframeDays }, ['timeframe-days']); + requireOptions({ 'timeframe-days': timeframeDays, 'to-date': options['to-date'] }, ['timeframe-days', 'to-date']); return apiInstance.researchTokenScreener({ chains: parseChains(options), timeframeDays, diff --git a/src/schema.json b/src/schema.json index 5bd9344e..965efae7 100644 --- a/src/schema.json +++ b/src/schema.json @@ -770,7 +770,7 @@ "description": "Historical token screener over a trailing window", "options": { "timeframe-days": { "required": true, "type": "number", "description": "Trailing window size in days" }, - "to-date": { "description": "Optional end date for the window (YYYY-MM-DD)" }, + "to-date": { "required": true, "description": "End date for the window (YYYY-MM-DD)" }, "chains": { "default": "solana", "description": "Comma-separated chains" } } },