Skip to content

Surface some commitment data#5

Merged
cxkoda merged 2 commits intomainfrom
01-26-show_commitment_data
Jan 27, 2026
Merged

Surface some commitment data#5
cxkoda merged 2 commits intomainfrom
01-26-show_commitment_data

Conversation

@WillSewell
Copy link
Copy Markdown
Collaborator

@WillSewell WillSewell commented Jan 27, 2026

Screenshot 2026-01-27 at 13.59.02.png

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@WillSewell WillSewell marked this pull request as ready for review January 27, 2026 13:59
@WillSewell WillSewell force-pushed the 01-26-show_commitment_data branch from de6df10 to 8aee18d Compare January 27, 2026 14:04
Copy link
Copy Markdown
Contributor

@cxkoda cxkoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just minor

Comment on lines +20 to +35
const walletTotals = new Map<Hex, bigint>();
for (const item of amounts) {
const current = walletTotals.get(item.Wallet) ?? BigInt(0);
walletTotals.set(item.Wallet, current + BigInt(item.Amount));
}

let topWallet = amounts[0].Wallet;
let topAmount = BigInt(0);
for (const [wallet, amount] of walletTotals) {
if (amount > topAmount) {
topAmount = amount;
topWallet = wallet;
}
}

return topWallet;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit non-idiomatic. why not just .sort + taking the last? or something with .reduce?

return amounts.reduce((sum, item) => sum + BigInt(item.Amount), BigInt(0));
}

function findTopWallet(amounts: WalletTokenAmount[]): Hex {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should maybe discourage showing the address and just use the entity ID instead?

@cxkoda cxkoda merged commit 6ad1387 into main Jan 27, 2026
2 checks passed
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