Skip to content

Commit f62d650

Browse files
Fix merkle proof generation to exclude zero-amount shares
The API endpoint was including all distribution shares when generating merkle proofs, while the merkle tree generator script filters out zero-amount shares. This mismatch caused "invalid merkle proof" errors when users tried to claim tokens. Add .gt('amount', 0) filter to the API endpoint to match the script and ensure both generate identical merkle trees.
1 parent 6b4b0f5 commit f62d650

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/api/src/routers/distribution.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const distributionRouter = createTRPCRouter({
2323
.from('distribution_shares')
2424
.select('index, address, amount::text, user_id', { count: 'exact' })
2525
.eq('distribution_id', distributionId)
26+
.gt('amount', 0)
2627
.order('index', { ascending: true })
2728
)
2829

0 commit comments

Comments
 (0)