Skip to content

Commit

Permalink
fix(torii/graphql): filter out tokens with zero balance (dojoengine#2769
Browse files Browse the repository at this point in the history
)

commit-id:11f63cc1

Co-authored-by: glihm <[email protected]>
  • Loading branch information
lambda-0x and glihm authored Dec 5, 2024
1 parent 90e2edd commit ea0973c
Showing 1 changed file with 7 additions and 1 deletion.
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 @@ async fn fetch_token_balances(
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(),
];

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

0 comments on commit ea0973c

Please sign in to comment.