Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(torii/graphql): filter out tokens with zero balance #2769

Merged
merged 2 commits into from
Dec 5, 2024
Merged
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
8 changes: 7 additions & 1 deletion crates/torii/graphql/src/object/erc/token_balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@
JOIN tokens t ON b.token_id = t.id
JOIN contracts c ON t.contract_address = c.contract_address"
);
let mut conditions = vec!["(b.account_address = ?)".to_string()];

// Only select balances for the given account address and non-zero balances.
let mut conditions = vec![
"(b.account_address = ?)".to_string(),
"b.balance != '0x0000000000000000000000000000000000000000000000000000000000000000'"
.to_string(),
];

Check warning on line 112 in crates/torii/graphql/src/object/erc/token_balance.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/graphql/src/object/erc/token_balance.rs#L106-L112

Added lines #L106 - L112 were not covered by tests

let mut cursor_param = &connection.after;
if let Some(after_cursor) = &connection.after {
Expand Down
Loading