Skip to content

Add svm balances command with SimClient wiring#38

Open
ivpusic wants to merge 1 commit intomainfrom
sim/svm-balances
Open

Add svm balances command with SimClient wiring#38
ivpusic wants to merge 1 commit intomainfrom
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/svm-balances branch 2 times, most recently from 3e08956 to a2dc2be Compare March 12, 2026 16:10
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch from c682cc0 to 2879e1f Compare March 12, 2026 16:10
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch 2 times, most recently from 98674c2 to ebd4cf0 Compare March 13, 2026 10:45
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch 2 times, most recently from 5d7bdb0 to 1af3a07 Compare March 13, 2026 10:56
@ivpusic ivpusic force-pushed the sim/svm-balances branch 2 times, most recently from 6501618 to f0ef4d7 Compare March 13, 2026 12:09
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch from 1af3a07 to a7987f1 Compare March 13, 2026 12:09
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch 2 times, most recently from 6c9eec5 to 0046a00 Compare March 13, 2026 16:15
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch from 0046a00 to b4dff39 Compare March 13, 2026 16:20
@ivpusic ivpusic force-pushed the sim/svm-balances branch 2 times, most recently from 9e733a1 to de31d1d Compare March 13, 2026 16:26
@ivpusic ivpusic force-pushed the sim/evm-defi-positions branch 2 times, most recently from 747053a to 9daf3f4 Compare March 13, 2026 16:31
@ivpusic ivpusic changed the base branch from sim/evm-defi-positions to graphite-base/38 March 13, 2026 16:34
@ivpusic ivpusic changed the base branch from graphite-base/38 to main March 13, 2026 16:35
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