Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/commands/SpotCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions src/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});