Skip to content

Commit

Permalink
Update aggregateChains.ts
Browse files Browse the repository at this point in the history
These changes:

- Fix a stylistic error in the property name.
- Make the code more robust when handling undefined values.
- Improve type safety.
  • Loading branch information
CreeptoGengar authored Dec 27, 2024
1 parent 57714e5 commit 42cf53f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions _api/src/aggregateChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const selectedChainProperties: (keyof Chain)[] = [
"apis",
"faucets",
"metadata",
"logo_URIs",
"logo_uris",
"bech32_prefix",
"network_type",
"evm_chain_id",
Expand All @@ -33,7 +33,9 @@ export function aggregateChainData(dirs: string[], outputFilePath: string) {
// Sort chains: layer 1 first, then by op bridge id
const sortChains = sortWith<Chain>([
descend((chain) => chain.metadata?.is_l1 || false),
ascend((chain) => chain.pretty_name ?? chain.chain_name),
ascend((chain) => {
return chain.pretty_name || chain.chain_name || ''
}),
])

writeJsonFile(outputFilePath, sortChains(chains))
Expand Down

0 comments on commit 42cf53f

Please sign in to comment.