Skip to content

Update SVM Balances to use metadata REFRESH MV#472

Merged
DenisCarriere merged 2 commits intomainfrom
fix/svm-balances
Apr 15, 2026
Merged

Update SVM Balances to use metadata REFRESH MV#472
DenisCarriere merged 2 commits intomainfrom
fix/svm-balances

Conversation

@DenisCarriere
Copy link
Copy Markdown
Contributor

This pull request refactors SQL queries across several routes to improve consistency, efficiency, and correctness in how metadata and decimals are joined and grouped. The main changes involve simplifying subqueries, ensuring deduplication of results, and aligning groupings and joins.

Query and Join Refactoring:

  • Replaced multiple subqueries and joins for metadata and decimals in src/routes/balances/svm.sql with simplified CTEs (metadata and decimals) that deduplicate by mint using LIMIT 1 BY mint, and updated the main query to join these new CTEs. [1] [2]
  • Updated the GROUP BY clause in the balances query to group by all selected columns using explicit table aliases, improving query correctness and readability.

Deduplication and Consistency:

  • Added LIMIT 1 BY mint to the metadata and decimals subqueries in both src/routes/swaps/svm.sql and src/routes/transfers/svm.sql to ensure only one row per mint is joined, preventing duplicate results. [1] [2]

@YaroShkvorets YaroShkvorets temporarily deployed to fix/svm-balances - token-api PR #472 April 15, 2026 17:01 — with Render Destroyed
@DenisCarriere DenisCarriere merged commit 607d737 into main Apr 15, 2026
2 of 3 checks passed
@DenisCarriere DenisCarriere deleted the fix/svm-balances branch April 15, 2026 17:01
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