Skip to content

Commit

Permalink
Sort assets by priority score (#1860)
Browse files Browse the repository at this point in the history
* Sort assets by priority score

* Revert logic in getAssetPriorityScore

* Add changeset
  • Loading branch information
JasonMHasperhoven authored Oct 24, 2024
1 parent 28d2682 commit 0745845
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-carpets-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'minifront': patch
---

Sort assets by priority score
4 changes: 3 additions & 1 deletion apps/minifront/src/fetchers/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { penumbra } from '../penumbra';

export const getAllAssets = async (): Promise<Metadata[]> => {
const responses = await Array.fromAsync(penumbra.service(ViewService).assets({}));
return responses.map(getDenomMetadata);
return responses
.map(getDenomMetadata)
.toSorted((a, b) => Number(b.priorityScore) - Number(a.priorityScore));
};

export const getAssetMetadataById = async (assetId: AssetId): Promise<Metadata | undefined> => {
Expand Down

0 comments on commit 0745845

Please sign in to comment.