Skip to content

Commit

Permalink
feat(local-blockchain.ts): reverse order of events fetched to display…
Browse files Browse the repository at this point in the history
… latest events first for better user experience
  • Loading branch information
MartinMinkov committed Feb 23, 2024
1 parent 24537f7 commit a922d89
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/mina/local-blockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ function LocalBlockchain({
);
},
async fetchEvents(publicKey: PublicKey, tokenId: Field = TokenId.default) {
return events?.[publicKey.toBase58()]?.[TokenId.toBase58(tokenId)] ?? [];
// Return events in reverse chronological order (latest events at the beginning)
const reversedEvents = (
events?.[publicKey.toBase58()]?.[TokenId.toBase58(tokenId)] ?? []
).reverse();
return reversedEvents;
},
async fetchActions(
publicKey: PublicKey,
Expand Down

0 comments on commit a922d89

Please sign in to comment.