Skip to content

Commit 829d1ae

Browse files
committed
wip
1 parent 7f8ec6e commit 829d1ae

File tree

7 files changed

+25
-15
lines changed

7 files changed

+25
-15
lines changed

apps/explorer/src/comps/ConnectWallet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export namespace ConnectWallet {
184184
passkeyStore.notify()
185185
}}
186186
>
187-
Try again
187+
Retry
188188
</button>
189189
</div>
190190
)

apps/explorer/src/comps/Contract.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ export function CollapsibleSection(props: {
129129
type="button"
130130
onClick={onToggle}
131131
className={cx(
132-
'flex items-center gap-[8px] h-full pl-[16px] cursor-pointer press-down focus-visible:-outline-offset-2! py-[6px]',
133-
actions ? 'pr-[12px]' : 'flex-1 pr-[16px]',
132+
'flex-1 flex items-center gap-[8px] h-full pl-[16px] cursor-pointer press-down focus-visible:-outline-offset-2! py-[6px]',
133+
actions ? 'pr-[12px]' : 'pr-[16px]',
134134
first && 'focus-visible:rounded-tl-[8px]!',
135135
first && !actions && 'focus-visible:rounded-tr-[8px]!',
136136
)}

apps/explorer/src/lib/domain/contract-source.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { isAddress } from 'viem'
44
import { useChainId } from 'wagmi'
55
import * as z from 'zod/mini'
66

7-
const CONTRACT_VERIFICATION_API_BASE_URL = import.meta.env
8-
.VITE_CONTRACT_VERIFY_URL
9-
107
const SoliditySettingsSchema = z.object({
118
remappings: z.optional(z.array(z.string())),
129
optimizer: z.optional(
@@ -74,13 +71,18 @@ export async function fetchContractSourceDirect(params: {
7471
const { address, chainId, signal } = params
7572

7673
const apiUrl = new URL(
77-
`${CONTRACT_VERIFICATION_API_BASE_URL}/${chainId}/${address.toLowerCase()}`,
74+
`${import.meta.env.VITE_CONTRACT_VERIFY_URL}/${chainId}/${address.toLowerCase()}`,
7875
)
7976
apiUrl.searchParams.set('fields', 'stdJsonInput,abi,compilation')
8077

8178
const response = await fetch(apiUrl.toString(), { signal })
8279

8380
if (!response.ok) {
81+
console.error(
82+
'Failed to fetch contract sources:',
83+
response.status,
84+
await response.text(),
85+
)
8486
throw new Error('Failed to fetch contract sources')
8587
}
8688

apps/explorer/src/routes/_layout/address/$address.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,7 @@ export const Route = createFileRoute('/_layout/address/$address')({
334334
contractSource = await fetchContractSourceDirect({
335335
address,
336336
chainId,
337-
}).catch((error) => {
338-
console.error('[loader] Failed to load contract source:', error)
339-
return undefined
340-
})
337+
}).catch(() => undefined)
341338
// Seed the query cache so client hydrates with data already available
342339
if (contractSource)
343340
context.queryClient.setQueryData(

apps/explorer/src/routes/api/code.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import * as z from 'zod/mini'
55
import { ContractVerificationLookupSchema } from '#lib/domain/contract-source.ts'
66
import { zAddress } from '#lib/zod.ts'
77

8-
const CONTRACT_VERIFICATION_API_BASE_URL = import.meta.env
9-
.VITE_CONTRACT_VERIFY_URL
8+
const CONTRACT_VERIFY_URL = import.meta.env.VITE_CONTRACT_VERIFY_URL
109

1110
const SHIKI_THEMES = {
1211
light: 'github-light',
@@ -104,7 +103,7 @@ export const Route = createFileRoute('/api/code')({
104103
)
105104

106105
const apiUrl = new URL(
107-
`${CONTRACT_VERIFICATION_API_BASE_URL}/${parsedSearchParams.chainid}/${parsedSearchParams.address.toLowerCase()}`,
106+
`${CONTRACT_VERIFY_URL}/${parsedSearchParams.chainid}/${parsedSearchParams.address.toLowerCase()}`,
108107
)
109108
apiUrl.searchParams.set('fields', 'stdJsonInput,abi,compilation')
110109
const response = await fetch(apiUrl.toString())

apps/explorer/src/routes/api/webauthn/$.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import { env } from 'cloudflare:workers'
22
import { createFileRoute } from '@tanstack/react-router'
33
import { Handler, Kv } from 'tempo.ts/server'
44

5+
const kv = env.EXPLORER_PASSKEY_STORE
6+
? Kv.cloudflare(env.EXPLORER_PASSKEY_STORE)
7+
: Kv.memory()
8+
59
const handler = ({ request }: { request: Request }) =>
610
Handler.keyManager({
711
path: '/api/webauthn',
8-
kv: Kv.cloudflare(env.EXPLORER_PASSKEY_STORE),
12+
kv,
913
}).fetch(request)
1014

1115
export const Route = createFileRoute('/api/webauthn/$')({

apps/explorer/vite.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ export default defineConfig((config) => {
116116
'import.meta.env.VITE_ENABLE_DEMO': JSON.stringify(
117117
env.VITE_ENABLE_DEMO ?? 'true',
118118
),
119+
'import.meta.env.VITE_CONTRACT_VERIFY_URL': JSON.stringify(
120+
wranglerVars.VITE_CONTRACT_VERIFY_URL ||
121+
env.VITE_CONTRACT_VERIFY_URL ||
122+
'',
123+
),
124+
'import.meta.env.VITE_OG_URL': JSON.stringify(
125+
wranglerVars.VITE_OG_URL || env.VITE_OG_URL || '',
126+
),
119127
},
120128
}
121129
})

0 commit comments

Comments
 (0)