diff --git a/src/commands/SpotCommand.ts b/src/commands/SpotCommand.ts index ab28856..ef238e8 100644 --- a/src/commands/SpotCommand.ts +++ b/src/commands/SpotCommand.ts @@ -400,6 +400,9 @@ export class SpotCommand { } const info = tokenMap.get(mint); if (!info) { + console.warn( + `Warning: Could not fetch metadata for token ${mint}. Skipping.` + ); continue; } const multiplier = Swap.getScaledUiMultiplier(info); diff --git a/src/e2e.test.ts b/src/e2e.test.ts index fc3f878..e58fe17 100644 --- a/src/e2e.test.ts +++ b/src/e2e.test.ts @@ -106,3 +106,13 @@ describe("keys add (dist/index.js)", () => { expect(second.stdout + second.stderr).toContain("already exists"); }); }); + +describe("spot portfolio", () => { + test("handles portfolio lookup without crashing on missing metadata", () => { + // This test verifies that the command completes without crashing + // even if token metadata is unavailable + const result = runCli("spot", "portfolio", "--address", TEST_SEED_ADDRESS); + // Should complete (may fail on API, but not crash on missing metadata) + expect(result.status).toBeLessThanOrEqual(1); + }); +});