Skip to content

Add evm collectibles command for NFT listings with spam filtering#34

Open
ivpusic wants to merge 1 commit intosim/evm-transactionsfrom
sim/evm-collectibles
Open

Add evm collectibles command for NFT listings with spam filtering#34
ivpusic wants to merge 1 commit intosim/evm-transactionsfrom
sim/evm-collectibles

Conversation

@ivpusic
Copy link
Member

@ivpusic ivpusic commented Mar 12, 2026

  • GET /v1/evm/collectibles/{address} with --chain-ids, --filter-spam, --show-spam-scores, --limit, --offset
  • Text table shows CHAIN, NAME, SYMBOL, TOKEN_ID, STANDARD, BALANCE plus SPAM/SPAM_SCORE when --show-spam-scores is set
  • Full OpenAPI spec coverage including metadata, spam explanations with json.RawMessage for polymorphic values
  • 6 E2E tests: text, JSON, filter-spam disabled, spam scores JSON, spam scores text columns, pagination

@cursor
Copy link

cursor bot commented Mar 12, 2026

PR Summary

Low Risk
Low risk: this is an additive CLI subcommand that calls a new API endpoint and formats output, with no changes to existing query flows besides command registration.

Overview
Adds a new sim evm collectibles <address> command that calls GET /v1/evm/collectibles/{address} with flags for --chain-ids, --filter-spam, --show-spam-scores, --limit, and --offset.

Supports both raw JSON output and a text table view, optionally adding SPAM/SPAM_SCORE columns and printing next_offset for pagination, and wires the new subcommand into the sim evm command tree.

Adds E2E tests covering text vs JSON output, spam filtering toggle, spam score inclusion, and pagination via next_offset.

Written by Cursor Bugbot for commit 8a633b2. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Attribute value typed as string, not RawMessage
    • Changed collectibleAttribute.Value from string to json.RawMessage to properly handle polymorphic NFT attribute values (strings, numbers, booleans) consistent with the codebase pattern.

Create PR

Or push these changes by commenting:

@cursor push 9d59d3b559
Preview (9d59d3b559)
diff --git a/cmd/sim/evm/collectibles.go b/cmd/sim/evm/collectibles.go
--- a/cmd/sim/evm/collectibles.go
+++ b/cmd/sim/evm/collectibles.go
@@ -69,9 +69,9 @@
 }
 
 type collectibleAttribute struct {
-	Key    string `json:"key"`
-	Value  string `json:"value"`
-	Format string `json:"format,omitempty"`
+	Key    string          `json:"key"`
+	Value  json.RawMessage `json:"value"`
+	Format string          `json:"format,omitempty"`
 }
 
 type spamExplanation struct {

Comment @cursor review or bugbot run to trigger another review on this PR


type collectibleAttribute struct {
Key string `json:"key"`
Value string `json:"value"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attribute value typed as string, not RawMessage

Medium Severity

collectibleAttribute.Value is typed as string, but NFT metadata attribute values are commonly polymorphic (strings, numbers, booleans). The codebase consistently uses json.RawMessage for polymorphic API values — spamExplanation.Value in the same file and functionInput.Value in activity.go both do this. If the API returns a non-string attribute value, json.Unmarshal in the text-output path will fail, breaking the entire command for any NFT with numeric traits.

Fix in Cursor Fix in Web

@ivpusic ivpusic force-pushed the sim/evm-transactions branch from bcff9e1 to a0d205d Compare March 12, 2026 15:34
@ivpusic ivpusic force-pushed the sim/evm-collectibles branch from 8a633b2 to 991a36a Compare March 12, 2026 15:34
@ivpusic ivpusic force-pushed the sim/evm-transactions branch from a0d205d to fbcafd8 Compare March 12, 2026 15:39
@ivpusic ivpusic force-pushed the sim/evm-collectibles branch from 991a36a to 2d53c17 Compare March 12, 2026 15:39
@ivpusic ivpusic force-pushed the sim/evm-transactions branch from fbcafd8 to a7bacad Compare March 12, 2026 16:07
@ivpusic ivpusic force-pushed the sim/evm-collectibles branch from 2d53c17 to a49f933 Compare March 12, 2026 16:07
- GET /v1/evm/collectibles/{address} with --chain-ids, --filter-spam, --show-spam-scores, --limit, --offset
- Text table shows CHAIN, NAME, SYMBOL, TOKEN_ID, STANDARD, BALANCE plus SPAM/SPAM_SCORE when --show-spam-scores is set
- Full OpenAPI spec coverage including metadata, spam explanations with json.RawMessage for polymorphic values
- 6 E2E tests: text, JSON, filter-spam disabled, spam scores JSON, spam scores text columns, pagination
@ivpusic ivpusic force-pushed the sim/evm-transactions branch from a7bacad to f381fe4 Compare March 12, 2026 16:10
@ivpusic ivpusic force-pushed the sim/evm-collectibles branch from a49f933 to d56f07a Compare March 12, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants