Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions apps/explorer/src/routes/_layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import UserIcon from '~icons/lucide/user'
import ZapIcon from '~icons/lucide/zap'

const SPOTLIGHT_DATA: Record<
number,
string,
Comment on lines 24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

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

The type Record<string, {...}> is too permissive and won't catch type errors when accessing SPOTLIGHT_DATA with invalid keys. Consider using a more specific type that matches the actual keys:

Suggested change
const SPOTLIGHT_DATA: Record<
number,
string,
const SPOTLIGHT_DATA: Record<
'testnet' | 'moderato',

This would make it clear that only 'testnet' and 'moderato' have spotlight data, and TypeScript would catch any attempts to access other keys without proper undefined checks.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/explorer/src/routes/_layout/index.tsx
Line: 24:25

Comment:
The type `Record<string, {...}>` is too permissive and won't catch type errors when accessing SPOTLIGHT_DATA with invalid keys. Consider using a more specific type that matches the actual keys:

```suggestion
const SPOTLIGHT_DATA: Record<
	'testnet' | 'moderato',
```

This would make it clear that only 'testnet' and 'moderato' have spotlight data, and TypeScript would catch any attempts to access other keys without proper undefined checks.

How can I resolve this? If you propose a fix, please make it concise.

{
accountAddress: Address.Address
contractAddress: Address.Address
Expand All @@ -32,7 +32,7 @@ const SPOTLIGHT_DATA: Record<
mintHash: Hex.Hex
}
> = {
42429: {
testnet: {
accountAddress: '0x5bc1473610754a5ca10749552b119df90c1a1877',
contractAddress: '0xe4b10A2a727D0f4863CEBca743a8dAb84cf65b2d',
receiptHash:
Expand All @@ -44,7 +44,7 @@ const SPOTLIGHT_DATA: Record<
mintHash:
'0xe5c909ef42674965a8b805118f08b58f215a98661838ae187737841531097b70',
},
42431: {
moderato: {
accountAddress: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
contractAddress: '0x0cb37634841784a6ef44aeba9bd6cf82c7143f86',
receiptHash:
Expand All @@ -58,8 +58,7 @@ const SPOTLIGHT_DATA: Record<
},
}

const chainId = Number(import.meta.env.VITE_TEMPO_CHAIN_ID)
const spotlightData = SPOTLIGHT_DATA[chainId]
const spotlightData = SPOTLIGHT_DATA[import.meta.env.VITE_TEMPO_ENV]

export const Route = createFileRoute('/_layout/')({
component: Component,
Expand Down