Skip to content

Add svm balances command with SimClient wiring#38

Open
ivpusic wants to merge 1 commit intosim/evm-defi-positionsfrom
sim/svm-balances
Open

Add svm balances command with SimClient wiring#38
ivpusic wants to merge 1 commit intosim/evm-defi-positionsfrom
sim/svm-balances

Conversation

@ivpusic
Copy link
Member

@ivpusic ivpusic commented Mar 12, 2026

Add dune sim svm balances <address> for querying SVM token balances across Solana/Eclipse chains with USD valuations. Supports --chains, --limit, --offset flags, text table and JSON output.

@cursor
Copy link

cursor bot commented Mar 12, 2026

PR Summary

Low Risk
Low risk and mostly additive: introduces a new CLI subcommand plus e2e-style tests, with no changes to existing auth or data mutation paths beyond reusing the existing Sim client context wiring.

Overview
Adds dune sim svm balances <address> to query the Sim API GET /beta/svm/balances/{address} with optional --chains, --limit, and --offset parameters, supporting both table (text) output and passthrough -o json output.

Wires SVM subcommands to a small SimClient interface extracted from command context (requireSimClient) and adds authenticated e2e tests covering text/JSON output, chain filtering, limit, and pagination behavior (skipped if DUNE_SIM_API_KEY is unset).

Written by Cursor Bugbot for commit 1b64179. 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 2 potential issues.

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues.

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

return "0.00"
}
return fmt.Sprintf("%.2f", v)
}
Copy link

Choose a reason for hiding this comment

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

Duplicated formatUSD utility across EVM and SVM packages

Low Severity

The formatUSD function in cmd/sim/svm/balances.go is an exact copy of the one in cmd/sim/evm/balances.go. This utility has no package-specific type dependencies and could live in the shared output package to avoid duplicated logic and the risk of the two copies diverging over time.

Fix in Cursor Fix in Web

formatUSD(b.PriceUSD),
formatUSD(b.ValueUSD),
}
}
Copy link

Choose a reason for hiding this comment

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

Display uses optional Balance field instead of required Amount

Low Severity

The text table displays b.Balance (tagged json:"balance,omitempty") in the BALANCE column, but this field is optional per its struct definition. The required Amount field (no omitempty) is never displayed. If the API omits balance for any entry, that table cell will be blank with no fallback to Amount.

Fix in Cursor Fix in Web

@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch from 2208ba0 to 234d2c4 Compare March 12, 2026 15:34
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch from 04fc294 to c682cc0 Compare March 12, 2026 16:07
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch from c682cc0 to 2879e1f 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